public void GetBroadcastCalls() { var getCallsRequest = new GetByIdRequest { Id = 1 }; var calls = Client.CallBroadcastsApi.GetCalls(getCallsRequest); Console.WriteLine(calls); Assert.That(calls.Items, Is.Not.Empty); long testBatchId = (long) calls.Items[0].BatchId; getCallsRequest = new GetBroadcastCallsTextsRequest { Id = 1, batchId = testBatchId }; calls = Client.CallBroadcastsApi.GetCalls(getCallsRequest); Console.WriteLine(calls); Assert.AreEqual(calls.Items[0].BatchId, testBatchId); }
public void GetCallsWithGetByIdAndBatchIdRequest() { var expectedJson = GetJsonPayload("/campaigns/callBroadcastsApi/response/getCalls.json"); var restRequest = MockRestResponse(expectedJson); var request = new GetBroadcastCallsTextsRequest { Offset = 5, Fields = FIELDS, Id = 11, batchId = 13 }; var calls = Client.CallBroadcastsApi.GetCalls(request); Assert.That(Serializer.Serialize(calls), 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.Resource, Is.StringEnding("/11/calls")); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches<Parameter>(p => p.Name.Equals("id"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("offset") && p.Value.Equals("5"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("batchId") && p.Value.Equals("13"))); }
public void GetBroadcastTexts() { var broadcast = new TextBroadcast { Name = "text_broadcast_1", Message = "test_msg", Recipients = new List<TextRecipient> { new TextRecipient { PhoneNumber = "14246525473" } } }; var broadcastId = Client.TextBroadcastsApi.Create(broadcast, false); var request = new GetByIdRequest { Id = broadcastId.Id }; var texts = Client.TextBroadcastsApi.GetTexts(request); Console.WriteLine(texts); Assert.That(texts.Items, Is.Not.Empty); long testBatchId = (long)texts.Items[0].BatchId; request = new GetBroadcastCallsTextsRequest { Id = broadcastId.Id, batchId = testBatchId }; texts = Client.TextBroadcastsApi.GetTexts(request); Assert.AreEqual(texts.Items[0].BatchId, testBatchId); }
/// <summary> /// Get texts associated with text broadcast ordered by date /// </summary> /// <param name="request">request with properties to filter</param> /// <returns>texts assosiated with broadcast</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<Text> GetTexts(GetBroadcastCallsTextsRequest request) { String path = TB_ITEM_TEXTS_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, request.Id.ToString()); return Client.Get<Page<Text>>(path, request); }