/// <summary> /// Lists faxes with optional filters. /// </summary> /// <param name="createdBefore">The end of the range. Defaults to now.</param> /// <param name="createdAfter">The beginning of the range. Defaults to one week ago.</param> /// <param name="direction">Either 'sent' or 'received'.</param> /// <param name="status">The status to filter by.</param> /// <param name="phoneNumber">A phone number to filter by.</param> /// <param name="tagName">A tag name to filter by (you must specify a tag value as well).</param> /// <param name="tagValue">A tag value to filter by (you must specify a tag name as well).</param> /// <param name="perPage">The maximum number of results to return per call or "page" (1000 max).</param> /// <param name="page">The page number to return for the request. 1-based.</param> /// <returns>A IEnumerable<Fax></returns> public IEnumerable <Fax> List(DateTime?createdBefore = null, DateTime?createdAfter = null, string direction = null, string status = null, string phoneNumber = null, string tagName = null, string tagValue = null, int?perPage = null, int?page = null) { Action <IRestRequest> addParameters = req => { if (createdBefore != null) { req.AddParameter("created_before", createdBefore.Value.Rfc3339()); } if (createdAfter != null) { req.AddParameter("created_after", createdAfter.Value.Rfc3339()); } if (direction != null) { req.AddParameter("direction", direction); } if (status != null) { req.AddParameter("status", status); } if (phoneNumber != null) { req.AddParameter("phone_number", phoneNumber); } if (tagName != null) { if (tagValue == null) { throw new ArgumentException("You must supply a tag value if you specify a tag name."); } req.AddParameter("tag[" + tagName + "]", tagValue); } if (perPage != null) { req.AddParameter("per_page", perPage); } if (page != null) { req.AddParameter("page", page); } }; return(context.pagedRequest <Fax>("faxes", Method.GET, true, addParameters)); }
/// <summary> /// Lists the phone numbers provisioned to your account. /// </summary> /// <param name="countryCode">The country code to search (e.g., "1" for US).</param> /// <param name="country">The area code search. If this is specified, you must specify the country code.</param> /// <param name="perPage">The maximum number of results to return per call or "page" (1000 max).</param> /// <param name="page">The page number to return for the request. 1-based.</param> /// <returns>A IEnumerable<PhoneNumberV2></returns> public IEnumerable <PhoneNumber> List(string areaCode = null, string countryCode = null, int?perPage = null, int?page = null) { Action <IRestRequest> addParameters = req => { if (countryCode != null) { req.AddParameter("country_code", countryCode); } if (areaCode != null) { if (countryCode == null) { throw new ArgumentException("You must supply either a country code or a country if you specify a state."); } req.AddParameter("area_code", areaCode); } if (perPage != null) { req.AddParameter("per_page", perPage); } if (page != null) { req.AddParameter("page", page); } }; return(client.pagedRequest <PhoneNumber>("phone_numbers", Method.GET, true, addParameters)); }
public IEnumerable <AreaCode> List(bool?tollFree = null, string countryCode = null, string country = null, string state = null, int?perPage = null, int?page = null ) { Action <IRestRequest> addParameters = req => { if (tollFree != null) { req.AddParameter("toll_free", tollFree); } if (countryCode != null) { req.AddParameter("country_code", countryCode); } if (country != null) { req.AddParameter("country", country); } if (state != null) { if (country == null && countryCode == null) { throw new ArgumentException("You must supply either a country code or a country if you specify a state."); } req.AddParameter("state", state); } if (perPage != null) { req.AddParameter("per_page", perPage); } if (page != null) { req.AddParameter("page", page); } }; return(client.pagedRequest <AreaCode>("public/area_codes", Method.GET, false, addParameters)); }
/// <summary> /// Lists supported countries with pricing /// </summary> /// <param name="perPage">The maximum number of results to return per call or "page" (1000 max).</param> /// <param name="page">The page number to return for the request. 1-based.</param> /// <returns>A IEnumerable<Country></returns> public IEnumerable <Country> List(int?perPage = null, int?page = null) { Action <IRestRequest> addParameters = req => { if (perPage != null) { req.AddParameter("per_page", perPage); } if (page != null) { req.AddParameter("page", page); } }; return(client.pagedRequest <Country>("public/countries", Method.GET, true, addParameters)); }