/// <summary> /// Mark a delivery report as confirmed so it is no longer return in check delivery reports requests. /// The confirm delivery reports endpoint is intended to be used in conjunction with the check delivery /// reports endpoint to allow for robust processing of delivery reports. Once one or more delivery /// reports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they /// are no longer returned in subsequent check delivery reports requests. /// The confirm delivery reports endpoint takes a list of delivery report IDs as follows: /// ```json /// { /// "delivery_report_ids": [ /// "011dcead-6988-4ad6-a1c7-6b6c68ea628d", /// "3487b3fa-6586-4979-a233-2d1b095c7718", /// "ba28e94b-c83d-4759-98e7-ff9c7edb87a1" /// ] /// } /// ``` /// Up to 100 delivery reports can be confirmed in a single confirm delivery reports request. /// </summary> /// <param name="body">Required parameter: Example: </param> /// <return>Returns the dynamic response from the API call</return> public dynamic CreateConfirmDeliveryReportsAsReceived(Models.ConfirmDeliveryReportsAsReceivedRequest body) { Task <dynamic> t = CreateConfirmDeliveryReportsAsReceivedAsync(body); APIHelper.RunTaskSynchronously(t); return(t.Result); }
/// <summary> /// Mark a delivery report as confirmed so it is no longer return in check delivery reports requests. /// The confirm delivery reports endpoint is intended to be used in conjunction with the check delivery /// reports endpoint to allow for robust processing of delivery reports. Once one or more delivery /// reports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they /// are no longer returned in subsequent check delivery reports requests. /// The confirm delivery reports endpoint takes a list of delivery report IDs as follows: /// ```json /// { /// "delivery_report_ids": [ /// "011dcead-6988-4ad6-a1c7-6b6c68ea628d", /// "3487b3fa-6586-4979-a233-2d1b095c7718", /// "ba28e94b-c83d-4759-98e7-ff9c7edb87a1" /// ] /// } /// ``` /// Up to 100 delivery reports can be confirmed in a single confirm delivery reports request. /// </summary> /// <param name="body">Required parameter: Example: </param> /// <param name="accountHeaderValue">Optional parameter: Sends the API an account value.</param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> CreateConfirmDeliveryReportsAsReceivedAsync(Models.ConfirmDeliveryReportsAsReceivedRequest body, string accountHeaderValue = null) { //the base uri for api requests string baseUri = Configuration.BaseUri; string methodUri = "/v1/delivery_reports/confirmed"; //prepare query string for API call StringBuilder queryBuilder = new StringBuilder(baseUri); queryBuilder.Append(methodUri); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = new Dictionary <string, string>() { { "user-agent", SdkVersion }, { "accept", "application/json" }, { "content-type", "application/json; charset=utf-8" } }; AddAccountHeaderTo(headers, accountHeaderValue); //append body params var jsonBody = APIHelper.JsonSerialize(body); //prepare the API call request to fetch the response HttpRequest request = PostHttpRequest(_queryUrl, headers, jsonBody); //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 APIException(@"", 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> /// Mark a delivery report as confirmed so it is no longer return in check delivery reports requests. /// The confirm delivery reports endpoint is intended to be used in conjunction with the check delivery /// reports endpoint to allow for robust processing of delivery reports. Once one or more delivery /// reports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they /// are no longer returned in subsequent check delivery reports requests. /// The confirm delivery reports endpoint takes a list of delivery report IDs as follows: /// ```json /// { /// "delivery_report_ids": [ /// "011dcead-6988-4ad6-a1c7-6b6c68ea628d", /// "3487b3fa-6586-4979-a233-2d1b095c7718", /// "ba28e94b-c83d-4759-98e7-ff9c7edb87a1" /// ] /// } /// ``` /// Up to 100 delivery reports can be confirmed in a single confirm delivery reports request. /// </summary> /// <param name="body">Required parameter: Example: </param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> CreateConfirmDeliveryReportsAsReceivedAsync(Models.ConfirmDeliveryReportsAsReceivedRequest body) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1/delivery_reports/confirmed"); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "messagemedia-messages-csharp-sdk-1.0.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.PostBody(_queryUrl, _headers, _body, 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 APIException(@"", _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> /// Mark a delivery report as confirmed so it is no longer return in check delivery reports requests. /// The confirm delivery reports endpoint is intended to be used in conjunction with the check delivery /// reports endpoint to allow for robust processing of delivery reports. Once one or more delivery /// reports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they /// are no longer returned in subsequent check delivery reports requests. /// The confirm delivery reports endpoint takes a list of delivery report IDs as follows: /// ```json /// { /// "delivery_report_ids": [ /// "011dcead-6988-4ad6-a1c7-6b6c68ea628d", /// "3487b3fa-6586-4979-a233-2d1b095c7718", /// "ba28e94b-c83d-4759-98e7-ff9c7edb87a1" /// ] /// } /// ``` /// Up to 100 delivery reports can be confirmed in a single confirm delivery reports request. /// </summary> /// <param name="body">Required parameter: Example: </param> /// <return>Returns the dynamic response from the API call</return> public async Task <dynamic> ConfirmDeliveryReportsAsReceivedAsync(Models.ConfirmDeliveryReportsAsReceivedRequest body) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/v1/delivery_reports/confirmed"); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "messagemedia-messages" }, { "accept", "application/json" }, { "content-type", "application/json; charset=utf-8" } }; //append body params var _body = APIHelper.JsonSerialize(body); //append authentication headers AuthManager.Instance.GetAuthHeaders(_queryUrl, _baseUri, _body).ToList().ForEach(x => _headers.Add(x.Key, x.Value)); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.PostBody(_queryUrl, _headers, _body); //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); } }