@teemill/product-catalog 1.10.0 → 1.12.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.
Files changed (135) hide show
  1. package/.openapi-generator/FILES +8 -29
  2. package/.openapi-generator/VERSION +1 -1
  3. package/README.md +3 -3
  4. package/api.ts +1592 -0
  5. package/base.ts +86 -0
  6. package/common.ts +150 -0
  7. package/configuration.ts +110 -0
  8. package/dist/api.d.ts +1120 -0
  9. package/dist/api.js +819 -0
  10. package/dist/base.d.ts +66 -0
  11. package/dist/base.js +65 -0
  12. package/dist/common.d.ts +65 -0
  13. package/dist/common.js +161 -0
  14. package/dist/configuration.d.ts +91 -0
  15. package/dist/configuration.js +43 -0
  16. package/dist/esm/api.d.ts +1120 -0
  17. package/dist/esm/api.js +808 -0
  18. package/dist/esm/base.d.ts +66 -0
  19. package/dist/esm/base.js +60 -0
  20. package/dist/esm/common.d.ts +65 -0
  21. package/dist/esm/common.js +149 -0
  22. package/dist/esm/configuration.d.ts +91 -0
  23. package/dist/esm/configuration.js +39 -0
  24. package/dist/esm/index.d.ts +13 -0
  25. package/dist/esm/index.js +15 -0
  26. package/dist/index.d.ts +13 -3
  27. package/dist/index.js +15 -5
  28. package/git_push.sh +57 -0
  29. package/index.ts +18 -0
  30. package/package.json +18 -4
  31. package/tsconfig.esm.json +7 -0
  32. package/tsconfig.json +4 -6
  33. package/dist/apis/ProductsApi.d.ts +0 -107
  34. package/dist/apis/ProductsApi.js +0 -498
  35. package/dist/apis/VariantsApi.d.ts +0 -50
  36. package/dist/apis/VariantsApi.js +0 -235
  37. package/dist/apis/index.d.ts +0 -2
  38. package/dist/apis/index.js +0 -20
  39. package/dist/models/ApiError.d.ts +0 -37
  40. package/dist/models/ApiError.js +0 -49
  41. package/dist/models/Attribute.d.ts +0 -50
  42. package/dist/models/Attribute.js +0 -56
  43. package/dist/models/AttributeThumbnail.d.ts +0 -46
  44. package/dist/models/AttributeThumbnail.js +0 -55
  45. package/dist/models/CreateProductRequest.d.ts +0 -88
  46. package/dist/models/CreateProductRequest.js +0 -70
  47. package/dist/models/CreateProductRequestAdditionalFilesInner.d.ts +0 -31
  48. package/dist/models/CreateProductRequestAdditionalFilesInner.js +0 -50
  49. package/dist/models/CreateProductRequestImagesInner.d.ts +0 -31
  50. package/dist/models/CreateProductRequestImagesInner.js +0 -45
  51. package/dist/models/CreateProductRequestSeoMetadata.d.ts +0 -31
  52. package/dist/models/CreateProductRequestSeoMetadata.js +0 -45
  53. package/dist/models/CreateProductRequestVariantsInner.d.ts +0 -59
  54. package/dist/models/CreateProductRequestVariantsInner.js +0 -64
  55. package/dist/models/CreateProductRequestVariantsInnerApplicationsInner.d.ts +0 -63
  56. package/dist/models/CreateProductRequestVariantsInnerApplicationsInner.js +0 -74
  57. package/dist/models/CreateProductRequestVariantsInnerAttributesInner.d.ts +0 -37
  58. package/dist/models/CreateProductRequestVariantsInnerAttributesInner.js +0 -53
  59. package/dist/models/CreateProductRequestVariantsInnerImagesInner.d.ts +0 -31
  60. package/dist/models/CreateProductRequestVariantsInnerImagesInner.js +0 -50
  61. package/dist/models/CreateProductRequestVariantsInnerRetailPrice.d.ts +0 -37
  62. package/dist/models/CreateProductRequestVariantsInnerRetailPrice.js +0 -53
  63. package/dist/models/CreateProductVariant.d.ts +0 -59
  64. package/dist/models/CreateProductVariant.js +0 -61
  65. package/dist/models/CreateProductVariantApplicationsInner.d.ts +0 -63
  66. package/dist/models/CreateProductVariantApplicationsInner.js +0 -73
  67. package/dist/models/CreateProductVariantAttributesInner.d.ts +0 -37
  68. package/dist/models/CreateProductVariantAttributesInner.js +0 -51
  69. package/dist/models/CreateProductVariantRetailPrice.d.ts +0 -37
  70. package/dist/models/CreateProductVariantRetailPrice.js +0 -51
  71. package/dist/models/Image.d.ts +0 -67
  72. package/dist/models/Image.js +0 -57
  73. package/dist/models/ImportProducts200Response.d.ts +0 -31
  74. package/dist/models/ImportProducts200Response.js +0 -45
  75. package/dist/models/ModelFile.d.ts +0 -31
  76. package/dist/models/ModelFile.js +0 -45
  77. package/dist/models/Price.d.ts +0 -37
  78. package/dist/models/Price.js +0 -47
  79. package/dist/models/Product.d.ts +0 -113
  80. package/dist/models/Product.js +0 -78
  81. package/dist/models/ProductAdditionalFilesInner.d.ts +0 -37
  82. package/dist/models/ProductAdditionalFilesInner.js +0 -47
  83. package/dist/models/ProductsResponse.d.ts +0 -38
  84. package/dist/models/ProductsResponse.js +0 -48
  85. package/dist/models/SeoMetadata.d.ts +0 -31
  86. package/dist/models/SeoMetadata.js +0 -45
  87. package/dist/models/Stock.d.ts +0 -31
  88. package/dist/models/Stock.js +0 -45
  89. package/dist/models/UpdateProductRequest.d.ts +0 -87
  90. package/dist/models/UpdateProductRequest.js +0 -65
  91. package/dist/models/Variant.d.ts +0 -114
  92. package/dist/models/Variant.js +0 -78
  93. package/dist/models/VariantProduct.d.ts +0 -37
  94. package/dist/models/VariantProduct.js +0 -47
  95. package/dist/models/VariantsResponse.d.ts +0 -38
  96. package/dist/models/VariantsResponse.js +0 -48
  97. package/dist/models/index.d.ts +0 -23
  98. package/dist/models/index.js +0 -41
  99. package/dist/runtime.d.ts +0 -187
  100. package/dist/runtime.js +0 -565
  101. package/src/apis/ProductsApi.ts +0 -453
  102. package/src/apis/VariantsApi.ts +0 -186
  103. package/src/apis/index.ts +0 -4
  104. package/src/index.ts +0 -5
  105. package/src/models/ApiError.ts +0 -69
  106. package/src/models/Attribute.ts +0 -93
  107. package/src/models/AttributeThumbnail.ts +0 -80
  108. package/src/models/CreateProductRequest.ts +0 -153
  109. package/src/models/CreateProductRequestAdditionalFilesInner.ts +0 -65
  110. package/src/models/CreateProductRequestImagesInner.ts +0 -60
  111. package/src/models/CreateProductRequestSeoMetadata.ts +0 -60
  112. package/src/models/CreateProductRequestVariantsInner.ts +0 -124
  113. package/src/models/CreateProductRequestVariantsInnerApplicationsInner.ts +0 -108
  114. package/src/models/CreateProductRequestVariantsInnerAttributesInner.ts +0 -75
  115. package/src/models/CreateProductRequestVariantsInnerImagesInner.ts +0 -65
  116. package/src/models/CreateProductRequestVariantsInnerRetailPrice.ts +0 -75
  117. package/src/models/CreateProductVariant.ts +0 -119
  118. package/src/models/CreateProductVariantApplicationsInner.ts +0 -103
  119. package/src/models/CreateProductVariantAttributesInner.ts +0 -70
  120. package/src/models/CreateProductVariantRetailPrice.ts +0 -70
  121. package/src/models/Image.ts +0 -108
  122. package/src/models/ImportProducts200Response.ts +0 -60
  123. package/src/models/ModelFile.ts +0 -60
  124. package/src/models/Price.ts +0 -68
  125. package/src/models/Product.ts +0 -190
  126. package/src/models/ProductAdditionalFilesInner.ts +0 -68
  127. package/src/models/ProductsResponse.ts +0 -75
  128. package/src/models/SeoMetadata.ts +0 -60
  129. package/src/models/Stock.ts +0 -60
  130. package/src/models/UpdateProductRequest.ts +0 -145
  131. package/src/models/Variant.ts +0 -195
  132. package/src/models/VariantProduct.ts +0 -68
  133. package/src/models/VariantsResponse.ts +0 -75
  134. package/src/models/index.ts +0 -25
  135. package/src/runtime.ts +0 -441
