public void FindNumberRegions() { var request = new FindNumberRegionsRequest { Limit = 2, State = "IL", Zipcode = "60640" }; var regions = Client.NumbersApi.FindNumberRegions(request); Assert.AreEqual(2, regions.Items.Count); Assert.That(regions.Items[0].City, Is.StringContaining("CHICAGO")); Assert.AreEqual("1773271", regions.Items[0].Prefix); Console.WriteLine(regions); }
public void FindNumberRegions() { var expectedJson = GetJsonPayload("/numbers/numbersApi/response/findNumberRegions.json"); var restRequest = MockRestResponse(expectedJson); var request = new FindNumberRegionsRequest { Limit = 1, Offset = 2, Zipcode = "1234", State = "LA" }; var regions = Client.NumbersApi.FindNumberRegions(request); Assert.That(Serializer.Serialize(regions), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("limit") && p.Value.Equals("1"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("offset") && p.Value.Equals("2"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("zipcode") && p.Value.Equals("1234"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("state") && p.Value.Equals("LA"))); }
/// <summary> /// Find number region information. Use this API to obtain detailed region information that /// can then be used to query for more specific phone numbers than a general query. /// </summary> /// <param name="request">request object</param> /// <returns>paged response</returns> /// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception> /// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception> /// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception> /// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception> /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception> /// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception> /// <exception cref="CallfireClientException"> in case error has occurred in client.</exception> public Page<Region> FindNumberRegions(FindNumberRegionsRequest request) { return Client.Get<Page<Region>>(NUMBERS_REGIONS_PATH, request); }