@profplum700/etsy-v3-api-client 2.4.0 → 2.4.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/node.esm.js CHANGED
@@ -1799,6 +1799,34 @@ class EtsyClient {
1799
1799
  const response = await this.makeRequest(`/shops/${shopId}/listings/${listingId}/properties`);
1800
1800
  return response.results;
1801
1801
  }
1802
+ async updateListingProperty(params) {
1803
+ const { shopId, listingId, propertyId, valueIds, values, scaleId } = params;
1804
+ const body = new URLSearchParams();
1805
+ valueIds.forEach(id => body.append('value_ids[]', id.toString()));
1806
+ values.forEach(val => body.append('values[]', val));
1807
+ if (scaleId !== undefined) {
1808
+ body.append('scale_id', scaleId.toString());
1809
+ }
1810
+ const url = `${this.baseUrl}/shops/${shopId}/listings/${listingId}/properties/${propertyId}`;
1811
+ await this.rateLimiter.waitForRateLimit();
1812
+ const accessToken = await this.tokenManager.getAccessToken();
1813
+ const response = await this.fetch(url, {
1814
+ method: 'PUT',
1815
+ headers: {
1816
+ 'Authorization': `Bearer ${accessToken}`,
1817
+ 'x-api-key': this.getApiKey(),
1818
+ 'Content-Type': 'application/x-www-form-urlencoded'
1819
+ },
1820
+ body: body.toString()
1821
+ });
1822
+ this.rateLimiter.updateFromHeaders(response.headers);
1823
+ this.rateLimiter.resetRetryCount();
1824
+ if (!response.ok) {
1825
+ const errorText = await response.text();
1826
+ throw new EtsyApiError(`Failed to update listing property: ${response.status} ${response.statusText}`, response.status, errorText);
1827
+ }
1828
+ return response.json();
1829
+ }
1802
1830
  async getShopProductionPartners(shopId) {
1803
1831
  const response = await this.makeRequest(`/shops/${shopId}/production-partners`);
1804
1832
  return response.results;