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