UNPKG

@datocms/cma-client

Version:
159 lines (158 loc) 5.57 kB
import BaseResource from '../../BaseResource'; import type * as SchemaTypes from '../SchemaTypes'; import type * as SimpleSchemaTypes from '../SimpleSchemaTypes'; export default class Field extends BaseResource { static readonly TYPE: "field"; /** * Create a new field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/create * * @throws {ApiError} * @throws {TimeoutError} */ create(itemTypeId: string | SimpleSchemaTypes.ItemTypeData, body: SimpleSchemaTypes.FieldCreateSchema): Promise<SimpleSchemaTypes.Field>; /** * Create a new field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/create * * @throws {ApiError} * @throws {TimeoutError} */ rawCreate(itemTypeId: string, body: SchemaTypes.FieldCreateSchema): Promise<SchemaTypes.FieldCreateJobSchema>; /** * Update a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/update * * @throws {ApiError} * @throws {TimeoutError} */ update(fieldId: string | SimpleSchemaTypes.FieldData, body: SimpleSchemaTypes.FieldUpdateSchema): Promise<SimpleSchemaTypes.Field>; /** * Update a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/update * * @throws {ApiError} * @throws {TimeoutError} */ rawUpdate(fieldId: string, body: SchemaTypes.FieldUpdateSchema): Promise<SchemaTypes.FieldUpdateJobSchema>; /** * List all fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/instances * * @throws {ApiError} * @throws {TimeoutError} */ list(itemTypeId: string | SimpleSchemaTypes.ItemTypeData): Promise<SimpleSchemaTypes.FieldInstancesTargetSchema>; /** * List all fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/instances * * @throws {ApiError} * @throws {TimeoutError} */ rawList(itemTypeId: string): Promise<SchemaTypes.FieldInstancesTargetSchema>; /** * List referenced fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/referencing * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ referencing(itemTypeId: string | SimpleSchemaTypes.ItemTypeData): Promise<SimpleSchemaTypes.FieldReferencingTargetSchema>; /** * List referenced fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/referencing * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawReferencing(itemTypeId: string): Promise<SchemaTypes.FieldReferencingTargetSchema>; /** * List related fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/related * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ related(itemTypeId: string | SimpleSchemaTypes.ItemTypeData): Promise<SimpleSchemaTypes.FieldRelatedTargetSchema>; /** * List related fields * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/related * * @throws {ApiError} * @throws {TimeoutError} * * @deprecated This API call is to be considered private and might change without notice */ rawRelated(itemTypeId: string): Promise<SchemaTypes.FieldRelatedTargetSchema>; /** * Retrieve a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/self * * @throws {ApiError} * @throws {TimeoutError} */ find(fieldId: string | SimpleSchemaTypes.FieldData): Promise<SimpleSchemaTypes.Field>; /** * Retrieve a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/self * * @throws {ApiError} * @throws {TimeoutError} */ rawFind(fieldId: string): Promise<SchemaTypes.FieldSelfTargetSchema>; /** * Delete a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/destroy * * @throws {ApiError} * @throws {TimeoutError} */ destroy(fieldId: string | SimpleSchemaTypes.FieldData): Promise<SimpleSchemaTypes.Field>; /** * Delete a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/destroy * * @throws {ApiError} * @throws {TimeoutError} */ rawDestroy(fieldId: string): Promise<SchemaTypes.FieldDestroyJobSchema>; /** * Duplicate a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/duplicate * * @throws {ApiError} * @throws {TimeoutError} */ duplicate(fieldId: string | SimpleSchemaTypes.FieldData): Promise<SimpleSchemaTypes.Field>; /** * Duplicate a field * * Read more: https://www.datocms.com/docs/content-management-api/resources/field/duplicate * * @throws {ApiError} * @throws {TimeoutError} */ rawDuplicate(fieldId: string): Promise<SchemaTypes.FieldDuplicateJobSchema>; }