@malevich-studio/strapi-sdk-typescript 1.2.9 → 1.2.11

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/cli.cjs CHANGED
@@ -21320,18 +21320,16 @@ class Strapi {
21320
21320
  this.token = token;
21321
21321
  }
21322
21322
  async fetch(endpoint, data = {}, params = {}) {
21323
- return await this.fetchData(endpoint, data, params);
21323
+ const queryString = params.method === 'GET' ? qs.stringify(data) : '';
21324
+ return await this.fetchData(queryString ? `${endpoint}?${queryString}` : endpoint, { data }, params);
21324
21325
  }
21325
21326
  async fetchData(endpoint, data = {}, params = {}) {
21326
- const queryString = params.method === 'GET' ? qs.stringify(data) : '';
21327
- return await this.baseFetch(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
21327
+ return await this.baseFetch(endpoint, _.merge({
21328
21328
  headers: {
21329
21329
  'Content-Type': 'application/json',
21330
21330
  },
21331
21331
  ...(params.method && !['GET', 'DELETE'].includes(params.method) ? {
21332
- body: JSON.stringify({
21333
- data,
21334
- })
21332
+ body: JSON.stringify(data)
21335
21333
  } : {}),
21336
21334
  }, params));
21337
21335
  }
@@ -21398,6 +21396,11 @@ class Strapi {
21398
21396
  }
21399
21397
  return response;
21400
21398
  }
21399
+ async baseMe(data) {
21400
+ return await this.fetchData('users/me', data, {
21401
+ method: 'GET',
21402
+ });
21403
+ }
21401
21404
  async getLocales(params) {
21402
21405
  return await this.baseFetch('i18n/locales', _.merge({
21403
21406
  headers: {
@@ -22027,6 +22030,10 @@ async function generateStrapiTypes(strapi) {
22027
22030
  ` return await this.baseChangePassword<User>(password, currentPassword);`,
22028
22031
  ' }',
22029
22032
  ' ',
22033
+ ` public async me(data: UserInput) {`,
22034
+ ` return await this.baseMer<User, UserInput>(data);`,
22035
+ ' }',
22036
+ ' ',
22030
22037
  methods.join('\n\n'),
22031
22038
  '}',
22032
22039
  '',