-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.ts
57 lines (49 loc) · 1.82 KB
/
example.ts
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
import { MetlinkHttpClientBuilder } from './src/MetlinkHttpClientBuilder'
import { Query } from './src/domain/trip-cancellation/Query'
import * as fs from 'fs'
import { MetlinkHttpClientInterface } from './src/Contracts'
const token = fs.readFileSync('.token', 'utf-8')
const axiosOptions = {}
const httpClient: MetlinkHttpClientInterface =
MetlinkHttpClientBuilder.buildWithAxios(token, axiosOptions)
httpClient.getGtfsAgencies()
httpClient.getGtfsCalendar()
httpClient.getGtfsCalendarDates()
httpClient.getGtfsFeedInfo()
httpClient.getGtfsRoutes('routeId')
httpClient.getGtfsShapes('shapeId')
httpClient.getGtfsStopTimes('tripId')
httpClient.getGtfsStops(null, null)
httpClient.getGtfsTransfers()
httpClient.getGtfsTrips()
httpClient.getGtfsRtTripUpdates()
httpClient.getGtfsRtVehiclePositions()
httpClient.getGtfsRtServiceAlerts()
httpClient.getStopPredictions('stopId')
const query: Query = new Query()
query.dateCreated = Date.now().toString()
httpClient.getTripCancellations(query)
/**
* Mapped entities
*/
const httpClientDecorated: MetlinkHttpClientInterface =
MetlinkHttpClientBuilder.buildWithAxiosUsingResponseDataDecorator(
token,
axiosOptions
)
httpClientDecorated.getGtfsAgencies()
httpClientDecorated.getGtfsCalendar()
httpClientDecorated.getGtfsCalendarDates()
httpClientDecorated.getGtfsFeedInfo()
httpClientDecorated.getGtfsRoutes('routeId')
httpClientDecorated.getGtfsShapes('shapeId')
httpClientDecorated.getGtfsStopTimes('tripId')
httpClientDecorated.getGtfsStops()
httpClientDecorated.getGtfsTransfers()
httpClientDecorated.getGtfsTrips()
httpClientDecorated.getGtfsRtServiceAlerts()
httpClientDecorated.getGtfsRtTripUpdates()
httpClientDecorated.getGtfsRtVehiclePositions()
const query2: Query = new Query()
query2.dateCreated = Date.now().toString()
httpClientDecorated.getTripCancellations(query2)