-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b8f7bd
commit 0105ba3
Showing
6 changed files
with
135 additions
and
1 deletion.
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: 19 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/toddlzt%2Ftoddlzt-6e898db7e9cb1e4a67816a588fef9a2c85ac9aa8db0de70de7015d596decce8c.yml | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/toddlzt%2Ftoddlzt-4d8c9c3ff9749f44f5a4c9fc86181575d221417185001ae5e38481e792efe948.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,69 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from '../core'; | ||
import { APIResource } from '../resource'; | ||
import * as VoiceAPI from './voice'; | ||
import * as PhoneNumberAPI from './phone-number'; | ||
|
||
export class Voice extends APIResource { | ||
/** | ||
* Retrieve details of a specific phone number | ||
*/ | ||
retrieve( | ||
phoneNumber: string, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<PhoneNumberAPI.PhoneNumberResponse> { | ||
return this._client.get(`/get-phone-number/${phoneNumber}`, options); | ||
} | ||
|
||
/** | ||
* List all phone numbers | ||
*/ | ||
list(options?: Core.RequestOptions): Core.APIPromise<VoiceListResponse> { | ||
return this._client.get('/list-phone-numbers', options); | ||
} | ||
} | ||
|
||
export interface VoiceResponse { | ||
/** | ||
* Gender of voice. | ||
*/ | ||
gender: 'male' | 'female'; | ||
|
||
/** | ||
* Indicates the provider of voice. | ||
*/ | ||
provider: 'elevenlabs' | 'openai' | 'deepgram'; | ||
|
||
/** | ||
* Unique id for the voice. | ||
*/ | ||
voice_id: string; | ||
|
||
/** | ||
* Name of the voice. | ||
*/ | ||
voice_name: string; | ||
|
||
/** | ||
* Accent annotation of the voice. | ||
*/ | ||
accent?: string; | ||
|
||
/** | ||
* Age annotation of the voice. | ||
*/ | ||
age?: string; | ||
|
||
/** | ||
* URL to the preview audio of the voice. | ||
*/ | ||
preview_audio_url?: string; | ||
} | ||
|
||
export type VoiceListResponse = Array<PhoneNumberAPI.PhoneNumberResponse>; | ||
|
||
export namespace Voice { | ||
export import VoiceResponse = VoiceAPI.VoiceResponse; | ||
export import VoiceListResponse = VoiceAPI.VoiceListResponse; | ||
} |
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,47 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Retell from 'retell-sdk'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const retell = new Retell({ | ||
apiKey: 'YOUR_RETELL_API_KEY', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource voice', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = retell.voice.retrieve('+14157774444'); | ||
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(retell.voice.retrieve('+14157774444', { path: '/_stainless_unknown_path' })).rejects.toThrow( | ||
Retell.NotFoundError, | ||
); | ||
}); | ||
|
||
test('list', async () => { | ||
const responsePromise = retell.voice.list(); | ||
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(retell.voice.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( | ||
Retell.NotFoundError, | ||
); | ||
}); | ||
}); |