/// <summary>
        /// Find keyword objects by list of keyword names
        /// </summary>
        /// <param name="keywords">list of keyword names</param>
        /// <returns>list with keyword 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 IList <Keyword> Find(IList <string> keywords)
        {
            var queryParams = new List <KeyValuePair <string, object> >();

            ClientUtils.AddQueryParamIfSet("keywords", keywords, queryParams);
            return(Client.Get <ListHolder <Keyword> >(KEYWORDS_PATH, queryParams).Items);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the wireless carrier of a valid mobile phone number (US and Canada)
        /// </summary>
        /// <param name="phoneNumber">phone number</param>
        /// <returns>the wireless carrier of a valid mobile phone number (US and Canada)</returns>
        /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
        /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
        public CarrierLookupResponse CarrierLookup(string phoneNumber)
        {
            Validate.NotBlank(phoneNumber, "phoneNumber cannot be blank");
            var queryParams = ClientUtils.AsParams("PhoneNumber", phoneNumber);
            var path        = CarrierLookupPath.ReplaceFirst(ClientConstants.Placeholder, phoneNumber);

            return(_client.Get <CarrierLookupResponse>(path, queryParams).Entry);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a single Media instance for a given media file id. This is the metadata
        /// for the media only.No content data is returned from this API.
        /// </summary>
        /// <param name="id">id of media file</param>
        /// <param name="fields">Limit text fields returned. Example fields=limit,offset,items(id,message)</param>
        /// <returns>Media meta object</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 Media Get(long id, string fields = null)
        {
            Validate.NotBlank(id.ToString(), "id cannot be blank");
            string path        = MEDIA_ITEM_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, id.ToString());
            var    queryParams = ClientUtils.BuildQueryParams("fields", fields);

            return(Client.Get <Media>(path, queryParams));
        }
 /// <summary>
 /// Check whether a Keyword is available to rent on Ez Texting's short code. Please note, we will check
 /// availability for the country your account is set to.
 /// </summary>
 /// <param name="keyword">keyword to check</param>
 /// <returns>true if keyword is available to rent, otherwise false returned</returns>
 /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
 /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
 public bool CheckAvailability(string keyword)
 {
     Validate.NotBlank(keyword, "keyword cannot be blank");
     // TODO ugly code, have to wait api fixes
     try
     {
         var queryParams = ClientUtils.AsParams("Keyword", keyword);
         var path        = CheckAvailabilityPath.ReplaceFirst(ClientConstants.Placeholder, keyword);
         var avail       = _client.Get <CheckAvailabilityResponse>(path, queryParams).Entry.Available;
         return(avail != null && avail.Value);
     }
     catch (EzTextingApiException e)
     {
         if (e.Errors != null && e.Errors.Contains($"Keyword: The keyword '{keyword}' is unavailable"))
         {
             return(false);
         }
         throw;
     }
 }
        /// <summary>
        /// Gets the json data for the provided catalog.
        /// </summary>
        /// <param name="catalogName">Name of the Azure catalog. Pass NULL to get the list of catalogs</param>
        /// <param name="language">Language for the data. Default is "en" for English.</param>
        /// <param name="locale">Locale for the data. Default is "en-us" for US English.</param>
        /// <returns>String, json data.</returns>
        private static string GetCatalogJson(string catalogName = null, string language = "en", string locale = "en-us")
        {
            string localFileName = Path.Combine(Directory.GetCurrentDirectory(), "_AzureCatalog", (string.IsNullOrWhiteSpace(catalogName) ? "_menu" : catalogName) + ".json");

            if (File.Exists(localFileName))
            {
                FileInfo info = new FileInfo(localFileName);
                if (info.LastWriteTimeUtc >= DateTime.UtcNow.AddDays(-30))
                {
                    return(File.ReadAllText(localFileName));
                }
            }

            string uri = (string.IsNullOrWhiteSpace(catalogName) ? CatalogEndpoint : CatalogCategoryDataEndpoint);

            uri = uri.Replace("{language}", language).Replace("{locale}", locale);
            if (!string.IsNullOrWhiteSpace(catalogName))
            {
                if (!catalogName.EndsWith("_MP", StringComparison.InvariantCultureIgnoreCase))
                {
                    catalogName += "_MP";
                }

                uri = uri.Replace("{category_id}", catalogName);
            }

            RestApiClient       client   = new RestApiClient(null, new Uri(uri));
            HttpResponseMessage response = client.Get();

            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }

            string json = response.Content.ReadAsStringAsync().Result;

            File.WriteAllText(localFileName, json);

            return(json);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Execute a GET request against an endpoint
        /// </summary>
        /// <param name="uriFragment">Fragment (tail) of the Wikipedia.org REST endpoint.
        /// (Provide only the part that comes after the <see cref="ENDPOINT_BASE_URI"/> value)</param>
        /// <param name="parameters">Optional, query string parameters. Function wil escape values, so pass in raw data!</param>
        /// <param name="headers">Optional, additional headers to add. Standard headers for Wikipedia.org API is added automaticaly.</param>
        /// <returns>Response content body as string. NULL if was not successful or content itself was NULL.</returns>
        public string GET(string uriFragment, Dictionary <string, string> parameters = null, Dictionary <string, string> headers = null)
        {
            StringBuilder uri = new StringBuilder();

            uri.Append(ENDPOINT_BASE_URI).Append("/").Append(uriFragment);
            if ((parameters != null) && (parameters.Count > 0))
            {
                uri.Append("?");
                bool isFirstParam = true;
                foreach (string key in parameters.Keys)
                {
                    uri.Append($"{(isFirstParam ? "?" : "&")}{key}={Uri.EscapeDataString(parameters[key])}");
                    isFirstParam = false;
                }
            }

            RestApiClient client = new RestApiClient(new Uri(uri.ToString()));

            client.RequestHeaders.Add("User-Agent", apiUserContactEmail);
            client.RequestHeaders.Add("Api-User-Agent", apiUserContactEmail);
            client.RequestHeaders.Add("Accept", "application/json");

            if ((headers != null) && (headers.Count > 0))
            {
                foreach (string key in headers.Keys)
                {
                    client.RequestHeaders.Add(key, headers[key]);
                }
            }

            HttpResponseMessage responseMessage = client.Get();

            if (responseMessage.IsSuccessStatusCode)
            {
                return(responseMessage.Content.ReadAsStringAsync().Result);
            }

            return(null);
        }
 /// <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));
 }
 /// <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));
 }
