├── .babel-plugin-macrosrc.yml ├── .babelrc ├── .gitignore ├── .graphqlconfig ├── .vscode └── settings.json ├── README.md ├── components ├── Item │ ├── Item.js │ ├── __generated__ │ │ ├── Item_item.graphql.js │ │ └── itemQuery.graphql.js │ └── itemQuery.js └── ItemList │ ├── ItemList.js │ └── __generated__ │ └── ItemList_items.graphql.js ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── _app.js └── index.js ├── queries ├── __generated__ │ └── rootQuery.graphql.js └── rootQuery.js ├── relay.config.js ├── relay ├── environment.js ├── utils │ └── index.js └── withData.js └── schemas └── schema.graphql /.babel-plugin-macrosrc.yml: -------------------------------------------------------------------------------- 1 | relay: ~ 2 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel"], 3 | "plugins": ["macros"] 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /.graphqlconfig: -------------------------------------------------------------------------------- 1 | { 2 | "schemaPath": "schemas/schema.graphql", 3 | "extensions": { 4 | "endpoints": { 5 | "dev": "https://api.digitransit.fi/routing/v1/routers/finland/index/graphql" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nextjs-with-relay-modern 2 | 3 | We use GraphQL API ([https://api.digitransit.fi/graphiql/finland](https://api.digitransit.fi/graphiql/finland)) to display a list of items. 4 | 5 | ### Start 6 | 7 | This command starts the retrieval of the remote schema, the Relay compilation and starts the server. 8 | 9 | ``` 10 | npm run dev 11 | ``` 12 | -------------------------------------------------------------------------------- /components/Item/Item.js: -------------------------------------------------------------------------------- 1 | import React, { useCallback, useState, useContext } from "react"; 2 | import { createFragmentContainer, ReactRelayContext } from "react-relay"; 3 | import graphql from "babel-plugin-relay/macro"; 4 | import { ListGroupItem } from "reactstrap"; 5 | import ItemQuery, { ItemQueryRenderer } from "./itemQuery"; 6 | 7 | const Item = ({ item, isSelected, onClick }) => ( 8 | { 13 | event.preventDefault(); 14 | onClick(item.id); 15 | }} 16 | tag="a" 17 | > 18 | {item.name} 19 | {isSelected && ( 20 | 21 | {({ error, props }) => { 22 | if (error) { 23 | return
An error occured: "{error.message}"
; 24 | } 25 | 26 | if (!props) { 27 | return
Loading...
; 28 | } 29 | 30 | return ( 31 |
   # Timezone: {props.agency.timezone}
32 | ); 33 | }} 34 |
35 | )} 36 |
37 | ); 38 | 39 | export default createFragmentContainer(Item, { 40 | item: graphql` 41 | fragment Item_item on Agency { 42 | id 43 | gtfsId 44 | name 45 | } 46 | ` 47 | }); 48 | -------------------------------------------------------------------------------- /components/Item/__generated__/Item_item.graphql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | /* eslint-disable */ 6 | 7 | 'use strict'; 8 | 9 | /*:: 10 | import type { ReaderFragment } from 'relay-runtime'; 11 | import type { FragmentReference } from "relay-runtime"; 12 | declare export opaque type Item_item$ref: FragmentReference; 13 | declare export opaque type Item_item$fragmentType: Item_item$ref; 14 | export type Item_item = {| 15 | +id: string, 16 | +gtfsId: string, 17 | +name: string, 18 | +$refType: Item_item$ref, 19 | |}; 20 | export type Item_item$data = Item_item; 21 | export type Item_item$key = { 22 | +$data?: Item_item$data, 23 | +$fragmentRefs: Item_item$ref, 24 | }; 25 | */ 26 | 27 | 28 | const node/*: ReaderFragment*/ = { 29 | "kind": "Fragment", 30 | "name": "Item_item", 31 | "type": "Agency", 32 | "metadata": null, 33 | "argumentDefinitions": [], 34 | "selections": [ 35 | { 36 | "kind": "ScalarField", 37 | "alias": null, 38 | "name": "id", 39 | "args": null, 40 | "storageKey": null 41 | }, 42 | { 43 | "kind": "ScalarField", 44 | "alias": null, 45 | "name": "gtfsId", 46 | "args": null, 47 | "storageKey": null 48 | }, 49 | { 50 | "kind": "ScalarField", 51 | "alias": null, 52 | "name": "name", 53 | "args": null, 54 | "storageKey": null 55 | } 56 | ] 57 | }; 58 | // prettier-ignore 59 | (node/*: any*/).hash = 'ccbbb794844c03812b0aa70d4ffb6814'; 60 | module.exports = node; 61 | -------------------------------------------------------------------------------- /components/Item/__generated__/itemQuery.graphql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | * @relayHash 2c631f6424db599240dd0bd0dc09824c 4 | */ 5 | 6 | /* eslint-disable */ 7 | 8 | 'use strict'; 9 | 10 | /*:: 11 | import type { ConcreteRequest } from 'relay-runtime'; 12 | export type itemQueryVariables = {| 13 | id: string 14 | |}; 15 | export type itemQueryResponse = {| 16 | +agency: ?{| 17 | +id: string, 18 | +phone: ?string, 19 | +timezone: string, 20 | +url: string, 21 | |} 22 | |}; 23 | export type itemQuery = {| 24 | variables: itemQueryVariables, 25 | response: itemQueryResponse, 26 | |}; 27 | */ 28 | 29 | 30 | /* 31 | query itemQuery( 32 | $id: String! 33 | ) { 34 | agency(id: $id) { 35 | id 36 | phone 37 | timezone 38 | url 39 | } 40 | } 41 | */ 42 | 43 | const node/*: ConcreteRequest*/ = (function(){ 44 | var v0 = [ 45 | { 46 | "kind": "LocalArgument", 47 | "name": "id", 48 | "type": "String!", 49 | "defaultValue": null 50 | } 51 | ], 52 | v1 = [ 53 | { 54 | "kind": "LinkedField", 55 | "alias": null, 56 | "name": "agency", 57 | "storageKey": null, 58 | "args": [ 59 | { 60 | "kind": "Variable", 61 | "name": "id", 62 | "variableName": "id" 63 | } 64 | ], 65 | "concreteType": "Agency", 66 | "plural": false, 67 | "selections": [ 68 | { 69 | "kind": "ScalarField", 70 | "alias": null, 71 | "name": "id", 72 | "args": null, 73 | "storageKey": null 74 | }, 75 | { 76 | "kind": "ScalarField", 77 | "alias": null, 78 | "name": "phone", 79 | "args": null, 80 | "storageKey": null 81 | }, 82 | { 83 | "kind": "ScalarField", 84 | "alias": null, 85 | "name": "timezone", 86 | "args": null, 87 | "storageKey": null 88 | }, 89 | { 90 | "kind": "ScalarField", 91 | "alias": null, 92 | "name": "url", 93 | "args": null, 94 | "storageKey": null 95 | } 96 | ] 97 | } 98 | ]; 99 | return { 100 | "kind": "Request", 101 | "fragment": { 102 | "kind": "Fragment", 103 | "name": "itemQuery", 104 | "type": "QueryType", 105 | "metadata": null, 106 | "argumentDefinitions": (v0/*: any*/), 107 | "selections": (v1/*: any*/) 108 | }, 109 | "operation": { 110 | "kind": "Operation", 111 | "name": "itemQuery", 112 | "argumentDefinitions": (v0/*: any*/), 113 | "selections": (v1/*: any*/) 114 | }, 115 | "params": { 116 | "operationKind": "query", 117 | "name": "itemQuery", 118 | "id": null, 119 | "text": "query itemQuery(\n $id: String!\n) {\n agency(id: $id) {\n id\n phone\n timezone\n url\n }\n}\n", 120 | "metadata": {} 121 | } 122 | }; 123 | })(); 124 | // prettier-ignore 125 | (node/*: any*/).hash = '72f19b3f171ac25b33e4a86e218a7261'; 126 | module.exports = node; 127 | -------------------------------------------------------------------------------- /components/Item/itemQuery.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from "react"; 2 | import { QueryRenderer, ReactRelayContext } from "react-relay"; 3 | import graphql from "babel-plugin-relay/macro"; 4 | 5 | export const itemQuery = graphql` 6 | query itemQuery($id: String!) { 7 | agency(id: $id) { 8 | id 9 | phone 10 | timezone 11 | url 12 | } 13 | } 14 | `; 15 | 16 | export const ItemQueryRenderer = ({ children, gtfsId: id }) => { 17 | const { environment } = useContext(ReactRelayContext); 18 | 19 | return ( 20 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /components/ItemList/ItemList.js: -------------------------------------------------------------------------------- 1 | import React, { useCallback, useState } from "react"; 2 | import { createFragmentContainer } from "react-relay"; 3 | import graphql from "babel-plugin-relay/macro"; 4 | import { Badge, ListGroup } from "reactstrap"; 5 | import Item from "../Item/Item"; 6 | 7 | export const ItemList = ({ items }) => { 8 | const [activeItem, setActiveItem] = useState(); 9 | const onClick = useCallback(id => setActiveItem(id), []); 10 | 11 | return ( 12 | <> 13 |

14 | List of items {items.length} 15 |

16 | 17 | {items && 18 | items.map((item, index) => ( 19 | 25 | ))} 26 | 27 | 28 | ); 29 | }; 30 | 31 | export default createFragmentContainer(ItemList, { 32 | items: graphql` 33 | fragment ItemList_items on Agency @relay(plural: true) { 34 | id 35 | ...Item_item 36 | } 37 | ` 38 | }); 39 | -------------------------------------------------------------------------------- /components/ItemList/__generated__/ItemList_items.graphql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | /* eslint-disable */ 6 | 7 | 'use strict'; 8 | 9 | /*:: 10 | import type { ReaderFragment } from 'relay-runtime'; 11 | type Item_item$ref = any; 12 | import type { FragmentReference } from "relay-runtime"; 13 | declare export opaque type ItemList_items$ref: FragmentReference; 14 | declare export opaque type ItemList_items$fragmentType: ItemList_items$ref; 15 | export type ItemList_items = $ReadOnlyArray<{| 16 | +id: string, 17 | +$fragmentRefs: Item_item$ref, 18 | +$refType: ItemList_items$ref, 19 | |}>; 20 | export type ItemList_items$data = ItemList_items; 21 | export type ItemList_items$key = $ReadOnlyArray<{ 22 | +$data?: ItemList_items$data, 23 | +$fragmentRefs: ItemList_items$ref, 24 | }>; 25 | */ 26 | 27 | 28 | const node/*: ReaderFragment*/ = { 29 | "kind": "Fragment", 30 | "name": "ItemList_items", 31 | "type": "Agency", 32 | "metadata": { 33 | "plural": true 34 | }, 35 | "argumentDefinitions": [], 36 | "selections": [ 37 | { 38 | "kind": "ScalarField", 39 | "alias": null, 40 | "name": "id", 41 | "args": null, 42 | "storageKey": null 43 | }, 44 | { 45 | "kind": "FragmentSpread", 46 | "name": "Item_item", 47 | "args": null 48 | } 49 | ] 50 | }; 51 | // prettier-ignore 52 | (node/*: any*/).hash = '2811b9a2f8f04a38bd4e82eabce64913'; 53 | module.exports = node; 54 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const withCSS = require("@zeit/next-css"); 2 | 3 | module.exports = withCSS(); 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nextjs-with-relay-modern", 3 | "version": "0.1.0", 4 | "description": "Handling SSR with Relay Modern inside NextJS project", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "npm run relay && next", 8 | "build": "next build", 9 | "start": "next start", 10 | "relay": "npm run relay:schema && npm run relay:compile", 11 | "relay:compile": "relay-compiler", 12 | "relay:compile-watch": "relay-compiler --watch", 13 | "relay:schema": "graphql get-schema -e dev" 14 | }, 15 | "keywords": [ 16 | "react", 17 | "relay", 18 | "relay-modern", 19 | "ssr", 20 | "next", 21 | "graphql-client" 22 | ], 23 | "author": { 24 | "name": "Thibault Boursier" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "https://github.com/thibaultboursier/nextjs-with-relay-modern.git" 29 | }, 30 | "license": "ISC", 31 | "dependencies": { 32 | "@zeit/next-css": "^1.0.1", 33 | "bootstrap": "^4.4.1", 34 | "graphql-cli": "^3.0.14", 35 | "isomorphic-unfetch": "^3.0.0", 36 | "next": "^9.3.2", 37 | "react": "^16.12.0", 38 | "react-dom": "^16.12.0", 39 | "reactstrap": "^8.1.1" 40 | }, 41 | "devDependencies": { 42 | "babel-plugin-macros": "^2.6.2", 43 | "babel-plugin-relay": "^7.1.0", 44 | "graphql": "^14.5.8", 45 | "react-relay": "^7.1.0", 46 | "relay-compiler": "^7.1.0", 47 | "relay-config": "^7.1.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pages/_app.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import App from "next/app"; 3 | import "bootstrap/dist/css/bootstrap.min.css"; 4 | 5 | class MyApp extends App { 6 | render() { 7 | const { Component, pageProps } = this.props; 8 | 9 | return ; 10 | } 11 | } 12 | 13 | export default MyApp; 14 | -------------------------------------------------------------------------------- /pages/index.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from "react"; 2 | import graphql from "babel-plugin-relay/macro"; 3 | import { ReactRelayContext } from "react-relay"; 4 | import { Button, Jumbotron } from "reactstrap"; 5 | import { withData } from "../relay/withData"; 6 | import { rootQuery } from "../queries/rootQuery"; 7 | import ItemList from "../components/ItemList/ItemList"; 8 | 9 | const IndexPage = ({ agencies, operationToRetain }) => { 10 | const { environment } = useContext(ReactRelayContext); 11 | 12 | useEffect(() => { 13 | const reference = environment.retain(operationToRetain); 14 | 15 | return () => reference(); 16 | }, []); 17 | 18 | return ( 19 |
20 | 21 |

