Exemplo n.º 1
0
 /// <summary>
 /// Create a new fax to send to a phone number or SIP endpoint.
 /// </summary>
 /// <param name="options"> Create Fax parameters </param>
 /// <param name="client"> Client to make requests to Twilio </param>
 /// <returns> Task that resolves to A single instance of Fax </returns>
 public static async System.Threading.Tasks.Task<FaxResource> CreateAsync(CreateFaxOptions options,
                                                                          ITwilioRestClient client = null)
 {
     client = client ?? TwilioClient.GetRestClient();
     var response = await client.RequestAsync(BuildCreateRequest(options, client));
     return FromJson(response.Content);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new fax to send to a phone number or SIP endpoint.
        /// </summary>
        /// <param name="options"> Create Fax parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Fax </returns>
        public static FaxResource Create(CreateFaxOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 3
0
 private static Request BuildCreateRequest(CreateFaxOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Fax,
                "/v1/Faxes",
                postParams: options.GetParams()
                ));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Create a new fax to send to a phone number or SIP endpoint
        /// </summary>
        ///
        /// <param name="to"> The phone number or SIP address to send the fax to </param>
        /// <param name="mediaUrl"> URL that points to the fax media </param>
        /// <param name="quality"> The quality of this fax </param>
        /// <param name="statusCallback"> URL for fax status callbacks </param>
        /// <param name="from"> Twilio number from which to originate the fax </param>
        /// <param name="sipAuthUsername"> Username for SIP authentication </param>
        /// <param name="sipAuthPassword"> Password for SIP authentication </param>
        /// <param name="storeMedia"> Whether or not to store media </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Fax </returns>
        public static async System.Threading.Tasks.Task <FaxResource> CreateAsync(string to, Uri mediaUrl, FaxResource.QualityEnum quality = null, Uri statusCallback = null, string from = null, string sipAuthUsername = null, string sipAuthPassword = null, bool?storeMedia = null, ITwilioRestClient client = null)
        {
            var options = new CreateFaxOptions(to, mediaUrl)
            {
                Quality = quality, StatusCallback = statusCallback, From = from, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, StoreMedia = storeMedia
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Create a new fax to send to a phone number or SIP endpoint.
 /// </summary>
 /// <param name="to"> The phone number to receive the fax </param>
 /// <param name="mediaUrl"> The URL of the PDF that contains the fax </param>
 /// <param name="quality"> The quality of this fax </param>
 /// <param name="statusCallback"> The URL we should call to send status information to your application </param>
 /// <param name="from"> The number the fax was sent from </param>
 /// <param name="sipAuthUsername"> The username for SIP authentication </param>
 /// <param name="sipAuthPassword"> The password for SIP authentication </param>
 /// <param name="storeMedia"> Whether to store a copy of the sent media </param>
 /// <param name="ttl"> How long in minutes to try to send the fax </param>
 /// <param name="client"> Client to make requests to Twilio </param>
 /// <returns> A single instance of Fax </returns>
 public static FaxResource Create(string to,
                                  Uri mediaUrl,
                                  FaxResource.QualityEnum quality = null,
                                  Uri statusCallback = null,
                                  string from = null,
                                  string sipAuthUsername = null,
                                  string sipAuthPassword = null,
                                  bool? storeMedia = null,
                                  int? ttl = null,
                                  ITwilioRestClient client = null)
 {
     var options = new CreateFaxOptions(to, mediaUrl){Quality = quality, StatusCallback = statusCallback, From = from, SipAuthUsername = sipAuthUsername, SipAuthPassword = sipAuthPassword, StoreMedia = storeMedia, Ttl = ttl};
     return Create(options, client);
 }