@lonca/trendyol 0.12.0 → 0.14.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 +6 -6
- package/dist/{client-BJjLOn4v.d.cts → client-CtygosAW.d.cts} +64 -25
- package/dist/{client-BJjLOn4v.d.ts → client-CtygosAW.d.ts} +64 -25
- package/dist/index.cjs +83 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -45
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +83 -45
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +83 -45
- package/dist/testing.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="left">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/loncadev/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/loncadev/.github/main/brand/logomark.svg" alt="Lonca" height="32">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# @lonca/trendyol
|
|
@@ -53,13 +53,12 @@ pnpm add @lonca/trendyol @lonca/core
|
|
|
53
53
|
# or npm install / yarn add
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
`@lonca/core` is a peer dependency (
|
|
56
|
+
`@lonca/core` is a peer dependency (error classes, the token-bucket limiter). The `paginate` / `paginateOffset` helpers and the `CursorPage` / `OffsetPage` types are re-exported from `@lonca/trendyol`, so you can import them straight from this package.
|
|
57
57
|
|
|
58
58
|
## Quick start
|
|
59
59
|
|
|
60
60
|
```ts
|
|
61
|
-
import { createTrendyolClient } from '@lonca/trendyol';
|
|
62
|
-
import { paginate } from '@lonca/core';
|
|
61
|
+
import { createTrendyolClient, paginate } from '@lonca/trendyol';
|
|
63
62
|
|
|
64
63
|
const client = createTrendyolClient({
|
|
65
64
|
sellerId: 12345,
|
|
@@ -203,7 +202,8 @@ const start = new Date('2026-05-01');
|
|
|
203
202
|
const end = new Date('2026-05-31');
|
|
204
203
|
|
|
205
204
|
for await (const tx of paginate((p) =>
|
|
206
|
-
|
|
205
|
+
// `transactionType` is required (Trendyol 500s without it); `limit` is clamped to 500/1000.
|
|
206
|
+
client.finance.getSettlements({ ...p, startDate: start, endDate: end, transactionType: 'Sale' }),
|
|
207
207
|
)) {
|
|
208
208
|
// tx is a typed FinancialTransaction — no .raw drill required for documented fields
|
|
209
209
|
if (tx.transactionType === 'Satış' && tx.orderNumber) {
|
|
@@ -349,7 +349,7 @@ await client.invoices.sendLink({ shipmentPackageId: 100, invoiceLink: 'https://x
|
|
|
349
349
|
await client.invoices.deleteLink({ serviceSourceId: 1, channelId: 2, customerId: 3 });
|
|
350
350
|
|
|
351
351
|
// finance — typed FinancialTransaction[]
|
|
352
|
-
await client.finance.getSettlements({ startDate, endDate });
|
|
352
|
+
await client.finance.getSettlements({ startDate, endDate, transactionType: 'Sale' }); // transactionType required
|
|
353
353
|
await client.finance.getOtherFinancials({ transactionType: 'DeductionInvoices' });
|
|
354
354
|
|
|
355
355
|
// labels
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger, BaseRequestOptions, TokenBucketRateLimiter, CursorPaginationParams, CursorPage, OffsetPaginationParams } from '@lonca/core';
|
|
1
|
+
import { Logger, BaseRequestOptions, TokenBucketRateLimiter, CursorPaginationParams, CursorPage, MutationResult, OffsetPaginationParams } from '@lonca/core';
|
|
2
2
|
|
|
3
3
|
declare const BASE_URLS: {
|
|
4
4
|
readonly prod: "https://apigw.trendyol.com";
|
|
@@ -349,7 +349,7 @@ declare class ClaimsResource {
|
|
|
349
349
|
*
|
|
350
350
|
* @throws {ValidationError} when `claimItems` is empty.
|
|
351
351
|
*/
|
|
352
|
-
create(input: CreateClaimInput): Promise<
|
|
352
|
+
create(input: CreateClaimInput): Promise<MutationResult>;
|
|
353
353
|
/**
|
|
354
354
|
* File a seller-side rejection ("ret talebi") against a customer claim.
|
|
355
355
|
*
|
|
@@ -358,14 +358,14 @@ declare class ClaimsResource {
|
|
|
358
358
|
* commas (Trendyol expects a single comma-separated string field).
|
|
359
359
|
* Attach supporting docs (PDF / JPEG) via `files: [Blob, ...]`.
|
|
360
360
|
*/
|
|
361
|
-
createIssue(claimId: string, input: CreateClaimIssueInput): Promise<
|
|
361
|
+
createIssue(claimId: string, input: CreateClaimIssueInput): Promise<MutationResult>;
|
|
362
362
|
/**
|
|
363
363
|
* Approve specific claim line items. After approval, Trendyol moves
|
|
364
364
|
* those line items into the post-approval refund / return-shipping flow.
|
|
365
365
|
*
|
|
366
366
|
* @throws {ValidationError} when `claimLineItemIdList` is empty.
|
|
367
367
|
*/
|
|
368
|
-
approveLineItems(claimId: string, input: ApproveClaimLineItemsInput): Promise<
|
|
368
|
+
approveLineItems(claimId: string, input: ApproveClaimLineItemsInput): Promise<MutationResult>;
|
|
369
369
|
/**
|
|
370
370
|
* List claims (page-based; SDK exposes opaque cursor convention).
|
|
371
371
|
*
|
|
@@ -696,7 +696,17 @@ type OtherFinancialRow = FinancialTransaction;
|
|
|
696
696
|
interface ListFinanceParams extends CursorPaginationParams {
|
|
697
697
|
startDate?: Date;
|
|
698
698
|
endDate?: Date;
|
|
699
|
+
/**
|
|
700
|
+
* **Required** by Trendyol's CHE finance API (it returns 500 without one),
|
|
701
|
+
* e.g. `'Sale'`, `'Return'`, `'Discount'`, `'DeductionInvoices'`. The SDK
|
|
702
|
+
* throws a `ValidationError` if omitted.
|
|
703
|
+
*/
|
|
699
704
|
transactionType?: string;
|
|
705
|
+
/**
|
|
706
|
+
* Page size. Trendyol's finance API only accepts **500 or 1000** — the SDK
|
|
707
|
+
* clamps any value to the nearest of those (default 500).
|
|
708
|
+
*/
|
|
709
|
+
limit?: number;
|
|
700
710
|
}
|
|
701
711
|
interface CreateCommonLabelInput {
|
|
702
712
|
/** Currently the only documented format Trendyol accepts. */
|
|
@@ -743,18 +753,28 @@ interface Country {
|
|
|
743
753
|
raw: Record<string, unknown>;
|
|
744
754
|
}
|
|
745
755
|
interface City {
|
|
756
|
+
/**
|
|
757
|
+
* Trendyol's internal city id — the value the **nested** endpoints expect
|
|
758
|
+
* (`getTurkeyDistricts(city.id)`). Distinct from `code` (the plate-style
|
|
759
|
+
* display code, e.g. `"1"` for Adana); passing `code` there returns 500.
|
|
760
|
+
*/
|
|
761
|
+
id?: string;
|
|
746
762
|
code: string;
|
|
747
763
|
name?: string;
|
|
748
764
|
countryCode?: string;
|
|
749
765
|
raw: Record<string, unknown>;
|
|
750
766
|
}
|
|
751
767
|
interface District {
|
|
768
|
+
/** Trendyol's internal district id — pass to `getTurkeyNeighborhoods(cityId, district.id)`. */
|
|
769
|
+
id?: string;
|
|
752
770
|
code: string;
|
|
753
771
|
name?: string;
|
|
754
772
|
cityCode?: string;
|
|
755
773
|
raw: Record<string, unknown>;
|
|
756
774
|
}
|
|
757
775
|
interface Neighborhood {
|
|
776
|
+
/** Trendyol's internal neighborhood id. */
|
|
777
|
+
id?: string;
|
|
758
778
|
code: string;
|
|
759
779
|
name?: string;
|
|
760
780
|
districtCode?: string;
|
|
@@ -835,13 +855,16 @@ interface ProductVariant {
|
|
|
835
855
|
raw: Record<string, unknown>;
|
|
836
856
|
}
|
|
837
857
|
/**
|
|
838
|
-
*
|
|
858
|
+
* The content fields shared by an approved {@link Product} and an unapproved
|
|
859
|
+
* (draft) {@link UnapprovedProduct} — so callers can read title / brand /
|
|
860
|
+
* category / images from either shape without branching.
|
|
839
861
|
*
|
|
840
|
-
*
|
|
841
|
-
*
|
|
862
|
+
* Intentionally just the common surface: the two diverge structurally beyond
|
|
863
|
+
* this (`Product` carries `variants[]`; `UnapprovedProduct` is flat with a root
|
|
864
|
+
* `barcode`), and their timestamp fields differ in optionality, so those stay on
|
|
865
|
+
* the concrete types.
|
|
842
866
|
*/
|
|
843
|
-
interface
|
|
844
|
-
contentId: string;
|
|
867
|
+
interface ProductContentBase {
|
|
845
868
|
productMainId: string;
|
|
846
869
|
title: string;
|
|
847
870
|
description?: string;
|
|
@@ -850,6 +873,15 @@ interface Product {
|
|
|
850
873
|
/** Image URLs in display order. */
|
|
851
874
|
images: string[];
|
|
852
875
|
attributes: ProductAttribute[];
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* A Trendyol marketplace product (approved variant).
|
|
879
|
+
*
|
|
880
|
+
* Lonca surfaces the stable fields we have verified against live Trendyol
|
|
881
|
+
* responses. Everything else stays accessible via `raw`.
|
|
882
|
+
*/
|
|
883
|
+
interface Product extends ProductContentBase {
|
|
884
|
+
contentId: string;
|
|
853
885
|
variants: ProductVariant[];
|
|
854
886
|
/** ISO 8601 UTC string (converted from Trendyol's ms-epoch). */
|
|
855
887
|
createdAt: string;
|
|
@@ -887,17 +919,12 @@ interface UnapprovedProductRejectReason {
|
|
|
887
919
|
* calls the image-list field `media`, but the live API returns it as
|
|
888
920
|
* `images`. SDK normalizes to `images`.
|
|
889
921
|
*/
|
|
890
|
-
interface UnapprovedProduct {
|
|
922
|
+
interface UnapprovedProduct extends ProductContentBase {
|
|
891
923
|
/** Seller (supplier) ID echoed back by Trendyol. */
|
|
892
924
|
supplierId?: string;
|
|
893
|
-
productMainId: string;
|
|
894
925
|
/** Lifecycle status — see `UnapprovedProductStatus`. */
|
|
895
926
|
status?: UnapprovedProductStatus;
|
|
896
|
-
brand: NamedRef;
|
|
897
|
-
category: NamedRef;
|
|
898
927
|
barcode: string;
|
|
899
|
-
title: string;
|
|
900
|
-
description?: string;
|
|
901
928
|
/** Stock quantity at the moment of the query. */
|
|
902
929
|
quantity?: number;
|
|
903
930
|
listPrice?: number;
|
|
@@ -906,9 +933,6 @@ interface UnapprovedProduct {
|
|
|
906
933
|
vatRate?: number;
|
|
907
934
|
dimensionalWeight?: number;
|
|
908
935
|
stockCode?: string;
|
|
909
|
-
/** Image URLs in display order (Trendyol's `images` field, spec says `media`). */
|
|
910
|
-
images: string[];
|
|
911
|
-
attributes: ProductAttribute[];
|
|
912
936
|
/** Populated when `status === 'rejected'`. */
|
|
913
937
|
rejectReasonDetails: UnapprovedProductRejectReason[];
|
|
914
938
|
/** Returned by Trendyol; null when the seller has not configured this. */
|
|
@@ -1145,11 +1169,11 @@ declare class InvoicesResource {
|
|
|
1145
1169
|
*
|
|
1146
1170
|
* Max 10 MB. Accepted formats: PDF, JPEG, PNG.
|
|
1147
1171
|
*/
|
|
1148
|
-
uploadFile(input: UploadInvoiceFileInput): Promise<
|
|
1172
|
+
uploadFile(input: UploadInvoiceFileInput): Promise<MutationResult>;
|
|
1149
1173
|
/** Register an invoice URL with Trendyol (alternative to uploading the file). */
|
|
1150
|
-
sendLink(input: SendInvoiceLinkInput): Promise<
|
|
1174
|
+
sendLink(input: SendInvoiceLinkInput): Promise<MutationResult>;
|
|
1151
1175
|
/** Remove a previously-registered invoice link. */
|
|
1152
|
-
deleteLink(input: DeleteInvoiceLinkInput): Promise<
|
|
1176
|
+
deleteLink(input: DeleteInvoiceLinkInput): Promise<MutationResult>;
|
|
1153
1177
|
}
|
|
1154
1178
|
|
|
1155
1179
|
/**
|
|
@@ -1193,10 +1217,20 @@ declare class LocationsResource {
|
|
|
1193
1217
|
/** List all supported countries (Türkiye + AZ + GULF + CEE). */
|
|
1194
1218
|
getCountries(): Promise<Country[]>;
|
|
1195
1219
|
getTurkeyCities(): Promise<City[]>;
|
|
1196
|
-
|
|
1197
|
-
|
|
1220
|
+
/**
|
|
1221
|
+
* List districts for a Turkish city. **Pass the city `id`** (`City.id`) — the
|
|
1222
|
+
* nested endpoint keys off Trendyol's internal id, not the display `code`, and
|
|
1223
|
+
* returns 500 for the code. Verified live.
|
|
1224
|
+
*/
|
|
1225
|
+
getTurkeyDistricts(cityId: string | number): Promise<District[]>;
|
|
1226
|
+
/**
|
|
1227
|
+
* List neighborhoods for a Turkish district. **Pass the ids** (`City.id`,
|
|
1228
|
+
* `District.id`) — not the display codes (those 500).
|
|
1229
|
+
*/
|
|
1230
|
+
getTurkeyNeighborhoods(cityId: string | number, districtId: string | number): Promise<Neighborhood[]>;
|
|
1198
1231
|
getAzerbaijanCities(): Promise<City[]>;
|
|
1199
|
-
|
|
1232
|
+
/** List districts for an Azerbaijani city. **Pass the city `id`** (`City.id`), not `code`. */
|
|
1233
|
+
getAzerbaijanDistricts(cityId: string | number): Promise<District[]>;
|
|
1200
1234
|
getCitiesByCountry(countryCode: string): Promise<City[]>;
|
|
1201
1235
|
getDistrictsByCity(countryCode: string, cityId: string | number): Promise<District[]>;
|
|
1202
1236
|
private cities;
|
|
@@ -2016,6 +2050,11 @@ declare class ProductsResource {
|
|
|
2016
2050
|
* List approved products. Use `paginate()` from `@lonca/core` to iterate
|
|
2017
2051
|
* lazily across pages.
|
|
2018
2052
|
*
|
|
2053
|
+
* **Approved only:** this endpoint silently excludes products still in review
|
|
2054
|
+
* or rejected — use {@link listUnapproved} for those. Date fields on the
|
|
2055
|
+
* returned {@link Product} (`createdAt` / `updatedAt`) are ISO 8601 UTC
|
|
2056
|
+
* **strings**, not `Date` objects.
|
|
2057
|
+
*
|
|
2019
2058
|
* Trendyol exposes both page-based and `nextPageToken`-based pagination
|
|
2020
2059
|
* (the latter required when the dataset exceeds 10,000 items). The SDK
|
|
2021
2060
|
* picks the right strategy automatically — pass our opaque `cursor` from
|
|
@@ -2624,4 +2663,4 @@ interface TrendyolClient {
|
|
|
2624
2663
|
*/
|
|
2625
2664
|
declare function createTrendyolClient(opts: CreateClientOptions): TrendyolClient;
|
|
2626
2665
|
|
|
2627
|
-
export { type FinancialTransaction as $, type ApproveClaimLineItemsInput as A, type BarcodeCategoryLookup as B, type CancelPackageItemInput as C, type Country as D, type CreateClaimInput as E, type CreateClaimIssueInput as F, type CreateClaimItemInput as G, type CreateClientOptions as H, type CreateCommonLabelInput as I, type CreateProductV2Input as J, type CreateTestOrderInput as K, type CreateVideoInput as L, type DeleteInvoiceLinkInput as M, type DeliveryOptionInput as N, type District as O, type ExportBatchAcceptedResponse as P, type ExportBatchStatus as Q, type ExportCategoryAttribute as R, ExportCenterResource as S, type ExportPackage as T, type ExportPackageItem as U, type ExportPackageStatus as V, type ExportPriceUpdateInput as W, type ExportProduct as X, type ExportProductInput as Y, type ExportStockUpdateInput as Z, FinanceResource as _, type ApprovedProductStatus as a, type
|
|
2666
|
+
export { type FinancialTransaction as $, type ApproveClaimLineItemsInput as A, type BarcodeCategoryLookup as B, type CancelPackageItemInput as C, type Country as D, type CreateClaimInput as E, type CreateClaimIssueInput as F, type CreateClaimItemInput as G, type CreateClientOptions as H, type CreateCommonLabelInput as I, type CreateProductV2Input as J, type CreateTestOrderInput as K, type CreateVideoInput as L, type DeleteInvoiceLinkInput as M, type DeliveryOptionInput as N, type District as O, type ExportBatchAcceptedResponse as P, type ExportBatchStatus as Q, type ExportCategoryAttribute as R, ExportCenterResource as S, type ExportPackage as T, type ExportPackageItem as U, type ExportPackageStatus as V, type ExportPriceUpdateInput as W, type ExportProduct as X, type ExportProductInput as Y, type ExportStockUpdateInput as Z, FinanceResource as _, type ApprovedProductStatus as a, type SuppliersResourceOptions as a$, type GetExportPackageItemsParams as a0, InventoryResource as a1, InvoicesResource as a2, type KnownShipmentPackageStatus as a3, LabelsResource as a4, type LaborCostInput as a5, type ListCategoryAttributeValuesParams as a6, type ListClaimsParams as a7, type ListCompensationTicketsParams as a8, type ListExportPackagesV2Params as a9, type ProductAttribute as aA, type ProductAttributeV2Input as aB, type ProductBase as aC, type ProductComposition as aD, type ProductContentBase as aE, type ProductImageInput as aF, type ProductOrigin as aG, type ProductStockPrice as aH, type ProductStockPriceVariant as aI, type ProductVariant as aJ, ProductsResource as aK, type QuantitySplit as aL, type Question as aM, type QuestionAnswer as aN, type QuestionStatus as aO, QuestionsResource as aP, type SellerIntegrationStatus as aQ, type SellerVideo as aR, type SendInvoiceLinkInput as aS, type SettlementRow as aT, type ShipmentPackage as aU, type ShipmentPackageStatus as aV, type SplitGroup as aW, type SplitPackagePlan as aX, type SupplierAddress as aY, type SupplierAddressType as aZ, SuppliersResource as a_, type ListExportPackagesV3Params as aa, type ListExportProductsParams as ab, type ListFinanceParams as ac, type ListInventoryAndPriceParams as ad, type ListOrdersParams as ae, type ListOrdersStreamParams as af, type ListProductsParams as ag, type ListQuestionsParams as ah, type ListUnapprovedProductsParams as ai, type ListVideosParams as aj, LocationsResource as ak, type NamedRef as al, type Neighborhood as am, type OrderAddress as an, type OrderAddressLines as ao, type OrderCustomer as ap, type OrderLine as aq, type OrderLineDiscountDetail as ar, OrdersResource as as, type OtherFinancialRow as at, type PackageDetail as au, type PackageHistoryEntry as av, type PackageLineUpdate as aw, type PriceInventoryUpdate as ax, type ProcessAlternativeDeliveryInput as ay, type Product as az, type BatchAcceptedResponse as b, type TestOrderStatus as b0, TestOrdersResource as b1, type TrendyolCapabilities as b2, type TrendyolCargoProvider as b3, type TrendyolClient as b4, type TrendyolEnvironment as b5, type UnapprovedDateQueryType as b6, type UnapprovedProduct as b7, type UnapprovedProductRejectReason as b8, type UnapprovedProductStatus as b9, type UpdateBoxInfoInput as ba, type UpdateContentInput as bb, type UpdateDeliveryInfoInput as bc, type UpdatePackageStatusInput as bd, type UpdatePriceInventoryResponse as be, type UpdateUnapprovedInput as bf, type UpdateVariantInput as bg, type UploadInvoiceFileInput as bh, VideosResource as bi, type Webhook as bj, type WebhookAuthenticationType as bk, type WebhookInput as bl, WebhooksResource as bm, createTrendyolClient as bn, normalizeShipmentPackage as bo, pollBatchStatus as bp, trendyolCapabilities as bq, type BatchPollOptions as c, type BatchRequestItemResult as d, type BatchRequestResult as e, type BatchRequestStatus as f, type Brand as g, BrandsResource as h, type BuyboxInfo as i, type CareInstruction as j, type CargoInvoiceItem as k, CategoriesResource as l, type Category as m, type CategoryAttribute as n, type CategoryAttributeValue as o, type City as p, type Claim as q, type ClaimIssueReason as r, type ClaimItemAudit as s, type ClaimItemStatus as t, ClaimsResource as u, type CommonLabel as v, type CommonLabelEntry as w, type CompensationItemDetail as x, type CompensationTicket as y, type CompensationTicketState as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger, BaseRequestOptions, TokenBucketRateLimiter, CursorPaginationParams, CursorPage, OffsetPaginationParams } from '@lonca/core';
|
|
1
|
+
import { Logger, BaseRequestOptions, TokenBucketRateLimiter, CursorPaginationParams, CursorPage, MutationResult, OffsetPaginationParams } from '@lonca/core';
|
|
2
2
|
|
|
3
3
|
declare const BASE_URLS: {
|
|
4
4
|
readonly prod: "https://apigw.trendyol.com";
|
|
@@ -349,7 +349,7 @@ declare class ClaimsResource {
|
|
|
349
349
|
*
|
|
350
350
|
* @throws {ValidationError} when `claimItems` is empty.
|
|
351
351
|
*/
|
|
352
|
-
create(input: CreateClaimInput): Promise<
|
|
352
|
+
create(input: CreateClaimInput): Promise<MutationResult>;
|
|
353
353
|
/**
|
|
354
354
|
* File a seller-side rejection ("ret talebi") against a customer claim.
|
|
355
355
|
*
|
|
@@ -358,14 +358,14 @@ declare class ClaimsResource {
|
|
|
358
358
|
* commas (Trendyol expects a single comma-separated string field).
|
|
359
359
|
* Attach supporting docs (PDF / JPEG) via `files: [Blob, ...]`.
|
|
360
360
|
*/
|
|
361
|
-
createIssue(claimId: string, input: CreateClaimIssueInput): Promise<
|
|
361
|
+
createIssue(claimId: string, input: CreateClaimIssueInput): Promise<MutationResult>;
|
|
362
362
|
/**
|
|
363
363
|
* Approve specific claim line items. After approval, Trendyol moves
|
|
364
364
|
* those line items into the post-approval refund / return-shipping flow.
|
|
365
365
|
*
|
|
366
366
|
* @throws {ValidationError} when `claimLineItemIdList` is empty.
|
|
367
367
|
*/
|
|
368
|
-
approveLineItems(claimId: string, input: ApproveClaimLineItemsInput): Promise<
|
|
368
|
+
approveLineItems(claimId: string, input: ApproveClaimLineItemsInput): Promise<MutationResult>;
|
|
369
369
|
/**
|
|
370
370
|
* List claims (page-based; SDK exposes opaque cursor convention).
|
|
371
371
|
*
|
|
@@ -696,7 +696,17 @@ type OtherFinancialRow = FinancialTransaction;
|
|
|
696
696
|
interface ListFinanceParams extends CursorPaginationParams {
|
|
697
697
|
startDate?: Date;
|
|
698
698
|
endDate?: Date;
|
|
699
|
+
/**
|
|
700
|
+
* **Required** by Trendyol's CHE finance API (it returns 500 without one),
|
|
701
|
+
* e.g. `'Sale'`, `'Return'`, `'Discount'`, `'DeductionInvoices'`. The SDK
|
|
702
|
+
* throws a `ValidationError` if omitted.
|
|
703
|
+
*/
|
|
699
704
|
transactionType?: string;
|
|
705
|
+
/**
|
|
706
|
+
* Page size. Trendyol's finance API only accepts **500 or 1000** — the SDK
|
|
707
|
+
* clamps any value to the nearest of those (default 500).
|
|
708
|
+
*/
|
|
709
|
+
limit?: number;
|
|
700
710
|
}
|
|
701
711
|
interface CreateCommonLabelInput {
|
|
702
712
|
/** Currently the only documented format Trendyol accepts. */
|
|
@@ -743,18 +753,28 @@ interface Country {
|
|
|
743
753
|
raw: Record<string, unknown>;
|
|
744
754
|
}
|
|
745
755
|
interface City {
|
|
756
|
+
/**
|
|
757
|
+
* Trendyol's internal city id — the value the **nested** endpoints expect
|
|
758
|
+
* (`getTurkeyDistricts(city.id)`). Distinct from `code` (the plate-style
|
|
759
|
+
* display code, e.g. `"1"` for Adana); passing `code` there returns 500.
|
|
760
|
+
*/
|
|
761
|
+
id?: string;
|
|
746
762
|
code: string;
|
|
747
763
|
name?: string;
|
|
748
764
|
countryCode?: string;
|
|
749
765
|
raw: Record<string, unknown>;
|
|
750
766
|
}
|
|
751
767
|
interface District {
|
|
768
|
+
/** Trendyol's internal district id — pass to `getTurkeyNeighborhoods(cityId, district.id)`. */
|
|
769
|
+
id?: string;
|
|
752
770
|
code: string;
|
|
753
771
|
name?: string;
|
|
754
772
|
cityCode?: string;
|
|
755
773
|
raw: Record<string, unknown>;
|
|
756
774
|
}
|
|
757
775
|
interface Neighborhood {
|
|
776
|
+
/** Trendyol's internal neighborhood id. */
|
|
777
|
+
id?: string;
|
|
758
778
|
code: string;
|
|
759
779
|
name?: string;
|
|
760
780
|
districtCode?: string;
|
|
@@ -835,13 +855,16 @@ interface ProductVariant {
|
|
|
835
855
|
raw: Record<string, unknown>;
|
|
836
856
|
}
|
|
837
857
|
/**
|
|
838
|
-
*
|
|
858
|
+
* The content fields shared by an approved {@link Product} and an unapproved
|
|
859
|
+
* (draft) {@link UnapprovedProduct} — so callers can read title / brand /
|
|
860
|
+
* category / images from either shape without branching.
|
|
839
861
|
*
|
|
840
|
-
*
|
|
841
|
-
*
|
|
862
|
+
* Intentionally just the common surface: the two diverge structurally beyond
|
|
863
|
+
* this (`Product` carries `variants[]`; `UnapprovedProduct` is flat with a root
|
|
864
|
+
* `barcode`), and their timestamp fields differ in optionality, so those stay on
|
|
865
|
+
* the concrete types.
|
|
842
866
|
*/
|
|
843
|
-
interface
|
|
844
|
-
contentId: string;
|
|
867
|
+
interface ProductContentBase {
|
|
845
868
|
productMainId: string;
|
|
846
869
|
title: string;
|
|
847
870
|
description?: string;
|
|
@@ -850,6 +873,15 @@ interface Product {
|
|
|
850
873
|
/** Image URLs in display order. */
|
|
851
874
|
images: string[];
|
|
852
875
|
attributes: ProductAttribute[];
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* A Trendyol marketplace product (approved variant).
|
|
879
|
+
*
|
|
880
|
+
* Lonca surfaces the stable fields we have verified against live Trendyol
|
|
881
|
+
* responses. Everything else stays accessible via `raw`.
|
|
882
|
+
*/
|
|
883
|
+
interface Product extends ProductContentBase {
|
|
884
|
+
contentId: string;
|
|
853
885
|
variants: ProductVariant[];
|
|
854
886
|
/** ISO 8601 UTC string (converted from Trendyol's ms-epoch). */
|
|
855
887
|
createdAt: string;
|
|
@@ -887,17 +919,12 @@ interface UnapprovedProductRejectReason {
|
|
|
887
919
|
* calls the image-list field `media`, but the live API returns it as
|
|
888
920
|
* `images`. SDK normalizes to `images`.
|
|
889
921
|
*/
|
|
890
|
-
interface UnapprovedProduct {
|
|
922
|
+
interface UnapprovedProduct extends ProductContentBase {
|
|
891
923
|
/** Seller (supplier) ID echoed back by Trendyol. */
|
|
892
924
|
supplierId?: string;
|
|
893
|
-
productMainId: string;
|
|
894
925
|
/** Lifecycle status — see `UnapprovedProductStatus`. */
|
|
895
926
|
status?: UnapprovedProductStatus;
|
|
896
|
-
brand: NamedRef;
|
|
897
|
-
category: NamedRef;
|
|
898
927
|
barcode: string;
|
|
899
|
-
title: string;
|
|
900
|
-
description?: string;
|
|
901
928
|
/** Stock quantity at the moment of the query. */
|
|
902
929
|
quantity?: number;
|
|
903
930
|
listPrice?: number;
|
|
@@ -906,9 +933,6 @@ interface UnapprovedProduct {
|
|
|
906
933
|
vatRate?: number;
|
|
907
934
|
dimensionalWeight?: number;
|
|
908
935
|
stockCode?: string;
|
|
909
|
-
/** Image URLs in display order (Trendyol's `images` field, spec says `media`). */
|
|
910
|
-
images: string[];
|
|
911
|
-
attributes: ProductAttribute[];
|
|
912
936
|
/** Populated when `status === 'rejected'`. */
|
|
913
937
|
rejectReasonDetails: UnapprovedProductRejectReason[];
|
|
914
938
|
/** Returned by Trendyol; null when the seller has not configured this. */
|
|
@@ -1145,11 +1169,11 @@ declare class InvoicesResource {
|
|
|
1145
1169
|
*
|
|
1146
1170
|
* Max 10 MB. Accepted formats: PDF, JPEG, PNG.
|
|
1147
1171
|
*/
|
|
1148
|
-
uploadFile(input: UploadInvoiceFileInput): Promise<
|
|
1172
|
+
uploadFile(input: UploadInvoiceFileInput): Promise<MutationResult>;
|
|
1149
1173
|
/** Register an invoice URL with Trendyol (alternative to uploading the file). */
|
|
1150
|
-
sendLink(input: SendInvoiceLinkInput): Promise<
|
|
1174
|
+
sendLink(input: SendInvoiceLinkInput): Promise<MutationResult>;
|
|
1151
1175
|
/** Remove a previously-registered invoice link. */
|
|
1152
|
-
deleteLink(input: DeleteInvoiceLinkInput): Promise<
|
|
1176
|
+
deleteLink(input: DeleteInvoiceLinkInput): Promise<MutationResult>;
|
|
1153
1177
|
}
|
|
1154
1178
|
|
|
1155
1179
|
/**
|
|
@@ -1193,10 +1217,20 @@ declare class LocationsResource {
|
|
|
1193
1217
|
/** List all supported countries (Türkiye + AZ + GULF + CEE). */
|
|
1194
1218
|
getCountries(): Promise<Country[]>;
|
|
1195
1219
|
getTurkeyCities(): Promise<City[]>;
|
|
1196
|
-
|
|
1197
|
-
|
|
1220
|
+
/**
|
|
1221
|
+
* List districts for a Turkish city. **Pass the city `id`** (`City.id`) — the
|
|
1222
|
+
* nested endpoint keys off Trendyol's internal id, not the display `code`, and
|
|
1223
|
+
* returns 500 for the code. Verified live.
|
|
1224
|
+
*/
|
|
1225
|
+
getTurkeyDistricts(cityId: string | number): Promise<District[]>;
|
|
1226
|
+
/**
|
|
1227
|
+
* List neighborhoods for a Turkish district. **Pass the ids** (`City.id`,
|
|
1228
|
+
* `District.id`) — not the display codes (those 500).
|
|
1229
|
+
*/
|
|
1230
|
+
getTurkeyNeighborhoods(cityId: string | number, districtId: string | number): Promise<Neighborhood[]>;
|
|
1198
1231
|
getAzerbaijanCities(): Promise<City[]>;
|
|
1199
|
-
|
|
1232
|
+
/** List districts for an Azerbaijani city. **Pass the city `id`** (`City.id`), not `code`. */
|
|
1233
|
+
getAzerbaijanDistricts(cityId: string | number): Promise<District[]>;
|
|
1200
1234
|
getCitiesByCountry(countryCode: string): Promise<City[]>;
|
|
1201
1235
|
getDistrictsByCity(countryCode: string, cityId: string | number): Promise<District[]>;
|
|
1202
1236
|
private cities;
|
|
@@ -2016,6 +2050,11 @@ declare class ProductsResource {
|
|
|
2016
2050
|
* List approved products. Use `paginate()` from `@lonca/core` to iterate
|
|
2017
2051
|
* lazily across pages.
|
|
2018
2052
|
*
|
|
2053
|
+
* **Approved only:** this endpoint silently excludes products still in review
|
|
2054
|
+
* or rejected — use {@link listUnapproved} for those. Date fields on the
|
|
2055
|
+
* returned {@link Product} (`createdAt` / `updatedAt`) are ISO 8601 UTC
|
|
2056
|
+
* **strings**, not `Date` objects.
|
|
2057
|
+
*
|
|
2019
2058
|
* Trendyol exposes both page-based and `nextPageToken`-based pagination
|
|
2020
2059
|
* (the latter required when the dataset exceeds 10,000 items). The SDK
|
|
2021
2060
|
* picks the right strategy automatically — pass our opaque `cursor` from
|
|
@@ -2624,4 +2663,4 @@ interface TrendyolClient {
|
|
|
2624
2663
|
*/
|
|
2625
2664
|
declare function createTrendyolClient(opts: CreateClientOptions): TrendyolClient;
|
|
2626
2665
|
|
|
2627
|
-
export { type FinancialTransaction as $, type ApproveClaimLineItemsInput as A, type BarcodeCategoryLookup as B, type CancelPackageItemInput as C, type Country as D, type CreateClaimInput as E, type CreateClaimIssueInput as F, type CreateClaimItemInput as G, type CreateClientOptions as H, type CreateCommonLabelInput as I, type CreateProductV2Input as J, type CreateTestOrderInput as K, type CreateVideoInput as L, type DeleteInvoiceLinkInput as M, type DeliveryOptionInput as N, type District as O, type ExportBatchAcceptedResponse as P, type ExportBatchStatus as Q, type ExportCategoryAttribute as R, ExportCenterResource as S, type ExportPackage as T, type ExportPackageItem as U, type ExportPackageStatus as V, type ExportPriceUpdateInput as W, type ExportProduct as X, type ExportProductInput as Y, type ExportStockUpdateInput as Z, FinanceResource as _, type ApprovedProductStatus as a, type
|
|
2666
|
+
export { type FinancialTransaction as $, type ApproveClaimLineItemsInput as A, type BarcodeCategoryLookup as B, type CancelPackageItemInput as C, type Country as D, type CreateClaimInput as E, type CreateClaimIssueInput as F, type CreateClaimItemInput as G, type CreateClientOptions as H, type CreateCommonLabelInput as I, type CreateProductV2Input as J, type CreateTestOrderInput as K, type CreateVideoInput as L, type DeleteInvoiceLinkInput as M, type DeliveryOptionInput as N, type District as O, type ExportBatchAcceptedResponse as P, type ExportBatchStatus as Q, type ExportCategoryAttribute as R, ExportCenterResource as S, type ExportPackage as T, type ExportPackageItem as U, type ExportPackageStatus as V, type ExportPriceUpdateInput as W, type ExportProduct as X, type ExportProductInput as Y, type ExportStockUpdateInput as Z, FinanceResource as _, type ApprovedProductStatus as a, type SuppliersResourceOptions as a$, type GetExportPackageItemsParams as a0, InventoryResource as a1, InvoicesResource as a2, type KnownShipmentPackageStatus as a3, LabelsResource as a4, type LaborCostInput as a5, type ListCategoryAttributeValuesParams as a6, type ListClaimsParams as a7, type ListCompensationTicketsParams as a8, type ListExportPackagesV2Params as a9, type ProductAttribute as aA, type ProductAttributeV2Input as aB, type ProductBase as aC, type ProductComposition as aD, type ProductContentBase as aE, type ProductImageInput as aF, type ProductOrigin as aG, type ProductStockPrice as aH, type ProductStockPriceVariant as aI, type ProductVariant as aJ, ProductsResource as aK, type QuantitySplit as aL, type Question as aM, type QuestionAnswer as aN, type QuestionStatus as aO, QuestionsResource as aP, type SellerIntegrationStatus as aQ, type SellerVideo as aR, type SendInvoiceLinkInput as aS, type SettlementRow as aT, type ShipmentPackage as aU, type ShipmentPackageStatus as aV, type SplitGroup as aW, type SplitPackagePlan as aX, type SupplierAddress as aY, type SupplierAddressType as aZ, SuppliersResource as a_, type ListExportPackagesV3Params as aa, type ListExportProductsParams as ab, type ListFinanceParams as ac, type ListInventoryAndPriceParams as ad, type ListOrdersParams as ae, type ListOrdersStreamParams as af, type ListProductsParams as ag, type ListQuestionsParams as ah, type ListUnapprovedProductsParams as ai, type ListVideosParams as aj, LocationsResource as ak, type NamedRef as al, type Neighborhood as am, type OrderAddress as an, type OrderAddressLines as ao, type OrderCustomer as ap, type OrderLine as aq, type OrderLineDiscountDetail as ar, OrdersResource as as, type OtherFinancialRow as at, type PackageDetail as au, type PackageHistoryEntry as av, type PackageLineUpdate as aw, type PriceInventoryUpdate as ax, type ProcessAlternativeDeliveryInput as ay, type Product as az, type BatchAcceptedResponse as b, type TestOrderStatus as b0, TestOrdersResource as b1, type TrendyolCapabilities as b2, type TrendyolCargoProvider as b3, type TrendyolClient as b4, type TrendyolEnvironment as b5, type UnapprovedDateQueryType as b6, type UnapprovedProduct as b7, type UnapprovedProductRejectReason as b8, type UnapprovedProductStatus as b9, type UpdateBoxInfoInput as ba, type UpdateContentInput as bb, type UpdateDeliveryInfoInput as bc, type UpdatePackageStatusInput as bd, type UpdatePriceInventoryResponse as be, type UpdateUnapprovedInput as bf, type UpdateVariantInput as bg, type UploadInvoiceFileInput as bh, VideosResource as bi, type Webhook as bj, type WebhookAuthenticationType as bk, type WebhookInput as bl, WebhooksResource as bm, createTrendyolClient as bn, normalizeShipmentPackage as bo, pollBatchStatus as bp, trendyolCapabilities as bq, type BatchPollOptions as c, type BatchRequestItemResult as d, type BatchRequestResult as e, type BatchRequestStatus as f, type Brand as g, BrandsResource as h, type BuyboxInfo as i, type CareInstruction as j, type CargoInvoiceItem as k, CategoriesResource as l, type Category as m, type CategoryAttribute as n, type CategoryAttributeValue as o, type City as p, type Claim as q, type ClaimIssueReason as r, type ClaimItemAudit as s, type ClaimItemStatus as t, ClaimsResource as u, type CommonLabel as v, type CommonLabelEntry as w, type CompensationItemDetail as x, type CompensationTicket as y, type CompensationTicketState as z };
|