/// <summary> /// Remove an IP Address in the Whitelist /// </summary> /// <param name="entryId">Required parameter: a unique identifier for the IP Address; opaque but likely a GUID</param> /// <param name="body">Required parameter: Example: </param> /// <return>Returns the Models.RemoveResponse response from the API call</return> public async Task <Models.RemoveResponse> RemoveAsync(string entryId, Models.IPAddress body) { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1.1/whitelists/ipaddresses/{entry_id}/delete"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "entry_id", entryId } }); //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" }, { "content-type", "application/json; charset=utf-8" } }; //append body params var _body = APIHelper.JsonSerialize(body); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.DeleteBody(_queryUrl, _headers, _body); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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 ReturnException(@"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 <Models.RemoveResponse>(_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="webhookId">Required parameter: Example: </param> /// <return>Returns the string response from the API call</return> public async Task <string> DestroyAsync(int webhookId) { //the base uri for api requestss string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/webhooks/{webhook_id}"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "webhook_id", webhookId } }); //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("X-API-TOKEN", Configuration.XAPITOKEN); _headers.Add("X-API-EMAIL", Configuration.XAPIEMAIL); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Delete(_queryUrl, _headers, null); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// List all Geo Locations in the Blacklist /// </summary> /// <return>Returns the Models.ListResponse1 response from the API call</return> public async Task <Models.ListResponse1> ListAsync() { //the base uri for api requests string _baseUri = Configuration.GetBaseURI(); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1.1/blacklists/geolocations"); //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); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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 ReturnException(@"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 <Models.ListResponse1>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// User Registration API /// </summary> /// <param name="Models.UserRegistrationInput">Object containing request parameters</param> /// <param name="queryParameters">Additional optional query parameters are supported by this endpoint</param> /// <return>Returns the Models.UserRegistrationModelResponse response from the API call</return> public async Task <Models.UserRegistrationModelResponse> UserRegistrationAsync(Models.UserRegistrationInput input, Dictionary <string, object> queryParameters = null) { //validating required parameters if (null == input.Email) { throw new ArgumentNullException("email", "The property \"Email\" in the input object cannot be null."); } if (null == input.User) { throw new ArgumentNullException("user", "The property \"User\" in the input object cannot be null."); } if (null == input.Password) { throw new ArgumentNullException("password", "The property \"Password\" in the input object cannot be null."); } //the base uri for api requests string _baseUri = Configuration.GetBaseURI(Configuration.Servers.PATH); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/a/u/r"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "email", input.Email }, { "user", input.User }, { "password", input.Password }, { "name", input.Name }, { "phone", input.Phone }, { "countrycode", input.Countrycode }, { "address", input.Address } }, ArrayDeserializationFormat, ParameterSeparator); //append optional parameters to the query APIHelper.AppendUrlWithQueryParameters(_queryBuilder, queryParameters, 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", "SMASH" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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(APIHelper.JsonDeserialize <Models.UserRegistrationModelResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }
/// <summary> /// Data Manipulation API /// </summary> /// <param name="Models.HttpsApiRestShApiDInput">Object containing request parameters</param> /// <return>Returns the Models.DataManipulationModelResponse response from the API call</return> public async Task <Models.DataManipulationModelResponse> HttpsApiRestShApiDAsync(Models.HttpsApiRestShApiDInput input) { //validating required parameters if (null == input.Data) { throw new ArgumentNullException("data", "The property \"Data\" in the input object cannot be null."); } if (null == input.Transform) { throw new ArgumentNullException("transform", "The property \"Transform\" in the input object cannot be null."); } //the base uri for api requests string _baseUri = Configuration.GetBaseURI(Configuration.Servers.PATH); //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/d"); //process optional query parameters APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>() { { "data", input.Data }, { "transform", input.Transform } }, 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", "SMASH" } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Get(_queryUrl, _headers); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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(APIHelper.JsonDeserialize <Models.DataManipulationModelResponse>(_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="webhook">Required parameter: Example: </param> /// <return>Returns the Webhook response from the API call</return> public async Task <Webhook> CreateAsync(Webhook webhook) { //validating required parameters if (null == webhook) { throw new ArgumentNullException("webhook", "The parameter \"webhook\" 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("/webhooks"); //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" }, { "content-type", "application/json; charset=utf-8" } }; _headers.Add("X-API-TOKEN", Configuration.XAPITOKEN); _headers.Add("X-API-EMAIL", Configuration.XAPIEMAIL); //append body params var _body = APIHelper.JsonSerialize(webhook); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.PostBody(_queryUrl, _headers, _body); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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 <Webhook>(_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="file">Required parameter: Example: </param> /// <param name="ticketId">Required parameter: Example: </param> /// <return>Returns the string response from the API call</return> public async Task <string> UploadInvoiceAsync(FileStreamInfo file, string ticketId) { //validating required parameters if (null == file) { throw new ArgumentNullException("file", "The parameter \"file\" is a required parameter and cannot be null."); } if (null == ticketId) { throw new ArgumentNullException("ticketId", "The parameter \"ticketId\" 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("/tickets/{ticket_id}/invoice_upload"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>() { { "ticket_id", ticketId } }); //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("X-API-TOKEN", Configuration.XAPITOKEN); _headers.Add("X-API-EMAIL", Configuration.XAPIEMAIL); //append form/field parameters var _fields = new Dictionary <string, object>() { { "file", file } }; //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.Post(_queryUrl, _headers, _fields); //Custom Authentication to be added for authorization AuthUtility.AppendCustomAuthParams(_request); //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(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }