public void TestFind() { FindSoundsRequest request = new FindSoundsRequest { Limit = 3, Filter = "sample" }; Page<CampaignSound> campaignSounds = Client.CampaignSoundsApi.Find(request); Assert.AreEqual(4, campaignSounds.TotalCount); Assert.AreEqual(3, campaignSounds.Items.Count); foreach (var item in campaignSounds.Items) { Assert.That(item.Name.Contains("Sample")); } }
public void TestFind() { string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/findCampaignSounds.json"); var restRequest = MockRestResponse(expectedJson); FindSoundsRequest request = new FindSoundsRequest { Limit = 5, Offset = 0, Filter = "1234" }; Page<CampaignSound> sounds = Client.CampaignSoundsApi.Find(request); Assert.That(Serializer.Serialize(sounds), 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("filter") && p.Value.Equals("1234"))); }
public void TestUploadSoundAndDeleteIt() { String soundName = "mp3_test_" + DateTime.Now.ToString(); string mp3FilePath = "Resources/File-examples/train1.mp3"; CampaignSound campaignSound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath, soundName); Assert.NotNull(campaignSound.Id); Client.CampaignSoundsApi.Delete((long) campaignSound.Id); FindSoundsRequest request = new FindSoundsRequest { Filter = soundName }; Page<CampaignSound> campaignSounds = Client.CampaignSoundsApi.Find(request); Assert.True(campaignSounds.Items.Count == 0); }
/// <summary> /// Find all campaign sounds that were created by the user. /// These are all of the available sounds to be used in campaigns. /// </summary> /// <param name="request">request object with different fields for search</param> /// <returns>page with campaign sound 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<CampaignSound> Find(FindSoundsRequest request) { return Client.Get<Page<CampaignSound>>(SOUNDS_PATH, request); }