Client basics
@mountaya/client is one typed client for the three APIs. It holds your credential, builds every request, and hands back typed data.
A publishable key alone reads published content on the Map Studio and Tile APIs. Add a session token for the Data API, your drafts, and every write: authentication shows how to get one.
In a browser, import from @mountaya/client/browser.
A Map Studio or Tile API method resolves to the envelope, with the payload at data. A Data API method resolves to the operation's own field, here routes. Method names are the API reference's operation ids.
Every Data API method sends a full GraphQL selection. Pass select to ask for less: the return type narrows to the fields you name.
signal and timeoutMs go in the same options bag.
Put the client on MountayaProvider, inside your QueryClientProvider:
Then read with the hooks:
useItineraries, useCollections and useZones read a listing a page at a time, with fetchNextPage. useMountayaQuery reads any other operation by name.