Пример #1
0
        /// <summary>
        /// Address validation This operation schedules a USPS package pickup from a residential or commercial location and provides a pickup confirmation number.
        /// </summary>
        /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="xPBTransactionId">A unique identifier for the transaction, up to 25 characters</param>
        /// <param name="schedulePickup">Schedule Pickup request.</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 SchedulePickupResponse</returns>
        public async System.Threading.Tasks.Task <SchedulePickupResponse> GetPickupscheduleAsync(string xPBTransactionId, SchedulePickup schedulePickup, bool?xPBUnifiedErrorStructure = default(bool?))
        {
            ApiResponse <SchedulePickupResponse> localVarResponse = await GetPickupscheduleAsyncWithHttpInfo(xPBTransactionId, schedulePickup, xPBUnifiedErrorStructure);

            return(localVarResponse.Data);
        }
Пример #2
0
        /// <summary>
        /// Address validation This operation schedules a USPS package pickup from a residential or commercial location and provides a pickup confirmation number.
        /// </summary>
        /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="xPBTransactionId">A unique identifier for the transaction, up to 25 characters</param>
        /// <param name="schedulePickup">Schedule Pickup request.</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 (SchedulePickupResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <SchedulePickupResponse> > GetPickupscheduleAsyncWithHttpInfo(string xPBTransactionId, SchedulePickup schedulePickup, bool?xPBUnifiedErrorStructure = default(bool?))
        {
            // verify the required parameter 'xPBTransactionId' is set
            if (xPBTransactionId == null)
            {
                throw new ApiException(400, "Missing required parameter 'xPBTransactionId' when calling PickupApi->GetPickupschedule");
            }
            // verify the required parameter 'schedulePickup' is set
            if (schedulePickup == null)
            {
                throw new ApiException(400, "Missing required parameter 'schedulePickup' when calling PickupApi->GetPickupschedule");
            }

            var    localVarPath         = "/v1/pickups/schedule";
            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 (xPBTransactionId != null)
            {
                localVarHeaderParams.Add("X-PB-TransactionId", this.Configuration.ApiClient.ParameterToString(xPBTransactionId));                           // header parameter
            }
            if (schedulePickup != null && schedulePickup.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(schedulePickup); // http body (model) parameter
            }
            else
            {
                localVarPostBody = schedulePickup; // 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("GetPickupschedule", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <SchedulePickupResponse>(localVarStatusCode,
                                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                            (SchedulePickupResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SchedulePickupResponse))));
        }
Пример #3
0
        /// <summary>
        /// Address validation This operation schedules a USPS package pickup from a residential or commercial location and provides a pickup confirmation number.
        /// </summary>
        /// <exception cref="shippingapi.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="xPBTransactionId">A unique identifier for the transaction, up to 25 characters</param>
        /// <param name="schedulePickup">Schedule Pickup request.</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>SchedulePickupResponse</returns>
        public SchedulePickupResponse GetPickupschedule(string xPBTransactionId, SchedulePickup schedulePickup, bool?xPBUnifiedErrorStructure = default(bool?))
        {
            ApiResponse <SchedulePickupResponse> localVarResponse = GetPickupscheduleWithHttpInfo(xPBTransactionId, schedulePickup, xPBUnifiedErrorStructure);

            return(localVarResponse.Data);
        }