Skip to content

Commit 7f6faa2

Browse files
Merge pull request #98 from contentstack/staging
DX | 09-06-2025 | Release
2 parents 76296df + 1edcb2a commit 7f6faa2

File tree

100 files changed

+404
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+404
-220
lines changed

.talismanrc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,18 @@ fileignoreconfig:
354354
checksum: c7323b95249759bc67c33d3a89d3d2e8b3ed3d146b944682d451ebebe22567c0
355355
- filename: .github/workflows/secrets-scan.yml
356356
checksum: d79ec3f3288964f7d117b9ad319a54c0ebc152e35f69be8fde95522034fdfb2a
357-
version: ""
357+
- filename: tests/api/global_fields/test_global_fields_api.py
358+
checksum: 1cd57383fcad33cfaddc03aec9a7ee3e85b27de35e4545462fca33e74768e812
359+
- filename: tests/unit/global_fields/test_global_fields_unittest.py
360+
checksum: 9bb05624cf1dadb770b3cf17fbfe915cf3133d622110da30a7dfebdeab0a315c
361+
- filename: tests/api/global_fields/test_global_fields_api.py
362+
checksum: ef69455a51168ea34d62a68caea0984504d3feeafb78010947fa99d7c54d9e9c
363+
- filename: tests/unit/bulk_operations/test_bulk_releases_unit.py
364+
checksum: 6f21d8928139fe511b7477d25276c3d73d0f500d5b489ac69939f34f5ae6cad9
365+
- filename: tests/api/global_fields/test_global_fields_api.py
366+
checksum: ef69455a51168ea34d62a68caea0984504d3feeafb78010947fa99d7c54d9e9c
367+
- filename: tests/unit/release_items/test_release_items_unit.py
368+
checksum: f92e78bc9aa8fcdf4cf8490eaa81c7ce8ce518767d9becf1393e847cc2ee12c4
369+
- filename: tests/unit/global_fields/test_global_fields_unittest.py
370+
checksum: 46297a6fbf321dfe4b85a3d2c1089614af8c9590d8352238c800ad69955b4b6a
371+
version: "1.0"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## Content Management SDK For Python
44
---
5+
## v1.4.0
6+
7+
#### Date: 09 June 2025
8+
9+
- Release 2.0 support.
10+
- Nested Global fields support
11+
---
512
## v1.3.3
613

714
#### Date: 12 May 2025

contentstack_management/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@
6969
)
7070

7171
__title__ = 'contentstack-management-python'
72-
__author__ = 'ishaileshmishra'
72+
__author__ = 'dev-ex'
7373
__status__ = 'debug'
7474
__region__ = 'na'
75-
__version__ = '1.3.3'
75+
__version__ = '1.4.0'
7676
__host__ = 'api.contentstack.io'
7777
__protocol__ = 'https://'
7878
__api_version__ = 'v3'

