106 lines
3.5 KiB
TypeScript
106 lines
3.5 KiB
TypeScript
import type { Product } from "./api";
|
|
|
|
export const products: Product[] = [
|
|
{
|
|
code: "daily_hydrogen",
|
|
name: "车辆日用氢量",
|
|
description: "按自然日查询全部授权车辆或指定车牌的用氢量,并返回数据质量状态。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/vehicles/hydrogen-consumption/query",
|
|
unit: "kg"
|
|
},
|
|
{
|
|
code: "daily_mileage",
|
|
name: "车辆日里程",
|
|
description: "按自然日查询当日里程、累计总里程及实际来源协议,支持自定义协议优先级。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/vehicles/mileage/query",
|
|
unit: "km"
|
|
},
|
|
{
|
|
code: "mileage_range",
|
|
name: "车辆区间日里程",
|
|
description: "按最长 366 天区间分页查询逐日里程,支持逐车逐日自定义协议优先级。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/vehicles/mileage/range/query",
|
|
unit: "km"
|
|
},
|
|
{
|
|
code: "total_mileage_at_time",
|
|
name: "指定时刻总里程",
|
|
description: "按 VIN 和北京时间查询最近一条总里程、实际采集协议、记录时间及时间差秒数。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/vehicles/total-mileage/query",
|
|
unit: "km"
|
|
},
|
|
{
|
|
code: "realtime_vehicle",
|
|
name: "车辆实时位置与状态",
|
|
description: "查询应用授权车辆的最新位置、在线状态、速度、总里程和采集协议。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/vehicles/realtime/query",
|
|
unit: ""
|
|
},
|
|
{
|
|
code: "hydrogen_station",
|
|
name: "加氢站地图点位",
|
|
description: "只读查询资产管理库加氢站的名称、经纬度、行政区划和合作状态。",
|
|
version: "v1",
|
|
status: "available",
|
|
method: "POST",
|
|
path: "/api/v1/hydrogen-stations/query",
|
|
unit: "座"
|
|
}
|
|
];
|
|
|
|
export const curlExample = (product: Product) => {
|
|
if (product.code === "realtime_vehicle") return `curl --request POST \\
|
|
--url https://open.d.lnoneos.com${product.path} \\
|
|
--header 'Authorization: Bearer YOUR_APP_KEY' \\
|
|
--header 'Content-Type: application/json' \\
|
|
--data '{}'`;
|
|
if (product.code === "hydrogen_station") return `curl --request POST \\
|
|
--url https://open.d.lnoneos.com${product.path} \\
|
|
--header 'Authorization: Bearer YOUR_APP_KEY' \\
|
|
--header 'Content-Type: application/json' \\
|
|
--data '{"province":"浙江省"}'`;
|
|
if (product.code === "total_mileage_at_time") return `curl --request POST \\
|
|
--url https://open.d.lnoneos.com${product.path} \\
|
|
--header 'Authorization: Bearer YOUR_APP_KEY' \\
|
|
--header 'Content-Type: application/json' \\
|
|
--data '{
|
|
"vin": "LA9GG68L2PBAF4790",
|
|
"time": "2026-07-21 09:30:00",
|
|
"protocol": "GB32960"
|
|
}'`;
|
|
if (product.code === "mileage_range") return `curl --request POST \\
|
|
--url https://open.d.lnoneos.com${product.path} \\
|
|
--header 'Authorization: Bearer YOUR_APP_KEY' \\
|
|
--header 'Content-Type: application/json' \\
|
|
--data '{
|
|
"startDate": "2026-07-01",
|
|
"endDate": "2026-07-23",
|
|
"protocolPriority": ["GB32960", "MQTT", "JT808"],
|
|
"pageSize": 5000
|
|
}'`;
|
|
return `curl --request POST \\
|
|
--url https://open.d.lnoneos.com${product.path} \\
|
|
--header 'Authorization: Bearer YOUR_APP_KEY' \\
|
|
--header 'Content-Type: application/json' \\
|
|
--data '{
|
|
"plateNumbers": ["沪A12345"],
|
|
"date": "2026-07-19"${product.code === "daily_mileage" ? `,
|
|
"protocolPriority": ["GB32960", "MQTT", "JT808"]` : ""}
|
|
}'`;
|
|
};
|