contentstack-management 1.3.3__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/PKG-INFO +2 -2
  2. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/__init__.py +2 -2
  3. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/auditlogs/auditlog.py +0 -2
  4. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/bulk_operations/bulk_operation.py +92 -0
  5. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/content_types/content_type.py +1 -1
  6. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/contentstack.py +0 -1
  7. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/delivery_token/delivery_token.py +0 -1
  8. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/environments/environment.py +0 -1
  9. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/extensions/extension.py +0 -1
  10. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/global_fields/global_fields.py +46 -8
  11. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/labels/label.py +0 -1
  12. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/locale/locale.py +0 -1
  13. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/management_token/management_token.py +0 -1
  14. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/metadata/metadata.py +0 -1
  15. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/publish_queue/publish_queue.py +0 -2
  16. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/release_items/release_item.py +43 -2
  17. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/releases/release.py +6 -4
  18. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/roles/roles.py +0 -1
  19. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/stack/stack.py +4 -7
  20. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/taxonomies/taxonomy.py +0 -1
  21. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/terms/terms.py +0 -1
  22. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/webhooks/webhook.py +1 -2
  23. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/workflows/workflows.py +2 -3
  24. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management.egg-info/PKG-INFO +2 -2
  25. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/setup.py +0 -1
  26. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/LICENSE +0 -0
  27. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/README.md +0 -0
  28. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/_api_client.py +0 -0
  29. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/_constant.py +0 -0
  30. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/_errors.py +0 -0
  31. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/aliases/__init__.py +0 -0
  32. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/aliases/aliases.py +0 -0
  33. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/assets/__init__.py +0 -0
  34. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/assets/assets.py +0 -0
  35. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/auditlogs/__init__.py +0 -0
  36. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/branches/__init__.py +0 -0
  37. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/branches/branches.py +0 -0
  38. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/bulk_operations/__init__.py +0 -0
  39. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/common.py +0 -0
  40. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/content_types/__init__.py +0 -0
  41. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/delivery_token/__init__.py +0 -0
  42. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/entries/__init__.py +0 -0
  43. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/entries/entry.py +0 -0
  44. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/environments/__init__.py +0 -0
  45. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/extensions/__init__.py +0 -0
  46. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/global_fields/__init__.py +0 -0
  47. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/labels/__init__.py +0 -0
  48. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/locale/__init__.py +0 -0
  49. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/management_token/__init__.py +0 -0
  50. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/metadata/__init__.py +0 -0
  51. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/organizations/__init__.py +0 -0
  52. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/organizations/organization.py +0 -0
  53. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/publish_queue/__init__.py +0 -0
  54. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/release_items/__init__.py +0 -0
  55. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/releases/__init__.py +0 -0
  56. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/roles/__init__.py +0 -0
  57. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/stack/__init__.py +0 -0
  58. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/taxonomies/__init__.py +0 -0
  59. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/terms/__init__.py +0 -0
  60. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/user_session/__init__.py +0 -0
  61. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/user_session/user_session.py +0 -0
  62. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/users/__init__.py +0 -0
  63. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/users/user.py +0 -0
  64. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/webhooks/__init__.py +0 -0
  65. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management/workflows/__init__.py +0 -0
  66. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management.egg-info/SOURCES.txt +0 -0
  67. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management.egg-info/dependency_links.txt +0 -0
  68. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management.egg-info/requires.txt +0 -0
  69. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/contentstack_management.egg-info/top_level.txt +0 -0
  70. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/setup.cfg +0 -0
  71. {contentstack_management-1.3.3 → contentstack_management-1.4.0}/tests/test_contentstack.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contentstack-management
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: Contentstack API Client Library for Python
5
5
  Home-page: https://github.com/contentstack/contentstack-management-python
6
- Author: ishaileshmishra
6
+ Author: dev-ex
7
7
  Author-email: mobile@contentstack.com
8
8
  License: MIT
9
9
  Classifier: License :: OSI Approved :: MIT License
@@ -69,10 +69,10 @@ __all__ = (
69
69
  )
70
70
 
71
71
  __title__ = 'contentstack-management-python'
72
- __author__ = 'ishaileshmishra'
72
+ __author__ = 'dev-ex'
73
73
  __status__ = 'debug'
74
74
  __region__ = 'na'
75
- __version__ = '1.3.3'
75
+ __version__ = '1.4.0'
76
76
  __host__ = 'api.contentstack.io'
77
77
  __protocol__ = 'https://'
78
78
  __api_version__ = 'v3'
@@ -3,9 +3,7 @@ which is the endpoint for the RESTFUL API that we'll be interacting with.
3
3
  The create(), read(), update(), and delete() methods each correspond to
