Пример #1
0
        /// <summary>
        /// Create a new End User.
        /// </summary>
        /// <param name="options"> Create EndUser parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of EndUser </returns>
        public static EndUserResource Create(CreateEndUserOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Пример #2
0
 private static Request BuildCreateRequest(CreateEndUserOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Trusthub,
                "/v1/EndUsers",
                postParams: options.GetParams(),
                headerParams: null
                ));
 }
Пример #3
0
        /// <summary>
        /// Create a new End User.
        /// </summary>
        /// <param name="friendlyName"> The string that you assigned to describe the resource </param>
        /// <param name="type"> The type of end user of the Bundle resource </param>
        /// <param name="attributes"> The set of parameters that compose the End User resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of EndUser </returns>
        public static async System.Threading.Tasks.Task <EndUserResource> CreateAsync(string friendlyName,
                                                                                      string type,
                                                                                      object attributes        = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateEndUserOptions(friendlyName, type)
            {
                Attributes = attributes
            };

            return(await CreateAsync(options, client));
        }
Пример #4
0
        /// <summary>
        /// Create a new End User.
        /// </summary>
        /// <param name="friendlyName"> The string that you assigned to describe the resource </param>
        /// <param name="type"> The type of end user of the Bundle resource </param>
        /// <param name="attributes"> The set of parameters that compose the End User resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of EndUser </returns>
        public static EndUserResource Create(string friendlyName,
                                             string type,
                                             object attributes        = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateEndUserOptions(friendlyName, type)
            {
                Attributes = attributes
            };

            return(Create(options, client));
        }
Пример #5
0
        /// <summary>
        /// Create a new End User.
        /// </summary>
        /// <param name="options"> Create EndUser parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of EndUser </returns>
        public static async System.Threading.Tasks.Task <EndUserResource> CreateAsync(CreateEndUserOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }