@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/README.md +10 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.esm.js +20 -4
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +1 -1
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -4
- package/dist/index.esm.js +20 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/node.cjs +20 -4
- package/dist/node.cjs.map +1 -1
- package/dist/node.esm.js +20 -4
- package/dist/node.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface EtsyClientConfig {
|
|
2
2
|
keystring: string;
|
|
3
|
-
sharedSecret
|
|
3
|
+
sharedSecret: string;
|
|
4
4
|
accessToken: string;
|
|
5
5
|
refreshToken: string;
|
|
6
6
|
expiresAt: Date;
|
|
@@ -183,6 +183,10 @@ interface EtsyListing {
|
|
|
183
183
|
occasion?: string;
|
|
184
184
|
style_id?: number[];
|
|
185
185
|
non_taxable?: boolean;
|
|
186
|
+
is_personalizable?: boolean;
|
|
187
|
+
personalization_is_required?: boolean;
|
|
188
|
+
personalization_char_count_max?: number;
|
|
189
|
+
personalization_instructions?: string;
|
|
186
190
|
is_customizable?: boolean;
|
|
187
191
|
is_digital?: boolean;
|
|
188
192
|
file_data?: string;
|
|
@@ -285,6 +289,28 @@ interface ListingParams {
|
|
|
285
289
|
legacy?: boolean;
|
|
286
290
|
}
|
|
287
291
|
type ListingIncludes = 'Shipping' | 'Images' | 'Shop' | 'User' | 'Translations' | 'Inventory' | 'Videos';
|
|
292
|
+
type EtsyPersonalizationQuestionType = 'text_input' | 'dropdown' | 'unlabeled_upload' | 'labeled_upload';
|
|
293
|
+
interface EtsyPersonalizationOption {
|
|
294
|
+
option_id?: number | null;
|
|
295
|
+
label: string;
|
|
296
|
+
}
|
|
297
|
+
interface EtsyPersonalizationQuestion {
|
|
298
|
+
question_id?: number | null;
|
|
299
|
+
question_type: EtsyPersonalizationQuestionType;
|
|
300
|
+
question_text: string;
|
|
301
|
+
instructions?: string | null;
|
|
302
|
+
required: boolean;
|
|
303
|
+
max_allowed_characters?: number | null;
|
|
304
|
+
max_allowed_files?: number | null;
|
|
305
|
+
options?: EtsyPersonalizationOption[] | null;
|
|
306
|
+
}
|
|
307
|
+
interface EtsyListingPersonalization {
|
|
308
|
+
personalization_questions: EtsyPersonalizationQuestion[];
|
|
309
|
+
}
|
|
310
|
+
interface UpdatePersonalizationParams {
|
|
311
|
+
personalization_questions: EtsyPersonalizationQuestion[];
|
|
312
|
+
supports_multiple_personalization_questions?: boolean;
|
|
313
|
+
}
|
|
288
314
|
interface SearchParams {
|
|
289
315
|
limit?: number;
|
|
290
316
|
offset?: number;
|
|
@@ -1308,7 +1334,7 @@ declare class EtsyClient {
|
|
|
1308
1334
|
private cache?;
|
|
1309
1335
|
private cacheTtl;
|
|
1310
1336
|
private keystring;
|
|
1311
|
-
private sharedSecret
|
|
1337
|
+
private sharedSecret;
|
|
1312
1338
|
private bulkOperationManager;
|
|
1313
1339
|
constructor(config: EtsyClientConfig);
|
|
1314
1340
|
private makeRequest;
|
|
@@ -1412,6 +1438,9 @@ declare class EtsyClient {
|
|
|
1412
1438
|
getListingVideos(listingId: string): Promise<EtsyListingVideo[]>;
|
|
1413
1439
|
getListingVideo(listingId: string, videoId: string): Promise<EtsyListingVideo>;
|
|
1414
1440
|
deleteListingVideo(shopId: string, listingId: string, videoId: string): Promise<void>;
|
|
1441
|
+
getListingPersonalizations(listingId: string): Promise<EtsyListingPersonalization>;
|
|
1442
|
+
updateListingPersonalization(shopId: string, listingId: string, params: UpdatePersonalizationParams): Promise<EtsyListingPersonalization>;
|
|
1443
|
+
deleteListingPersonalization(shopId: string, listingId: string): Promise<void>;
|
|
1415
1444
|
createListingTranslation(shopId: string, listingId: string, language: string, params: CreateListingTranslationParams): Promise<EtsyListingTranslation>;
|
|
1416
1445
|
getListingTranslation(shopId: string, listingId: string, language: string): Promise<EtsyListingTranslation>;
|
|
1417
1446
|
updateListingTranslation(shopId: string, listingId: string, language: string, params: UpdateListingTranslationParams): Promise<EtsyListingTranslation>;
|
|
@@ -1702,7 +1731,7 @@ interface WebhookConfig {
|
|
|
1702
1731
|
algorithm?: 'sha256' | 'sha1';
|
|
1703
1732
|
verifySignatures?: boolean;
|
|
1704
1733
|
}
|
|
1705
|
-
type EtsyWebhookEventType = 'receipt.updated' | 'receipt.created' | 'listing.updated' | 'listing.created' | 'listing.deactivated' | 'shop.updated';
|
|
1734
|
+
type EtsyWebhookEventType = 'receipt.updated' | 'receipt.created' | 'listing.updated' | 'listing.created' | 'listing.deactivated' | 'shop.updated' | 'order.shipped' | 'order.delivered' | 'order.paid' | 'order.canceled';
|
|
1706
1735
|
interface EtsyWebhookEvent {
|
|
1707
1736
|
type: EtsyWebhookEventType;
|
|
1708
1737
|
timestamp: number;
|
|
@@ -2087,4 +2116,4 @@ declare function getLibraryInfo(): {
|
|
|
2087
2116
|
};
|
|
2088
2117
|
|
|
2089
2118
|
export { AuthHelper, BatchQueryExecutor, BulkOperationManager, COMMON_SCOPE_COMBINATIONS, CacheWithInvalidation, CreateListingSchema, DEFAULT_RETRY_CONFIG, ETSY_RATE_LIMITS, ETSY_SCOPES, EncryptedFileTokenStorage, EtsyApiError, EtsyAuthError, EtsyClient, EtsyRateLimitError, EtsyRateLimiter, EtsyWebhookHandler, FieldValidator, FileTokenStorage, GlobalRequestQueue, LFUCache, LIBRARY_NAME, LRUCache, ListingQueryBuilder, LocalStorageTokenStorage, MemoryTokenStorage, PaginatedResults, PluginManager, ReceiptQueryBuilder, RedisCacheStorage, RetryManager, SecureTokenStorage, SessionStorageTokenStorage, TokenManager, UpdateListingSchema, UpdateShopSchema, VERSION, ValidationException, Validator, WebhookSecurity, combineValidators, createAnalyticsPlugin, createAuthHelper, createBatchQuery, createBulkOperationManager, createCacheStorage, createCacheWithInvalidation, createCachingPlugin, createCodeChallenge, createDefaultTokenStorage, createEtsyClient, createListingQuery, createLoggingPlugin, createPaginatedResults, createRateLimitPlugin, createRateLimiter, createReceiptQuery, createRedisCacheStorage, createRetryPlugin, createTokenManager, createValidator, createWebhookHandler, createWebhookSecurity, decryptAES256GCM, EtsyClient as default, defaultRateLimiter, deriveKeyFromPassword, encryptAES256GCM, executeBulkOperation, field, generateCodeVerifier, generateEncryptionKey, generateRandomBase64Url, generateState, getAvailableStorage, getEnvironmentInfo, getGlobalQueue, getLibraryInfo, hasLocalStorage, hasSessionStorage, isBrowser, isNode, isSecureStorageSupported, sha256, sha256Base64Url, validate, validateEncryptionKey, validateOrThrow, withQueryBuilder, withQueue, withRetry };
|
|
2090
|
-
export type { AdvancedCachingConfig, AnalyticsPluginConfig, ApproachingLimitCallback, AuthHelperConfig, BulkImageUploadOperation, BulkOperationConfig, BulkOperationError, BulkOperationResult, BulkOperationSummary, BulkUpdateListingOperation, CacheEntry, CacheStats, CacheStorage, CacheStrategy, CachingPluginConfig, ConsolidateReturnPoliciesParams, CreateDraftListingParams, CreateListingTranslationParams, CreateReadinessStateParams, CreateReceiptShipmentParams, CreateReturnPolicyParams, CreateShippingProfileDestinationParams, CreateShippingProfileParams, CreateShippingProfileUpgradeParams, CreateShopSectionParams, EncryptedData, EncryptedStorageConfig, EtsyApiResponse, EtsyBuyerTaxonomyNode, EtsyBuyerTaxonomyProperty, EtsyBuyerTaxonomyPropertyScale, EtsyBuyerTaxonomyPropertyValue, EtsyClientConfig, EtsyClientWithQueryBuilder, EtsyErrorDetails, EtsyListing, EtsyListingFile, EtsyListingImage, EtsyListingInventory, EtsyListingOffering, EtsyListingProduct, EtsyListingProperty, EtsyListingPropertyScale, EtsyListingPropertyValue, EtsyListingTranslation, EtsyListingVariationImage, EtsyListingVideo, EtsyPagination, EtsyPayment, EtsyPaymentAccountLedgerEntry, EtsyPaymentAdjustment, EtsyPlugin, EtsyRateLimitHeaders, EtsyReview, EtsySellerTaxonomyNode, EtsyShippingCarrier, EtsyShippingCarrierMailClass, EtsyShippingProfile, EtsyShippingProfileDestination, EtsyShippingProfileUpgrade, EtsyShop, EtsyShopHolidayPreference, EtsyShopProcessingProfile, EtsyShopProductionPartner, EtsyShopReceipt, EtsyShopReceiptShipment, EtsyShopReceiptTransaction, EtsyShopRefund, EtsyShopReturnPolicy, EtsyShopSection, EtsyTokenResponse, EtsyTokens, EtsyTransactionVariation, EtsyUser, EtsyUserAddress, EtsyWebhookEvent, EtsyWebhookEventType, FindActiveListingsByShopParams, FindShopsParams, GetFeaturedListingsParams, GetLedgerEntryPaymentsParams, GetListingsByIdsParams, GetListingsByReturnPolicyParams, GetListingsBySectionParams, GetListingsByShopReceiptParams, GetPaymentAccountLedgerEntriesParams, GetReadinessStateParams, GetReviewsParams, GetShopReceiptsParams, GetTransactionsByListingParams, GetTransactionsByShopParams, ListingParams, ListingSortOn, ListingState, LoggerInterface, LoggingPluginConfig, PageFetcher, PaginationOptions, PluginRequestConfig, PluginResponse, QueueOptions, RateLimitConfig, RateLimitErrorType, RateLimitPluginConfig, RateLimitStatus, RedisClientLike, RedisConfig, RequestPriority, RetryConfig, RetryOptions, RetryPluginConfig, SearchParams, SecureTokenStorageConfig, SortOrder, TokenRefreshCallback, TokenRotationCallback, TokenRotationConfig, TokenScopesParams, TokenScopesResponse, TokenStorage, UpdateHolidayPreferencesParams, UpdateListingInventoryParams, UpdateListingParams, UpdateListingPropertyParams, UpdateListingTranslationParams, UpdateReadinessStateParams, UpdateReturnPolicyParams, UpdateShippingProfileDestinationParams, UpdateShippingProfileParams, UpdateShippingProfileUpgradeParams, UpdateShopParams, UpdateShopReceiptParams, UpdateShopSectionParams, UpdateVariationImagesParams, UploadListingFileParams, UploadListingImageParams, ValidationError, ValidationOptions, ValidationResult, ValidationSchema, ValidatorFunction, WebhookConfig, WebhookEventHandler, WebhookSecurityConfig };
|
|
2119
|
+
export type { AdvancedCachingConfig, AnalyticsPluginConfig, ApproachingLimitCallback, AuthHelperConfig, BulkImageUploadOperation, BulkOperationConfig, BulkOperationError, BulkOperationResult, BulkOperationSummary, BulkUpdateListingOperation, CacheEntry, CacheStats, CacheStorage, CacheStrategy, CachingPluginConfig, ConsolidateReturnPoliciesParams, CreateDraftListingParams, CreateListingTranslationParams, CreateReadinessStateParams, CreateReceiptShipmentParams, CreateReturnPolicyParams, CreateShippingProfileDestinationParams, CreateShippingProfileParams, CreateShippingProfileUpgradeParams, CreateShopSectionParams, EncryptedData, EncryptedStorageConfig, EtsyApiResponse, EtsyBuyerTaxonomyNode, EtsyBuyerTaxonomyProperty, EtsyBuyerTaxonomyPropertyScale, EtsyBuyerTaxonomyPropertyValue, EtsyClientConfig, EtsyClientWithQueryBuilder, EtsyErrorDetails, EtsyListing, EtsyListingFile, EtsyListingImage, EtsyListingInventory, EtsyListingOffering, EtsyListingPersonalization, EtsyListingProduct, EtsyListingProperty, EtsyListingPropertyScale, EtsyListingPropertyValue, EtsyListingTranslation, EtsyListingVariationImage, EtsyListingVideo, EtsyPagination, EtsyPayment, EtsyPaymentAccountLedgerEntry, EtsyPaymentAdjustment, EtsyPersonalizationOption, EtsyPersonalizationQuestion, EtsyPersonalizationQuestionType, EtsyPlugin, EtsyRateLimitHeaders, EtsyReview, EtsySellerTaxonomyNode, EtsyShippingCarrier, EtsyShippingCarrierMailClass, EtsyShippingProfile, EtsyShippingProfileDestination, EtsyShippingProfileUpgrade, EtsyShop, EtsyShopHolidayPreference, EtsyShopProcessingProfile, EtsyShopProductionPartner, EtsyShopReceipt, EtsyShopReceiptShipment, EtsyShopReceiptTransaction, EtsyShopRefund, EtsyShopReturnPolicy, EtsyShopSection, EtsyTokenResponse, EtsyTokens, EtsyTransactionVariation, EtsyUser, EtsyUserAddress, EtsyWebhookEvent, EtsyWebhookEventType, FindActiveListingsByShopParams, FindShopsParams, GetFeaturedListingsParams, GetLedgerEntryPaymentsParams, GetListingsByIdsParams, GetListingsByReturnPolicyParams, GetListingsBySectionParams, GetListingsByShopReceiptParams, GetPaymentAccountLedgerEntriesParams, GetReadinessStateParams, GetReviewsParams, GetShopReceiptsParams, GetTransactionsByListingParams, GetTransactionsByShopParams, ListingParams, ListingSortOn, ListingState, LoggerInterface, LoggingPluginConfig, PageFetcher, PaginationOptions, PluginRequestConfig, PluginResponse, QueueOptions, RateLimitConfig, RateLimitErrorType, RateLimitPluginConfig, RateLimitStatus, RedisClientLike, RedisConfig, RequestPriority, RetryConfig, RetryOptions, RetryPluginConfig, SearchParams, SecureTokenStorageConfig, SortOrder, TokenRefreshCallback, TokenRotationCallback, TokenRotationConfig, TokenScopesParams, TokenScopesResponse, TokenStorage, UpdateHolidayPreferencesParams, UpdateListingInventoryParams, UpdateListingParams, UpdateListingPropertyParams, UpdateListingTranslationParams, UpdatePersonalizationParams, UpdateReadinessStateParams, UpdateReturnPolicyParams, UpdateShippingProfileDestinationParams, UpdateShippingProfileParams, UpdateShippingProfileUpgradeParams, UpdateShopParams, UpdateShopReceiptParams, UpdateShopSectionParams, UpdateVariationImagesParams, UploadListingFileParams, UploadListingImageParams, ValidationError, ValidationOptions, ValidationResult, ValidationSchema, ValidatorFunction, WebhookConfig, WebhookEventHandler, WebhookSecurityConfig };
|
package/dist/index.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
|
-
|
|
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}`, {
|