/*
* Selling Partner API for Fulfillment Inbound
* The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network.
*
* OpenAPI spec version: v0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.amazon.spapi.api;
import com.amazon.SellingPartnerAPIAA.*;
import com.amazon.spapi.client.*;
import com.amazon.spapi.model.fulfillmentinbound.*;
import com.google.gson.reflect.TypeToken;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FbaInboundApi {
private ApiClient apiClient;
FbaInboundApi() {
this(Configuration.getDefaultApiClient());
}
public FbaInboundApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for confirmPreorder
* @param shipmentId A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param needByDate Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param marketplaceId A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
* @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 confirmPreorderCall(String shipmentId, LocalDate needByDate, String marketplaceId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fba/inbound/v0/shipments/{shipmentId}/preorder/confirm"
.replaceAll("\\{" + "shipmentId" + "\\}", apiClient.escapeString(shipmentId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
if (needByDate != null)
localVarQueryParams.addAll(apiClient.parameterToPair("NeedByDate", needByDate));
if (marketplaceId != null)
localVarQueryParams.addAll(apiClient.parameterToPair("MarketplaceId", marketplaceId));
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/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 confirmPreorderValidateBeforeCall(String shipmentId, LocalDate needByDate, String marketplaceId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException,LWAException {
// verify the required parameter 'shipmentId' is set
if (shipmentId == null) {
throw new ApiException("Missing the required parameter 'shipmentId' when calling confirmPreorder(Async)");
}
// verify the required parameter 'needByDate' is set
if (needByDate == null) {
throw new ApiException("Missing the required parameter 'needByDate' when calling confirmPreorder(Async)");
}
// verify the required parameter 'marketplaceId' is set
if (marketplaceId == null) {
throw new ApiException("Missing the required parameter 'marketplaceId' when calling confirmPreorder(Async)");
}
com.squareup.okhttp.Call call = confirmPreorderCall(shipmentId, needByDate, marketplaceId, progressListener, progressRequestListener);
return call;
}
/**
*
* Returns information needed to confirm a shipment for pre-order. Call this operation after calling the getPreorderInfo operation to get the NeedByDate value and other pre-order information about the shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
* @param shipmentId A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param needByDate Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param marketplaceId A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
* @return ConfirmPreorderResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ConfirmPreorderResponse confirmPreorder(String shipmentId, LocalDate needByDate, String marketplaceId) throws ApiException,LWAException {
ApiResponse<ConfirmPreorderResponse> resp = confirmPreorderWithHttpInfo(shipmentId, needByDate, marketplaceId);
return resp.getData();
}
/**
*
* Returns information needed to confirm a shipment for pre-order. Call this operation after calling the getPreorderInfo operation to get the NeedByDate value and other pre-order information about the shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
* @param shipmentId A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param needByDate Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks