@teemill/gfn-catalog 1.2.0 → 1.3.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 (92) hide show
  1. package/.openapi-generator/FILES +1 -0
  2. package/.openapi-generator/VERSION +1 -1
  3. package/README.md +2 -2
  4. package/dist/apis/ProductsApi.d.ts +1 -1
  5. package/dist/apis/ProductsApi.js +47 -128
  6. package/dist/apis/VariantsApi.d.ts +19 -2
  7. package/dist/apis/VariantsApi.js +170 -245
  8. package/dist/esm/apis/ProductsApi.d.ts +35 -0
  9. package/dist/esm/apis/ProductsApi.js +81 -0
  10. package/dist/esm/apis/VariantsApi.d.ts +82 -0
  11. package/dist/esm/apis/VariantsApi.js +225 -0
  12. package/dist/esm/apis/index.d.ts +2 -0
  13. package/dist/esm/apis/index.js +4 -0
  14. package/dist/esm/index.d.ts +3 -0
  15. package/dist/esm/index.js +5 -0
  16. package/dist/esm/models/ApiError.d.ts +37 -0
  17. package/dist/esm/models/ApiError.js +42 -0
  18. package/dist/esm/models/Attribute.d.ts +50 -0
  19. package/dist/esm/models/Attribute.js +49 -0
  20. package/dist/esm/models/AttributeThumbnail.d.ts +46 -0
  21. package/dist/esm/models/AttributeThumbnail.js +48 -0
  22. package/dist/esm/models/Image.d.ts +67 -0
  23. package/dist/esm/models/Image.js +50 -0
  24. package/dist/esm/models/Product.d.ts +67 -0
  25. package/dist/esm/models/Product.js +52 -0
  26. package/dist/esm/models/ProductsResponse.d.ts +38 -0
  27. package/dist/esm/models/ProductsResponse.js +41 -0
  28. package/dist/esm/models/Stock.d.ts +31 -0
  29. package/dist/esm/models/Stock.js +38 -0
  30. package/dist/esm/models/StockResponse.d.ts +38 -0
  31. package/dist/esm/models/StockResponse.js +41 -0
  32. package/dist/esm/models/Variant.d.ts +78 -0
  33. package/dist/esm/models/Variant.js +61 -0
  34. package/dist/esm/models/VariantManufacturerOrigin.d.ts +37 -0
  35. package/dist/esm/models/VariantManufacturerOrigin.js +40 -0
  36. package/dist/esm/models/VariantProduct.d.ts +37 -0
  37. package/dist/esm/models/VariantProduct.js +40 -0
  38. package/dist/esm/models/VariantStock.d.ts +50 -0
  39. package/dist/esm/models/VariantStock.js +45 -0
  40. package/dist/esm/models/VariantsResponse.d.ts +38 -0
  41. package/dist/esm/models/VariantsResponse.js +41 -0
  42. package/dist/esm/models/index.d.ts +13 -0
  43. package/dist/esm/models/index.js +15 -0
  44. package/dist/esm/runtime.d.ts +187 -0
  45. package/dist/esm/runtime.js +333 -0
  46. package/dist/models/ApiError.d.ts +1 -1
  47. package/dist/models/ApiError.js +1 -1
  48. package/dist/models/Attribute.d.ts +1 -1
  49. package/dist/models/Attribute.js +2 -2
  50. package/dist/models/AttributeThumbnail.d.ts +1 -1
  51. package/dist/models/AttributeThumbnail.js +1 -1
  52. package/dist/models/Image.d.ts +1 -1
  53. package/dist/models/Image.js +1 -1
  54. package/dist/models/Product.d.ts +1 -1
  55. package/dist/models/Product.js +1 -1
  56. package/dist/models/ProductsResponse.d.ts +1 -1
  57. package/dist/models/ProductsResponse.js +2 -2
  58. package/dist/models/Stock.d.ts +1 -1
  59. package/dist/models/Stock.js +1 -1
  60. package/dist/models/StockResponse.d.ts +1 -1
  61. package/dist/models/StockResponse.js +2 -2
  62. package/dist/models/Variant.d.ts +1 -1
  63. package/dist/models/Variant.js +6 -6
  64. package/dist/models/VariantManufacturerOrigin.d.ts +1 -1
  65. package/dist/models/VariantManufacturerOrigin.js +1 -1
  66. package/dist/models/VariantProduct.d.ts +1 -1
  67. package/dist/models/VariantProduct.js +1 -1
  68. package/dist/models/VariantStock.d.ts +1 -1
  69. package/dist/models/VariantStock.js +2 -2
  70. package/dist/models/VariantsResponse.d.ts +1 -1
  71. package/dist/models/VariantsResponse.js +2 -2
  72. package/dist/runtime.d.ts +1 -1
  73. package/dist/runtime.js +223 -439
  74. package/package.json +4 -2
  75. package/src/apis/ProductsApi.ts +1 -1
  76. package/src/apis/VariantsApi.ts +84 -1
  77. package/src/models/ApiError.ts +1 -1
  78. package/src/models/Attribute.ts +1 -1
  79. package/src/models/AttributeThumbnail.ts +1 -1
  80. package/src/models/Image.ts +1 -1
  81. package/src/models/Product.ts +1 -1
  82. package/src/models/ProductsResponse.ts +1 -1
  83. package/src/models/Stock.ts +1 -1
  84. package/src/models/StockResponse.ts +1 -1
  85. package/src/models/Variant.ts +1 -1
  86. package/src/models/VariantManufacturerOrigin.ts +1 -1
  87. package/src/models/VariantProduct.ts +1 -1
  88. package/src/models/VariantStock.ts +1 -1
  89. package/src/models/VariantsResponse.ts +1 -1
  90. package/src/runtime.ts +1 -1
  91. package/tsconfig.esm.json +7 -0
  92. package/tsconfig.json +2 -2
