Ejemplo n.º 1
0
        /// <summary>
        /// Create 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>
        /// Create a new Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="dateExpiry"> The date this Session was expiry </param>
        /// <param name="ttl"> TTL for a Session, in seconds. </param>
        /// <param name="status"> The Status of this Session </param>
        /// <param name="participants"> A list of phone numbers to add to this Session. </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, DateTime?dateExpiry = null, int?ttl = null, SessionResource.StatusEnum status = null, List <string> participants = null, ITwilioRestClient client = null)
        {
            var options = new CreateSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, DateExpiry = dateExpiry, Ttl = ttl, Status = status, Participants = participants
            };

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new Session
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="dateExpiry"> The date this Session was expiry </param>
        /// <param name="ttl"> TTL for a Session, in seconds. </param>
        /// <param name="status"> The Status of this Session </param>
        /// <param name="participants"> A list of phone numbers to add to this Session. </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, DateTime?dateExpiry = null, int?ttl = null, SessionResource.StatusEnum status = null, List <string> participants = null, ITwilioRestClient client = null)
        {
            var options = new CreateSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, DateExpiry = dateExpiry, Ttl = ttl, Status = status, Participants = participants
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateSessionOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Proxy,
                "/v1/Services/" + options.PathServiceSid + "/Sessions",
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a new Session
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the parent Service resource </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the resource </param>
        /// <param name="dateExpiry"> The ISO 8601 date when the Session should expire </param>
        /// <param name="ttl"> When the session will expire </param>
        /// <param name="mode"> The Mode of the Session </param>
        /// <param name="status"> Session status </param>
        /// <param name="participants"> The Participant objects to include in the new session </param>
        /// <param name="failOnParticipantConflict"> An experimental parameter to override the ProxyAllowParticipantConflict
        ///                                 account flag on a per-request basis. </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,
                                             DateTime?dateExpiry               = null,
                                             int?ttl                           = null,
                                             SessionResource.ModeEnum mode     = null,
                                             SessionResource.StatusEnum status = null,
                                             List <object> participants        = null,
                                             bool?failOnParticipantConflict    = null,
                                             ITwilioRestClient client          = null)
        {
            var options = new CreateSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, DateExpiry = dateExpiry, Ttl = ttl, Mode = mode, Status = status, Participants = participants, FailOnParticipantConflict = failOnParticipantConflict
            };

            return(Create(options, client));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create 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));
        }