-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ts
396 lines (394 loc) · 13.8 KB
/
project.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/**
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
*/
import { AssociateRoleKeyReference, AssociateRoleResourceIdentifier } from './associate-role.js'
import { LastModifiedBy } from './common.js'
import { MessagesConfiguration, MessagesConfigurationDraft } from './message.js'
import { CustomFieldLocalizedEnumValue } from './type.js'
export interface BusinessUnitConfiguration {
/**
* Status of Business Units created using the [My Business Unit endpoint](ctp:api:endpoint:/{projectKey}/me/business-units:POST).
*
*/
readonly myBusinessUnitStatusOnCreation: BusinessUnitConfigurationStatus
/**
* Default [Associate Role](ctp:api:type:AssociateRole) assigned to the Associate creating a Business Unit using the [My Business Unit endpoint](ctp:api:endpoint:/{projectKey}/me/business-units:POST).
*
*
*/
readonly myBusinessUnitAssociateRoleOnCreation?: AssociateRoleKeyReference
}
/**
* Default value for [Business Unit Status](ctp:api:type:BusinessUnitStatus) configured though [Project settings](/../api/projects/project#change-my-business-unit-status-on-creation).
*/
export type BusinessUnitConfigurationStatus = 'Active' | 'Inactive' | string
export interface CartsConfiguration {
/**
* Default value for the `deleteDaysAfterLastModification` parameter of the [CartDraft](ctp:api:type:CartDraft) and [MyCartDraft](ctp:api:type:MyCartDraft).
* If a [ChangeSubscription](ctp:api:type:ChangeSubscription) for Carts exists, a [ResourceDeletedDeliveryPayload](ctp:api:type:ResourceDeletedDeliveryPayload) is sent upon deletion of a Cart.
*
* This field may not be present on Projects created before January 2020.
*
*
*/
readonly deleteDaysAfterLastModification?: number
/**
* Indicates if country _- no state_ Tax Rate fallback should be used when a shipping address state is not explicitly covered in the rates lists of all Tax Categories of a Cart Line Items. This field may not be present on Projects created before June 2020.
*
*
*/
readonly countryTaxRateFallbackEnabled?: boolean
}
/**
* Represents a RFC 7662 compliant [OAuth 2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662) endpoint. For more information, see [Requesting an access token using an external OAuth 2.0 server](/../api/authorization#requesting-an-access-token-using-an-external-oauth-server).
*
* You can only configure **one** external OAuth 2.0 endpoint per Project. To authenticate using multiple external services (such as social network logins), use a middle layer authentication service.
*
*/
export interface ExternalOAuth {
/**
* URL with authorization header.
*
*
*/
readonly url: string
/**
* Must not contain any leading or trailing whitespaces. Partially hidden on retrieval.
*
*/
readonly authorizationHeader: string
}
/**
* Specifies the status of the [Order Search](/../api/projects/order-search) index.
*/
export type OrderSearchStatus = 'Activated' | 'Deactivated' | string
export interface Project {
/**
* Current version of the Project.
*
*
*/
readonly version: number
/**
* User-defined unique identifier of the Project.
*
*
*/
readonly key: string
/**
* Name of the Project.
*
*
*/
readonly name: string
/**
* Country code of the geographic location.
*
*
*/
readonly countries: string[]
/**
* Currency code of the country. A Project must have at least one currency.
*
*
*/
readonly currencies: string[]
/**
* Language of the country. A Project must have at least one language.
*
*
*/
readonly languages: string[]
/**
* Date and time (UTC) the Project was initially created.
*
*
*/
readonly createdAt: string
/**
* Date in YYYY-MM format specifying when the trial period for the Project ends. Only present on Projects in trial period.
*
*
*/
readonly trialUntil?: string
/**
* Holds the configuration for the [Messages Query](/../api/projects/messages) feature.
*
*
*/
readonly messages: MessagesConfiguration
/**
* Holds the configuration for the [Carts](/../api/projects/carts) feature.
*
*
*/
readonly carts: CartsConfiguration
/**
* Holds the configuration for the [Shopping Lists](/../api/projects/shoppingLists) feature. This field may not be present on Projects created before January 2020.
*
*
*/
readonly shoppingLists?: ShoppingListsConfiguration
/**
* Holds the configuration for the [tiered shipping rates](ctp:api:type:ShippingRatePriceTier) feature.
*
*
*/
readonly shippingRateInputType?: ShippingRateInputType
/**
* Represents a RFC 7662 compliant [OAuth 2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662) endpoint.
*
*
*/
readonly externalOAuth?: ExternalOAuth
/**
* Controls indexing of resources to be provided on high performance read-only search endpoints.
*
*
*/
readonly searchIndexing?: SearchIndexingConfiguration
/**
* Holds configuration specific to [Business Units](ctp:api:type:BusinessUnit).
*
*
*/
readonly businessUnits?: BusinessUnitConfiguration
}
export interface ProjectUpdate {
/**
* Expected version of the Project on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned.
*
*
*/
readonly version: number
/**
* Update actions to be performed on the Project.
*
*
*/
readonly actions: ProjectUpdateAction[]
}
export type ProjectUpdateAction =
| ProjectChangeBusinessUnitStatusOnCreationAction
| ProjectChangeCartsConfigurationAction
| ProjectChangeCountriesAction
| ProjectChangeCountryTaxRateFallbackEnabledAction
| ProjectChangeCurrenciesAction
| ProjectChangeLanguagesAction
| ProjectChangeMessagesConfigurationAction
| ProjectChangeNameAction
| ProjectChangeOrderSearchStatusAction
| ProjectChangeProductSearchIndexingEnabledAction
| ProjectChangeShoppingListsConfigurationAction
| ProjectSetBusinessUnitAssociateRoleOnCreationAction
| ProjectSetExternalOAuthAction
| ProjectSetShippingRateInputTypeAction
/**
* Controls indexing of resources to be provided on high performance read-only search endpoints.
*
*/
export interface SearchIndexingConfiguration {
/**
* Configuration for the [Product Projection Search](/../api/projects/products-search) and [Product Suggestions](/../api/projects/products-suggestions) endpoints.
*
*/
readonly products?: SearchIndexingConfigurationValues
/**
* Configuration for the [Order Search](/../api/projects/order-search) feature.
*
*/
readonly orders?: SearchIndexingConfigurationValues
}
/**
* Status of resource indexing.
*/
export type SearchIndexingConfigurationStatus = 'Activated' | 'Deactivated' | 'Indexing' | string
export interface SearchIndexingConfigurationValues {
/**
* Current status of resource indexing. Present on Projects from 1 February 2019.
*
*/
readonly status?: SearchIndexingConfigurationStatus
/**
* Date and time (UTC) the Project was last updated. Only present on Projects last modified after 1 February 2019.
*
*
*/
readonly lastModifiedAt?: string
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).
*
*
*/
readonly lastModifiedBy?: LastModifiedBy
}
export type ShippingRateInputType = CartClassificationType | CartScoreType | CartValueType
/**
* Used when the ShippingRate maps to an abstract Cart categorization expressed by strings (for example, `Light`, `Medium`, or `Heavy`).
* Only keys defined in the `values` array can be used to create a tier or to set a value of the `shippingRateInput` on the [Cart](ctp:api:type:Cart).
* Keys must be unique.
*
*/
export interface CartClassificationType {
readonly type: 'CartClassification'
/**
* The classification items that can be used for specifying any [ShippingRatePriceTier](ctp:api:type:ShippingRatePriceTier).
*
*/
readonly values: CustomFieldLocalizedEnumValue[]
}
/**
* Used when the ShippingRate maps to an abstract Cart categorization expressed by integers (such as shipping scores or weight ranges).
*
*/
export interface CartScoreType {
readonly type: 'CartScore'
}
/**
* Used when the ShippingRate maps to the sum of [LineItem](ctp:api:type:LineItem) Prices.
* The value of the Cart is used to select a tier.
* If chosen, it is not possible to set a value for the `shippingRateInput` on the [Cart](ctp:api:type:Cart).
*
*/
export interface CartValueType {
readonly type: 'CartValue'
}
export interface ShoppingListsConfiguration {
/**
* Default value for the `deleteDaysAfterLastModification` parameter of the [ShoppingListDraft](ctp:api:type:ShoppingListDraft).
* This field may not be present on Projects created before January 2020.
*
*
*/
readonly deleteDaysAfterLastModification?: number
}
export interface ProjectChangeBusinessUnitStatusOnCreationAction {
readonly action: 'changeMyBusinessUnitStatusOnCreation'
/**
* Status for Business Units created using the [My Business Unit endpoint](ctp:api:endpoint:/{projectKey}/me/business-units:POST).
*
*
*/
readonly status: BusinessUnitConfigurationStatus
}
export interface ProjectChangeCartsConfigurationAction {
readonly action: 'changeCartsConfiguration'
/**
* Configuration for the [Carts](/../api/projects/carts) feature.
*
*
*/
readonly cartsConfiguration: CartsConfiguration
}
export interface ProjectChangeCountriesAction {
readonly action: 'changeCountries'
/**
* New value to set. Must not be empty.
*
*
*/
readonly countries: string[]
}
export interface ProjectChangeCountryTaxRateFallbackEnabledAction {
readonly action: 'changeCountryTaxRateFallbackEnabled'
/**
* When `true`, country _- no state_ Tax Rate is used as fallback. See [CartsConfiguration](ctp:api:type:CartsConfiguration).
*
*/
readonly countryTaxRateFallbackEnabled: boolean
}
export interface ProjectChangeCurrenciesAction {
readonly action: 'changeCurrencies'
/**
* New value to set. Must not be empty.
*
*
*/
readonly currencies: string[]
}
/**
* Removing a language used by a [Store](ctp:api:type:Store) returns a [LanguageUsedInStores](ctp:api:type:LanguageUsedInStoresError) error.
*
*/
export interface ProjectChangeLanguagesAction {
readonly action: 'changeLanguages'
/**
* New value to set. Must not be empty.
*
*
*/
readonly languages: string[]
}
export interface ProjectChangeMessagesConfigurationAction {
readonly action: 'changeMessagesConfiguration'
/**
* Configuration for the [Messages Query](/../api/projects/messages) feature.
*
*/
readonly messagesConfiguration: MessagesConfigurationDraft
}
export interface ProjectChangeNameAction {
readonly action: 'changeName'
/**
* New value to set. Must not be empty.
*
*
*/
readonly name: string
}
export interface ProjectChangeOrderSearchStatusAction {
readonly action: 'changeOrderSearchStatus'
/**
* Activates or deactivates the [Order Search](/../api/projects/order-search) feature. Activation will trigger building a search index for the Orders in the Project.
*
*/
readonly status: OrderSearchStatus
}
export interface ProjectChangeProductSearchIndexingEnabledAction {
readonly action: 'changeProductSearchIndexingEnabled'
/**
* - If `false`, the indexing of [Product](ctp:api:type:Product) information will stop and the [Product Projection Search](/../api/projects/products-search) as well as the [Product Suggestions](/../api/projects/products-suggestions) endpoint will not be available anymore for this Project. The Project's [SearchIndexingConfiguration](ctp:api:type:SearchIndexingConfiguration) `status` for `products` will be changed to `"Deactivated"`.
* - If `true`, the indexing of [Product](ctp:api:type:Product) information will start and the [Product Projection Search](/../api/projects/products-search) as well as the [Product Suggestions](/../api/projects/products-suggestions) endpoint will become available soon after for this Project. Proportional to the amount of information being indexed, the Project's [SearchIndexingConfiguration](ctp:api:type:SearchIndexingConfiguration) `status` for `products` will be shown as `"Indexing"` during this time. As soon as the indexing has finished, the configuration status will be changed to `"Activated"` making the aforementioned endpoints fully available for this Project.
*
*
*/
readonly enabled: boolean
}
export interface ProjectChangeShoppingListsConfigurationAction {
readonly action: 'changeShoppingListsConfiguration'
/**
* Configuration for the [Shopping Lists](/../api/projects/shoppingLists) feature.
*
*
*/
readonly shoppingListsConfiguration: ShoppingListsConfiguration
}
export interface ProjectSetBusinessUnitAssociateRoleOnCreationAction {
readonly action: 'setMyBusinessUnitAssociateRoleOnCreation'
/**
* Default [Associate Role](ctp:api:type:AssociateRole) assigned to the Associate creating a Business Unit using the [My Business Unit endpoint](ctp:api:endpoint:/{projectKey}/me/business-units:POST).
*
*
*/
readonly associateRole: AssociateRoleResourceIdentifier
}
export interface ProjectSetExternalOAuthAction {
readonly action: 'setExternalOAuth'
/**
* Value to set. If empty, any existing value will be removed.
*
*
*/
readonly externalOAuth?: ExternalOAuth
}
export interface ProjectSetShippingRateInputTypeAction {
readonly action: 'setShippingRateInputType'
/**
* Value to set. If empty, any existing value will be removed.
*
*
*/
readonly shippingRateInputType?: ShippingRateInputType
}