Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Mar 27, 2024
1 parent a56af5d commit 560bbc5
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 372 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

Types:

- <code><a href="./src/resources/call.ts">CallResponse</a></code>
- <code><a href="./src/resources/call.ts">RegisterCallResponse</a></code>
- <code><a href="./src/resources/call.ts">CallRetrieveResponse</a></code>
- <code><a href="./src/resources/call.ts">CallListResponse</a></code>

Methods:

- <code title="post /create-phone-call">client.call.<a href="./src/resources/call.ts">create</a>({ ...params }) -> RegisterCallResponse</code>
- <code title="get /get-call/{call_id}">client.call.<a href="./src/resources/call.ts">retrieve</a>(callId) -> CallRetrieveResponse</code>
- <code title="get /get-call/{call_id}">client.call.<a href="./src/resources/call.ts">retrieve</a>(callId) -> CallResponse</code>
- <code title="get /list-calls">client.call.<a href="./src/resources/call.ts">list</a>({ ...params }) -> CallListResponse</code>
- <code title="post /register-call">client.call.<a href="./src/resources/call.ts">register</a>({ ...params }) -> RegisterCallResponse</code>

Expand Down
17 changes: 5 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import * as qs from 'qs';
import * as API from 'retell-sdk/resources/index';

export interface ClientOptions {
/**
* Defaults to process.env['RETELL_API_KEY'].
*/
apiKey?: string | undefined;
apiKey: string;

/**
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
Expand Down Expand Up @@ -79,7 +76,7 @@ export class Retell extends Core.APIClient {
/**
* API Client for interfacing with the Retell API.
*
* @param {string | undefined} [opts.apiKey=process.env['RETELL_API_KEY'] ?? undefined]
* @param {string} opts.apiKey
* @param {string} [opts.baseURL=process.env['RETELL_BASE_URL'] ?? https://api.retellai.com] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
Expand All @@ -88,14 +85,10 @@ export class Retell extends Core.APIClient {
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
*/
constructor({
baseURL = Core.readEnv('RETELL_BASE_URL'),
apiKey = Core.readEnv('RETELL_API_KEY'),
...opts
}: ClientOptions = {}) {
constructor({ baseURL = Core.readEnv('RETELL_BASE_URL'), apiKey, ...opts }: ClientOptions) {
if (apiKey === undefined) {
throw new Errors.RetellError(
"The RETELL_API_KEY environment variable is missing or empty; either provide it, or instantiate the Retell client with an apiKey option, like new Retell({ apiKey: 'My API Key' }).",
"Missing required client option apiKey; you need to instantiate the Retell client with an apiKey option, like new Retell({ apiKey: 'My API Key' }).",
);
}

Expand Down Expand Up @@ -185,8 +178,8 @@ export namespace Retell {
export import RequestOptions = Core.RequestOptions;

export import Call = API.Call;
export import CallResponse = API.CallResponse;
export import RegisterCallResponse = API.RegisterCallResponse;
export import CallRetrieveResponse = API.CallRetrieveResponse;
export import CallListResponse = API.CallListResponse;
export import CallCreateParams = API.CallCreateParams;
export import CallListParams = API.CallListParams;
Expand Down
Loading

0 comments on commit 560bbc5

Please sign in to comment.