/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Conversation parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Conversation </returns>
        public static ConversationResource Create(CreateConversationOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Esempio n. 2
0
 private static Request BuildCreateRequest(CreateConversationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Conversations,
                "/v1/Conversations",
                postParams: options.GetParams()
                ));
 }
Esempio n. 3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> The human-readable name of this conversation. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="messagingServiceSid"> The unique id of the SMS Service this conversation belongs to. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Conversation </returns>
        public static ConversationResource Create(string friendlyName        = null,
                                                  DateTime?dateCreated       = null,
                                                  DateTime?dateUpdated       = null,
                                                  string messagingServiceSid = null,
                                                  ITwilioRestClient client   = null)
        {
            var options = new CreateConversationOptions()
            {
                FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid
            };

            return(Create(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> The human-readable name of this conversation. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="messagingServiceSid"> The unique id of the SMS Service this conversation belongs to. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Conversation </returns>
        public static async System.Threading.Tasks.Task <ConversationResource> CreateAsync(string friendlyName        = null,
                                                                                           DateTime?dateCreated       = null,
                                                                                           DateTime?dateUpdated       = null,
                                                                                           string messagingServiceSid = null,
                                                                                           ITwilioRestClient client   = null)
        {
            var options = new CreateConversationOptions()
            {
                FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid
            };

            return(await CreateAsync(options, client));
        }
Esempio n. 5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> The human-readable name of this conversation. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="messagingServiceSid"> The unique id of the SMS Service this conversation belongs to. </param>
        /// <param name="attributes"> An optional string metadata field you can use to store any data you wish. </param>
        /// <param name="state"> Current state of this conversation. </param>
        /// <param name="timersInactive"> ISO8601 duration when conversation will be switched to `inactive` state. </param>
        /// <param name="timersClosed"> ISO8601 duration when conversation will be switched to `closed` state. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Conversation </returns>
        public static async System.Threading.Tasks.Task <ConversationResource> CreateAsync(string friendlyName                  = null,
                                                                                           DateTime?dateCreated                 = null,
                                                                                           DateTime?dateUpdated                 = null,
                                                                                           string messagingServiceSid           = null,
                                                                                           string attributes                    = null,
                                                                                           ConversationResource.StateEnum state = null,
                                                                                           string timersInactive                = null,
                                                                                           string timersClosed                  = null,
                                                                                           ITwilioRestClient client             = null)
        {
            var options = new CreateConversationOptions()
            {
                FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> The human-readable name of this conversation. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="messagingServiceSid"> The unique id of the SMS Service this conversation belongs to. </param>
        /// <param name="attributes"> An optional string metadata field you can use to store any data you wish. </param>
        /// <param name="state"> Current state of this conversation. </param>
        /// <param name="timersInactive"> ISO8601 duration when conversation will be switched to `inactive` state. </param>
        /// <param name="timersClosed"> ISO8601 duration when conversation will be switched to `closed` state. </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 Conversation </returns>
        public static ConversationResource Create(string friendlyName                  = null,
                                                  DateTime?dateCreated                 = null,
                                                  DateTime?dateUpdated                 = null,
                                                  string messagingServiceSid           = null,
                                                  string attributes                    = null,
                                                  ConversationResource.StateEnum state = null,
                                                  string timersInactive                = null,
                                                  string timersClosed                  = null,
                                                  ConversationResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateConversationOptions()
            {
                FriendlyName = friendlyName, DateCreated = dateCreated, DateUpdated = dateUpdated, MessagingServiceSid = messagingServiceSid, Attributes = attributes, State = state, TimersInactive = timersInactive, TimersClosed = timersClosed, XTwilioWebhookEnabled = xTwilioWebhookEnabled
            };

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

            return(FromJson(response.Content));
        }