Skip to content

Commit

Permalink
Merge pull request #61 from OneBusAway/release-please--branches--main…
Browse files Browse the repository at this point in the history
…--changes--next--components--onebusaway-sdk

release: 0.1.0-alpha.13
  • Loading branch information
Ahmedhossamdev authored Jun 28, 2024
2 parents 1a722e3 + b02a36f commit 8ecf299
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.prism.log
node_modules
yarn-error.log
codegen.log
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.12"
".": "0.1.0-alpha.13"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 6
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e2d8fe6ddeac1c6c1069b561d47fb0a2a5c821fe2840c734238e050d73fe211b.yml
configured_endpoints: 7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-078a3ae0f749c5f370d657032346c607e199d3f87f16c33e7b6b7555995663de.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.13 (2024-06-28)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/OneBusAway/js-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)

### Features

* **api:** update via SDK Studio ([#60](https://github.com/OneBusAway/js-sdk/issues/60)) ([aaabd42](https://github.com/OneBusAway/js-sdk/commit/aaabd42f7198bb397b39c5b3948208a39c4b6ab9))

## 0.1.0-alpha.12 (2024-06-26)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/OneBusAway/js-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
Expand Down
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ Types:
Methods:

- <code title="get /api/where/arrival-and-departure-for-stop/{stopID}.json">client.arrivalAndDepartureForStop.<a href="./src/resources/arrival-and-departure-for-stop.ts">retrieve</a>(stopId, { ...params }) -> ArrivalAndDepartureForStopRetrieveResponse</code>

# ArrivalsAndDeparturesForStop

Types:

- <code><a href="./src/resources/arrivals-and-departures-for-stop.ts">ArrivalsAndDeparturesForStopRetrieveResponse</a></code>

Methods:

- <code title="get /api/where/arrivals-and-departures-for-stop/{stopID}.json">client.arrivalsAndDeparturesForStop.<a href="./src/resources/arrivals-and-departures-for-stop.ts">retrieve</a>(stopId, { ...params }) -> ArrivalsAndDeparturesForStopRetrieveResponse</code>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onebusaway-sdk",
"version": "0.1.0-alpha.12",
"version": "0.1.0-alpha.13",
"description": "The official TypeScript library for the Onebusaway SDK API",
"author": "Onebusaway SDK <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class OnebusawaySDK extends Core.APIClient {
currentTime: API.CurrentTime = new API.CurrentTime(this);
stopsForLocation: API.StopsForLocation = new API.StopsForLocation(this);
arrivalAndDepartureForStop: API.ArrivalAndDepartureForStop = new API.ArrivalAndDepartureForStop(this);
arrivalsAndDeparturesForStop: API.ArrivalsAndDeparturesForStop = new API.ArrivalsAndDeparturesForStop(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return {
Expand Down Expand Up @@ -207,6 +208,10 @@ export namespace OnebusawaySDK {
export import ArrivalAndDepartureForStopRetrieveResponse = API.ArrivalAndDepartureForStopRetrieveResponse;
export import ArrivalAndDepartureForStopRetrieveParams = API.ArrivalAndDepartureForStopRetrieveParams;

export import ArrivalsAndDeparturesForStop = API.ArrivalsAndDeparturesForStop;
export import ArrivalsAndDeparturesForStopRetrieveResponse = API.ArrivalsAndDeparturesForStopRetrieveResponse;
export import ArrivalsAndDeparturesForStopRetrieveParams = API.ArrivalsAndDeparturesForStopRetrieveParams;

export import References = API.References;
export import ResponseWrapper = API.ResponseWrapper;
}
Expand Down
216 changes: 216 additions & 0 deletions src/resources/arrivals-and-departures-for-stop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
// 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 ArrivalsAndDeparturesForStopAPI from './arrivals-and-departures-for-stop';
import * as Shared from './shared';

export class ArrivalsAndDeparturesForStop extends APIResource {
/**
* arrivals-and-departures-for-stop
*/
retrieve(
stopId: string,
query?: ArrivalsAndDeparturesForStopRetrieveParams,
options?: Core.RequestOptions,
): Core.APIPromise<ArrivalsAndDeparturesForStopRetrieveResponse>;
retrieve(
stopId: string,
options?: Core.RequestOptions,
): Core.APIPromise<ArrivalsAndDeparturesForStopRetrieveResponse>;
retrieve(
stopId: string,
query: ArrivalsAndDeparturesForStopRetrieveParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<ArrivalsAndDeparturesForStopRetrieveResponse> {
if (isRequestOptions(query)) {
return this.retrieve(stopId, {}, query);
}
return this._client.get(`/api/where/arrivals-and-departures-for-stop/stopID.json`, { query, ...options });
}
}

export interface ArrivalsAndDeparturesForStopRetrieveResponse extends Shared.ResponseWrapper {
data?: ArrivalsAndDeparturesForStopRetrieveResponse.Data;
}

export namespace ArrivalsAndDeparturesForStopRetrieveResponse {
export interface Data {
entry?: Data.Entry;
}

export namespace Data {
export interface Entry {
arrivalsAndDepartures?: Array<Entry.ArrivalsAndDeparture>;

references?: Shared.References;
}

export namespace Entry {
export interface ArrivalsAndDeparture {
actualTrack?: string;

arrivalEnabled?: boolean;

blockTripSequence?: number;

departureEnabled?: boolean;

distanceFromStop?: number;

frequency?: string;

historicalOccupancy?: string;

lastUpdateTime?: number;

numberOfStopsAway?: number;

occupancyStatus?: string;

predicted?: boolean;

predictedArrivalInterval?: string;

predictedArrivalTime?: number;

predictedDepartureInterval?: string;

predictedDepartureTime?: number;

predictedOccupancy?: string;

routeId?: string;

routeLongName?: string;

routeShortName?: string;

scheduledArrivalInterval?: string;

scheduledArrivalTime?: number;

scheduledDepartureInterval?: string;

scheduledDepartureTime?: number;

scheduledTrack?: string;

serviceDate?: number;

situationIds?: Array<string>;

status?: string;

stopId?: string;

stopSequence?: number;

totalStopsInTrip?: number;

tripHeadsign?: string;

tripId?: string;

tripStatus?: ArrivalsAndDeparture.TripStatus;

vehicleId?: string;
}

export namespace ArrivalsAndDeparture {
export interface TripStatus {
activeTripId?: string;

blockTripSequence?: number;

closestStop?: string;

closestStopTimeOffset?: number;

distanceAlongTrip?: number;

frequency?: string;

lastKnownDistanceAlongTrip?: number;

lastKnownLocation?: TripStatus.LastKnownLocation;

lastKnownOrientation?: number;

lastLocationUpdateTime?: number;

lastUpdateTime?: number;

nextStop?: string;

nextStopTimeOffset?: number;

occupancyCapacity?: number;

occupancyCount?: number;

occupancyStatus?: string;

orientation?: number;

phase?: string;

position?: TripStatus.Position;

predicted?: boolean;

scheduledDistanceAlongTrip?: number;

scheduleDeviation?: number;

serviceDate?: number;

situationIds?: Array<string>;

status?: string;

totalDistanceAlongTrip?: number;

vehicleId?: string;
}

export namespace TripStatus {
export interface LastKnownLocation {
lat?: number;

lon?: number;
}

export interface Position {
lat?: number;

lon?: number;
}
}
}
}
}
}

export interface ArrivalsAndDeparturesForStopRetrieveParams {
/**
* Include vehicles arriving or departing in the next n minutes.
*/
minutesAfter?: number;

/**
* Include vehicles having arrived or departed in the previous n minutes.
*/
minutesBefore?: number;

/**
* The specific time for querying the system status.
*/
time?: string;
}

export namespace ArrivalsAndDeparturesForStop {
export import ArrivalsAndDeparturesForStopRetrieveResponse = ArrivalsAndDeparturesForStopAPI.ArrivalsAndDeparturesForStopRetrieveResponse;
export import ArrivalsAndDeparturesForStopRetrieveParams = ArrivalsAndDeparturesForStopAPI.ArrivalsAndDeparturesForStopRetrieveParams;
}
5 changes: 5 additions & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export {
ArrivalAndDepartureForStopRetrieveParams,
ArrivalAndDepartureForStop,
} from './arrival-and-departure-for-stop';
export {
ArrivalsAndDeparturesForStopRetrieveResponse,
ArrivalsAndDeparturesForStopRetrieveParams,
ArrivalsAndDeparturesForStop,
} from './arrivals-and-departures-for-stop';
export { ConfigRetrieveResponse, Config } from './config';
export { CurrentTimeRetrieveResponse, CurrentTime } from './current-time';
export {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.1.0-alpha.12'; // x-release-please-version
export const VERSION = '0.1.0-alpha.13'; // x-release-please-version
40 changes: 40 additions & 0 deletions tests/api-resources/arrivals-and-departures-for-stop.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import OnebusawaySDK from 'onebusaway-sdk';
import { Response } from 'node-fetch';

const onebusawaySDK = new OnebusawaySDK({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource arrivalsAndDeparturesForStop', () => {
test('retrieve', async () => {
const responsePromise = onebusawaySDK.arrivalsAndDeparturesForStop.retrieve('1_75403');
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(
onebusawaySDK.arrivalsAndDeparturesForStop.retrieve('1_75403', { 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(
onebusawaySDK.arrivalsAndDeparturesForStop.retrieve(
'1_75403',
{ minutesAfter: 0, minutesBefore: 0, time: '2019-12-27T18:11:19.117Z' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(OnebusawaySDK.NotFoundError);
});
});

0 comments on commit 8ecf299

Please sign in to comment.