Skip to content

Commit aaa3a86

Browse files
authored
Rust model for GBFS v3.1-RC2 (#185)
* copy 3.0 => 3.1RC2 Signed-off-by: GitHub <[email protected]> * Update examples Signed-off-by: GitHub <[email protected]> * rename `use`s Signed-off-by: GitHub <[email protected]> * Add `vehicle_availability.json` Signed-off-by: GitHub <[email protected]> * `vehicle_availability` Signed-off-by: tdelmas <[email protected]> * `manifest`: `area` and `country_code` Signed-off-by: tdelmas <[email protected]> * `station_information`: `city` Signed-off-by: tdelmas <[email protected]> * `system_pricing_plans`: `reservation_price_per_min`, `reservation_price_flat_rate` and `fare_capping` Signed-off-by: tdelmas <[email protected]> * Fix `interval` type Signed-off-by: tdelmas <[email protected]> * Normalize floats in example Signed-off-by: tdelmas <[email protected]> * Fix `max_range_meters` type Signed-off-by: tdelmas <[email protected]> * Update README to say that it includes v 3.1-RC2 Signed-off-by: tdelmas <[email protected]> * Bump rust crate version to `0.1.4` Signed-off-by: tdelmas <[email protected]> --------- Signed-off-by: GitHub <[email protected]> Signed-off-by: tdelmas <[email protected]>
1 parent cbfbbfe commit aaa3a86

39 files changed

+2573
-3
lines changed

models/rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gbfs_types"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
edition = "2021"
55
license = "Apache-2.0"
66
description = "Types for GBFS"

models/rust/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cargo add gbfs_types
1818
```
1919

2020
## Versions
21-
Currently only version 3.0 of GBFS is supported
21+
Currently only versions 3.0 and 3.1-RC2 of GBFS are supported
2222

2323
## Example Code (Types)
2424
```rust
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"feeds": [
7+
{
8+
"name": "system_information",
9+
"url": "https://www.example.com/gbfs/1/system_information"
10+
},
11+
{
12+
"name": "station_information",
13+
"url": "https://www.example.com/gbfs/1/station_information"
14+
}
15+
]
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"versions": [
7+
{
8+
"version": "2.0",
9+
"url": "https://www.example.com/gbfs/2/gbfs"
10+
},
11+
{
12+
"version": "3.1-RC",
13+
"url": "https://www.example.com/gbfs/3.1-RC/gbfs"
14+
}
15+
]
16+
}
17+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"geofencing_zones": {
7+
"type": "FeatureCollection",
8+
"features": [
9+
{
10+
"type": "Feature",
11+
"geometry": {
12+
"type": "MultiPolygon",
13+
"coordinates": [
14+
[
15+
[
16+
[
17+
-122.578067,
18+
45.562982
19+
],
20+
[
21+
-122.661838,
22+
45.562741
23+
],
24+
[
25+
-122.661151,
26+
45.504542
27+
],
28+
[
29+
-122.578926,
30+
45.5046625
31+
],
32+
[
33+
-122.578067,
34+
45.562982
35+
]
36+
]
37+
]
38+
]
39+
},
40+
"properties": {
41+
"name": [
42+
{
43+
"text": "NE 24th/NE Knott",
44+
"language": "en"
45+
}
46+
],
47+
"start": "2023-07-17T13:34:13+02:00",
48+
"end": "2024-07-18T13:34:13+02:00",
49+
"rules": [
50+
{
51+
"vehicle_type_ids": [
52+
"moped1",
53+
"car1"
54+
],
55+
"ride_start_allowed": true,
56+
"ride_end_allowed": true,
57+
"ride_through_allowed": true,
58+
"maximum_speed_kph": 10,
59+
"station_parking": true
60+
}
61+
]
62+
}
63+
}
64+
]
65+
},
66+
"global_rules": [
67+
{
68+
"ride_start_allowed": false,
69+
"ride_end_allowed": false,
70+
"ride_through_allowed": true
71+
}
72+
]
73+
}
74+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"datasets": [
7+
{
8+
"system_id": "example_berlin",
9+
"versions": [
10+
{
11+
"version": "2.0",
12+
"url": "https://berlin.example.com/gbfs/2/gbfs"
13+
},
14+
{
15+
"version": "3.1-RC",
16+
"url": "https://berlin.example.com/gbfs/3.1-RC/gbfs"
17+
}
18+
],
19+
"area": {
20+
"type": "MultiPolygon",
21+
"coordinates": [
22+
[
23+
[
24+
[
25+
13.10821,
26+
52.58563
27+
],
28+
[
29+
13.29743,
30+
52.67046
31+
],
32+
[
33+
13.48451,
34+
52.6855
35+
],
36+
[
37+
13.77993,
38+
52.43458
39+
],
40+
[
41+
13.65355,
42+
52.33048
43+
],
44+
[
45+
13.08165,
46+
52.38793
47+
],
48+
[
49+
13.10821,
50+
52.58563
51+
]
52+
]
53+
]
54+
]
55+
},
56+
"country_code": "DE"
57+
},
58+
{
59+
"system_id": "example_paris",
60+
"versions": [
61+
{
62+
"version": "2.0",
63+
"url": "https://paris.example.com/gbfs/2/gbfs"
64+
},
65+
{
66+
"version": "3.1-RC",
67+
"url": "https://paris.example.com/gbfs/3.1-RC/gbfs"
68+
}
69+
],
70+
"area": {
71+
"type": "MultiPolygon",
72+
"coordinates": [
73+
[
74+
[
75+
[
76+
2.14306,
77+
48.89971
78+
],
79+
[
80+
2.36707,
81+
48.99455
82+
],
83+
[
84+
2.60219,
85+
49.01987
86+
],
87+
[
88+
2.615,
89+
48.69025
90+
],
91+
[
92+
2.52167,
93+
48.6867
94+
],
95+
[
96+
2.26838,
97+
48.73275
98+
],
99+
[
100+
2.13103,
101+
48.80833
102+
],
103+
[
104+
2.14306,
105+
48.89971
106+
]
107+
]
108+
]
109+
]
110+
},
111+
"country_code": "FR"
112+
}
113+
]
114+
}
115+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"stations": [
7+
{
8+
"station_id": "pga",
9+
"name": [
10+
{
11+
"text": "Parking garage A",
12+
"language": "en"
13+
}
14+
],
15+
"lat": 12.345678,
16+
"lon": 45.678901,
17+
"station_opening_hours": "Su-Th 05:00-22:00; Fr-Sa 05:00-01:00",
18+
"parking_type": "underground_parking",
19+
"parking_hoop": false,
20+
"contact_phone": "+33109874321",
21+
"is_charging_station": true,
22+
"vehicle_docks_capacity": [
23+
{
24+
"vehicle_type_ids": [
25+
"abc123"
26+
],
27+
"count": 7
28+
}
29+
]
30+
}
31+
]
32+
}
33+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"stations": [
7+
{
8+
"station_id": "station12",
9+
"name": [
10+
{
11+
"text": "SE Belmont & SE 10th",
12+
"language": "en"
13+
}
14+
],
15+
"lat": 45.516445,
16+
"lon": -122.655775,
17+
"city": "Portland, OR",
18+
"is_valet_station": false,
19+
"is_virtual_station": true,
20+
"is_charging_station": false,
21+
"station_area": {
22+
"type": "MultiPolygon",
23+
"coordinates": [
24+
[
25+
[
26+
[
27+
-122.655775,
28+
45.516445
29+
],
30+
[
31+
-122.655705,
32+
45.516445
33+
],
34+
[
35+
-122.655705,
36+
45.516495
37+
],
38+
[
39+
-122.655775,
40+
45.516495
41+
],
42+
[
43+
-122.655775,
44+
45.516445
45+
]
46+
]
47+
]
48+
]
49+
},
50+
"capacity": 16,
51+
"vehicle_types_capacity": [
52+
{
53+
"vehicle_type_ids": [
54+
"abc123",
55+
"def456"
56+
],
57+
"count": 15
58+
},
59+
{
60+
"vehicle_type_ids": [
61+
"def456"
62+
],
63+
"count": 1
64+
}
65+
]
66+
}
67+
]
68+
}
69+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"last_updated": "2023-07-17T13:34:13+02:00",
3+
"ttl": 300,
4+
"version": "3.1-RC",
5+
"data": {
6+
"stations": [
7+
{
8+
"station_id": "425",
9+
"name": [
10+
{
11+
"text": "Coppertail",
12+
"language": "en"
13+
}
14+
],
15+
"lat": 27.956333,
16+
"lon": -82.430436,
17+
"rental_uris": {
18+
"android": "https://www.example.com/app?sid=1234567890&platform=android",
19+
"ios": "https://www.example.com/app?sid=1234567890&platform=ios"
20+
}
21+
}
22+
]
23+
}
24+
}

0 commit comments

Comments
 (0)