Skip to content

Commit

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

release: 0.1.0-alpha.27
  • Loading branch information
Ahmedhossamdev authored Jul 27, 2024
2 parents 9ee3f27 + 518fd10 commit a790b05
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 7 deletions.
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.26"
".": "0.1.0-alpha.27"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.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.27 (2024-07-27)

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

### Features

* **api:** OpenAPI spec update via Stainless API ([#122](https://github.com/OneBusAway/js-sdk/issues/122)) ([e9310c2](https://github.com/OneBusAway/js-sdk/commit/e9310c2832ace88ed76300e6e3ee44232aaf48cd))

## 0.1.0-alpha.26 (2024-07-27)

Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/OneBusAway/js-sdk/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)
Expand Down
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ Methods:

- <code title="get /api/where/stop/{stopID}.json">client.stop.<a href="./src/resources/stop.ts">retrieve</a>(stopId) -> StopRetrieveResponse</code>

# StopIDsForAgency

Types:

- <code><a href="./src/resources/stop-ids-for-agency.ts">StopIDsForAgencyListResponse</a></code>

Methods:

- <code title="get /api/where/stop-ids-for-agency/{agencyID}.json">client.stopIdsForAgency.<a href="./src/resources/stop-ids-for-agency.ts">list</a>(agencyId) -> StopIDsForAgencyListResponse</code>

# Route

Types:
Expand Down
14 changes: 14 additions & 0 deletions examples/stops-ids-for-agency.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import onebusaway from '../dist/index.mjs';

const oba = new onebusaway({
apiKey: 'TEST',
});

async function main() {
const response = await oba.stopIdsForAgency.list('40');
response.data.list.forEach((stop) => {
console.log(stop);
});
}

main();
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.26",
"version": "0.1.0-alpha.27",
"description": "The official TypeScript library for the Onebusaway SDK API",
"author": "Onebusaway SDK <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class OnebusawaySDK extends Core.APIClient {
stopsForLocation: API.StopsForLocation = new API.StopsForLocation(this);
stopsForRoute: API.StopsForRoute = new API.StopsForRoute(this);
stop: API.Stop = new API.Stop(this);
stopIdsForAgency: API.StopIDsForAgency = new API.StopIDsForAgency(this);
route: API.Route = new API.Route(this);
arrivalAndDeparture: API.ArrivalAndDeparture = new API.ArrivalAndDeparture(this);
trip: API.Trip = new API.Trip(this);
Expand Down Expand Up @@ -216,6 +217,9 @@ export namespace OnebusawaySDK {
export import Stop = API.Stop;
export import StopRetrieveResponse = API.StopRetrieveResponse;

export import StopIDsForAgency = API.StopIDsForAgency;
export import StopIDsForAgencyListResponse = API.StopIDsForAgencyListResponse;

export import Route = API.Route;
export import RouteRetrieveResponse = API.RouteRetrieveResponse;

Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
export { ConfigRetrieveResponse, Config } from './config';
export { CurrentTimeRetrieveResponse, CurrentTime } from './current-time';
export { RouteRetrieveResponse, Route } from './route';
export { StopIDsForAgencyListResponse, StopIDsForAgency } from './stop-ids-for-agency';
export { StopRetrieveResponse, Stop } from './stop';
export {
StopsForLocationRetrieveResponse,
Expand Down
33 changes: 33 additions & 0 deletions src/resources/stop-ids-for-agency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../resource';
import * as Core from '../core';
import * as StopIDsForAgencyAPI from './stop-ids-for-agency';
import * as Shared from './shared';

export class StopIDsForAgency extends APIResource {
/**
* Get stop IDs for a specific agency
*/
list(agencyId: string, options?: Core.RequestOptions): Core.APIPromise<StopIDsForAgencyListResponse> {
return this._client.get(`/api/where/stop-ids-for-agency/${agencyId}.json`, options);
}
}

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

export namespace StopIDsForAgencyListResponse {
export interface Data {
list: Array<string>;

references: Shared.References;

limitExceeded?: boolean;
}
}

export namespace StopIDsForAgency {
export import StopIDsForAgencyListResponse = StopIDsForAgencyAPI.StopIDsForAgencyListResponse;
}
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.26'; // x-release-please-version
export const VERSION = '0.1.0-alpha.27'; // x-release-please-version
29 changes: 29 additions & 0 deletions tests/api-resources/stop-ids-for-agency.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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 stopIdsForAgency', () => {
test('list', async () => {
const responsePromise = client.stopIdsForAgency.list('agencyID');
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('list: 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.stopIdsForAgency.list('agencyID', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OnebusawaySDK.NotFoundError);
});
});

0 comments on commit a790b05

Please sign in to comment.