/// <summary> /// getTrackingDetails /// </summary> /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="addTrackingEvents">add track event</param> /// <param name="xPBUnifiedErrorStructure">Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional, default to true)</param> /// <returns>Task of InlineResponse2002</returns> public async System.Threading.Tasks.Task <InlineResponse2002> AddTrackingEventsAsync(AddTrackingEvents addTrackingEvents, bool?xPBUnifiedErrorStructure = default(bool?)) { ApiResponse <InlineResponse2002> localVarResponse = await AddTrackingEventsAsyncWithHttpInfo(addTrackingEvents, xPBUnifiedErrorStructure); return(localVarResponse.Data); }
/// <summary> /// getTrackingDetails /// </summary> /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="addTrackingEvents">add track event</param> /// <param name="xPBUnifiedErrorStructure">Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional, default to true)</param> /// <returns>Task of ApiResponse (InlineResponse2002)</returns> public async System.Threading.Tasks.Task <ApiResponse <InlineResponse2002> > AddTrackingEventsAsyncWithHttpInfo(AddTrackingEvents addTrackingEvents, bool?xPBUnifiedErrorStructure = default(bool?)) { // verify the required parameter 'addTrackingEvents' is set if (addTrackingEvents == null) { throw new ApiException(400, "Missing required parameter 'addTrackingEvents' when calling TrackingApi->AddTrackingEvents"); } var localVarPath = "/v2/track/events"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (xPBUnifiedErrorStructure != null) { localVarHeaderParams.Add("X-PB-UnifiedErrorStructure", this.Configuration.ApiClient.ParameterToString(xPBUnifiedErrorStructure)); // header parameter } if (addTrackingEvents != null && addTrackingEvents.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(addTrackingEvents); // http body (model) parameter } else { localVarPostBody = addTrackingEvents; // byte array } // authentication (oAuth2ClientCredentials) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("AddTrackingEvents", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <InlineResponse2002>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (InlineResponse2002)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse2002)))); }
/// <summary> /// getTrackingDetails /// </summary> /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="addTrackingEvents">add track event</param> /// <param name="xPBUnifiedErrorStructure">Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional, default to true)</param> /// <returns>InlineResponse2002</returns> public InlineResponse2002 AddTrackingEvents(AddTrackingEvents addTrackingEvents, bool?xPBUnifiedErrorStructure = default(bool?)) { ApiResponse <InlineResponse2002> localVarResponse = AddTrackingEventsWithHttpInfo(addTrackingEvents, xPBUnifiedErrorStructure); return(localVarResponse.Data); }