From aae3f08995e6fad2f89ac0ca1702af39152d0363 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:06:03 +0000 Subject: [PATCH 1/2] feat(api): api update (#268) --- .stats.yml | 2 +- api.md | 10 ++++ src/index.ts | 5 ++ src/resources/index.ts | 1 + src/resources/stops-for-agency.ts | 54 ++++++++++++++++++++ tests/api-resources/stops-for-agency.test.ts | 29 +++++++++++ 6 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/resources/stops-for-agency.ts create mode 100644 tests/api-resources/stops-for-agency.test.ts diff --git a/.stats.yml b/.stats.yml index acd4ac2..d4b713b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 28 +configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml diff --git a/api.md b/api.md index cb44abd..64c2b34 100644 --- a/api.md +++ b/api.md @@ -75,6 +75,16 @@ Methods: - client.stopsForRoute.list(routeId, { ...params }) -> StopsForRouteListResponse +# StopsForAgency + +Types: + +- StopsForAgencyListResponse + +Methods: + +- client.stopsForAgency.list(agencyId) -> StopsForAgencyListResponse + # Stop Types: diff --git a/src/index.ts b/src/index.ts index 102cfff..a60f8c5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,6 +56,7 @@ import { import { Shape, ShapeRetrieveResponse } from './resources/shape'; import { Stop, StopRetrieveResponse } from './resources/stop'; import { StopIDsForAgency, StopIDsForAgencyListResponse } from './resources/stop-ids-for-agency'; +import { StopsForAgency, StopsForAgencyListResponse } from './resources/stops-for-agency'; import { StopsForLocation, StopsForLocationListParams, @@ -209,6 +210,7 @@ export class OnebusawaySDK extends Core.APIClient { currentTime: API.CurrentTime = new API.CurrentTime(this); stopsForLocation: API.StopsForLocation = new API.StopsForLocation(this); stopsForRoute: API.StopsForRoute = new API.StopsForRoute(this); + stopsForAgency: API.StopsForAgency = new API.StopsForAgency(this); stop: API.Stop = new API.Stop(this); stopIdsForAgency: API.StopIDsForAgency = new API.StopIDsForAgency(this); scheduleForStop: API.ScheduleForStop = new API.ScheduleForStop(this); @@ -276,6 +278,7 @@ OnebusawaySDK.Config = Config; OnebusawaySDK.CurrentTime = CurrentTime; OnebusawaySDK.StopsForLocation = StopsForLocation; OnebusawaySDK.StopsForRoute = StopsForRoute; +OnebusawaySDK.StopsForAgency = StopsForAgency; OnebusawaySDK.Stop = Stop; OnebusawaySDK.StopIDsForAgency = StopIDsForAgency; OnebusawaySDK.ScheduleForStop = ScheduleForStop; @@ -328,6 +331,8 @@ export declare namespace OnebusawaySDK { type StopsForRouteListParams as StopsForRouteListParams, }; + export { StopsForAgency as StopsForAgency, type StopsForAgencyListResponse as StopsForAgencyListResponse }; + export { Stop as Stop, type StopRetrieveResponse as StopRetrieveResponse }; export { diff --git a/src/resources/index.ts b/src/resources/index.ts index 2faaa7e..e7ecce5 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -46,6 +46,7 @@ export { export { Shape, type ShapeRetrieveResponse } from './shape'; export { Stop, type StopRetrieveResponse } from './stop'; export { StopIDsForAgency, type StopIDsForAgencyListResponse } from './stop-ids-for-agency'; +export { StopsForAgency, type StopsForAgencyListResponse } from './stops-for-agency'; export { StopsForLocation, type StopsForLocationListResponse, diff --git a/src/resources/stops-for-agency.ts b/src/resources/stops-for-agency.ts new file mode 100644 index 0000000..0030f5c --- /dev/null +++ b/src/resources/stops-for-agency.ts @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; +import * as Shared from './shared'; + +export class StopsForAgency extends APIResource { + /** + * Get stops for a specific agency + */ + list(agencyId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/api/where/stops-for-agency/${agencyId}.json`, options); + } +} + +export interface StopsForAgencyListResponse extends Shared.ResponseWrapper { + limitExceeded: boolean; + + list: Array; + + references: Shared.References; + + outOfRange?: boolean; +} + +export namespace StopsForAgencyListResponse { + export interface List { + id: string; + + lat: number; + + lon: number; + + name: string; + + parent: string; + + routeIds: Array; + + staticRouteIds: Array; + + code?: string; + + direction?: string; + + locationType?: number; + + wheelchairBoarding?: string; + } +} + +export declare namespace StopsForAgency { + export { type StopsForAgencyListResponse as StopsForAgencyListResponse }; +} diff --git a/tests/api-resources/stops-for-agency.test.ts b/tests/api-resources/stops-for-agency.test.ts new file mode 100644 index 0000000..179cc40 --- /dev/null +++ b/tests/api-resources/stops-for-agency.test.ts @@ -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 stopsForAgency', () => { + test('list', async () => { + const responsePromise = client.stopsForAgency.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.stopsForAgency.list('agencyID', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OnebusawaySDK.NotFoundError); + }); +}); From 82d63a6e881b90de527ce72c2acc161fff1c86a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:06:21 +0000 Subject: [PATCH 2/2] release: 1.5.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4c313f9..dd8fde7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.0" + ".": "1.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e8a18..267a3d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.5.0 (2024-11-29) + +Full Changelog: [v1.4.0...v1.5.0](https://github.com/OneBusAway/js-sdk/compare/v1.4.0...v1.5.0) + +### Features + +* **api:** api update ([#268](https://github.com/OneBusAway/js-sdk/issues/268)) ([aae3f08](https://github.com/OneBusAway/js-sdk/commit/aae3f08995e6fad2f89ac0ca1702af39152d0363)) + ## 1.4.0 (2024-11-29) Full Changelog: [v1.3.0...v1.4.0](https://github.com/OneBusAway/js-sdk/compare/v1.3.0...v1.4.0) diff --git a/package-lock.json b/package-lock.json index ff0e4ae..c1c79f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "onebusaway-sdk", - "version": "1.4.0", + "version": "1.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "onebusaway-sdk", - "version": "1.4.0", + "version": "1.5.0", "license": "Apache-2.0", "dependencies": { "@types/node": "^18.11.18", diff --git a/package.json b/package.json index 9bab3f0..0119380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onebusaway-sdk", - "version": "1.4.0", + "version": "1.5.0", "description": "The official TypeScript library for the Onebusaway SDK API", "author": "Onebusaway SDK ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 391e342..e514fa0 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.4.0'; // x-release-please-version +export const VERSION = '1.5.0'; // x-release-please-version