@@ -5,39 +5,13 @@
5
5
  * GFN Catalog API
6
6
  * Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
7
7
  *
8
- * The version of the OpenAPI document: 1.2.0
8
+ * The version of the OpenAPI document: 1.3.0
9
9
  * Contact: hello@teemill.com
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
12
  * https://openapi-generator.tech
13
13
  * Do not edit the class manually.
14
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
15
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
16
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
17
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -47,258 +21,209 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
47
21
  step((generator = generator.apply(thisArg, _arguments || [])).next());
48
22
  });
49
23
  };
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
24
  Object.defineProperty(exports, "__esModule", { value: true });
78
25
  exports.VariantsApi = void 0;
79
- var runtime = require("../runtime");
80
- var index_1 = require("../models/index");
26
+ const runtime = require("../runtime");
27
+ const index_1 = require("../models/index");
81
28
  /**
82
29
  *
83
30
  */
84
- var VariantsApi = /** @class */ (function (_super) {
85
- __extends(VariantsApi, _super);
86
- function VariantsApi() {
87
- return _super !== null && _super.apply(this, arguments) || this;
31
+ class VariantsApi extends runtime.BaseAPI {
32
+ /**
33
+ * Gets the stock level for the GFN variant with the given ID.
34
+ * Get GFN variant stock
35
+ */
36
+ getStockRaw(requestParameters, initOverrides) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (requestParameters.project === null || requestParameters.project === undefined) {
39
+ throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling getStock.');
40
+ }
41
+ if (requestParameters.variantId === null || requestParameters.variantId === undefined) {
42
+ throw new runtime.RequiredError('variantId', 'Required parameter requestParameters.variantId was null or undefined when calling getStock.');
43
+ }
44
+ const queryParameters = {};
45
+ if (requestParameters.project !== undefined) {
46
+ queryParameters['project'] = requestParameters.project;
47
+ }
48
+ if (requestParameters.fulfillmentProjects !== undefined) {
49
+ queryParameters['fulfillmentProjects'] = requestParameters.fulfillmentProjects;
50
+ }
51
+ const headerParameters = {};
52
+ if (this.configuration && this.configuration.accessToken) {
53
+ // oauth required
54
+ headerParameters["Authorization"] = yield this.configuration.accessToken("session-oauth", []);
55
+ }
56
+ if (this.configuration && this.configuration.apiKey) {
57
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
58
+ }
59
+ const response = yield this.request({
60
+ path: `/v1/gfn/catalog/stock/{variantId}`.replace(`{${"variantId"}}`, encodeURIComponent(String(requestParameters.variantId))),
61
+ method: 'GET',
62
+ headers: headerParameters,
63
+ query: queryParameters,
64
+ }, initOverrides);
65
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantStockFromJSON)(jsonValue));
66
+ });
67
+ }
68
+ /**
69
+ * Gets the stock level for the GFN variant with the given ID.
70
+ * Get GFN variant stock
71
+ */
72
+ getStock(project, variantId, optionalParameters = {}, initOverrides) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const response = yield this.getStockRaw(Object.assign({ project: project, variantId: variantId }, optionalParameters), initOverrides);
75
+ return yield response.value();
76
+ });
88
77
  }
