Skip to content

Commit

Permalink
Release 0.0.5-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 19, 2023
1 parent b4eb239 commit 43c0524
Show file tree
Hide file tree
Showing 61 changed files with 388 additions and 242 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ node_modules
/dist
/Client.d.ts
/Client.js
/environments.d.ts
/environments.js
/index.d.ts
/index.js
/api
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@fern-api/vocode",
"version": "0.0.4",
"name": "@vocode/vocode-api",
"version": "0.0.5-alpha.1",
"private": false,
"repository": "https://github.com/fern-vocode/vocode-node",
"repository": "https://github.com/vocodedev/vocode-api-node",
"main": "./index.js",
"types": "./index.d.ts",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as environments from "./environments";
import * as core from "./core";
import { Numbers } from "./api/resources/numbers/client/Client";
import { Calls } from "./api/resources/calls/client/Client";
Expand All @@ -14,7 +13,7 @@ import { Webhooks } from "./api/resources/webhooks/client/Client";

export declare namespace VocodeClient {
interface Options {
environment?: core.Supplier<environments.VocodeEnvironment | string>;
environment: core.Supplier<string>;
token: core.Supplier<core.BearerToken>;
}
}
Expand Down
39 changes: 13 additions & 26 deletions src/api/resources/actions/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Vocode from "../../..";
import { default as URLSearchParams } from "@ungap/url-search-params";
Expand All @@ -12,7 +11,7 @@ import * as errors from "../../../../errors";

export declare namespace Actions {
interface Options {
environment?: core.Supplier<environments.VocodeEnvironment | string>;
environment: core.Supplier<string>;
token: core.Supplier<core.BearerToken>;
}
}
Expand All @@ -28,16 +27,13 @@ export class Actions {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/actions"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/actions"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -88,16 +84,13 @@ export class Actions {

public async listActions(): Promise<Vocode.ListActionsResponseItem[]> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/actions/list"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/actions/list"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -138,16 +131,13 @@ export class Actions {
*/
public async createAction(request: Vocode.CreateActionRequest): Promise<Vocode.CreateActionResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/actions/create"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/actions/create"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
body: await serializers.CreateActionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -204,16 +194,13 @@ export class Actions {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/actions/update"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/actions/update"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down
39 changes: 13 additions & 26 deletions src/api/resources/agents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Vocode from "../../..";
import { default as URLSearchParams } from "@ungap/url-search-params";
Expand All @@ -12,7 +11,7 @@ import * as errors from "../../../../errors";

export declare namespace Agents {
interface Options {
environment?: core.Supplier<environments.VocodeEnvironment | string>;
environment: core.Supplier<string>;
token: core.Supplier<core.BearerToken>;
}
}
Expand All @@ -28,16 +27,13 @@ export class Agents {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/agents"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/agents"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -88,16 +84,13 @@ export class Agents {

public async listAgents(): Promise<Vocode.Agent[]> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/agents/list"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/agents/list"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -138,16 +131,13 @@ export class Agents {
*/
public async createAgent(request: Vocode.AgentParams): Promise<Vocode.Agent> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/agents/create"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/agents/create"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
body: await serializers.AgentParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -204,16 +194,13 @@ export class Agents {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/agents/update"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/agents/update"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down
97 changes: 71 additions & 26 deletions src/api/resources/calls/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Vocode from "../../..";
import urlJoin from "url-join";
Expand All @@ -12,7 +11,7 @@ import { default as URLSearchParams } from "@ungap/url-search-params";

export declare namespace Calls {
interface Options {
environment?: core.Supplier<environments.VocodeEnvironment | string>;
environment: core.Supplier<string>;
token: core.Supplier<core.BearerToken>;
}
}
Expand All @@ -25,16 +24,13 @@ export class Calls {

public async listCalls(): Promise<Vocode.Call[]> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/calls/list"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/calls/list"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -78,16 +74,13 @@ export class Calls {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/calls"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/calls"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -144,16 +137,13 @@ export class Calls {
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/calls/end"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/calls/end"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -207,16 +197,13 @@ export class Calls {
*/
public async createCall(request: Vocode.CreateCallRequest): Promise<Vocode.Call> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.VocodeEnvironment.Production,
"v1/calls/create"
),
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/calls/create"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/vocode",
"X-Fern-SDK-Version": "0.0.4",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
body: await serializers.CreateCallRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -265,6 +252,64 @@ export class Calls {
}
}

/**
* @throws {@link Vocode.UnprocessableEntityError}
*/
public async recording(request: Vocode.RecordingRequest): Promise<unknown> {
const { id } = request;
const _queryParams = new URLSearchParams();
_queryParams.append("id", id);
const _response = await core.fetcher({
url: urlJoin(await core.Supplier.get(this._options.environment), "v1/calls/recording"),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@vocode/vocode-api",
"X-Fern-SDK-Version": "0.0.5-alpha.1",
},
contentType: "application/json",
queryParameters: _queryParams,
timeoutMs: 60000,
});
if (_response.ok) {
return _response.body;
}

if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 422:
throw new Vocode.UnprocessableEntityError(
await serializers.HttpValidationError.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ["response"],
})
);
default:
throw new errors.VocodeError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
}
}

switch (_response.error.reason) {
case "non-json":
throw new errors.VocodeError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.VocodeTimeoutError();
case "unknown":
throw new errors.VocodeError({
message: _response.error.errorMessage,
});
}
}

protected async _getAuthorizationHeader() {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
Expand Down
Loading

0 comments on commit 43c0524

Please sign in to comment.