package/tsconfig.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "declaration": true,
4
- "target": "es5",
4
+ "target": "ES6",
5
5
  "module": "commonjs",
6
- "moduleResolution": "node",
6
+ "noImplicitAny": true,
7
7
  "outDir": "dist",
8
- "lib": [
9
- "es6",
10
- "dom"
11
- ],
8
+ "rootDir": ".",
9
+ "moduleResolution": "node",
12
10
  "typeRoots": [
13
11
  "node_modules/@types"
14
12
  ]
@@ -1,107 +0,0 @@
1
- /**
2
- * Product Catalog API
3
- * Manage Product Catalog A catalog product is an object that represents a product listing that can be purchased from the given project. It contains a combination of design applications and a warehouse product, plus listing information such as title, description and tags.
4
- *
5
- * The version of the OpenAPI document: 1.10.0
6
- * Contact: hello@teemill.com
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime';
13
- import type { CreateProductRequest, ImportProducts200Response, Product, ProductsResponse, UpdateProductRequest } from '../models/index';
14
- export interface CreateProductOperationRequest {
15
- project: string;
16
- createProductRequest?: CreateProductRequest;
17
- }
18
- export interface DeleteProductRequest {
19
- project: string;
20
- productId: string;
21
- }
22
- export interface GetProductRequest {
23
- project: string;
24
- productId: string;
25
- fields?: string;
26
- }
27
- export interface GetProductsRequest {
28
- project: string;
29
- pageToken?: number;
30
- search?: string;
31
- pageSize?: number;
32
- fields?: string;
33
- }
34
- export interface ImportProductsRequest {
35
- project: string;
36
- body?: string;
37
- }
38
- export interface UpdateProductOperationRequest {
39
- project: string;
40
- productId: string;
41
- updateProductRequest?: UpdateProductRequest;
42
- }
43
- /**
44
- *
45
- */
46
- export declare class ProductsApi extends runtime.BaseAPI {
47
- /**
48
- * Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
49
- * Create product
50
- */
51
- createProductRaw(requestParameters: CreateProductOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>>;
52
- /**
53
- * Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
54
- * Create product
55
- */
56
- createProduct(project: string, optionalParameters?: runtime.OptionalOnly<CreateProductOperationRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Product>;
57
- /**
58
- * Deletes a catalog product
59
- * Delete catalog product
60
- */
61
- deleteProductRaw(requestParameters: DeleteProductRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
62
- /**
63
- * Deletes a catalog product
64
- * Delete catalog product
65
- */
66
- deleteProduct(project: string, productId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
67
- /**
68
- * Gets a product by a given ID.
69
- * Get product
70
- */
71
- getProductRaw(requestParameters: GetProductRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>>;
72
- /**
73
- * Gets a product by a given ID.
74
- * Get product
75
- */
76
- getProduct(project: string, productId: string, optionalParameters?: runtime.OptionalOnly<GetProductRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Product>;
77
- /**
78
- * Lists all enabled store listing products attached to the given project.
79
- * List products
80
- */
81
- getProductsRaw(requestParameters: GetProductsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductsResponse>>;
82
- /**
83
- * Lists all enabled store listing products attached to the given project.
84
- * List products
85
- */
86
- getProducts(project: string, optionalParameters?: runtime.OptionalOnly<GetProductsRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductsResponse>;
87
- /**
88
- * Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
89
- * Import products
90
- */
91
- importProductsRaw(requestParameters: ImportProductsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ImportProducts200Response>>;
92
- /**
93
- * Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
94
- * Import products
95
- */
96
- importProducts(project: string, optionalParameters?: runtime.OptionalOnly<ImportProductsRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ImportProducts200Response>;
97
- /**
98
- * Updates a product by a given ID.
99
- * Update product
100
- */
101
- updateProductRaw(requestParameters: UpdateProductOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>>;
102
- /**
103
- * Updates a product by a given ID.
104
- * Update product
105
- */
106
- updateProduct(project: string, productId: string, optionalParameters?: runtime.OptionalOnly<UpdateProductOperationRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Product>;
107
- }
@@ -1,498 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Product Catalog API
6
- * Manage Product Catalog A catalog product is an object that represents a product listing that can be purchased from the given project. It contains a combination of design applications and a warehouse product, plus listing information such as title, description and tags.
7
- *
8
- * The version of the OpenAPI document: 1.10.0
9
- * Contact: hello@teemill.com
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- var __extends = (this && this.__extends) || (function () {
16
- var extendStatics = function (d, b) {
17
- extendStatics = Object.setPrototypeOf ||
18
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
- return extendStatics(d, b);
21
- };
22
- return function (d, b) {
23
- if (typeof b !== "function" && b !== null)
24
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
- extendStatics(d, b);
26
- function __() { this.constructor = d; }
27
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
- };
29
- })();
30
- var __assign = (this && this.__assign) || function () {
31
- __assign = Object.assign || function(t) {
32
- for (var s, i = 1, n = arguments.length; i < n; i++) {
33
- s = arguments[i];
34
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
- t[p] = s[p];
36
- }
37
- return t;
38
- };
39
- return __assign.apply(this, arguments);
40
- };
41
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
- return new (P || (P = Promise))(function (resolve, reject) {
44
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- };
50
- var __generator = (this && this.__generator) || function (thisArg, body) {
51
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
52
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
53
- function verb(n) { return function (v) { return step([n, v]); }; }
54
- function step(op) {
55
- if (f) throw new TypeError("Generator is already executing.");
56
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
57
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
58
- if (y = 0, t) op = [op[0] & 2, t.value];
59
- switch (op[0]) {
60
- case 0: case 1: t = op; break;
61
- case 4: _.label++; return { value: op[1], done: false };
62
- case 5: _.label++; y = op[1]; op = [0]; continue;
63
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
64
- default:
65
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
66
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
67
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
68
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
69
- if (t[2]) _.ops.pop();
70
- _.trys.pop(); continue;
71
- }
72
- op = body.call(thisArg, _);
73
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
74
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
75
- }
76
- };
77
- Object.defineProperty(exports, "__esModule", { value: true });
78
- exports.ProductsApi = void 0;
79
- var runtime = require("../runtime");
80
- var index_1 = require("../models/index");
81
- /**
82
- *
83
- */
84
- var ProductsApi = /** @class */ (function (_super) {
85
- __extends(ProductsApi, _super);
86
- function ProductsApi() {
87
- return _super !== null && _super.apply(this, arguments) || this;
88
- }
89
- /**
90
- * Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
91
- * Create product
92
- */
93
- ProductsApi.prototype.createProductRaw = function (requestParameters, initOverrides) {
94
- return __awaiter(this, void 0, void 0, function () {
95
- var queryParameters, headerParameters, _a, _b, response;
96
- return __generator(this, function (_c) {
97
- switch (_c.label) {
98
- case 0:
99
- if (requestParameters.project === null || requestParameters.project === undefined) {
100
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling createProduct.');
101
- }
102
- queryParameters = {};
103
- if (requestParameters.project !== undefined) {
104
- queryParameters['project'] = requestParameters.project;
105
- }
106
- headerParameters = {};
107
- headerParameters['Content-Type'] = 'application/json';
108
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
109
- // oauth required
110
- _a = headerParameters;
111
- _b = "Authorization";
112
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
113
- case 1:
114
- // oauth required
115
- _a[_b] = _c.sent();
116
- _c.label = 2;
117
- case 2:
118
- if (this.configuration && this.configuration.apiKey) {
119
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
120
- }
121
- return [4 /*yield*/, this.request({
122
- path: "/v1/catalog/products",
123
- method: 'POST',
124
- headers: headerParameters,
125
- query: queryParameters,
126
- body: (0, index_1.CreateProductRequestToJSON)(requestParameters.createProductRequest),
127
- }, initOverrides)];
128
- case 3:
129
- response = _c.sent();
130
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.ProductFromJSON)(jsonValue); })];
131
- }
132
- });
133
- });
134
- };
135
- /**
136
- * Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
137
- * Create product
138
- */
139
- ProductsApi.prototype.createProduct = function (project, optionalParameters, initOverrides) {
140
- if (optionalParameters === void 0) { optionalParameters = {}; }
141
- return __awaiter(this, void 0, void 0, function () {
142
- var response;
143
- return __generator(this, function (_a) {
144
- switch (_a.label) {
145
- case 0: return [4 /*yield*/, this.createProductRaw(__assign({ project: project }, optionalParameters), initOverrides)];
146
- case 1:
147
- response = _a.sent();
148
- return [4 /*yield*/, response.value()];
149
- case 2: return [2 /*return*/, _a.sent()];
150
- }
151
- });
152
- });
153
- };
154
- /**
155
- * Deletes a catalog product
156
- * Delete catalog product
157
- */
158
- ProductsApi.prototype.deleteProductRaw = function (requestParameters, initOverrides) {
159
- return __awaiter(this, void 0, void 0, function () {
160
- var queryParameters, headerParameters, _a, _b, response;
161
- return __generator(this, function (_c) {
162
- switch (_c.label) {
163
- case 0:
164
- if (requestParameters.project === null || requestParameters.project === undefined) {
165
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling deleteProduct.');
166
- }
167
- if (requestParameters.productId === null || requestParameters.productId === undefined) {
168
- throw new runtime.RequiredError('productId', 'Required parameter requestParameters.productId was null or undefined when calling deleteProduct.');
169
- }
170
- queryParameters = {};
171
- if (requestParameters.project !== undefined) {
172
- queryParameters['project'] = requestParameters.project;
173
- }
174
- headerParameters = {};
175
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
176
- // oauth required
177
- _a = headerParameters;
178
- _b = "Authorization";
179
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
180
- case 1:
181
- // oauth required
182
- _a[_b] = _c.sent();
183
- _c.label = 2;
184
- case 2:
185
- if (this.configuration && this.configuration.apiKey) {
186
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
187
- }
188
- return [4 /*yield*/, this.request({
189
- path: "/v1/catalog/products/{productId}".replace("{".concat("productId", "}"), encodeURIComponent(String(requestParameters.productId))),
190
- method: 'DELETE',
191
- headers: headerParameters,
192
- query: queryParameters,
193
- }, initOverrides)];
194
- case 3:
195
- response = _c.sent();
196
- return [2 /*return*/, new runtime.VoidApiResponse(response)];
197
- }
198
- });
199
- });
200
- };
201
- /**
202
- * Deletes a catalog product
203
- * Delete catalog product
204
- */
205
- ProductsApi.prototype.deleteProduct = function (project, productId, initOverrides) {
206
- return __awaiter(this, void 0, void 0, function () {
207
- return __generator(this, function (_a) {
208
- switch (_a.label) {
209
- case 0: return [4 /*yield*/, this.deleteProductRaw({
210
- project: project, productId: productId,
211
- }, initOverrides)];
212
- case 1:
213
- _a.sent();
214
- return [2 /*return*/];
215
- }
216
- });
217
- });
218
- };
219
- /**
220
- * Gets a product by a given ID.
221
- * Get product
222
- */
223
- ProductsApi.prototype.getProductRaw = function (requestParameters, initOverrides) {
224
- return __awaiter(this, void 0, void 0, function () {
225
- var queryParameters, headerParameters, _a, _b, response;
226
- return __generator(this, function (_c) {
227
- switch (_c.label) {
228
- case 0:
229
- if (requestParameters.project === null || requestParameters.project === undefined) {
230
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling getProduct.');
231
- }
232
- if (requestParameters.productId === null || requestParameters.productId === undefined) {
233
- throw new runtime.RequiredError('productId', 'Required parameter requestParameters.productId was null or undefined when calling getProduct.');
234
- }
235
- queryParameters = {};
236
- if (requestParameters.project !== undefined) {
237
- queryParameters['project'] = requestParameters.project;
238
- }
239
- if (requestParameters.fields !== undefined) {
240
- queryParameters['fields'] = requestParameters.fields;
241
- }
242
- headerParameters = {};
243
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
244
- // oauth required
245
- _a = headerParameters;
246
- _b = "Authorization";
247
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
248
- case 1:
249
- // oauth required
250
- _a[_b] = _c.sent();
251
- _c.label = 2;
252
- case 2:
253
- if (this.configuration && this.configuration.apiKey) {
254
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
255
- }
256
- return [4 /*yield*/, this.request({
257
- path: "/v1/catalog/products/{productId}".replace("{".concat("productId", "}"), encodeURIComponent(String(requestParameters.productId))),
258
- method: 'GET',
259
- headers: headerParameters,
260
- query: queryParameters,
261
- }, initOverrides)];
262
- case 3:
263
- response = _c.sent();
264
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.ProductFromJSON)(jsonValue); })];
265
- }
266
- });
267
- });
268
- };
269
- /**
270
- * Gets a product by a given ID.
271
- * Get product
272
- */
273
- ProductsApi.prototype.getProduct = function (project, productId, optionalParameters, initOverrides) {
274
- if (optionalParameters === void 0) { optionalParameters = {}; }
275
- return __awaiter(this, void 0, void 0, function () {
276
- var response;
277
- return __generator(this, function (_a) {
278
- switch (_a.label) {
279
- case 0: return [4 /*yield*/, this.getProductRaw(__assign({ project: project, productId: productId }, optionalParameters), initOverrides)];
280
- case 1:
281
- response = _a.sent();
282
- return [4 /*yield*/, response.value()];
283
- case 2: return [2 /*return*/, _a.sent()];
284
- }
285
- });
286
- });
287
- };
288
- /**
289
- * Lists all enabled store listing products attached to the given project.
290
- * List products
291
- */
292
- ProductsApi.prototype.getProductsRaw = function (requestParameters, initOverrides) {
293
- return __awaiter(this, void 0, void 0, function () {
294
- var queryParameters, headerParameters, _a, _b, response;
295
- return __generator(this, function (_c) {
296
- switch (_c.label) {
297
- case 0:
298
- if (requestParameters.project === null || requestParameters.project === undefined) {
299
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling getProducts.');
300
- }
301
- queryParameters = {};
302
- if (requestParameters.project !== undefined) {
303
- queryParameters['project'] = requestParameters.project;
304
- }
305
- if (requestParameters.pageToken !== undefined) {
306
- queryParameters['pageToken'] = requestParameters.pageToken;
307
- }
308
- if (requestParameters.search !== undefined) {
309
- queryParameters['search'] = requestParameters.search;
310
- }
311
- if (requestParameters.pageSize !== undefined) {
312
- queryParameters['pageSize'] = requestParameters.pageSize;
313
- }
314
- if (requestParameters.fields !== undefined) {
315
- queryParameters['fields'] = requestParameters.fields;
316
- }
317
- headerParameters = {};
318
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
319
- // oauth required
320
- _a = headerParameters;
321
- _b = "Authorization";
322
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
323
- case 1:
324
- // oauth required
325
- _a[_b] = _c.sent();
326
- _c.label = 2;
327
- case 2:
328
- if (this.configuration && this.configuration.apiKey) {
329
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
330
- }
331
- return [4 /*yield*/, this.request({
332
- path: "/v1/catalog/products",
333
- method: 'GET',
334
- headers: headerParameters,
335
- query: queryParameters,
336
- }, initOverrides)];
337
- case 3:
338
- response = _c.sent();
339
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.ProductsResponseFromJSON)(jsonValue); })];
340
- }
341
- });
342
- });
343
- };
344
- /**
345
- * Lists all enabled store listing products attached to the given project.
346
- * List products
347
- */
348
- ProductsApi.prototype.getProducts = function (project, optionalParameters, initOverrides) {
349
- if (optionalParameters === void 0) { optionalParameters = {}; }
350
- return __awaiter(this, void 0, void 0, function () {
351
- var response;
352
- return __generator(this, function (_a) {
353
- switch (_a.label) {
354
- case 0: return [4 /*yield*/, this.getProductsRaw(__assign({ project: project }, optionalParameters), initOverrides)];
355
- case 1:
356
- response = _a.sent();
357
- return [4 /*yield*/, response.value()];
358
- case 2: return [2 /*return*/, _a.sent()];
359
- }
360
- });
361
- });
362
- };
363
- /**
364
- * Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
365
- * Import products
366
- */
367
- ProductsApi.prototype.importProductsRaw = function (requestParameters, initOverrides) {
368
- return __awaiter(this, void 0, void 0, function () {
369
- var queryParameters, headerParameters, _a, _b, response;
370
- return __generator(this, function (_c) {
371
- switch (_c.label) {
372
- case 0:
373
- if (requestParameters.project === null || requestParameters.project === undefined) {
374
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling importProducts.');
375
- }
376
- queryParameters = {};
377
- if (requestParameters.project !== undefined) {
378
- queryParameters['project'] = requestParameters.project;
379
- }
380
- headerParameters = {};
381
- headerParameters['Content-Type'] = 'text/csv';
382
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
383
- // oauth required
384
- _a = headerParameters;
385
- _b = "Authorization";
386
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
387
- case 1:
388
- // oauth required
389
- _a[_b] = _c.sent();
390
- _c.label = 2;
391
- case 2:
392
- if (this.configuration && this.configuration.apiKey) {
393
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
394
- }
395
- return [4 /*yield*/, this.request({
396
- path: "/v1/catalog/products/import",
397
- method: 'POST',
398
- headers: headerParameters,
399
- query: queryParameters,
400
- body: requestParameters.body,
401
- }, initOverrides)];
402
- case 3:
403
- response = _c.sent();
404
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.ImportProducts200ResponseFromJSON)(jsonValue); })];
405
- }
406
- });
407
- });
408
- };
409
- /**
410
- * Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
411
- * Import products
412
- */
413
- ProductsApi.prototype.importProducts = function (project, optionalParameters, initOverrides) {
414
- if (optionalParameters === void 0) { optionalParameters = {}; }
415
- return __awaiter(this, void 0, void 0, function () {
416
- var response;
417
- return __generator(this, function (_a) {
418
- switch (_a.label) {
419
- case 0: return [4 /*yield*/, this.importProductsRaw(__assign({ project: project }, optionalParameters), initOverrides)];
420
- case 1:
421
- response = _a.sent();
422
- return [4 /*yield*/, response.value()];
423
- case 2: return [2 /*return*/, _a.sent()];
424
- }
425
- });
426
- });
427
- };
428
- /**
429
- * Updates a product by a given ID.
430
- * Update product
431
- */
432
- ProductsApi.prototype.updateProductRaw = function (requestParameters, initOverrides) {
433
- return __awaiter(this, void 0, void 0, function () {
434
- var queryParameters, headerParameters, _a, _b, response;
435
- return __generator(this, function (_c) {
436
- switch (_c.label) {
437
- case 0:
438
- if (requestParameters.project === null || requestParameters.project === undefined) {
439
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling updateProduct.');
440
- }
441
- if (requestParameters.productId === null || requestParameters.productId === undefined) {
442
- throw new runtime.RequiredError('productId', 'Required parameter requestParameters.productId was null or undefined when calling updateProduct.');
443
- }
444
- queryParameters = {};
445
- if (requestParameters.project !== undefined) {
446
- queryParameters['project'] = requestParameters.project;
447
- }
448
- headerParameters = {};
449
- headerParameters['Content-Type'] = 'application/json';
450
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
451
- // oauth required
452
- _a = headerParameters;
453
- _b = "Authorization";
454
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
455
- case 1:
456
- // oauth required
457
- _a[_b] = _c.sent();
458
- _c.label = 2;
459
- case 2:
460
- if (this.configuration && this.configuration.apiKey) {
461
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
462
- }
463
- return [4 /*yield*/, this.request({
464
- path: "/v1/catalog/products/{productId}".replace("{".concat("productId", "}"), encodeURIComponent(String(requestParameters.productId))),
465
- method: 'PATCH',
466
- headers: headerParameters,
467
- query: queryParameters,
468
- body: (0, index_1.UpdateProductRequestToJSON)(requestParameters.updateProductRequest),
469
- }, initOverrides)];
470
- case 3:
471
- response = _c.sent();
472
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.ProductFromJSON)(jsonValue); })];
473
- }
474
- });
475
- });
476
- };
477
- /**
478
- * Updates a product by a given ID.
479
- * Update product
480
- */
481
- ProductsApi.prototype.updateProduct = function (project, productId, optionalParameters, initOverrides) {
482
- if (optionalParameters === void 0) { optionalParameters = {}; }
483
- return __awaiter(this, void 0, void 0, function () {
484
- var response;
485
- return __generator(this, function (_a) {
486
- switch (_a.label) {
487
- case 0: return [4 /*yield*/, this.updateProductRaw(__assign({ project: project, productId: productId }, optionalParameters), initOverrides)];
488
- case 1:
489
- response = _a.sent();
490
- return [4 /*yield*/, response.value()];
491
- case 2: return [2 /*return*/, _a.sent()];
492
- }
493
- });
494
- });
495
- };
496
- return ProductsApi;
497
- }(runtime.BaseAPI));
498
- exports.ProductsApi = ProductsApi;