/// <summary> /// Time Estimates /// </summary> /// <param name="startLatitude">Required parameter: Latitude component of start location.</param> /// <param name="startLongitude">Required parameter: Longitude component of start location.</param> /// <param name="customerUuid">Optional parameter: Unique customer identifier to be used for experience customization.</param> /// <param name="productId">Optional parameter: Unique identifier representing a specific product for a given latitude & longitude.</param> /// <return>Returns the List<Models.ProductModel> response from the API call</return> public async Task <List <Models.ProductModel> > GetEstimatesTimeAsync( double startLatitude, double startLongitude, Guid?customerUuid = null, string productId = null) { //the base uri for api requestss string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/estimates/time"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "start_latitude", startLatitude }, { "start_longitude", startLongitude }, { "customer_uuid", customerUuid }, { "product_id", productId } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK { throw new ErrorErrorException(@"Unexpected error", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <List <Models.ProductModel> >(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
public async Task <dynamic> GetWebhooksAsync(string resourceId) { string _baseUri = Configuration.GetBaseURI(); StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/webhooks"); APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "resourceId", resourceId } }, ArrayDeserializationFormat, ParameterSeparator); string _queryUrl = APIHelper.CleanUrl(_queryBuilder); var _headers = Utilities.APIHelper.GetHeader(); HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Returns a list of all Numbering Plan Area (NPA) codes containing purchasable phone numbers. /// </summary> /// <param name="limit">Optional parameter: Limits the number of items to retrieve. A maximum of 400 items can be retrieved.</param> /// <param name="offset">Optional parameter: Offsets the list of phone numbers by your specified value. For example, if you have 4 phone numbers and you entered 1 as your offset value, then only 3 of your phone numbers will be displayed in the response.</param> /// <param name="maxSetupCost">Optional parameter: Restricts the results to the specified maximum non-recurring setup cost.</param> /// <return>Returns the void response from the API call</return> public async Task <dynamic> ListAvailableAreaCodesAsync(int?limit = null, int?offset = null, double?maxSetupCost = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v2/numbers/available/areacodes"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "limit", limit }, { "offset", offset }, { "max_setup_cost", maxSetupCost } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "Flowroute SDK v3.0" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if (_response.StatusCode == 401) { throw new ErrorException(@"Unauthorized – There was an issue with your API credentials.", _context); } if (_response.StatusCode == 404) { throw new ErrorException(@"The specified resource was not found", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Gets all plans /// </summary> /// <param name="page">Optional parameter: Page number</param> /// <param name="size">Optional parameter: Page size</param> /// <param name="name">Optional parameter: Filter for Plan's name</param> /// <param name="status">Optional parameter: Filter for Plan's status</param> /// <param name="billingType">Optional parameter: Filter for plan's billing type</param> /// <param name="createdSince">Optional parameter: Filter for plan's creation date start range</param> /// <param name="createdUntil">Optional parameter: Filter for plan's creation date end range</param> /// <return>Returns the Models.ListPlansResponse response from the API call</return> public async Task <Models.ListPlansResponse> GetPlansAsync( int?page = null, int?size = null, string name = null, string status = null, string billingType = null, DateTime?createdSince = null, DateTime?createdUntil = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/plans"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "page", page }, { "size", size }, { "name", name }, { "status", status }, { "billing_type", billingType }, { "created_since", (createdSince.HasValue) ? createdSince.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null }, { "created_until", (createdUntil.HasValue) ? createdUntil.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "MundiSDK - DotNet 0.16.0-beta.0" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.ListPlansResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Parse, validate and get location information about a phone number. See: https://www.neutrinoapi.com/api/phone-validate/ /// </summary> /// <param name="number">Required parameter: A phone number. This can be in international format (E.164) or local format. If passing local format you should use the 'country-code' or 'ip' options as well</param> /// <param name="countryCode">Optional parameter: ISO 2-letter country code, assume numbers are based in this country.<br/>If not set numbers are assumed to be in international format (with or without the leading + sign)</param> /// <param name="ip">Optional parameter: Pass in a users IP address and we will assume numbers are based in the country of the IP address</param> /// <return>Returns the Models.PhoneValidateResponse response from the API call</return> public async Task <Models.PhoneValidateResponse> PhoneValidateAsync(string number, string countryCode = null, string ip = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/phone-validate"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "user-id", Configuration.UserId }, { "api-key", Configuration.ApiKey } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; //append form/field parameters var _fields = new List <KeyValuePair <string, Object> >() { new KeyValuePair <string, object>("output-case", "camel"), new KeyValuePair <string, object>("number", number), new KeyValuePair <string, object>("country-code", countryCode), new KeyValuePair <string, object>("ip", ip) }; //remove null parameters _fields = _fields.Where(kvp => kvp.Value != null).ToList(); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.PhoneValidateResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Return cost of sending a message to the number. /// </summary> /// <param name="mobileNumber">Required parameter: Mobile number you want to know the price of sending a message.</param> /// <return>Returns the string response from the API call</return> public async Task <string> GetPriceOfMessageAsync(string mobileNumber) { //validating required parameters if (null == mobileNumber) { throw new ArgumentNullException("mobileNumber", "The parameter \"mobileNumber\" is a required parameter and cannot be null."); } //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/message/price"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "mobileNumber", mobileNumber } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "Releans" } }; _headers.Add("Authorization", string.Format("Bearer {0}", Configuration.OAuthAccessToken)); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //return null on 404 if (_response.StatusCode == 404) { return(null); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// The code generation endpoint. The response is a path to the generated zip file relative to https://apimatic.io/ /// > Note: This endpoint does not require Basic Authentication. /// </summary> /// <param name="apikey">Required parameter: The API Key of the pre-configured API</param> /// <param name="template">Required parameter: The template to use for code generation</param> /// <param name="dl">Optional parameter: Optional</param> /// <return>Returns the string response from the API call</return> public async Task <string> UsingApikeyAsStringAsync(string apikey, Models.Template template, int?dl = 0) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/codegen"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "apikey", apikey }, { "template", Models.TemplateHelper.ToValue(template) }, { "dl", (null != dl) ? dl : 0 } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if (_response.StatusCode == 401) { throw new APIException(@"Unauthorized: Access is denied due to invalid credentials.", _context); } if (_response.StatusCode == 412) { throw new APIException(@"Precondition Failed", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// TODO: type endpoint description here /// </summary> /// <param name="suites">Required parameter: Example: </param> /// <return>Returns the ServerResponse response from the API call</return> public async Task <ServerResponse> IntegerEnumArrayAsync(List <SuiteCode> suites) { //validating required parameters if (null == suites) { throw new ArgumentNullException("suites", "The parameter \"suites\" is a required parameter and cannot be null."); } //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/query/integerenumarray"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "suites", SuiteCodeHelper.ToValue(suites) } }); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "Stamplay SDK" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request); HttpContext _context = new HttpContext(_request, _response); //return null on 404 if (_response.StatusCode == 404) { return(null); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <ServerResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// listDidGroup is a method related to Voxbone’s inventory. It allows you to retrieve the list of DID groups. A DID group can be defined as the smallest set of DIDs which is usually DIDs that share the same city or area code attributes. It is a method which is useful to get pricing info on a DID and to get didGroupIds which is a required parameter when placing a DID order. /// </summary> /// <param name="countryCodeA3">Required parameter: The three letter identifier for the didGroup's country.</param> /// <param name="pageNumber">Required parameter: The page number, starting at 0.</param> /// <param name="pageSize">Required parameter: The page size (max number of entities that are displayed in the response).</param> /// <param name="didGroupIds">Optional parameter: The list of didGroup identifier.</param> /// <param name="stateId">Optional parameter: The numerical identifier for the didGroup's state. Please see the listState operation to retrieve a validstate identifier.</param> /// <param name="cityNamePattern">Optional parameter: The name of the didGroup's city. Note that the system will execute a partial match on the city name.</param> /// <param name="rateCenter">Optional parameter: The name of the didGroup's ratecenter. Note that the system will execute a partial match on the ratecenter name.</param> /// <param name="areaCode">Optional parameter: The didGroup's area code.</param> /// <param name="didType">Optional parameter: The didGroup's did type.</param> /// <param name="showEmpty">Optional parameter: Set to true if you want to show the didGroups with no stock currently available.</param> /// <param name="featureIds">Optional parameter: The list of desired feature. This list should contain the identifier of any desired feature for the didGroup.Please refer to the listFeature operation to retrieve valid feature identifiers.</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> ListDidGroupAsync( string countryCodeA3, string pageNumber, string pageSize, string didGroupIds = null, string stateId = null, string cityNamePattern = null, string rateCenter = null, string areaCode = null, string didType = null, string showEmpty = null, string featureIds = null) { //the base uri for api requests string baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/services/rest/inventory/didgroup"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(queryBuilder, new Dictionary <string, object>() { { "countryCodeA3", countryCodeA3 }, { "pageNumber", pageNumber }, { "pageSize", pageSize }, { "didGroupIds", didGroupIds }, { "stateId", stateId }, { "cityNamePattern", cityNamePattern }, { "rateCenter", rateCenter }, { "areaCode", areaCode }, { "didType", didType }, { "showEmpty", showEmpty }, { "featureIds", featureIds } }); //validate and preprocess url string queryUrl = APIHelper.CleanUrl(queryBuilder); //prepare and invoke the API call request to fetch the response HttpRequest request = Unirest.get(queryUrl) //append request with appropriate headers and parameters .header("User-Agent", "APIMATIC 2.0") .header("Accept", "application/json") .basicAuth(basicAuthUserName, basicAuthPassword); //invoke request and get response HttpResponse <String> response = await request.asStringAsync(); //Error handling using HTTP status codes if ((response.Code < 200) || (response.Code > 206)) //[200,206] = HTTP OK { throw new APIException(@"HTTP Response Not OK", response.Code); } return(APIHelper.JsonDeserialize <dynamic>(response.Body)); }
/// <summary> /// Get bonuses daily given. /// </summary> /// <param name="accountSlug">Optional parameter: The account identifier</param> /// <param name="campaignSlug">Optional parameter: The campaign identifier</param> /// <param name="advocateToken">Optional parameter: The advocate identifier</param> /// <param name="mfrom">Optional parameter: The datetime were the range of the search starts</param> /// <param name="to">Optional parameter: The datetime were the range of the search stops</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> GetBonusesDailyGivenAsync( string accountSlug = null, string campaignSlug = null, string advocateToken = null, DateTime?mfrom = null, DateTime?to = null) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/reports/bonuses-daily-given"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "account_slug", accountSlug }, { "campaign_slug", campaignSlug }, { "advocate_token", advocateToken }, { "from", (mfrom.HasValue) ? mfrom.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null }, { "to", (to.HasValue) ? to.Value.ToString("r") : null } }); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; _headers.Add("Content-Type", Configuration.ContentType); _headers.Add("X-Auth-Token", Configuration.XAuthToken); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// TODO: type endpoint description here /// </summary> /// <param name="callback">Required parameter: The callback function that the JSON response will be wrapped in if desired</param> /// <param name="colorid">Required parameter: Vehicle color ID (&colorid=xxx&colorid=xxx&colorid=xxx for multiples)</param> /// <param name="fmt">Required parameter: Response format (json only) (Acceptable values are: "json")</param> /// <param name="optionid">Required parameter: Vehicle option ID (&optionid=xxx&optionid=xxx&optionid=xxx for multiples)</param> /// <param name="styleid">Required parameter: Vehicle style ID</param> /// <param name="zip">Required parameter: Five-digit zipcode</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> GetCalculatenewtmvAsync( string callback, string colorid, string fmt, string optionid, string styleid, string zip) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1/api/tmv/tmvservice/calculatenewtmv"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "callback", callback }, { "colorid", colorid }, { "fmt", fmt }, { "optionid", optionid }, { "styleid", styleid }, { "zip", zip }, { "api_key", Configuration.ApiKey } }); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, _context); } }
/// <summary> /// TODO: type endpoint description here /// </summary> /// <param name="boolean">Required parameter: TODO: type parameter description here</param> /// <param name="number">Required parameter: TODO: type parameter description here</param> /// <param name="mstring">Required parameter: TODO: type parameter description here</param> /// <param name="queryParameters">Additional optional query parameters are supported by this endpoint</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> SimpleQueryAsync( bool boolean, int number, string mstring, Dictionary <string, object> queryParameters = null) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/query"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "boolean", boolean }, { "number", number }, { "string", mstring } }); //append optional parameters to the query APIHelper.AppendUrlWithQueryParameters(_queryBuilder, queryParameters); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "Stamplay SDK" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if ((_response.StatusCode < 200) || (_response.StatusCode > 206)) //[200,206] = HTTP OK { throw new APIException(@"HTTP Response Not OK", _context); } try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, _context); } }
/// <summary> /// Get a list of existing keywords. /// </summary> /// <param name="format">Required parameter: Response format e.g. json or xml</param> /// <param name="number">Optional parameter: Filter the list by virtual number</param> /// <param name="page">Optional parameter: Page number, for pagination</param> /// <param name="max">Optional parameter: Maximum results returned per page</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> GetKeywordsAsync( string format, string number = null, string page = null, string max = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/get-keywords.{format}"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "format", format } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "number", number }, { "page", page }, { "max", max } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.Apikey, Configuration.Apisecret); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Calculates the expression using the specified operation. /// </summary> /// <param name="Models.GetCalculateInput">Object containing request parameters</param> /// <return>Returns the double response from the API call</return> public async Task <double> GetCalculateAsync(Models.GetCalculateInput input) { //Check if authentication token is set AuthManager.Instance.CheckAuthorization(); //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/{operation}"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "operation", Models.OperationTypeEnumHelper.ToValue(input.Operation) } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "x", input.X }, { "y", input.Y } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" } }; _headers.Add("gfdsfkl", Configuration.Gfdsfkl); _headers.Add("dsfsdf", Configuration.Dsfsdf); _headers.Add("Authorization", string.Format("Bearer {0}", Configuration.OAuthToken.AccessToken)); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(double.Parse(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Retrieves a list of orders under a platform /// </summary> /// <param name="Models.GetOrdersInput">Object containing request parameters</param> /// <return>Returns the Models.GetOrdersResponseModel response from the API call</return> public async Task <Models.GetOrdersResponseModel> GetOrdersAsync(Models.GetOrdersInput input) { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/orders"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "accountIdentifier", input.AccountIdentifier }, { "customerIdentifier", input.CustomerIdentifier }, { "externalRefID", input.ExternalRefID }, { "startDate", (input.StartDate.HasValue) ? input.StartDate.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null }, { "endDate", (input.EndDate.HasValue) ? input.EndDate.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null }, { "elementsPerBlock", input.ElementsPerBlock }, { "page", input.Page } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "V2NGSDK" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.PlatformName, Configuration.PlatformKey); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK { throw new RaasGenericException(@"API Error", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.GetOrdersResponseModel>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// List All Inbound ShortCode /// </summary> /// <param name="Models.CreateShortcodeGetinboundsmsInput">Object containing request parameters</param> /// <return>Returns the string response from the API call</return> public async Task <string> CreateShortcodeGetinboundsmsAsync(Models.CreateShortcodeGetinboundsmsInput input) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/shortcode/getinboundsms.json"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "Datecreated", input.Datecreated } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" } }; //append form/field parameters var _fields = new List <KeyValuePair <string, Object> >() { new KeyValuePair <string, object>("page", input.Page), new KeyValuePair <string, object>("pagesize", input.Pagesize), new KeyValuePair <string, object>("from", input.From), new KeyValuePair <string, object>("Shortcode", input.Shortcode) }; //remove null parameters _fields = _fields.Where(kvp => kvp.Value != null).ToList(); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// This endpoint allows to get list of payments. In order to get detailed payment history and reconciliation you can use this endpoint. /// You can try this API with configuring client parameters in Console Tab below. Test OAuthClientId is b30359c21700fd6f2b91154adcb7b37bab3e7e0a33e22682e5dd149d7a6ac4df and OAuthClientSecret is 4bc4335faad41d6a23cd059e495005f00496a64e34e6187b1d72695a8debd28c /// </summary> /// <param name="filterStoreCode">Required parameter: Filter for an online store.</param> /// <param name="filterCreatedAt">Required parameter: Filter for created_at field. It is accepted a valid date range value. The format is YYYY-MM-DD..YYYY-MM-DD.</param> /// <param name="filterStatus">Optional parameter: Filter for status field. It is accepted a valid status value of payment.</param> /// <param name="sort">Optional parameter: Sort for some selected fields. In order to sort descending "-" value will be used before the field. Valid field values are "created_at", "updated_at", "status".</param> /// <return>Returns the Models.ListMilePaymentResponse response from the API call</return> public async Task <Models.ListMilePaymentResponse> ListMilePaymentsAsync( string filterStoreCode, string filterCreatedAt, string filterStatus = null, string sort = null) { //Check if authentication token is set AuthManager.Instance.CheckAuthorization(); //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v2/ecommerce/payments"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "filter[store_code]", filterStoreCode }, { "filter[created_at]", filterCreatedAt }, { "filter[status]", filterStatus }, { "sort", sort } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; _headers.Add("Authorization", string.Format("Bearer {0}", Configuration.OAuthToken.AccessToken)); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.ListMilePaymentResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// TODO: type endpoint description here /// </summary> /// <param name="days">Required parameter: Example: </param> /// <return>Returns the ServerResponse response from the API call</return> public async Task <ServerResponse> SendStringEnumArrayAsync(List <Days> days) { //validating required parameters if (null == days) { throw new ArgumentNullException("days", "The parameter \"days\" is a required parameter and cannot be null."); } //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/form/stringenum"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "array", "true" } }); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "Stamplay SDK" }, { "accept", "application/json" } }; //append form/field parameters var _fields = new Dictionary <string, object>(); _fields.Add(APIHelper.PrepareFormFieldsFromObject("days", days)); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <ServerResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// آپلود فایل در ایزی بیمه /// بعد از آپلود، ادرس فایل باید در api های بعدی ارسال شود. /// </summary> /// <param name="subDomain">Required parameter: دامنه یا زیر دامنه ی مرکز بیمه</param> /// <param name="xApiKey">Required parameter: کلید اختصاصی ارتباط با سرور</param> /// <param name="file">Required parameter: فایل ارسالی</param> /// <return>Returns the Models.BaseModelUpload response from the API call</return> public async Task <Models.BaseModelUpload> UploadAsync(string subDomain, string xApiKey, string file) { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/FileManager/Upload"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "subDomain", subDomain } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" }, { "x-api-key", xApiKey } }; //append form/field parameters var _fields = new List <KeyValuePair <string, Object> >() { new KeyValuePair <string, object>("file", file) }; //remove null parameters _fields = _fields.Where(kvp => kvp.Value != null).ToList(); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.BaseModelUpload>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Categories are subdivisions within an account. /// The `defaultCategory` from [`/api/v2/accounts`](#operations-tag-Accounts) is where the main balance and transactions are held. /// Other categories are used for Savings Goals. /// </summary> /// <param name="accountUid">Required parameter: Account uid</param> /// <param name="categoryUid">Required parameter: Category uid</param> /// <param name="minTransactionTimestamp">Required parameter: Minimum transaction timestamp</param> /// <param name="maxTransactionTimestamp">Required parameter: Maximum transaction timestamp</param> /// <return>Returns the Models.FeedItems response from the API call</return> public async Task <FeedItems> GetQueryFeedItemsWithTransactionTimesBetweenAsync( Guid accountUid, Guid categoryUid, DateTime minTransactionTimestamp, DateTime maxTransactionTimestamp) { //the base uri for api requests var baseUri = Configuration.GetBaseURI(); //prepare query string for API call var queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/api/v2/feed/account/{accountUid}/category/{categoryUid}/transactions-between"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object> { { "accountUid", accountUid }, { "categoryUid", categoryUid } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(queryBuilder, new Dictionary <string, object> { // ReSharper disable StringLiteralTypo { "minTransactionTimestamp", minTransactionTimestamp.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") }, { "maxTransactionTimestamp", maxTransactionTimestamp.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") } // ReSharper restore StringLiteralTypo }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url var queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = APIHelper.GetRequestHeaders(); //prepare the API call request to fetch the response var request = ClientInstance.Get(queryUrl, headers); //invoke request and get response var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false); var context = new HTTPContext(request, response); //handle errors ValidateResponse(response, context); try { return(APIHelper.JsonDeserialize <FeedItems>(response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, context); } }
/// <summary> /// Clean and sanitize untrusted HTML. See: https://www.neutrinoapi.com/api/html-clean/ /// </summary> /// <param name="content">Required parameter: The HTML content. This can be either a URL to load HTML from or an actual HTML content string</param> /// <param name="outputType">Required parameter: The level of sanitization, possible values are:<br/><b>plain-text</b>: reduce the content to plain text only (no HTML tags at all)<br/><br/><b>simple-text</b>: allow only very basic text formatting tags like b, em, i, strong, u<br/><br/><b>basic-html</b>: allow advanced text formatting and hyper links<br/><br/><b>basic-html-with-images</b>: same as basic html but also allows image tags<br/><br/><b>advanced-html</b>: same as basic html with images but also allows many more common HTML tags like table, ul, dl, pre<br/></param> /// <return>Returns the Stream response from the API call</return> public async Task <Stream> HTMLCleanAsync(string content, string outputType) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/html-clean"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "user-id", Configuration.UserId }, { "api-key", Configuration.ApiKey } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" } }; //append form/field parameters var _fields = new List <KeyValuePair <string, Object> >() { new KeyValuePair <string, object>("content", content), new KeyValuePair <string, object>("output-type", outputType) }; //remove null parameters _fields = _fields.Where(kvp => kvp.Value != null).ToList(); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields); //invoke request and get response HttpResponse _response = await ClientInstance.ExecuteAsBinaryAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(_response.RawBody); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Get the list of accounts. /// </summary> /// <param name="page">Optional parameter: Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result.</param> /// <param name="limit">Optional parameter: Maximum number of results to return in the response. Default (10), threshold (100)</param> /// <param name="filter">Optional parameter: Allowed fields: name. Use the following delimiters to build your filters params. The vertical bar ('\|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd\|city::denver\|title::grand poobah'</param> /// <param name="sort">Optional parameter: Allowed fields: name, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('\|'), which is consistent with the separation of the name\|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name\|first_name\|-hire_date</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> GetAccountsAsync( int?page = 1, int?limit = 10, string filter = null, string sort = null) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/accounts"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "page", (null != page) ? page : 1 }, { "limit", (null != limit) ? limit : 10 }, { "filter", filter }, { "sort", sort } }); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" } }; _headers.Add("Content-Type", Configuration.ContentType); _headers.Add("X-Auth-Token", Configuration.XAuthToken); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Get the spending insights grouped by counter party /// </summary> /// <param name="accountUid">Required parameter: Account uid</param> /// <param name="year">Required parameter: Year</param> /// <param name="month">Required parameter: Month</param> /// <return>Returns the Models.SpendingCounterPartySummary response from the API call</return> public async Task <SpendingCounterPartySummary> GetQuerySpendingInsightsByCounterpartyAsync(Guid accountUid, string year, MonthEnum month) { //validating required parameters if (null == year) { throw new ArgumentNullException(nameof(year), "The parameter \"year\" is a required parameter and cannot be null."); } //the base uri for api requests var baseUri = Configuration.GetBaseURI(); //prepare query string for API call var queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/api/v2/accounts/{accountUid}/spending-insights/counter-party"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object> { { "accountUid", accountUid } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(queryBuilder, new Dictionary <string, object> { { "year", year }, { "month", MonthEnumHelper.ToValue(month) } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url var queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = APIHelper.GetRequestHeaders(); //prepare the API call request to fetch the response var request = ClientInstance.Get(queryUrl, headers); //invoke request and get response var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false); var context = new HTTPContext(request, response); //handle errors ValidateResponse(response, context); try { return(APIHelper.JsonDeserialize <SpendingCounterPartySummary>(response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, context); } }
/// <summary> /// N.B. if you're looking for only the next payment date, this is also returned when getting a standing order in the `StandingOrder` response from the field `nextDate`. /// Categories are subdivisions within an account. /// The `defaultCategory` from [`/api/v2/accounts`](#operations-tag-Accounts) is where the main balance and transactions are held. /// Other categories are used for Savings Goals. /// </summary> /// <param name="accountUid">Required parameter: Account uid</param> /// <param name="categoryUid">Required parameter: Category uid</param> /// <param name="paymentOrderUid">Required parameter: Payment Order uid</param> /// <param name="count">Optional parameter: Number of next payment dates to retrieve, between 1 and 100. If count is greater than the number of future payments all future payments will be returned. Defaults to 10.</param> /// <return>Returns the Models.NextPaymentDatesResponse response from the API call</return> public async Task <NextPaymentDatesResponse> ListNextPaymentDatesAsync( Guid accountUid, Guid categoryUid, Guid paymentOrderUid, int?count = null) { //the base uri for api requests var baseUri = Configuration.GetBaseURI(); //prepare query string for API call var queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/api/v2/payments/local/account/{accountUid}/category/{categoryUid}/standing-orders/{paymentOrderUid}/upcoming-payments"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object> { { "accountUid", accountUid }, { "categoryUid", categoryUid }, { "paymentOrderUid", paymentOrderUid } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(queryBuilder, new Dictionary <string, object> { { "count", count } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url var queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = APIHelper.GetRequestHeaders(); //prepare the API call request to fetch the response var request = ClientInstance.Get(queryUrl, headers); //invoke request and get response var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false); var context = new HTTPContext(request, response); //handle errors ValidateResponse(response, context); try { return(APIHelper.JsonDeserialize <NextPaymentDatesResponse>(response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, context); } }
/// <summary> /// To choose a file format, set the Accept header to either 'application/pdf' or 'text/csv' /// </summary> /// <param name="accountUid">Required parameter: Example: </param> /// <param name="yearMonth">Required parameter: Example: </param> /// <return>Returns the Stream response from the API call</return> public async Task <Stream> GetDownloadCsvStatementAsync(Guid accountUid, string yearMonth) { //validating required parameters if (null == yearMonth) { throw new ArgumentNullException(nameof(yearMonth), "The parameter \"yearMonth\" is a required parameter and cannot be null."); } //the base uri for api requests var baseUri = Configuration.GetBaseURI(); //prepare query string for API call var queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/api/v2/accounts/{accountUid}/statement/download"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object> { { "accountUid", accountUid } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(queryBuilder, new Dictionary <string, object> { { "yearMonth", yearMonth } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url var queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = APIHelper.GetRequestHeaders(true, true); //prepare the API call request to fetch the response var request = ClientInstance.Get(queryUrl, headers); //invoke request and get response var response = await ClientInstance.ExecuteAsBinaryAsync(request).ConfigureAwait(false); var context = new HTTPContext(request, response); //handle errors ValidateResponse(response, context); try { return(response.RawBody); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, context); } }
/// <summary> /// پیگیری وضعیت بیمه نامه /// </summary> /// <param name="trackingCode">Required parameter: شماره ی پیگیری بیمه نامه</param> /// <param name="nationalCode">Required parameter: کد ملی کاربر</param> /// <param name="xApiKey">Required parameter: کلید اختصاصی ارتباط با سرور</param> /// <return>Returns the Models.BaseModelInsurancePolicyTracking response from the API call</return> public async Task <Models.BaseModelInsurancePolicyTracking> GetInsurancePolicyTrackingAsync(int trackingCode, long nationalCode, string xApiKey) { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/InsurancePolicy/Tracking"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "trackingCode", trackingCode }, { "nationalCode", nationalCode } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" }, { "x-api-key", xApiKey } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if (_response.StatusCode == 500) { throw new InternalServerErrorException(@"Internal Server Error", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.BaseModelInsurancePolicyTracking>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Gets Items /// </summary> /// <param name="size">Optional parameter: The number of the users response. Defaults to 10. Must be between 1 and 10,000 inclusive. This parameter must be string represetation of an integer like "1".</param> /// <param name="mfrom">Optional parameter: The number of users to be skipped from the response. Defaults to 0. Must be bigger than or equal to 0. This parameter must be string represetation of an integer like "1".</param> /// <return>Returns the Models.ItemsResponse response from the API call</return> public async Task <Models.ItemsResponse> GetItemsAsync(long?size = null, long?mfrom = null) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1/items"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "size", size }, { "from", mfrom } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "SUGGESTGRID" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK { throw new ErrorResponseException(@"Unexpected internal error.", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.ItemsResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Retrieve all the webhooks created for the connected account. /// A successful request to the retrieve webhook endpoint will return a response body as follows: /// ``` /// { /// "page": 0, /// "pageSize": 100, /// "pageData": [ /// { /// "url": "https://webhook.com", /// "method": "POST", /// "id": "8805c9d8-bef7-41c7-906a-69ede93aa024", /// "encoding": "JSON", /// "events": [ /// "RECEIVED_SMS" /// ], /// "headers": {}, /// "template": "{\"id\":\"$mtId\", \"status\":\"$statusCode\"}" /// } /// ] /// } /// ``` /// *Note: Response 400 is returned when the `page` query parameter is not valid or the `pageSize` query parameter is not valid.* /// </summary> /// <param name="page">Optional parameter: Example: </param> /// <param name="pageSize">Optional parameter: Example: </param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> RetrieveWebhookAsync(int?page = null, int?pageSize = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1/webhooks/messages/"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "page", page }, { "pageSize", pageSize } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "messagesmedia-webhooks" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if (_response.StatusCode == 400) { throw new RetrieveWebhook400ResponseException(@"Unexpected error in API call. See HTTP response body for details.", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <dynamic>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// TODO: type endpoint description here /// </summary> /// <param name="chargeId">Required parameter: Charge Id</param> /// <param name="page">Optional parameter: Page number</param> /// <param name="size">Optional parameter: Page size</param> /// <return>Returns the Models.ListChargeTransactionsResponse response from the API call</return> public async Task <Models.ListChargeTransactionsResponse> GetChargeTransactionsAsync(string chargeId, int?page = null, int?size = null) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/charges/{charge_id}/transactions"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "charge_id", chargeId } }); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "page", page }, { "size", size } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "MundiSDK - DotNet 0.16.21" }, { "accept", "application/json" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.ListChargeTransactionsResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// دریافت اطلاعات پایه ی بیمه ی زلزله /// </summary> /// <param name="subDomain">Required parameter: دامنه یا زیر دامنه ی مرکز بیمه</param> /// <param name="insurancePolicyId">Required parameter: شناسه ی بیمه نامه</param> /// <param name="insurancePolicyType">Required parameter: شناسه ی نوع بیمه نامه</param> /// <param name="xApiKey">Required parameter: کلید اختصاصی ارتباط با سرور</param> /// <return>Returns the Models.BaseModelEarthquake response from the API call</return> public async Task <Models.BaseModelEarthquake> GetEarthquakeAsync( string subDomain, int insurancePolicyId, int insurancePolicyType, string xApiKey) { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/FireInsurance/Initialize"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "subDomain", subDomain }, { "insurancePolicyId", insurancePolicyId }, { "insurancePolicyType", insurancePolicyType } }, ArrayDeserializationFormat, ParameterSeparator); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "accept", "application/json" }, { "x-api-key", xApiKey } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.BaseModelEarthquake>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }