Beispiel #1
0
        /// <summary>
        /// Add a new conversation user to your service
        /// </summary>
        /// <param name="options"> Create User parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of User </returns>
        public static async System.Threading.Tasks.Task <UserResource> CreateAsync(CreateUserOptions options,
                                                                                   ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Beispiel #2
0
 private static Request BuildCreateRequest(CreateUserOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Conversations,
                "/v1/Services/" + options.PathChatServiceSid + "/Users",
                postParams: options.GetParams(),
                headerParams: options.GetHeaderParams()
                ));
 }
Beispiel #3
0
        /// <summary>
        /// Add a new conversation user to your service
        /// </summary>
        /// <param name="pathChatServiceSid"> The SID of the Conversation Service that the resource is associated with </param>
        /// <param name="identity"> The string that identifies the resource's User </param>
        /// <param name="friendlyName"> The string that you assigned to describe the resource </param>
        /// <param name="attributes"> The JSON Object string that stores application-specific data </param>
        /// <param name="roleSid"> The SID of a service-level Role to assign to the user </param>
        /// <param name="xTwilioWebhookEnabled"> The X-Twilio-Webhook-Enabled HTTP request header </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of User </returns>
        public static UserResource Create(string pathChatServiceSid,
                                          string identity,
                                          string friendlyName = null,
                                          string attributes   = null,
                                          string roleSid      = null,
                                          UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null,
                                          ITwilioRestClient client = null)
        {
            var options = new CreateUserOptions(pathChatServiceSid, identity)
            {
                FriendlyName = friendlyName, Attributes = attributes, RoleSid = roleSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled
            };

            return(Create(options, client));
        }
Beispiel #4
0
        /// <summary>
        /// Add a new conversation user to your service
        /// </summary>
        /// <param name="pathChatServiceSid"> The SID of the Conversation Service that the resource is associated with </param>
        /// <param name="identity"> The string that identifies the resource's User </param>
        /// <param name="friendlyName"> The string that you assigned to describe the resource </param>
        /// <param name="attributes"> The JSON Object string that stores application-specific data </param>
        /// <param name="roleSid"> The SID of a service-level Role to assign to the user </param>
        /// <param name="xTwilioWebhookEnabled"> The X-Twilio-Webhook-Enabled HTTP request header </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of User </returns>
        public static async System.Threading.Tasks.Task <UserResource> CreateAsync(string pathChatServiceSid,
                                                                                   string identity,
                                                                                   string friendlyName = null,
                                                                                   string attributes   = null,
                                                                                   string roleSid      = null,
                                                                                   UserResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null,
                                                                                   ITwilioRestClient client = null)
        {
            var options = new CreateUserOptions(pathChatServiceSid, identity)
            {
                FriendlyName = friendlyName, Attributes = attributes, RoleSid = roleSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled
            };

            return(await CreateAsync(options, client));
        }