square-connect
Version:
JavaScript client library for the Square Connect v2 API
1,241 lines (1,048 loc) • 104 kB
JavaScript
/**
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
*
*/
var ApiClient = require('../ApiClient');
var V1AdjustInventoryRequest = require('../model/V1AdjustInventoryRequest');
var V1Category = require('../model/V1Category');
var V1Discount = require('../model/V1Discount');
var V1Fee = require('../model/V1Fee');
var V1InventoryEntry = require('../model/V1InventoryEntry');
var V1Item = require('../model/V1Item');
var V1ModifierList = require('../model/V1ModifierList');
var V1ModifierOption = require('../model/V1ModifierOption');
var V1Page = require('../model/V1Page');
var V1PageCell = require('../model/V1PageCell');
var V1UpdateModifierListRequest = require('../model/V1UpdateModifierListRequest');
var V1Variation = require('../model/V1Variation');
/**
* V1Items service.
* @module api/V1ItemsApi
*/
/**
* Constructs a new V1ItemsApi.
* @alias module:api/V1ItemsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* @deprecated
* AdjustInventory
* Adjusts the current available inventory of an item variation.
* @param {String} locationId The ID of the item's associated location.
* @param {String} variationId The ID of the variation to adjust inventory information for.
* @param {module:model/V1AdjustInventoryRequest} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1InventoryEntry} and HTTP response
*/
this.adjustInventoryWithHttpInfo = function(locationId, variationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.adjustInventory");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling adjustInventory");
}
// verify the required parameter 'variationId' is set
if (variationId === undefined || variationId === null) {
throw new Error("Missing the required parameter 'variationId' when calling adjustInventory");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling adjustInventory");
}
var pathParams = {
'location_id': locationId,
'variation_id': variationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1InventoryEntry;
return this.apiClient.callApi(
'/v1/{location_id}/inventory/{variation_id}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* AdjustInventory
* Adjusts the current available inventory of an item variation.
* @param {String} locationId The ID of the item's associated location.
* @param {String} variationId The ID of the variation to adjust inventory information for.
* @param {module:model/V1AdjustInventoryRequest} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1InventoryEntry}
*/
this.adjustInventory = function(locationId, variationId, body) {
return this.adjustInventoryWithHttpInfo(locationId, variationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* ApplyFee
* Associates a fee with an item so the fee is automatically applied to the item in Square Point of Sale.
* @param {String} locationId The ID of the fee's associated location.
* @param {String} itemId The ID of the item to add the fee to.
* @param {String} feeId The ID of the fee to apply.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Item} and HTTP response
*/
this.applyFeeWithHttpInfo = function(locationId, itemId, feeId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.applyFee");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling applyFee");
}
// verify the required parameter 'itemId' is set
if (itemId === undefined || itemId === null) {
throw new Error("Missing the required parameter 'itemId' when calling applyFee");
}
// verify the required parameter 'feeId' is set
if (feeId === undefined || feeId === null) {
throw new Error("Missing the required parameter 'feeId' when calling applyFee");
}
var pathParams = {
'location_id': locationId,
'item_id': itemId,
'fee_id': feeId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Item;
return this.apiClient.callApi(
'/v1/{location_id}/items/{item_id}/fees/{fee_id}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* ApplyFee
* Associates a fee with an item so the fee is automatically applied to the item in Square Point of Sale.
* @param {String} locationId The ID of the fee's associated location.
* @param {String} itemId The ID of the item to add the fee to.
* @param {String} feeId The ID of the fee to apply.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Item}
*/
this.applyFee = function(locationId, itemId, feeId) {
return this.applyFeeWithHttpInfo(locationId, itemId, feeId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* ApplyModifierList
* Associates a modifier list with an item so the associated modifier options can be applied to the item.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to apply.
* @param {String} itemId The ID of the item to add the modifier list to.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Item} and HTTP response
*/
this.applyModifierListWithHttpInfo = function(locationId, modifierListId, itemId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.applyModifierList");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling applyModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId === undefined || modifierListId === null) {
throw new Error("Missing the required parameter 'modifierListId' when calling applyModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId === undefined || itemId === null) {
throw new Error("Missing the required parameter 'itemId' when calling applyModifierList");
}
var pathParams = {
'location_id': locationId,
'modifier_list_id': modifierListId,
'item_id': itemId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Item;
return this.apiClient.callApi(
'/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* ApplyModifierList
* Associates a modifier list with an item so the associated modifier options can be applied to the item.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to apply.
* @param {String} itemId The ID of the item to add the modifier list to.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Item}
*/
this.applyModifierList = function(locationId, modifierListId, itemId) {
return this.applyModifierListWithHttpInfo(locationId, modifierListId, itemId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateCategory
* Creates an item category.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Category} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Category} and HTTP response
*/
this.createCategoryWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createCategory");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createCategory");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createCategory");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Category;
return this.apiClient.callApi(
'/v1/{location_id}/categories', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateCategory
* Creates an item category.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Category} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Category}
*/
this.createCategory = function(locationId, body) {
return this.createCategoryWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateDiscount
* Creates a discount.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Discount} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Discount} and HTTP response
*/
this.createDiscountWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createDiscount");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createDiscount");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createDiscount");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Discount;
return this.apiClient.callApi(
'/v1/{location_id}/discounts', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateDiscount
* Creates a discount.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Discount} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Discount}
*/
this.createDiscount = function(locationId, body) {
return this.createDiscountWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateFee
* Creates a fee (tax).
* @param {String} locationId The ID of the location to create a fee for.
* @param {module:model/V1Fee} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Fee} and HTTP response
*/
this.createFeeWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createFee");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createFee");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createFee");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Fee;
return this.apiClient.callApi(
'/v1/{location_id}/fees', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateFee
* Creates a fee (tax).
* @param {String} locationId The ID of the location to create a fee for.
* @param {module:model/V1Fee} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Fee}
*/
this.createFee = function(locationId, body) {
return this.createFeeWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* 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 `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 {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Item} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Item} and HTTP response
*/
this.createItemWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createItem");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createItem");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createItem");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Item;
return this.apiClient.callApi(
'/v1/{location_id}/items', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* 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 `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 {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Item} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Item}
*/
this.createItem = function(locationId, body) {
return this.createItemWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateModifierList
* Creates an item modifier list and at least 1 modifier option for it.
* @param {String} locationId The ID of the location to create a modifier list for.
* @param {module:model/V1ModifierList} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1ModifierList} and HTTP response
*/
this.createModifierListWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createModifierList");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createModifierList");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createModifierList");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1ModifierList;
return this.apiClient.callApi(
'/v1/{location_id}/modifier-lists', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateModifierList
* Creates an item modifier list and at least 1 modifier option for it.
* @param {String} locationId The ID of the location to create a modifier list for.
* @param {module:model/V1ModifierList} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1ModifierList}
*/
this.createModifierList = function(locationId, body) {
return this.createModifierListWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to edit.
* @param {module:model/V1ModifierOption} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1ModifierOption} and HTTP response
*/
this.createModifierOptionWithHttpInfo = function(locationId, modifierListId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createModifierOption");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId === undefined || modifierListId === null) {
throw new Error("Missing the required parameter 'modifierListId' when calling createModifierOption");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createModifierOption");
}
var pathParams = {
'location_id': locationId,
'modifier_list_id': modifierListId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1ModifierOption;
return this.apiClient.callApi(
'/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to edit.
* @param {module:model/V1ModifierOption} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1ModifierOption}
*/
this.createModifierOption = function(locationId, modifierListId, body) {
return this.createModifierOptionWithHttpInfo(locationId, modifierListId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreatePage
* Creates a Favorites page in Square Point of Sale.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Page} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Page} and HTTP response
*/
this.createPageWithHttpInfo = function(locationId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createPage");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createPage");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createPage");
}
var pathParams = {
'location_id': locationId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Page;
return this.apiClient.callApi(
'/v1/{location_id}/pages', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreatePage
* Creates a Favorites page in Square Point of Sale.
* @param {String} locationId The ID of the location to create an item for.
* @param {module:model/V1Page} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Page}
*/
this.createPage = function(locationId, body) {
return this.createPageWithHttpInfo(locationId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* CreateVariation
* Creates an item variation for an existing item.
* @param {String} locationId The ID of the item's associated location.
* @param {String} itemId The item's ID.
* @param {module:model/V1Variation} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Variation} and HTTP response
*/
this.createVariationWithHttpInfo = function(locationId, itemId, body) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.createVariation");
var postBody = body;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling createVariation");
}
// verify the required parameter 'itemId' is set
if (itemId === undefined || itemId === null) {
throw new Error("Missing the required parameter 'itemId' when calling createVariation");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createVariation");
}
var pathParams = {
'location_id': locationId,
'item_id': itemId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Variation;
return this.apiClient.callApi(
'/v1/{location_id}/items/{item_id}/variations', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* CreateVariation
* Creates an item variation for an existing item.
* @param {String} locationId The ID of the item's associated location.
* @param {String} itemId The item's ID.
* @param {module:model/V1Variation} body An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Variation}
*/
this.createVariation = function(locationId, itemId, body) {
return this.createVariationWithHttpInfo(locationId, itemId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteCategory
* Deletes an existing item category. __DeleteCategory__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} categoryId The ID of the category to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Category} and HTTP response
*/
this.deleteCategoryWithHttpInfo = function(locationId, categoryId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteCategory");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId === undefined || categoryId === null) {
throw new Error("Missing the required parameter 'categoryId' when calling deleteCategory");
}
var pathParams = {
'location_id': locationId,
'category_id': categoryId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Category;
return this.apiClient.callApi(
'/v1/{location_id}/categories/{category_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteCategory
* Deletes an existing item category. __DeleteCategory__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} categoryId The ID of the category to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Category}
*/
this.deleteCategory = function(locationId, categoryId) {
return this.deleteCategoryWithHttpInfo(locationId, categoryId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteDiscount
* Deletes an existing discount. __DeleteDiscount__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteDiscountRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} discountId The ID of the discount to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Discount} and HTTP response
*/
this.deleteDiscountWithHttpInfo = function(locationId, discountId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteDiscount");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteDiscount");
}
// verify the required parameter 'discountId' is set
if (discountId === undefined || discountId === null) {
throw new Error("Missing the required parameter 'discountId' when calling deleteDiscount");
}
var pathParams = {
'location_id': locationId,
'discount_id': discountId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Discount;
return this.apiClient.callApi(
'/v1/{location_id}/discounts/{discount_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteDiscount
* Deletes an existing discount. __DeleteDiscount__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteDiscountRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} discountId The ID of the discount to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Discount}
*/
this.deleteDiscount = function(locationId, discountId) {
return this.deleteDiscountWithHttpInfo(locationId, discountId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteFee
* Deletes an existing fee (tax). __DeleteFee__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteFeeRequest` object as documented below.
* @param {String} locationId The ID of the fee's associated location.
* @param {String} feeId The ID of the fee to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Fee} and HTTP response
*/
this.deleteFeeWithHttpInfo = function(locationId, feeId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteFee");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteFee");
}
// verify the required parameter 'feeId' is set
if (feeId === undefined || feeId === null) {
throw new Error("Missing the required parameter 'feeId' when calling deleteFee");
}
var pathParams = {
'location_id': locationId,
'fee_id': feeId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Fee;
return this.apiClient.callApi(
'/v1/{location_id}/fees/{fee_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteFee
* Deletes an existing fee (tax). __DeleteFee__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteFeeRequest` object as documented below.
* @param {String} locationId The ID of the fee's associated location.
* @param {String} feeId The ID of the fee to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Fee}
*/
this.deleteFee = function(locationId, feeId) {
return this.deleteFeeWithHttpInfo(locationId, feeId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteItem
* Deletes an existing item and all item variations associated with it. __DeleteItem__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteItemRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} itemId The ID of the item to modify.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Item} and HTTP response
*/
this.deleteItemWithHttpInfo = function(locationId, itemId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteItem");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteItem");
}
// verify the required parameter 'itemId' is set
if (itemId === undefined || itemId === null) {
throw new Error("Missing the required parameter 'itemId' when calling deleteItem");
}
var pathParams = {
'location_id': locationId,
'item_id': itemId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Item;
return this.apiClient.callApi(
'/v1/{location_id}/items/{item_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteItem
* Deletes an existing item and all item variations associated with it. __DeleteItem__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteItemRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} itemId The ID of the item to modify.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Item}
*/
this.deleteItem = function(locationId, itemId) {
return this.deleteItemWithHttpInfo(locationId, itemId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteModifierList
* Deletes an existing item modifier list and all modifier options associated with it. __DeleteModifierList__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierListRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1ModifierList} and HTTP response
*/
this.deleteModifierListWithHttpInfo = function(locationId, modifierListId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteModifierList");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId === undefined || modifierListId === null) {
throw new Error("Missing the required parameter 'modifierListId' when calling deleteModifierList");
}
var pathParams = {
'location_id': locationId,
'modifier_list_id': modifierListId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1ModifierList;
return this.apiClient.callApi(
'/v1/{location_id}/modifier-lists/{modifier_list_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteModifierList
* Deletes an existing item modifier list and all modifier options associated with it. __DeleteModifierList__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierListRequest` object as documented below.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1ModifierList}
*/
this.deleteModifierList = function(locationId, modifierListId) {
return this.deleteModifierListWithHttpInfo(locationId, modifierListId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeleteModifierOption
* Deletes an existing item modifier option from a modifier list. __DeleteModifierOption__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierOptionRequest` object.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to delete.
* @param {String} modifierOptionId The ID of the modifier list to edit.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1ModifierOption} and HTTP response
*/
this.deleteModifierOptionWithHttpInfo = function(locationId, modifierListId, modifierOptionId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deleteModifierOption");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId === undefined || modifierListId === null) {
throw new Error("Missing the required parameter 'modifierListId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierOptionId' is set
if (modifierOptionId === undefined || modifierOptionId === null) {
throw new Error("Missing the required parameter 'modifierOptionId' when calling deleteModifierOption");
}
var pathParams = {
'location_id': locationId,
'modifier_list_id': modifierListId,
'modifier_option_id': modifierOptionId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1ModifierOption;
return this.apiClient.callApi(
'/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeleteModifierOption
* Deletes an existing item modifier option from a modifier list. __DeleteModifierOption__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierOptionRequest` object.
* @param {String} locationId The ID of the item's associated location.
* @param {String} modifierListId The ID of the modifier list to delete.
* @param {String} modifierOptionId The ID of the modifier list to edit.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1ModifierOption}
*/
this.deleteModifierOption = function(locationId, modifierListId, modifierOptionId) {
return this.deleteModifierOptionWithHttpInfo(locationId, modifierListId, modifierOptionId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeletePage
* Deletes an existing Favorites page and all of its cells. __DeletePage__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageRequest` object.
* @param {String} locationId The ID of the Favorites page's associated location.
* @param {String} pageId The ID of the page to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Page} and HTTP response
*/
this.deletePageWithHttpInfo = function(locationId, pageId) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deletePage");
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deletePage");
}
// verify the required parameter 'pageId' is set
if (pageId === undefined || pageId === null) {
throw new Error("Missing the required parameter 'pageId' when calling deletePage");
}
var pathParams = {
'location_id': locationId,
'page_id': pageId
};
var queryParams = {
};
var headerParams = {
};
headerParams['Square-Version'] = '2020-12-16';
var formParams = {
};
var authNames = ['oauth2'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = V1Page;
return this.apiClient.callApi(
'/v1/{location_id}/pages/{page_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* DeletePage
* Deletes an existing Favorites page and all of its cells. __DeletePage__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageRequest` object.
* @param {String} locationId The ID of the Favorites page's associated location.
* @param {String} pageId The ID of the page to delete.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/V1Page}
*/
this.deletePage = function(locationId, pageId) {
return this.deletePageWithHttpInfo(locationId, pageId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @deprecated
* DeletePageCell
* Deletes a cell from a Favorites page in Square Point of Sale. __DeletePageCell__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageCellRequest` object as documented below.
* @param {String} locationId The ID of the Favorites page's associated location.
* @param {String} pageId The ID of the page to delete.
* @param {Object} opts Optional parameters
* @param {String} opts.row The row of the cell to clear. Always an integer between 0 and 4, inclusive. Row 0 is the top row.
* @param {String} opts.column The column of the cell to clear. Always an integer between 0 and 4, inclusive. Column 0 is the leftmost column.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/V1Page} and HTTP response
*/
this.deletePageCellWithHttpInfo = function(locationId, pageId, opts) {
console.warn("\x1b[33m%s\x1b[0m","Calling deprecated API: V1ItemsApi.deletePageCell");
opts = opts || {};
var postBody = null;
// verify the required parameter 'locationId' is set
if (locationId === undefined || locationId === null) {
throw new Error("Missing the required parameter 'locationId' when calling deletePageCell");
}
// verify the required parameter 'pageId' is set
if (pageId === undefined || pageId === null) {
throw new Error(