Alpaca Travel GraphQL SDK for fetch
A basic fetch based SDK for use in the browser.
See More:
UNPKG CDN
You can use a hosted version of the SDK via unpkg.com which mirrors and hosts
the release made to NPM.
Latest release
https://unpkg.com/@alpaca-travel/graph-sdk-fetch@latest/dist/umd/graph-sdk.min.js
Example pinned to version 2
You can also target a specific version in the URL, pinning the version following
a semver style. This will ensure that breaking changes do not affect your
implementation.
https://unpkg.com/@alpaca-travel/graph-sdk-fetch@2/dist/umd/graph-sdk.min.js
Example HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/@alpaca-travel/graph-sdk-fetch@latest/dist/umd/graph-sdk.min.js"></script>
</head>
<body>
<script type="text/javascript">
const ACCESS_TOKEN = "UPDATE_WITH_YOUR_ACCESS_TOKEN";
const sdk = alpacaGraphSdk.getClientSdk({
url: `https://withalpaca.com/api/graphql?accessToken=${ACCESS_TOKEN}`,
});
sdk
.getItinerary({
id: "itinerary/0mttpRn7spYNDIV979fHbE",
})
.then(({ data }) => console.log(data))
.catch(console.error);
</script>
</body>
</html>