Ejemplo n.º 9
0
 public List <Job> Get()
 {
     return(jobsApiClient.Get());
 }
        /// <summary>
        /// Get a report for specific delivery status of a message you have sent.
        /// </summary>
        /// <param name="id">message id</param>
        /// <returns>delivery report</returns>
        /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
        /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
        public DeliveryReport GetReport(long id)
        {
            var path = ReportPath.ReplaceFirst(ClientConstants.Placeholder, id.ToString());

            return(_client.Get <DeliveryReport>(path).Entry);
        }
 /// <summary>
 /// Find all subscriptions for the user.
 /// Search for subscriptions on campaign id, resource, event, from number, to number, or whether they are enabled.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged list with subscriptions</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 <Subscription> Find(FindSubscriptionsRequest request)
 {
     return(Client.Get <Page <Subscription> >(SUBSCRIPTIONS_PATH, request));
 }
        /// <summary>
        /// Returns a single Batch instance for a given batch id.
        /// This API is useful for determining the state of a validating batch.
        /// </summary>
        /// <param name="id">id of batch</param>
        /// <param name="fields">limit fields returned. Example fields=id,name</param>
        /// <returns>requested batch</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 Batch Get(long id, string fields = null)
        {
            var queryParams = ClientUtils.BuildQueryParams("fields", fields);

            return(Client.Get <Batch>(BATCH_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, id.ToString()), queryParams));
        }
 /// <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));
 }
 /// <summary>
 /// Find contact lists by id, name, number, etc...
 /// </summary>
 /// <param name="request">request object with fields to filter</param>
 /// <returns>paged list with contact lists</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 <ContactList> Find(FindContactListsRequest request)
 {
     return(Client.Get <Page <ContactList> >(LISTS_PATH, request));
 }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.WriteLine("Venus.AI console client");
            Console.WriteLine("press ctrl+c to exit");

            while (true)
            {
                Console.Write("Press <Enter> to start recording.");
                Console.ReadLine();
                Recorder.StartRecord();
                Console.Write("Recording... \nPress <Enter> to stop.");
                Console.ReadLine();
                Recorder.StopRecord();
                Thread.Sleep(100);

                ApiRequest inputMessage = new ApiRequest();
                inputMessage.Language    = "rus";
                inputMessage.RequestType = "voice";
                inputMessage.Id          = 1;
                inputMessage.VoiceData   = System.IO.File.ReadAllBytes("demo.wav");

                /*
                 * /////////////DEBUG
                 * var config = JsonConvert.DeserializeObject<SDK.Components.Configurations.YandexCompmnentConfig>(File.ReadAllText(Environment.CurrentDirectory + "/appconfig.json"));
                 * YandexSttComponent yandexStt = new YandexSttComponent();
                 * var res = yandexStt.Process(new SDK.Components.Messages.VoiceMessage()
                 * {
                 *  Id = 1,
                 *  Language = SDK.Core.Enums.Language.Russian,
                 *  Vioce = inputMessage.VoiceData
                 * });
                 *
                 * Console.WriteLine(">" + res.Text);
                 * Console.ReadLine();
                 * /////////////
                 */

                RestApiClient.Сonfigure(@"http://192.168.88.150:50567/api/request");
                string err;
                bool   isConnect = RestApiClient.Connect(out err);

                if (!isConnect)
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine("[FAIL]\n\t{0}.", err);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.Write("Press eny key to exit...");
                    Console.Read();
                    return;
                }

                try
                {
                    var        jsonRequest   = Utils.JsonConverter.ToJson(inputMessage);
                    var        jsonRespone   = RestApiClient.Post(jsonRequest);
                    ApiRespone outputMessage = Utils.JsonConverter.FromJson <ApiRespone>(jsonRespone);

                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.Write($"\nuser   > ");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write($"{outputMessage.InputText}\n");
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.Write($"venus.ai> ");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write($"{outputMessage.OutputText}\n");
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.Write($"intent  : ");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write($"{outputMessage.IntentName}\n\n");
                    Console.ForegroundColor = ConsoleColor.Gray;

                    File.WriteAllBytes("answer.wav", outputMessage.VoiceData);
                    SoundPlayer.Play("answer.wav");

                    if (outputMessage.IntentName == "personalize_intent")
                    {
                        RestApiClient.Сonfigure(@"http://192.168.88.150:50567/api/intent");
                        var jsonIntents = RestApiClient.Get();
                        var intents     = JsonConvert.DeserializeObject <IntentList>(jsonIntents);
                        Console.WriteLine("Intents:\n#\t| Intent Name");
                        for (int i = 0; i < intents.Intents.Count; i++)
                        {
                            Console.ForegroundColor = ConsoleColor.Magenta;
                            Console.Write($"{i}\t| ");
                            Console.ForegroundColor = ConsoleColor.Gray;
                            Console.WriteLine(intents.Intents[i]);
                        }
                        Console.Write("Enter Intent number: ");
                        var n = int.Parse(Console.ReadLine());

                        Console.Write($"Intent {intents.Intents[n]} chosen! Say your command. Press <Enter> to start recording.");
                        Console.ReadLine();
                        Recorder.StartRecord();
                        Console.Write("Recording... \nPress <Enter> to stop.");
                        Console.ReadLine();
                        Recorder.StopRecord();
                        Thread.Sleep(100);

                        IntentModificationRequest intentModificationRequest = new IntentModificationRequest()
                        {
                            Id         = 1,
                            IntentName = intents.Intents[n],
                            Language   = "rus",
                            VoiceData  = System.IO.File.ReadAllBytes("demo.wav")
                        };

                        var jsonResponeIntent = RestApiClient.Post(JsonConvert.SerializeObject(intentModificationRequest));
                        var r = JsonConvert.DeserializeObject <IntentModificationRespone>(jsonResponeIntent);

                        File.WriteAllBytes("answer.wav", r.VoiceData);
                        SoundPlayer.Play("answer.wav");
                    }
                    if (SHOW_DEBUG_INFO)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkMagenta;
                        Console.Write("REQUEST TO SERVER: ");
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("\n" + jsonRequest);

                        Console.ForegroundColor = ConsoleColor.DarkMagenta;
                        Console.Write("RESPONE FROM SERVER: ");
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("\n" + jsonRespone);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Find all owned keyword leases for a user. A keyword lease is the ownership information involving a keyword.
 /// </summary>
 /// <param name="request">request payload</param>
 /// <returns>paged list with keyword lease 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 <KeywordLease> Find(CommonFindRequest request)
 {
     return(Client.Get <Page <KeywordLease> >(KEYWORD_LEASES_PATH, request));
 }
 /// <summary>
 /// Get a single file stored in your Ez Texting media library.
 /// </summary>
 /// <param name="id">file's id</param>
 /// <returns>media file</returns>
 /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
 /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
 public MediaFile Get(long id)
 {
     return(_client.Get <MediaFile>(FilesItemPath.ReplaceFirst(ClientConstants.Placeholder, id.ToString())).Entry);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Finds all calls sent or received by the user, filtered by different properties, broadcast id,
 /// toNumber, fromNumber, label, state, etc.Use "campaignId=0" parameter to query
 /// for all calls sent through the POST /calls API {@link CallsApi#send(List)}.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged list with call 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 <Call> Find(FindCallsRequest request)
 {
     return(Client.Get <Page <Call> >(CALLS_PATH, request));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Find account details for the user. Details include name, email, and basic account permissions.
 /// GET /me/account
 /// </summary>
 /// <returns>user's account</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 UserAccount GetAccount()
 {
     return(Client.Get <UserAccount>(ME_ACCOUNT_PATH));
 }
 /// <summary>
 /// Find do not contact (DNC) lists
 /// </summary>
 /// <param name="request">request with properties to find</param>
 /// <returns>paged list with dnc lists</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 <DncList> Find(FindDncListsRequest request)
 {
     return(Client.Get <Page <DncList> >(DNC_LISTS_PATH, request));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Checks credit balances on your account.
 /// </summary>
 /// <returns>account balance</returns>
 /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
 /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
 public CreditBalance CheckBalance()
 {
     return(_client.Get <CreditBalance>(CheckBalancePath).Entry);
 }
        /// <summary>
        /// Get incoming text message in your Ez Texting Inbox
        /// </summary>
        /// <param name="id">message's id</param>
        /// <returns>inbox message</returns>
        /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
        /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
        public InboxMessage GetMessage(long id)
        {
            var path = MessagesItemPath.ReplaceFirst(ClientConstants.Placeholder, id.ToString());

            return(_client.Get <InboxMessage>(path).Entry);
        }
 /// <summary>
 /// Get a single group stored in your Ez Texting account.
 /// </summary>
 /// <param name="id">group's id</param>
 /// <returns>groups that were found</returns>
 /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
 /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
 public Group Get(long id)
 {
     return(_client.Get <Group>(GroupsItemPath.ReplaceFirst(ClientConstants.Placeholder, id.ToString())).Entry);
 }
 /// <summary>
 /// Find number leases by prefix, zipcode, etc...
 /// This API is useful for finding all numbers currently owned by an account.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged leases</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 <NumberLease> Find(FindNumberLeasesRequest request)
 {
     return(Client.Get <Page <NumberLease> >(NUMBER_LEASES_PATH, request));
 }
        /// <summary>
        /// Get order for keyword and/or number orders
        /// GET /me/account
        /// </summary>
        /// <param name="id">id of order</param>
        /// <param name="fields">limit fields returned. Example fields=id,name</param>
        /// <returns>ResourceId with id of created order</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 NumberOrder GetOrder(long id, string fields = null)
        {
            var queryParams = ClientUtils.BuildQueryParams("fields", fields);

            return(Client.Get <NumberOrder>(ORDERS_GET_ORDER.ReplaceFirst(ClientConstants.PLACEHOLDER, id.ToString()), queryParams));
        }
 /// <summary>
 /// Find all webhooks for the user.
 /// Search for webhooks on name, resource, event, callback URL, or whether they are enabled.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged list with webhooks</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 <Webhook> Find(FindWebhooksRequest request)
 {
     return(Client.Get <Page <Webhook> >(WEBHOOKS_PATH, request));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Find number in local catalog by prefix, zipcode, etc...
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>available numbers in catalog</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 IList <Number> FindNumbersLocal(FindNumbersLocalRequest request)
 {
     return(Client.Get <ListHolder <Number> >(NUMBERS_LOCAL_PATH, request).Items);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Finds all media files which was uploaded by the user, filtered by file name.
 /// </summary>
 /// <param name="request">request object with different fields to filter</param>
 /// <returns>paged list with media 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 <Media> Find(FindMediaRequest request)
 {
     return(Client.Get <Page <Media> >(MEDIA_PATH, request));
 }
 /// <summary>
 /// Get a single contact stored in your Ez Texting account.
 /// </summary>
 /// <param name="id">contact's id</param>
 /// <returns>contacts that were found</returns>
 /// <exception cref="EzTextingApiException">in case error has occurred on server side, check provided error description.</exception>
 /// <exception cref="EzTextingClientException">in case error has occurred in client.</exception>
 public Contact Get(string id)
 {
     Validate.NotBlank(id, "id cannot be blank");
     return(_client.Get <Contact>(ContactsItemPath.ReplaceFirst(ClientConstants.Placeholder, id)).Entry);
 }
Ejemplo n.º 30
0
 /// <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(FindDncNumbersRequest request)
 {
     return(Client.Get <Page <DoNotContact> >(DNC_PATH, request));
 }