public void FindCalls() { string expectedJson = GetJsonPayload("/callstexts/callsApi/response/findCalls.json"); var restRequest = MockRestResponse(expectedJson); var request = new FindCallsRequest { States = new List<StateType> { StateType.CALLBACK, StateType.DISABLED }, Id = new List<long> { 1, 2, 3 }, Limit = 5, Offset = 0, BatchId = 1001 }; Page<Call> calls = Client.CallsApi.Find(request); Assert.That(Serializer.Serialize(calls), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); 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("batchId") && p.Value.Equals("1001"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("id") && p.Value.Equals("1"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("id") && p.Value.Equals("2"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("id") && p.Value.Equals("3"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("states") && p.Value.Equals("CALLBACK"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("states") && p.Value.Equals("DISABLED"))); }
public void FindCalls() { var request = new FindCallsRequest { States = { StateType.FINISHED, StateType.READY }, IntervalBegin = DateTime.UtcNow.AddMonths(-2), IntervalEnd = DateTime.UtcNow, Limit = 3 }; Page<Call> calls = Client.CallsApi.Find(request); Console.WriteLine("Calls: " + calls); Assert.AreEqual(3, calls.Items.Count); }
/// <summary> /// Finds all calls sent or received by the user, filtered by different properties, broadcast id, /// toNumber, fromNumber, label, state, etc.Use "campaignId=0" parameter to query /// for all calls sent through the POST /calls API {@link CallsApi#send(List)}. /// </summary> /// <param name="request">request object with different fields to filter</param> /// <returns>paged list with call objects</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<Call> Find(FindCallsRequest request) { return Client.Get<Page<Call>>(CALLS_PATH, request); }