public void FindDncs() { var request = new FindDncContactsRequest(); Page<DoNotContact> dncs = Client.DncApi.Find(request); Console.WriteLine("Page of credentials:" + dncs); Assert.NotNull(dncs); Assert.GreaterOrEqual(dncs.Items.Count, 0); }
public void Find() { string expectedJson = GetJsonPayload("/contacts/dncApi/response/findDncs.json"); var restRequest = MockRestResponse(expectedJson); FindDncContactsRequest request = new FindDncContactsRequest { Limit = 1, Offset = 5, Fields = FIELDS, Prefix = "1", DncListId = TEST_LONG, DncListName = TEST_STRING, CallDnc = true, TextDnc = true }; Page<DoNotContact> dncs = Client.DncApi.Find(request); Assert.NotNull(dncs); Assert.That(Serializer.Serialize(dncs), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); }
public void UpdateDnc() { long listId = 2021478003; string number = "13234324554"; string prefix = "13234"; DoNotContact dncToUpdate = new DoNotContact { ListId = listId, Text = true, Call = true, Number = number }; Client.DncApi.Update(dncToUpdate); var request = new FindDncContactsRequest { DncListId = listId, Prefix = prefix, CallDnc = true, TextDnc = true, Limit = 1, Offset = 0 }; Page<DoNotContact> dnc = Client.DncApi.Find(request); Assert.NotNull(dnc); Assert.AreEqual(dnc.Items.Count, 1); Assert.AreEqual(dnc.Items[0].ListId, listId); Assert.AreEqual(dnc.Items[0].Number, number); Assert.AreEqual(dnc.Items[0].Text, true); Assert.AreEqual(dnc.Items[0].Call, true); //get back initial db stage as before test dncToUpdate.Text = true; dncToUpdate.Call = true; Client.DncApi.Update(dncToUpdate); }
/// <summary> /// Find all Do Not Contact (DNC) objects created by the user. /// These DoNotContact entries only affect calls/texts/campaigns on this account. /// </summary> /// <param name="request">find request with different properties to filter</param> /// <returns>paged list with dnc 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<DoNotContact> Find(FindDncContactsRequest request) { return Client.Get<Page<DoNotContact>>(DNC_PATH, request); }