Exemplo n.º 1
0
        /// <summary>
        /// Fetch a message belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="options"> Fetch Message parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Message </returns>
        public static async System.Threading.Tasks.Task <MessageResource> FetchAsync(FetchMessageOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fetch a message belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="options"> Fetch Message parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Fetch(FetchMessageOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Fetch a message belonging to the account used to make the request
 /// </summary>
 /// <param name="pathSid"> The unique string that identifies the resource </param>
 /// <param name="pathAccountSid"> The SID of the Account that created the resource to fetch </param>
 /// <param name="client"> Client to make requests to Twilio </param>
 /// <returns> Task that resolves to A single instance of Message </returns>
 public static async System.Threading.Tasks.Task<MessageResource> FetchAsync(string pathSid,
                                                                             string pathAccountSid = null,
                                                                             ITwilioRestClient client = null)
 {
     var options = new FetchMessageOptions(pathSid){PathAccountSid = pathAccountSid};
     return await FetchAsync(options, client);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fetch a message belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="pathSid"> Fetch by unique message Sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Fetch(string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchMessageOptions(pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Fetch(options, client));
        }
Exemplo n.º 5
0
 private static Request BuildFetchRequest(FetchMessageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }