Skip to content

Commit

Permalink
feat: Add example for retrieving shape information
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmedhossamdev committed Aug 12, 2024
1 parent bfe5e3e commit 8d6ddac
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/shape.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import onebusaway from '../dist/index.mjs';
import { loadSettings } from './helpers/load-env.mjs';

// Load settings from .env file, if it exists. If not, we'll use the
// Puget Sound server URL (which is also the default in the SDK) and
// the 'TEST' API key.
const settings = loadSettings({
apiKey: 'TEST',
baseUrl: 'https://api.pugetsound.onebusaway.org/',
});

// Create a new instance of the OneBusAway SDK with the settings we loaded.
const oba = new onebusaway(settings);

async function main() {
const shapeId = '1_10002005';
const response = await oba.shape.retrieve(shapeId);
console.log(response.data.entry.points[0]);
}

main();

0 comments on commit 8d6ddac

Please sign in to comment.