/// <summary> /// create /// </summary> /// <param name="options"> Create Session parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Session </returns> public static SessionResource Create(CreateSessionOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
private static Request BuildCreateRequest(CreateSessionOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Messaging, "/v1/Sessions", client.Region, postParams: options.GetParams() )); }
/// <summary> /// create /// </summary> /// <param name="messagingServiceSid"> The SID of the SMS Service the session belongs to </param> /// <param name="friendlyName"> A string to describe the resource </param> /// <param name="attributes"> A JSON string that stores application-specific data </param> /// <param name="dateCreated"> The ISO 8601 date and time in GMT when the resource was created </param> /// <param name="dateUpdated"> The ISO 8601 date and time in GMT when the resource was updated </param> /// <param name="createdBy"> The Identity of the session's creator </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Session </returns> public static async System.Threading.Tasks.Task <SessionResource> CreateAsync(string messagingServiceSid, string friendlyName = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string createdBy = null, ITwilioRestClient client = null) { var options = new CreateSessionOptions(messagingServiceSid) { FriendlyName = friendlyName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy }; return(await CreateAsync(options, client)); }
/// <summary> /// create /// </summary> /// <param name="messagingServiceSid"> The SID of the SMS Service the session belongs to </param> /// <param name="friendlyName"> A string to describe the resource </param> /// <param name="attributes"> A JSON string that stores application-specific data </param> /// <param name="dateCreated"> The ISO 8601 date and time in GMT when the resource was created </param> /// <param name="dateUpdated"> The ISO 8601 date and time in GMT when the resource was updated </param> /// <param name="createdBy"> The Identity of the session's creator </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Session </returns> public static SessionResource Create(string messagingServiceSid, string friendlyName = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string createdBy = null, ITwilioRestClient client = null) { var options = new CreateSessionOptions(messagingServiceSid) { FriendlyName = friendlyName, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, CreatedBy = createdBy }; return(Create(options, client)); }
/// <summary> /// create /// </summary> /// <param name="options"> Create Session parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Session </returns> public static async System.Threading.Tasks.Task <SessionResource> CreateAsync(CreateSessionOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }