Skip to content

Commit

Permalink
feat(api): manual updates (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jun 2, 2024
1 parent 8b8f7bd commit 0105ba3
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
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
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,15 @@ Methods:
- <code title="patch /update-retell-llm/{llm_id}">client.llm.<a href="./src/resources/llm.ts">update</a>(llmId, { ...params }) -> LlmResponse</code>
- <code title="get /list-retell-llms">client.llm.<a href="./src/resources/llm.ts">list</a>() -> LlmListResponse</code>
- <code title="delete /delete-retell-llm/{llm_id}">client.llm.<a href="./src/resources/llm.ts">delete</a>(llmId) -> void</code>

# Voice

Types:

- <code><a href="./src/resources/voice.ts">VoiceResponse</a></code>
- <code><a href="./src/resources/voice.ts">VoiceListResponse</a></code>

Methods:

- <code title="get /get-phone-number/{phone_number}">client.voice.<a href="./src/resources/voice.ts">retrieve</a>(phoneNumber) -> PhoneNumberResponse</code>
- <code title="get /list-phone-numbers">client.voice.<a href="./src/resources/voice.ts">list</a>() -> VoiceListResponse</code>
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class Retell extends Core.APIClient {
phoneNumber: API.PhoneNumber = new API.PhoneNumber(this);
agent: API.Agent = new API.Agent(this);
llm: API.Llm = new API.Llm(this);
voice: API.Voice = new API.Voice(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -205,6 +206,10 @@ export namespace Retell {
export import LlmListResponse = API.LlmListResponse;
export import LlmCreateParams = API.LlmCreateParams;
export import LlmUpdateParams = API.LlmUpdateParams;

export import Voice = API.Voice;
export import VoiceResponse = API.VoiceResponse;
export import VoiceListResponse = API.VoiceListResponse;
}

export default Retell;
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export {
PhoneNumberUpdateParams,
PhoneNumber,
} from './phone-number';
export { VoiceResponse, VoiceListResponse, Voice } from './voice';
69 changes: 69 additions & 0 deletions src/resources/voice.ts
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;
}
47 changes: 47 additions & 0 deletions tests/api-resources/voice.test.ts
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,
);
});
});

0 comments on commit 0105ba3

Please sign in to comment.