Example #1
0
        public void FindConfigs()
        {
            var expectedJson = GetJsonPayload("/numbers/numberLeasesApi/response/findNumberLeaseConfigs.json");
            var restRequest  = MockRestResponse(expectedJson);

            var request = new FindNumberLeaseConfigsRequest
            {
                Limit     = 5,
                Offset    = 0,
                State     = "LA",
                LabelName = "label"
            };
            var configs = Client.NumberLeasesApi.FindConfigs(request);

            Assert.That(Serializer.Serialize(configs), 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("5")));
            Assert.That(restRequest.Value.Parameters, Has.Some.Matches <Parameter>(p => p.Name.Equals("offset") && p.Value.Equals("0")));
            Assert.That(restRequest.Value.Parameters, Has.Some.Matches <Parameter>(p => p.Name.Equals("state") && p.Value.Equals("LA")));
            Assert.That(restRequest.Value.Parameters, Has.Some.Matches <Parameter>(p => p.Name.Equals("labelName") && p.Value.Equals("label")));
        }
Example #2
0
        public void FindNumberLeaseConfigs()
        {
            var request = new FindNumberLeaseConfigsRequest {
                Limit = 2
            };
            var configs = Client.NumberLeasesApi.FindConfigs(request);

            Console.WriteLine(configs);

            Assert.True(configs.Items.Count > 0);
        }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindNumberLeaseConfigsRequest()
     {
         Prefix     = "14245",
         City       = "Los Angeles",
         State      = "CA",
         Zipcode    = "90940",
         Lata       = "123",
         RateCenter = "123",
         LabelName  = "my label",
         Offset     = 0,
         Limit      = 10,
         Fields     = "items(number,configType)"
     };
     Page <NumberConfig> configs = client.NumberLeasesApi.FindConfigs(request);
 }
 /// <summary>
 /// Find all number lease configs for the user.
 /// </summary>
 /// <param name="request">request to filter</param>
 /// <returns>paged number configs</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 <NumberConfig> FindConfigs(FindNumberLeaseConfigsRequest request)
 {
     return(Client.Get <Page <NumberConfig> >(NUMBER_CONFIGS_PATH, request));
 }