-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from OneBusAway/release-please--branches--mai…
…n--changes--next--components--onebusaway-sdk release: 0.1.0-alpha.30
- Loading branch information
Showing
12 changed files
with
218 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
".": "0.1.0-alpha.29" | ||
".": "0.1.0-alpha.30" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 16 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-7a71bec90a568b0dbefc3d81206069d9759259460cffa0543b162f6835be1e9a.yml | ||
configured_endpoints: 17 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-160e2615de51b1febaeb9f4a2fbbb7e70939e1ebec74946e7ec1e026868fed7e.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 stopId = '1_75403'; | ||
const response = await oba.scheduleForStop.retrieve(stopId); | ||
|
||
for (let route of response.data.entry.stopRouteSchedules) { | ||
console.log(`Route ${route.routeId}`); | ||
for (let trip of route.stopRouteDirectionSchedules[0].scheduleStopTimes) { | ||
console.log(` ${trip.tripId} ${trip.arrivalTime}`); | ||
} | ||
} | ||
} | ||
|
||
main(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '../resource'; | ||
import { isRequestOptions } from '../core'; | ||
import * as Core from '../core'; | ||
import * as ScheduleForStopAPI from './schedule-for-stop'; | ||
import * as Shared from './shared'; | ||
|
||
export class ScheduleForStop extends APIResource { | ||
/** | ||
* Get schedule for a specific stop | ||
*/ | ||
retrieve( | ||
stopId: string, | ||
query?: ScheduleForStopRetrieveParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<ScheduleForStopRetrieveResponse>; | ||
retrieve(stopId: string, options?: Core.RequestOptions): Core.APIPromise<ScheduleForStopRetrieveResponse>; | ||
retrieve( | ||
stopId: string, | ||
query: ScheduleForStopRetrieveParams | Core.RequestOptions = {}, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<ScheduleForStopRetrieveResponse> { | ||
if (isRequestOptions(query)) { | ||
return this.retrieve(stopId, {}, query); | ||
} | ||
return this._client.get(`/api/where/schedule-for-stop/${stopId}.json`, { query, ...options }); | ||
} | ||
} | ||
|
||
export interface ScheduleForStopRetrieveResponse extends Shared.ResponseWrapper { | ||
data?: ScheduleForStopRetrieveResponse.Data; | ||
} | ||
|
||
export namespace ScheduleForStopRetrieveResponse { | ||
export interface Data { | ||
entry: Data.Entry; | ||
|
||
references: Shared.References; | ||
} | ||
|
||
export namespace Data { | ||
export interface Entry { | ||
date: number; | ||
|
||
stopId: string; | ||
|
||
stopRouteSchedules: Array<Entry.StopRouteSchedule>; | ||
} | ||
|
||
export namespace Entry { | ||
export interface StopRouteSchedule { | ||
routeId: string; | ||
|
||
stopRouteDirectionSchedules: Array<StopRouteSchedule.StopRouteDirectionSchedule>; | ||
} | ||
|
||
export namespace StopRouteSchedule { | ||
export interface StopRouteDirectionSchedule { | ||
scheduleStopTimes: Array<StopRouteDirectionSchedule.ScheduleStopTime>; | ||
|
||
tripHeadsign: string; | ||
|
||
scheduleFrequencies?: Array<StopRouteDirectionSchedule.ScheduleFrequency>; | ||
} | ||
|
||
export namespace StopRouteDirectionSchedule { | ||
export interface ScheduleStopTime { | ||
arrivalEnabled: boolean; | ||
|
||
arrivalTime: number; | ||
|
||
departureEnabled: boolean; | ||
|
||
departureTime: number; | ||
|
||
serviceId: string; | ||
|
||
tripId: string; | ||
|
||
stopHeadsign?: string; | ||
} | ||
|
||
export interface ScheduleFrequency { | ||
endTime: number; | ||
|
||
headway: number; | ||
|
||
serviceDate: number; | ||
|
||
serviceId: string; | ||
|
||
startTime: number; | ||
|
||
tripId: string; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
export interface ScheduleForStopRetrieveParams { | ||
/** | ||
* The date for which you want to request a schedule in the format YYYY-MM-DD | ||
* (optional, defaults to the current date) | ||
*/ | ||
date?: string; | ||
} | ||
|
||
export namespace ScheduleForStop { | ||
export import ScheduleForStopRetrieveResponse = ScheduleForStopAPI.ScheduleForStopRetrieveResponse; | ||
export import ScheduleForStopRetrieveParams = ScheduleForStopAPI.ScheduleForStopRetrieveParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const VERSION = '0.1.0-alpha.29'; // x-release-please-version | ||
export const VERSION = '0.1.0-alpha.30'; // x-release-please-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import OnebusawaySDK from 'onebusaway-sdk'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const client = new OnebusawaySDK({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource scheduleForStop', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = client.scheduleForStop.retrieve('stopID'); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('retrieve: request options instead of params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
client.scheduleForStop.retrieve('stopID', { path: '/_stainless_unknown_path' }), | ||
).rejects.toThrow(OnebusawaySDK.NotFoundError); | ||
}); | ||
|
||
test('retrieve: request options and params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
client.scheduleForStop.retrieve('stopID', { date: '2019-12-27' }, { path: '/_stainless_unknown_path' }), | ||
).rejects.toThrow(OnebusawaySDK.NotFoundError); | ||
}); | ||
}); |