Наследование: CallfireApiClient.Api.Common.Model.Request.FindRequest
        public void AddRecipientsAndAddRemoveBatches()
        {
            var findRequest = new FindBroadcastsRequest
            {
                Name = "updated_name",
                Limit = 1
            };
            var broadcasts = Client.TextBroadcastsApi.Find(findRequest);
            Console.WriteLine(broadcasts);
            Assert.That(broadcasts.Items, Is.Not.Empty);
            var id = broadcasts.Items[0].Id;

            // add recipients
            var recipients = new List<TextRecipient>
            {
                new TextRecipient { PhoneNumber = "14246525473" },
                new TextRecipient { PhoneNumber = "12132041238" }
            };
            var texts = Client.TextBroadcastsApi.AddRecipients((long)id, recipients);
            Console.WriteLine(texts);
            Assert.AreEqual(2, texts.Count);
            Assert.That(texts[0].Message, Is.StringStarting("test_msg"));

            // get batches
            var getBatchesRequest = new GetByIdRequest { Id = id };
            var batches = Client.TextBroadcastsApi.GetBatches(getBatchesRequest);
            Console.WriteLine(batches);

            // add batch
            var addBatchRequest = new AddBatchRequest
            {
                CampaignId = (long)id,
                Name = "new_batch",
                Recipients = new List<Recipient>
                {
                    new TextRecipient { PhoneNumber = "14246525473" },
                    new TextRecipient { PhoneNumber = "12132041238" }
                }
            };
            ResourceId addedBatchId = Client.TextBroadcastsApi.AddBatch(addBatchRequest);

            var addedBatch = Client.BatchesApi.Get(addedBatchId.Id);
            Console.WriteLine(batches);
            Assert.AreEqual(addedBatch.BroadcastId, id);
            Assert.True((bool)addedBatch.Enabled);
            Assert.AreEqual(addBatchRequest.Name, addedBatch.Name);

            addedBatch.Enabled = false;
            Client.BatchesApi.Update(addedBatch);
            Batch updatedBatch = Client.BatchesApi.Get(addedBatchId.Id);
            Assert.False((bool)updatedBatch.Enabled);
        }
        public void AddRecipientsAndAddRemoveBatches()
        {
            var findRequest = new FindBroadcastsRequest
            {
                Name = "updated_name",
                Limit = 1
            };
            var broadcasts = Client.CallBroadcastsApi.Find(findRequest);
            Console.WriteLine(broadcasts);
            Assert.That(broadcasts.Items, Is.Not.Empty);
            var id = broadcasts.Items[0].Id;

            var calls = Client.CallBroadcastsApi.AddRecipients((long)id, new List<Recipient>
                {
                    new Recipient { PhoneNumber = "12132212384" },
                    new Recipient { PhoneNumber = "12132212385" }
                });
            Console.WriteLine(calls);
            Assert.AreEqual(2, calls.Count);

            // get batches
            var getBatchesRequest = new GetByIdRequest { Id = id };
            var batches = Client.CallBroadcastsApi.GetBatches(getBatchesRequest);
            Console.WriteLine(batches);

            // add batch
            var addBatchRequest = new AddBatchRequest
            {
                CampaignId = (long)id,
                Name = "new_batch",
                Recipients = new List<Recipient>
                {
                    new Recipient { PhoneNumber = "12132212386" },
                    new Recipient { PhoneNumber = "12132212387" }
                }
            };
            ResourceId addedBatchId = Client.CallBroadcastsApi.AddBatch(addBatchRequest);

            var addedBatch = Client.BatchesApi.Get(addedBatchId.Id);
            Assert.AreEqual(addedBatch.BroadcastId, id);
        }
        public void Find()
        {
            var expectedJson = GetJsonPayload("/campaigns/callBroadcastsApi/response/findCallBroadcasts.json");
            var restRequest = MockRestResponse(expectedJson);

            var request = new FindBroadcastsRequest()
            {
                Limit = 5,
                Name = "name",
                Label = "label",
                Running = true
            };
            var broadcasts = Client.CallBroadcastsApi.Find(request);
            Assert.That(Serializer.Serialize(broadcasts), 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("name") && p.Value.Equals("name")));
            Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("label") && p.Value.Equals("label")));
            Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("running") && p.Value.Equals("True")));
        }
 /// <summary>
 /// Find all text broadcasts created by the user. Can query on label, name, and the current
 /// running status of the campaign.
 /// </summary>
 /// <param name="request">request object with filtering options</param>
 /// <returns>page with TextBroadcast 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<TextBroadcast> Find(FindBroadcastsRequest request)
 {
     return Client.Get<Page<TextBroadcast>>(TB_PATH, request);
 }
 /// <summary>
 /// Find all call broadcasts created by the user. Can query on label, name, and the current
 /// running status of the campaign.
 /// </summary>
 /// <param name="request">request object with filtering options</param>
 /// <returns>page with CallBroadcast 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<CallBroadcast> Find(FindBroadcastsRequest request)
 {
     return Client.Get<Page<CallBroadcast>>(CB_PATH, request);
 }