/// <summary> /// Get a report for specific delivery status of a message you have sent. /// </summary> /// <param name="id">message id</param> /// <param name="status">delivery status to sort by</param> /// <returns>list of possible phone numbers which have given status</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public IList <long?> GetDetailedReport(long id, DeliveryStatus status) { var path = DetailedReportPath.ReplaceFirst(ClientConstants.Placeholder, id.ToString()); var queryParams = ClientUtils.AsParams("status", status.EnumMemberAttr()); return(_client.Get <long?>(path, queryParams).Entries); }
/// <summary> /// Get the wireless carrier of a valid mobile phone number (US and Canada) /// </summary> /// <param name="phoneNumber">phone number</param> /// <returns>the wireless carrier of a valid mobile phone number (US and Canada)</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public CarrierLookupResponse CarrierLookup(string phoneNumber) { Validate.NotBlank(phoneNumber, "phoneNumber cannot be blank"); var queryParams = ClientUtils.AsParams("PhoneNumber", phoneNumber); var path = CarrierLookupPath.ReplaceFirst(ClientConstants.Placeholder, phoneNumber); return(_client.Get <CarrierLookupResponse>(path, queryParams).Entry); }
/// <summary> /// Rents a Keyword for use on Ez Texting's short code in the country your account is set to send messages to. /// You may rent a Keyword using a credit card you have stored in your Ez Texting account, or you may pass credit /// card details when you call the API. /// </summary> /// <param name="keyword">keyword for rent</param> /// <param name="ccNumber">ast four digits of any card stored in your Ez Texting account.</param> /// <returns>keyword</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public Keyword Rent(string keyword, string ccNumber) { Validate.NotBlank(keyword, "keyword cannot be blank"); Validate.NotBlank(ccNumber, "ccNumber cannot be blank"); var queryParams = ClientUtils.AsParams("Keyword", keyword, "StoredCreditCard", ccNumber); return(_client.Post <Keyword>(KeywordsPath, queryParams).Entry); }
/// <summary> /// Create a new folder that will be stored in your Ez Texting account /// </summary> /// <param name="name">the name of the folder</param> /// <returns>created folder</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public Folder CreateFolder(string name) { Validate.NotBlank(name, "name cannot be blank"); var queryParams = ClientUtils.AsParams("Name", name); var folder = _client.Post <Folder>(FoldersPath, queryParams).Entry; // API returns only id, so setting name folder.Name = name; return(folder); }
/// <summary> /// Check whether a Keyword is available to rent on Ez Texting's short code. Please note, we will check /// availability for the country your account is set to. /// </summary> /// <param name="keyword">keyword to check</param> /// <returns>true if keyword is available to rent, otherwise false returned</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public bool CheckAvailability(string keyword) { Validate.NotBlank(keyword, "keyword cannot be blank"); // TODO ugly code, have to wait api fixes try { var queryParams = ClientUtils.AsParams("Keyword", keyword); var path = CheckAvailabilityPath.ReplaceFirst(ClientConstants.Placeholder, keyword); var avail = _client.Get <CheckAvailabilityResponse>(path, queryParams).Entry.Available; return(avail != null && avail.Value); } catch (EzTextingApiException e) { if (e.Errors != null && e.Errors.Contains($"Keyword: The keyword '{keyword}' is unavailable")) { return(false); } throw; } }
/// <summary> /// Create a new mediafile that will be stored in your Ez Texting media library /// </summary> /// <param name="url">url to download file</param> /// <returns>created media file object</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public MediaFile Create(string url) { return(_client.Post <MediaFile>(FilesPath, ClientUtils.AsParams("Source", url)).Entry); }
/// <summary> /// Rents a Keyword for use on Ez Texting's short code in the country your account is set to send messages to. /// You may rent a Keyword using a credit card you have stored in your Ez Texting account, or you may pass credit /// card details when you call the API. /// </summary> /// <param name="keyword">keyword for rent</param> /// <param name="creditCard">credit card for payment</param> /// <returns>keyword</returns> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public Keyword Rent(string keyword, CreditCard creditCard) { Validate.NotBlank(keyword, "keyword cannot be blank"); return(_client.Post <Keyword>(KeywordsPath, creditCard, ClientUtils.AsParams("Keyword", keyword)).Entry); }
/// <summary> /// Moves an incoming text messages in your Ez Texting Inbox to a specified folder. /// </summary> /// <param name="ids">list with message ids</param> /// <param name="folderId">destination folder's id</param> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public void MoveMessages(IList <long> ids, long folderId) { Validate.NotNull(ids, "ids"); _client.Post <object>(MoveMessagePath, ClientUtils.AsParams("ID", ids, "FolderID", folderId)); }
/// <summary> /// Moves an incoming text message in your Ez Texting Inbox to a specified folder. /// </summary> /// <param name="id">message's id</param> /// <param name="folderId">destination folder's id</param> /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception> /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception> public void MoveMessage(long id, long folderId) { _client.Post <object>(MoveMessagePath, ClientUtils.AsParams("ID", id, "FolderID", folderId)); }