@malevich-studio/strapi-sdk-typescript 1.0.17 → 1.1.1

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.
package/dist/index.cjs CHANGED
@@ -21221,9 +21221,9 @@ class Strapi {
21221
21221
  this.url = url;
21222
21222
  this.token = token;
21223
21223
  }
21224
- async request(endpoint, data = {}, params = {}) {
21224
+ async fetch(endpoint, data = {}, params = {}) {
21225
21225
  const queryString = params.method === 'GET' ? qs.stringify(data) : '';
21226
- return await this.baseRequest(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
21226
+ return await this.baseFetch(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
21227
21227
  headers: {
21228
21228
  'Content-Type': 'application/json',
21229
21229
  },
@@ -21235,31 +21235,31 @@ class Strapi {
21235
21235
  }, params));
21236
21236
  }
21237
21237
  async getDocuments(endpoint, data, params = {}) {
21238
- return await this.request(endpoint, data, {
21238
+ return await this.fetch(endpoint, data, {
21239
21239
  method: 'GET',
21240
21240
  ...params,
21241
21241
  });
21242
21242
  }
21243
21243
  async getDocument(endpoint, data, params = {}) {
21244
- return await this.request(endpoint, data, {
21244
+ return await this.fetch(endpoint, data, {
21245
21245
  method: 'GET',
21246
21246
  ...params,
21247
21247
  });
21248
21248
  }
21249
21249
  async create(endpoint, data, params = {}) {
21250
- return await this.request(endpoint, data, {
21250
+ return await this.fetch(endpoint, data, {
21251
21251
  method: 'POST',
21252
21252
  ...params,
21253
21253
  });
21254
21254
  }
21255
21255
  async update(endpoint, id, data, params = {}) {
21256
- return await this.request(`${endpoint}/${id}`, data, {
21256
+ return await this.fetch(`${endpoint}/${id}`, data, {
21257
21257
  method: 'PUT',
21258
21258
  ...params,
21259
21259
  });
21260
21260
  }
21261
21261
  async delete(endpoint, id, params = {}) {
21262
- return await this.request(`${endpoint}/${id}`, {}, {
21262
+ return await this.fetch(`${endpoint}/${id}`, {}, {
21263
21263
  method: 'DELETE',
21264
21264
  ...params,
21265
21265
  });
@@ -21279,12 +21279,12 @@ class Strapi {
21279
21279
  return await this.uploadForm(form);
21280
21280
  }
21281
21281
  async uploadForm(form) {
21282
- return (await this.baseRequest('upload', {
21282
+ return (await this.baseFetch('upload', {
21283
21283
  method: 'POST',
21284
21284
  body: form,
21285
21285
  }));
21286
21286
  }
21287
- async baseRequest(endpoint, params = {}) {
21287
+ async baseFetch(endpoint, params = {}) {
21288
21288
  const response = await fetch(`${this.url}/api/${endpoint}`, _.merge({
21289
21289
  headers: {
21290
21290
  Authorization: `Bearer ${this.token}`,