@@ -320,6 +320,52 @@ export function Taxonomy (http, data = {}) {
320320 throw error ( err )
321321 }
322322 }
323+
324+ /**
325+ * @description The Unpublish taxonomy call initiates a job to unpublish a taxonomy and/or specific terms from the specified environments and locales.
326+ * @memberof Taxonomy
327+ * @func unpublish
328+ * @param {Object } data - Unpublish details (same shape as publish: locales, environments, items, etc.)
329+ * @param {string } [api_version=''] - Optional API version (e.g., '3.2')
330+ * @param {Object= } params - Optional query parameters. If params.branch is set, it is sent as the branch request header.
331+ * @returns {Promise<Object> } Response object with unpublish job details
332+ * @example
333+ * import * as contentstack from '@contentstack/management'
334+ * const client = contentstack.client()
335+ *
336+ * const unpublishData = {
337+ * locales: ["en-us"],
338+ * environments: ["development"],
339+ * items: [
340+ * { uid: "taxonomy_testing" }
341+ * ]
342+ * }
343+ * client.stack({ api_key: 'api_key'}).taxonomy().unpublish(unpublishData, '3.2')
344+ * .then((response) => console.log(response))
345+ */
346+ this . unpublish = async function ( data , api_version = '' , params = { } ) {
347+ try {
348+ const { branch, ...queryParams } = params
349+ const headers = {
350+ headers : { ...cloneDeep ( this . stackHeaders ) } ,
351+ params : queryParams
352+ }
353+ if ( api_version ) {
354+ headers . headers . api_version = api_version
355+ }
356+ if ( branch ) {
357+ headers . headers . branch = branch
358+ }
359+ const response = await http . post ( `${ this . urlPath } /unpublish` , data , headers )
360+ if ( response . data ) {
361+ return response . data
362+ } else {
363+ throw error ( response )
364+ }
365+ } catch ( err ) {
366+ throw error ( err )
367+ }
368+ }
323369 }
324370 bindModuleHeaders ( this )
325371}
0 commit comments