public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindTextsRequest
     {
         Id = new List <long> {
             11646003, 12646003, 13776003
         },
         CampaignId = 449060003,
         BatchId    = 447060003,
         ToNumber   = "12136666123",
         FromNumber = "12135551126",
         Label      = "my label",
         States     = new List <StateType> {
             StateType.FINISHED, StateType.READY, StateType.INVALID
         },
         Results = new List <TextRecord.TextResult> {
             TextRecord.TextResult.RECEIVED
         },
         Inbound       = true,
         IntervalBegin = new DateTime(2016, 9, 13, 15, 50, 17),
         IntervalEnd   = new DateTime(2016, 9, 13, 15, 50, 17),
         Offset        = 0,
         Limit         = 10,
         Fields        = "items(id,fromNumber,toNumber,modified,message)"
     };
     Page <Text> texts = client.TextsApi.Find(request);
 }
Exemple #2
0
        public void FindTexts()
        {
            string expectedJson = GetJsonPayload("/callstexts/textsApi/response/findTexts.json");
            var    restRequest  = MockRestResponse(expectedJson);
            var    request      = new FindTextsRequest
            {
                Limit  = 5,
                Offset = 0,
                States = new List <StateType> {
                    StateType.CALLBACK, StateType.DISABLED
                },
                Id = new List <long> {
                    1, 2, 3
                },
                BatchId = 1001
            };

            Page <CallfireApiClient.Api.CallsTexts.Model.Text> texts = Client.TextsApi.Find(request);

            Assert.That(Serializer.Serialize(texts), 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 static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindTextsRequest
     {
         // find all replies for a particular Text Broadcast
         CampaignId = 1003003,
         Inbound    = true,
         Limit      = 10
     };
     Page <Text> texts = client.TextsApi.Find(request);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindTextsRequest
     {
         FromNumber    = "12135551100",
         IntervalBegin = new DateTime(2016, 9, 13, 15, 50, 17),
         IntervalEnd   = new DateTime(2016, 12, 1, 0, 0, 0),
         Offset        = 100,
         Limit         = 50,
         Fields        = "items(id,message,created)"
     };
     Page <Text> texts = client.TextsApi.Find(request);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindTextsRequest
     {
         // find all texts which belong to a particular campaign and were sent between
         // 2015-12-01 and 2015-12-10
         CampaignId    = 13,
         Label         = "reminders",
         IntervalBegin = new DateTime(2016, 12, 1, 0, 0, 0),
         IntervalEnd   = new DateTime(2016, 12, 1, 0, 0, 0),
         Limit         = 10
     };
     Page <Text> texts = client.TextsApi.Find(request);
 }
        public void FindAndGetParticularTexts()
        {
            var request = new FindTextsRequest
            {
                States = new List <StateType> {
                    StateType.FINISHED, StateType.READY
                },
                Results = new List <TextRecord.TextResult> {
                    TextRecord.TextResult.SENT, TextRecord.TextResult.RECEIVED
                },
                Limit = 2
            };

            Page <CallfireApiClient.Api.CallsTexts.Model.Text> texts = Client.TextsApi.Find(request);

            Assert.IsNotEmpty(texts.Items);

            CallfireApiClient.Api.CallsTexts.Model.Text text = Client.TextsApi.Get((long)texts.Items[0].Id, "id,fromNumber,state");

            Assert.NotNull(text.Id);
            Assert.NotNull(text.FromNumber);
            Assert.NotNull(text.State);
            Assert.IsNull(text.ToNumber);
        }
 /// <summary>
 /// Finds all texts sent or received by the user. Use "campaignId=0"  parameter to query for all
 /// texts sent through the POST /texts API.
 /// If no limit is given then the last 100 texts will be returned.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged list with text 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 <Text> Find(FindTextsRequest request)
 {
     return(Client.Get <Page <Text> >(TEXTS_PATH, request));
 }