-
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.
feat(api): update via SDK Studio (#185)
- Loading branch information
1 parent
890130e
commit 87faf11
Showing
6 changed files
with
90 additions
and
2 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,2 +1,2 @@ | ||
configured_endpoints: 26 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-fbc053e98085f73b2bf9d6a71bd4992c5eec1b582a030fb48b727cc0788ceae7.yml | ||
configured_endpoints: 27 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.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
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,44 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '../resource'; | ||
import * as Core from '../core'; | ||
import * as ShapeAPI from './shape'; | ||
import * as Shared from './shared'; | ||
|
||
export class Shape extends APIResource { | ||
/** | ||
* Retrieve a shape (the path traveled by a transit vehicle) by ID. | ||
*/ | ||
retrieve(shapeId: string, options?: Core.RequestOptions): Core.APIPromise<ShapeRetrieveResponse> { | ||
return this._client.get(`/api/where/shape/${shapeId}.json`, options); | ||
} | ||
} | ||
|
||
export interface ShapeRetrieveResponse extends Shared.ResponseWrapper { | ||
data: ShapeRetrieveResponse.Data; | ||
} | ||
|
||
export namespace ShapeRetrieveResponse { | ||
export interface Data { | ||
entry: Data.Entry; | ||
|
||
references: Shared.References; | ||
} | ||
|
||
export namespace Data { | ||
export interface Entry { | ||
length: number; | ||
|
||
/** | ||
* Encoded polyline format representing the shape of the path | ||
*/ | ||
points: string; | ||
|
||
levels?: string; | ||
} | ||
} | ||
} | ||
|
||
export namespace Shape { | ||
export import ShapeRetrieveResponse = ShapeAPI.ShapeRetrieveResponse; | ||
} |
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,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 shape', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = client.shape.retrieve('shapeID'); | ||
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.shape.retrieve('shapeID', { path: '/_stainless_unknown_path' })).rejects.toThrow( | ||
OnebusawaySDK.NotFoundError, | ||
); | ||
}); | ||
}); |