Skip to content

Commit d96f65b

Browse files
committed
feat: ✨ allows overwrite flag param in import of contenttype and global field
1 parent 1c8bc74 commit d96f65b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/stack/contentType/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,18 @@ export function ContentType (http, data = {}) {
192192
* const data = {
193193
* content_type: 'path/to/file.json',
194194
* }
195-
* client.stack({ api_key: 'api_key'}).contentType().import(data)
195+
* client.stack({ api_key: 'api_key'}).contentType().import(data, { overwrite: true })
196196
* .then((contentType) => console.log(contentType))
197197
*
198198
*/
199-
this.import = async function (data) {
199+
this.import = async function (data, params = {}) {
200200
try {
201201
const response = await upload({
202202
http: http,
203203
urlPath: `${this.urlPath}/import`,
204204
stackHeaders: this.stackHeaders,
205-
formData: createFormData(data)
205+
formData: createFormData(data),
206+
params: params
206207
})
207208
if (response.data) {
208209
return new this.constructor(http, parseData(response, this.stackHeaders))

lib/stack/globalField/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,18 @@ export function GlobalField (http, data = {}) {
115115
* const data = {
116116
* global_field: 'path/to/file.json',
117117
* }
118-
* client.stack({ api_key: 'api_key'}).globalField().import(data)
118+
* client.stack({ api_key: 'api_key'}).globalField().import(data, { overwrite: true })
119119
* .then((globalField) => console.log(globalField))
120120
*
121121
*/
122-
this.import = async function (data) {
122+
this.import = async function (data, params = {}) {
123123
try {
124124
const response = await upload({
125125
http: http,
126126
urlPath: `${this.urlPath}/import`,
127127
stackHeaders: this.stackHeaders,
128-
formData: createFormData(data)
128+
formData: createFormData(data),
129+
params: params
129130
})
130131
if (response.data) {
131132
return new this.constructor(http, parseData(response, this.stackHeaders))

0 commit comments

Comments
 (0)