89
78
  /**
90
79
  * Gets a GFN variant by the given ID.
91
80
  * Get a GFN variant
92
81
  */
93
- VariantsApi.prototype.getVariantRaw = 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 getVariant.');
101
- }
102
- if (requestParameters.variantId === null || requestParameters.variantId === undefined) {
103
- throw new runtime.RequiredError('variantId', 'Required parameter requestParameters.variantId was null or undefined when calling getVariant.');
104
- }
105
- queryParameters = {};
106
- if (requestParameters.project !== undefined) {
107
- queryParameters['project'] = requestParameters.project;
108
- }
109
- if (requestParameters.fields !== undefined) {
110
- queryParameters['fields'] = requestParameters.fields;
111
- }
112
- headerParameters = {};
113
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
114
- // oauth required
115
- _a = headerParameters;
116
- _b = "Authorization";
117
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
118
- case 1:
119
- // oauth required
120
- _a[_b] = _c.sent();
121
- _c.label = 2;
122
- case 2:
123
- if (this.configuration && this.configuration.apiKey) {
124
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
125
- }
126
- return [4 /*yield*/, this.request({
127
- path: "/v1/gfn/catalog/variants/{variantId}".replace("{".concat("variantId", "}"), encodeURIComponent(String(requestParameters.variantId))),
128
- method: 'GET',
129
- headers: headerParameters,
130
- query: queryParameters,
131
- }, initOverrides)];
132
- case 3:
133
- response = _c.sent();
134
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.VariantFromJSON)(jsonValue); })];
135
- }
136
- });
82
+ getVariantRaw(requestParameters, initOverrides) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ if (requestParameters.project === null || requestParameters.project === undefined) {
85
+ throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling getVariant.');
86
+ }
87
+ if (requestParameters.variantId === null || requestParameters.variantId === undefined) {
88
+ throw new runtime.RequiredError('variantId', 'Required parameter requestParameters.variantId was null or undefined when calling getVariant.');
89
+ }
90
+ const queryParameters = {};
91
+ if (requestParameters.project !== undefined) {
92
+ queryParameters['project'] = requestParameters.project;
93
+ }
94
+ if (requestParameters.fields !== undefined) {
95
+ queryParameters['fields'] = requestParameters.fields;
96
+ }
97
+ const headerParameters = {};
98
+ if (this.configuration && this.configuration.accessToken) {
99
+ // oauth required
100
+ headerParameters["Authorization"] = yield this.configuration.accessToken("session-oauth", []);
101
+ }
102
+ if (this.configuration && this.configuration.apiKey) {
103
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
104
+ }
105
+ const response = yield this.request({
106
+ path: `/v1/gfn/catalog/variants/{variantId}`.replace(`{${"variantId"}}`, encodeURIComponent(String(requestParameters.variantId))),
107
+ method: 'GET',
108
+ headers: headerParameters,
109
+ query: queryParameters,
110
+ }, initOverrides);
111
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantFromJSON)(jsonValue));
137
112
  });
138
- };
113
+ }
139
114
  /**
140
115
  * Gets a GFN variant by the given ID.
141
116
  * Get a GFN variant
142
117
  */
143
- VariantsApi.prototype.getVariant = function (project, variantId, optionalParameters, initOverrides) {
144
- if (optionalParameters === void 0) { optionalParameters = {}; }
145
- return __awaiter(this, void 0, void 0, function () {
146
- var response;
147
- return __generator(this, function (_a) {
148
- switch (_a.label) {
149
- case 0: return [4 /*yield*/, this.getVariantRaw(__assign({ project: project, variantId: variantId }, optionalParameters), initOverrides)];
150
- case 1:
151
- response = _a.sent();
152
- return [4 /*yield*/, response.value()];
153
- case 2: return [2 /*return*/, _a.sent()];
154
- }
155
- });
118
+ getVariant(project, variantId, optionalParameters = {}, initOverrides) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const response = yield this.getVariantRaw(Object.assign({ project: project, variantId: variantId }, optionalParameters), initOverrides);
121
+ return yield response.value();
156
122
  });
157
- };
123
+ }
158
124
  /**
159
125
  * Lists the stock levels for all GFN variants available to the project.
160
126
  * List GFN variant stock
161
127
  */
