/// <summary> /// Creates a PhaxCode and returns an identifier for the barcode image. /// </summary> /// <param name="metadata">Metadata to associate with this code.</param> /// <returns>A PhaxCode object.</returns> public PhaxCode Create(string metadata) { Action <IRestRequest> addParameters = req => { req.AddParameter("metadata", metadata); }; return(client.request <PhaxCode>("phax_codes.json", Method.POST, true, addParameters).Data); }
/// <summary> /// Sends a fax /// </summary> /// <param name="options">A dictionary representing all the parameters for the fax. See the Phaxio documentation for the exact parameter names.</param> /// <returns>a string representing a fax id.</returns> public Fax Create(Dictionary <string, object> options) { Action <IRestRequest> requestModifier = req => { foreach (var option in options) { req.AddParameter(option.Key, option.Value); } }; return(context.request <Fax>("faxes", Method.POST, true, requestModifier).Data); }
/// <summary> /// Provisions a new fax number /// </summary> /// <param name="countryCode">The country code to provsion the number in.</param> /// <param name="areaCode">The area code to provsion the number in.</param> /// <param name="callbackUrl">The URL that Phaxio will post to when a fax is recieved at this number.</param> /// <returns>A PhoneNumber object representing the new number.</returns> public PhoneNumber Create(string areaCode, string countryCode, string callbackUrl = null) { Action <IRestRequest> addParameters = req => { req.AddParameter("country_code", countryCode); req.AddParameter("area_code", areaCode); if (callbackUrl != null) { req.AddParameter("callback_url", callbackUrl); } }; return(client.request <PhoneNumber>("phone_numbers", Method.POST, true, addParameters).Data); }
/// <summary> /// Resends this fax /// </summary> /// <param name="callbackUrl">The URL to send the callback to.</param> public void Resend(string callbackUrl = null) { Action <IRestRequest> addParameters = req => { if (callbackUrl != null) { req.AddParameter("callback_url", callbackUrl); } }; PhaxioClient.request <Object>("faxes/" + Id + "/resend", Method.POST, true, addParameters).ToResult(); }
/// <summary> /// Deletes this fax /// </summary> public void Delete() { PhaxioClient.request <Object>("faxes/" + Id, Method.DELETE).ToResult(); }
/// <summary> /// Cancels this fax /// </summary> public void Cancel() { PhaxioClient.request <Object>("faxes/" + Id + "/cancel", Method.POST).ToResult(); }
/// <summary> /// Releases a number /// </summary> public void Release() { PhaxioClient.request <Object>("phone_numbers/" + Number, Method.DELETE); }