Skip to content

Commit f40a346

Browse files
docs: 📝 updated api reference docs for search, ancestors, descendants and move
1 parent 84981e9 commit f40a346

File tree

1 file changed

+62
-3
lines changed

1 file changed

+62
-3
lines changed

lib/stack/taxonomy/terms/index.js

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function Terms (http, data) {
1919
this.urlPath = `/taxonomies/${this.taxonomy_uid}/terms/${this.uid}`
2020

2121
/**
22-
* @description The Update terms call is used to update an existing terms.
22+
* @description The Update terms call is used to update an existing term.
2323
* @memberof Terms
2424
* @func update
2525
* @returns {Promise<Terms.Terms>} Promise for Terms instance
@@ -38,7 +38,7 @@ export function Terms (http, data) {
3838
this.update = update(http, 'term')
3939

4040
/**
41-
* @description The Delete terms call is used to delete an existing terms.
41+
* @description The Delete terms call is used to delete an existing term.
4242
* @memberof Terms
4343
* @func delete
4444
* @returns {Promise<Terms.Terms>} Response Object.
@@ -53,7 +53,7 @@ export function Terms (http, data) {
5353
this.delete = deleteEntity(http)
5454

5555
/**
56-
* @description The Fetch terms call is used to fetch an existing terms.
56+
* @description The Fetch terms call is used to fetch an existing term.
5757
* @memberof Terms
5858
* @func fetch
5959
* @returns {Promise<Terms.Terms>} Promise for Terms instance
@@ -66,6 +66,20 @@ export function Terms (http, data) {
6666
*
6767
*/
6868
this.fetch = fetch(http, 'term')
69+
70+
/**
71+
* @description The ancestors call is used to get all the ancestor terms of an existing term.
72+
* @memberof Terms
73+
* @func ancestors
74+
* @returns {Promise<Terms.Terms>} Promise for Terms instance
75+
* @example
76+
* import * as contentstack from '@contentstack/management'
77+
* const client = contentstack.client()
78+
*
79+
* client.stack({ api_key: 'api_key'}).terms('terms_uid').ancestors()
80+
* .then((terms) => console.log(terms))
81+
*
82+
*/
6983
this.ancestors = async (params = {}) => {
7084
try {
7185
const headers = {
@@ -78,6 +92,20 @@ export function Terms (http, data) {
7892
throw err
7993
}
8094
}
95+
96+
/**
97+
* @description The move call is used to existing term.
98+
* @memberof Terms
99+
* @func descendants
100+
* @returns {Promise<Terms.Terms>} Promise for Terms instance
101+
* @example
102+
* import * as contentstack from '@contentstack/management'
103+
* const client = contentstack.client()
104+
*
105+
* client.stack({ api_key: 'api_key'}).terms('terms_uid').descendants()
106+
* .then((terms) => console.log(terms))
107+
*
108+
*/
81109
this.descendants = async (params = {}) => {
82110
try {
83111
const headers = {
@@ -90,6 +118,24 @@ export function Terms (http, data) {
90118
throw err
91119
}
92120
}
121+
122+
/**
123+
* @description The move call is used to update the parent uid.
124+
* @memberof Terms
125+
* @func anscestors
126+
* @returns {Promise<Terms.Terms>} Promise for Terms instance
127+
* @example
128+
* import * as contentstack from '@contentstack/management'
129+
* const client = contentstack.client()
130+
*
131+
* const term = {
132+
* parent_uid: 'parent_uid',
133+
* order: 2
134+
* }
135+
* client.stack({ api_key: 'api_key'}).terms('terms_uid').move(term)
136+
* .then((terms) => console.log(terms))
137+
*
138+
*/
93139
this.move = move(http, 'term')
94140
} else {
95141
/**
@@ -128,6 +174,19 @@ export function Terms (http, data) {
128174
*/
129175
this.query = query({ http: http, wrapperCollection: TermsCollection })
130176
}
177+
/**
178+
* @description The Search terms call is used to search a term.
179+
* @memberof Terms
180+
* @func search
181+
* @returns {Promise<Terms.Terms>} Promise for Terms instance
182+
* @example
183+
* import * as contentstack from '@contentstack/management'
184+
* const client = contentstack.client()
185+
* const term_string = ''
186+
* client.stack({ api_key: 'api_key'}).terms().search(term_string)
187+
* .then(terms) => console.log(terms)
188+
*
189+
*/
131190
this.search = async (term = '', params = {}) => {
132191
try {
133192
const headers = {

0 commit comments

Comments
 (0)