Skip to content

Commit 263f248

Browse files
sunil-lakshmanishaileshmishraharshithad0703
authored
Next (#34)
* Added users and organisations api methods User Session Logging in/out Users Get User Update User Activate User Request Password Reset Password Organizations Get All Organizations Get Single Organization Organization Roles Organization Users Transfer Organization Ownership Organization Stacks Organization Logs * added requirements.txt file * loaded install, changlog , codeowners and release.yml file * Organized package structure * Developed stack Implementation * Code Optimized * Added Mock test and Api Test cases * Added test cases and coverage packages * Added API documentation and added stacks test cases * Added coverage reports generartion in github action Added coverage report github action Changed methods name Changed unit test cases Code improvements API Documentation * Added global fields class * - General code improvements - Corrected few testcases - Single place for credentials - linting added * Feat/cs 40287 workflow class implemetation (#14) * feat: ✨ implemented branches and aliases with unit and api test cases * test: ✅ added mock tests for branches and aliases * docs: 📝 added api documentation for branches and aliases * feat: ✨ content type implementation with api references, unit test cases and api test cases * test: renamed the api, mock, unit test file names of branch and alias * test: renamed file path in branch and alias mock tests * test: improved coverage report for branches and aliases * test: Added mock test cases for content type * docs: 📝 Cleared typo errors * test: removed unwanted test files * refactor: Code improvement for branches, aliases and content type implementation * - General code improvements - Testcases improvements * - General code improvements - Testcases improvements * - General code improvements - Formats are updated * code enhancement * Created Entry class and test cases Created Entry Class created entry class test cases * feat: ✨ asset class implementation with tests and api docs * Code improvements and changed test cases to new structure * test: ✅ added resources and made some changes in api and unit test cases * Updated Unit test cases. * Webhook class Implementation * Created workflow class * Deleted secrets-scan.yml file * Updated variable name * Deleted sast-scan.yml file * Feat/cs 40545 metadata class implemetation (#15) * Metadata class implementation * Deleted sast-scan.yml file * Fixed PR comments * Code optimisation and handling custom error exception * Removed uids * Feat/cs 40549 roles class implementation (#16) * Created roles class with unit testcases, mock test cases and api test cases * Updated coverage report github workflow file * Added coverage install command * Added pytest install command * Updated stack class unit test file * Added html coverage * Added coverage reports and visualizations * Removed visualisation * Generating coverage report in svg format * Added coverage-badge install command * Fixed PR comments and code optimisation * Added coverage reports graphical visualisation in github page * Created readme file * changed variable name * Updated readme file * Update README.md * Added auditlog class and license file (#17) * Added auditlog class and license file * Added test case for invalid inputs * commented the idiom It Allows You to Execute Code When the File Runs as a Script, but Not When It’s Imported as a Module --------- Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> * Developed environment class implementation (#19) * Developed environment class implementation * Updated variable name * Added CI-CD implementation (#20) * Added CI-CD implementation Added CICD implemetation Updated code Optimization Updated code for check package in test environment. * Removed Unused files * Feat/cs 41198 locale class implementation (#21) * Added locale class implementation * Implemented taxonomy support (#22) --------- Co-authored-by: harshithad0703 <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> * Feat/cs 41199 label class implementation (#25) * Next (#23) * Added users and organisations api methods User Session Logging in/out Users Get User Update User Activate User Request Password Reset Password Organizations Get All Organizations Get Single Organization Organization Roles Organization Users Transfer Organization Ownership Organization Stacks Organization Logs * added requirements.txt file * loaded install, changlog , codeowners and release.yml file * Organized package structure * Developed stack Implementation * Code Optimized * Added Mock test and Api Test cases * Added test cases and coverage packages * Added API documentation and added stacks test cases * Added coverage reports generartion in github action Added coverage report github action Changed methods name Changed unit test cases Code improvements API Documentation * Added global fields class * - General code improvements - Corrected few testcases - Single place for credentials - linting added * Feat/cs 40287 workflow class implemetation (#14) * feat: ✨ implemented branches and aliases with unit and api test cases * test: ✅ added mock tests for branches and aliases * docs: 📝 added api documentation for branches and aliases * feat: ✨ content type implementation with api references, unit test cases and api test cases * test: renamed the api, mock, unit test file names of branch and alias * test: renamed file path in branch and alias mock tests * test: improved coverage report for branches and aliases * test: Added mock test cases for content type * docs: 📝 Cleared typo errors * test: removed unwanted test files * refactor: Code improvement for branches, aliases and content type implementation * - General code improvements - Testcases improvements * - General code improvements - Testcases improvements * - General code improvements - Formats are updated * code enhancement * Created Entry class and test cases Created Entry Class created entry class test cases * feat: ✨ asset class implementation with tests and api docs * Code improvements and changed test cases to new structure * test: ✅ added resources and made some changes in api and unit test cases * Updated Unit test cases. * Webhook class Implementation * Created workflow class * Deleted secrets-scan.yml file * Updated variable name * Deleted sast-scan.yml file * Feat/cs 40545 metadata class implemetation (#15) * Metadata class implementation * Deleted sast-scan.yml file * Fixed PR comments * Code optimisation and handling custom error exception * Removed uids * Feat/cs 40549 roles class implementation (#16) * Created roles class with unit testcases, mock test cases and api test cases * Updated coverage report github workflow file * Added coverage install command * Added pytest install command * Updated stack class unit test file * Added html coverage * Added coverage reports and visualizations * Removed visualisation * Generating coverage report in svg format * Added coverage-badge install command * Fixed PR comments and code optimisation * Added coverage reports graphical visualisation in github page * Created readme file * changed variable name * Updated readme file * Update README.md * Added auditlog class and license file (#17) * Added auditlog class and license file * Added test case for invalid inputs * commented the idiom It Allows You to Execute Code When the File Runs as a Script, but Not When It’s Imported as a Module --------- Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> * Developed environment class implementation (#19) * Developed environment class implementation * Updated variable name * Added CI-CD implementation (#20) * Added CI-CD implementation Added CICD implemetation Updated code Optimization Updated code for check package in test environment. * Removed Unused files * Feat/cs 41198 locale class implementation (#21) * Added locale class implementation * Implemented taxonomy support (#22) --------- Co-authored-by: harshithad0703 <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> * Deleted .idea directory (#24) * Deleted .idea directory * Deleted Test apidoc files * Deleted coverage.txt file * Created label class implementation * Updated document data --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> * Feat/cs 41332 terms class implemetation (#27) * Next (#26) * Added users and organisations api methods User Session Logging in/out Users Get User Update User Activate User Request Password Reset Password Organizations Get All Organizations Get Single Organization Organization Roles Organization Users Transfer Organization Ownership Organization Stacks Organization Logs * added requirements.txt file * loaded install, changlog , codeowners and release.yml file * Organized package structure * Developed stack Implementation * Code Optimized * Added Mock test and Api Test cases * Added test cases and coverage packages * Added API documentation and added stacks test cases * Added coverage reports generartion in github action Added coverage report github action Changed methods name Changed unit test cases Code improvements API Documentation * Added global fields class * - General code improvements - Corrected few testcases - Single place for credentials - linting added * Feat/cs 40287 workflow class implemetation (#14) * feat: ✨ implemented branches and aliases with unit and api test cases * test: ✅ added mock tests for branches and aliases * docs: 📝 added api documentation for branches and aliases * feat: ✨ content type implementation with api references, unit test cases and api test cases * test: renamed the api, mock, unit test file names of branch and alias * test: renamed file path in branch and alias mock tests * test: improved coverage report for branches and aliases * test: Added mock test cases for content type * docs: 📝 Cleared typo errors * test: removed unwanted test files * refactor: Code improvement for branches, aliases and content type implementation * - General code improvements - Testcases improvements * - General code improvements - Testcases improvements * - General code improvements - Formats are updated * code enhancement * Created Entry class and test cases Created Entry Class created entry class test cases * feat: ✨ asset class implementation with tests and api docs * Code improvements and changed test cases to new structure * test: ✅ added resources and made some changes in api and unit test cases * Updated Unit test cases. * Webhook class Implementation * Created workflow class * Deleted secrets-scan.yml file * Updated variable name * Deleted sast-scan.yml file * Feat/cs 40545 metadata class implemetation (#15) * Metadata class implementation * Deleted sast-scan.yml file * Fixed PR comments * Code optimisation and handling custom error exception * Removed uids * Feat/cs 40549 roles class implementation (#16) * Created roles class with unit testcases, mock test cases and api test cases * Updated coverage report github workflow file * Added coverage install command * Added pytest install command * Updated stack class unit test file * Added html coverage * Added coverage reports and visualizations * Removed visualisation * Generating coverage report in svg format * Added coverage-badge install command * Fixed PR comments and code optimisation * Added coverage reports graphical visualisation in github page * Created readme file * changed variable name * Updated readme file * Update README.md * Added auditlog class and license file (#17) * Added auditlog class and license file * Added test case for invalid inputs * commented the idiom It Allows You to Execute Code When the File Runs as a Script, but Not When It’s Imported as a Module --------- Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> * Developed environment class implementation (#19) * Developed environment class implementation * Updated variable name * Added CI-CD implementation (#20) * Added CI-CD implementation Added CICD implemetation Updated code Optimization Updated code for check package in test environment. * Removed Unused files * Feat/cs 41198 locale class implementation (#21) * Added locale class implementation * Implemented taxonomy support (#22) --------- Co-authored-by: harshithad0703 <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> * Feat/cs 41199 label class implementation (#25) * Next (#23) * Added users and organisations api methods User Session Logging in/out Users Get User Update User Activate User Request Password Reset Password Organizations Get All Organizations Get Single Organization Organization Roles Organization Users Transfer Organization Ownership Organization Stacks Organization Logs * added requirements.txt file * loaded install, changlog , codeowners and release.yml file * Organized package structure * Developed stack Implementation * Code Optimized * Added Mock test and Api Test cases * Added test cases and coverage packages * Added API documentation and added stacks test cases * Added coverage reports generartion in github action Added coverage report github action Changed methods name Changed unit test cases Code improvements API Documentation * Added global fields class * - General code improvements - Corrected few testcases - Single place for credentials - linting added * Feat/cs 40287 workflow class implemetation (#14) * feat: ✨ implemented branches and aliases with unit and api test cases * test: ✅ added mock tests for branches and aliases * docs: 📝 added api documentation for branches and aliases * feat: ✨ content type implementation with api references, unit test cases and api test cases * test: renamed the api, mock, unit test file names of branch and alias * test: renamed file path in branch and alias mock tests * test: improved coverage report for branches and aliases * test: Added mock test cases for content type * docs: 📝 Cleared typo errors * test: removed unwanted test files * refactor: Code improvement for branches, aliases and content type implementation * - General code improvements - Testcases improvements * - General code improvements - Testcases improvements * - General code improvements - Formats are updated * code enhancement * Created Entry class and test cases Created Entry Class created entry class test cases * feat: ✨ asset class implementation with tests and api docs * Code improvements and changed test cases to new structure * test: ✅ added resources and made some changes in api and unit test cases * Updated Unit test cases. * Webhook class Implementation * Created workflow class * Deleted secrets-scan.yml file * Updated variable name * Deleted sast-scan.yml file * Feat/cs 40545 metadata class implemetation (#15) * Metadata class implementation * Deleted sast-scan.yml file * Fixed PR comments * Code optimisation and handling custom error exception * Removed uids * Feat/cs 40549 roles class implementation (#16) * Created roles class with unit testcases, mock test cases and api test cases * Updated coverage report github workflow file * Added coverage install command * Added pytest install command * Updated stack class unit test file * Added html coverage * Added coverage reports and visualizations * Removed visualisation * Generating coverage report in svg format * Added coverage-badge install command * Fixed PR comments and code optimisation * Added coverage reports graphical visualisation in github page * Created readme file * changed variable name * Updated readme file * Update README.md * Added auditlog class and license file (#17) * Added auditlog class and license file * Added test case for invalid inputs * commented the idiom It Allows You to Execute Code When the File Runs as a Script, but Not When It’s Imported as a Module --------- Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> * Developed environment class implementation (#19) * Developed environment class implementation * Updated variable name * Added CI-CD implementation (#20) * Added CI-CD implementation Added CICD implemetation Updated code Optimization Updated code for check package in test environment. * Removed Unused files * Feat/cs 41198 locale class implementation (#21) * Added locale class implementation * Implemented taxonomy support (#22) --------- Co-authored-by: harshithad0703 <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> * Deleted .idea directory (#24) * Deleted .idea directory * Deleted Test apidoc files * Deleted coverage.txt file * Created label class implementation * Updated document data --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> * Added terms class implementation --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]> * Added bulk operations class implementation (#29) * Added release and release item class implementation (#31) * Added release and release item class implementation * fixed failed unit test case --------- Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: Shailesh Mishra <[email protected]> Co-authored-by: harshithad0703 <[email protected]>
1 parent 7e6f234 commit 263f248

File tree

28 files changed

+1324
-5
lines changed

28 files changed

+1324
-5
lines changed

.talismanrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,18 @@ fileignoreconfig:
276276
- filename: tests/unit/bulk_operations/test_bulk_operations_unit.py
277277
checksum: 1cfaea5cacaef44f2154bd25150d599e6e7be541477b3cef2e909ab16ef86636
278278
version: ""
279+
fileignoreconfig:
280+
- filename: tests/mock/releases/test_releases_mock.py
281+
checksum: b519703e910b645882404ba508e5b64132b24130f204f1d4791d4faad824e93b
282+
- filename: tests/api/release_items/test_release_items_api.py
283+
checksum: 5258ca032ee32626fafd9fd7af27c1399a2773319a33bd89761fabc579b15977
284+
- filename: tests/api/releases/test_releases_api.py
285+
checksum: 6250feb132ce2ddd1ca3607cb04bc30f47ffc8f7bcf495e5b09a03cd99eae8b5
286+
- filename: tests/mock/release_items/test_release_items_mock.py
287+
checksum: 98def0f6650518882a8cbcc3b2ea8fe243795d08c7059d1885ba73f37d7c4aa3
288+
- filename: tests/unit/release_items/test_release_items_unit.py
289+
checksum: 0bf883a9918b0669266d1a736538d2492e0287e152424d1164a258afa31ddc72
290+
- filename: tests/unit/releases/test_release_unit.py
291+
checksum: ffef2e354ac901eafd0f0aa8a95394892ec23b9d8b807de3e096a28536a75126
292+
version: ""
279293

contentstack_management/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
from .labels.label import Label
2626
from .terms.terms import Terms
2727
from .bulk_operations.bulk_operation import BulkOperation
28+
from .releases.release import Releases
29+
from .release_items.release_item import ReleaseItems
2830

2931

3032
__all__ = (
@@ -53,7 +55,9 @@
5355
"Taxonomy",
5456
"Label",
5557
"Terms",
56-
"BulkOperation"
58+
"BulkOperation",
59+
"Releases",
60+
"ReleaseItems"
5761
)
5862

5963
__title__ = 'contentstack-management-python'

contentstack_management/_api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def post(self, path, data=None, json_data=None, headers=None, params=None, files
130130
# headers = headers or {}
131131
return self._call_request('POST', url, headers=headers, params=params, data=data, json_data=json_data, files=files)
132132

133-
def delete(self, path, headers=None, params=None):
133+
def delete(self, path, headers=None, params=None, data=None):
134134
"""
135135
The function sends a DELETE request to a specified URL with optional headers and parameters.
136136
@@ -150,4 +150,4 @@ def delete(self, path, headers=None, params=None):
150150

151151
url = f"{self.endpoint}{path}"
152152
# headers = headers or {}
153-
return self._call_request('DELETE', url, headers=headers, params=params)
153+
return self._call_request('DELETE', url, headers=headers, params=params, data = data)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from contentstack_management import contentstack
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
"""This class takes a base URL as an argument when it's initialized,
2+
which is the endpoint for the RESTFUL API that we'll be interacting with.
3+
The create(), read(), update(), and delete() methods each correspond to
4+
the CRUD operations that can be performed on the API """
5+
6+
import json
7+
from ..common import Parameter
8+
from urllib.parse import quote
9+
from .._errors import ArgumentException
10+
11+
class ReleaseItems(Parameter):
12+
"""
13+
This class takes a base URL as an argument when it's initialized,
14+
which is the endpoint for the RESTFUL API that
15+
we'll be interacting with. The create(), read(), update(), and delete()
16+
methods each correspond to the CRUD
17+
operations that can be performed on the API """
18+
19+
def __init__(self, client, release_uid: str):
20+
self.client = client
21+
self.release_uid = release_uid
22+
super().__init__(self.client)
23+
self.path = f"releases/{self.release_uid}"
24+
25+
def find(self):
26+
"""
27+
The "Get all items in a Release request" retrieves a list of all items (entries and assets) that are part of a specific Release.
28+
:return: Json, with releases details.
29+
30+
-------------------------------
31+
[Example:]
32+
33+
>>> from contentstack_management import contentstack
34+
>>> client = contentstack.client(authtoken='your_authtoken')
35+
>>> result = client.stack("api_key").releases("release_uid").item().find()
36+
37+
-------------------------------
38+
"""
39+
url = f"{self.path}/items"
40+
return self.client.get(url, headers = self.client.headers)
41+
42+
43+
def create(self, data: dict):
44+
"""
45+
The "Add a single item to a Release" request allows you to add an item (entry or asset) to a Release.
46+
47+
:param data: The `data` parameter is a dictionary that contains the data to be sent in the
48+
request body. It will be converted to a JSON string using the `json.dumps()` function before
49+
being sent in the request
50+
:type data: dict
51+
:return: The code is returning the result of the `post` method call on the `self.client` object.
52+
53+
-------------------------------
54+
[Example:]
55+
>>> data ={
56+
>>> "item": {
57+
>>> "version": 1,
58+
>>> "uid": "entry_or_asset_uid",
59+
>>> "content_type_uid": "your_content_type_uid",
60+
>>> "action": "publish",
61+
>>> "locale": "en-us"
62+
>>> }
63+
>>> }
64+
>>> from contentstack_management import contentstack
65+
>>> client = contentstack.client(authtoken='your_authtoken')
66+
>>> result = client.stack('api_key').releases('release_uid').item().create(data)
67+
-------------------------------
68+
"""
69+
70+
data = json.dumps(data)
71+
url = f"{self.path}/item"
72+
return self.client.post(url, headers = self.client.headers, data=data)
73+
74+
def create_multiple(self, data: dict):
75+
"""
76+
The "Add multiple items to a Release" request allows you to add multiple items (entries and/or assets) to a Release.
77+
78+
:param data: The `data` parameter is a dictionary that contains the data to be sent in the
79+
request body. It will be converted to a JSON string using the `json.dumps()` function before
80+
being sent in the request
81+
:type data: dict
82+
:return: The code is returning the result of the `post` method call on the `self.client` object.
83+
84+
-------------------------------
85+
[Example:]
86+
>>> data ={
87+
>>> "items": [{
88+
>>> "uid": "entry_or_asset_uid1",
89+
>>> "version": 1,
90+
>>> "locale": "en-us",
91+
>>> "content_type_uid": "demo1",
92+
>>> "action": "publish"
93+
>>> }, {
94+
>>> "uid": "entry_or_asset_uid2",
95+
>>> "version": 4,
96+
>>> "locale": "fr-fr",
97+
>>> "content_type_uid": "demo2",
98+
>>> "action": "publish"
99+
>>> }]
100+
>>> }
101+
>>> from contentstack_management import contentstack
102+
>>> client = contentstack.client(authtoken='your_authtoken')
103+
>>> result = client.stack('api_key').releases('release_uid').item().create_multiple(data)
104+
-------------------------------
105+
"""
106+
107+
data = json.dumps(data)
108+
url = f"{self.path}/items"
109+
return self.client.post(url, headers = self.client.headers, data=data)
110+
111+
def update(self, data: dict):
112+
"""
113+
The "Update Release items to their latest versions" request let you update all the release items (entries and assets) to their latest versions before deployment
114+
115+
:param data: A dictionary containing the data to be updated
116+
:type data: dict
117+
:param item_uid: The `item_uid` parameter is a string that represents the unique identifier of
118+
the item you want to update
119+
:type item_uid: str
120+
:return: the result of the `self.client.put()` method, which is the response from making a PUT
121+
request to the specified URL with the provided data and headers.
122+
123+
-------------------------------
124+
[Example:]
125+
>>> data ={
126+
>>> "items":[
127+
>>> "$all"
128+
>>> ]
129+
>>> }
130+
>>> from contentstack_management import contentstack
131+
>>> client = contentstack.client(authtoken='your_authtoken')
132+
>>> result = client.stack('api_key').releases("release_uid").item().update(data)
133+
134+
-------------------------------
135+
"""
136+
137+
self.validate_release_uid()
138+
url = f"{self.path}/update_items"
139+
data = json.dumps(data)
140+
return self.client.put(url, headers = self.client.headers, data=data)
141+
142+
143+
def delete(self, data: dict):
144+
"""
145+
The "Remove an item from a Release" request removes one or more items (entries and/or assets) from a specific Release.
146+
147+
:param item_uid: The `item_uid` parameter is a string that represents the unique identifier of
148+
the item you want to delete
149+
:type item_uid: str
150+
:return: the result of the delete request made to the specified URL.
151+
152+
-------------------------------
153+
[Example:]
154+
>>> data = {
155+
>>> "items": [{
156+
>>> "uid": "items_uid",
157+
>>> "version": 1,
158+
>>> "locale": "ja-jp",
159+
>>> "content_type_uid": "category",
160+
>>> "action": "publish"
161+
>>> }]
162+
>>> }
163+
>>> from contentstack_management import contentstack
164+
>>> client = contentstack.client(authtoken='your_authtoken')
165+
>>> result = result = client.stack('api_key').releases('release_uid').item().delete(data)
166+
167+
-------------------------------
168+
"""
169+
170+
self.validate_release_uid()
171+
url = f"{self.path}/items"
172+
data = json.dumps(data)
173+
return self.client.delete(url, headers = self.client.headers, data=data)
174+
175+
def delete_multiple(self, data: dict):
176+
"""
177+
The "Remove an item from a Release" request removes one or more items (entries and/or assets) from a specific Release.
178+
179+
:param item_uid: The `item_uid` parameter is a string that represents the unique identifier of
180+
the item you want to delete
181+
:type item_uid: str
182+
:return: the result of the delete request made to the specified URL.
183+
184+
-------------------------------
185+
[Example:]
186+
>>> data = {
187+
>>> "items": [{
188+
>>> "uid": "item_uid",
189+
>>> "locale": "en-us",
190+
>>> "version": 1,
191+
>>> "content_type_uid": "your_content_type_uid",
192+
>>> "action": "publish_or_unpublish"
193+
>>> }]
194+
>>> }
195+
>>> from contentstack_management import contentstack
196+
>>> client = contentstack.client(authtoken='your_authtoken')
197+
>>> result = result = client.stack('api_key').releases('release_uid').item().delete_multiple(data)
198+
199+
-------------------------------
200+
"""
201+
self.validate_release_uid()
202+
url = f"{self.path}/items"
203+
Parameter.add_param(self, "all", True)
204+
data = json.dumps(data)
205+
return self.client.delete(url, headers = self.client.headers, data=data)
206+
207+
def validate_release_uid(self):
208+
if self.release_uid is None or '':
209+
raise ArgumentException('Releases Uid is required')
210+
211+
212+
213+
214+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from contentstack_management import contentstack

0 commit comments

Comments
 (0)