162
- VariantsApi.prototype.listStockRaw = function (requestParameters, initOverrides) {
163
- return __awaiter(this, void 0, void 0, function () {
164
- var queryParameters, headerParameters, _a, _b, response;
165
- return __generator(this, function (_c) {
166
- switch (_c.label) {
167
- case 0:
168
- if (requestParameters.project === null || requestParameters.project === undefined) {
169
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling listStock.');
170
- }
171
- queryParameters = {};
172
- if (requestParameters.project !== undefined) {
173
- queryParameters['project'] = requestParameters.project;
174
- }
175
- if (requestParameters.pageToken !== undefined) {
176
- queryParameters['pageToken'] = requestParameters.pageToken;
177
- }
178
- if (requestParameters.pageSize !== undefined) {
179
- queryParameters['pageSize'] = requestParameters.pageSize;
180
- }
181
- headerParameters = {};
182
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
183
- // oauth required
184
- _a = headerParameters;
185
- _b = "Authorization";
186
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
187
- case 1:
188
- // oauth required
189
- _a[_b] = _c.sent();
190
- _c.label = 2;
191
- case 2:
192
- if (this.configuration && this.configuration.apiKey) {
193
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
194
- }
195
- return [4 /*yield*/, this.request({
196
- path: "/v1/gfn/catalog/stock",
197
- method: 'GET',
198
- headers: headerParameters,
199
- query: queryParameters,
200
- }, initOverrides)];
201
- case 3:
202
- response = _c.sent();
203
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.StockResponseFromJSON)(jsonValue); })];
204
- }
205
- });
128
+ listStockRaw(requestParameters, initOverrides) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ if (requestParameters.project === null || requestParameters.project === undefined) {
131
+ throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling listStock.');
132
+ }
133
+ const queryParameters = {};
134
+ if (requestParameters.project !== undefined) {
135
+ queryParameters['project'] = requestParameters.project;
136
+ }
137
+ if (requestParameters.fulfillmentProjects !== undefined) {
138
+ queryParameters['fulfillmentProjects'] = requestParameters.fulfillmentProjects;
139
+ }
140
+ if (requestParameters.pageToken !== undefined) {
141
+ queryParameters['pageToken'] = requestParameters.pageToken;
142
+ }
143
+ if (requestParameters.pageSize !== undefined) {
144
+ queryParameters['pageSize'] = requestParameters.pageSize;
145
+ }
146
+ if (requestParameters.search !== undefined) {
147
+ queryParameters['search'] = requestParameters.search;
148
+ }
149
+ const headerParameters = {};
150
+ if (this.configuration && this.configuration.accessToken) {
151
+ // oauth required
152
+ headerParameters["Authorization"] = yield this.configuration.accessToken("session-oauth", []);
153
+ }
154
+ if (this.configuration && this.configuration.apiKey) {
155
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
156
+ }
157
+ const response = yield this.request({
158
+ path: `/v1/gfn/catalog/stock`,
159
+ method: 'GET',
160
+ headers: headerParameters,
161
+ query: queryParameters,
162
+ }, initOverrides);
163
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.StockResponseFromJSON)(jsonValue));
206
164
  });
207
- };
165
+ }
208
166
  /**
209
167
  * Lists the stock levels for all GFN variants available to the project.
210
168
  * List GFN variant stock
211
169
  */
212
- VariantsApi.prototype.listStock = function (project, optionalParameters, initOverrides) {
213
- if (optionalParameters === void 0) { optionalParameters = {}; }
214
- return __awaiter(this, void 0, void 0, function () {
215
- var response;
216
- return __generator(this, function (_a) {
217
- switch (_a.label) {
218
- case 0: return [4 /*yield*/, this.listStockRaw(__assign({ project: project }, optionalParameters), initOverrides)];
219
- case 1:
220
- response = _a.sent();
221
- return [4 /*yield*/, response.value()];
222
- case 2: return [2 /*return*/, _a.sent()];
223
- }
224
- });
170
+ listStock(project, optionalParameters = {}, initOverrides) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ const response = yield this.listStockRaw(Object.assign({ project: project }, optionalParameters), initOverrides);
173
+ return yield response.value();
225
174
  });
226
- };
175
+ }
227
176
  /**
228
177
  * Lists all GFN variants available to the project. Can be filtered by product ID, SKU, and attribute values using the search parameter.
229
178
  * List GFN variants
230
179
  */
