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