symone-sdk 1.0.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 +54 -0
- package/index.d.ts +34 -0
- package/index.js +54 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# symone-sdk
|
|
2
|
+
|
|
3
|
+
JavaScript SDK for the [SYMONE](https://symone.fr) motorcycle transport API.
|
|
4
|
+
|
|
5
|
+
SYMONE is Europe's first long-distance motorcycle highway transport service. This SDK lets you search available routes between French cities (Paris, Marseille, Lyon, Nice, etc.).
|
|
6
|
+
|
|
7
|
+
**No authentication required.**
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install symone-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
const { searchRoutes, filterRoutes, getParisMarseilleCache } = require('symone-sdk');
|
|
19
|
+
|
|
20
|
+
// Get all upcoming routes
|
|
21
|
+
const routes = await searchRoutes();
|
|
22
|
+
|
|
23
|
+
// Filter Paris → Marseille
|
|
24
|
+
const results = filterRoutes(routes, { depart: 'Paris', arrival: 'Marseille' });
|
|
25
|
+
console.log(results);
|
|
26
|
+
|
|
27
|
+
// Fast cache for Paris–Marseille
|
|
28
|
+
const cache = await getParisMarseilleCache();
|
|
29
|
+
console.log(cache.trajetIds);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
### `searchRoutes()`
|
|
35
|
+
Returns all upcoming motorcycle transport routes in France as a JSON array.
|
|
36
|
+
|
|
37
|
+
### `filterRoutes(routes, options)`
|
|
38
|
+
Filter results client-side.
|
|
39
|
+
- `options.depart` — departure city name (e.g. `"Paris"`)
|
|
40
|
+
- `options.arrival` — arrival city name (e.g. `"Marseille"`)
|
|
41
|
+
- `options.date` — date in `YYYYMMDD` format
|
|
42
|
+
|
|
43
|
+
### `getParisMarseilleCache()`
|
|
44
|
+
Fast cached endpoint returning available Paris–Marseille route IDs.
|
|
45
|
+
|
|
46
|
+
### `getCitiesNear(location)`
|
|
47
|
+
Find SYMONE-served cities near a location name.
|
|
48
|
+
|
|
49
|
+
## Links
|
|
50
|
+
|
|
51
|
+
- Website: https://symone.fr
|
|
52
|
+
- API docs: https://symone.fr/api/index.md
|
|
53
|
+
- OpenAPI spec: https://symone.fr/openapi.json
|
|
54
|
+
- Pricing: https://symone.fr/pricing.md
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface Route {
|
|
2
|
+
type: 'route' | 'event';
|
|
3
|
+
id: number;
|
|
4
|
+
depart: string;
|
|
5
|
+
arrival: string;
|
|
6
|
+
date: string;
|
|
7
|
+
price_min: number;
|
|
8
|
+
price_max: number;
|
|
9
|
+
places_moto_1: number;
|
|
10
|
+
places_passenger_1: number;
|
|
11
|
+
time0: string;
|
|
12
|
+
time4: string;
|
|
13
|
+
layover1?: string;
|
|
14
|
+
layover2?: string;
|
|
15
|
+
completed: number;
|
|
16
|
+
draft: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ParisMarseilleCache {
|
|
20
|
+
trajetIds: number[];
|
|
21
|
+
cacheDate: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface FilterOptions {
|
|
26
|
+
depart?: string;
|
|
27
|
+
arrival?: string;
|
|
28
|
+
date?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function searchRoutes(): Promise<Route[]>;
|
|
32
|
+
export function getParisMarseilleCache(): Promise<ParisMarseilleCache>;
|
|
33
|
+
export function getCitiesNear(location: string): Promise<any[]>;
|
|
34
|
+
export function filterRoutes(routes: Route[], options?: FilterOptions): Route[];
|
package/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const BASE_URL = 'https://symone.fr/api-proxy';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Search all upcoming motorcycle transport routes in France.
|
|
5
|
+
* Returns a full list — filter client-side by depart/arrival/date.
|
|
6
|
+
* @returns {Promise<Array>} Array of route objects
|
|
7
|
+
*/
|
|
8
|
+
async function searchRoutes() {
|
|
9
|
+
const res = await fetch(`${BASE_URL}/route/get/results`);
|
|
10
|
+
if (!res.ok) throw new Error(`SYMONE API error: ${res.status}`);
|
|
11
|
+
return res.json();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get cached Paris–Marseille route IDs (fast).
|
|
16
|
+
* @returns {Promise<Object>} { trajetIds, cacheDate }
|
|
17
|
+
*/
|
|
18
|
+
async function getParisMarseilleCache() {
|
|
19
|
+
const res = await fetch(`${BASE_URL}/route/paris-marseille-cache`);
|
|
20
|
+
if (!res.ok) throw new Error(`SYMONE API error: ${res.status}`);
|
|
21
|
+
return res.json();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Find SYMONE-served cities near a location.
|
|
26
|
+
* @param {string} location - City name (e.g. "Paris")
|
|
27
|
+
* @returns {Promise<Array>}
|
|
28
|
+
*/
|
|
29
|
+
async function getCitiesNear(location) {
|
|
30
|
+
const res = await fetch(`${BASE_URL}/route/cities-near?location=${encodeURIComponent(location)}`);
|
|
31
|
+
if (!res.ok) throw new Error(`SYMONE API error: ${res.status}`);
|
|
32
|
+
return res.json();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Filter routes by departure and/or arrival city.
|
|
37
|
+
* @param {Array} routes - Result from searchRoutes()
|
|
38
|
+
* @param {Object} options
|
|
39
|
+
* @param {string} [options.depart] - Departure city name
|
|
40
|
+
* @param {string} [options.arrival] - Arrival city name
|
|
41
|
+
* @param {string} [options.date] - Date in YYYYMMDD format
|
|
42
|
+
* @returns {Array}
|
|
43
|
+
*/
|
|
44
|
+
function filterRoutes(routes, { depart, arrival, date } = {}) {
|
|
45
|
+
return routes.filter(r => {
|
|
46
|
+
if (r.type !== 'route') return false;
|
|
47
|
+
if (depart && r.depart !== depart) return false;
|
|
48
|
+
if (arrival && r.arrival !== arrival) return false;
|
|
49
|
+
if (date && r.date !== date) return false;
|
|
50
|
+
return true;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { searchRoutes, getParisMarseilleCache, getCitiesNear, filterRoutes };
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "symone-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "JavaScript SDK for the SYMONE motorcycle transport API. Search available routes between French cities. No authentication required.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"symone",
|
|
9
|
+
"motorcycle",
|
|
10
|
+
"transport",
|
|
11
|
+
"moto",
|
|
12
|
+
"france",
|
|
13
|
+
"api",
|
|
14
|
+
"sdk",
|
|
15
|
+
"paris",
|
|
16
|
+
"marseille",
|
|
17
|
+
"route",
|
|
18
|
+
"travel"
|
|
19
|
+
],
|
|
20
|
+
"author": "SYMONE SAS <contact@symone.fr> (https://symone.fr)",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://symone.fr/api/index.md",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/silen4-zg/symone-skills.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"email": "contact@symone.fr"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=14"
|
|
32
|
+
}
|
|
33
|
+
}
|