231
- VariantsApi.prototype.listVariantsRaw = function (requestParameters, initOverrides) {
232
- return __awaiter(this, void 0, void 0, function () {
233
- var queryParameters, headerParameters, _a, _b, response;
234
- return __generator(this, function (_c) {
235
- switch (_c.label) {
236
- case 0:
237
- if (requestParameters.project === null || requestParameters.project === undefined) {
238
- throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling listVariants.');
239
- }
240
- queryParameters = {};
241
- if (requestParameters.project !== undefined) {
242
- queryParameters['project'] = requestParameters.project;
243
- }
244
- if (requestParameters.pageToken !== undefined) {
245
- queryParameters['pageToken'] = requestParameters.pageToken;
246
- }
247
- if (requestParameters.pageSize !== undefined) {
248
- queryParameters['pageSize'] = requestParameters.pageSize;
249
- }
250
- if (requestParameters.fields !== undefined) {
251
- queryParameters['fields'] = requestParameters.fields;
252
- }
253
- if (requestParameters.search !== undefined) {
254
- queryParameters['search'] = requestParameters.search;
255
- }
256
- headerParameters = {};
257
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
258
- // oauth required
259
- _a = headerParameters;
260
- _b = "Authorization";
261
- return [4 /*yield*/, this.configuration.accessToken("session-oauth", [])];
262
- case 1:
263
- // oauth required
264
- _a[_b] = _c.sent();
265
- _c.label = 2;
266
- case 2:
267
- if (this.configuration && this.configuration.apiKey) {
268
- headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
269
- }
270
- return [4 /*yield*/, this.request({
271
- path: "/v1/gfn/catalog/variants",
272
- method: 'GET',
273
- headers: headerParameters,
274
- query: queryParameters,
275
- }, initOverrides)];
276
- case 3:
277
- response = _c.sent();
278
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.VariantsResponseFromJSON)(jsonValue); })];
279
- }
280
- });
180
+ listVariantsRaw(requestParameters, initOverrides) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ if (requestParameters.project === null || requestParameters.project === undefined) {
183
+ throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling listVariants.');
184
+ }
185
+ const queryParameters = {};
186
+ if (requestParameters.project !== undefined) {
187
+ queryParameters['project'] = requestParameters.project;
188
+ }
189
+ if (requestParameters.pageToken !== undefined) {
190
+ queryParameters['pageToken'] = requestParameters.pageToken;
191
+ }
192
+ if (requestParameters.pageSize !== undefined) {
193
+ queryParameters['pageSize'] = requestParameters.pageSize;
194
+ }
195
+ if (requestParameters.fields !== undefined) {
196
+ queryParameters['fields'] = requestParameters.fields;
197
+ }
198
+ if (requestParameters.search !== undefined) {
199
+ queryParameters['search'] = requestParameters.search;
200
+ }
201
+ const headerParameters = {};
202
+ if (this.configuration && this.configuration.accessToken) {
203
+ // oauth required
204
+ headerParameters["Authorization"] = yield this.configuration.accessToken("session-oauth", []);
205
+ }
206
+ if (this.configuration && this.configuration.apiKey) {
207
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
208
+ }
209
+ const response = yield this.request({
210
+ path: `/v1/gfn/catalog/variants`,
211
+ method: 'GET',
212
+ headers: headerParameters,
213
+ query: queryParameters,
214
+ }, initOverrides);
215
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantsResponseFromJSON)(jsonValue));
281
216
  });
282
- };
217
+ }
283
218
  /**
284
219
  * Lists all GFN variants available to the project. Can be filtered by product ID, SKU, and attribute values using the search parameter.
285
220
  * List GFN variants
286
221
  */
