-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListItineraryLocationsWithItineraryDirections.graphql
88 lines (83 loc) · 2.48 KB
/
ListItineraryLocationsWithItineraryDirections.graphql
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
# Query the itinerary locations, with information about the directions between
# each of the locations. There are various ways to join on Inbound/Outbound
# directions and various customisation of how you would present this list
query listItineraryLocationsWithItineraryDirections(
$itineraryId: ID!
$first: Int!
$after: String
) {
itinerary(
# Supply the itinerary ID
id: $itineraryId
) {
# Select the associated itinerary locations using the children selector
children(
# Limit to querying the itinerary locations
type: ItineraryLocation
# Using the relay "cursor connection" specification for pagination
# See: https://relay.dev/graphql/connections.htm
first: $first
after: $after
) {
edges {
# Using the edge position, we can get a numbering of the result 1...X
edgePositionNumber
node {
# ID/Types
id
__typename
# Specific information drawn from the Itinerary Location
... on ItineraryLocation {
# Query the itinerary location
place {
# ID/Types
id
__typename
# Peel off what information we want from to show about the place
name
# Take what level from the address we want
address {
locality
}
# Categories, like restaurant, hotel etc
layers {
name
}
}
}
}
# Additionally, query the routes between the locations as edge data,
# which will obtain directions from the itinerary that arrive (Inbound)
# to this location, from the last location in the edge sequence
directions(first: 1, direction: Inbound) {
nodes {
# ID/Types
id
__typename
# Duration
durationMin
# Access the route modes (e.g. Car, etc)
route {
segments {
# ID/Types
id
__typename
# Access polyline or geojson for each segment
mode
}
}
# Query any other ItineraryDirections data here..
}
}
# Obtain the cursor to pass back as the "after" property
cursor
}
# Total number of locations
totalCount
pageInfo {
hasNextPage
endCursor
}
}
}
}