/// <summary>
        /// Removes User from selected Channel.
        /// </summary>
        /// <param name="options"> Delete UserChannel parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of UserChannel </returns>
        public static bool Delete(DeleteUserChannelOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Removes User from selected Channel.
        /// </summary>
        /// <param name="options"> Delete UserChannel parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of UserChannel </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(DeleteUserChannelOptions options,
                                                                           ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Removes User from selected Channel.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the resources from </param>
        /// <param name="pathUserSid"> The SID of the User to fetch the User Channel resources from </param>
        /// <param name="pathChannelSid"> The SID of the Channel the resource belongs to </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of UserChannel </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(string pathServiceSid,
                                                                           string pathUserSid,
                                                                           string pathChannelSid,
                                                                           ITwilioRestClient client = null)
        {
            var options = new DeleteUserChannelOptions(pathServiceSid, pathUserSid, pathChannelSid);

            return(await DeleteAsync(options, client));
        }
        /// <summary>
        /// Removes User from selected Channel.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the resources from </param>
        /// <param name="pathUserSid"> The SID of the User to fetch the User Channel resources from </param>
        /// <param name="pathChannelSid"> The SID of the Channel the resource belongs to </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of UserChannel </returns>
        public static bool Delete(string pathServiceSid,
                                  string pathUserSid,
                                  string pathChannelSid,
                                  ITwilioRestClient client = null)
        {
            var options = new DeleteUserChannelOptions(pathServiceSid, pathUserSid, pathChannelSid);

            return(Delete(options, client));
        }
Esempio n. 5
0
 private static Request BuildDeleteRequest(DeleteUserChannelOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Delete,
                Rest.Domain.Chat,
                "/v2/Services/" + options.PathServiceSid + "/Users/" + options.PathUserSid + "/Channels/" + options.PathChannelSid + "",
                queryParams: options.GetParams()
                ));
 }