@lonca/trendyol 0.11.3 → 0.13.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-DMndJSb0.d.cts} +33 -3
- package/dist/{client-BJjLOn4v.d.ts → client-DMndJSb0.d.ts} +33 -3
- package/dist/index.cjs +38 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +31 -9
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +30 -9
- 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 +30 -9
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.cjs
CHANGED
|
@@ -716,12 +716,20 @@ var FinanceResource = class {
|
|
|
716
716
|
);
|
|
717
717
|
}
|
|
718
718
|
async queryPage(path, params) {
|
|
719
|
-
|
|
719
|
+
if (!params.transactionType) {
|
|
720
|
+
throw new core.ValidationError({
|
|
721
|
+
message: "finance: transactionType is required (Trendyol returns 500 without it) \u2014 pass e.g. { transactionType: 'Sale' }."
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
const size = (params.limit ?? 500) > 500 ? 1e3 : 500;
|
|
720
725
|
const page = params.cursor ? Number.parseInt(params.cursor, 10) : 0;
|
|
721
|
-
const query = {
|
|
726
|
+
const query = {
|
|
727
|
+
page,
|
|
728
|
+
size,
|
|
729
|
+
transactionType: params.transactionType
|
|
730
|
+
};
|
|
722
731
|
if (params.startDate) query.startDate = params.startDate.getTime();
|
|
723
732
|
if (params.endDate) query.endDate = params.endDate.getTime();
|
|
724
|
-
if (params.transactionType) query.transactionType = params.transactionType;
|
|
725
733
|
const data = await this.transport.request({
|
|
726
734
|
method: "GET",
|
|
727
735
|
path,
|
|
@@ -998,22 +1006,32 @@ var LocationsResource = class {
|
|
|
998
1006
|
async getTurkeyCities() {
|
|
999
1007
|
return this.cities(`/integration/member/countries/domestic/TR/cities`);
|
|
1000
1008
|
}
|
|
1001
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* List districts for a Turkish city. **Pass the city `id`** (`City.id`) — the
|
|
1011
|
+
* nested endpoint keys off Trendyol's internal id, not the display `code`, and
|
|
1012
|
+
* returns 500 for the code. Verified live.
|
|
1013
|
+
*/
|
|
1014
|
+
async getTurkeyDistricts(cityId) {
|
|
1002
1015
|
return this.districts(
|
|
1003
|
-
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(
|
|
1016
|
+
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(cityId))}/districts`
|
|
1004
1017
|
);
|
|
1005
1018
|
}
|
|
1006
|
-
|
|
1019
|
+
/**
|
|
1020
|
+
* List neighborhoods for a Turkish district. **Pass the ids** (`City.id`,
|
|
1021
|
+
* `District.id`) — not the display codes (those 500).
|
|
1022
|
+
*/
|
|
1023
|
+
async getTurkeyNeighborhoods(cityId, districtId) {
|
|
1007
1024
|
return this.neighborhoods(
|
|
1008
|
-
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(
|
|
1025
|
+
`/integration/member/countries/domestic/TR/cities/${encodeURIComponent(String(cityId))}/districts/${encodeURIComponent(String(districtId))}/neighborhoods`
|
|
1009
1026
|
);
|
|
1010
1027
|
}
|
|
1011
1028
|
async getAzerbaijanCities() {
|
|
1012
1029
|
return this.cities(`/integration/member/countries/domestic/AZ/cities`);
|
|
1013
1030
|
}
|
|
1014
|
-
|
|
1031
|
+
/** List districts for an Azerbaijani city. **Pass the city `id`** (`City.id`), not `code`. */
|
|
1032
|
+
async getAzerbaijanDistricts(cityId) {
|
|
1015
1033
|
return this.districts(
|
|
1016
|
-
`/integration/member/countries/domestic/AZ/cities/${encodeURIComponent(String(
|
|
1034
|
+
`/integration/member/countries/domestic/AZ/cities/${encodeURIComponent(String(cityId))}/districts`
|
|
1017
1035
|
);
|
|
1018
1036
|
}
|
|
1019
1037
|
// ─── International (GULF / CEE) ───────────────────────────────────────
|
|
@@ -1033,6 +1051,7 @@ var LocationsResource = class {
|
|
|
1033
1051
|
rateLimiter: this.limiter
|
|
1034
1052
|
});
|
|
1035
1053
|
return n(data, (node) => ({
|
|
1054
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1036
1055
|
code: String(node.code ?? node.id ?? ""),
|
|
1037
1056
|
name: node.name,
|
|
1038
1057
|
countryCode: node.countryCode
|
|
@@ -1045,6 +1064,7 @@ var LocationsResource = class {
|
|
|
1045
1064
|
rateLimiter: this.limiter
|
|
1046
1065
|
});
|
|
1047
1066
|
return n(data, (node) => ({
|
|
1067
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1048
1068
|
code: String(node.code ?? node.id ?? ""),
|
|
1049
1069
|
name: node.name,
|
|
1050
1070
|
cityCode: node.cityCode !== void 0 ? String(node.cityCode) : void 0
|
|
@@ -1057,6 +1077,7 @@ var LocationsResource = class {
|
|
|
1057
1077
|
rateLimiter: this.limiter
|
|
1058
1078
|
});
|
|
1059
1079
|
return n(data, (node) => ({
|
|
1080
|
+
id: node.id !== void 0 ? String(node.id) : void 0,
|
|
1060
1081
|
code: String(node.code ?? node.id ?? ""),
|
|
1061
1082
|
name: node.name,
|
|
1062
1083
|
districtCode: node.districtCode !== void 0 ? String(node.districtCode) : void 0
|