Ejemplo n.º 1
0
        /// <summary>
        /// Start a new Session
        /// </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));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Start a new Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="ttl"> How long will this session stay open, in seconds. </param>
        /// <param name="status"> The Status of this Session </param>
        /// <param name="participants"> The participants </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 pathServiceSid, string uniqueName = null, int?ttl = null, SessionResource.StatusEnum status = null, List <string> participants = null, ITwilioRestClient client = null)
        {
            var options = new CreateSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, Ttl = ttl, Status = status, Participants = participants
            };

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Start a new Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="ttl"> How long will this session stay open, in seconds. </param>
        /// <param name="status"> The Status of this Session </param>
        /// <param name="participants"> The participants </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Session </returns>
        public static SessionResource Create(string pathServiceSid, string uniqueName = null, int?ttl = null, SessionResource.StatusEnum status = null, List <string> participants = null, ITwilioRestClient client = null)
        {
            var options = new CreateSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, Ttl = ttl, Status = status, Participants = participants
            };

            return(Create(options, client));
        }
Ejemplo n.º 4
0
 private static Request BuildCreateRequest(CreateSessionOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/Proxy/Services/" + options.PathServiceSid + "/Sessions",
                client.Region,
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Start a new Session
        /// </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));
        }