NextJS with Relay Modern

22 |

23 | We use{" "} 24 | 25 | GraphQL API 26 | {" "} 27 | to display a list of items. 28 |

29 |
30 |

31 | 38 |

39 |
40 | 41 |
42 | ); 43 | }; 44 | 45 | export default withData(IndexPage, { 46 | query: rootQuery 47 | }); 48 | -------------------------------------------------------------------------------- /queries/__generated__/rootQuery.graphql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | * @relayHash 578efe0019d80884adc4b8638262582c 4 | */ 5 | 6 | /* eslint-disable */ 7 | 8 | 'use strict'; 9 | 10 | /*:: 11 | import type { ConcreteRequest } from 'relay-runtime'; 12 | type ItemList_items$ref = any; 13 | export type rootQueryVariables = {||}; 14 | export type rootQueryResponse = {| 15 | +agencies: ?$ReadOnlyArray 18 | |}; 19 | export type rootQuery = {| 20 | variables: rootQueryVariables, 21 | response: rootQueryResponse, 22 | |}; 23 | */ 24 | 25 | 26 | /* 27 | query rootQuery { 28 | agencies { 29 | ...ItemList_items 30 | id 31 | } 32 | } 33 | 34 | fragment ItemList_items on Agency { 35 | id 36 | ...Item_item 37 | } 38 | 39 | fragment Item_item on Agency { 40 | id 41 | gtfsId 42 | name 43 | } 44 | */ 45 | 46 | const node/*: ConcreteRequest*/ = { 47 | "kind": "Request", 48 | "fragment": { 49 | "kind": "Fragment", 50 | "name": "rootQuery", 51 | "type": "QueryType", 52 | "metadata": null, 53 | "argumentDefinitions": [], 54 | "selections": [ 55 | { 56 | "kind": "LinkedField", 57 | "alias": null, 58 | "name": "agencies", 59 | "storageKey": null, 60 | "args": null, 61 | "concreteType": "Agency", 62 | "plural": true, 63 | "selections": [ 64 | { 65 | "kind": "FragmentSpread", 66 | "name": "ItemList_items", 67 | "args": null 68 | } 69 | ] 70 | } 71 | ] 72 | }, 73 | "operation": { 74 | "kind": "Operation", 75 | "name": "rootQuery", 76 | "argumentDefinitions": [], 77 | "selections": [ 78 | { 79 | "kind": "LinkedField", 80 | "alias": null, 81 | "name": "agencies", 82 | "storageKey": null, 83 | "args": null, 84 | "concreteType": "Agency", 85 | "plural": true, 86 | "selections": [ 87 | { 88 | "kind": "ScalarField", 89 | "alias": null, 90 | "name": "id", 91 | "args": null, 92 | "storageKey": null 93 | }, 94 | { 95 | "kind": "ScalarField", 96 | "alias": null, 97 | "name": "gtfsId", 98 | "args": null, 99 | "storageKey": null 100 | }, 101 | { 102 | "kind": "ScalarField", 103 | "alias": null, 104 | "name": "name", 105 | "args": null, 106 | "storageKey": null 107 | } 108 | ] 109 | } 110 | ] 111 | }, 112 | "params": { 113 | "operationKind": "query", 114 | "name": "rootQuery", 115 | "id": null, 116 | "text": "query rootQuery {\n agencies {\n ...ItemList_items\n id\n }\n}\n\nfragment ItemList_items on Agency {\n id\n ...Item_item\n}\n\nfragment Item_item on Agency {\n id\n gtfsId\n name\n}\n", 117 | "metadata": {} 118 | } 119 | }; 120 | // prettier-ignore 121 | (node/*: any*/).hash = 'bf4e9854c02f685db6ba783f4a162c1e'; 122 | module.exports = node; 123 | -------------------------------------------------------------------------------- /queries/rootQuery.js: -------------------------------------------------------------------------------- 1 | import graphql from "babel-plugin-relay/macro"; 2 | 3 | export const rootQuery = graphql` 4 | query rootQuery { 5 | agencies { 6 | ...ItemList_items 7 | } 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /relay.config.js: -------------------------------------------------------------------------------- 1 | // relay.config.js 2 | module.exports = { 3 | // ... 4 | // Configuration options accepted by the `relay-compiler` command-line tool and `babel-plugin-relay`. 5 | src: ".", 6 | schema: "./schemas/schema.graphql", 7 | exclude: ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"] 8 | }; 9 | -------------------------------------------------------------------------------- /relay/environment.js: -------------------------------------------------------------------------------- 1 | import { 2 | Environment, 3 | Network, 4 | QueryResponseCache, 5 | RecordSource, 6 | Store 7 | } from "relay-runtime"; 8 | import fetch from "isomorphic-unfetch"; 9 | 10 | const oneMinute = 60 * 1000; 11 | const cache = new QueryResponseCache({ size: 250, ttl: oneMinute }); 12 | let environment = null; 13 | 14 | function fetchQuery(operation, variables, cacheConfig) { 15 | const queryID = operation.text; 16 | const isMutation = operation.operationKind === "mutation"; 17 | const isQuery = operation.operationKind === "query"; 18 | const forceFetch = cacheConfig && cacheConfig.force; 19 | const fromCache = cache.get(queryID, variables); 20 | 21 | if (isQuery && fromCache !== null && !forceFetch) { 22 | return fromCache; 23 | } 24 | 25 | return fetch( 26 | "https://api.digitransit.fi/routing/v1/routers/finland/index/graphql", 27 | { 28 | method: "POST", 29 | headers: { 30 | "Content-Type": "application/json" 31 | }, 32 | body: JSON.stringify({ 33 | query: operation.text, 34 | variables 35 | }) 36 | } 37 | ) 38 | .then(response => { 39 | return response.json(); 40 | }) 41 | .then(json => { 42 | if (isQuery && json) { 43 | cache.set(queryID, variables, json); 44 | } 45 | if (isMutation) { 46 | cache.clear(); 47 | } 48 | 49 | return json; 50 | }); 51 | } 52 | 53 | export const initEnvironment = ({ records = {} } = {}) => { 54 | const network = Network.create(fetchQuery); 55 | const store = new Store(new RecordSource(records)); 56 | 57 | if (!process.browser) { 58 | return new Environment({ 59 | network, 60 | store 61 | }); 62 | } 63 | 64 | if (!environment) { 65 | environment = new Environment({ 66 | network, 67 | store 68 | }); 69 | } 70 | 71 | return environment; 72 | }; 73 | -------------------------------------------------------------------------------- /relay/utils/index.js: -------------------------------------------------------------------------------- 1 | import { getRequest, createOperationDescriptor } from "relay-runtime"; 2 | 3 | export const getOperationFromQuery = (query, variables) => { 4 | const request = getRequest(query); 5 | 6 | return createOperationDescriptor(request, variables).root; 7 | }; 8 | 9 | export const getQueryRecordsFromEnvironment = environment => 10 | environment 11 | .getStore() 12 | .getSource() 13 | .toJSON(); 14 | -------------------------------------------------------------------------------- /relay/withData.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { fetchQuery, ReactRelayContext } from "react-relay"; 3 | import { initEnvironment } from "./environment"; 4 | import { getQueryRecordsFromEnvironment, getOperationFromQuery } from "./utils"; 5 | 6 | export const withData = (ComposedComponent, options = {}) => { 7 | return class WithData extends React.Component { 8 | static displayName = `WithData(${ComposedComponent.displayName || 9 | "ComposedComponent"})`; 10 | 11 | static async getInitialProps(ctx) { 12 | let composedInitialProps = {}; 13 | 14 | if (ComposedComponent.getInitialProps) { 15 | composedInitialProps = await ComposedComponent.getInitialProps(ctx); 16 | } 17 | 18 | const environment = initEnvironment(); 19 | let queryProps = {}; 20 | let queryRecords = {}; 21 | let operationToRetain; 22 | 23 | if (options.query) { 24 | queryProps = await fetchQuery( 25 | environment, 26 | options.query, 27 | options.variables || {} 28 | ); 29 | queryRecords = getQueryRecordsFromEnvironment(environment); 30 | operationToRetain = getOperationFromQuery( 31 | options.query, 32 | options.variables 33 | ); 34 | } 35 | 36 | return { 37 | ...composedInitialProps, 38 | ...queryProps, 39 | queryRecords, 40 | operationToRetain 41 | }; 42 | } 43 | 44 | constructor(props) { 45 | super(props); 46 | this.environment = initEnvironment({ 47 | records: props.queryRecords 48 | }); 49 | } 50 | 51 | render() { 52 | return ( 53 | 56 | 57 | 58 | ); 59 | } 60 | }; 61 | }; 62 | -------------------------------------------------------------------------------- /schemas/schema.graphql: -------------------------------------------------------------------------------- 1 | # source: https://api.digitransit.fi/routing/v1/routers/finland/index/graphql 2 | # timestamp: Sun Dec 08 2019 13:03:44 GMT+0100 (GMT+01:00) 3 | 4 | schema { 5 | query: QueryType 6 | } 7 | 8 | """A public transport agency""" 9 | type Agency implements Node { 10 | """ 11 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 12 | """ 13 | id: ID! 14 | 15 | """Agency feed and id""" 16 | gtfsId: String! 17 | 18 | """Name of the agency""" 19 | name: String! 20 | 21 | """URL to the home page of the agency""" 22 | url: String! 23 | 24 | """ID of the time zone which this agency operates on""" 25 | timezone: String! 26 | lang: String 27 | 28 | """Phone number which customers can use to contact this agency""" 29 | phone: String 30 | 31 | """URL to a web page which has information of fares used by this agency""" 32 | fareUrl: String 33 | 34 | """List of routes operated by this agency""" 35 | routes: [Route] 36 | 37 | """ 38 | List of alerts which have an effect on all operations of the agency (e.g. a strike) 39 | """ 40 | alerts: [Alert] 41 | } 42 | 43 | """Alert of a current or upcoming disruption in public transportation""" 44 | type Alert implements Node { 45 | """ 46 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 47 | """ 48 | id: ID! 49 | 50 | """hashcode from the original GTFS-RT alert""" 51 | alertHash: Int 52 | 53 | """The feed in which this alert was published""" 54 | feed: String 55 | 56 | """ 57 | Agency affected by the disruption. Note that this value is present only if the 58 | disruption has an effect on all operations of the agency (e.g. in case of a strike). 59 | """ 60 | agency: Agency 61 | 62 | """Route affected by the disruption""" 63 | route: Route 64 | 65 | """Trip affected by the disruption""" 66 | trip: Trip 67 | 68 | """Stop affected by the disruption""" 69 | stop: Stop 70 | 71 | """Patterns affected by the disruption""" 72 | patterns: [Pattern] 73 | 74 | """Header of the alert, if available""" 75 | alertHeaderText: String 76 | 77 | """Header of the alert in all different available languages""" 78 | alertHeaderTextTranslations: [TranslatedString!]! 79 | 80 | """Long description of the alert""" 81 | alertDescriptionText: String! 82 | 83 | """Long descriptions of the alert in all different available languages""" 84 | alertDescriptionTextTranslations: [TranslatedString!]! 85 | 86 | """Url with more information""" 87 | alertUrl: String 88 | 89 | """Url with more information in all different available languages""" 90 | alertUrlTranslations: [TranslatedString!]! 91 | 92 | """Alert effect""" 93 | alertEffect: AlertEffectType 94 | 95 | """Alert cause""" 96 | alertCause: AlertCauseType 97 | 98 | """Alert severity level""" 99 | alertSeverityLevel: AlertSeverityLevelType 100 | 101 | """ 102 | Time when this alert comes into effect. Format: Unix timestamp in seconds 103 | """ 104 | effectiveStartDate: Long 105 | 106 | """ 107 | Time when this alert is not in effect anymore. Format: Unix timestamp in seconds 108 | """ 109 | effectiveEndDate: Long 110 | } 111 | 112 | """Cause of a alert""" 113 | enum AlertCauseType { 114 | """UNKNOWN_CAUSE""" 115 | UNKNOWN_CAUSE 116 | 117 | """OTHER_CAUSE""" 118 | OTHER_CAUSE 119 | 120 | """TECHNICAL_PROBLEM""" 121 | TECHNICAL_PROBLEM 122 | 123 | """STRIKE""" 124 | STRIKE 125 | 126 | """DEMONSTRATION""" 127 | DEMONSTRATION 128 | 129 | """ACCIDENT""" 130 | ACCIDENT 131 | 132 | """HOLIDAY""" 133 | HOLIDAY 134 | 135 | """WEATHER""" 136 | WEATHER 137 | 138 | """MAINTENANCE""" 139 | MAINTENANCE 140 | 141 | """CONSTRUCTION""" 142 | CONSTRUCTION 143 | 144 | """POLICE_ACTIVITY""" 145 | POLICE_ACTIVITY 146 | 147 | """MEDICAL_EMERGENCY""" 148 | MEDICAL_EMERGENCY 149 | } 150 | 151 | """Effect of a alert""" 152 | enum AlertEffectType { 153 | """NO_SERVICE""" 154 | NO_SERVICE 155 | 156 | """REDUCED_SERVICE""" 157 | REDUCED_SERVICE 158 | 159 | """SIGNIFICANT_DELAYS""" 160 | SIGNIFICANT_DELAYS 161 | 162 | """DETOUR""" 163 | DETOUR 164 | 165 | """ADDITIONAL_SERVICE""" 166 | ADDITIONAL_SERVICE 167 | 168 | """MODIFIED_SERVICE""" 169 | MODIFIED_SERVICE 170 | 171 | """OTHER_EFFECT""" 172 | OTHER_EFFECT 173 | 174 | """UNKNOWN_EFFECT""" 175 | UNKNOWN_EFFECT 176 | 177 | """STOP_MOVED""" 178 | STOP_MOVED 179 | 180 | """NO_EFFECT""" 181 | NO_EFFECT 182 | } 183 | 184 | """Severity level of a alert""" 185 | enum AlertSeverityLevelType { 186 | """Severity of alert is unknown""" 187 | UNKNOWN_SEVERITY 188 | 189 | """ 190 | Info alerts are used for informational messages that should not have a 191 | significant effect on user's journey, for example: A single entrance to a 192 | metro station is temporarily closed. 193 | """ 194 | INFO 195 | 196 | """ 197 | Warning alerts are used when a single stop or route has a disruption that can 198 | affect user's journey, for example: All trams on a specific route are running 199 | with irregular schedules. 200 | """ 201 | WARNING 202 | 203 | """ 204 | Severe alerts are used when a significant part of public transport services is 205 | affected, for example: All train services are cancelled due to technical problems. 206 | """ 207 | SEVERE 208 | } 209 | 210 | """Bike park represents a location where bicycles can be parked.""" 211 | type BikePark implements Node & PlaceInterface { 212 | """ 213 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 214 | """ 215 | id: ID! 216 | 217 | """ID of the bike park""" 218 | bikeParkId: String 219 | 220 | """Name of the bike park""" 221 | name: String! 222 | 223 | """Number of spaces available for bikes""" 224 | spacesAvailable: Int 225 | 226 | """ 227 | If true, value of `spacesAvailable` is updated from a real-time source. 228 | """ 229 | realtime: Boolean 230 | 231 | """Longitude of the bike park (WGS 84)""" 232 | lon: Float 233 | 234 | """Latitude of the bike park (WGS 84)""" 235 | lat: Float 236 | } 237 | 238 | """ 239 | Bike rental station represents a location where users can rent bicycles for a fee. 240 | """ 241 | type BikeRentalStation implements Node & PlaceInterface { 242 | """ 243 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 244 | """ 245 | id: ID! 246 | 247 | """ID of the bike rental station""" 248 | stationId: String 249 | 250 | """Name of the bike rental station""" 251 | name: String! 252 | 253 | """ 254 | Number of bikes currently available on the rental station. The total capacity 255 | of this bike rental station is the sum of fields `bikesAvailable` and 256 | `spacesAvailable`. 257 | """ 258 | bikesAvailable: Int 259 | 260 | """ 261 | Number of free spaces currently available on the rental station. The total 262 | capacity of this bike rental station is the sum of fields `bikesAvailable` and 263 | `spacesAvailable`. 264 | Note that this value being 0 does not necessarily indicate that bikes cannot 265 | be returned to this station, as it might be possible to leave the bike in the 266 | vicinity of the rental station, even if the bike racks don't have any spaces 267 | available (see field `allowDropoff`). 268 | """ 269 | spacesAvailable: Int 270 | 271 | """ 272 | A description of the current state of this bike rental station, e.g. "Station on" 273 | """ 274 | state: String 275 | 276 | """ 277 | If true, values of `bikesAvailable` and `spacesAvailable` are updated from a 278 | real-time source. If false, values of `bikesAvailable` and `spacesAvailable` 279 | are always the total capacity divided by two. 280 | """ 281 | realtime: Boolean 282 | 283 | """If true, bikes can be returned to this station.""" 284 | allowDropoff: Boolean 285 | networks: [String] 286 | 287 | """Longitude of the bike rental station (WGS 84)""" 288 | lon: Float 289 | 290 | """Latitude of the bike rental station (WGS 84)""" 291 | lat: Float 292 | } 293 | 294 | enum BikesAllowed { 295 | """There is no bike information for the trip.""" 296 | NO_INFORMATION 297 | 298 | """ 299 | The vehicle being used on this particular trip can accommodate at least one bicycle. 300 | """ 301 | ALLOWED 302 | 303 | """No bicycles are allowed on this trip.""" 304 | NOT_ALLOWED 305 | } 306 | 307 | """Car park represents a location where cars can be parked.""" 308 | type CarPark implements Node & PlaceInterface { 309 | """ 310 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 311 | """ 312 | id: ID! 313 | 314 | """ID of the car park""" 315 | carParkId: String 316 | 317 | """Name of the car park""" 318 | name: String! 319 | 320 | """Number of parking spaces at the car park""" 321 | maxCapacity: Int 322 | 323 | """Number of currently available parking spaces at the car park""" 324 | spacesAvailable: Int 325 | 326 | """ 327 | If true, value of `spacesAvailable` is updated from a real-time source. 328 | """ 329 | realtime: Boolean 330 | 331 | """Longitude of the car park (WGS 84)""" 332 | lon: Float 333 | 334 | """Latitude of the car park (WGS 84)""" 335 | lat: Float 336 | } 337 | 338 | """Cluster is a list of stops grouped by name and proximity""" 339 | type Cluster implements Node { 340 | """ 341 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 342 | """ 343 | id: ID! 344 | 345 | """ID of the cluster""" 346 | gtfsId: String! 347 | 348 | """Name of the cluster""" 349 | name: String! 350 | 351 | """ 352 | Latitude of the center of this cluster (i.e. average latitude of stops in this cluster) 353 | """ 354 | lat: Float! 355 | 356 | """ 357 | Longitude of the center of this cluster (i.e. average longitude of stops in this cluster) 358 | """ 359 | lon: Float! 360 | 361 | """List of stops in the cluster""" 362 | stops: [Stop!] 363 | } 364 | 365 | type Coordinates { 366 | """Latitude (WGS 84)""" 367 | lat: Float 368 | 369 | """Longitude (WGS 84)""" 370 | lon: Float 371 | } 372 | 373 | type debugOutput { 374 | totalTime: Long 375 | pathCalculationTime: Long 376 | precalculationTime: Long 377 | renderingTime: Long 378 | timedOut: Boolean 379 | } 380 | 381 | """ 382 | Departure row is a location, which lists departures of a certain pattern from a 383 | stop. Departure rows are identified with the pattern, so querying departure rows 384 | will return only departures from one stop per pattern 385 | """ 386 | type DepartureRow implements Node & PlaceInterface { 387 | """ 388 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 389 | """ 390 | id: ID! 391 | 392 | """Stop from which the departures leave""" 393 | stop: Stop 394 | 395 | """Latitude of the stop (WGS 84)""" 396 | lat: Float 397 | 398 | """Longitude of the stop (WGS 84)""" 399 | lon: Float 400 | 401 | """Pattern of the departure row""" 402 | pattern: Pattern 403 | 404 | """Departures of the pattern from the stop""" 405 | stoptimes( 406 | """ 407 | Return rows departing after this time. Time format: Unix timestamp in seconds. Default: current time. 408 | """ 409 | startTime: Long = 0 410 | 411 | """How many seconds ahead to search for departures. Default is one day.""" 412 | timeRange: Int = 86400 413 | 414 | """Maximum number of departures to return.""" 415 | numberOfDepartures: Int = 1 416 | 417 | """If true, only those departures which allow boarding are returned""" 418 | omitNonPickups: Boolean = false 419 | 420 | """If false, returns also canceled trips""" 421 | omitCanceled: Boolean = true 422 | ): [Stoptime] 423 | } 424 | 425 | type elevationProfileComponent { 426 | """The distance from the start of the step, in meters.""" 427 | distance: Float 428 | 429 | """The elevation at this distance, in meters.""" 430 | elevation: Float 431 | } 432 | 433 | type fare { 434 | type: String 435 | 436 | """ISO 4217 currency code""" 437 | currency: String 438 | 439 | """ 440 | Fare price in cents. **Note:** this value is dependent on the currency used, 441 | as one cent is not necessarily ¹/₁₀₀ of the basic monerary unit. 442 | """ 443 | cents: Int 444 | 445 | """Components which this fare is composed of""" 446 | components: [fareComponent] 447 | } 448 | 449 | """Component of the fare (i.e. ticket) for a part of the itinerary""" 450 | type fareComponent { 451 | """ID of the ticket type. Corresponds to `fareId` in **TicketType**.""" 452 | fareId: String 453 | 454 | """ISO 4217 currency code""" 455 | currency: String 456 | 457 | """ 458 | Fare price in cents. **Note:** this value is dependent on the currency used, 459 | as one cent is not necessarily ¹/₁₀₀ of the basic monerary unit. 460 | """ 461 | cents: Int 462 | 463 | """List of routes which use this fare component""" 464 | routes: [Route] 465 | } 466 | 467 | """ 468 | A feed provides routing data (stops, routes, timetables, etc.) from one or more public transport agencies. 469 | """ 470 | type Feed { 471 | """ID of the feed""" 472 | feedId: String! 473 | 474 | """List of agencies which provide data to this feed""" 475 | agencies: [Agency] 476 | } 477 | 478 | enum FilterPlaceType { 479 | """Stops""" 480 | STOP 481 | 482 | """Departure rows""" 483 | DEPARTURE_ROW 484 | 485 | """Bicycle rent stations""" 486 | BICYCLE_RENT 487 | 488 | """Bike parks""" 489 | BIKE_PARK 490 | 491 | """Car parks""" 492 | CAR_PARK 493 | } 494 | 495 | type Geometry { 496 | """The number of points in the string""" 497 | length: Int 498 | 499 | """ 500 | List of coordinates of in a Google encoded polyline format (see 501 | https://developers.google.com/maps/documentation/utilities/polylinealgorithm) 502 | """ 503 | points: Polyline 504 | } 505 | 506 | input InputBanned { 507 | """A comma-separated list of banned route ids""" 508 | routes: String 509 | 510 | """A comma-separated list of banned agency ids""" 511 | agencies: String 512 | 513 | """A comma-separated list of banned trip ids""" 514 | trips: String 515 | 516 | """ 517 | A comma-separated list of banned stop ids. Note that these stops are only 518 | banned for boarding and disembarking vehicles — it is possible to get an 519 | itinerary where a vehicle stops at one of these stops 520 | """ 521 | stops: String 522 | 523 | """ 524 | A comma-separated list of banned stop ids. Only itineraries where these stops 525 | are not travelled through are returned, e.g. if a bus route stops at one of 526 | these stops, that route will not be used in the itinerary, even if the stop is 527 | not used for boarding or disembarking the vehicle. 528 | """ 529 | stopsHard: String 530 | } 531 | 532 | input InputCoordinates { 533 | """Latitude of the place (WGS 84)""" 534 | lat: Float! 535 | 536 | """Longitude of the place (WGS 84)""" 537 | lon: Float! 538 | 539 | """ 540 | The name of the place. If specified, the place name in results uses this value instead of `"Origin"` or `"Destination"` 541 | """ 542 | address: String 543 | 544 | """ 545 | The amount of time, in seconds, to spend at this location before venturing forth. 546 | """ 547 | locationSlack: Int 548 | } 549 | 550 | input InputFilters { 551 | """Stops to include by GTFS id.""" 552 | stops: [String] 553 | 554 | """Routes to include by GTFS id.""" 555 | routes: [String] 556 | 557 | """Bike rentals to include by id.""" 558 | bikeRentalStations: [String] 559 | 560 | """Bike parks to include by id.""" 561 | bikeParks: [String] 562 | 563 | """Car parks to include by id.""" 564 | carParks: [String] 565 | } 566 | 567 | input InputModeWeight { 568 | """ 569 | The weight of TRAM traverse mode. Values over 1 add cost to tram travel and values under 1 decrease cost 570 | """ 571 | TRAM: Float 572 | 573 | """ 574 | The weight of SUBWAY traverse mode. Values over 1 add cost to subway travel and values under 1 decrease cost 575 | """ 576 | SUBWAY: Float 577 | 578 | """ 579 | The weight of RAIL traverse mode. Values over 1 add cost to rail travel and values under 1 decrease cost 580 | """ 581 | RAIL: Float 582 | 583 | """ 584 | The weight of BUS traverse mode. Values over 1 add cost to bus travel and values under 1 decrease cost 585 | """ 586 | BUS: Float 587 | 588 | """ 589 | The weight of FERRY traverse mode. Values over 1 add cost to ferry travel and values under 1 decrease cost 590 | """ 591 | FERRY: Float 592 | 593 | """ 594 | The weight of CABLE_CAR traverse mode. Values over 1 add cost to cable car travel and values under 1 decrease cost 595 | """ 596 | CABLE_CAR: Float 597 | 598 | """ 599 | The weight of GONDOLA traverse mode. Values over 1 add cost to gondola travel and values under 1 decrease cost 600 | """ 601 | GONDOLA: Float 602 | 603 | """ 604 | The weight of FUNICULAR traverse mode. Values over 1 add cost to funicular travel and values under 1 decrease cost 605 | """ 606 | FUNICULAR: Float 607 | 608 | """ 609 | The weight of AIRPLANE traverse mode. Values over 1 add cost to airplane travel and values under 1 decrease cost 610 | """ 611 | AIRPLANE: Float 612 | } 613 | 614 | input InputPreferred { 615 | """A comma-separated list of ids of the routes preferred by the user.""" 616 | routes: String 617 | 618 | """A comma-separated list of ids of the agencies preferred by the user.""" 619 | agencies: String 620 | 621 | """ 622 | Penalty added for using every route that is not preferred if user set any 623 | route as preferred. We return number of seconds that we are willing to wait 624 | for preferred route. 625 | """ 626 | otherThanPreferredRoutesPenalty: Int 627 | } 628 | 629 | """ 630 | Relative importances of optimization factors. Only effective for bicycling legs. 631 | Invariant: `timeFactor + slopeFactor + safetyFactor == 1` 632 | """ 633 | input InputTriangle { 634 | """Relative importance of safety""" 635 | safetyFactor: Float 636 | 637 | """Relative importance of flat terrain""" 638 | slopeFactor: Float 639 | 640 | """Relative importance of duration""" 641 | timeFactor: Float 642 | } 643 | 644 | input InputUnpreferred { 645 | """A comma-separated list of ids of the routes unpreferred by the user.""" 646 | routes: String 647 | 648 | """A comma-separated list of ids of the agencies unpreferred by the user.""" 649 | agencies: String 650 | 651 | """ 652 | Penalty added for using route that is unpreferred, i.e. number of seconds that 653 | we are willing to wait for route that is unpreferred. 654 | """ 655 | useUnpreferredRoutesPenalty: Int 656 | } 657 | 658 | type Itinerary { 659 | """ 660 | Time when the user leaves from the origin. Format: Unix timestamp in milliseconds. 661 | """ 662 | startTime: Long 663 | 664 | """ 665 | Time when the user arrives to the destination.. Format: Unix timestamp in milliseconds. 666 | """ 667 | endTime: Long 668 | 669 | """Duration of the trip on this itinerary, in seconds.""" 670 | duration: Long 671 | 672 | """How much time is spent waiting for transit to arrive, in seconds.""" 673 | waitingTime: Long 674 | 675 | """How much time is spent walking, in seconds.""" 676 | walkTime: Long 677 | 678 | """How far the user has to walk, in meters.""" 679 | walkDistance: Float 680 | 681 | """ 682 | A list of Legs. Each Leg is either a walking (cycling, car) portion of the 683 | itinerary, or a transit leg on a particular vehicle. So a itinerary where the 684 | user walks to the Q train, transfers to the 6, then walks to their 685 | destination, has four legs. 686 | """ 687 | legs: [Leg]! 688 | 689 | """Information about the fares for this itinerary""" 690 | fares: [fare] 691 | 692 | """ 693 | How much elevation is gained, in total, over the course of the itinerary, in meters. 694 | """ 695 | elevationGained: Float 696 | 697 | """ 698 | How much elevation is lost, in total, over the course of the itinerary, in meters. 699 | """ 700 | elevationLost: Float 701 | } 702 | 703 | type Leg { 704 | """ 705 | The date and time when this leg begins. Format: Unix timestamp in milliseconds. 706 | """ 707 | startTime: Long 708 | 709 | """ 710 | The date and time when this leg ends. Format: Unix timestamp in milliseconds. 711 | """ 712 | endTime: Long 713 | 714 | """ 715 | For transit leg, the offset from the scheduled departure time of the boarding 716 | stop in this leg, i.e. scheduled time of departure at boarding stop = 717 | `startTime - departureDelay` 718 | """ 719 | departureDelay: Int 720 | 721 | """ 722 | For transit leg, the offset from the scheduled arrival time of the alighting 723 | stop in this leg, i.e. scheduled time of arrival at alighting stop = `endTime 724 | - arrivalDelay` 725 | """ 726 | arrivalDelay: Int 727 | 728 | """The mode (e.g. `WALK`) used when traversing this leg.""" 729 | mode: Mode 730 | 731 | """The leg's duration in seconds""" 732 | duration: Float 733 | 734 | """The leg's geometry.""" 735 | legGeometry: Geometry 736 | 737 | """ 738 | For transit legs, the transit agency that operates the service used for this leg. For non-transit legs, `null`. 739 | """ 740 | agency: Agency 741 | 742 | """Whether there is real-time data about this Leg""" 743 | realTime: Boolean 744 | 745 | """State of real-time data""" 746 | realtimeState: RealtimeState 747 | 748 | """The distance traveled while traversing the leg in meters.""" 749 | distance: Float 750 | 751 | """Whether this leg is a transit leg or not.""" 752 | transitLeg: Boolean 753 | 754 | """Whether this leg is traversed with a rented bike.""" 755 | rentedBike: Boolean 756 | 757 | """The Place where the leg originates.""" 758 | from: Place! 759 | 760 | """The Place where the leg ends.""" 761 | to: Place! 762 | 763 | """ 764 | For transit legs, the route that is used for traversing the leg. For non-transit legs, `null`. 765 | """ 766 | route: Route 767 | 768 | """ 769 | For transit legs, the trip that is used for traversing the leg. For non-transit legs, `null`. 770 | """ 771 | trip: Trip 772 | 773 | """ 774 | For transit legs, the service date of the trip. Format: YYYYMMDD. For non-transit legs, null. 775 | """ 776 | serviceDate: String 777 | 778 | """ 779 | For transit legs, intermediate stops between the Place where the leg 780 | originates and the Place where the leg ends. For non-transit legs, null. 781 | """ 782 | intermediateStops: [Stop] 783 | 784 | """ 785 | For transit legs, intermediate stops between the Place where the leg 786 | originates and the Place where the leg ends. For non-transit legs, null. 787 | Returns Place type, which has fields for e.g. departure and arrival times 788 | """ 789 | intermediatePlaces: [Place] 790 | 791 | """ 792 | Whether the destination of this leg (field `to`) is one of the intermediate places specified in the query. 793 | """ 794 | intermediatePlace: Boolean 795 | steps: [step] 796 | } 797 | 798 | """Identifies whether this stop represents a stop or station.""" 799 | enum LocationType { 800 | """A location where passengers board or disembark from a transit vehicle.""" 801 | STOP 802 | 803 | """A physical structure or area that contains one or more stop.""" 804 | STATION 805 | ENTRANCE 806 | } 807 | 808 | """Long type""" 809 | scalar Long 810 | 811 | enum Mode { 812 | """AIRPLANE""" 813 | AIRPLANE 814 | 815 | """BICYCLE""" 816 | BICYCLE 817 | 818 | """BUS""" 819 | BUS 820 | 821 | """CABLE_CAR""" 822 | CABLE_CAR 823 | 824 | """CAR""" 825 | CAR 826 | 827 | """FERRY""" 828 | FERRY 829 | 830 | """FUNICULAR""" 831 | FUNICULAR 832 | 833 | """GONDOLA""" 834 | GONDOLA 835 | 836 | """Only used internally. No use for API users.""" 837 | LEG_SWITCH 838 | 839 | """RAIL""" 840 | RAIL 841 | 842 | """SUBWAY""" 843 | SUBWAY 844 | 845 | """TRAM""" 846 | TRAM 847 | 848 | """A special transport mode, which includes all public transport.""" 849 | TRANSIT 850 | 851 | """WALK""" 852 | WALK 853 | } 854 | 855 | """An object with an ID""" 856 | interface Node { 857 | """The ID of an object""" 858 | id: ID! 859 | } 860 | 861 | """Optimization type for bicycling legs""" 862 | enum OptimizeType { 863 | """Prefer faster routes""" 864 | QUICK 865 | 866 | """ 867 | Prefer safer routes, i.e. avoid crossing streets and use bike paths when possible 868 | """ 869 | SAFE 870 | 871 | """Prefer flat terrain""" 872 | FLAT 873 | 874 | """GREENWAYS""" 875 | GREENWAYS 876 | 877 | """ 878 | **TRIANGLE** optimization type can be used to set relative preferences of optimization factors. See argument `triangle`. 879 | """ 880 | TRIANGLE 881 | 882 | """ 883 | Deprecated, use argument `transferPenalty` to optimize for less transfers. 884 | """ 885 | TRANSFERS 886 | } 887 | 888 | """Information about pagination in a connection.""" 889 | type PageInfo { 890 | """When paginating forwards, are there more items?""" 891 | hasNextPage: Boolean! 892 | 893 | """When paginating backwards, are there more items?""" 894 | hasPreviousPage: Boolean! 895 | 896 | """When paginating backwards, the cursor to continue.""" 897 | startCursor: String 898 | 899 | """When paginating forwards, the cursor to continue.""" 900 | endCursor: String 901 | } 902 | 903 | """ 904 | Pattern is sequence of stops used by trips on a specific direction and variant 905 | of a route. Most routes have only two patterns: one for outbound trips and one 906 | for inbound trips 907 | """ 908 | type Pattern implements Node { 909 | """ 910 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 911 | """ 912 | id: ID! 913 | 914 | """The route this pattern runs on""" 915 | route: Route! 916 | 917 | """ 918 | Direction of the pattern. Possible values: 0, 1 or -1. 919 | -1 indicates that the direction is irrelevant, i.e. the route has patterns only in one direction. 920 | """ 921 | directionId: Int 922 | 923 | """ 924 | Name of the pattern. Pattern name can be just the name of the route or it can 925 | include details of destination and origin stops. 926 | """ 927 | name: String 928 | 929 | """ID of the pattern""" 930 | code: String! 931 | 932 | """Vehicle headsign used by trips of this pattern""" 933 | headsign: String 934 | 935 | """Trips which run on this pattern""" 936 | trips: [Trip!] 937 | 938 | """Trips which run on this pattern on the specified date""" 939 | tripsForDate( 940 | """Deprecated, please switch to serviceDate instead""" 941 | serviceDay: String 942 | 943 | """Return trips of the pattern active on this date. Format: YYYYMMDD""" 944 | serviceDate: String 945 | ): [Trip!] 946 | 947 | """List of stops served by this pattern""" 948 | stops: [Stop!] 949 | geometry: [Coordinates] 950 | 951 | """ 952 | Coordinates of the route of this pattern in Google polyline encoded format 953 | """ 954 | patternGeometry: Geometry 955 | 956 | """ 957 | Hash code of the pattern. This value is stable and not dependent on the 958 | pattern id, i.e. this value can be used to check whether two patterns are the 959 | same, even if their ids have changed. 960 | """ 961 | semanticHash: String 962 | 963 | """List of alerts which have an effect on trips of the pattern""" 964 | alerts: [Alert] 965 | } 966 | 967 | enum PickupDropoffType { 968 | """Regularly scheduled pickup / drop off.""" 969 | SCHEDULED 970 | 971 | """No pickup / drop off available.""" 972 | NONE 973 | 974 | """Must phone agency to arrange pickup / drop off.""" 975 | CALL_AGENCY 976 | 977 | """Must coordinate with driver to arrange pickup / drop off.""" 978 | COORDINATE_WITH_DRIVER 979 | } 980 | 981 | type Place { 982 | """ 983 | For transit stops, the name of the stop. For points of interest, the name of the POI. 984 | """ 985 | name: String 986 | 987 | """ 988 | Type of vertex. (Normal, Bike sharing station, Bike P+R, Transit stop) Mostly 989 | used for better localization of bike sharing and P+R station names 990 | """ 991 | vertexType: VertexType 992 | 993 | """Latitude of the place (WGS 84)""" 994 | lat: Float! 995 | 996 | """Longitude of the place (WGS 84)""" 997 | lon: Float! 998 | 999 | """ 1000 | The time the rider will arrive at the place. Format: Unix timestamp in milliseconds. 1001 | """ 1002 | arrivalTime: Long! 1003 | 1004 | """ 1005 | The time the rider will depart the place. Format: Unix timestamp in milliseconds. 1006 | """ 1007 | departureTime: Long! 1008 | 1009 | """The stop related to the place.""" 1010 | stop: Stop 1011 | 1012 | """The bike rental station related to the place""" 1013 | bikeRentalStation: BikeRentalStation 1014 | 1015 | """The bike parking related to the place""" 1016 | bikePark: BikePark 1017 | 1018 | """The car parking related to the place""" 1019 | carPark: CarPark 1020 | } 1021 | 1022 | type placeAtDistance implements Node { 1023 | """ 1024 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 1025 | """ 1026 | id: ID! 1027 | place: PlaceInterface 1028 | 1029 | """Walking distance to the place along streets and paths""" 1030 | distance: Int 1031 | } 1032 | 1033 | """A connection to a list of items.""" 1034 | type placeAtDistanceConnection { 1035 | edges: [placeAtDistanceEdge] 1036 | pageInfo: PageInfo! 1037 | } 1038 | 1039 | """An edge in a connection.""" 1040 | type placeAtDistanceEdge { 1041 | """The item at the end of the edge""" 1042 | node: placeAtDistance 1043 | cursor: String! 1044 | } 1045 | 1046 | """Interface for places, e.g. stops, stations, parking areas..""" 1047 | interface PlaceInterface { 1048 | id: ID! 1049 | 1050 | """Latitude of the place (WGS 84)""" 1051 | lat: Float 1052 | 1053 | """Longitude of the place (WGS 84)""" 1054 | lon: Float 1055 | } 1056 | 1057 | type Plan { 1058 | """The time and date of travel. Format: Unix timestamp in milliseconds.""" 1059 | date: Long 1060 | 1061 | """The origin""" 1062 | from: Place! 1063 | 1064 | """The destination""" 1065 | to: Place! 1066 | 1067 | """A list of possible itineraries""" 1068 | itineraries: [Itinerary]! 1069 | 1070 | """A list of possible error messages as enum""" 1071 | messageEnums: [String]! 1072 | 1073 | """A list of possible error messages in cleartext""" 1074 | messageStrings: [String]! 1075 | 1076 | """Information about the timings for the plan generation""" 1077 | debugOutput: debugOutput! 1078 | } 1079 | 1080 | """ 1081 | List of coordinates in an encoded polyline format (see 1082 | https://developers.google.com/maps/documentation/utilities/polylinealgorithm). 1083 | The value appears in JSON as a string. 1084 | """ 1085 | scalar Polyline 1086 | 1087 | """ 1088 | Additional qualifier for a transport mode. 1089 | Note that qualifiers can only be used with certain transport modes. 1090 | """ 1091 | enum Qualifier { 1092 | """The vehicle used for transport can be rented""" 1093 | RENT 1094 | 1095 | """ 1096 | ~~HAVE~~ 1097 | **Currently not used** 1098 | """ 1099 | HAVE 1100 | 1101 | """ 1102 | The vehicle used must be left to a parking area before continuing the journey. 1103 | This qualifier is usable with transport modes `CAR` and `BICYCLE`. 1104 | Note that the vehicle is only parked if the journey is continued with public 1105 | transportation (e.g. if only `CAR` and `WALK` transport modes are allowed to 1106 | be used, the car will not be parked as it is used for the whole journey). 1107 | """ 1108 | PARK 1109 | 1110 | """ 1111 | ~~KEEP~~ 1112 | **Currently not used** 1113 | """ 1114 | KEEP 1115 | 1116 | """The user can be picked up by someone else riding a vehicle""" 1117 | PICKUP 1118 | } 1119 | 1120 | type QueryType { 1121 | """Fetches an object given its ID""" 1122 | node( 1123 | """The ID of an object""" 1124 | id: ID! 1125 | ): Node 1126 | 1127 | """Get all available feeds""" 1128 | feeds: [Feed] 1129 | 1130 | """Get all agencies""" 1131 | agencies: [Agency] 1132 | 1133 | """Return list of available ticket types""" 1134 | ticketTypes: [TicketType] 1135 | 1136 | """ 1137 | Get a single agency based on agency ID, i.e. value of field `gtfsId` (ID format is `FeedId:StopId`) 1138 | """ 1139 | agency(id: String!): Agency 1140 | 1141 | """Get all stops""" 1142 | stops( 1143 | """Return stops with these ids""" 1144 | ids: [String] 1145 | 1146 | """Query stops by this name""" 1147 | name: String 1148 | ): [Stop] 1149 | 1150 | """Get all stops within the specified bounding box""" 1151 | stopsByBbox( 1152 | """Southern bound of the bounding box""" 1153 | minLat: Float! 1154 | 1155 | """Western bound of the bounding box""" 1156 | minLon: Float! 1157 | 1158 | """Northern bound of the bounding box""" 1159 | maxLat: Float! 1160 | 1161 | """Eastern bound of the bounding box""" 1162 | maxLon: Float! 1163 | 1164 | """Deprecated, use argument `feeds` instead""" 1165 | agency: String 1166 | 1167 | """List of feed ids from which stops are returned""" 1168 | feeds: [String!] 1169 | ): [Stop] 1170 | 1171 | """ 1172 | Get all stops within the specified radius from a location. The returned type 1173 | is a Relay connection (see 1174 | https://facebook.github.io/relay/graphql/connections.htm). The stopAtDistance 1175 | type has two values: stop and distance. 1176 | """ 1177 | stopsByRadius( 1178 | """Latitude of the location (WGS 84)""" 1179 | lat: Float! 1180 | 1181 | """Longitude of the location (WGS 84)""" 1182 | lon: Float! 1183 | 1184 | """ 1185 | Radius (in meters) to search for from the specified location. Note that this 1186 | is walking distance along streets and paths rather than a geographic distance. 1187 | """ 1188 | radius: Int! 1189 | 1190 | """Deprecated, use argument `feeds` instead""" 1191 | agency: String 1192 | 1193 | """List of feed ids from which stops are returned""" 1194 | feeds: [String!] 1195 | before: String 1196 | after: String 1197 | first: Int 1198 | last: Int 1199 | ): stopAtDistanceConnection 1200 | 1201 | """ 1202 | Get all places (stops, stations, etc. with coordinates) within the specified 1203 | radius from a location. The returned type is a Relay connection (see 1204 | https://facebook.github.io/relay/graphql/connections.htm). The placeAtDistance 1205 | type has two fields: place and distance. The search is done by walking so the 1206 | distance is according to the network of walkable streets and paths. 1207 | """ 1208 | nearest( 1209 | """Latitude of the location (WGS 84)""" 1210 | lat: Float! 1211 | 1212 | """Longitude of the location (WGS 84)""" 1213 | lon: Float! 1214 | 1215 | """ 1216 | Maximum distance (in meters) to search for from the specified location. Note 1217 | that this is walking distance along streets and paths rather than a 1218 | geographic distance. Default is 2000m 1219 | """ 1220 | maxDistance: Int = 2000 1221 | 1222 | """ 1223 | Maximum number of results. Search is stopped when this limit is reached. Default is 20. 1224 | """ 1225 | maxResults: Int = 20 1226 | 1227 | """ 1228 | Only return places that are one of these types, e.g. `STOP` or `BICYCLE_RENT` 1229 | """ 1230 | filterByPlaceTypes: [FilterPlaceType] 1231 | 1232 | """ 1233 | Only return places that are related to one of these transport modes. This 1234 | argument can be used to return e.g. only nearest railway stations or only 1235 | nearest places related to bicycling. 1236 | """ 1237 | filterByModes: [Mode] 1238 | 1239 | """Only include places that match one of the given GTFS ids.""" 1240 | filterByIds: InputFilters 1241 | before: String 1242 | after: String 1243 | first: Int 1244 | last: Int 1245 | ): placeAtDistanceConnection 1246 | 1247 | """ 1248 | Get a single departure row based on its ID (ID format is `FeedId:StopId:PatternId`) 1249 | """ 1250 | departureRow(id: String!): DepartureRow 1251 | 1252 | """ 1253 | Get a single stop based on its ID, i.e. value of field `gtfsId` (ID format is `FeedId:StopId`) 1254 | """ 1255 | stop(id: String!): Stop 1256 | 1257 | """ 1258 | Get a single station based on its ID, i.e. value of field `gtfsId` (format is `FeedId:StopId`) 1259 | """ 1260 | station(id: String!): Stop 1261 | 1262 | """Get all stations""" 1263 | stations( 1264 | """Only return stations that match one of the ids in this list""" 1265 | ids: [String] 1266 | 1267 | """Query stations by name""" 1268 | name: String 1269 | ): [Stop] 1270 | 1271 | """Get all routes""" 1272 | routes( 1273 | """Only return routes with these ids""" 1274 | ids: [String] 1275 | 1276 | """Only return routes with these feedIds""" 1277 | feeds: [String] 1278 | 1279 | """Query routes by this name""" 1280 | name: String 1281 | 1282 | """Deprecated, use argument `transportModes` instead.""" 1283 | modes: String 1284 | 1285 | """Only include routes, which use one of these modes""" 1286 | transportModes: [Mode] 1287 | ): [Route] 1288 | 1289 | """ 1290 | Get a single route based on its ID, i.e. value of field `gtfsId` (format is `FeedId:RouteId`) 1291 | """ 1292 | route(id: String!): Route 1293 | 1294 | """Get all trips""" 1295 | trips( 1296 | """Only return trips with these feedIds""" 1297 | feeds: [String] 1298 | ): [Trip] 1299 | 1300 | """ 1301 | Get a single trip based on its ID, i.e. value of field `gtfsId` (format is `FeedId:TripId`) 1302 | """ 1303 | trip(id: String!): Trip 1304 | 1305 | """ 1306 | Finds a trip matching the given parameters. This query type is useful if the 1307 | id of a trip is not known, but other details uniquely identifying the trip are 1308 | available from some source (e.g. MQTT vehicle positions). 1309 | """ 1310 | fuzzyTrip( 1311 | """id of the route""" 1312 | route: String! 1313 | 1314 | """ 1315 | Direction of the trip, possible values: 0, 1 or -1. 1316 | -1 indicates that the direction is irrelevant, i.e. in case the route has 1317 | trips only in one direction. See field `directionId` of Pattern. 1318 | """ 1319 | direction: Int = -1 1320 | 1321 | """Departure date of the trip, format: YYYY-MM-DD""" 1322 | date: String! 1323 | 1324 | """ 1325 | Departure time of the trip, format: seconds since midnight of the departure date 1326 | """ 1327 | time: Int! 1328 | ): Trip 1329 | 1330 | """Get cancelled TripTimes.""" 1331 | cancelledTripTimes( 1332 | """Feed feedIds (e.g. ["HSL"]).""" 1333 | feeds: [String] 1334 | 1335 | """Route gtfsIds (e.g. ["HSL:1098"]).""" 1336 | routes: [String] 1337 | 1338 | """TripPattern codes (e.g. ["HSL:1098:1:01"]).""" 1339 | patterns: [String] 1340 | 1341 | """Trip gtfsIds (e.g. ["HSL:1098_20190405_Ma_2_1455"]).""" 1342 | trips: [String] 1343 | 1344 | """ 1345 | Only cancelled trip times scheduled to run on minDate or after are returned. Format: "2019-12-23" or "20191223". 1346 | """ 1347 | minDate: String 1348 | 1349 | """ 1350 | Only cancelled trip times scheduled to run on maxDate or before are returned. Format: "2019-12-23" or "20191223". 1351 | """ 1352 | maxDate: String 1353 | 1354 | """ 1355 | Only cancelled trip times that have first stop departure time at 1356 | minDepartureTime or after are returned. Format: seconds since midnight of minDate. 1357 | """ 1358 | minDepartureTime: Int 1359 | 1360 | """ 1361 | Only cancelled trip times that have first stop departure time at 1362 | maxDepartureTime or before are returned. Format: seconds since midnight of maxDate. 1363 | """ 1364 | maxDepartureTime: Int 1365 | 1366 | """ 1367 | Only cancelled trip times that have last stop arrival time at minArrivalTime 1368 | or after are returned. Format: seconds since midnight of minDate. 1369 | """ 1370 | minArrivalTime: Int 1371 | 1372 | """ 1373 | Only cancelled trip times that have last stop arrival time at maxArrivalTime 1374 | or before are returned. Format: seconds since midnight of maxDate. 1375 | """ 1376 | maxArrivalTime: Int 1377 | ): [Stoptime] 1378 | 1379 | """Get all patterns""" 1380 | patterns: [Pattern] 1381 | 1382 | """ 1383 | Get a single pattern based on its ID, i.e. value of field `code` (format is 1384 | `FeedId:RouteId:DirectionId:PatternVariantNumber`) 1385 | """ 1386 | pattern(id: String!): Pattern 1387 | 1388 | """Get all clusters""" 1389 | clusters: [Cluster] 1390 | 1391 | """Get a single cluster based on its ID, i.e. value of field `gtfsId`""" 1392 | cluster(id: String!): Cluster 1393 | 1394 | """Get all active alerts""" 1395 | alerts( 1396 | """Only return alerts in these feeds""" 1397 | feeds: [String!] 1398 | 1399 | """Only return alerts with these severity levels""" 1400 | severityLevel: [AlertSeverityLevelType!] 1401 | 1402 | """Only return alerts with these effects""" 1403 | effect: [AlertEffectType!] 1404 | 1405 | """Only return alerts with these causes""" 1406 | cause: [AlertCauseType!] 1407 | ): [Alert] 1408 | 1409 | """Get the time range for which the API has data available""" 1410 | serviceTimeRange: serviceTimeRange 1411 | 1412 | """Get all bike rental stations""" 1413 | bikeRentalStations: [BikeRentalStation] 1414 | 1415 | """ 1416 | Get a single bike rental station based on its ID, i.e. value of field `stationId` 1417 | """ 1418 | bikeRentalStation(id: String!): BikeRentalStation 1419 | 1420 | """Get all bike parks""" 1421 | bikeParks: [BikePark] 1422 | 1423 | """ 1424 | Get a single bike park based on its ID, i.e. value of field `bikeParkId` 1425 | """ 1426 | bikePark(id: String!): BikePark 1427 | 1428 | """Get all car parks""" 1429 | carParks( 1430 | """ 1431 | Return car parks with these ids. 1432 | **Note:** if an id is invalid (or the car park service is unavailable) the returned list will contain `null` values. 1433 | """ 1434 | ids: [String] 1435 | ): [CarPark] 1436 | 1437 | """Get a single car park based on its ID, i.e. value of field `carParkId`""" 1438 | carPark(id: String!): CarPark 1439 | 1440 | """Needed until https://github.com/facebook/relay/issues/112 is resolved""" 1441 | viewer: QueryType 1442 | 1443 | """ 1444 | Plans an itinerary from point A to point B based on the given arguments 1445 | """ 1446 | plan( 1447 | """ 1448 | Date of departure or arrival in format YYYY-MM-DD. Default value: current date 1449 | """ 1450 | date: String 1451 | 1452 | """ 1453 | Time of departure or arrival in format hh:mm:ss. Default value: current time 1454 | """ 1455 | time: String 1456 | 1457 | """ 1458 | The geographical location where the itinerary begins. 1459 | Use either this argument or `fromPlace`, but not both. 1460 | """ 1461 | from: InputCoordinates 1462 | 1463 | """ 1464 | The geographical location where the itinerary ends. 1465 | Use either this argument or `toPlace`, but not both. 1466 | """ 1467 | to: InputCoordinates 1468 | 1469 | """ 1470 | The place where the itinerary begins in format `name::place`, where `place` 1471 | is either a lat,lng pair (e.g. `Pasila::60.199041,24.932928`) or a stop id 1472 | (e.g. `Pasila::HSL:1000202`). 1473 | Use either this argument or `from`, but not both. 1474 | """ 1475 | fromPlace: String 1476 | 1477 | """ 1478 | The place where the itinerary ends in format `name::place`, where `place` is 1479 | either a lat,lng pair (e.g. `Pasila::60.199041,24.932928`) or a stop id 1480 | (e.g. `Pasila::HSL:1000202`). 1481 | Use either this argument or `to`, but not both. 1482 | """ 1483 | toPlace: String 1484 | 1485 | """ 1486 | Whether the itinerary must be wheelchair accessible. Default value: false 1487 | """ 1488 | wheelchair: Boolean 1489 | 1490 | """The maximum number of itineraries to return. Default value: 3.""" 1491 | numItineraries: Int = 3 1492 | 1493 | """ 1494 | The maximum distance (in meters) the user is willing to walk per walking 1495 | section. If the only transport mode allowed is `WALK`, then the value of 1496 | this argument is ignored. 1497 | Default: 2000m 1498 | Maximum value: 15000m 1499 | **Note:** If this argument has a relatively small value and only some 1500 | transport modes are allowed (e.g. `WALK` and `RAIL`), it is possible to get 1501 | an itinerary which has (useless) back and forth public transport legs to 1502 | avoid walking too long distances. 1503 | """ 1504 | maxWalkDistance: Float 1505 | 1506 | """ 1507 | The maximum time (in seconds) of pre-transit travel when using 1508 | drive-to-transit (park and ride or kiss and ride). Default value: 1800. 1509 | """ 1510 | maxPreTransitTime: Int 1511 | 1512 | """ 1513 | How expensive it is to drive a car when car&parking, increase this value to 1514 | make car driving legs shorter. Default value: 1. 1515 | """ 1516 | carParkCarLegWeight: Float 1517 | 1518 | """ 1519 | How easily bad itineraries are filtered from results. Value 0 (default) 1520 | disables filtering. Itineraries are filtered if they are worse than another 1521 | one in some respect (e.g. more walking) by more than the percentage of 1522 | filtering level, which is calculated by dividing 100% by the value of this 1523 | argument (e.g. `itineraryFiltering = 0.5` → 200% worse itineraries are filtered). 1524 | """ 1525 | itineraryFiltering: Float 1526 | 1527 | """ 1528 | A multiplier for how bad walking is, compared to being in transit for equal 1529 | lengths of time.Empirically, values between 10 and 20 seem to correspond 1530 | well to the concept of not wanting to walk too much without asking for 1531 | totally ridiculous itineraries, but this observation should in no way be 1532 | taken as scientific or definitive. Your mileage may vary. Default value: 2.0 1533 | """ 1534 | walkReluctance: Float 1535 | 1536 | """ 1537 | How much more reluctant is the user to walk on streets with car traffic allowed. Default value: 1.0 1538 | """ 1539 | walkOnStreetReluctance: Float 1540 | 1541 | """ 1542 | How much worse is waiting for a transit vehicle than being on a transit 1543 | vehicle, as a multiplier. The default value treats wait and on-vehicle time 1544 | as the same. It may be tempting to set this higher than walkReluctance (as 1545 | studies often find this kind of preferences among riders) but the planner 1546 | will take this literally and walk down a transit line to avoid waiting at a 1547 | stop. This used to be set less than 1 (0.95) which would make waiting 1548 | offboard preferable to waiting onboard in an interlined trip. That is also 1549 | undesirable. If we only tried the shortest possible transfer at each stop to 1550 | neighboring stop patterns, this problem could disappear. Default value: 1.0. 1551 | """ 1552 | waitReluctance: Float 1553 | 1554 | """ 1555 | How much less bad is waiting at the beginning of the trip (replaces 1556 | `waitReluctance` on the first boarding). Default value: 0.4 1557 | """ 1558 | waitAtBeginningFactor: Float 1559 | 1560 | """ 1561 | Max walk speed along streets, in meters per second. Default value: 1.33 1562 | """ 1563 | walkSpeed: Float 1564 | 1565 | """Max bike speed along streets, in meters per second. Default value: 5.0""" 1566 | bikeSpeed: Float 1567 | 1568 | """Time to get on and off your own bike, in seconds. Default value: 0""" 1569 | bikeSwitchTime: Int 1570 | 1571 | """ 1572 | Cost of getting on and off your own bike. Unit: seconds. Default value: 0 1573 | """ 1574 | bikeSwitchCost: Int 1575 | 1576 | """ 1577 | Optimization type for bicycling legs, e.g. prefer flat terrain. Default value: `QUICK` 1578 | """ 1579 | optimize: OptimizeType 1580 | 1581 | """ 1582 | Triangle optimization parameters for bicycling legs. Only effective when `optimize` is set to **TRIANGLE**. 1583 | """ 1584 | triangle: InputTriangle 1585 | 1586 | """ 1587 | Whether the itinerary should depart at the specified time (false), or arrive 1588 | to the destination at the specified time (true). Default value: false. 1589 | """ 1590 | arriveBy: Boolean 1591 | 1592 | """An ordered list of intermediate locations to be visited.""" 1593 | intermediatePlaces: [InputCoordinates] 1594 | 1595 | """ 1596 | List of routes and agencies which are given higher preference when planning the itinerary 1597 | """ 1598 | preferred: InputPreferred 1599 | 1600 | """ 1601 | List of routes and agencies which are given lower preference when planning the itinerary 1602 | """ 1603 | unpreferred: InputUnpreferred 1604 | 1605 | """ 1606 | This prevents unnecessary transfers by adding a cost for boarding a vehicle. Unit: seconds. Default value: 600 1607 | """ 1608 | walkBoardCost: Int 1609 | 1610 | """ 1611 | Separate cost for boarding a vehicle with a bicycle, which is more difficult 1612 | than on foot. Unit: seconds. Default value: 600 1613 | """ 1614 | bikeBoardCost: Int 1615 | 1616 | """ 1617 | List of routes, trips, agencies and stops which are not used in the itinerary 1618 | """ 1619 | banned: InputBanned 1620 | 1621 | """ 1622 | An extra penalty added on transfers (i.e. all boardings except the first 1623 | one). Not to be confused with bikeBoardCost and walkBoardCost, which are the 1624 | cost of boarding a vehicle with and without a bicycle. The boardCosts are 1625 | used to model the 'usual' perceived cost of using a transit vehicle, and the 1626 | transferPenalty is used when a user requests even less transfers. In the 1627 | latter case, we don't actually optimize for fewest transfers, as this can 1628 | lead to absurd results. Consider a trip in New York from Grand Army Plaza 1629 | (the one in Brooklyn) to Kalustyan's at noon. The true lowest transfers 1630 | route is to wait until midnight, when the 4 train runs local the whole way. 1631 | The actual fastest route is the 2/3 to the 4/5 at Nevins to the 6 at Union 1632 | Square, which takes half an hour. Even someone optimizing for fewest 1633 | transfers doesn't want to wait until midnight. Maybe they would be willing 1634 | to walk to 7th Ave and take the Q to Union Square, then transfer to the 6. 1635 | If this takes less than optimize_transfer_penalty seconds, then that's what 1636 | we'll return. Default value: 0. 1637 | """ 1638 | transferPenalty: Int 1639 | 1640 | """ 1641 | This argument has no use for itinerary planning and will be removed later. 1642 | ~~When true, do not use goal direction or stop at the target, build a full SPT. Default value: false.~~ 1643 | """ 1644 | batch: Boolean 1645 | 1646 | """ 1647 | Deprecated, use `transportModes` instead. 1648 | ~~The set of TraverseModes that a user is willing to use. Default value: WALK | TRANSIT.~~ 1649 | """ 1650 | modes: String 1651 | 1652 | """ 1653 | List of transportation modes that the user is willing to use. Default: `["WALK","TRANSIT"]` 1654 | """ 1655 | transportModes: [TransportMode] 1656 | 1657 | """ 1658 | The weight multipliers for transit modes. WALK, BICYCLE, CAR, TRANSIT and LEG_SWITCH are not included. 1659 | """ 1660 | modeWeight: InputModeWeight 1661 | 1662 | """Is bike rental allowed? Default value: false""" 1663 | allowBikeRental: Boolean 1664 | 1665 | """ 1666 | Invariant: `boardSlack + alightSlack <= transferSlack`. Default value: 0 1667 | """ 1668 | boardSlack: Int 1669 | 1670 | """ 1671 | Invariant: `boardSlack + alightSlack <= transferSlack`. Default value: 0 1672 | """ 1673 | alightSlack: Int 1674 | 1675 | """ 1676 | A global minimum transfer time (in seconds) that specifies the minimum 1677 | amount of time that must pass between exiting one transit vehicle and 1678 | boarding another. This time is in addition to time it might take to walk 1679 | between transit stops. Default value: 0 1680 | """ 1681 | minTransferTime: Int 1682 | 1683 | """ 1684 | Penalty (in seconds) for using a non-preferred transfer. Default value: 180 1685 | """ 1686 | nonpreferredTransferPenalty: Int 1687 | 1688 | """Maximum number of transfers. Default value: 2""" 1689 | maxTransfers: Int 1690 | 1691 | """ 1692 | This argument has currently no effect on which itineraries are returned. Use 1693 | argument `fromPlace` to start the itinerary from a specific stop. 1694 | ~~A transit stop that this trip must start from~~ 1695 | """ 1696 | startTransitStopId: String 1697 | 1698 | """ 1699 | ID of the trip on which the itinerary starts. This argument can be used to 1700 | plan itineraries when the user is already onboard a vehicle. When using this 1701 | argument, arguments `time` and `from` should be set based on a vehicle 1702 | position message received from the vehicle running the specified trip. 1703 | **Note:** this argument only takes into account the route and estimated 1704 | travel time of the trip (and therefore arguments `time` and `from` must be 1705 | used correctly to get meaningful itineraries). 1706 | """ 1707 | startTransitTripId: String 1708 | 1709 | """ 1710 | No effect on itinerary planning, adjust argument `time` instead to get later departures. 1711 | ~~The maximum wait time in seconds the user is willing to delay trip start. Only effective in Analyst.~~ 1712 | """ 1713 | claimInitialWait: Long 1714 | 1715 | """ 1716 | **Consider this argument experimental** – setting this argument to true 1717 | causes timeouts and unoptimal routes in many cases. 1718 | When true, reverse optimize (find alternative transportation mode, which 1719 | still arrives to the destination in time) this search on the fly after 1720 | processing each transit leg, rather than reverse-optimizing the entire path 1721 | when it's done. Default value: false. 1722 | """ 1723 | reverseOptimizeOnTheFly: Boolean 1724 | 1725 | """ 1726 | When false, return itineraries using canceled trips. Default value: true. 1727 | """ 1728 | omitCanceled: Boolean = true 1729 | 1730 | """ 1731 | When true, realtime updates are ignored during this search. Default value: false 1732 | """ 1733 | ignoreRealtimeUpdates: Boolean 1734 | 1735 | """ 1736 | Only useful for testing and troubleshooting. 1737 | ~~If true, the remaining weight heuristic is disabled. Currently only 1738 | implemented for the long distance path service. Default value: false.~~ 1739 | """ 1740 | disableRemainingWeightHeuristic: Boolean 1741 | 1742 | """ 1743 | Two-letter language code (ISO 639-1) used for returned text. 1744 | **Note:** only part of the data has translations available and names of 1745 | stops and POIs are returned in their default language. Due to missing 1746 | translations, it is sometimes possible that returned text uses a mixture of two languages. 1747 | """ 1748 | locale: String 1749 | 1750 | """ 1751 | **Deprecated:** Use `allowedTicketTypes` instead. 1752 | A comma-separated list of allowed ticket types. 1753 | """ 1754 | ticketTypes: String 1755 | 1756 | """ 1757 | List of ticket types that are allowed to be used in itineraries. 1758 | See `ticketTypes` query for list of possible ticket types. 1759 | """ 1760 | allowedTicketTypes: [String] 1761 | 1762 | """Tuning parameter for the search algorithm, mainly useful for testing.""" 1763 | heuristicStepsPerMainStep: Int 1764 | 1765 | """ 1766 | Whether legs should be compacted by performing a reversed search. 1767 | **Experimental argument, will be removed!** 1768 | """ 1769 | compactLegsByReversedSearch: Boolean 1770 | 1771 | """ 1772 | Which bike rental networks can be used. By default, all networks are allowed. 1773 | """ 1774 | allowedBikeRentalNetworks: [String] 1775 | ): Plan 1776 | } 1777 | 1778 | enum RealtimeState { 1779 | """ 1780 | The trip information comes from the GTFS feed, i.e. no real-time update has been applied. 1781 | """ 1782 | SCHEDULED 1783 | 1784 | """ 1785 | The trip information has been updated, but the trip pattern stayed the same as the trip pattern of the scheduled trip. 1786 | """ 1787 | UPDATED 1788 | 1789 | """The trip has been canceled by a real-time update.""" 1790 | CANCELED 1791 | 1792 | """ 1793 | The trip has been added using a real-time update, i.e. the trip was not present in the GTFS feed. 1794 | """ 1795 | ADDED 1796 | 1797 | """ 1798 | The trip information has been updated and resulted in a different trip pattern 1799 | compared to the trip pattern of the scheduled trip. 1800 | """ 1801 | MODIFIED 1802 | } 1803 | 1804 | """ 1805 | Route represents a public transportation service, usually from point A to point 1806 | B and *back*, shown to customers under a single name, e.g. bus 550. Routes 1807 | contain patterns (see field `patterns`), which describe different variants of 1808 | the route, e.g. outbound pattern from point A to point B and inbound pattern 1809 | from point B to point A. 1810 | """ 1811 | type Route implements Node { 1812 | """ 1813 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 1814 | """ 1815 | id: ID! 1816 | 1817 | """ID of the route in format `FeedId:RouteId`""" 1818 | gtfsId: String! 1819 | 1820 | """Agency operating the route""" 1821 | agency: Agency 1822 | 1823 | """Short name of the route, usually a line number, e.g. 550""" 1824 | shortName: String 1825 | 1826 | """Long name of the route, e.g. Helsinki-Leppävaara""" 1827 | longName: String 1828 | 1829 | """Transport mode of this route, e.g. `BUS`""" 1830 | mode: Mode 1831 | 1832 | """ 1833 | The raw GTFS route type as a integer. For the list of possible values, see: 1834 | https://developers.google.com/transit/gtfs/reference/#routestxt and 1835 | https://developers.google.com/transit/gtfs/reference/extended-route-types 1836 | """ 1837 | type: Int 1838 | desc: String 1839 | url: String 1840 | 1841 | """ 1842 | The color (in hexadecimal format) the agency operating this route would prefer 1843 | to use on UI elements (e.g. polylines on a map) related to this route. This 1844 | value is not available for most routes. 1845 | """ 1846 | color: String 1847 | 1848 | """ 1849 | The color (in hexadecimal format) the agency operating this route would prefer 1850 | to use when displaying text related to this route. This value is not available 1851 | for most routes. 1852 | """ 1853 | textColor: String 1854 | bikesAllowed: BikesAllowed 1855 | 1856 | """List of patterns which operate on this route""" 1857 | patterns: [Pattern] 1858 | 1859 | """List of stops on this route""" 1860 | stops: [Stop] 1861 | 1862 | """List of trips which operate on this route""" 1863 | trips: [Trip] 1864 | 1865 | """List of alerts which have an effect on the route""" 1866 | alerts: [Alert] 1867 | } 1868 | 1869 | """Time range for which the API has data available""" 1870 | type serviceTimeRange { 1871 | """ 1872 | Time from which the API has data available. Format: Unix timestamp in seconds 1873 | """ 1874 | start: Long 1875 | 1876 | """ 1877 | Time until which the API has data available. Format: Unix timestamp in seconds 1878 | """ 1879 | end: Long 1880 | } 1881 | 1882 | type step { 1883 | """The distance in meters that this step takes.""" 1884 | distance: Float 1885 | 1886 | """The longitude of the start of the step.""" 1887 | lon: Float 1888 | 1889 | """The latitude of the start of the step.""" 1890 | lat: Float 1891 | 1892 | """The elevation profile as a list of { distance, elevation } values.""" 1893 | elevationProfile: [elevationProfileComponent] 1894 | } 1895 | 1896 | """ 1897 | Stop can represent either a single public transport stop, where passengers can 1898 | board and/or disembark vehicles, or a station, which contains multiple stops. 1899 | See field `locationType`. 1900 | """ 1901 | type Stop implements Node & PlaceInterface { 1902 | """ 1903 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 1904 | """ 1905 | id: ID! 1906 | 1907 | """Returns timetable of the specified pattern at this stop""" 1908 | stopTimesForPattern( 1909 | """Id of the pattern""" 1910 | id: String! 1911 | 1912 | """ 1913 | Return departures after this time. Format: Unix timestamp in seconds. Default value: current time 1914 | """ 1915 | startTime: Long = 0 1916 | 1917 | """ 1918 | Return stoptimes within this time range, starting from `startTime`. Unit: Seconds 1919 | """ 1920 | timeRange: Int = 86400 1921 | numberOfDepartures: Int = 2 1922 | 1923 | """If true, only those departures which allow boarding are returned""" 1924 | omitNonPickups: Boolean = false 1925 | 1926 | """If false, returns also canceled trips""" 1927 | omitCanceled: Boolean = true 1928 | ): [Stoptime] 1929 | 1930 | """ÌD of the stop in format `FeedId:StopId`""" 1931 | gtfsId: String! 1932 | 1933 | """Name of the stop, e.g. Pasilan asema""" 1934 | name: String! 1935 | 1936 | """Latitude of the stop (WGS 84)""" 1937 | lat: Float 1938 | 1939 | """Longitude of the stop (WGS 84)""" 1940 | lon: Float 1941 | 1942 | """Stop code which is visible at the stop""" 1943 | code: String 1944 | 1945 | """Description of the stop, usually a street name""" 1946 | desc: String 1947 | 1948 | """ID of the zone where this stop is located""" 1949 | zoneId: String 1950 | url: String 1951 | 1952 | """Identifies whether this stop represents a stop or station.""" 1953 | locationType: LocationType 1954 | 1955 | """ 1956 | The station which this stop is part of (or null if this stop is not part of a station) 1957 | """ 1958 | parentStation: Stop 1959 | 1960 | """ 1961 | Whether wheelchair boarding is possible for at least some of vehicles on this stop 1962 | """ 1963 | wheelchairBoarding: WheelchairBoarding 1964 | direction: String 1965 | timezone: String 1966 | 1967 | """ 1968 | The raw GTFS route type used by routes which pass through this stop. For the 1969 | list of possible values, see: 1970 | https://developers.google.com/transit/gtfs/reference/#routestxt and 1971 | https://developers.google.com/transit/gtfs/reference/extended-route-types 1972 | """ 1973 | vehicleType: Int 1974 | 1975 | """ 1976 | Transport mode (e.g. `BUS`) used by routes which pass through this stop or 1977 | `null` if mode cannot be determined, e.g. in case no routes pass through the stop. 1978 | Note that also other types of vehicles may use the stop, e.g. tram replacement 1979 | buses might use stops which have `TRAM` as their mode. 1980 | """ 1981 | vehicleMode: Mode 1982 | 1983 | """ 1984 | Identifier of the platform, usually a number. This value is only present for stops that are part of a station 1985 | """ 1986 | platformCode: String 1987 | 1988 | """The cluster which this stop is part of""" 1989 | cluster: Cluster 1990 | 1991 | """ 1992 | Returns all stops that are children of this station (Only applicable for stations) 1993 | """ 1994 | stops: [Stop] 1995 | 1996 | """Routes which pass through this stop""" 1997 | routes: [Route!] 1998 | 1999 | """Patterns which pass through this stop""" 2000 | patterns: [Pattern] 2001 | 2002 | """List of nearby stops which can be used for transfers""" 2003 | transfers( 2004 | """ 2005 | Maximum distance to the transfer stop. Defaults to unlimited. 2006 | **Note:** only stops that are linked as a transfer stops to this stop are 2007 | returned, i.e. this does not do a query to search for *all* stops within 2008 | radius of `maxDistance`. 2009 | """ 2010 | maxDistance: Int 2011 | ): [stopAtDistance] 2012 | 2013 | """Returns list of stoptimes for the specified date""" 2014 | stoptimesForServiceDate( 2015 | """Date in format YYYYMMDD""" 2016 | date: String 2017 | 2018 | """If true, only those departures which allow boarding are returned""" 2019 | omitNonPickups: Boolean = false 2020 | 2021 | """If false, returns also canceled trips""" 2022 | omitCanceled: Boolean = false 2023 | ): [StoptimesInPattern] 2024 | 2025 | """ 2026 | Returns list of stoptimes (arrivals and departures) at this stop, grouped by patterns 2027 | """ 2028 | stoptimesForPatterns( 2029 | """ 2030 | Return departures after this time. Format: Unix timestamp in seconds. Default value: current time 2031 | """ 2032 | startTime: Long = 0 2033 | 2034 | """ 2035 | Return stoptimes within this time range, starting from `startTime`. Unit: Seconds 2036 | """ 2037 | timeRange: Int = 86400 2038 | numberOfDepartures: Int = 5 2039 | 2040 | """If true, only those departures which allow boarding are returned""" 2041 | omitNonPickups: Boolean = false 2042 | 2043 | """If false, returns also canceled trips""" 2044 | omitCanceled: Boolean = true 2045 | ): [StoptimesInPattern] 2046 | 2047 | """Returns list of stoptimes (arrivals and departures) at this stop""" 2048 | stoptimesWithoutPatterns( 2049 | """ 2050 | Return departures after this time. Format: Unix timestamp in seconds. Default value: current time 2051 | """ 2052 | startTime: Long = 0 2053 | 2054 | """ 2055 | Return stoptimes within this time range, starting from `startTime`. Unit: Seconds 2056 | """ 2057 | timeRange: Int = 86400 2058 | numberOfDepartures: Int = 5 2059 | 2060 | """If true, only those departures which allow boarding are returned""" 2061 | omitNonPickups: Boolean = false 2062 | 2063 | """If false, returns also canceled trips""" 2064 | omitCanceled: Boolean = true 2065 | ): [Stoptime] 2066 | 2067 | """List of alerts which have an effect on this stop""" 2068 | alerts: [Alert] 2069 | } 2070 | 2071 | type stopAtDistance implements Node { 2072 | """ 2073 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 2074 | """ 2075 | id: ID! 2076 | stop: Stop 2077 | 2078 | """Walking distance to the stop along streets and paths""" 2079 | distance: Int 2080 | } 2081 | 2082 | """A connection to a list of items.""" 2083 | type stopAtDistanceConnection { 2084 | edges: [stopAtDistanceEdge] 2085 | pageInfo: PageInfo! 2086 | } 2087 | 2088 | """An edge in a connection.""" 2089 | type stopAtDistanceEdge { 2090 | """The item at the end of the edge""" 2091 | node: stopAtDistance 2092 | cursor: String! 2093 | } 2094 | 2095 | """ 2096 | Stoptime represents the time when a specific trip arrives to or departs from a specific stop. 2097 | """ 2098 | type Stoptime { 2099 | """The stop where this arrival/departure happens""" 2100 | stop: Stop 2101 | 2102 | """ 2103 | Scheduled arrival time. Format: seconds since midnight of the departure date 2104 | """ 2105 | scheduledArrival: Int 2106 | 2107 | """ 2108 | Realtime prediction of arrival time. Format: seconds since midnight of the departure date 2109 | """ 2110 | realtimeArrival: Int 2111 | 2112 | """ 2113 | The offset from the scheduled arrival time in seconds. Negative values 2114 | indicate that the trip is running ahead of schedule. 2115 | """ 2116 | arrivalDelay: Int 2117 | 2118 | """ 2119 | Scheduled departure time. Format: seconds since midnight of the departure date 2120 | """ 2121 | scheduledDeparture: Int 2122 | 2123 | """ 2124 | Realtime prediction of departure time. Format: seconds since midnight of the departure date 2125 | """ 2126 | realtimeDeparture: Int 2127 | 2128 | """ 2129 | The offset from the scheduled departure time in seconds. Negative values 2130 | indicate that the trip is running ahead of schedule 2131 | """ 2132 | departureDelay: Int 2133 | 2134 | """ 2135 | true, if this stop is used as a time equalization stop. false otherwise. 2136 | """ 2137 | timepoint: Boolean 2138 | 2139 | """true, if this stoptime has real-time data available""" 2140 | realtime: Boolean 2141 | 2142 | """State of real-time data""" 2143 | realtimeState: RealtimeState 2144 | 2145 | """ 2146 | Whether the vehicle can be boarded at this stop. This field can also be used 2147 | to indicate if boarding is possible only with special arrangements. 2148 | """ 2149 | pickupType: PickupDropoffType 2150 | 2151 | """ 2152 | Whether the vehicle can be disembarked at this stop. This field can also be 2153 | used to indicate if disembarkation is possible only with special arrangements. 2154 | """ 2155 | dropoffType: PickupDropoffType 2156 | 2157 | """ 2158 | Departure date of the trip. Format: Unix timestamp (local time) in seconds. 2159 | """ 2160 | serviceDay: Long 2161 | 2162 | """Trip which this stoptime is for""" 2163 | trip: Trip 2164 | stopHeadsign: String @deprecated(reason: "Use headsign instead, will be removed in the future") 2165 | 2166 | """ 2167 | Vehicle headsign of the trip on this stop. Trip headsigns can change during 2168 | the trip (e.g. on routes which run on loops), so this value should be used 2169 | instead of `tripHeadsign` to display the headsign relevant to the user. 2170 | """ 2171 | headsign: String 2172 | } 2173 | 2174 | """Stoptimes grouped by pattern""" 2175 | type StoptimesInPattern { 2176 | pattern: Pattern 2177 | stoptimes: [Stoptime] 2178 | } 2179 | 2180 | """Describes ticket type""" 2181 | type TicketType implements Node { 2182 | """ 2183 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 2184 | """ 2185 | id: ID! 2186 | 2187 | """ 2188 | Ticket type ID in format `FeedId:TicketTypeId`. Ticket type IDs are usually 2189 | combination of ticket zones where the ticket is valid. 2190 | """ 2191 | fareId: ID! 2192 | 2193 | """Price of the ticket in currency that is specified in `currency` field""" 2194 | price: Float 2195 | 2196 | """ISO 4217 currency code""" 2197 | currency: String 2198 | 2199 | """ 2200 | List of zones where this ticket is valid. 2201 | Corresponds to field `zoneId` in **Stop** type. 2202 | """ 2203 | zones: [String!] 2204 | } 2205 | 2206 | """Text with language""" 2207 | type TranslatedString { 2208 | text: String 2209 | 2210 | """Two-letter language code (ISO 639-1)""" 2211 | language: String 2212 | } 2213 | 2214 | """Transportation mode which can be used in the itinerary""" 2215 | input TransportMode { 2216 | mode: Mode! 2217 | 2218 | """Optional additional qualifier for transport mode, e.g. `RENT`""" 2219 | qualifier: Qualifier 2220 | } 2221 | 2222 | """ 2223 | Trip is a specific occurance of a pattern, usually identified by route, direction on the route and exact departure time. 2224 | """ 2225 | type Trip implements Node { 2226 | """ 2227 | Global object ID provided by Relay. This value can be used to refetch this object using **node** query. 2228 | """ 2229 | id: ID! 2230 | 2231 | """ID of the trip in format `FeedId:TripId`""" 2232 | gtfsId: String! 2233 | 2234 | """The route the trip is running on""" 2235 | route: Route! 2236 | serviceId: String 2237 | 2238 | """List of dates when this trip is in service. Format: YYYYMMDD""" 2239 | activeDates: [String] 2240 | tripShortName: String 2241 | 2242 | """Headsign of the vehicle when running on this trip""" 2243 | tripHeadsign: String 2244 | 2245 | """ 2246 | Short name of the route this trip is running. See field `shortName` of Route. 2247 | """ 2248 | routeShortName: String 2249 | 2250 | """ 2251 | Direction code of the trip, i.e. is this the outbound or inbound trip of a 2252 | pattern. Possible values: 0, 1 or `null` if the direction is irrelevant, i.e. 2253 | the pattern has trips only in one direction. 2254 | """ 2255 | directionId: String 2256 | blockId: String 2257 | shapeId: String 2258 | 2259 | """Whether the vehicle running this trip can be boarded by a wheelchair""" 2260 | wheelchairAccessible: WheelchairBoarding 2261 | 2262 | """Whether bikes are allowed on board the vehicle running this trip""" 2263 | bikesAllowed: BikesAllowed 2264 | 2265 | """The pattern the trip is running on""" 2266 | pattern: Pattern 2267 | 2268 | """List of stops this trip passes through""" 2269 | stops: [Stop!]! 2270 | 2271 | """ 2272 | Hash code of the trip. This value is stable and not dependent on the trip id. 2273 | """ 2274 | semanticHash: String! 2275 | 2276 | """List of times when this trip arrives to or departs from a stop""" 2277 | stoptimes: [Stoptime] 2278 | 2279 | """Departure time from the first stop""" 2280 | departureStoptime( 2281 | """ 2282 | Date for which the departure time is returned. Format: YYYYMMDD. If this 2283 | argument is not used, field `serviceDay` in the stoptime will have a value of 0. 2284 | """ 2285 | serviceDate: String 2286 | ): Stoptime 2287 | 2288 | """Arrival time to the final stop""" 2289 | arrivalStoptime( 2290 | """ 2291 | Date for which the arrival time is returned. Format: YYYYMMDD. If this 2292 | argument is not used, field `serviceDay` in the stoptime will have a value of 0. 2293 | """ 2294 | serviceDate: String 2295 | ): Stoptime 2296 | stoptimesForDate( 2297 | """Deprecated, please switch to serviceDate instead""" 2298 | serviceDay: String 2299 | 2300 | """Date for which stoptimes are returned. Format: YYYYMMDD""" 2301 | serviceDate: String 2302 | ): [Stoptime] 2303 | 2304 | """List of coordinates of this trip's route""" 2305 | geometry: [[Float]] 2306 | 2307 | """ 2308 | Coordinates of the route of this trip in Google polyline encoded format 2309 | """ 2310 | tripGeometry: Geometry 2311 | 2312 | """List of alerts which have an effect on this trip""" 2313 | alerts: [Alert] 2314 | } 2315 | 2316 | enum VertexType { 2317 | """NORMAL""" 2318 | NORMAL 2319 | 2320 | """TRANSIT""" 2321 | TRANSIT 2322 | 2323 | """BIKEPARK""" 2324 | BIKEPARK 2325 | 2326 | """BIKESHARE""" 2327 | BIKESHARE 2328 | 2329 | """PARKANDRIDE""" 2330 | PARKANDRIDE 2331 | } 2332 | 2333 | enum WheelchairBoarding { 2334 | """There is no accessibility information for the stop.""" 2335 | NO_INFORMATION 2336 | 2337 | """ 2338 | At least some vehicles at this stop can be boarded by a rider in a wheelchair. 2339 | """ 2340 | POSSIBLE 2341 | 2342 | """Wheelchair boarding is not possible at this stop.""" 2343 | NOT_POSSIBLE 2344 | } 2345 | --------------------------------------------------------------------------------