encarapi 1.2.0 → 1.3.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 CHANGED
@@ -85,6 +85,15 @@ saveCursor(client.china.lastCursor);
85
85
  | `iterateCatalogById(params)` | `GET /api/catalog?sort=id` | Complete, stable traversal (keyset cursor, nothing repeated or skipped) |
86
86
  | `leasing(params)` | `GET /api/catalog/leasing` | Lease takeovers and rentals |
87
87
  | `iterateLeasingById(params)` | `GET /api/catalog/leasing?sort=id` | Complete, stable traversal of lease/rental listings |
88
+ | `vehicleByVin(vin)` | `GET /api/vehicle/by-vin/{vin}` | All listings of one VIN incl. removed ones (Business/Scale) |
89
+ | `trucks(params)` | `GET /api/catalog/trucks` | Trucks, buses and special vehicles (Business/Scale) |
90
+ | `truckEnums()` | `GET /api/catalog/trucks/enums` | Truck filter values with counts |
91
+ | `trucksCsv()` | `GET /api/catalog/trucks/export` | Full truck inventory CSV (Business/Scale) |
92
+ | `iterateTrucksById(params)` | `GET /api/catalog/trucks?sort=id` | Complete, stable traversal of the truck catalog |
93
+ | `equipment(params)` | `GET /api/catalog/equipment` | Used excavators (Business/Scale) |
94
+ | `equipmentEnums()` | `GET /api/catalog/equipment/enums` | Equipment filter values with counts |
95
+ | `equipmentCsv()` | `GET /api/catalog/equipment/export` | Full equipment inventory CSV (Business/Scale) |
96
+ | `iterateEquipmentById(params)` | `GET /api/catalog/equipment?sort=id` | Complete, stable traversal of the equipment catalog |
88
97
  | `nav(params)` | `GET /api/nav` | Filter facets with counts |
89
98
  | `enums(params)` | `GET /api/enums` | Valid values for the flat filters |
90
99
  | `modelSearch(search, params)` | `GET /api/model-search` | Model autocomplete |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "encarapi",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Official Node.js client for EnCarAPI: Korean used car data (Encar, KB Chachacha, K Car) and Chinese used car data (Dongchedi, Che168) in one REST API.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/index.d.ts CHANGED
@@ -81,6 +81,58 @@ export interface KoreaCatalogParams {
81
81
  count?: Bool;
82
82
  }
83
83
 
