@commercetools/importapi-sdk 4.4.1 → 4.6.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.
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var querystring = require('querystring');
6
-
7
5
  function _toPrimitive(input, hint) {
8
6
  if (typeof input !== "object" || input === null) return input;
9
7
  var prim = input[Symbol.toPrimitive];
@@ -40,6 +38,20 @@ function _defineProperty(obj, key, value) {
40
38
  * Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
41
39
  * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
42
40
  */
41
+
42
+ function urlStringifier(object) {
43
+ const params = new URLSearchParams(object);
44
+ for (const [key, value] of Object.entries(object)) {
45
+ if (Array.isArray(value)) {
46
+ params.delete(key);
47
+ value.filter(Boolean).forEach(v => params.append(key, v));
48
+ }
49
+ }
50
+ return params.toString();
51
+ }
52
+ function stringifyURLString(object, stringifier = urlStringifier) {
53
+ return urlStringifier(object);
54
+ }
43
55
  function isDefined(value) {
44
56
  return typeof value !== 'undefined' && value !== null;
45
57
  }
@@ -67,7 +79,7 @@ function cleanObject(obj) {
67
79
  }
68
80
  function formatQueryString(variableMap) {
69
81
  const map = cleanObject(variableMap);
70
- const result = querystring.stringify(map);
82
+ const result = stringifyURLString(map);
71
83
  if (result === '') {
72
84
  return '';
73
85
  }
@@ -1228,6 +1240,80 @@ class ByProjectKeyStandalonePricesRequestBuilder {
1228
1240
  }
1229
1241
  }
1230
1242
 
1243
+ /**
1244
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1245
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1246
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1247
+ */
1248
+ /**
1249
+ **/
1250
+ class ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder {
1251
+ constructor(args) {
1252
+ this.args = args;
1253
+ }
1254
+ /**
1255
+ * Creates a request for creating new Type or updating existing ones.
1256
+ */
1257
+ post(methodArgs) {
1258
+ return new ApiRequest({
1259
+ baseUri: this.args.baseUri,
1260
+ method: 'POST',
1261
+ uriTemplate: '/{projectKey}/types/import-containers/{importContainerKey}',
1262
+ pathVariables: this.args.pathArgs,
1263
+ headers: {
1264
+ 'Content-Type': 'application/json',
1265
+ ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
1266
+ },
1267
+ body: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.body
1268
+ }, this.args.executeRequest);
1269
+ }
1270
+ }
1271
+
1272
+ /**
1273
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1274
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1275
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1276
+ */
1277
+ /**
1278
+ **/
1279
+ class ByProjectKeyTypesImportContainersRequestBuilder {
1280
+ constructor(args) {
1281
+ this.args = args;
1282
+ }
1283
+ withImportContainerKeyValue(childPathArgs) {
1284
+ return new ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder({
1285
+ pathArgs: {
1286
+ ...this.args.pathArgs,
1287
+ ...childPathArgs
1288
+ },
1289
+ executeRequest: this.args.executeRequest,
1290
+ baseUri: this.args.baseUri
1291
+ });
1292
+ }
1293
+ }
1294
+
1295
+ /**
1296
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1297
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1298
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1299
+ */
1300
+ /**
1301
+ **/
1302
+ class ByProjectKeyTypesRequestBuilder {
1303
+ constructor(args) {
1304
+ this.args = args;
1305
+ }
1306
+ importContainers() {
1307
+ return new ByProjectKeyTypesImportContainersRequestBuilder({
1308
+ pathArgs: {
1309
+ ...this.args.pathArgs
1310
+ },
1311
+ executeRequest: this.args.executeRequest,
1312
+ baseUri: this.args.baseUri
1313
+ });
1314
+ }
1315
+ }
1316
+
1231
1317
  /**
1232
1318
  * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1233
1319
  * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
@@ -1365,6 +1451,15 @@ class ByProjectKeyRequestBuilder {
1365
1451
  baseUri: this.args.baseUri
1366
1452
  });
1367
1453
  }
1454
+ types() {
1455
+ return new ByProjectKeyTypesRequestBuilder({
1456
+ pathArgs: {
1457
+ ...this.args.pathArgs
1458
+ },
1459
+ executeRequest: this.args.executeRequest,
1460
+ baseUri: this.args.baseUri
1461
+ });
1462
+ }
1368
1463
  }
1369
1464
 
1370
1465
  class ApiRoot {
@@ -1,5 +1,3 @@
1
- import { stringify } from 'querystring';
2
-
3
1
  function _toPrimitive(input, hint) {
4
2
  if (typeof input !== "object" || input === null) return input;
5
3
  var prim = input[Symbol.toPrimitive];
@@ -36,6 +34,20 @@ function _defineProperty(obj, key, value) {
36
34
  * Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
37
35
  * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
38
36
  */
37
+
38
+ function urlStringifier(object) {
39
+ const params = new URLSearchParams(object);
40
+ for (const [key, value] of Object.entries(object)) {
41
+ if (Array.isArray(value)) {
42
+ params.delete(key);
43
+ value.filter(Boolean).forEach(v => params.append(key, v));
44
+ }
45
+ }
46
+ return params.toString();
47
+ }
48
+ function stringifyURLString(object, stringifier = urlStringifier) {
49
+ return urlStringifier(object);
50
+ }
39
51
  function isDefined(value) {
40
52
  return typeof value !== 'undefined' && value !== null;
41
53
  }
@@ -63,7 +75,7 @@ function cleanObject(obj) {
63
75
  }
64
76
  function formatQueryString(variableMap) {
65
77
  const map = cleanObject(variableMap);
66
- const result = stringify(map);
78
+ const result = stringifyURLString(map);
67
79
  if (result === '') {
68
80
  return '';
69
81
  }
@@ -1224,6 +1236,80 @@ class ByProjectKeyStandalonePricesRequestBuilder {
1224
1236
  }
1225
1237
  }
1226
1238
 
1239
+ /**
1240
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1241
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1242
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1243
+ */
1244
+ /**
1245
+ **/
1246
+ class ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder {
1247
+ constructor(args) {
1248
+ this.args = args;
1249
+ }
1250
+ /**
1251
+ * Creates a request for creating new Type or updating existing ones.
1252
+ */
1253
+ post(methodArgs) {
1254
+ return new ApiRequest({
1255
+ baseUri: this.args.baseUri,
1256
+ method: 'POST',
1257
+ uriTemplate: '/{projectKey}/types/import-containers/{importContainerKey}',
1258
+ pathVariables: this.args.pathArgs,
1259
+ headers: {
1260
+ 'Content-Type': 'application/json',
1261
+ ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
1262
+ },
1263
+ body: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.body
1264
+ }, this.args.executeRequest);
1265
+ }
1266
+ }
1267
+
1268
+ /**
1269
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1270
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1271
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1272
+ */
1273
+ /**
1274
+ **/
1275
+ class ByProjectKeyTypesImportContainersRequestBuilder {
1276
+ constructor(args) {
1277
+ this.args = args;
1278
+ }
1279
+ withImportContainerKeyValue(childPathArgs) {
1280
+ return new ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder({
1281
+ pathArgs: {
1282
+ ...this.args.pathArgs,
1283
+ ...childPathArgs
1284
+ },
1285
+ executeRequest: this.args.executeRequest,
1286
+ baseUri: this.args.baseUri
1287
+ });
1288
+ }
1289
+ }
1290
+
1291
+ /**
1292
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1293
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
1294
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
1295
+ */
1296
+ /**
1297
+ **/
1298
+ class ByProjectKeyTypesRequestBuilder {
1299
+ constructor(args) {
1300
+ this.args = args;
1301
+ }
1302
+ importContainers() {
1303
+ return new ByProjectKeyTypesImportContainersRequestBuilder({
1304
+ pathArgs: {
1305
+ ...this.args.pathArgs
1306
+ },
1307
+ executeRequest: this.args.executeRequest,
1308
+ baseUri: this.args.baseUri
1309
+ });
1310
+ }
1311
+ }
1312
+
1227
1313
  /**
1228
1314
  * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
1229
1315
  * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
@@ -1361,6 +1447,15 @@ class ByProjectKeyRequestBuilder {
1361
1447
  baseUri: this.args.baseUri
1362
1448
  });
1363
1449
  }
1450
+ types() {
1451
+ return new ByProjectKeyTypesRequestBuilder({
1452
+ pathArgs: {
1453
+ ...this.args.pathArgs
1454
+ },
1455
+ executeRequest: this.args.executeRequest,
1456
+ baseUri: this.args.baseUri
1457
+ });
1458
+ }
1364
1459
  }
1365
1460
 
1366
1461
  class ApiRoot {
@@ -18,6 +18,7 @@ import { ByProjectKeyProductVariantPatchesRequestBuilder } from './product-varia
18
18
  import { ByProjectKeyProductVariantsRequestBuilder } from './product-variants/by-project-key-product-variants-request-builder';
19
19
  import { ByProjectKeyProductsRequestBuilder } from './products/by-project-key-products-request-builder';
20
20
  import { ByProjectKeyStandalonePricesRequestBuilder } from './standalone-prices/by-project-key-standalone-prices-request-builder';
21
+ import { ByProjectKeyTypesRequestBuilder } from './types/by-project-key-types-request-builder';
21
22
  /**
22
23
  **/
23
24
  export declare class ByProjectKeyRequestBuilder {
@@ -49,4 +50,5 @@ export declare class ByProjectKeyRequestBuilder {
49
50
  orderPatches(): ByProjectKeyOrderPatchesRequestBuilder;
50
51
  customers(): ByProjectKeyCustomersRequestBuilder;
51
52
  inventories(): ByProjectKeyInventoriesRequestBuilder;
53
+ types(): ByProjectKeyTypesRequestBuilder;
52
54
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
3
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
4
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5
+ */
6
+ import { ImportResponse, TypeImportRequest } from '../../models/importrequests';
7
+ import { executeRequest } from '../../shared/utils/common-types';
8
+ import { ApiRequest } from '../../shared/utils/requests-utils';
9
+ /**
10
+ **/
11
+ export declare class ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder {
12
+ protected readonly args: {
13
+ pathArgs: {
14
+ projectKey: string;
15
+ importContainerKey: string;
16
+ };
17
+ executeRequest: executeRequest;
18
+ baseUri?: string;
19
+ };
20
+ constructor(args: {
21
+ pathArgs: {
22
+ projectKey: string;
23
+ importContainerKey: string;
24
+ };
25
+ executeRequest: executeRequest;
26
+ baseUri?: string;
27
+ });
28
+ /**
29
+ * Creates a request for creating new Type or updating existing ones.
30
+ */
31
+ post(methodArgs: {
32
+ body: TypeImportRequest;
33
+ headers?: {
34
+ [key: string]: string | string[];
35
+ };
36
+ }): ApiRequest<ImportResponse>;
37
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
3
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
4
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5
+ */
6
+ import { executeRequest } from '../../shared/utils/common-types';
7
+ import { ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder } from './by-project-key-types-import-containers-by-import-container-key-request-builder';
8
+ /**
9
+ **/
10
+ export declare class ByProjectKeyTypesImportContainersRequestBuilder {
11
+ protected readonly args: {
12
+ pathArgs: {
13
+ projectKey: string;
14
+ };
15
+ executeRequest: executeRequest;
16
+ baseUri?: string;
17
+ };
18
+ constructor(args: {
19
+ pathArgs: {
20
+ projectKey: string;
21
+ };
22
+ executeRequest: executeRequest;
23
+ baseUri?: string;
24
+ });
25
+ withImportContainerKeyValue(childPathArgs: {
26
+ importContainerKey: string;
27
+ }): ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder;
28
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
3
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
4
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5
+ */
6
+ import { executeRequest } from '../../shared/utils/common-types';
7
+ import { ByProjectKeyTypesImportContainersRequestBuilder } from '../import-containers/by-project-key-types-import-containers-request-builder';
8
+ /**
9
+ **/
10
+ export declare class ByProjectKeyTypesRequestBuilder {
11
+ protected readonly args: {
12
+ pathArgs: {
13
+ projectKey: string;
14
+ };
15
+ executeRequest: executeRequest;
16
+ baseUri?: string;
17
+ };
18
+ constructor(args: {
19
+ pathArgs: {
20
+ projectKey: string;
21
+ };
22
+ executeRequest: executeRequest;
23
+ baseUri?: string;
24
+ });
25
+ importContainers(): ByProjectKeyTypesImportContainersRequestBuilder;
26
+ }
@@ -22,5 +22,6 @@ export * from './models/products';
22
22
  export * from './models/producttypes';
23
23
  export * from './models/productvariants';
24
24
  export * from './models/standalone-prices';
25
+ export * from './models/types';
25
26
  export * from './shared/utils/common-types';
26
27
  export * from './shared/utils/middleware';
@@ -13,6 +13,7 @@ import { ProductImport } from './products';
13
13
  import { ProductTypeImport } from './producttypes';
14
14
  import { ProductVariantImport } from './productvariants';
15
15
  import { StandalonePriceImport } from './standalone-prices';
16
+ import { TypeImport } from './types';
16
17
  export interface Asset {
17
18
  /**
18
19
  * User-defined identifier for the asset.
@@ -172,7 +173,7 @@ export interface ImportResource {
172
173
  */
173
174
  readonly key: string;
174
175
  }
175
- export type _ImportResource = ImportResource | ProductVariantImport | PriceImport | CategoryImport | StandalonePriceImport | ProductImport | ProductDraftImport | ProductTypeImport | CustomerImport | InventoryImport;
176
+ export type _ImportResource = ImportResource | CategoryImport | CustomerImport | InventoryImport | PriceImport | ProductDraftImport | ProductImport | ProductTypeImport | ProductVariantImport | StandalonePriceImport | TypeImport;
176
177
  /**
177
178
  * References a resource by key.
178
179
  */
@@ -462,10 +463,10 @@ export interface PriceTier {
462
463
  readonly value: TypedMoney;
463
464
  }
464
465
  /**
465
- * The type of the import resource.
466
+ * The resource types that can be imported.
466
467
  *
467
468
  */
468
- export type ImportResourceType = 'category' | 'customer' | 'inventory' | 'order' | 'order-patch' | 'price' | 'product' | 'product-draft' | 'product-type' | 'product-variant' | 'product-variant-patch' | 'standalone-price' | string;
469
+ export type ImportResourceType = 'category' | 'customer' | 'inventory' | 'order' | 'order-patch' | 'price' | 'product' | 'product-draft' | 'product-type' | 'product-variant' | 'product-variant-patch' | 'standalone-price' | 'type' | string;
469
470
  /**
470
471
  * The type of the referenced resource.
471
472
  *
@@ -136,7 +136,7 @@ export interface CustomerImport extends ImportResource {
136
136
  */
137
137
  readonly email: string;
138
138
  /**
139
- * Maps to `Customer.password`.
139
+ * Required when `authenticationMode` is set to `Password`. Maps to `Customer.password`.
140
140
  *
141
141
  *
142
142
  */
@@ -15,11 +15,12 @@ import { ProductImport } from './products';
15
15
  import { ProductTypeImport } from './producttypes';
16
16
  import { ProductVariantImport, ProductVariantPatch } from './productvariants';
17
17
  import { StandalonePriceImport } from './standalone-prices';
18
+ import { TypeImport } from './types';
18
19
  /**
19
20
  * An import request batches multiple import resources of the same import resource type for processing by an import container.
20
21
  *
21
22
  */
22
- export type ImportRequest = CategoryImportRequest | CustomerImportRequest | InventoryImportRequest | OrderImportRequest | OrderPatchImportRequest | PriceImportRequest | ProductDraftImportRequest | ProductImportRequest | ProductTypeImportRequest | ProductVariantImportRequest | ProductVariantPatchRequest | StandalonePriceImportRequest;
23
+ export type ImportRequest = CategoryImportRequest | CustomerImportRequest | InventoryImportRequest | OrderImportRequest | OrderPatchImportRequest | PriceImportRequest | ProductDraftImportRequest | ProductImportRequest | ProductTypeImportRequest | ProductVariantImportRequest | ProductVariantPatchRequest | StandalonePriceImportRequest | TypeImportRequest;
23
24
  /**
24
25
  * A list of the ID's and validation statuses of newly created [ImportOperations](#importoperation).
25
26
  * Used as a response at each resource-specific import endpoint, for example, at [Import Categories](/category#import-categories) and [Import ProductTypes](/product-type#import-producttypes).
@@ -187,3 +188,16 @@ export interface InventoryImportRequest {
187
188
  */
188
189
  readonly resources: InventoryImport[];
189
190
  }
191
+ /**
192
+ * The request body to [import Types](#import-types). Contains data for [Types](/../api/projects/types#type) to be created or updated in a Project.
193
+ *
194
+ */
195
+ export interface TypeImportRequest {
196
+ readonly type: 'type';
197
+ /**
198
+ * The type import resources of this request.
199
+ *
200
+ *
201
+ */
202
+ readonly resources: TypeImport[];
203
+ }
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
3
+ * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
4
+ * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5
+ */
6
+ import { ImportResource, LocalizedString } from './common';
7
+ /**
8
+ * Provides a visual representation type for this field. It is only relevant for string-based field types like [CustomFieldStringType](ctp:import:type:CustomFieldStringType) and [CustomFieldLocalizedStringType](ctp:import:type:CustomFieldLocalizedStringType).
9
+ *
10
+ */
11
+ export type TypeTextInputHint = 'MultiLine' | 'SingleLine' | string;
12
+ /**
13
+ * IDs indicating the [customizable resources and data types](/../api/projects/types#list-of-customizable-data-types). Maps to `Type.resourceTypeId`.
14
+ *
15
+ */
16
+ export type ResourceTypeId = 'address' | 'asset' | 'business-unit' | 'cart-discount' | 'category' | 'channel' | 'custom-line-item' | 'customer' | 'customer-group' | 'discount-code' | 'inventory-entry' | 'line-item' | 'order' | 'order-delivery' | 'order-edit' | 'order-parcel' | 'order-return-item' | 'payment' | 'payment-interface-interaction' | 'product-price' | 'product-selection' | 'quote' | 'review' | 'shipping' | 'shipping-method' | 'shopping-list' | 'shopping-list-text-line-item' | 'standalone-price' | 'store' | 'transaction' | string;
17
+ export type FieldType = CustomFieldBooleanType | CustomFieldDateTimeType | CustomFieldDateType | CustomFieldEnumType | CustomFieldLocalizedEnumType | CustomFieldLocalizedStringType | CustomFieldMoneyType | CustomFieldNumberType | CustomFieldReferenceType | CustomFieldSetType | CustomFieldStringType | CustomFieldTimeType;
18
+ /**
19
+ * Field type for Boolean values.
20
+ */
21
+ export interface CustomFieldBooleanType {
22
+ readonly name: 'Boolean';
23
+ }
24
+ /**
25
+ * Field type for [DateTime](ctp:import:type:DateTime) values.
26
+ */
27
+ export interface CustomFieldDateTimeType {
28
+ readonly name: 'DateTime';
29
+ }
30
+ /**
31
+ * Field type for [Date](ctp:import:type:Date) values.
32
+ */
33
+ export interface CustomFieldDateType {
34
+ readonly name: 'Date';
35
+ }
36
+ /**
37
+ * Field type for enum values.
38
+ */
39
+ export interface CustomFieldEnumType {
40
+ readonly name: 'Enum';
41
+ /**
42
+ * Allowed values.
43
+ *
44
+ */
45
+ readonly values: CustomFieldEnumValue[];
46
+ }
47
+ /**
48
+ * Defines an allowed value of a [CustomFieldEnumType](ctp:import:type:CustomFieldEnumType) field.
49
+ */
50
+ export interface CustomFieldEnumValue {
51
+ /**
52
+ * Key of the value used as a programmatic identifier.
53
+ *
54
+ */
55
+ readonly key: string;
56
+ /**
57
+ * Descriptive label of the value.
58
+ *
59
+ */
60
+ readonly label: string;
61
+ }
62
+ /**
63
+ * Field type for localized enum values.
64
+ */
65
+ export interface CustomFieldLocalizedEnumType {
66
+ readonly name: 'LocalizedEnum';
67
+ /**
68
+ * Allowed values.
69
+ *
70
+ */
71
+ readonly values: CustomFieldLocalizedEnumValue[];
72
+ }
73
+ /**
74
+ * Defines an allowed value of a [CustomFieldLocalizedEnumType](ctp:import:type:CustomFieldLocalizedEnumType) field.
75
+ */
76
+ export interface CustomFieldLocalizedEnumValue {
77
+ /**
78
+ * Key of the value used as a programmatic identifier.
79
+ *
80
+ */
81
+ readonly key: string;
82
+ /**
83
+ * Descriptive localized label of the value.
84
+ *
85
+ */
86
+ readonly label: LocalizedString;
87
+ }
88
+ /**
89
+ * Field type for [LocalizedString](ctp:import:type:LocalizedString) values.
90
+ */
91
+ export interface CustomFieldLocalizedStringType {
92
+ readonly name: 'LocalizedString';
93
+ }
94
+ /**
95
+ * Field type for [CentPrecisionMoney](ctp:import:type:CentPrecisionMoney) values.
96
+ */
97
+ export interface CustomFieldMoneyType {
98
+ readonly name: 'Money';
99
+ }
100
+ /**
101
+ * Field type for number values.
102
+ */
103
+ export interface CustomFieldNumberType {
104
+ readonly name: 'Number';
105
+ }
106
+ /**
107
+ * Field type for [Reference](ctp:import:type:Reference) values.
108
+ */
109
+ export interface CustomFieldReferenceType {
110
+ readonly name: 'Reference';
111
+ /**
112
+ * Resource type the Custom Field can reference.
113
+ *
114
+ */
115
+ readonly referenceTypeId: CustomFieldReferenceValue;
116
+ }
117
+ /**
118
+ * Defines which resource type a [CustomFieldReferenceType](ctp:import:type:CustomFieldReferenceType) can reference.
119
+ */
120
+ export type CustomFieldReferenceValue = 'cart' | 'category' | 'channel' | 'customer' | 'key-value-document' | 'order' | 'product' | 'product-type' | 'review' | 'shipping-method' | 'state' | 'zone' | string;
121
+ /**
122
+ * Values of a SetType Custom Field are sets of values of the specified `elementType` (without duplicate elements).
123
+ */
124
+ export interface CustomFieldSetType {
125
+ readonly name: 'Set';
126
+ /**
127
+ * Field type of the elements in the set.
128
+ *
129
+ */
130
+ readonly elementType: FieldType;
131
+ }
132
+ /**
133
+ * Field type for string values.
134
+ */
135
+ export interface CustomFieldStringType {
136
+ readonly name: 'String';
137
+ }
138
+ /**
139
+ * Field type for [Time](ctp:import:type:Time) values.
140
+ */
141
+ export interface CustomFieldTimeType {
142
+ readonly name: 'Time';
143
+ }
144
+ /**
145
+ * Defines a [Custom Field](/../api/projects/custom-fields) and its meta-information. Maps to `Type.FieldDefinition`.
146
+ *
147
+ */
148
+ export interface FieldDefinition {
149
+ /**
150
+ * Data type of the Custom Field to define.
151
+ *
152
+ */
153
+ readonly type: FieldType;
154
+ /**
155
+ * Name of the Custom Field to define. Must be unique for a given [ResourceTypeId](ctp:import:type:ResourceTypeId). In case there is a FieldDefinition with the same `name` in another Type, both FieldDefinitions must have the same `type`. This value cannot be changed after the Type is imported.
156
+ *
157
+ *
158
+ */
159
+ readonly name: string;
160
+ /**
161
+ * A human-readable label for the field.
162
+ *
163
+ */
164
+ readonly label: LocalizedString;
165
+ /**
166
+ * Defines whether the field is required to have a value. This value cannot be changed after the Type is imported.
167
+ *
168
+ */
169
+ readonly required: boolean;
170
+ /**
171
+ * Provides a visual representation type for this field. It is only relevant for string-based field types like [CustomFieldStringType](ctp:import:type:CustomFieldStringType) and [CustomFieldLocalizedStringType](ctp:import:type:CustomFieldLocalizedStringType).
172
+ *
173
+ *
174
+ */
175
+ readonly inputHint?: TypeTextInputHint;
176
+ }
177
+ /**
178
+ * The data representation for a Type to be imported that is persisted as a [Type](/../api/projects/types#type) in the Project.
179
+ *
180
+ */
181
+ export interface TypeImport extends ImportResource {
182
+ /**
183
+ * User-defined unique identifier for the Type.
184
+ *
185
+ *
186
+ */
187
+ readonly key: string;
188
+ /**
189
+ * Maps to `Type.name`.
190
+ *
191
+ *
192
+ */
193
+ readonly name: LocalizedString;
194
+ /**
195
+ * Maps to `Type.description`.
196
+ *
197
+ *
198
+ */
199
+ readonly description?: LocalizedString;
200
+ /**
201
+ * Maps to `Type.resourceTypeIds`. This value cannot be changed after the Type is imported.
202
+ *
203
+ *
204
+ */
205
+ readonly resourceTypeIds: ResourceTypeId[];
206
+ /**
207
+ * Maps to `Type.fieldDefinitions`.
208
+ *
209
+ *
210
+ */
211
+ readonly fieldDefinitions?: FieldDefinition[];
212
+ }
@@ -4,4 +4,5 @@
4
4
  * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5
5
  */
6
6
  import { ClientRequest } from './common-types';
7
+ export declare function stringifyURLString(object: string | Record<string, any> | Array<Array<string>>, stringifier?: (object: string | Record<string, any> | Array<Array<string>> | URLSearchParams) => string): string;
7
8
  export declare function buildRelativeUri(commonRequest: ClientRequest): string;