UNPKG

@datocms/cma-client

Version:
392 lines (391 loc) 15.3 kB
import * as Utils from '@datocms/rest-client-utils'; import BaseResource from '../../BaseResource'; import type * as SchemaTypes from '../SchemaTypes'; import type * as SimpleSchemaTypes from '../SimpleSchemaTypes'; export default class Item extends BaseResource { static readonly TYPE: "item"; /** * List all records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/instances * * @throws {ApiError} * @throws {TimeoutError} */ list(queryParams?: SimpleSchemaTypes.ItemInstancesHrefSchema): Promise<SimpleSchemaTypes.ItemInstancesTargetSchema>; /** * List all records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/instances * * @throws {ApiError} * @throws {TimeoutError} */ rawList(queryParams?: SchemaTypes.ItemInstancesHrefSchema): Promise<SchemaTypes.ItemInstancesTargetSchema>; /** * Async iterator to auto-paginate over elements returned by list() * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/instances * * @throws {ApiError} * @throws {TimeoutError} */ listPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SimpleSchemaTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SimpleSchemaTypes.Item, void, unknown>; /** * Async iterator to auto-paginate over elements returned by rawList() * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/instances * * @throws {ApiError} * @throws {TimeoutError} */ rawListPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SchemaTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SchemaTypes.Item, void, unknown>; /** * Validates an existing record field * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/validate_existing * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ validateExisting(itemId: string | SimpleSchemaTypes.ItemData, body: SimpleSchemaTypes.ItemValidateExistingSchema): Promise<void>; /** * Validates an existing record field * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/validate_existing * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawValidateExisting(itemId: string, body: SchemaTypes.ItemValidateExistingSchema): Promise<void>; /** * Validates a record field * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/validate_new * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ validateNew(body: SimpleSchemaTypes.ItemValidateNewSchema): Promise<void>; /** * Validates a record field * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/validate_new * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawValidateNew(body: SchemaTypes.ItemValidateNewSchema): Promise<void>; /** * Create a new record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/create * * @throws {ApiError} * @throws {TimeoutError} */ create(body: SimpleSchemaTypes.ItemCreateSchema): Promise<SimpleSchemaTypes.Item>; /** * Create a new record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/create * * @throws {ApiError} * @throws {TimeoutError} */ rawCreate(body: SchemaTypes.ItemCreateSchema): Promise<SchemaTypes.ItemCreateTargetSchema>; /** * Duplicate a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/duplicate * * @throws {ApiError} * @throws {TimeoutError} */ duplicate(itemId: string | SimpleSchemaTypes.ItemData): Promise<SimpleSchemaTypes.Item>; /** * Duplicate a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/duplicate * * @throws {ApiError} * @throws {TimeoutError} */ rawDuplicate(itemId: string): Promise<SchemaTypes.ItemDuplicateJobSchema>; /** * Update a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/update * * @throws {ApiError} * @throws {TimeoutError} */ update(itemId: string | SimpleSchemaTypes.ItemData, body: SimpleSchemaTypes.ItemUpdateSchema): Promise<SimpleSchemaTypes.Item>; /** * Update a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/update * * @throws {ApiError} * @throws {TimeoutError} */ rawUpdate(itemId: string, body: SchemaTypes.ItemUpdateSchema): Promise<SchemaTypes.ItemUpdateTargetSchema>; /** * Referenced records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/references * * @throws {ApiError} * @throws {TimeoutError} */ references(itemId: string | SimpleSchemaTypes.ItemData, queryParams?: SimpleSchemaTypes.ItemReferencesHrefSchema): Promise<SimpleSchemaTypes.ItemReferencesTargetSchema>; /** * Referenced records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/references * * @throws {ApiError} * @throws {TimeoutError} */ rawReferences(itemId: string, queryParams?: SchemaTypes.ItemReferencesHrefSchema): Promise<SchemaTypes.ItemReferencesTargetSchema>; /** * Retrieve a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/self * * @throws {ApiError} * @throws {TimeoutError} */ find(itemId: string | SimpleSchemaTypes.ItemData, queryParams?: SimpleSchemaTypes.ItemSelfHrefSchema): Promise<SimpleSchemaTypes.Item>; /** * Retrieve a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/self * * @throws {ApiError} * @throws {TimeoutError} */ rawFind(itemId: string, queryParams?: SchemaTypes.ItemSelfHrefSchema): Promise<SchemaTypes.ItemSelfTargetSchema>; /** * Retrieve information regarding changes between current and published versions of the record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/current_vs_published_state * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ currentVsPublishedState(itemId: string | SimpleSchemaTypes.ItemData): Promise<SimpleSchemaTypes.ItemCurrentVsPublishedState>; /** * Retrieve information regarding changes between current and published versions of the record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/current_vs_published_state * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawCurrentVsPublishedState(itemId: string): Promise<SchemaTypes.ItemCurrentVsPublishedStateTargetSchema>; /** * Delete a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/destroy * * @throws {ApiError} * @throws {TimeoutError} */ destroy(itemId: string | SimpleSchemaTypes.ItemData): Promise<SimpleSchemaTypes.Item>; /** * Delete a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/destroy * * @throws {ApiError} * @throws {TimeoutError} */ rawDestroy(itemId: string): Promise<SchemaTypes.ItemDestroyJobSchema>; /** * Delete multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_destroy * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ batchDestroy(queryParams: SimpleSchemaTypes.ItemBatchDestroyHrefSchema): Promise<SimpleSchemaTypes.ItemBatchDestroyJobSchema>; /** * Delete multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_destroy * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawBatchDestroy(queryParams: SchemaTypes.ItemBatchDestroyHrefSchema): Promise<SchemaTypes.ItemBatchDestroyJobSchema>; /** * Publish multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_publish * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ batchPublish(queryParams: SimpleSchemaTypes.ItemBatchPublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchPublishJobSchema>; /** * Publish multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_publish * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawBatchPublish(queryParams: SchemaTypes.ItemBatchPublishHrefSchema): Promise<SchemaTypes.ItemBatchPublishJobSchema>; /** * Unpublish multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_unpublish * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ batchUnpublish(queryParams: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchUnpublishJobSchema>; /** * Unpublish multiple records * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/batch_unpublish * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawBatchUnpublish(queryParams: SchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SchemaTypes.ItemBatchUnpublishJobSchema>; /** * Publish a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/publish * * @throws {ApiError} * @throws {TimeoutError} */ publish(itemId: string | SimpleSchemaTypes.ItemData, body?: SimpleSchemaTypes.ItemPublishSchema, queryParams?: SimpleSchemaTypes.ItemPublishHrefSchema): Promise<SimpleSchemaTypes.Item>; /** * Publish a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/publish * * @throws {ApiError} * @throws {TimeoutError} */ rawPublish(itemId: string, body?: SchemaTypes.ItemPublishSchema, queryParams?: SchemaTypes.ItemPublishHrefSchema): Promise<SchemaTypes.ItemPublishTargetSchema>; /** * Unpublish a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/unpublish * * @throws {ApiError} * @throws {TimeoutError} */ unpublish(itemId: string | SimpleSchemaTypes.ItemData, body?: SimpleSchemaTypes.ItemUnpublishSchema, queryParams?: SimpleSchemaTypes.ItemUnpublishHrefSchema): Promise<SimpleSchemaTypes.Item>; /** * Unpublish a record * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/unpublish * * @throws {ApiError} * @throws {TimeoutError} */ rawUnpublish(itemId: string, body?: SchemaTypes.ItemUnpublishSchema, queryParams?: SchemaTypes.ItemUnpublishHrefSchema): Promise<SchemaTypes.ItemUnpublishTargetSchema>; /** * Publish items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_publish * * @throws {ApiError} * @throws {TimeoutError} */ bulkPublish(body: SimpleSchemaTypes.ItemBulkPublishSchema): Promise<SimpleSchemaTypes.ItemBulkPublishJobSchema>; /** * Publish items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_publish * * @throws {ApiError} * @throws {TimeoutError} */ rawBulkPublish(body: SchemaTypes.ItemBulkPublishSchema): Promise<SchemaTypes.ItemBulkPublishJobSchema>; /** * Unpublish items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_unpublish * * @throws {ApiError} * @throws {TimeoutError} */ bulkUnpublish(body: SimpleSchemaTypes.ItemBulkUnpublishSchema): Promise<SimpleSchemaTypes.ItemBulkUnpublishJobSchema>; /** * Unpublish items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_unpublish * * @throws {ApiError} * @throws {TimeoutError} */ rawBulkUnpublish(body: SchemaTypes.ItemBulkUnpublishSchema): Promise<SchemaTypes.ItemBulkUnpublishJobSchema>; /** * Destroy items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_destroy * * @throws {ApiError} * @throws {TimeoutError} */ bulkDestroy(body: SimpleSchemaTypes.ItemBulkDestroySchema): Promise<SimpleSchemaTypes.ItemBulkDestroyJobSchema>; /** * Destroy items in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_destroy * * @throws {ApiError} * @throws {TimeoutError} */ rawBulkDestroy(body: SchemaTypes.ItemBulkDestroySchema): Promise<SchemaTypes.ItemBulkDestroyJobSchema>; /** * Move items to stage in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_move_to_stage * * @throws {ApiError} * @throws {TimeoutError} */ bulkMoveToStage(body: SimpleSchemaTypes.ItemBulkMoveToStageSchema): Promise<SimpleSchemaTypes.ItemBulkMoveToStageJobSchema>; /** * Move items to stage in bulk * * Read more: https://www.datocms.com/docs/content-management-api/resources/item/bulk_move_to_stage * * @throws {ApiError} * @throws {TimeoutError} */ rawBulkMoveToStage(body: SchemaTypes.ItemBulkMoveToStageSchema): Promise<SchemaTypes.ItemBulkMoveToStageJobSchema>; }