4
4
  the CRUD operations that can be performed on the API """
5
5
 
6
- import json
7
6
  from ..common import Parameter
8
- from urllib.parse import quote
9
7
  from .._errors import ArgumentException
10
8
 
11
9
  class Auditlog(Parameter):
@@ -227,4 +227,96 @@ class BulkOperation(Parameter):
227
227
  data = json.dumps(data)
228
228
  return self.client.post(url, headers = self.client.headers, data = data, params=self.params)
229
229
 
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
+
230
322
 
@@ -340,7 +340,7 @@ class ContentType(Parameter):
340
340
  >>> response = content_type.imports()
341
341
  --------------------------------
342
342
  """
343
- url = f"content_types/import"
343
+ url = "content_types/import"
344
344
  self.client.headers['Content-Type'] = "multipart/form-data"
345
345
  files = {'content_type': open(f"{file_path}", 'rb')}
346
346
  return self.client.post(url, headers=self.client.headers, params=self.params, files=files)
@@ -1,4 +1,3 @@
1
- import contentstack_management
2
1
  from enum import Enum
3
2
  from ._api_client import _APIClient
4
3
  from contentstack_management.organizations import organization
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class DeliveryToken(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Environment(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
  from requests_toolbelt.multipart.encoder import MultipartEncoder
11
10
 
@@ -18,10 +18,13 @@ class GlobalFields(Parameter):
18
18
  methods each correspond to the CRUD
19
19
  operations that can be performed on the API """
20
20
 
21
- def __init__(self, client, global_field_uid=None):
21
+ def __init__(self, client, global_field_uid=None, options=None):
22
22
  self.client = client
23
23
  self.global_field_uid = global_field_uid
24
+ self.options = options
24
25
  super().__init__(self.client)
26
+ if self.options and 'api_version' in self.options:
27
+ Parameter.add_header(self, 'api_version', str(self.options['api_version']))
25
28
 
26
29
  def find(self):
27
30
  """
@@ -34,7 +37,12 @@ class GlobalFields(Parameter):
34
37
  >>> result = client.stack("api_key").global_fields('global_field_uid').find().json()
35
38
  -------------------------------
36
39
  """
37
- return self.client.get(_path, headers=self.client.headers, params = self.params)
40
+ response = self.client.get(_path, headers=self.client.headers, params = self.params)
41
+ # Remove the api_version header after request
42
+ if self.options and 'api_version' in self.options:
43
+ self.client.headers.pop('api_version', None)
44
+
45
+ return response
38
46
 
39
47
  def fetch(self):
40
48
  """
@@ -50,7 +58,12 @@ class GlobalFields(Parameter):
50
58
  -------------------------------
51
59
  """
52
60
  url = f"{_path}/{self.global_field_uid}"
53
- return self.client.get(url, headers=self.client.headers, params = self.params)
61
+ response = self.client.get(url, headers=self.client.headers, params = self.params)
62
+ # Remove the api_version header after request
63
+ if self.options and 'api_version' in self.options:
64
+ self.client.headers.pop('api_version', None)
65
+
66
+ return response
54
67
 
55
68
  def create(self, data):
56
69
  """
@@ -74,7 +87,12 @@ class GlobalFields(Parameter):
74
87
  -------------------------------
75
88
  """
76
89
  data = json.dumps(data)
77
- return self.client.post(_path, headers=self.client.headers, data=data, params = self.params)
90
+ response = self.client.post(_path, headers=self.client.headers, data=data, params = self.params)
91
+ # Remove the api_version header after request
92
+ if self.options and 'api_version' in self.options:
93
+ self.client.headers.pop('api_version', None)
94
+
95
+ return response
78
96
 
79
97
  def update(self, data):
80
98
  """
@@ -99,7 +117,12 @@ class GlobalFields(Parameter):
99
117
  """
100
118
  url = f"{_path}/{self.global_field_uid}"
101
119
  data = json.dumps(data)
102
- return self.client.put(url, headers=self.client.headers, params=self.params, data=data)
120
+ response = self.client.put(url, headers=self.client.headers, params=self.params, data=data)
121
+ # Remove the api_version header after request
122
+ if self.options and 'api_version' in self.options:
123
+ self.client.headers.pop('api_version', None)
124
+
125
+ return response
103
126
 
104
127
  def delete(self):
105
128
  """
@@ -114,7 +137,12 @@ class GlobalFields(Parameter):
114
137
  -------------------------------
115
138
  """
116
139
  url = f"{_path}/{self.global_field_uid}"
117
- return self.client.delete(url, headers=self.client.headers, params=self.params)
140
+ response = self.client.delete(url, headers=self.client.headers, params=self.params)
141
+ # Remove the api_version header after request
142
+ if self.options and 'api_version' in self.options:
143
+ self.client.headers.pop('api_version', None)
144
+
145
+ return response
118
146
 
119
147
  def imports(self, file_path):
120
148
  """
@@ -131,7 +159,12 @@ class GlobalFields(Parameter):
131
159
  """
132
160
  self.client.headers['Content-Type'] = "multipart/form-data"
133
161
  files = {'global_field': open(f"{file_path}", 'rb')}
134
- return self.client.post('global_fields/import', headers=self.client.headers, params=self.params, files=files)
162
+ response = self.client.post('global_fields/import', headers=self.client.headers, params=self.params, files=files)
163
+ # Remove the api_version header after request
164
+ if self.options and 'api_version' in self.options:
165
+ self.client.headers.pop('api_version', None)
166
+
167
+ return response
135
168
 
136
169
  def export(self):
137
170
  """
@@ -148,4 +181,9 @@ class GlobalFields(Parameter):
148
181
  if self.global_field_uid is None or '':
149
182
  raise Exception('global_field_uid is required')
150
183
  url = f"{_path}/{self.global_field_uid}/export"
151
- return self.client.get(url, headers=self.client.headers, params=self.params)
184
+ response = self.client.get(url, headers=self.client.headers, params=self.params)
185
+ # Remove the api_version header after request
186
+ if self.options and 'api_version' in self.options:
187
+ self.client.headers.pop('api_version', None)
188
+
189
+ return response
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Label(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Locale(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class ManagementToken(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Metadata(Parameter):
@@ -3,9 +3,7 @@ which is the endpoint for the RESTFUL API that we'll be interacting with.
3
3
  The create(), read(), update(), and delete() methods each correspond to
4
4
  the CRUD operations that can be performed on the API """
5
5
 
6
- import json
7
6
  from ..common import Parameter
8
- from urllib.parse import quote
9
7
  from .._errors import ArgumentException
10
8
 
11
9
  class PublishQueue(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class ReleaseItems(Parameter):
@@ -16,11 +15,13 @@ class ReleaseItems(Parameter):
16
15
  methods each correspond to the CRUD
17
16
  operations that can be performed on the API """
18
17
 
19
- def __init__(self, client, release_uid: str):
18
+ def __init__(self, client, release_uid: str, headers: dict = None):
20
19
  self.client = client
21
20
  self.release_uid = release_uid
22
21
  super().__init__(self.client)
23
22
  self.path = f"releases/{self.release_uid}"
23
+ if headers:
24
+ self.add_header_dict(headers)
24
25
 
25
26
  def find(self):
26
27
  """
@@ -204,6 +205,46 @@ class ReleaseItems(Parameter):
204
205
  data = json.dumps(data)
205
206
  return self.client.delete(url, headers = self.client.headers, data=data, params = self.params)
206
207
 
208
+ def move(self, data: dict):
209
+ """
210
+ The "Move items to a different Release" request allows you to move one or more items (entries and/or assets) from one Release to another Release.
211
+
212
+ :param data: The `data` parameter is a dictionary that contains the data to be sent in the
213
+ request body. It will be converted to a JSON string using the `json.dumps()` function before
214
+ being sent in the request
215
+ :type data: dict
216
+ :return: the result of the `post` method call on the `self.client` object.
217
+
218
+ -------------------------------
219
+ [Example:]
220
+ >>> data ={
221
+ >>> "release_uid": "targe_release_uid",
222
+ >>> "item": [
223
+ >>> {
224
+ >>> "uid": "entry_uid",
225
+ >>> "locale": "en-us"
226
+ >>> },
227
+ >>> {
228
+ >>> "uid": "entry_uid",
229
+ >>> "locale": "en-us",
230
+ >>> "variant_id": "entry_variant_id"
231
+ >>> }
232
+ >>> ]
233
+ >>> }
234
+ >>> import contentstack_management
235
+ >>> client = contentstack_management.Client(authtoken='your_authtoken')
236
+ >>> result = result = client.stack('api_key').releases('release_uid').item().move(data)
237
+
238
+ -------------------------------
239
+ """
240
+
241
+ self.validate_release_uid()
242
+ url = f"{self.path}/items/move"
243
+ data = json.dumps(data)
244
+ return self.client.post(url, headers = self.client.headers, data=data, params = self.params)
245
+
246
+
247
+
207
248
  def validate_release_uid(self):
208
249
  if self.release_uid is None or '':
209
250
  raise ArgumentException('Releases Uid is required')
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
  from ..release_items.release_item import ReleaseItems
11
10
 
@@ -14,11 +13,14 @@ class Releases(Parameter):
14
13
  You can define a “Release” as a set of entries and assets that needs to be deployed (published or unpublished) all at once to a particular environment.
15
14
  """
16
15
 
17
- def __init__(self, client, release_uid: str):
16
+ def __init__(self, client, release_uid: str, headers: dict = None):
18
17
  self.client = client
19
18
  self.release_uid = release_uid
20
19
  super().__init__(self.client)
21
20
  self.path = "releases"
21
+ if headers:
22
+ self.add_header_dict(headers)
23
+
22
24
 
23
25
  def find(self):
24
26
  """
@@ -192,8 +194,8 @@ class Releases(Parameter):
192
194
  if self.release_uid is None or '':
193
195
  raise ArgumentException("Releases Uid is required")
194
196
 
195
- def item(self):
197
+ def item(self, headers: dict = None):
196
198
  self.validate_uid()
197
- return ReleaseItems(self.client, self.release_uid)
199
+ return ReleaseItems(self.client, self.release_uid, headers)
198
200
 
199
201
 
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Roles(Parameter):
@@ -1,5 +1,4 @@
1
1
  import json
2
- from .._errors import ArgumentException
3
2
  from ..aliases.aliases import Alias
4
3
  from ..assets.assets import Assets
5
4
  from ..branches.branches import Branch
@@ -294,10 +293,8 @@ class Stack(Parameter):
294
293
  data = json.dumps(data)
295
294
  return self.client.post('stacks/unshare', headers=self.client.headers, params=self.params, data=data)
296
295
 
297
- def global_fields(self, global_field_uid=None):
298
- if 'api_key' not in self.client.headers:
299
- raise Exception('api_key is required')
300
- return GlobalFields(self.client, global_field_uid)
296
+ def global_fields(self, global_field_uid=None, options=None):
297
+ return GlobalFields(self.client, global_field_uid, options)
301
298
 
302
299
  def branch(self, branch_uid=None):
303
300
  return Branch(self.client, branch_uid)
@@ -341,8 +338,8 @@ class Stack(Parameter):
341
338
  def bulk_operation(self):
342
339
  return BulkOperation(self.client)
343
340
 
344
- def releases(self, release_uid: str = None):
345
- return Releases(self.client, release_uid)
341
+ def releases(self, release_uid: str = None, headers: dict = None):
342
+ return Releases(self.client, release_uid, headers)
346
343
 
347
344
  def delivery_token(self, delivery_token: str = None):
348
345
  return DeliveryToken(self.client, delivery_token)
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
  from ..terms.terms import Terms
11
10
 
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
  from .._errors import ArgumentException
10
9
 
11
10
  class Terms(Parameter):
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
 
10
9
  class Webhook(Parameter):
11
10
  """
@@ -20,7 +19,7 @@ class Webhook(Parameter):
20
19
  self.webhook_uid = webhook_uid
21
20
  super().__init__(self.client)
22
21
 
23
- self.path = f"webhooks"
22
+ self.path = "webhooks"
24
23
 
25
24
  def find(self):
26
25
  """
@@ -5,7 +5,6 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
7
  from ..common import Parameter
8
- from urllib.parse import quote
9
8
 
10
9
  class Workflows(Parameter):
11
10
  """
@@ -20,7 +19,7 @@ class Workflows(Parameter):
20
19
  self.workflow_uid = workflow_uid
21
20
  super().__init__(self.client)
22
21
 
23
- self.path = f"workflows"
22
+ self.path = "workflows"
24
23
 
25
24
  def find(self):
26
25
  """
@@ -593,7 +592,7 @@ class Workflows(Parameter):
593
592
 
594
593
  -------------------------------
595
594
  """
596
- url = f"user/assignments"
595
+ url = "user/assignments"
597
596
  return self.client.get(url, headers = self.client.headers, params = self.params)
598
597
 
599
598
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contentstack-management
3
- Version: 1.3.3
3
+ Version: 1.4.0
4
4
  Summary: Contentstack API Client Library for Python
5
5
  Home-page: https://github.com/contentstack/contentstack-management-python
6
- Author: ishaileshmishra
6
+ Author: dev-ex
7
7
  Author-email: mobile@contentstack.com
8
8
  License: MIT
9
9
  Classifier: License :: OSI Approved :: MIT License
@@ -1,6 +1,5 @@
1
1
  import os
2
2
  import re
3
- import sys
4
3
  from setuptools import setup, find_packages
5
4
 
6
5
  with open("README.md", "r") as f: