@profplum700/etsy-v3-api-client 2.5.4 → 3.0.0

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/node.cjs CHANGED
@@ -1346,6 +1346,9 @@ class MemoryCache {
1346
1346
  }
1347
1347
  class EtsyClient {
1348
1348
  constructor(config) {
1349
+ if (!config.sharedSecret) {
1350
+ throw new EtsyAuthError('sharedSecret is REQUIRED for Etsy API v3 application usage. See: https://github.com/profplum700/etsy-v3-api-client/issues/21');
1351
+ }
1349
1352
  this.tokenManager = new TokenManager(config);
1350
1353
  this.baseUrl = config.baseUrl || 'https://api.etsy.com/v3/application';
1351
1354
  this.logger = new DefaultLogger();
@@ -1465,10 +1468,7 @@ class EtsyClient {
1465
1468
  return body;
1466
1469
  }
1467
1470
  getApiKey() {
1468
- if (this.sharedSecret) {
1469
- return `${this.keystring}:${this.sharedSecret}`;
1470
- }
1471
- return this.keystring;
1471
+ return `${this.keystring}:${this.sharedSecret}`;
1472
1472
  }
1473
1473
  async getUser() {
1474
1474
  return this.makeRequest('/users/me');
@@ -2139,6 +2139,22 @@ class EtsyClient {
2139
2139
  async deleteListingVideo(shopId, listingId, videoId) {
2140
2140
  await this.makeRequest(`/shops/${shopId}/listings/${listingId}/videos/${videoId}`, { method: 'DELETE' }, false);
2141
2141
  }
2142
+ async getListingPersonalizations(listingId) {
2143
+ return this.makeRequest(`/listings/${listingId}/personalization`);
2144
+ }
2145
+ async updateListingPersonalization(shopId, listingId, params) {
2146
+ const { supports_multiple_personalization_questions, ...body } = params;
2147
+ const query = supports_multiple_personalization_questions
2148
+ ? '?supports_multiple_personalization_questions=true'
2149
+ : '';
2150
+ return this.makeRequest(`/shops/${shopId}/listings/${listingId}/personalization${query}`, {
2151
+ method: 'POST',
2152
+ body: JSON.stringify(body)
2153
+ }, false);
2154
+ }
2155
+ async deleteListingPersonalization(shopId, listingId) {
2156
+ await this.makeRequest(`/shops/${shopId}/listings/${listingId}/personalization`, { method: 'DELETE' }, false);
2157
+ }
2142
2158
  async createListingTranslation(shopId, listingId, language, params) {
2143
2159
  const body = this.buildFormBody(params);
2144
2160
  return this.makeRequest(`/shops/${shopId}/listings/${listingId}/translations/${language}`, {