コード例 #1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Participant parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Participant </returns>
        public static ParticipantResource Create(CreateParticipantOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
コード例 #2
0
 private static Request BuildCreateRequest(CreateParticipantOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Messaging,
                "/v1/Sessions/" + options.PathSessionSid + "/Participants",
                client.Region,
                postParams: options.GetParams()
                ));
 }
コード例 #3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathSessionSid"> The SID of the Session for the participant </param>
        /// <param name="identity"> The string that identifies the resource's User </param>
        /// <param name="userAddress"> The address of the participant's device </param>
        /// <param name="attributes"> A JSON string that stores application-specific data </param>
        /// <param name="twilioAddress"> The address of the Twilio phone number that the participant is in contact with </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="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Participant </returns>
        public static ParticipantResource Create(string pathSessionSid,
                                                 string identity          = null,
                                                 string userAddress       = null,
                                                 string attributes        = null,
                                                 string twilioAddress     = null,
                                                 DateTime?dateCreated     = null,
                                                 DateTime?dateUpdated     = null,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreateParticipantOptions(pathSessionSid)
            {
                Identity = identity, UserAddress = userAddress, Attributes = attributes, TwilioAddress = twilioAddress, DateCreated = dateCreated, DateUpdated = dateUpdated
            };

            return(Create(options, client));
        }
コード例 #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathSessionSid"> The SID of the Session for the participant </param>
        /// <param name="identity"> The string that identifies the resource's User </param>
        /// <param name="userAddress"> The address of the participant's device </param>
        /// <param name="attributes"> A JSON string that stores application-specific data </param>
        /// <param name="twilioAddress"> The address of the Twilio phone number that the participant is in contact with </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="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Participant </returns>
        public static async System.Threading.Tasks.Task <ParticipantResource> CreateAsync(string pathSessionSid,
                                                                                          string identity          = null,
                                                                                          string userAddress       = null,
                                                                                          string attributes        = null,
                                                                                          string twilioAddress     = null,
                                                                                          DateTime?dateCreated     = null,
                                                                                          DateTime?dateUpdated     = null,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreateParticipantOptions(pathSessionSid)
            {
                Identity = identity, UserAddress = userAddress, Attributes = attributes, TwilioAddress = twilioAddress, DateCreated = dateCreated, DateUpdated = dateUpdated
            };

            return(await CreateAsync(options, client));
        }
コード例 #5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Participant parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Participant </returns>
        public static async System.Threading.Tasks.Task <ParticipantResource> CreateAsync(CreateParticipantOptions options,
                                                                                          ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }