/// <summary>
        /// Create a new Entity for the Service
        /// </summary>
        /// <param name="options"> Create Entity parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Entity </returns>
        public static EntityResource Create(CreateEntityOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Create a new Entity for the Service
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="identity"> Unique identity of the Entity </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Entity </returns>
        public static async System.Threading.Tasks.Task <EntityResource> CreateAsync(string pathServiceSid,
                                                                                     string identity,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateEntityOptions(pathServiceSid, identity);

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Create a new Entity for the Service
        /// </summary>
        /// <param name="options"> Create Entity parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Entity </returns>
        public static async System.Threading.Tasks.Task <EntityResource> CreateAsync(CreateEntityOptions options,
                                                                                     ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateEntityOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Authy,
                "/v1/Services/" + options.PathServiceSid + "/Entities",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Create a new Entity for the Service
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="identity"> Unique identity of the Entity </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Entity </returns>
        public static EntityResource Create(string pathServiceSid, string identity, ITwilioRestClient client = null)
        {
            var options = new CreateEntityOptions(pathServiceSid, identity);

            return(Create(options, client));
        }