84
+ /** Filters for /api/catalog/trucks. Values from korea.truckEnums(). */
85
+ export interface KoreaTruckParams {
86
+ form?: "cargo" | "wing_body" | "bus" | "dump_construction" | "crane" | "tank" | "camper" | "waste_transport" | "live_fish" | "tow_transport" | "tractor" | "trailer" | (string & {});
87
+ manufacturer?: string;
88
+ /** Substring of the Korean model name, e.g. "포터". */
89
+ model?: string;
90
+ min_tons?: number;
91
+ max_tons?: number;
92
+ use?: "private" | "commercial" | "other";
93
+ fuel?: string;
94
+ transmission?: string;
95
+ color?: string;
96
+ min_price?: number;
97
+ max_price?: number;
98
+ min_year?: number;
99
+ max_year?: number;
100
+ min_mileage?: number;
101
+ max_mileage?: number;
102
+ region?: string;
103
+ sort?: "newest" | "price_asc" | "price_desc" | "mileage_asc" | "mileage_desc" | "year_desc" | "year_asc" | "id";
104
+ after?: string;
105
+ page?: number;
106
+ limit?: number;
107
+ count?: Bool;
108
+ lang?: "en";
109
+ }
110
+
111
+ /** Filters for /api/catalog/equipment. Values from korea.equipmentEnums(). */
112
+ export interface KoreaEquipmentParams {
113
+ maker?: string;
114
+ model?: string;
115
+ sub_type?: "crawler" | "wheel" | (string & {});
116
+ /** e.g. "EXC_CR_LE_6_5" (02 class crawler). */
117
+ weight_class?: string;
118
+ min_year?: number;
119
+ max_year?: number;
120
+ min_hours?: number;
121
+ max_hours?: number;
122
+ /** Price in 만원 (10,000 KRW). */
123
+ min_price?: number;
124
+ max_price?: number;
125
+ has_price?: Bool;
126
+ /** "sell" (default), "buy", "rent", a comma list or "all". */
127
+ deal_type?: string;
128
+ region?: string;
129
+ sort?: "newest" | "price_asc" | "price_desc" | "hours_asc" | "year_desc" | "year_asc" | "id";
130
+ after?: string;
131
+ page?: number;
132
+ limit?: number;
133
+ count?: Bool;
134
+ }
135
+
84
136
  export interface KoreaCatalogResponse {
85
137
  Count?: number;
86
138
  SearchResults: Json[];
@@ -130,6 +182,24 @@ export class KoreaClient {
130
182
  iterateCatalogById(params?: KoreaCatalogParams): AsyncGenerator<Json, void, unknown>;
131
183
  /** iterateCatalogById() for lease-takeover and rental listings. */
132
184
  iterateLeasingById(params?: KoreaCatalogParams): AsyncGenerator<Json, void, unknown>;
185
+ /** Encar trucks, buses and special vehicles (Business/Scale). */
186
+ trucks(params?: KoreaTruckParams): Promise<KoreaCatalogResponse>;
187
+ /** Every Encar / K Car listing of one VIN, active and removed (Business/Scale). */
188
+ vehicleByVin(vin: string): Promise<Json>;
189
+ /** Valid truck filter values with counts. */
190
+ truckEnums(): Promise<Json>;
191
+ /** Full truck inventory as CSV text (Business/Scale). */
192
+ trucksCsv(params?: { compress?: Bool }): Promise<string>;
193
+ /** Complete, stable traversal of the truck catalog (sort=id + after). */
194
+ iterateTrucksById(params?: KoreaTruckParams): AsyncGenerator<Json, void, unknown>;
195
+ /** Used excavators from 굴삭기나라 (Business/Scale). */
196
+ equipment(params?: KoreaEquipmentParams): Promise<KoreaCatalogResponse>;
197
+ /** Valid equipment filter values with counts. */
198
+ equipmentEnums(): Promise<Json>;
199
+ /** Full equipment inventory as CSV text (Business/Scale). */
200
+ equipmentCsv(params?: { compress?: Bool }): Promise<string>;
201
+ /** Complete, stable traversal of the equipment catalog (sort=id + after). */
202
+ iterateEquipmentById(params?: KoreaEquipmentParams): AsyncGenerator<Json, void, unknown>;
133
203
  /** Ids: Encar id, "kbc:<id>" or "kcar:<id>". */
134
204
  vehicle(id: string, params?: { lang?: "en" }): Promise<Json>;
135
205
  inspection(id: string): Promise<Json>;
package/src/korea.js CHANGED
@@ -64,6 +64,38 @@ class KoreaClient {
64
64
  yield* this._iterateById("/api/catalog/leasing", params);
65
65
  }
66
66
 
67
+ // -- trucks, buses, special vehicles (Business/Scale) ----------------------
68
+
69
+ /** Encar trucks & buses: { form: "cargo", max_tons: 1, lang: "en" }. Values from truckEnums(). */
70
+ trucks(params) { return this.http.request("GET", "/api/catalog/trucks", { params }); }
71
+
72
+ /** Valid truck filter values with counts (form, use, fuel, transmission, color, manufacturer, capacity_tons, region). */
73
+ truckEnums() { return this.http.request("GET", "/api/catalog/trucks/enums"); }
74
+
75
+ /** Full truck inventory as CSV text (Business/Scale). */
76
+ trucksCsv(params) { return this.http.request("GET", "/api/catalog/trucks/export", { params, text: true }); }
77
+
78
+ /** Complete, stable traversal of the truck catalog (sort=id + after). */
79
+ async *iterateTrucksById(params = {}) {
80
+ yield* this._iterateById("/api/catalog/trucks", params);
81
+ }
82
+
83
+ // -- construction equipment / excavators (Business/Scale) -----------------
84
+
85
+ /** Used excavators from 굴삭기나라: { sub_type: "crawler", max_hours: 5000 }. Values from equipmentEnums(). */
86
+ equipment(params) { return this.http.request("GET", "/api/catalog/equipment", { params }); }
87
+
88
+ /** Valid equipment filter values with counts (maker, sub_type, weight_class, deal_type, region). */
89
+ equipmentEnums() { return this.http.request("GET", "/api/catalog/equipment/enums"); }
90
+
91
+ /** Full equipment inventory as CSV text (Business/Scale). */
92
+ equipmentCsv(params) { return this.http.request("GET", "/api/catalog/equipment/export", { params, text: true }); }
93
+
94
+ /** Complete, stable traversal of the equipment catalog (sort=id + after). */
95
+ async *iterateEquipmentById(params = {}) {
96
+ yield* this._iterateById("/api/catalog/equipment", params);
97
+ }
98
+
67
99
  async *_iterateById(path, params) {
68
100
  const { page, ...rest } = params;
69
101
  let query = { ...rest, sort: "id", limit: params.limit || 1000 };
@@ -80,6 +112,9 @@ class KoreaClient {
80
112
  /** Full vehicle detail. Ids: Encar id, "kbc:<id>" or "kcar:<id>". */
81
113
  vehicle(id, params) { return this.http.request("GET", `/api/vehicle/${enc(id)}`, { params }); }
82
114
 
115
+ /** Every Encar / K Car listing of one VIN, active and removed (Business/Scale). */
116
+ vehicleByVin(vin) { return this.http.request("GET", `/api/vehicle/by-vin/${enc(vin)}`); }
117
+
83
118
  /** Official inspection report (성능점검). */
84
119
  inspection(id) { return this.http.request("GET", `/api/inspection/${enc(id)}`); }
85
120