@@ -144,10 +144,92 @@ def delete(self, taxonomy_uid: str = None):
144144 return self .client .delete (url , headers = self .client .headers , params = self .params )
145145
146146
147+ def publish (self , data : dict ):
148+ """
149+ Publish one or more taxonomies to the given environments and locales.
150+ Call on a collection-level instance: stack.taxonomy().publish(...)
151+ :param data: Request body with keys: locales, environments, items, scheduled_at.
152+
153+ -------------------------------
154+ [Example:]
155+ >>> data = {
156+ >>> "locales": ["en-us"],
157+ >>> "environments": ["production"],
158+ >>> "items": [{"uid": "taxonomy_uid"}]
159+ >>> }
160+ >>> import contentstack_management
161+ >>> client = contentstack_management.Client(authtoken='your_authtoken')
162+ >>> result = client.stack('api_key').taxonomy().publish(data).json()
163+
164+ -------------------------------
165+ """
166+ data = json .dumps (data )
167+ return self .client .post (f"{ self .path } /publish" , headers = self .client .headers , data = data , params = self .params )
168+
169+ def unpublish (self , data : dict ):
170+ """
171+ Unpublish one or more taxonomies from the given environments and locales.
172+ Call on a collection-level instance: stack.taxonomy().unpublish(...)
173+ :param data: Request body with keys: locales, environments, items, scheduled_at.
174+
175+ -------------------------------
176+ [Example:]
177+ >>> data = {
178+ >>> "locales": ["en-us"],
179+ >>> "environments": ["production"],
180+ >>> "items": [{"uid": "taxonomy_uid"}]
181+ >>> }
182+ >>> import contentstack_management
183+ >>> client = contentstack_management.Client(authtoken='your_authtoken')
184+ >>> result = client.stack('api_key').taxonomy().unpublish(data).json()
185+
186+ -------------------------------
187+ """
188+ data = json .dumps (data )
189+ return self .client .post (f"{ self .path } /unpublish" , headers = self .client .headers , data = data , params = self .params )
190+
191+ def localize (self , data : dict ):
192+ """
193+ Localize a taxonomy into the locale specified via add_param("locale", "...").
194+ :param data: Request body, e.g. {"taxonomy": {"name": "Localized name"}}.
195+
196+ -------------------------------
197+ [Example:]
198+ >>> import contentstack_management
199+ >>> client = contentstack_management.Client(authtoken='your_authtoken')
200+ >>> tax = client.stack('api_key').taxonomy('taxonomy_uid')
201+ >>> tax.add_param("locale", "hi-in")
202+ >>> result = tax.localize({"taxonomy": {"name": "Taxonomy HI"}}).json()
203+
204+ -------------------------------
205+ """
206+ self .validate_taxonomy_uid ()
207+ url = f"{ self .path } /{ self .taxonomy_uid } "
208+ data = json .dumps (data )
209+ return self .client .post (url , headers = self .client .headers , data = data , params = self .params )
210+
211+ def unlocalize (self ):
212+ """
213+ Unlocalize a taxonomy from the locale specified via add_param("locale", "...").
214+
215+ -------------------------------
216+ [Example:]
217+ >>> import contentstack_management
218+ >>> client = contentstack_management.Client(authtoken='your_authtoken')
219+ >>> tax = client.stack('api_key').taxonomy('taxonomy_uid')
220+ >>> tax.add_param("locale", "hi-in")
221+ >>> result = tax.unlocalize().json()
222+
223+ -------------------------------
224+ """
225+ self .validate_taxonomy_uid ()
226+ url = f"{ self .path } /{ self .taxonomy_uid } "
227+ return self .client .delete (url , headers = self .client .headers , params = self .params )
228+
147229 def validate_taxonomy_uid (self ):
148230 if self .taxonomy_uid is None or '' :
149231 raise ArgumentException (TAXONOMY_UID_REQUIRED )
150-
232+
151233 def terms (self , terms_uid : str = None ):
152234 self .validate_taxonomy_uid ()
153235 return Terms (self .client , self .taxonomy_uid , terms_uid )
0 commit comments