All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kibocommerce.sdk.fulfillment.api.ShipmentAttributesControllerApi Maven / Gradle / Ivy

/*
 * Kibo Fulfillment API - Production Profile
 * REST API backing the Kibo Fulfiller User Interface
 *
 * OpenAPI spec version: 1.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.kibocommerce.sdk.fulfillment.api;

import com.kibocommerce.sdk.fulfillment.ApiCallback;
import com.kibocommerce.sdk.fulfillment.ApiClient;
import com.kibocommerce.sdk.fulfillment.ApiException;
import com.kibocommerce.sdk.fulfillment.ApiResponse;
import com.kibocommerce.sdk.fulfillment.Configuration;
import com.kibocommerce.sdk.fulfillment.Pair;
import com.kibocommerce.sdk.fulfillment.ProgressRequestBody;
import com.kibocommerce.sdk.fulfillment.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.kibocommerce.sdk.fulfillment.model.ShipmentAttribute;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ShipmentAttributesControllerApi {
    private ApiClient apiClient;

    public ShipmentAttributesControllerApi() {
        this(Configuration.getDefaultApiClient());
    }

    public ShipmentAttributesControllerApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Build call for deleteShipmentAttributeUsingDELETE
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call deleteShipmentAttributeUsingDELETECall(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = new Object();

        // create path and map variables
        String localVarPath = "/commerce/shipments/{shipmentNumber}/attributes/{key}"
            .replaceAll("\\{" + "key" + "\\}", apiClient.escapeString(key.toString()))
            .replaceAll("\\{" + "shipmentNumber" + "\\}", apiClient.escapeString(shipmentNumber.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        if (xVolSite != null) {
            localVarHeaderParams.put("x-vol-site", apiClient.parameterToString(xVolSite));
        }

        if (xVolTenant != null) {
            localVarHeaderParams.put("x-vol-tenant", apiClient.parameterToString(xVolTenant));
        }

        Map localVarFormParams = new HashMap();
        final String[] localVarAccepts = {
            
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call deleteShipmentAttributeUsingDELETEValidateBeforeCall(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'key' is set
        if (key == null) {
            throw new ApiException("Missing the required parameter 'key' when calling deleteShipmentAttributeUsingDELETE(Async)");
        }
        
        // verify the required parameter 'shipmentNumber' is set
        if (shipmentNumber == null) {
            throw new ApiException("Missing the required parameter 'shipmentNumber' when calling deleteShipmentAttributeUsingDELETE(Async)");
        }
        
        // verify the required parameter 'xVolTenant' is set
        if (xVolTenant == null) {
            throw new ApiException("Missing the required parameter 'xVolTenant' when calling deleteShipmentAttributeUsingDELETE(Async)");
        }
        

        com.squareup.okhttp.Call call = deleteShipmentAttributeUsingDELETECall(key, shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        return call;

    }

    /**
     * deleteShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void deleteShipmentAttributeUsingDELETE(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        deleteShipmentAttributeUsingDELETEWithHttpInfo(key, shipmentNumber, xVolTenant, xVolSite);
    }

    /**
     * deleteShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse deleteShipmentAttributeUsingDELETEWithHttpInfo(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        com.squareup.okhttp.Call call = deleteShipmentAttributeUsingDELETEValidateBeforeCall(key, shipmentNumber, xVolTenant, xVolSite, null, null);
        return apiClient.execute(call);
    }

    /**
     * deleteShipmentAttribute (asynchronously)
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call deleteShipmentAttributeUsingDELETEAsync(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = deleteShipmentAttributeUsingDELETEValidateBeforeCall(key, shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for getShipmentAttributeUsingGET
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call getShipmentAttributeUsingGETCall(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = new Object();

        // create path and map variables
        String localVarPath = "/commerce/shipments/{shipmentNumber}/attributes/{key}"
            .replaceAll("\\{" + "key" + "\\}", apiClient.escapeString(key.toString()))
            .replaceAll("\\{" + "shipmentNumber" + "\\}", apiClient.escapeString(shipmentNumber.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        if (xVolSite != null) {
            localVarHeaderParams.put("x-vol-site", apiClient.parameterToString(xVolSite));
        }

        if (xVolTenant != null) {
            localVarHeaderParams.put("x-vol-tenant", apiClient.parameterToString(xVolTenant));
        }

        Map localVarFormParams = new HashMap();
        final String[] localVarAccepts = {
            "application/xml", "application/json", "application/hal+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getShipmentAttributeUsingGETValidateBeforeCall(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'key' is set
        if (key == null) {
            throw new ApiException("Missing the required parameter 'key' when calling getShipmentAttributeUsingGET(Async)");
        }
        
        // verify the required parameter 'shipmentNumber' is set
        if (shipmentNumber == null) {
            throw new ApiException("Missing the required parameter 'shipmentNumber' when calling getShipmentAttributeUsingGET(Async)");
        }
        
        // verify the required parameter 'xVolTenant' is set
        if (xVolTenant == null) {
            throw new ApiException("Missing the required parameter 'xVolTenant' when calling getShipmentAttributeUsingGET(Async)");
        }
        

        com.squareup.okhttp.Call call = getShipmentAttributeUsingGETCall(key, shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        return call;

    }

    /**
     * getShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @return ShipmentAttribute
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ShipmentAttribute getShipmentAttributeUsingGET(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        ApiResponse resp = getShipmentAttributeUsingGETWithHttpInfo(key, shipmentNumber, xVolTenant, xVolSite);
        return resp.getData();
    }

    /**
     * getShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @return ApiResponse<ShipmentAttribute>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getShipmentAttributeUsingGETWithHttpInfo(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        com.squareup.okhttp.Call call = getShipmentAttributeUsingGETValidateBeforeCall(key, shipmentNumber, xVolTenant, xVolSite, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * getShipmentAttribute (asynchronously)
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call getShipmentAttributeUsingGETAsync(String key, Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = getShipmentAttributeUsingGETValidateBeforeCall(key, shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getShipmentAttributesUsingGET
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call getShipmentAttributesUsingGETCall(Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = new Object();

        // create path and map variables
        String localVarPath = "/commerce/shipments/{shipmentNumber}/attributes"
            .replaceAll("\\{" + "shipmentNumber" + "\\}", apiClient.escapeString(shipmentNumber.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        if (xVolSite != null) {
            localVarHeaderParams.put("x-vol-site", apiClient.parameterToString(xVolSite));
        }

        if (xVolTenant != null) {
            localVarHeaderParams.put("x-vol-tenant", apiClient.parameterToString(xVolTenant));
        }

        Map localVarFormParams = new HashMap();
        final String[] localVarAccepts = {
            "application/xml", "application/json", "application/hal+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call getShipmentAttributesUsingGETValidateBeforeCall(Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'shipmentNumber' is set
        if (shipmentNumber == null) {
            throw new ApiException("Missing the required parameter 'shipmentNumber' when calling getShipmentAttributesUsingGET(Async)");
        }
        
        // verify the required parameter 'xVolTenant' is set
        if (xVolTenant == null) {
            throw new ApiException("Missing the required parameter 'xVolTenant' when calling getShipmentAttributesUsingGET(Async)");
        }
        

        com.squareup.okhttp.Call call = getShipmentAttributesUsingGETCall(shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        return call;

    }

    /**
     * getShipmentAttributes
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @return List<ShipmentAttribute>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List getShipmentAttributesUsingGET(Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        ApiResponse> resp = getShipmentAttributesUsingGETWithHttpInfo(shipmentNumber, xVolTenant, xVolSite);
        return resp.getData();
    }

    /**
     * getShipmentAttributes
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @return ApiResponse<List<ShipmentAttribute>>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse> getShipmentAttributesUsingGETWithHttpInfo(Integer shipmentNumber, Integer xVolTenant, Integer xVolSite) throws ApiException {
        com.squareup.okhttp.Call call = getShipmentAttributesUsingGETValidateBeforeCall(shipmentNumber, xVolTenant, xVolSite, null, null);
        Type localVarReturnType = new TypeToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * getShipmentAttributes (asynchronously)
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param xVolSite  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call getShipmentAttributesUsingGETAsync(Integer shipmentNumber, Integer xVolTenant, Integer xVolSite, final ApiCallback> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = getShipmentAttributesUsingGETValidateBeforeCall(shipmentNumber, xVolTenant, xVolSite, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for setShipmentAttributeUsingPUT
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attribute (required)
     * @param xVolSite  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call setShipmentAttributeUsingPUTCall(String key, Integer shipmentNumber, Integer xVolTenant, ShipmentAttribute shipmentAttribute, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = shipmentAttribute;

        // create path and map variables
        String localVarPath = "/commerce/shipments/{shipmentNumber}/attributes/{key}"
            .replaceAll("\\{" + "key" + "\\}", apiClient.escapeString(key.toString()))
            .replaceAll("\\{" + "shipmentNumber" + "\\}", apiClient.escapeString(shipmentNumber.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        if (xVolSite != null) {
            localVarHeaderParams.put("x-vol-site", apiClient.parameterToString(xVolSite));
        }

        if (xVolTenant != null) {
            localVarHeaderParams.put("x-vol-tenant", apiClient.parameterToString(xVolTenant));
        }

        Map localVarFormParams = new HashMap();
        final String[] localVarAccepts = {
            "application/xml", "application/json", "application/hal+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call setShipmentAttributeUsingPUTValidateBeforeCall(String key, Integer shipmentNumber, Integer xVolTenant, ShipmentAttribute shipmentAttribute, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'key' is set
        if (key == null) {
            throw new ApiException("Missing the required parameter 'key' when calling setShipmentAttributeUsingPUT(Async)");
        }
        
        // verify the required parameter 'shipmentNumber' is set
        if (shipmentNumber == null) {
            throw new ApiException("Missing the required parameter 'shipmentNumber' when calling setShipmentAttributeUsingPUT(Async)");
        }
        
        // verify the required parameter 'xVolTenant' is set
        if (xVolTenant == null) {
            throw new ApiException("Missing the required parameter 'xVolTenant' when calling setShipmentAttributeUsingPUT(Async)");
        }
        
        // verify the required parameter 'shipmentAttribute' is set
        if (shipmentAttribute == null) {
            throw new ApiException("Missing the required parameter 'shipmentAttribute' when calling setShipmentAttributeUsingPUT(Async)");
        }
        

        com.squareup.okhttp.Call call = setShipmentAttributeUsingPUTCall(key, shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, progressListener, progressRequestListener);
        return call;

    }

    /**
     * setShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attribute (required)
     * @param xVolSite  (optional)
     * @return ShipmentAttribute
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ShipmentAttribute setShipmentAttributeUsingPUT(String key, Integer shipmentNumber, Integer xVolTenant, ShipmentAttribute shipmentAttribute, Integer xVolSite) throws ApiException {
        ApiResponse resp = setShipmentAttributeUsingPUTWithHttpInfo(key, shipmentNumber, xVolTenant, shipmentAttribute, xVolSite);
        return resp.getData();
    }

    /**
     * setShipmentAttribute
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attribute (required)
     * @param xVolSite  (optional)
     * @return ApiResponse<ShipmentAttribute>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse setShipmentAttributeUsingPUTWithHttpInfo(String key, Integer shipmentNumber, Integer xVolTenant, ShipmentAttribute shipmentAttribute, Integer xVolSite) throws ApiException {
        com.squareup.okhttp.Call call = setShipmentAttributeUsingPUTValidateBeforeCall(key, shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * setShipmentAttribute (asynchronously)
     * 
     * @param key key (required)
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attribute (required)
     * @param xVolSite  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call setShipmentAttributeUsingPUTAsync(String key, Integer shipmentNumber, Integer xVolTenant, ShipmentAttribute shipmentAttribute, Integer xVolSite, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = setShipmentAttributeUsingPUTValidateBeforeCall(key, shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for setShipmentAttributesUsingPUT
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attributes (required)
     * @param xVolSite  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call setShipmentAttributesUsingPUTCall(Integer shipmentNumber, Integer xVolTenant, List shipmentAttribute, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = shipmentAttribute;

        // create path and map variables
        String localVarPath = "/commerce/shipments/{shipmentNumber}/attributes"
            .replaceAll("\\{" + "shipmentNumber" + "\\}", apiClient.escapeString(shipmentNumber.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        if (xVolSite != null) {
            localVarHeaderParams.put("x-vol-site", apiClient.parameterToString(xVolSite));
        }

        if (xVolTenant != null) {
            localVarHeaderParams.put("x-vol-tenant", apiClient.parameterToString(xVolTenant));
        }

        Map localVarFormParams = new HashMap();
        final String[] localVarAccepts = {
            "application/xml", "application/json", "application/hal+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] {  };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call setShipmentAttributesUsingPUTValidateBeforeCall(Integer shipmentNumber, Integer xVolTenant, List shipmentAttribute, Integer xVolSite, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'shipmentNumber' is set
        if (shipmentNumber == null) {
            throw new ApiException("Missing the required parameter 'shipmentNumber' when calling setShipmentAttributesUsingPUT(Async)");
        }
        
        // verify the required parameter 'xVolTenant' is set
        if (xVolTenant == null) {
            throw new ApiException("Missing the required parameter 'xVolTenant' when calling setShipmentAttributesUsingPUT(Async)");
        }
        
        // verify the required parameter 'shipmentAttribute' is set
        if (shipmentAttribute == null) {
            throw new ApiException("Missing the required parameter 'shipmentAttribute' when calling setShipmentAttributesUsingPUT(Async)");
        }
        

        com.squareup.okhttp.Call call = setShipmentAttributesUsingPUTCall(shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, progressListener, progressRequestListener);
        return call;

    }

    /**
     * setShipmentAttributes
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attributes (required)
     * @param xVolSite  (optional)
     * @return List<ShipmentAttribute>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List setShipmentAttributesUsingPUT(Integer shipmentNumber, Integer xVolTenant, List shipmentAttribute, Integer xVolSite) throws ApiException {
        ApiResponse> resp = setShipmentAttributesUsingPUTWithHttpInfo(shipmentNumber, xVolTenant, shipmentAttribute, xVolSite);
        return resp.getData();
    }

    /**
     * setShipmentAttributes
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attributes (required)
     * @param xVolSite  (optional)
     * @return ApiResponse<List<ShipmentAttribute>>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse> setShipmentAttributesUsingPUTWithHttpInfo(Integer shipmentNumber, Integer xVolTenant, List shipmentAttribute, Integer xVolSite) throws ApiException {
        com.squareup.okhttp.Call call = setShipmentAttributesUsingPUTValidateBeforeCall(shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, null, null);
        Type localVarReturnType = new TypeToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * setShipmentAttributes (asynchronously)
     * 
     * @param shipmentNumber shipmentNumber (required)
     * @param xVolTenant  (required)
     * @param shipmentAttribute attributes (required)
     * @param xVolSite  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call setShipmentAttributesUsingPUTAsync(Integer shipmentNumber, Integer xVolTenant, List shipmentAttribute, Integer xVolSite, final ApiCallback> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        com.squareup.okhttp.Call call = setShipmentAttributesUsingPUTValidateBeforeCall(shipmentNumber, xVolTenant, shipmentAttribute, xVolSite, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy