Skip to content

🌿 Fern Regeneration -- May 23, 2025 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vapi-ai/server-sdk",
"version": "0.8.1",
"version": "0.9.1",
"private": false,
"repository": "https://github.com/VapiAI/server-sdk-typescript",
"main": "./index.js",
Expand Down
42 changes: 0 additions & 42 deletions reference.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
# Reference

<details><summary><code>client.<a href="/src/Client.ts">prometheusControllerIndex</a>() -> void</code></summary>
<dl>
<dd>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.prometheusControllerIndex();
```

</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**requestOptions:** `VapiClient.RequestOptions`

</dd>
</dl>
</dd>
</dl>

</dd>
</dl>
</details>

##

## Calls

<details><summary><code>client.calls.<a href="/src/api/resources/calls/client/Client.ts">list</a>({ ...params }) -> Vapi.Call[]</code></summary>
Expand Down
81 changes: 2 additions & 79 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import * as environments from "./environments";
import * as core from "./core";
import urlJoin from "url-join";
import * as errors from "./errors/index";
import { Calls } from "./api/resources/calls/client/Client";
import { Assistants } from "./api/resources/assistants/client/Client";
import { PhoneNumbers } from "./api/resources/phoneNumbers/client/Client";
Expand All @@ -25,7 +23,7 @@ export declare namespace VapiClient {
environment?: core.Supplier<environments.VapiEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
token: core.Supplier<core.BearerToken>;
fetcher?: core.FetchFunction;
}

Expand Down Expand Up @@ -56,7 +54,7 @@ export class VapiClient {
protected _analytics: Analytics | undefined;
protected _logs: Logs | undefined;

constructor(protected readonly _options: VapiClient.Options = {}) {}
constructor(protected readonly _options: VapiClient.Options) {}

public get calls(): Calls {
return (this._calls ??= new Calls(this._options));
Expand Down Expand Up @@ -109,79 +107,4 @@ export class VapiClient {
public get logs(): Logs {
return (this._logs ??= new Logs(this._options));
}

/**
* @param {VapiClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.prometheusControllerIndex()
*/
public prometheusControllerIndex(requestOptions?: VapiClient.RequestOptions): core.HttpResponsePromise<void> {
return core.HttpResponsePromise.fromPromise(this.__prometheusControllerIndex(requestOptions));
}

private async __prometheusControllerIndex(
requestOptions?: VapiClient.RequestOptions,
): Promise<core.WithRawResponse<void>> {
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.VapiEnvironment.Default,
"prometheus_metrics",
),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
},
contentType: "application/json",
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: undefined, rawResponse: _response.rawResponse };
}

if (_response.error.reason === "status-code") {
throw new errors.VapiError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}

switch (_response.error.reason) {
case "non-json":
throw new errors.VapiError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.VapiTimeoutError("Timeout exceeded when calling GET /prometheus_metrics.");
case "unknown":
throw new errors.VapiError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
17 changes: 6 additions & 11 deletions src/api/resources/analytics/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export declare namespace Analytics {
environment?: core.Supplier<environments.VapiEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
token: core.Supplier<core.BearerToken>;
fetcher?: core.FetchFunction;
}

Expand All @@ -30,7 +30,7 @@ export declare namespace Analytics {
}

export class Analytics {
constructor(protected readonly _options: Analytics.Options = {}) {}
constructor(protected readonly _options: Analytics.Options) {}

/**
* @param {Vapi.AnalyticsQueryDto} request
Expand Down Expand Up @@ -71,8 +71,8 @@ export class Analytics {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -113,12 +113,7 @@ export class Analytics {
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
protected async _getAuthorizationHeader(): Promise<string> {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
}
33 changes: 14 additions & 19 deletions src/api/resources/assistants/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export declare namespace Assistants {
environment?: core.Supplier<environments.VapiEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
token: core.Supplier<core.BearerToken>;
fetcher?: core.FetchFunction;
}

Expand All @@ -30,7 +30,7 @@ export declare namespace Assistants {
}

export class Assistants {
constructor(protected readonly _options: Assistants.Options = {}) {}
constructor(protected readonly _options: Assistants.Options) {}

/**
* @param {Vapi.AssistantsListRequest} request
Expand Down Expand Up @@ -110,8 +110,8 @@ export class Assistants {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -182,8 +182,8 @@ export class Assistants {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -251,8 +251,8 @@ export class Assistants {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -319,8 +319,8 @@ export class Assistants {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -393,8 +393,8 @@ export class Assistants {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -435,12 +435,7 @@ export class Assistants {
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
protected async _getAuthorizationHeader(): Promise<string> {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
}
33 changes: 14 additions & 19 deletions src/api/resources/calls/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export declare namespace Calls {
environment?: core.Supplier<environments.VapiEnvironment | string>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
token?: core.Supplier<core.BearerToken | undefined>;
token: core.Supplier<core.BearerToken>;
fetcher?: core.FetchFunction;
}

Expand All @@ -30,7 +30,7 @@ export declare namespace Calls {
}

export class Calls {
constructor(protected readonly _options: Calls.Options = {}) {}
constructor(protected readonly _options: Calls.Options) {}

/**
* @param {Vapi.CallsListRequest} request
Expand Down Expand Up @@ -125,8 +125,8 @@ export class Calls {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -197,8 +197,8 @@ export class Calls {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -263,8 +263,8 @@ export class Calls {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -331,8 +331,8 @@ export class Calls {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -405,8 +405,8 @@ export class Calls {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vapi-ai/server-sdk",
"X-Fern-SDK-Version": "0.8.1",
"User-Agent": "@vapi-ai/server-sdk/0.8.1",
"X-Fern-SDK-Version": "0.9.1",
"User-Agent": "@vapi-ai/server-sdk/0.9.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...requestOptions?.headers,
Expand Down Expand Up @@ -447,12 +447,7 @@ export class Calls {
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
protected async _getAuthorizationHeader(): Promise<string> {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
}
Loading