@51eat/sdk 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/business/client/Client.d.ts +0 -3
- package/dist/cjs/api/resources/business/client/Client.js +14 -19
- package/dist/cjs/api/resources/business/resources/commerce/client/Client.d.ts +9 -0
- package/dist/cjs/api/resources/business/resources/commerce/client/Client.js +27 -12
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/client/Client.js +116 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/catalog}/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/catalog}/index.js +1 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/types/GetOptionsCatalogResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/catalog/types/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/index.d.ts +8 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/index.js +12 -4
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/Client.d.ts +46 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/Client.js +137 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/requests/GetProductsLocationsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/requests/SetLocationProductsRequest.d.ts +15 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/requests/SetLocationProductsRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/GetProductsLocationsResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/GetProductsLocationsResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/SetProductsLocationsResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/SetProductsLocationsResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/Client.d.ts +80 -0
- package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/Client.js +142 -49
- package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/requests/DeleteProductCategoriesRequest.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/DeleteProductCategoriesRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/StoreProductCategoryRequest.d.ts +14 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/StoreProductCategoryRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/UpdateProductCategoryRequest.d.ts +14 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/UpdateProductCategoryRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/index.js +18 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/CreateProductCategoriesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/CreateProductCategoriesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/ListProductCategoriesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/ListProductCategoriesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/UpdateProductCategoriesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/UpdateProductCategoriesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productCategories/types/index.js +19 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/Client.d.ts +92 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/Client.js +338 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/DeleteProductImagesRequest.d.ts +13 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/DeleteProductImagesRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/ReorderProductImagesRequest.d.ts +24 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/ReorderProductImagesRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/StoreProductImageRequest.d.ts +18 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/StoreProductImageRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/UpdateProductImageRequest.d.ts +14 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/UpdateProductImageRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/index.js +18 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/ReorderProductImagesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/ReorderProductImagesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/UpdateProductImagesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/UpdateProductImagesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/UploadProductImagesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/UploadProductImagesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/business/resources/commerce/resources/productImages/types/index.js +19 -0
- package/dist/cjs/api/resources/business/resources/index.d.ts +0 -2
- package/dist/cjs/api/resources/business/resources/index.js +1 -3
- package/dist/cjs/api/types/CatalogFormOptionsResource.d.ts +87 -0
- package/dist/cjs/api/types/CatalogFormOptionsResource.js +17 -0
- package/dist/cjs/api/types/LocationProductsResource.d.ts +42 -0
- package/dist/cjs/api/types/LocationProductsResource.js +19 -0
- package/dist/cjs/api/types/ProductCategoryResource.d.ts +4 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/business/client/Client.d.mts +0 -3
- package/dist/esm/api/resources/business/client/Client.mjs +0 -5
- package/dist/esm/api/resources/business/resources/commerce/client/Client.d.mts +9 -0
- package/dist/esm/api/resources/business/resources/commerce/client/Client.mjs +15 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/client/Client.mjs +79 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/catalog}/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/catalog}/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/types/GetOptionsCatalogResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/catalog/types/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/index.d.mts +8 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/index.mjs +8 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/Client.d.mts +46 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/Client.mjs +137 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/requests/GetProductsLocationsRequest.d.mts +10 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/requests/SetLocationProductsRequest.d.mts +15 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/requests/SetLocationProductsRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/GetProductsLocationsResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/GetProductsLocationsResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/SetProductsLocationsResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/SetProductsLocationsResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/locations/types/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/Client.d.mts +80 -0
- package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/Client.mjs +142 -49
- package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/requests/DeleteProductCategoriesRequest.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/DeleteProductCategoriesRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/StoreProductCategoryRequest.d.mts +14 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/StoreProductCategoryRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/UpdateProductCategoryRequest.d.mts +14 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/UpdateProductCategoryRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/CreateProductCategoriesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/CreateProductCategoriesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/ListProductCategoriesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/ListProductCategoriesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/UpdateProductCategoriesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/UpdateProductCategoriesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/index.d.mts +3 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productCategories/types/index.mjs +3 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/Client.d.mts +92 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/Client.mjs +301 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/DeleteProductImagesRequest.d.mts +13 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/DeleteProductImagesRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/ReorderProductImagesRequest.d.mts +24 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/ReorderProductImagesRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/StoreProductImageRequest.d.mts +18 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/StoreProductImageRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/UpdateProductImageRequest.d.mts +14 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/UpdateProductImageRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/ReorderProductImagesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/ReorderProductImagesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/UpdateProductImagesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/UpdateProductImagesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/UploadProductImagesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/UploadProductImagesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/index.d.mts +3 -0
- package/dist/esm/api/resources/business/resources/commerce/resources/productImages/types/index.mjs +3 -0
- package/dist/esm/api/resources/business/resources/index.d.mts +0 -2
- package/dist/esm/api/resources/business/resources/index.mjs +0 -2
- package/dist/esm/api/types/CatalogFormOptionsResource.d.mts +87 -0
- package/dist/esm/api/types/CatalogFormOptionsResource.mjs +14 -0
- package/dist/esm/api/types/LocationProductsResource.d.mts +42 -0
- package/dist/esm/api/types/LocationProductsResource.mjs +16 -0
- package/dist/esm/api/types/ProductCategoryResource.d.mts +4 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +34 -12
- package/reference.md +543 -42
- package/dist/cjs/api/resources/business/resources/productCategories/client/Client.d.ts +0 -51
- package/dist/cjs/api/resources/business/resources/productCategories/client/requests/UpdateProductCategoriesRequest.d.ts +0 -9
- package/dist/cjs/api/resources/business/resources/productCategories/client/requests/index.d.ts +0 -2
- package/dist/esm/api/resources/business/resources/productCategories/client/Client.d.mts +0 -51
- package/dist/esm/api/resources/business/resources/productCategories/client/requests/UpdateProductCategoriesRequest.d.mts +0 -9
- package/dist/esm/api/resources/business/resources/productCategories/client/requests/index.d.mts +0 -2
- /package/dist/{esm/api/resources/business/resources/productCategories/client/requests/index.mjs → cjs/api/resources/business/resources/commerce/resources/catalog/client/index.d.ts} +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories/client/requests → commerce/resources/catalog/client}/index.js +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories/client/requests/DeleteProductCategoriesRequest.js → commerce/resources/catalog/types/GetOptionsCatalogResponse.js} +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories/client/requests/UpdateProductCategoriesRequest.js → commerce/resources/locations/client/requests/GetProductsLocationsRequest.js} +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/index.js +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/exports.d.ts +0 -0
- /package/dist/cjs/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/exports.js +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories/client/requests/DeleteProductCategoriesRequest.mjs → commerce/resources/catalog/types/GetOptionsCatalogResponse.mjs} +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories/client/requests/UpdateProductCategoriesRequest.mjs → commerce/resources/locations/client/requests/GetProductsLocationsRequest.mjs} +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/exports.d.mts +0 -0
- /package/dist/esm/api/resources/business/resources/{productCategories → commerce/resources/productCategories}/exports.mjs +0 -0
package/dist/cjs/api/resources/business/resources/commerce/resources/locations/client/Client.js
CHANGED
|
@@ -195,6 +195,143 @@ class LocationsClient {
|
|
|
195
195
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/commerce/locations");
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Every product of the business, by name, and the IDs of those sold here
|
|
200
|
+
* (`selected`): online, for pickup, at a store; in person at a stand
|
|
201
|
+
* (`channel`). `location.sells_this_way` is false while the location
|
|
202
|
+
* doesn't sell that way at all, and nothing can be added there.
|
|
203
|
+
*
|
|
204
|
+
* @param {FiveOneEat.business.commerce.GetProductsLocationsRequest} request
|
|
205
|
+
* @param {LocationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
206
|
+
*
|
|
207
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
208
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
209
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* await client.business.commerce.locations.getProducts({
|
|
213
|
+
* location: "location"
|
|
214
|
+
* })
|
|
215
|
+
*/
|
|
216
|
+
getProducts(request, requestOptions) {
|
|
217
|
+
return core.HttpResponsePromise.fromPromise(this.__getProducts(request, requestOptions));
|
|
218
|
+
}
|
|
219
|
+
__getProducts(request, requestOptions) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
222
|
+
const { location } = request;
|
|
223
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
224
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
225
|
+
const _response = yield core.fetcher({
|
|
226
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/commerce/locations/${core.url.encodePathParam(location)}/products`),
|
|
227
|
+
method: "GET",
|
|
228
|
+
headers: _headers,
|
|
229
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
230
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
231
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
232
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
233
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
234
|
+
logging: this._options.logging,
|
|
235
|
+
});
|
|
236
|
+
if (_response.ok) {
|
|
237
|
+
return {
|
|
238
|
+
data: _response.body,
|
|
239
|
+
rawResponse: _response.rawResponse,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
if (_response.error.reason === "status-code") {
|
|
243
|
+
switch (_response.error.statusCode) {
|
|
244
|
+
case 401:
|
|
245
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
246
|
+
case 403:
|
|
247
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
248
|
+
case 404:
|
|
249
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
250
|
+
default:
|
|
251
|
+
throw new errors.FiveOneEatError({
|
|
252
|
+
statusCode: _response.error.statusCode,
|
|
253
|
+
body: _response.error.body,
|
|
254
|
+
rawResponse: _response.rawResponse,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/commerce/locations/{location}/products");
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Sells exactly `product_ids` here, the way the location sells; an empty
|
|
263
|
+
* list takes them all off. Each product's other stores and stands stay
|
|
264
|
+
* as they are. Saving replaces what is there, so a retry is safe.
|
|
265
|
+
* `active: true` switches the location on before adding, `active: false`
|
|
266
|
+
* off after taking off. A product added where the location can't sell it
|
|
267
|
+
* (switched off, archived, or not taking pickup orders or selling in
|
|
268
|
+
* person) is refused with a form error on `availability`, and one that
|
|
269
|
+
* isn't the business's on `product_ids.*`.
|
|
270
|
+
*
|
|
271
|
+
* @param {FiveOneEat.business.commerce.SetLocationProductsRequest} request
|
|
272
|
+
* @param {LocationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
273
|
+
*
|
|
274
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
275
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
276
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
277
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* await client.business.commerce.locations.setProducts({
|
|
281
|
+
* location: "location",
|
|
282
|
+
* product_ids: ["product_ids"]
|
|
283
|
+
* })
|
|
284
|
+
*/
|
|
285
|
+
setProducts(request, requestOptions) {
|
|
286
|
+
return core.HttpResponsePromise.fromPromise(this.__setProducts(request, requestOptions));
|
|
287
|
+
}
|
|
288
|
+
__setProducts(request, requestOptions) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
291
|
+
const { location } = request, _body = __rest(request, ["location"]);
|
|
292
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
293
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
294
|
+
const _response = yield core.fetcher({
|
|
295
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/commerce/locations/${core.url.encodePathParam(location)}/products`),
|
|
296
|
+
method: "PUT",
|
|
297
|
+
headers: _headers,
|
|
298
|
+
contentType: "application/json",
|
|
299
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
300
|
+
requestType: "json",
|
|
301
|
+
body: _body,
|
|
302
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
303
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
304
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
305
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
306
|
+
logging: this._options.logging,
|
|
307
|
+
});
|
|
308
|
+
if (_response.ok) {
|
|
309
|
+
return {
|
|
310
|
+
data: _response.body,
|
|
311
|
+
rawResponse: _response.rawResponse,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (_response.error.reason === "status-code") {
|
|
315
|
+
switch (_response.error.statusCode) {
|
|
316
|
+
case 401:
|
|
317
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
318
|
+
case 403:
|
|
319
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
320
|
+
case 404:
|
|
321
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
322
|
+
case 422:
|
|
323
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
324
|
+
default:
|
|
325
|
+
throw new errors.FiveOneEatError({
|
|
326
|
+
statusCode: _response.error.statusCode,
|
|
327
|
+
body: _response.error.body,
|
|
328
|
+
rawResponse: _response.rawResponse,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/commerce/locations/{location}/products");
|
|
333
|
+
});
|
|
334
|
+
}
|
|
198
335
|
/**
|
|
199
336
|
* @param {FiveOneEat.business.commerce.GetLocationsRequest} request
|
|
200
337
|
* @param {LocationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* location: "location",
|
|
5
|
+
* product_ids: ["product_ids"]
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface SetLocationProductsRequest {
|
|
9
|
+
/** The location ID */
|
|
10
|
+
location: string;
|
|
11
|
+
/** Every product sold here; an empty list takes them all off. */
|
|
12
|
+
product_ids: string[];
|
|
13
|
+
/** Switch the location on before adding, or off after taking off. Left out, it stays as it is. */
|
|
14
|
+
active?: boolean;
|
|
15
|
+
}
|
|
@@ -4,9 +4,11 @@ export type { FlyerLocationsRequest } from "./FlyerLocationsRequest.js";
|
|
|
4
4
|
export type { GetHoursLocationsRequest } from "./GetHoursLocationsRequest.js";
|
|
5
5
|
export type { GetLocationsRequest } from "./GetLocationsRequest.js";
|
|
6
6
|
export type { GetPickupLocationsRequest } from "./GetPickupLocationsRequest.js";
|
|
7
|
+
export type { GetProductsLocationsRequest } from "./GetProductsLocationsRequest.js";
|
|
7
8
|
export type { OfferMainStoreProductsLocationsRequest } from "./OfferMainStoreProductsLocationsRequest.js";
|
|
8
9
|
export type { PreviewPickupScheduleRequest } from "./PreviewPickupScheduleRequest.js";
|
|
9
10
|
export type { SetLocationActiveRequest } from "./SetLocationActiveRequest.js";
|
|
11
|
+
export type { SetLocationProductsRequest } from "./SetLocationProductsRequest.js";
|
|
10
12
|
export { StoreLocationRequest } from "./StoreLocationRequest.js";
|
|
11
13
|
export type { UpdateLocationsRequest } from "./UpdateLocationsRequest.js";
|
|
12
14
|
export type { UpdateOpeningHoursRequest } from "./UpdateOpeningHoursRequest.js";
|
package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/index.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ export * from "./FlyerLocationsResponse.js";
|
|
|
4
4
|
export * from "./GetHoursLocationsResponse.js";
|
|
5
5
|
export * from "./GetLocationsResponse.js";
|
|
6
6
|
export * from "./GetPickupLocationsResponse.js";
|
|
7
|
+
export * from "./GetProductsLocationsResponse.js";
|
|
7
8
|
export * from "./ListLocationsResponse.js";
|
|
8
9
|
export * from "./OfferMainStoreProductsLocationsResponse.js";
|
|
9
10
|
export * from "./PreviewPickupAffectedOrdersLocationsResponse.js";
|
|
10
11
|
export * from "./SetActiveLocationsResponse.js";
|
|
12
|
+
export * from "./SetProductsLocationsResponse.js";
|
|
11
13
|
export * from "./UpdateHoursLocationsResponse.js";
|
|
12
14
|
export * from "./UpdateLocationsResponse.js";
|
|
13
15
|
export * from "./UpdatePickupLocationsResponse.js";
|
package/dist/cjs/api/resources/business/resources/commerce/resources/locations/types/index.js
CHANGED
|
@@ -20,10 +20,12 @@ __exportStar(require("./FlyerLocationsResponse.js"), exports);
|
|
|
20
20
|
__exportStar(require("./GetHoursLocationsResponse.js"), exports);
|
|
21
21
|
__exportStar(require("./GetLocationsResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./GetPickupLocationsResponse.js"), exports);
|
|
23
|
+
__exportStar(require("./GetProductsLocationsResponse.js"), exports);
|
|
23
24
|
__exportStar(require("./ListLocationsResponse.js"), exports);
|
|
24
25
|
__exportStar(require("./OfferMainStoreProductsLocationsResponse.js"), exports);
|
|
25
26
|
__exportStar(require("./PreviewPickupAffectedOrdersLocationsResponse.js"), exports);
|
|
26
27
|
__exportStar(require("./SetActiveLocationsResponse.js"), exports);
|
|
28
|
+
__exportStar(require("./SetProductsLocationsResponse.js"), exports);
|
|
27
29
|
__exportStar(require("./UpdateHoursLocationsResponse.js"), exports);
|
|
28
30
|
__exportStar(require("./UpdateLocationsResponse.js"), exports);
|
|
29
31
|
__exportStar(require("./UpdatePickupLocationsResponse.js"), exports);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../../../../../core/index.js";
|
|
4
|
+
import * as FiveOneEat from "../../../../../../../index.js";
|
|
5
|
+
export declare namespace ProductCategoriesClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ProductCategoriesClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ProductCategoriesClient.Options>;
|
|
12
|
+
constructor(options?: ProductCategoriesClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* In their order, flat (a child names its parent in `parent_id`), each
|
|
15
|
+
* with `products_count`, the products filed directly under it.
|
|
16
|
+
*
|
|
17
|
+
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
20
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* await client.business.commerce.productCategories.list()
|
|
24
|
+
*/
|
|
25
|
+
list(requestOptions?: ProductCategoriesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.commerce.ListProductCategoriesResponse>;
|
|
26
|
+
private __list;
|
|
27
|
+
/**
|
|
28
|
+
* Answers 201.
|
|
29
|
+
*
|
|
30
|
+
* @param {FiveOneEat.business.commerce.StoreProductCategoryRequest} request
|
|
31
|
+
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
|
+
*
|
|
33
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
34
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
35
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* await client.business.commerce.productCategories.create({
|
|
39
|
+
* "Idempotency-Key": "Idempotency-Key",
|
|
40
|
+
* name: "name"
|
|
41
|
+
* })
|
|
42
|
+
*/
|
|
43
|
+
create(request: FiveOneEat.business.commerce.StoreProductCategoryRequest, requestOptions?: ProductCategoriesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.commerce.CreateProductCategoriesResponse>;
|
|
44
|
+
private __create;
|
|
45
|
+
/**
|
|
46
|
+
* @param {FiveOneEat.business.commerce.UpdateProductCategoryRequest} request
|
|
47
|
+
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
+
*
|
|
49
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
50
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
51
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
52
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.business.commerce.productCategories.update({
|
|
56
|
+
* productCategory: "productCategory",
|
|
57
|
+
* name: "name"
|
|
58
|
+
* })
|
|
59
|
+
*/
|
|
60
|
+
update(request: FiveOneEat.business.commerce.UpdateProductCategoryRequest, requestOptions?: ProductCategoriesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.commerce.UpdateProductCategoriesResponse>;
|
|
61
|
+
private __update;
|
|
62
|
+
/**
|
|
63
|
+
* Its children become top-level categories and its products, and theirs,
|
|
64
|
+
* are left uncategorised.
|
|
65
|
+
*
|
|
66
|
+
* @param {FiveOneEat.business.commerce.DeleteProductCategoriesRequest} request
|
|
67
|
+
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
68
|
+
*
|
|
69
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
70
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
71
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* await client.business.commerce.productCategories.delete({
|
|
75
|
+
* productCategory: "productCategory"
|
|
76
|
+
* })
|
|
77
|
+
*/
|
|
78
|
+
delete(request: FiveOneEat.business.commerce.DeleteProductCategoriesRequest, requestOptions?: ProductCategoriesClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
79
|
+
private __delete;
|
|
80
|
+
}
|
|
@@ -42,23 +42,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
45
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
57
|
exports.ProductCategoriesClient = void 0;
|
|
47
|
-
const BaseClient_js_1 = require("
|
|
48
|
-
const headers_js_1 = require("
|
|
49
|
-
const core = __importStar(require("
|
|
50
|
-
const environments = __importStar(require("
|
|
51
|
-
const handleNonStatusCodeError_js_1 = require("
|
|
52
|
-
const errors = __importStar(require("
|
|
58
|
+
const BaseClient_js_1 = require("../../../../../../../../BaseClient.js");
|
|
59
|
+
const headers_js_1 = require("../../../../../../../../core/headers.js");
|
|
60
|
+
const core = __importStar(require("../../../../../../../../core/index.js"));
|
|
61
|
+
const environments = __importStar(require("../../../../../../../../environments.js"));
|
|
62
|
+
const handleNonStatusCodeError_js_1 = require("../../../../../../../../errors/handleNonStatusCodeError.js");
|
|
63
|
+
const errors = __importStar(require("../../../../../../../../errors/index.js"));
|
|
64
|
+
const FiveOneEat = __importStar(require("../../../../../../../index.js"));
|
|
53
65
|
class ProductCategoriesClient {
|
|
54
66
|
constructor(options = {}) {
|
|
55
67
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
68
|
}
|
|
57
69
|
/**
|
|
70
|
+
* In their order, flat (a child names its parent in `parent_id`), each
|
|
71
|
+
* with `products_count`, the products filed directly under it.
|
|
72
|
+
*
|
|
58
73
|
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
74
|
*
|
|
75
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
76
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
77
|
+
*
|
|
60
78
|
* @example
|
|
61
|
-
* await client.business.productCategories.list()
|
|
79
|
+
* await client.business.commerce.productCategories.list()
|
|
62
80
|
*/
|
|
63
81
|
list(requestOptions) {
|
|
64
82
|
return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
|
|
@@ -69,7 +87,7 @@ class ProductCategoriesClient {
|
|
|
69
87
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
70
88
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
71
89
|
const _response = yield core.fetcher({
|
|
72
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/product-categories"),
|
|
90
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/commerce/product-categories"),
|
|
73
91
|
method: "GET",
|
|
74
92
|
headers: _headers,
|
|
75
93
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -80,37 +98,61 @@ class ProductCategoriesClient {
|
|
|
80
98
|
logging: this._options.logging,
|
|
81
99
|
});
|
|
82
100
|
if (_response.ok) {
|
|
83
|
-
return {
|
|
101
|
+
return {
|
|
102
|
+
data: _response.body,
|
|
103
|
+
rawResponse: _response.rawResponse,
|
|
104
|
+
};
|
|
84
105
|
}
|
|
85
106
|
if (_response.error.reason === "status-code") {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
switch (_response.error.statusCode) {
|
|
108
|
+
case 401:
|
|
109
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
110
|
+
case 403:
|
|
111
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
112
|
+
default:
|
|
113
|
+
throw new errors.FiveOneEatError({
|
|
114
|
+
statusCode: _response.error.statusCode,
|
|
115
|
+
body: _response.error.body,
|
|
116
|
+
rawResponse: _response.rawResponse,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
91
119
|
}
|
|
92
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/product-categories");
|
|
120
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/commerce/product-categories");
|
|
93
121
|
});
|
|
94
122
|
}
|
|
95
123
|
/**
|
|
124
|
+
* Answers 201.
|
|
125
|
+
*
|
|
126
|
+
* @param {FiveOneEat.business.commerce.StoreProductCategoryRequest} request
|
|
96
127
|
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
97
128
|
*
|
|
129
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
130
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
131
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
132
|
+
*
|
|
98
133
|
* @example
|
|
99
|
-
* await client.business.productCategories.create(
|
|
134
|
+
* await client.business.commerce.productCategories.create({
|
|
135
|
+
* "Idempotency-Key": "Idempotency-Key",
|
|
136
|
+
* name: "name"
|
|
137
|
+
* })
|
|
100
138
|
*/
|
|
101
|
-
create(requestOptions) {
|
|
102
|
-
return core.HttpResponsePromise.fromPromise(this.__create(requestOptions));
|
|
139
|
+
create(request, requestOptions) {
|
|
140
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
103
141
|
}
|
|
104
|
-
__create(requestOptions) {
|
|
142
|
+
__create(request, requestOptions) {
|
|
105
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
145
|
+
const { "Idempotency-Key": idempotencyKey } = request, _body = __rest(request, ["Idempotency-Key"]);
|
|
107
146
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
108
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
147
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
109
148
|
const _response = yield core.fetcher({
|
|
110
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/product-categories"),
|
|
149
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/commerce/product-categories"),
|
|
111
150
|
method: "POST",
|
|
112
151
|
headers: _headers,
|
|
152
|
+
contentType: "application/json",
|
|
113
153
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
154
|
+
requestType: "json",
|
|
155
|
+
body: _body,
|
|
114
156
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
115
157
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
116
158
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -118,25 +160,43 @@ class ProductCategoriesClient {
|
|
|
118
160
|
logging: this._options.logging,
|
|
119
161
|
});
|
|
120
162
|
if (_response.ok) {
|
|
121
|
-
return {
|
|
163
|
+
return {
|
|
164
|
+
data: _response.body,
|
|
165
|
+
rawResponse: _response.rawResponse,
|
|
166
|
+
};
|
|
122
167
|
}
|
|
123
168
|
if (_response.error.reason === "status-code") {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
169
|
+
switch (_response.error.statusCode) {
|
|
170
|
+
case 401:
|
|
171
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
172
|
+
case 403:
|
|
173
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
174
|
+
case 422:
|
|
175
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
176
|
+
default:
|
|
177
|
+
throw new errors.FiveOneEatError({
|
|
178
|
+
statusCode: _response.error.statusCode,
|
|
179
|
+
body: _response.error.body,
|
|
180
|
+
rawResponse: _response.rawResponse,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
129
183
|
}
|
|
130
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/product-categories");
|
|
184
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/commerce/product-categories");
|
|
131
185
|
});
|
|
132
186
|
}
|
|
133
187
|
/**
|
|
134
|
-
* @param {FiveOneEat.business.
|
|
188
|
+
* @param {FiveOneEat.business.commerce.UpdateProductCategoryRequest} request
|
|
135
189
|
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
136
190
|
*
|
|
191
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
192
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
193
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
194
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
195
|
+
*
|
|
137
196
|
* @example
|
|
138
|
-
* await client.business.productCategories.update({
|
|
139
|
-
* productCategory: "productCategory"
|
|
197
|
+
* await client.business.commerce.productCategories.update({
|
|
198
|
+
* productCategory: "productCategory",
|
|
199
|
+
* name: "name"
|
|
140
200
|
* })
|
|
141
201
|
*/
|
|
142
202
|
update(request, requestOptions) {
|
|
@@ -145,14 +205,17 @@ class ProductCategoriesClient {
|
|
|
145
205
|
__update(request, requestOptions) {
|
|
146
206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
207
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148
|
-
const { productCategory } = request;
|
|
208
|
+
const { productCategory } = request, _body = __rest(request, ["productCategory"]);
|
|
149
209
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
150
210
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
151
211
|
const _response = yield core.fetcher({
|
|
152
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/product-categories/${core.url.encodePathParam(productCategory)}`),
|
|
212
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/commerce/product-categories/${core.url.encodePathParam(productCategory)}`),
|
|
153
213
|
method: "PUT",
|
|
154
214
|
headers: _headers,
|
|
215
|
+
contentType: "application/json",
|
|
155
216
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
217
|
+
requestType: "json",
|
|
218
|
+
body: _body,
|
|
156
219
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
157
220
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
158
221
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -160,24 +223,45 @@ class ProductCategoriesClient {
|
|
|
160
223
|
logging: this._options.logging,
|
|
161
224
|
});
|
|
162
225
|
if (_response.ok) {
|
|
163
|
-
return {
|
|
226
|
+
return {
|
|
227
|
+
data: _response.body,
|
|
228
|
+
rawResponse: _response.rawResponse,
|
|
229
|
+
};
|
|
164
230
|
}
|
|
165
231
|
if (_response.error.reason === "status-code") {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
232
|
+
switch (_response.error.statusCode) {
|
|
233
|
+
case 401:
|
|
234
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
235
|
+
case 403:
|
|
236
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
237
|
+
case 404:
|
|
238
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
239
|
+
case 422:
|
|
240
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
241
|
+
default:
|
|
242
|
+
throw new errors.FiveOneEatError({
|
|
243
|
+
statusCode: _response.error.statusCode,
|
|
244
|
+
body: _response.error.body,
|
|
245
|
+
rawResponse: _response.rawResponse,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
171
248
|
}
|
|
172
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/product-categories/{productCategory}");
|
|
249
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/commerce/product-categories/{productCategory}");
|
|
173
250
|
});
|
|
174
251
|
}
|
|
175
252
|
/**
|
|
176
|
-
*
|
|
253
|
+
* Its children become top-level categories and its products, and theirs,
|
|
254
|
+
* are left uncategorised.
|
|
255
|
+
*
|
|
256
|
+
* @param {FiveOneEat.business.commerce.DeleteProductCategoriesRequest} request
|
|
177
257
|
* @param {ProductCategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
178
258
|
*
|
|
259
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
260
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
261
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
262
|
+
*
|
|
179
263
|
* @example
|
|
180
|
-
* await client.business.productCategories.delete({
|
|
264
|
+
* await client.business.commerce.productCategories.delete({
|
|
181
265
|
* productCategory: "productCategory"
|
|
182
266
|
* })
|
|
183
267
|
*/
|
|
@@ -191,7 +275,7 @@ class ProductCategoriesClient {
|
|
|
191
275
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
192
276
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
193
277
|
const _response = yield core.fetcher({
|
|
194
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/product-categories/${core.url.encodePathParam(productCategory)}`),
|
|
278
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/commerce/product-categories/${core.url.encodePathParam(productCategory)}`),
|
|
195
279
|
method: "DELETE",
|
|
196
280
|
headers: _headers,
|
|
197
281
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -205,13 +289,22 @@ class ProductCategoriesClient {
|
|
|
205
289
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
206
290
|
}
|
|
207
291
|
if (_response.error.reason === "status-code") {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
292
|
+
switch (_response.error.statusCode) {
|
|
293
|
+
case 401:
|
|
294
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
295
|
+
case 403:
|
|
296
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
297
|
+
case 404:
|
|
298
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
299
|
+
default:
|
|
300
|
+
throw new errors.FiveOneEatError({
|
|
301
|
+
statusCode: _response.error.statusCode,
|
|
302
|
+
body: _response.error.body,
|
|
303
|
+
rawResponse: _response.rawResponse,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
213
306
|
}
|
|
214
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/product-categories/{productCategory}");
|
|
307
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/commerce/product-categories/{productCategory}");
|
|
215
308
|
});
|
|
216
309
|
}
|
|
217
310
|
}
|