@lonca/trendyol 0.6.0 → 0.8.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/index.d.cts CHANGED
@@ -10,7 +10,7 @@ interface TransportConfig {
10
10
  apiKey: string;
11
11
  apiSecret: string;
12
12
  env: TrendyolEnvironment;
13
- integratorName?: string;
13
+ integratorName: string;
14
14
  clientIp?: string;
15
15
  logger?: Logger;
16
16
  /** Request timeout in ms. Default: 30_000. */
@@ -35,6 +35,8 @@ declare class TrendyolTransport {
35
35
  private readonly timeoutMs;
36
36
  private readonly fetchImpl;
37
37
  constructor(config: TransportConfig);
38
+ /** Seller ID this transport is configured with. Resources read it for path-building. */
39
+ get sellerId(): number;
38
40
  request<T>(opts: RequestOptions): Promise<T>;
39
41
  private buildUrl;
40
42
  private buildHeaders;
@@ -177,20 +179,8 @@ type ListCategoryAttributeValuesParams = CursorPaginationParams;
177
179
  */
178
180
  declare class CategoriesResource {
179
181
  private readonly transport;
180
- /**
181
- * Trendyol seller (supplier) ID — required only for the AutoFT-scoped
182
- * `getByBarcodes` lookup. Other category endpoints don't need it.
183
- * Provided automatically when constructed via `createTrendyolClient`.
184
- */
185
- private readonly sellerId?;
186
182
  private readonly limiter;
187
- constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter,
188
- /**
189
- * Trendyol seller (supplier) ID — required only for the AutoFT-scoped
190
- * `getByBarcodes` lookup. Other category endpoints don't need it.
191
- * Provided automatically when constructed via `createTrendyolClient`.
192
- */
193
- sellerId?: number | undefined);
183
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
194
184
  /**
195
185
  * Fetch the full Trendyol category tree.
196
186
  *
@@ -240,8 +230,6 @@ declare class CategoriesResource {
240
230
  *
241
231
  * @param barcodes 1–N barcodes to look up.
242
232
  * @throws {ValidationError} when `barcodes` is empty.
243
- * @throws Error when the client was created without a `sellerId` and this
244
- * method is called directly (use `createTrendyolClient` to wire it).
245
233
  */
246
234
  getByBarcodes(barcodes: string[]): Promise<BarcodeCategoryLookup>;
247
235
  }
@@ -356,9 +344,8 @@ interface ClaimItemAudit {
356
344
  */
357
345
  declare class ClaimsResource {
358
346
  private readonly transport;
359
- private readonly sellerId;
360
347
  private readonly limiter;
361
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
348
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
362
349
  /**
363
350
  * Create a return claim against an order. Use this to file a return on
364
351
  * behalf of a customer (e.g. when they called your CS line). For
@@ -582,9 +569,8 @@ interface Neighborhood {
582
569
  */
583
570
  declare class FinanceResource {
584
571
  private readonly transport;
585
- private readonly sellerId;
586
572
  private readonly limiter;
587
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
573
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
588
574
  getSettlements(params?: ListFinanceParams): Promise<CursorPage<FinancialTransaction>>;
589
575
  getOtherFinancials(params?: ListFinanceParams): Promise<CursorPage<FinancialTransaction>>;
590
576
  private queryPage;
@@ -625,8 +611,7 @@ interface UpdatePriceInventoryResponse {
625
611
  */
626
612
  declare class InventoryResource {
627
613
  private readonly transport;
628
- private readonly sellerId;
629
- constructor(transport: TrendyolTransport, sellerId: number);
614
+ constructor(transport: TrendyolTransport);
630
615
  /**
631
616
  * Update price and/or stock for one or more SKUs (by barcode).
632
617
  *
@@ -651,9 +636,8 @@ declare class InventoryResource {
651
636
  */
652
637
  declare class InvoicesResource {
653
638
  private readonly transport;
654
- private readonly sellerId;
655
639
  private readonly limiter;
656
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
640
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
657
641
  /**
658
642
  * Upload an invoice file for a shipment package. **Multipart**: the
659
643
  * SDK builds the FormData internally from the typed input.
@@ -673,9 +657,8 @@ declare class InvoicesResource {
673
657
  */
674
658
  declare class LabelsResource {
675
659
  private readonly transport;
676
- private readonly sellerId;
677
660
  private readonly limiter;
678
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
661
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
679
662
  /**
680
663
  * Request a common ZPL label for a cargo tracking number. After this
681
664
  * returns, call `getCommon()` with the same `cargoTrackingNumber` to
@@ -1099,9 +1082,8 @@ declare function normalizeShipmentPackage(rawNode: unknown): ShipmentPackage;
1099
1082
  */
1100
1083
  declare class OrdersResource {
1101
1084
  private readonly transport;
1102
- private readonly sellerId;
1103
1085
  private readonly limiter;
1104
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
1086
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
1105
1087
  /**
1106
1088
  * List shipment packages for the seller.
1107
1089
  *
@@ -1686,13 +1668,12 @@ interface ListUnapprovedProductsParams extends CursorPaginationParams {
1686
1668
  */
1687
1669
  declare class ProductsResource {
1688
1670
  private readonly transport;
1689
- private readonly sellerId;
1690
1671
  private readonly filterLimiter;
1691
1672
  private readonly batchLimiter;
1692
1673
  private readonly buyboxLimiter;
1693
1674
  private readonly writeLimiter;
1694
1675
  private readonly deleteLimiter;
1695
- constructor(transport: TrendyolTransport, sellerId: number, options?: {
1676
+ constructor(transport: TrendyolTransport, options?: {
1696
1677
  filterLimiter?: TokenBucketRateLimiter;
1697
1678
  batchLimiter?: TokenBucketRateLimiter;
1698
1679
  buyboxLimiter?: TokenBucketRateLimiter;
@@ -1930,9 +1911,8 @@ interface ListQuestionsParams extends CursorPaginationParams {
1930
1911
  */
1931
1912
  declare class QuestionsResource {
1932
1913
  private readonly transport;
1933
- private readonly sellerId;
1934
1914
  private readonly limiter;
1935
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
1915
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
1936
1916
  /** Fetch a single question by its numeric ID. */
1937
1917
  get(questionId: string | number): Promise<Question>;
1938
1918
  /**
@@ -2001,12 +1981,11 @@ interface SuppliersResourceOptions {
2001
1981
  */
2002
1982
  declare class SuppliersResource {
2003
1983
  private readonly transport;
2004
- private readonly sellerId;
2005
1984
  private cache;
2006
1985
  private readonly cacheTtlMs;
2007
1986
  private readonly limiter;
2008
1987
  private inflight;
2009
- constructor(transport: TrendyolTransport, sellerId: number, options?: SuppliersResourceOptions);
1988
+ constructor(transport: TrendyolTransport, options?: SuppliersResourceOptions);
2010
1989
  /**
2011
1990
  * List the seller's registered addresses (shipment, returning, invoice, warehouse).
2012
1991
  *
@@ -2028,9 +2007,8 @@ declare class SuppliersResource {
2028
2007
  */
2029
2008
  declare class TestOrdersResource {
2030
2009
  private readonly transport;
2031
- private readonly sellerId;
2032
2010
  private readonly limiter;
2033
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
2011
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
2034
2012
  /**
2035
2013
  * Create a test order with the given customer / addresses / lines. The
2036
2014
  * SDK forwards the typed payload verbatim — drill into Trendyol's
@@ -2110,9 +2088,8 @@ interface Webhook {
2110
2088
  */
2111
2089
  declare class WebhooksResource {
2112
2090
  private readonly transport;
2113
- private readonly sellerId;
2114
2091
  private readonly limiter;
2115
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
2092
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
2116
2093
  /**
2117
2094
  * Create a new webhook subscription. Trendyol caps subscriptions at 15
2118
2095
  * per seller — the SDK does NOT pre-check (you'd need to call `list()`
@@ -2152,11 +2129,12 @@ interface CreateClientOptions {
2152
2129
  /** Which Trendyol environment to target. */
2153
2130
  env: TrendyolEnvironment;
2154
2131
  /**
2155
- * Integrator company name to send in `User-Agent` / `x-agentname`.
2156
- * Defaults to `'SelfIntegration'` if the seller owns the integration code.
2132
+ * Integrator company name to send in `User-Agent` / `x-agentname`. Required —
2133
+ * Trendyol uses this to attribute API traffic. Use `'SelfIntegration'` if
2134
+ * the seller owns the integration code, otherwise your company / product name.
2157
2135
  * Trendyol caps this at 30 alphanumeric characters.
2158
2136
  */
2159
- integratorName?: string;
2137
+ integratorName: string;
2160
2138
  /**
2161
2139
  * IPv4 address to send in `x-clientip`.
2162
2140
  * Defaults to `'127.0.0.1'` — Trendyol does not validate this against the
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ interface TransportConfig {
10
10
  apiKey: string;
11
11
  apiSecret: string;
12
12
  env: TrendyolEnvironment;
13
- integratorName?: string;
13
+ integratorName: string;
14
14
  clientIp?: string;
15
15
  logger?: Logger;
16
16
  /** Request timeout in ms. Default: 30_000. */
@@ -35,6 +35,8 @@ declare class TrendyolTransport {
35
35
  private readonly timeoutMs;
36
36
  private readonly fetchImpl;
37
37
  constructor(config: TransportConfig);
38
+ /** Seller ID this transport is configured with. Resources read it for path-building. */
39
+ get sellerId(): number;
38
40
  request<T>(opts: RequestOptions): Promise<T>;
39
41
  private buildUrl;
40
42
  private buildHeaders;
@@ -177,20 +179,8 @@ type ListCategoryAttributeValuesParams = CursorPaginationParams;
177
179
  */
178
180
  declare class CategoriesResource {
179
181
  private readonly transport;
180
- /**
181
- * Trendyol seller (supplier) ID — required only for the AutoFT-scoped
182
- * `getByBarcodes` lookup. Other category endpoints don't need it.
183
- * Provided automatically when constructed via `createTrendyolClient`.
184
- */
185
- private readonly sellerId?;
186
182
  private readonly limiter;
187
- constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter,
188
- /**
189
- * Trendyol seller (supplier) ID — required only for the AutoFT-scoped
190
- * `getByBarcodes` lookup. Other category endpoints don't need it.
191
- * Provided automatically when constructed via `createTrendyolClient`.
192
- */
193
- sellerId?: number | undefined);
183
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
194
184
  /**
195
185
  * Fetch the full Trendyol category tree.
196
186
  *
@@ -240,8 +230,6 @@ declare class CategoriesResource {
240
230
  *
241
231
  * @param barcodes 1–N barcodes to look up.
242
232
  * @throws {ValidationError} when `barcodes` is empty.
243
- * @throws Error when the client was created without a `sellerId` and this
244
- * method is called directly (use `createTrendyolClient` to wire it).
245
233
  */
246
234
  getByBarcodes(barcodes: string[]): Promise<BarcodeCategoryLookup>;
247
235
  }
@@ -356,9 +344,8 @@ interface ClaimItemAudit {
356
344
  */
357
345
  declare class ClaimsResource {
358
346
  private readonly transport;
359
- private readonly sellerId;
360
347
  private readonly limiter;
361
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
348
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
362
349
  /**
363
350
  * Create a return claim against an order. Use this to file a return on
364
351
  * behalf of a customer (e.g. when they called your CS line). For
@@ -582,9 +569,8 @@ interface Neighborhood {
582
569
  */
583
570
  declare class FinanceResource {
584
571
  private readonly transport;
585
- private readonly sellerId;
586
572
  private readonly limiter;
587
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
573
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
588
574
  getSettlements(params?: ListFinanceParams): Promise<CursorPage<FinancialTransaction>>;
589
575
  getOtherFinancials(params?: ListFinanceParams): Promise<CursorPage<FinancialTransaction>>;
590
576
  private queryPage;
@@ -625,8 +611,7 @@ interface UpdatePriceInventoryResponse {
625
611
  */
626
612
  declare class InventoryResource {
627
613
  private readonly transport;
628
- private readonly sellerId;
629
- constructor(transport: TrendyolTransport, sellerId: number);
614
+ constructor(transport: TrendyolTransport);
630
615
  /**
631
616
  * Update price and/or stock for one or more SKUs (by barcode).
632
617
  *
@@ -651,9 +636,8 @@ declare class InventoryResource {
651
636
  */
652
637
  declare class InvoicesResource {
653
638
  private readonly transport;
654
- private readonly sellerId;
655
639
  private readonly limiter;
656
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
640
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
657
641
  /**
658
642
  * Upload an invoice file for a shipment package. **Multipart**: the
659
643
  * SDK builds the FormData internally from the typed input.
@@ -673,9 +657,8 @@ declare class InvoicesResource {
673
657
  */
674
658
  declare class LabelsResource {
675
659
  private readonly transport;
676
- private readonly sellerId;
677
660
  private readonly limiter;
678
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
661
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
679
662
  /**
680
663
  * Request a common ZPL label for a cargo tracking number. After this
681
664
  * returns, call `getCommon()` with the same `cargoTrackingNumber` to
@@ -1099,9 +1082,8 @@ declare function normalizeShipmentPackage(rawNode: unknown): ShipmentPackage;
1099
1082
  */
1100
1083
  declare class OrdersResource {
1101
1084
  private readonly transport;
1102
- private readonly sellerId;
1103
1085
  private readonly limiter;
1104
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
1086
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
1105
1087
  /**
1106
1088
  * List shipment packages for the seller.
1107
1089
  *
@@ -1686,13 +1668,12 @@ interface ListUnapprovedProductsParams extends CursorPaginationParams {
1686
1668
  */
1687
1669
  declare class ProductsResource {
1688
1670
  private readonly transport;
1689
- private readonly sellerId;
1690
1671
  private readonly filterLimiter;
1691
1672
  private readonly batchLimiter;
1692
1673
  private readonly buyboxLimiter;
1693
1674
  private readonly writeLimiter;
1694
1675
  private readonly deleteLimiter;
1695
- constructor(transport: TrendyolTransport, sellerId: number, options?: {
1676
+ constructor(transport: TrendyolTransport, options?: {
1696
1677
  filterLimiter?: TokenBucketRateLimiter;
1697
1678
  batchLimiter?: TokenBucketRateLimiter;
1698
1679
  buyboxLimiter?: TokenBucketRateLimiter;
@@ -1930,9 +1911,8 @@ interface ListQuestionsParams extends CursorPaginationParams {
1930
1911
  */
1931
1912
  declare class QuestionsResource {
1932
1913
  private readonly transport;
1933
- private readonly sellerId;
1934
1914
  private readonly limiter;
1935
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
1915
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
1936
1916
  /** Fetch a single question by its numeric ID. */
1937
1917
  get(questionId: string | number): Promise<Question>;
1938
1918
  /**
@@ -2001,12 +1981,11 @@ interface SuppliersResourceOptions {
2001
1981
  */
2002
1982
  declare class SuppliersResource {
2003
1983
  private readonly transport;
2004
- private readonly sellerId;
2005
1984
  private cache;
2006
1985
  private readonly cacheTtlMs;
2007
1986
  private readonly limiter;
2008
1987
  private inflight;
2009
- constructor(transport: TrendyolTransport, sellerId: number, options?: SuppliersResourceOptions);
1988
+ constructor(transport: TrendyolTransport, options?: SuppliersResourceOptions);
2010
1989
  /**
2011
1990
  * List the seller's registered addresses (shipment, returning, invoice, warehouse).
2012
1991
  *
@@ -2028,9 +2007,8 @@ declare class SuppliersResource {
2028
2007
  */
2029
2008
  declare class TestOrdersResource {
2030
2009
  private readonly transport;
2031
- private readonly sellerId;
2032
2010
  private readonly limiter;
2033
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
2011
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
2034
2012
  /**
2035
2013
  * Create a test order with the given customer / addresses / lines. The
2036
2014
  * SDK forwards the typed payload verbatim — drill into Trendyol's
@@ -2110,9 +2088,8 @@ interface Webhook {
2110
2088
  */
2111
2089
  declare class WebhooksResource {
2112
2090
  private readonly transport;
2113
- private readonly sellerId;
2114
2091
  private readonly limiter;
2115
- constructor(transport: TrendyolTransport, sellerId: number, limiter?: TokenBucketRateLimiter);
2092
+ constructor(transport: TrendyolTransport, limiter?: TokenBucketRateLimiter);
2116
2093
  /**
2117
2094
  * Create a new webhook subscription. Trendyol caps subscriptions at 15
2118
2095
  * per seller — the SDK does NOT pre-check (you'd need to call `list()`
@@ -2152,11 +2129,12 @@ interface CreateClientOptions {
2152
2129
  /** Which Trendyol environment to target. */
2153
2130
  env: TrendyolEnvironment;
2154
2131
  /**
2155
- * Integrator company name to send in `User-Agent` / `x-agentname`.
2156
- * Defaults to `'SelfIntegration'` if the seller owns the integration code.
2132
+ * Integrator company name to send in `User-Agent` / `x-agentname`. Required —
2133
+ * Trendyol uses this to attribute API traffic. Use `'SelfIntegration'` if
2134
+ * the seller owns the integration code, otherwise your company / product name.
2157
2135
  * Trendyol caps this at 30 alphanumeric characters.
2158
2136
  */
2159
- integratorName?: string;
2137
+ integratorName: string;
2160
2138
  /**
2161
2139
  * IPv4 address to send in `x-clientip`.
2162
2140
  * Defaults to `'127.0.0.1'` — Trendyol does not validate this against the