UNPKG

4.71 kBTypeScriptView Raw
1import type { CursorPaginatedCollectionProp, DeleteConceptParams, GetConceptDescendantsParams, GetConceptParams, GetManyConceptParams, GetOrganizationParams, UpdateConceptParams } from '../../common-types';
2import type { ConceptProps, CreateConceptProps } from '../../entities/concept';
3import type { OpPatch } from 'json-patch';
4import type { SetOptional } from 'type-fest';
5export type ConceptPlainClientAPI = {
6 /**
7 * Create Concept
8 * @returns ConceptProps
9 * @throws if the request fails
10 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/create-a-concept}
11 * @example
12 * ```javascript
13 * const concept = await client.concept.create({
14 * organizationId: '<organization_id>',
15 * }, conceptProps);
16 * ```
17 */
18 create(params: SetOptional<GetOrganizationParams, 'organizationId'>, payload: CreateConceptProps): Promise<ConceptProps>;
19 /**
20 * Update Concept
21 * @returns the updated Concept
22 * @throws if the request fails
23 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept}
24 * @example
25 * ```javascript
26 * const updatedConcept = await client.concept.update({
27 * organizationId: '<organization_id>',
28 * }, patch);
29 * ```
30 */
31 update(params: SetOptional<UpdateConceptParams, 'organizationId'>, payload: OpPatch[]): Promise<ConceptProps>;
32 /**
33 * Get Concept
34 * @returns the Concept
35 * @throws if the request fails
36 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept}
37 * @example
38 * ```javascript
39 * const concept = await client.concept.get({
40 * organizationId: '<organization_id>',
41 * conceptId: '<concept_id>',
42 * });
43 * ```
44 */
45 get(params: SetOptional<GetConceptParams, 'organizationId'>): Promise<ConceptProps>;
46 /**
47 * Delete Concept
48 * @returns nothing
49 * @throws if the request fails
50 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept}
51 * @example
52 * ```javascript
53 * await client.concept.delete({
54 * conceptId: '<concept_id>',
55 * version: 1,
56 * });
57 * ```
58 */
59 delete(params: SetOptional<DeleteConceptParams, 'organizationId'>): Promise<void>;
60 /**
61 * Get many Concepts
62 * @returns list of many Concepts
63 * @throws if the request fails
64 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept-collection}
65 * @example
66 * ```javascript
67 * const concepts = await client.concept.getMany({
68 * organizationId: '<organization_id>',
69 * });
70 * ```
71 */
72 getMany(params: SetOptional<GetManyConceptParams, 'organizationId'>): Promise<CursorPaginatedCollectionProp<ConceptProps>>;
73 /**
74 * Get number of total Concept
75 * @returns number of total Concept
76 * @throws if the request fails
77 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/total-concepts}
78 * @example
79 * ```javascript
80 * const {total} = await client.concept.getTotal({
81 * organizationId: '<organization_id>',
82 * });
83 * ```
84 */
85 getTotal(params: SetOptional<GetOrganizationParams, 'organizationId'>): Promise<{
86 total: number;
87 }>;
88 /**
89 * Get descendant Concepts
90 * @returns list of Concepts
91 * @throws if the request fails
92 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/descendants}
93 * @example
94 * ```javascript
95 * const concepts = await client.concept.getDescendants({
96 * organizationId: '<organization_id>',
97 * conceptId: '<concept_id>',
98 * });
99 * ```
100 */
101 getDescendants(params: SetOptional<GetConceptDescendantsParams, 'organizationId'>): Promise<CursorPaginatedCollectionProp<ConceptProps>>;
102 /**
103 * Get ancestor Concepts
104 * @returns list of ancestor Concepts
105 * @throws if the request fails
106 * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/ancestors}
107 * @example
108 * ```javascript
109 * const concepts = await client.concept.getAncestors({
110 * organizationId: '<organization_id>',
111 * conceptId: '<concept_id>',
112 * });
113 * ```
114 */
115 getAncestors(params: SetOptional<GetConceptDescendantsParams, 'organizationId'>): Promise<CursorPaginatedCollectionProp<ConceptProps>>;
116};