contentstack_management/auditlogs/auditlog.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
The create(), read(), update(), and delete() methods each correspond to
44
the CRUD operations that can be performed on the API """
55

6-
import json
76
from ..common import Parameter
8-
from urllib.parse import quote
97
from .._errors import ArgumentException
108

119
class Auditlog(Parameter):

contentstack_management/bulk_operations/bulk_operation.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,96 @@ def update(self, data: dict):
227227
data = json.dumps(data)
228228
return self.client.post(url, headers = self.client.headers, data = data, params=self.params)
229229

230+
def add_items(self, data: dict, headers: dict = None):
231+
"""
232+
The Add items to bulk operation request allows you to add multiple entries and assets to a bulk operation.
233+
234+
:return: The `add_items` method is returning the result of the `post` request made by the
235+
`client.post` method.
236+
-------------------------------
237+
[Example:]
238+
>>> data = {
239+
>>> "release": "release_uid"
240+
>>> "action": "publish",
241+
>>> "locale": ["en-us", "hi-in"]
242+
>>> "reference": true
243+
>>> "items": [
244+
>>> {
245+
>>> "uid": "blt63177c0f00f20b61",
246+
>>> "content_type_uid": "my_blog"
247+
>>> }
248+
>>> ]
249+
>>> }
250+
>>> import contentstack_management
251+
>>> client = contentstack_management.Client(authtoken='your_authtoken')
252+
>>> result = client.stack('api_key').bulk_operation().add_items(data).json()
253+
254+
-------------------------------
255+
"""
256+
if headers is not None:
257+
self.client.headers.update(headers)
258+
url = f"{self.path}/release/items"
259+
data = json.dumps(data)
260+
return self.client.post(url, headers = self.client.headers, data = data, params=self.params)
261+
262+
def update_items(self, data: dict, headers: dict = None):
263+
"""
264+
The update items to bulk operation request allows you to update multiple entries and assets to a bulk operation.
265+
266+
:return: The `update_items` method is returning the result of the `put` request made by the
267+
`client.post` method.
268+
-------------------------------
269+
[Example:]
270+
>>> data = {
271+
>>> "release": "release_uid",
272+
>>> "items": [
273+
>>> {
274+
>>> "uid": "entry_uid",
275+
>>> "locale": "en-us"
276+
>>> },
277+
>>> {
278+
>>> "uid": "entry_uid",
279+
>>> "locale": "en-us",
280+
>>> "variant_id": "entry_variant_id"
281+
>>> }
282+
>>> ]
283+
>>> or
284+
>>> [ '$all' ]
285+
>>> }
286+
>>> import contentstack_management
287+
>>> client = contentstack_management.Client(authtoken='your_authtoken')
288+
>>> result = client.stack('api_key').bulk_operation().update_items(data).json()
289+
290+
-------------------------------
291+
"""
292+
if headers is not None:
293+
self.client.headers.update(headers)
294+
url = f"{self.path}/release/update_items"
295+
data = json.dumps(data)
296+
return self.client.put(url, headers = self.client.headers, data = data, params=self.params)
297+
298+
def job_status(self, job_uid: str, headers: dict = None):
299+
"""
300+
The Job status request allows you to get the status of a bulk operation job.
301+
302+
:param job_uid: The `job_uid` parameter is a string that represents the unique identifier of the job
303+
whose status you want to retrieve
304+
:type job_uid: str
305+
:return: The `job_status` method is returning the result of the `get` request made by the
306+
`client.get` method.
307+
-------------------------------
308+
[Example:]
309+
>>> import contentstack_management
310+
>>> client = contentstack_management.Client(authtoken='your_authtoken')
311+
>>> result = client.stack('api_key').bulk_operation().job_status('job_uid').json()
312+
313+
-------------------------------
314+
"""
315+
if job_uid is None:
316+
raise ArgumentException("job_uid", "job_uid cannot be None")
317+
if headers is not None:
318+
self.client.headers.update(headers)
319+
url = f"{self.path}/jobs/{quote(job_uid)}"
320+
return self.client.get(url, headers = self.client.headers, params=self.params)
321+
230322

contentstack_management/content_types/content_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def imports(self, file_path):
340340
>>> response = content_type.imports()
341341
--------------------------------
342342
"""
343-
url = f"content_types/import"
343+
url = "content_types/import"
344344
self.client.headers['Content-Type'] = "multipart/form-data"
345345
files = {'content_type': open(f"{file_path}", 'rb')}
346346
return self.client.post(url, headers=self.client.headers, params=self.params, files=files)

contentstack_management/contentstack.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import contentstack_management
21
from enum import Enum
32
from ._api_client import _APIClient
43
from contentstack_management.organizations import organization

contentstack_management/delivery_token/delivery_token.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import json
77
from ..common import Parameter
8-
from urllib.parse import quote
98
from .._errors import ArgumentException
109

1110
class DeliveryToken(Parameter):

contentstack_management/environments/environment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import json
77
from ..common import Parameter
8-
from urllib.parse import quote
98
from .._errors import ArgumentException
109

1110
class Environment(Parameter):

contentstack_management/extensions/extension.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import json
77
from ..common import Parameter
8-
from urllib.parse import quote
98
from .._errors import ArgumentException
109
from requests_toolbelt.multipart.encoder import MultipartEncoder
1110

0 commit comments

Comments
 (0)