Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions src/lib/api/CommercetoolsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2127,6 +2127,42 @@ export class CommercetoolsApi {
})
}

/**
* Delete a product type by id
* https://docs.commercetools.com/api/projects/productTypes#delete-producttype-by-id
*/
deleteProductTypeById(options: CommonRequestOptions & { id: string; version: number }): Promise<ProductType> {
ensureNonEmptyString({ value: options.id, name: 'id' })

return this.request({
...this.extractCommonRequestOptions(options),
path: `/product-types/${encodeURIComponent(options.id)}`,
method: 'DELETE',
params: {
...options.params,
version: options.version,
},
})
}

/**
* Delete a product type by key
* https://docs.commercetools.com/api/projects/productTypes#delete-producttype-by-id
*/
deleteProductTypeByKey(options: CommonRequestOptions & { key: string; version: number }): Promise<ProductType> {
ensureNonEmptyString({ value: options.key, name: 'key' })

return this.request({
...this.extractCommonRequestOptions(options),
path: `/product-types/key=${encodeURIComponent(options.key)}`,
method: 'DELETE',
params: {
...options.params,
version: options.version,
},
})
}

/**
* Get a type by id:
* https://docs.commercetools.com/api/projects/types#get-type-by-id
Expand Down Expand Up @@ -2699,6 +2735,42 @@ export class CommercetoolsApi {
})
}

/**
* Delete a state by id
* https://docs.commercetools.com/api/projects/states#delete-state-by-id
*/
deleteStateById(options: CommonRequestOptions & { id: string; version: number }): Promise<State> {
ensureNonEmptyString({ value: options.id, name: 'id' })

return this.request({
...this.extractCommonRequestOptions(options),
path: `/states/${encodeURIComponent(options.id)}`,
method: 'DELETE',
params: {
...options.params,
version: options.version,
},
})
}

/**
* Delete a state by key
* https://docs.commercetools.com/api/projects/states#delete-state-by-key
*/
deleteStateByKey(options: CommonRequestOptions & { key: string; version: number }): Promise<State> {
ensureNonEmptyString({ value: options.key, name: 'key' })

return this.request({
...this.extractCommonRequestOptions(options),
path: `/states/key=${encodeURIComponent(options.key)}`,
method: 'DELETE',
params: {
...options.params,
version: options.version,
},
})
}

/**
* Get a standalone price given its id
* https://docs.commercetools.com/api/projects/standalone-prices#get-standaloneprice-by-id
Expand Down