287
- VariantsApi.prototype.listVariants = function (project, optionalParameters, initOverrides) {
288
- if (optionalParameters === void 0) { optionalParameters = {}; }
289
- return __awaiter(this, void 0, void 0, function () {
290
- var response;
291
- return __generator(this, function (_a) {
292
- switch (_a.label) {
293
- case 0: return [4 /*yield*/, this.listVariantsRaw(__assign({ project: project }, optionalParameters), initOverrides)];
294
- case 1:
295
- response = _a.sent();
296
- return [4 /*yield*/, response.value()];
297
- case 2: return [2 /*return*/, _a.sent()];
298
- }
299
- });
222
+ listVariants(project, optionalParameters = {}, initOverrides) {
223
+ return __awaiter(this, void 0, void 0, function* () {
224
+ const response = yield this.listVariantsRaw(Object.assign({ project: project }, optionalParameters), initOverrides);
225
+ return yield response.value();
300
226
  });
301
- };
302
- return VariantsApi;
303
- }(runtime.BaseAPI));
227
+ }
228
+ }
304
229
  exports.VariantsApi = VariantsApi;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * GFN Catalog API
3
+ * Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
4
+ *
5
+ * The version of the OpenAPI document: 1.3.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 { ProductsResponse } from '../models/index';
14
+ export interface ListProductsRequest {
15
+ project: string;
16
+ pageToken?: number;
17
+ pageSize?: number;
18
+ fields?: string;
19
+ search?: string;
20
+ }
21
+ /**
22
+ *
23
+ */
24
+ export declare class ProductsApi extends runtime.BaseAPI {
25
+ /**
26
+ * Lists all GFN products available to the project. Can be filtered by style codes using the search parameter.
27
+ * List GFN products
28
+ */
29
+ listProductsRaw(requestParameters: ListProductsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductsResponse>>;
30
+ /**
31
+ * Lists all GFN products available to the project. Can be filtered by style codes using the search parameter.
32
+ * List GFN products
33
+ */
34
+ listProducts(project: string, optionalParameters?: runtime.OptionalOnly<ListProductsRequest>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductsResponse>;
35
+ }
@@ -0,0 +1,81 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GFN Catalog API
5
+ * Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
6
+ *
7
+ * The version of the OpenAPI document: 1.3.0
8
+ * Contact: hello@teemill.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { ProductsResponseFromJSON, } from '../models/index';
25
+ /**
26
+ *
27
+ */
28
+ export class ProductsApi extends runtime.BaseAPI {
29
+ /**
30
+ * Lists all GFN products available to the project. Can be filtered by style codes using the search parameter.
31
+ * List GFN products
32
+ */
33
+ listProductsRaw(requestParameters, initOverrides) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ if (requestParameters.project === null || requestParameters.project === undefined) {
36
+ throw new runtime.RequiredError('project', 'Required parameter requestParameters.project was null or undefined when calling listProducts.');
37
+ }
38
+ const queryParameters = {};
39
+ if (requestParameters.project !== undefined) {
40
+ queryParameters['project'] = requestParameters.project;
41
+ }
42
+ if (requestParameters.pageToken !== undefined) {
43
+ queryParameters['pageToken'] = requestParameters.pageToken;
44
+ }
45
+ if (requestParameters.pageSize !== undefined) {
46
+ queryParameters['pageSize'] = requestParameters.pageSize;
47
+ }
48
+ if (requestParameters.fields !== undefined) {
49
+ queryParameters['fields'] = requestParameters.fields;
50
+ }
51
+ if (requestParameters.search !== undefined) {
52
+ queryParameters['search'] = requestParameters.search;
53
+ }
54
+ const headerParameters = {};
55
+ if (this.configuration && this.configuration.accessToken) {
56
+ // oauth required
57
+ headerParameters["Authorization"] = yield this.configuration.accessToken("session-oauth", []);
58
+ }
59
+ if (this.configuration && this.configuration.apiKey) {
60
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
61
+ }
62
+ const response = yield this.request({
63
+ path: `/v1/gfn/catalog/products`,
64
+ method: 'GET',
65
+ headers: headerParameters,
66
+ query: queryParameters,
67
+ }, initOverrides);
68
+ return new runtime.JSONApiResponse(response, (jsonValue) => ProductsResponseFromJSON(jsonValue));
69
+ });
70
+ }
71
+ /**
72
+ * Lists all GFN products available to the project. Can be filtered by style codes using the search parameter.
73
+ * List GFN products
74
+ */
75
+ listProducts(project, optionalParameters = {}, initOverrides) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const response = yield this.listProductsRaw(Object.assign({ project: project }, optionalParameters), initOverrides);
78
+ return yield response.value();
79
+ });
80
+ }
81
+ }