File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ import httpClient from './core/contentstackHTTPClient.js'
39
39
* import * as contentstack from '@contentstack/management'
40
40
* const client = contentstack.client({ timeout: 50000 })
41
41
*
42
+ * @prop {number= } params.maxRequests - Optional maximum number of requests SDK should send concurrently. Default is 10 request.
43
+ * @example //Set the `maxRequests` to 50000ms
44
+ * import * as contentstack from '@contentstack/management'
45
+ * const client = contentstack.client({ maxRequests: 5 })
46
+ *
42
47
* @prop {boolean= } params.retryOnError - Optional boolean for retry on failuer. Default is true
43
48
* @example //Set the `retryOnError` to false
44
49
* import * as contentstack from '@contentstack/management'
Original file line number Diff line number Diff line change @@ -52,21 +52,25 @@ export function ReleaseItem (http, data = {}) {
52
52
* client.stack({ api_key: 'api_key'}).release('release_uid').delete({items})
53
53
* .then((response) => console.log(response.notice))
54
54
*/
55
- this . delete = async ( param ) => {
56
- if ( param === undefined ) {
55
+ this . delete = async ( items ) => {
56
+ let param = { }
57
+ if ( items === undefined ) {
57
58
param = { all : true }
58
59
}
59
60
try {
60
61
const headers = {
61
62
headers : { ...cloneDeep ( this . stackHeaders ) } ,
63
+ data : {
64
+ ...cloneDeep ( items )
65
+ } ,
62
66
params : {
63
67
...cloneDeep ( param )
64
68
}
65
69
} || { }
66
70
67
71
const response = await http . delete ( this . urlPath , headers )
68
72
if ( response . data ) {
69
- return response . data
73
+ return new Release ( http , { ... response . data , stackHeaders : data . stackHeaders } )
70
74
} else {
71
75
throw error ( response )
72
76
}
@@ -123,17 +127,14 @@ export function ReleaseItem (http, data = {}) {
123
127
const headers = {
124
128
headers : {
125
129
...cloneDeep ( this . stackHeaders )
126
- } ,
127
- params : {
128
- ...cloneDeep ( param )
129
130
}
130
131
} || { }
131
132
132
133
try {
133
- const response = await http . post ( param . item ? `releases/${ data . releaseUid } /item` : this . urlPath , data , headers )
134
+ const response = await http . post ( param . item ? `releases/${ data . releaseUid } /item` : this . urlPath , param , headers )
134
135
if ( response . data ) {
135
136
if ( response . data ) {
136
- return new Release ( http , response . data )
137
+ return new Release ( http , { ... response . data , stackHeaders : data . stackHeaders } )
137
138
}
138
139
} else {
139
140
throw error ( response )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @contentstack/management" ,
3
- "version" : " 1.2.0" ,
3
+ "version" : " 1.2.0-beta " ,
4
4
"description" : " The Content Management API is used to manage the content of your Contentstack account" ,
5
5
"main" : " dist/node/contentstack-management.js" ,
6
6
"browser" : " dist/web/contentstack-management.js" ,
14
14
"nyc" : {
15
15
"exclude" : [
16
16
" **/bulkOperation" ,
17
- " **/items" ,
18
17
" **/test"
19
18
]
20
19
},
34
33
"test:debug" : " BABEL_ENV=test mocha debug --require @babel/register ./test" ,
35
34
"lint" : " eslint lib test" ,
36
35
"format" : " eslint --fix lib test" ,
37
- "prepack" : " npm run build && npm run generate:docs" ,
38
- "prepublish" : " npm run build && npm run generate:docs" ,
36
+ "prepare" : " npm run build && npm run generate:docs" ,
39
37
"pretest" : " rimraf coverage && npm run lint" ,
40
38
"precommit" : " npm run lint" ,
41
39
"prepush" : " npm run test:unit" ,
You can’t perform that action at this time.
0 commit comments