コード例 #1
0
        /// <summary>
        /// Fetch an instance of a short code
        /// </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));
        }
コード例 #2
0
        /// <summary>
        /// Fetch an instance of a short code
        /// </summary>
        /// <param name="pathSid"> The unique string that identifies this resource </param>
        /// <param name="pathAccountSid"> The SID of the Account that created the resource(s) to fetch </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ShortCode </returns>
        public static ShortCodeResource Fetch(string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchShortCodeOptions(pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Fetch(options, client));
        }
コード例 #3
0
 private static Request BuildFetchRequest(FetchShortCodeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/SMS/ShortCodes/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }
コード例 #4
0
        /// <summary>
        /// Fetch an instance of a short code
        /// </summary>
        ///
        /// <param name="pathSid"> Fetch by unique short-code Sid </param>
        /// <param name="pathAccountSid"> The account_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 pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchShortCodeOptions(pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(await FetchAsync(options, client));
        }
コード例 #5
0
        /// <summary>
        /// Fetch an instance of a short code
        /// </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));
        }