-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandard_covoit.yaml
742 lines (702 loc) · 24.3 KB
/
standard_covoit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
openapi: 3.0.1
info:
title: ""
description: ""
version: 0.0.1
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
tags:
- name: Search
description: API routes to search for journeys. These routes can be left opened to public.
#
# API Routes
#
paths:
/driver_journeys:
get:
tags:
- Search
summary: Search for matching punctual planned outward driver journeys.
description: Route used to retrieve a collection of punctual planned outward driver journeys matching the provided criteria.
operationId: getDriverJourneys
parameters:
- $ref: '#/components/parameters/departureLat'
- $ref: '#/components/parameters/departureLng'
- $ref: '#/components/parameters/arrivalLat'
- $ref: '#/components/parameters/arrivalLng'
- $ref: '#/components/parameters/departureDate'
- $ref: '#/components/parameters/timeDelta'
- $ref: '#/components/parameters/departureRadius'
- $ref: '#/components/parameters/arrivalRadius'
- $ref: '#/components/parameters/count'
responses:
200:
description: Ok. Request processed successfully.
content:
application/json:
schema:
title: DriverJourneys
type: array
items:
$ref: '#/components/schemas/DriverJourney'
400:
description: Bad Request. See error message.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
401:
description: Unauthorized. You must authenticate.
429:
description: Too Many Requests. Please slow down.
headers:
Retry-After:
description: |-
How long to wait before making a new request (in seconds).
schema:
type: integer
500:
description: Internal Server Error. Please try again later.
/passenger_journeys:
get:
tags:
- Search
summary: Search for matching punctual planned outward passenger journeys.
description: Route used to retrieve a collection of punctual planned outward passenger journeys matching the provided criteria.
operationId: getPassengerJourneys
parameters:
- $ref: '#/components/parameters/departureLat'
- $ref: '#/components/parameters/departureLng'
- $ref: '#/components/parameters/arrivalLat'
- $ref: '#/components/parameters/arrivalLng'
- $ref: '#/components/parameters/departureDate'
- $ref: '#/components/parameters/timeDelta'
- $ref: '#/components/parameters/departureRadius'
- $ref: '#/components/parameters/arrivalRadius'
- $ref: '#/components/parameters/count'
responses:
200:
description: Ok. Request processed successfully.
content:
application/json:
schema:
title: PassengerJourneys
type: array
items:
$ref: '#/components/schemas/PassengerJourney'
400:
description: Bad Request. See error message.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
401:
description: Unauthorized. You must authenticate.
429:
description: Too Many Requests. Please slow down.
headers:
Retry-After:
description: |-
How long to wait before making a new request (in seconds).
schema:
type: integer
500:
description: Internal Server Error. Please try again later.
/booking:
post:
tags:
- Interact
summary: Send a booking request to the owner of a journey.
description: Route used to allow a user to book a carpool to the owner of a journey. While posting a new Booking, its status shall always be set first as `status=pending`.
_Reminder:_ The sender must also store the Booking object, and be ready to receive modifications of it through the PATCH /bookings
operationId: postBookings
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
responses:
200:
description: Ok. Request processed successfully.
content:
application/json:
schema:
title: PassengerJourneys
type: array
items:
$ref: '#/components/schemas/Booking'
400:
description: Bad Request. See error message.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
401:
description: Unauthorized. You must authenticate.
429:
description: Too Many Requests. Please slow down.
headers:
Retry-After:
description: |-
How long to wait before making a new request (in seconds).
schema:
type: integer
500:
description: Internal Server Error. Please try again later.
/bookings/{bookingId}:
patch:
tags:
- Interact
summary: Updates status of an existing Booking object.
description: Route used to update the status of an existing Booking object. Should be used usually just to accept or reject an existing Booking.
operationId: patchBookings
parameters:
- name: bookingId
in: path
required: true
schema:
$ref: '#/components/schemas/bookingId'
- name: status
description: New status of the Booking.
in: query
required: true
schema:
$ref: '#/components/schemas/bookingStatus'
responses:
200:
description: Successful operation.
401:
description: Unauthorized. Error code can be among `access_denied, missing_booking_ownerhsip` .
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
404:
description: The targeted journey, booking or user no more exists. Error code can be among `missing_journey, missing_booking, missing_user` .
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
409:
description: Conflict. This booking has already the new status requested. Error code is `status_already_set`.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
get:
tags:
- Interact
summary: Retrieves an existing Booking object.
description: Route used to retrieve the details of an existing Booking object. Can only be used by the opeartor having created the Booking object. This route is provided to check if the Booking object state is similar between two operators, but its usage should be required to handle the full use case of a booking.
operationId: getBookings
parameters:
- name: bookingId
in: path
required: true
schema:
$ref: '#/components/schemas/bookingId'
responses:
200:
description: Successful operation.
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
401:
description: Unauthorized. Error code can be among `access_denied, missing_booking_ownerhsip` .
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
404:
description: This Booking object no more exists. Error code can be among `missing_journey, missing_booking, missing_user` .
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: |-
Explain why the request couldn't be processed.
/status:
get:
tags:
- status
summary: Give health status of the webservice.
responses:
200:
description: Ok. Webservice is available.
429:
description: Too Many Requests. Please slow down.
headers:
Retry-After:
description: |-
How long to wait before making a new request (in seconds).
schema:
type: integer
500:
description: Internal Server Error. Please try again later.
#
# Schemas
#
components:
parameters:
departureLat:
name: departureLat
in: query
required: true
schema:
type: number
description: Latitude of searched departure point.
departureLng:
name: departureLng
in: query
description: Longitude of searched departure point.
required: true
schema:
type: number
arrivalLat:
name: arrivalLat
in: query
description: Latitude of searched arrival point.
required: true
schema:
type: number
arrivalLng:
name: arrivalLng
in: query
description: Longitude of searched arrival point.
required: true
schema:
type: number
departureDate:
name: departureDate
in: query
description: Departure datetime using a UNIX UTC timestamp in seconds.
schema:
type: integer
timeDelta:
name: timeDelta
in: query
description: Time margin in seconds. The retrieved journeys must match the
given time parameters within a +`timeDelta` / -`timeDelta` interval .
schema:
type: integer
default: 900
departureRadius:
name: departureRadius
in: query
description: Search radius in kilometers around the departure point.
schema:
type: number
default: 1.0
arrivalRadius:
name: arrivalRadius
in: query
description: Search radius in kilometers around the arrival point.
schema:
type: number
default: 1.0
count:
name: count
in: query
description: Maximum number of returned journeys. If missing, all matching
journeys are returned.
schema:
type: integer
schemas:
Journey:
title: Journey
required:
- id
- duration
- passengerPickupDate
- passengerPickupLat
- passengerPickupLng
- passengerDropLat
- passengerDropLng
- type
- webUrl
type: object
properties:
id:
type: string
minLength: 1
maxLength: 255
description: Journey's id.
In order to be a basis for carpool proof, this id must match the `journey_id` that could be provided to a carpool proof register as described for example in [this documentation of an open source product for France](https://tech.covoiturage.beta.gouv.fr/partners/preuves/schema.html#schema-json-complet).
passengerPickupDate:
type: number
description: |-
Passenger pickup datetime as a UNIX UTC timestamp in seconds.
format: long
passengerPickupLat:
type: "number"
format: "double"
description: Latitude of the passenger pick-up point.
passengerPickupLng:
type: "number"
format: "double"
description: Longitude of the passenger pick-up point.
passengerDropLat:
type: "number"
format: "double"
description: Latitude of the passenger drop-off point.
passengerDropLng:
type: "number"
format: "double"
description: Longitude of the passenger drop-off point.
passengerPickupAddress:
type: string
description: String representing the pickup-up address.
passengerDropAddress:
type: string
description: String representing the drop-off address.
duration:
type: integer
description: Carpooling duration in seconds.
webUrl:
type: string
description: URL of the journey on the webservice provider platform.
type:
type: string
description: |-
Type of journey. A dynamic journey is happening in real time.
enum:
- PLANNED
- DYNAMIC
- LINE
distance:
type: "integer"
description: Carpooling distance in meters.
driverDepartureDate:
type: number
description: |-
Driver departure datetime as a UNIX UTC timestamp in seconds.
format: long
driverDepartureLat:
type: "number"
format: "double"
description: Latitude of the departure.
driverDepartureLng:
type: "number"
format: "double"
description: Longitude of the departure.
driverArrivalLat:
type: "number"
format: "double"
description: Latitude of the arrival.
driverArrivalLng:
type: "number"
format: "double"
description: Longitude of the arrival.
driverDepartureAddress:
type: string
description: String representing the departure address of the driver.
driverArrivalAddress:
type: string
description: String representing the arrival address of the driver.
journeyPolyline:
type: string
description: |-
Carpooling journey itinerary as a
[Google Encoded Polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm).
price:
$ref: '#/components/schemas/Price'
preferences:
$ref: '#/components/schemas/Preferences'
deepLink:
$ref: '#/components/schemas/DeepLink'
DriverJourney:
allOf:
- $ref: '#/components/schemas/Journey'
- type: object
required:
- driver
properties:
driver:
$ref: '#/components/schemas/User'
availableSeats:
type: integer
description: If a driver journey, available seats.
car:
$ref: '#/components/schemas/Car'
departureToPickupWalkingTime:
type: integer
description: |-
Walking time from the requested departure location
to the pick-up location.
dropoffToArrivalWalkingTime:
type: integer
description: |-
Walking time to the requested arrival location
from the drop-off location.
departureToPickupWalkingDistance:
type: integer
description: |-
Walking distance from the requested departure location
to the pick-up location.
dropoffToArrivalWalkingDistance:
type: integer
description: |-
Walking distance to the requested arrival location
from the drop-off location.
departureToPickupWalkingPolyline:
type: string
description: |-
Walking
[Google Encoded Polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
from the requested departure location to the pick-up location.
dropoffToArrivalWalkingPolyline:
type: string
description: |-
Walking
[Google Encoded Polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
to the requested arrival location from the drop-off location.
PassengerJourney:
allOf:
- $ref: '#/components/schemas/Journey'
- type: object
required:
- passenger
properties:
passenger:
$ref: '#/components/schemas/User'
requestedSeats:
type: integer
description: If a passenger journey, requested seats.
Price:
type: object
properties:
type:
type: string
description: |-
Either « FREE », « PAYING » or « UNKNOWN ». « UNKNOWN » is given
when it should be « PAYING » but we cannot set the price yet.
enum:
- FREE
- PAYING
- UNKNOWN
amount:
type: number
description: Carpooling passenger cost in euros.
format: float
currency:
type: string
description: ISO 4217 code representing the currency of the price.
User:
type: object
required:
- id
- alias
properties:
id:
type: string
description: User's unique identifier.
alias:
type: string
description: User's alias.
firstName:
type: string
description: User's first name.
lastName:
type: string
description: User's last name.
grade:
type: integer
minimum: 1
maximum: 5
description: User's grade from 1 to 5.
picture:
type: string
description: User's profile picture absolute URL.
gender:
type: string
description: User's gender. 'O' stands for 'Other'.
enum:
- F
- M
- O
verifiedIdentity:
type: boolean
description: true if the identity of this user has been verified by the operator or a third party; and the firstName, lastName, birthdate have been confirmed as identitical to an official identity proof document. Can be left empty if the information is not available.
Preferences:
type: object
properties:
smoking:
type: boolean
description: |-
If driver journey, specifies if the driver allows smoking in the car.
animals:
type: boolean
description: |-
If driver journey, specifies if the driver allows animals in the car.
music:
type: boolean
description: |-
If driver journey, specifies if the driver enjoys music in the car.
isTalker:
type: boolean
description: |-
If driver journey, specifies if the driver enjoys talking with passengers.
luggageSize:
type: integer
minimum: 1
maximum: 5
description: |-
If driver journey, specifies the size of allowed luggages.
From very small (1) to very big (5).
Car:
type: object
properties:
model:
type: string
description: Model of the car.
brand:
type: string
description: Brand of the car.
DeepLink:
type: object
description: Platform specific deep-link configurations.
properties:
android:
type: object
properties:
uri:
type: string
description: |-
URI compliant with Android conventions to open the webservice
provider mobile app on the screen presenting the specific journey
(see [this guide](https://blog.branch.io/technical-guide-to-deep-linking-on-android-chrome-intents/) for more details).
storeUrl:
type: string
description: |-
URL of the webservice provider mobile app on the PlayStore
in case the app is not yet installed on the device.
ios:
type: object
properties:
universalLink:
type: string
description: |-
URI compliant with iOS conventions to open the webservice
provider mobile app on the screen presenting the specific journey.
ConnectionMessage:
type: object
required:
- driverJourneyId
- driverUserid
- passengerJourneyId
- passengerUserid
properties:
driverJourneyId:
$ref: '#/components/schemas/journeyId'
driverUserid:
type: string
description: User's id as retrieved by the route GET /driver_journeys.
driverAlias:
type: string
description: Driver's name alias.
details:
type: string
maxLength: 500
description: Free text content of the message. The message can contain all the details (phone number, email, etc.) allowing the recipient to call back the sender in order to carpool with him/her.
passengerJourneyId:
$ref: '#/components/schemas/journeyId'
passengerUserid:
type: string
description: User's id as retrieved by the route GET /passenger_journeys.
passengerAlias:
type: string
description: Passenger's name alias.
driverOperator:
$ref: '#/components/schemas/operator'
driverOperatorWebUrl:
$ref: '#/components/schemas/operatorUrl'
passengerOperator:
$ref: '#/components/schemas/operator'
passengerOperatorWebUrl:
$ref: '#/components/schemas/operatorUrl'
Booking:
allOf:
- $ref: '#/components/schemas/ConnectionMessage'
type: object
required:
- id
- frequency
- outwardSchedule
- price
properties:
id:
$ref: '#/components/schemas/bookingId'
passengerPickupDate:
type: number
description: |-
Passenger pickup datetime as a UNIX UTC timestamp in seconds.
format: long
status:
$ref: '#/components/schemas/bookingStatus'
price:
type: number
description: Proposed and agreed (when `status=accepted`) price for the journey.
journeyId:
type: string
minLength: 1
maxLength: 255
description: Journey's id.
In order to be a basis for carpool proof, this id must match the `journey_id` that could be provided to a carpool proof register as described for example in [this documentation of an open source product for France](https://tech.covoiturage.beta.gouv.fr/partners/preuves/schema.html#schema-json-complet).
bookingId:
type: string
description: Booking id is common between both operators, and must be set as a MD5 hashing of a string concatenating the `driverJourneyId`, the `passengerJourneyId` and a UNIX UTC timestamp in seconds.
bookingStatus:
type: string
description: Status of the booking.
enum:
- pending
- accepted
- rejected
- cancelled
default: pending
operator:
type: string
description: Name of the operator owning this journey.
operatorUrl:
type: string
description: Url on the website of the operator owning this journey.