@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.
@@ -1305,6 +1305,9 @@ class MemoryCache {
1305
1305
  }
1306
1306
  class EtsyClient {
1307
1307
  constructor(config) {
1308
+ if (!config.sharedSecret) {
1309
+ throw new EtsyAuthError('sharedSecret is REQUIRED for Etsy API v3 application usage. See: https://github.com/profplum700/etsy-v3-api-client/issues/21');
1310
+ }
1308
1311
  this.tokenManager = new TokenManager(config);
1309
1312
  this.baseUrl = config.baseUrl || 'https://api.etsy.com/v3/application';
1310
1313
  this.logger = new DefaultLogger();
@@ -1424,10 +1427,7 @@ class EtsyClient {
1424
1427
  return body;
1425
1428
  }
1426
1429
  getApiKey() {
1427
- if (this.sharedSecret) {
1428
- return `${this.keystring}:${this.sharedSecret}`;
1429
- }
1430
- return this.keystring;
1430
+ return `${this.keystring}:${this.sharedSecret}`;
1431
1431
  }
1432
1432
  async getUser() {
1433
1433
  return this.makeRequest('/users/me');
@@ -2098,6 +2098,22 @@ class EtsyClient {
2098
2098
  async deleteListingVideo(shopId, listingId, videoId) {
2099
2099
  await this.makeRequest(`/shops/${shopId}/listings/${listingId}/videos/${videoId}`, { method: 'DELETE' }, false);
2100
2100
  }
2101
+ async getListingPersonalizations(listingId) {
2102
+ return this.makeRequest(`/listings/${listingId}/personalization`);
2103
+ }
2104
+ async updateListingPersonalization(shopId, listingId, params) {
2105
+ const { supports_multiple_personalization_questions, ...body } = params;
2106
+ const query = supports_multiple_personalization_questions
2107
+ ? '?supports_multiple_personalization_questions=true'
2108
+ : '';
2109
+ return this.makeRequest(`/shops/${shopId}/listings/${listingId}/personalization${query}`, {
2110
+ method: 'POST',
2111
+ body: JSON.stringify(body)
2112
+ }, false);
2113
+ }
2114
+ async deleteListingPersonalization(shopId, listingId) {
2115
+ await this.makeRequest(`/shops/${shopId}/listings/${listingId}/personalization`, { method: 'DELETE' }, false);
2116
+ }
2101
2117
  async createListingTranslation(shopId, listingId, language, params) {
2102
2118
  const body = this.buildFormBody(params);
2103
2119
  return this.makeRequest(`/shops/${shopId}/listings/${listingId}/translations/${language}`, {