Ejemplo n.º 1
0
        /// <summary>
        /// Fetch a shortcode belonging to this service
        /// </summary>
        /// <param name="options"> Fetch ShortCode parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ShortCode </returns>
        public static ShortCodeResource Fetch(FetchShortCodeOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fetch a shortcode belonging to this service
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathSid"> Fetch by unique shortcode Sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of ShortCode </returns>
        public static async System.Threading.Tasks.Task <ShortCodeResource> FetchAsync(string pathServiceSid,
                                                                                       string pathSid,
                                                                                       ITwilioRestClient client = null)
        {
            var options = new FetchShortCodeOptions(pathServiceSid, pathSid);

            return(await FetchAsync(options, client));
        }
Ejemplo n.º 3
0
 private static Request BuildFetchRequest(FetchShortCodeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Preview,
                "/Proxy/Services/" + options.PathServiceSid + "/ShortCodes/" + options.PathSid + "",
                client.Region,
                queryParams: options.GetParams()
                ));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Fetch a shortcode belonging to this service
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathSid"> Fetch by unique shortcode Sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ShortCode </returns>
        public static ShortCodeResource Fetch(string pathServiceSid, string pathSid, ITwilioRestClient client = null)
        {
            var options = new FetchShortCodeOptions(pathServiceSid, pathSid);

            return(Fetch(options, client));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Fetch a shortcode belonging to this service
        /// </summary>
        /// <param name="options"> Fetch ShortCode parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of ShortCode </returns>
        public static async System.Threading.Tasks.Task <ShortCodeResource> FetchAsync(FetchShortCodeOptions options,
                                                                                       ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }