com.squareup.connect.api.V1ItemsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connect Show documentation
Show all versions of connect Show documentation
Java client library for the Square Connect API
package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.V1AdjustInventoryRequest;
import com.squareup.connect.models.V1Category;
import com.squareup.connect.models.V1Discount;
import com.squareup.connect.models.V1Fee;
import com.squareup.connect.models.V1InventoryEntry;
import com.squareup.connect.models.V1Item;
import com.squareup.connect.models.V1ModifierList;
import com.squareup.connect.models.V1ModifierOption;
import com.squareup.connect.models.V1Page;
import com.squareup.connect.models.V1PageCell;
import com.squareup.connect.models.V1UpdateModifierListRequest;
import com.squareup.connect.models.V1Variation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class V1ItemsApi {
private ApiClient apiClient;
public V1ItemsApi() {
this(Configuration.getDefaultApiClient());
}
public V1ItemsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* AdjustInventory
* Adjusts an item variation's current available inventory.
* @param locationId The ID of the item's associated location. (required)
* @param variationId The ID of the variation to adjust inventory information for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1InventoryEntry
* @throws ApiException if fails to make API call
*/
public V1InventoryEntry adjustInventory(String locationId, String variationId, V1AdjustInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling adjustInventory");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling adjustInventory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling adjustInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* AdjustInventory
* Adjusts an item variation's current available inventory.
* @param locationId The ID of the item's associated location. (required)
* @param variationId The ID of the variation to adjust inventory information for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponseadjustInventoryWithHttpInfo(String locationId, String variationId, V1AdjustInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling adjustInventory");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling adjustInventory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling adjustInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ApplyFee
* Associates a fee with an item, meaning the fee is automatically applied to the item in Square Register.
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
public V1Item applyFee(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling applyFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ApplyFee
* Associates a fee with an item, meaning the fee is automatically applied to the item in Square Register.
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponseapplyFeeWithHttpInfo(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling applyFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ApplyModifierList
* Associates a modifier list with an item, meaning modifier options from the list can be applied to the item.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to apply. (required)
* @param itemId The ID of the item to add the modifier list to. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
public V1Item applyModifierList(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling applyModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ApplyModifierList
* Associates a modifier list with an item, meaning modifier options from the list can be applied to the item.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to apply. (required)
* @param itemId The ID of the item to add the modifier list to. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponseapplyModifierListWithHttpInfo(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling applyModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateCategory
* Creates an item category.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Category
* @throws ApiException if fails to make API call
*/
public V1Category createCategory(String locationId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateCategory
* Creates an item category.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateCategoryWithHttpInfo(String locationId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateDiscount
* Creates a discount.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Discount
* @throws ApiException if fails to make API call
*/
public V1Discount createDiscount(String locationId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateDiscount
* Creates a discount.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateDiscountWithHttpInfo(String locationId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateFee
* Creates a fee (tax).
* @param locationId The ID of the location to create a fee for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Fee
* @throws ApiException if fails to make API call
*/
public V1Fee createFee(String locationId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateFee
* Creates a fee (tax).
* @param locationId The ID of the location to create a fee for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateFeeWithHttpInfo(String locationId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateItem
* Creates an item and at least one variation for it. Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify its `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
public V1Item createItem(String locationId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateItem
* Creates an item and at least one variation for it. Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify its `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateItemWithHttpInfo(String locationId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateModifierList
* Creates an item modifier list and at least one modifier option for it.
* @param locationId The ID of the location to create a modifier list for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierList
* @throws ApiException if fails to make API call
*/
public V1ModifierList createModifierList(String locationId, V1ModifierList body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateModifierList
* Creates an item modifier list and at least one modifier option for it.
* @param locationId The ID of the location to create a modifier list for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateModifierListWithHttpInfo(String locationId, V1ModifierList body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierOption
* @throws ApiException if fails to make API call
*/
public V1ModifierOption createModifierOption(String locationId, String modifierListId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling createModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateModifierOptionWithHttpInfo(String locationId, String modifierListId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling createModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreatePage
* Creates a Favorites page in Square Register.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Page
* @throws ApiException if fails to make API call
*/
public V1Page createPage(String locationId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createPage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreatePage
* Creates a Favorites page in Square Register.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreatePageWithHttpInfo(String locationId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createPage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateVariation
* Creates an item variation for an existing item.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Variation
* @throws ApiException if fails to make API call
*/
public V1Variation createVariation(String locationId, String itemId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling createVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateVariation
* Creates an item variation for an existing item.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsecreateVariationWithHttpInfo(String locationId, String itemId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling createVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteCategory
* Deletes an existing item category. *Note**: DeleteCategory returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param categoryId The ID of the category to delete. (required)
* @return V1Category
* @throws ApiException if fails to make API call
*/
public V1Category deleteCategory(String locationId, String categoryId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling deleteCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Square-Version", "2019-03-27");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
CompleteResponse completeResponse = (CompleteResponse)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteCategory
* Deletes an existing item category. *Note**: DeleteCategory returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param categoryId The ID of the category to delete. (required)
* @return CompleteResponse
* @throws ApiException if fails to make API call
*/
public CompleteResponsedeleteCategoryWithHttpInfo(String locationId, String categoryId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling deleteCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType localVarReturnType = new GenericType() {};
return (CompleteResponse