phonic 0.30.19 → 0.30.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +9 -4
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +5 -1
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +10 -1
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +4 -0
- package/dist/cjs/api/resources/auth/client/Client.d.ts +52 -0
- package/dist/cjs/api/resources/auth/client/Client.js +146 -0
- package/dist/cjs/api/resources/auth/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/auth/client/index.js +17 -0
- package/dist/cjs/api/resources/auth/client/requests/CreateSessionTokenRequest.d.ts +13 -0
- package/dist/cjs/api/resources/auth/client/requests/CreateSessionTokenRequest.js +5 -0
- package/dist/cjs/api/resources/auth/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/auth/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/auth/index.d.ts +2 -0
- package/dist/cjs/api/resources/auth/index.js +18 -0
- package/dist/cjs/api/resources/auth/types/AuthCreateSessionTokenResponse.d.ts +9 -0
- package/dist/cjs/api/resources/auth/types/AuthCreateSessionTokenResponse.js +5 -0
- package/dist/cjs/api/resources/auth/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/auth/types/index.js +17 -0
- package/dist/cjs/api/resources/conversations/client/Client.js +2 -9
- package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.ts +0 -4
- package/dist/cjs/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.ts +2 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/types/Agent.d.ts +3 -1
- package/dist/cjs/api/types/Conversation.d.ts +13 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +10 -1
- package/dist/cjs/api/types/CreateAgentRequest.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +5 -1
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +10 -1
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +4 -0
- package/dist/esm/api/resources/auth/client/Client.d.mts +52 -0
- package/dist/esm/api/resources/auth/client/Client.mjs +109 -0
- package/dist/esm/api/resources/auth/client/index.d.mts +2 -0
- package/dist/esm/api/resources/auth/client/index.mjs +1 -0
- package/dist/esm/api/resources/auth/client/requests/CreateSessionTokenRequest.d.mts +13 -0
- package/dist/esm/api/resources/auth/client/requests/CreateSessionTokenRequest.mjs +4 -0
- package/dist/esm/api/resources/auth/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/auth/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/auth/index.d.mts +2 -0
- package/dist/esm/api/resources/auth/index.mjs +2 -0
- package/dist/esm/api/resources/auth/types/AuthCreateSessionTokenResponse.d.mts +9 -0
- package/dist/esm/api/resources/auth/types/AuthCreateSessionTokenResponse.mjs +4 -0
- package/dist/esm/api/resources/auth/types/index.d.mts +1 -0
- package/dist/esm/api/resources/auth/types/index.mjs +1 -0
- package/dist/esm/api/resources/conversations/client/Client.mjs +2 -9
- package/dist/esm/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.mts +0 -4
- package/dist/esm/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.mts +2 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/types/Agent.d.mts +3 -1
- package/dist/esm/api/types/Conversation.d.mts +13 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +10 -1
- package/dist/esm/api/types/CreateAgentRequest.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +67 -0
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Tools } from "./api/resources/tools/client/Client.js";
|
|
|
8
8
|
import { ExtractionSchemas } from "./api/resources/extractionSchemas/client/Client.js";
|
|
9
9
|
import { Voices } from "./api/resources/voices/client/Client.js";
|
|
10
10
|
import { Conversations } from "./api/resources/conversations/client/Client.js";
|
|
11
|
+
import { Auth } from "./api/resources/auth/client/Client.js";
|
|
11
12
|
import { Projects } from "./api/resources/projects/client/Client.js";
|
|
12
13
|
export declare namespace PhonicClient {
|
|
13
14
|
interface Options {
|
|
@@ -39,6 +40,7 @@ export declare class PhonicClient {
|
|
|
39
40
|
protected _extractionSchemas: ExtractionSchemas | undefined;
|
|
40
41
|
protected _voices: Voices | undefined;
|
|
41
42
|
protected _conversations: Conversations | undefined;
|
|
43
|
+
protected _auth: Auth | undefined;
|
|
42
44
|
protected _projects: Projects | undefined;
|
|
43
45
|
constructor(_options?: PhonicClient.Options);
|
|
44
46
|
get agents(): Agents;
|
|
@@ -46,5 +48,6 @@ export declare class PhonicClient {
|
|
|
46
48
|
get extractionSchemas(): ExtractionSchemas;
|
|
47
49
|
get voices(): Voices;
|
|
48
50
|
get conversations(): Conversations;
|
|
51
|
+
get auth(): Auth;
|
|
49
52
|
get projects(): Projects;
|
|
50
53
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -44,14 +44,15 @@ const Client_js_2 = require("./api/resources/tools/client/Client.js");
|
|
|
44
44
|
const Client_js_3 = require("./api/resources/extractionSchemas/client/Client.js");
|
|
45
45
|
const Client_js_4 = require("./api/resources/voices/client/Client.js");
|
|
46
46
|
const Client_js_5 = require("./api/resources/conversations/client/Client.js");
|
|
47
|
-
const Client_js_6 = require("./api/resources/
|
|
47
|
+
const Client_js_6 = require("./api/resources/auth/client/Client.js");
|
|
48
|
+
const Client_js_7 = require("./api/resources/projects/client/Client.js");
|
|
48
49
|
class PhonicClient {
|
|
49
50
|
constructor(_options = {}) {
|
|
50
51
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
51
52
|
"X-Fern-Language": "JavaScript",
|
|
52
53
|
"X-Fern-SDK-Name": "phonic",
|
|
53
|
-
"X-Fern-SDK-Version": "0.30.
|
|
54
|
-
"User-Agent": "phonic/0.30.
|
|
54
|
+
"X-Fern-SDK-Version": "0.30.21",
|
|
55
|
+
"User-Agent": "phonic/0.30.21",
|
|
55
56
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
56
57
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
57
58
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -76,9 +77,13 @@ class PhonicClient {
|
|
|
76
77
|
var _a;
|
|
77
78
|
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_5.Conversations(this._options)));
|
|
78
79
|
}
|
|
80
|
+
get auth() {
|
|
81
|
+
var _a;
|
|
82
|
+
return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new Client_js_6.Auth(this._options)));
|
|
83
|
+
}
|
|
79
84
|
get projects() {
|
|
80
85
|
var _a;
|
|
81
|
-
return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new
|
|
86
|
+
return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new Client_js_7.Projects(this._options)));
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
89
|
exports.PhonicClient = PhonicClient;
|
|
@@ -41,7 +41,11 @@ export interface AgentsCreateRequest {
|
|
|
41
41
|
project?: string;
|
|
42
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
43
43
|
name: string;
|
|
44
|
-
phone_number:
|
|
44
|
+
phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
|
|
45
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
46
|
+
custom_phone_number?: string | null;
|
|
47
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
48
|
+
custom_phone_numbers?: string[];
|
|
45
49
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
46
50
|
timezone?: string;
|
|
47
51
|
/** The voice ID to use. */
|
|
@@ -41,7 +41,11 @@ export interface UpdateAgentRequest {
|
|
|
41
41
|
project?: string;
|
|
42
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
43
43
|
name?: string;
|
|
44
|
-
phone_number:
|
|
44
|
+
phone_number: UpdateAgentRequest.PhoneNumber | null;
|
|
45
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
46
|
+
custom_phone_number?: string | null;
|
|
47
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
48
|
+
custom_phone_numbers?: string[];
|
|
45
49
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
46
50
|
timezone?: string;
|
|
47
51
|
/** The voice ID to use. */
|
|
@@ -78,6 +82,11 @@ export interface UpdateAgentRequest {
|
|
|
78
82
|
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
|
|
79
83
|
}
|
|
80
84
|
export declare namespace UpdateAgentRequest {
|
|
85
|
+
type PhoneNumber = "assign-automatically" | "custom";
|
|
86
|
+
const PhoneNumber: {
|
|
87
|
+
readonly AssignAutomatically: "assign-automatically";
|
|
88
|
+
readonly Custom: "custom";
|
|
89
|
+
};
|
|
81
90
|
/**
|
|
82
91
|
* The audio format of the agent.
|
|
83
92
|
*/
|
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.UpdateAgentRequest = void 0;
|
|
7
7
|
var UpdateAgentRequest;
|
|
8
8
|
(function (UpdateAgentRequest) {
|
|
9
|
+
UpdateAgentRequest.PhoneNumber = {
|
|
10
|
+
AssignAutomatically: "assign-automatically",
|
|
11
|
+
Custom: "custom",
|
|
12
|
+
};
|
|
9
13
|
UpdateAgentRequest.AudioFormat = {
|
|
10
14
|
Pcm44100: "pcm_44100",
|
|
11
15
|
Pcm16000: "pcm_16000",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments.js";
|
|
5
|
+
import * as core from "../../../../core/index.js";
|
|
6
|
+
import * as Phonic from "../../../index.js";
|
|
7
|
+
export declare namespace Auth {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.PhonicEnvironment | environments.PhonicEnvironmentUrls>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
12
|
+
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
|
+
/** Additional headers to include in requests. */
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
|
+
fetcher?: core.FetchFunction;
|
|
16
|
+
}
|
|
17
|
+
interface RequestOptions {
|
|
18
|
+
/** The maximum time to wait for a response in seconds. */
|
|
19
|
+
timeoutInSeconds?: number;
|
|
20
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
/** A hook to abort the request. */
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
24
|
+
/** Additional query string parameters to include in the request. */
|
|
25
|
+
queryParams?: Record<string, unknown>;
|
|
26
|
+
/** Additional headers to include in the request. */
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare class Auth {
|
|
31
|
+
protected readonly _options: Auth.Options;
|
|
32
|
+
constructor(_options?: Auth.Options);
|
|
33
|
+
/**
|
|
34
|
+
* Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key.
|
|
35
|
+
*
|
|
36
|
+
* @param {Phonic.CreateSessionTokenRequest} request
|
|
37
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
38
|
+
*
|
|
39
|
+
* @throws {@link Phonic.BadRequestError}
|
|
40
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
41
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
42
|
+
* @throws {@link Phonic.InternalServerError}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* await client.auth.createSessionToken({
|
|
46
|
+
* ttl_seconds: 300
|
|
47
|
+
* })
|
|
48
|
+
*/
|
|
49
|
+
createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
|
|
50
|
+
private __createSessionToken;
|
|
51
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.Auth = void 0;
|
|
49
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
50
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
51
|
+
const Phonic = __importStar(require("../../../index.js"));
|
|
52
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
53
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
54
|
+
class Auth {
|
|
55
|
+
constructor(_options = {}) {
|
|
56
|
+
this._options = _options;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key.
|
|
60
|
+
*
|
|
61
|
+
* @param {Phonic.CreateSessionTokenRequest} request
|
|
62
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
|
+
*
|
|
64
|
+
* @throws {@link Phonic.BadRequestError}
|
|
65
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
66
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
67
|
+
* @throws {@link Phonic.InternalServerError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.auth.createSessionToken({
|
|
71
|
+
* ttl_seconds: 300
|
|
72
|
+
* })
|
|
73
|
+
*/
|
|
74
|
+
createSessionToken(request = {}, requestOptions) {
|
|
75
|
+
return core.HttpResponsePromise.fromPromise(this.__createSessionToken(request, requestOptions));
|
|
76
|
+
}
|
|
77
|
+
__createSessionToken() {
|
|
78
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
79
|
+
var _a, _b, _c, _d;
|
|
80
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
81
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
82
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
83
|
+
.base, "auth/session_token"),
|
|
84
|
+
method: "POST",
|
|
85
|
+
headers: _headers,
|
|
86
|
+
contentType: "application/json",
|
|
87
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
88
|
+
requestType: "json",
|
|
89
|
+
body: request,
|
|
90
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
91
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
92
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
93
|
+
});
|
|
94
|
+
if (_response.ok) {
|
|
95
|
+
return {
|
|
96
|
+
data: _response.body,
|
|
97
|
+
rawResponse: _response.rawResponse,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (_response.error.reason === "status-code") {
|
|
101
|
+
switch (_response.error.statusCode) {
|
|
102
|
+
case 400:
|
|
103
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
104
|
+
case 401:
|
|
105
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
106
|
+
case 403:
|
|
107
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
108
|
+
case 500:
|
|
109
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
110
|
+
default:
|
|
111
|
+
throw new errors.PhonicError({
|
|
112
|
+
statusCode: _response.error.statusCode,
|
|
113
|
+
body: _response.error.body,
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
switch (_response.error.reason) {
|
|
119
|
+
case "non-json":
|
|
120
|
+
throw new errors.PhonicError({
|
|
121
|
+
statusCode: _response.error.statusCode,
|
|
122
|
+
body: _response.error.rawBody,
|
|
123
|
+
rawResponse: _response.rawResponse,
|
|
124
|
+
});
|
|
125
|
+
case "timeout":
|
|
126
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /auth/session_token.");
|
|
127
|
+
case "unknown":
|
|
128
|
+
throw new errors.PhonicError({
|
|
129
|
+
message: _response.error.errorMessage,
|
|
130
|
+
rawResponse: _response.rawResponse,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
_getAuthorizationHeader() {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
var _a;
|
|
138
|
+
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
139
|
+
if (bearer != null) {
|
|
140
|
+
return `Bearer ${bearer}`;
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.Auth = Auth;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* ttl_seconds: 300
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface CreateSessionTokenRequest {
|
|
11
|
+
/** Time-to-live for the session token in seconds. */
|
|
12
|
+
ttl_seconds?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type CreateSessionTokenRequest } from "./CreateSessionTokenRequest.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types/index.js"), exports);
|
|
18
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthCreateSessionTokenResponse {
|
|
5
|
+
/** The session token to use for authentication. */
|
|
6
|
+
session_token: string;
|
|
7
|
+
/** When the session token expires. */
|
|
8
|
+
expires_at: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AuthCreateSessionTokenResponse.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AuthCreateSessionTokenResponse.js"), exports);
|
|
@@ -803,14 +803,7 @@ class Conversations {
|
|
|
803
803
|
__sipOutboundCall(request, requestOptions) {
|
|
804
804
|
return __awaiter(this, void 0, void 0, function* () {
|
|
805
805
|
var _a, _b, _c, _d;
|
|
806
|
-
const {
|
|
807
|
-
const _queryParams = {};
|
|
808
|
-
if (token != null) {
|
|
809
|
-
_queryParams["token"] = token;
|
|
810
|
-
}
|
|
811
|
-
if (downstreamWebsocketUrl != null) {
|
|
812
|
-
_queryParams["downstream_websocket_url"] = downstreamWebsocketUrl;
|
|
813
|
-
}
|
|
806
|
+
const { "X-Sip-Address": sipAddress, "X-Sip-Auth-Username": sipAuthUsername, "X-Sip-Auth-Password": sipAuthPassword } = request, _body = __rest(request, ["X-Sip-Address", "X-Sip-Auth-Username", "X-Sip-Auth-Password"]);
|
|
814
807
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
815
808
|
Authorization: yield this._getAuthorizationHeader(),
|
|
816
809
|
"X-Sip-Address": sipAddress,
|
|
@@ -823,7 +816,7 @@ class Conversations {
|
|
|
823
816
|
method: "POST",
|
|
824
817
|
headers: _headers,
|
|
825
818
|
contentType: "application/json",
|
|
826
|
-
queryParameters:
|
|
819
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
827
820
|
requestType: "json",
|
|
828
821
|
body: _body,
|
|
829
822
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -11,10 +11,6 @@ import * as Phonic from "../../../../index.js";
|
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
13
|
export interface ConversationsSipOutboundCallRequest {
|
|
14
|
-
/** Optional session token used for STS authorization. */
|
|
15
|
-
token?: string;
|
|
16
|
-
/** Optional downstream STS WebSocket URL to override the default. */
|
|
17
|
-
downstream_websocket_url?: string;
|
|
18
14
|
/** SIP address of the user's SIP trunk. Required. */
|
|
19
15
|
"X-Sip-Address": string;
|
|
20
16
|
/** SIP auth username, if your provider requires it. */
|
|
@@ -8,6 +8,8 @@ export * as voices from "./voices/index.js";
|
|
|
8
8
|
export * from "./voices/types/index.js";
|
|
9
9
|
export * as conversations from "./conversations/index.js";
|
|
10
10
|
export * from "./conversations/types/index.js";
|
|
11
|
+
export * as auth from "./auth/index.js";
|
|
12
|
+
export * from "./auth/types/index.js";
|
|
11
13
|
export * as projects from "./projects/index.js";
|
|
12
14
|
export * from "./projects/types/index.js";
|
|
13
15
|
export * from "./agents/client/requests/index.js";
|
|
@@ -15,4 +17,5 @@ export * from "./tools/client/requests/index.js";
|
|
|
15
17
|
export * from "./extractionSchemas/client/requests/index.js";
|
|
16
18
|
export * from "./voices/client/requests/index.js";
|
|
17
19
|
export * from "./conversations/client/requests/index.js";
|
|
20
|
+
export * from "./auth/client/requests/index.js";
|
|
18
21
|
export * from "./projects/client/requests/index.js";
|
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.projects = exports.conversations = exports.voices = exports.extractionSchemas = exports.tools = exports.agents = void 0;
|
|
39
|
+
exports.projects = exports.auth = exports.conversations = exports.voices = exports.extractionSchemas = exports.tools = exports.agents = void 0;
|
|
40
40
|
exports.agents = __importStar(require("./agents/index.js"));
|
|
41
41
|
__exportStar(require("./agents/types/index.js"), exports);
|
|
42
42
|
exports.tools = __importStar(require("./tools/index.js"));
|
|
@@ -47,6 +47,8 @@ exports.voices = __importStar(require("./voices/index.js"));
|
|
|
47
47
|
__exportStar(require("./voices/types/index.js"), exports);
|
|
48
48
|
exports.conversations = __importStar(require("./conversations/index.js"));
|
|
49
49
|
__exportStar(require("./conversations/types/index.js"), exports);
|
|
50
|
+
exports.auth = __importStar(require("./auth/index.js"));
|
|
51
|
+
__exportStar(require("./auth/types/index.js"), exports);
|
|
50
52
|
exports.projects = __importStar(require("./projects/index.js"));
|
|
51
53
|
__exportStar(require("./projects/types/index.js"), exports);
|
|
52
54
|
__exportStar(require("./agents/client/requests/index.js"), exports);
|
|
@@ -54,4 +56,5 @@ __exportStar(require("./tools/client/requests/index.js"), exports);
|
|
|
54
56
|
__exportStar(require("./extractionSchemas/client/requests/index.js"), exports);
|
|
55
57
|
__exportStar(require("./voices/client/requests/index.js"), exports);
|
|
56
58
|
__exportStar(require("./conversations/client/requests/index.js"), exports);
|
|
59
|
+
__exportStar(require("./auth/client/requests/index.js"), exports);
|
|
57
60
|
__exportStar(require("./projects/client/requests/index.js"), exports);
|
|
@@ -7,8 +7,10 @@ export interface Agent {
|
|
|
7
7
|
id: string;
|
|
8
8
|
/** The name of the agent. */
|
|
9
9
|
name: string;
|
|
10
|
-
/** The phone number that the agent uses to accept
|
|
10
|
+
/** The phone number that the agent uses to accept calls. `null` if the agent is not associated with a phone number, in which can the agent can be used via WebSockets. This field is deprecated. Use `phone_numbers` instead. */
|
|
11
11
|
phone_number: string | null;
|
|
12
|
+
/** Array of phone numbers that the agent uses to accept phone calls. */
|
|
13
|
+
phone_numbers: string[];
|
|
12
14
|
/** The project the agent belongs to. */
|
|
13
15
|
project: Agent.Project;
|
|
14
16
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
@@ -55,6 +55,8 @@ export interface Conversation {
|
|
|
55
55
|
task_results: Record<string, unknown>;
|
|
56
56
|
/** Array of conversation items (turns). */
|
|
57
57
|
items: Phonic.ConversationItem[];
|
|
58
|
+
/** Phone call metadata. `null` for non-phone call conversations. */
|
|
59
|
+
call_info: Conversation.CallInfo | null;
|
|
58
60
|
}
|
|
59
61
|
export declare namespace Conversation {
|
|
60
62
|
/**
|
|
@@ -97,4 +99,15 @@ export declare namespace Conversation {
|
|
|
97
99
|
readonly Assistant: "assistant";
|
|
98
100
|
readonly Error: "error";
|
|
99
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Phone call metadata. `null` for non-phone call conversations.
|
|
104
|
+
*/
|
|
105
|
+
interface CallInfo {
|
|
106
|
+
/** Caller phone number in E.164 format. */
|
|
107
|
+
from_phone_number: string;
|
|
108
|
+
/** Callee phone number in E.164 format. */
|
|
109
|
+
to_phone_number: string;
|
|
110
|
+
/** Twilio Call SID. Only present for user SIP trunking calls. */
|
|
111
|
+
twilio_call_sid?: string;
|
|
112
|
+
}
|
|
100
113
|
}
|
|
@@ -5,7 +5,11 @@ import * as Phonic from "../index.js";
|
|
|
5
5
|
export interface CreateAgentRequest {
|
|
6
6
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
7
7
|
name: string;
|
|
8
|
-
phone_number:
|
|
8
|
+
phone_number: CreateAgentRequest.PhoneNumber | null;
|
|
9
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
10
|
+
custom_phone_number?: string | null;
|
|
11
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
12
|
+
custom_phone_numbers?: string[];
|
|
9
13
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
10
14
|
timezone?: string;
|
|
11
15
|
/** The voice ID to use. */
|
|
@@ -42,6 +46,11 @@ export interface CreateAgentRequest {
|
|
|
42
46
|
configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
|
|
43
47
|
}
|
|
44
48
|
export declare namespace CreateAgentRequest {
|
|
49
|
+
type PhoneNumber = "assign-automatically" | "custom";
|
|
50
|
+
const PhoneNumber: {
|
|
51
|
+
readonly AssignAutomatically: "assign-automatically";
|
|
52
|
+
readonly Custom: "custom";
|
|
53
|
+
};
|
|
45
54
|
/**
|
|
46
55
|
* The audio format of the agent.
|
|
47
56
|
*/
|
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CreateAgentRequest = void 0;
|
|
7
7
|
var CreateAgentRequest;
|
|
8
8
|
(function (CreateAgentRequest) {
|
|
9
|
+
CreateAgentRequest.PhoneNumber = {
|
|
10
|
+
AssignAutomatically: "assign-automatically",
|
|
11
|
+
Custom: "custom",
|
|
12
|
+
};
|
|
9
13
|
CreateAgentRequest.AudioFormat = {
|
|
10
14
|
Pcm44100: "pcm_44100",
|
|
11
15
|
Pcm16000: "pcm_16000",
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.21";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ import { Tools } from "./api/resources/tools/client/Client.mjs";
|
|
|
8
8
|
import { ExtractionSchemas } from "./api/resources/extractionSchemas/client/Client.mjs";
|
|
9
9
|
import { Voices } from "./api/resources/voices/client/Client.mjs";
|
|
10
10
|
import { Conversations } from "./api/resources/conversations/client/Client.mjs";
|
|
11
|
+
import { Auth } from "./api/resources/auth/client/Client.mjs";
|
|
11
12
|
import { Projects } from "./api/resources/projects/client/Client.mjs";
|
|
12
13
|
export declare namespace PhonicClient {
|
|
13
14
|
interface Options {
|
|
@@ -39,6 +40,7 @@ export declare class PhonicClient {
|
|
|
39
40
|
protected _extractionSchemas: ExtractionSchemas | undefined;
|
|
40
41
|
protected _voices: Voices | undefined;
|
|
41
42
|
protected _conversations: Conversations | undefined;
|
|
43
|
+
protected _auth: Auth | undefined;
|
|
42
44
|
protected _projects: Projects | undefined;
|
|
43
45
|
constructor(_options?: PhonicClient.Options);
|
|
44
46
|
get agents(): Agents;
|
|
@@ -46,5 +48,6 @@ export declare class PhonicClient {
|
|
|
46
48
|
get extractionSchemas(): ExtractionSchemas;
|
|
47
49
|
get voices(): Voices;
|
|
48
50
|
get conversations(): Conversations;
|
|
51
|
+
get auth(): Auth;
|
|
49
52
|
get projects(): Projects;
|
|
50
53
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -8,14 +8,15 @@ import { Tools } from "./api/resources/tools/client/Client.mjs";
|
|
|
8
8
|
import { ExtractionSchemas } from "./api/resources/extractionSchemas/client/Client.mjs";
|
|
9
9
|
import { Voices } from "./api/resources/voices/client/Client.mjs";
|
|
10
10
|
import { Conversations } from "./api/resources/conversations/client/Client.mjs";
|
|
11
|
+
import { Auth } from "./api/resources/auth/client/Client.mjs";
|
|
11
12
|
import { Projects } from "./api/resources/projects/client/Client.mjs";
|
|
12
13
|
export class PhonicClient {
|
|
13
14
|
constructor(_options = {}) {
|
|
14
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
15
16
|
"X-Fern-Language": "JavaScript",
|
|
16
17
|
"X-Fern-SDK-Name": "phonic",
|
|
17
|
-
"X-Fern-SDK-Version": "0.30.
|
|
18
|
-
"User-Agent": "phonic/0.30.
|
|
18
|
+
"X-Fern-SDK-Version": "0.30.21",
|
|
19
|
+
"User-Agent": "phonic/0.30.21",
|
|
19
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
20
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
21
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -40,6 +41,10 @@ export class PhonicClient {
|
|
|
40
41
|
var _a;
|
|
41
42
|
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Conversations(this._options)));
|
|
42
43
|
}
|
|
44
|
+
get auth() {
|
|
45
|
+
var _a;
|
|
46
|
+
return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new Auth(this._options)));
|
|
47
|
+
}
|
|
43
48
|
get projects() {
|
|
44
49
|
var _a;
|
|
45
50
|
return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new Projects(this._options)));
|
|
@@ -41,7 +41,11 @@ export interface AgentsCreateRequest {
|
|
|
41
41
|
project?: string;
|
|
42
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
43
43
|
name: string;
|
|
44
|
-
phone_number:
|
|
44
|
+
phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
|
|
45
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
46
|
+
custom_phone_number?: string | null;
|
|
47
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
48
|
+
custom_phone_numbers?: string[];
|
|
45
49
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
46
50
|
timezone?: string;
|
|
47
51
|
/** The voice ID to use. */
|
|
@@ -41,7 +41,11 @@ export interface UpdateAgentRequest {
|
|
|
41
41
|
project?: string;
|
|
42
42
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
43
43
|
name?: string;
|
|
44
|
-
phone_number:
|
|
44
|
+
phone_number: UpdateAgentRequest.PhoneNumber | null;
|
|
45
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
46
|
+
custom_phone_number?: string | null;
|
|
47
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
48
|
+
custom_phone_numbers?: string[];
|
|
45
49
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
46
50
|
timezone?: string;
|
|
47
51
|
/** The voice ID to use. */
|
|
@@ -78,6 +82,11 @@ export interface UpdateAgentRequest {
|
|
|
78
82
|
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
|
|
79
83
|
}
|
|
80
84
|
export declare namespace UpdateAgentRequest {
|
|
85
|
+
type PhoneNumber = "assign-automatically" | "custom";
|
|
86
|
+
const PhoneNumber: {
|
|
87
|
+
readonly AssignAutomatically: "assign-automatically";
|
|
88
|
+
readonly Custom: "custom";
|
|
89
|
+
};
|
|
81
90
|
/**
|
|
82
91
|
* The audio format of the agent.
|
|
83
92
|
*/
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var UpdateAgentRequest;
|
|
5
5
|
(function (UpdateAgentRequest) {
|
|
6
|
+
UpdateAgentRequest.PhoneNumber = {
|
|
7
|
+
AssignAutomatically: "assign-automatically",
|
|
8
|
+
Custom: "custom",
|
|
9
|
+
};
|
|
6
10
|
UpdateAgentRequest.AudioFormat = {
|
|
7
11
|
Pcm44100: "pcm_44100",
|
|
8
12
|
Pcm16000: "pcm_16000",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments.mjs";
|
|
5
|
+
import * as core from "../../../../core/index.mjs";
|
|
6
|
+
import * as Phonic from "../../../index.mjs";
|
|
7
|
+
export declare namespace Auth {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.PhonicEnvironment | environments.PhonicEnvironmentUrls>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
12
|
+
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
|
+
/** Additional headers to include in requests. */
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
|
+
fetcher?: core.FetchFunction;
|
|
16
|
+
}
|
|
17
|
+
interface RequestOptions {
|
|
18
|
+
/** The maximum time to wait for a response in seconds. */
|
|
19
|
+
timeoutInSeconds?: number;
|
|
20
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
/** A hook to abort the request. */
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
24
|
+
/** Additional query string parameters to include in the request. */
|
|
25
|
+
queryParams?: Record<string, unknown>;
|
|
26
|
+
/** Additional headers to include in the request. */
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare class Auth {
|
|
31
|
+
protected readonly _options: Auth.Options;
|
|
32
|
+
constructor(_options?: Auth.Options);
|
|
33
|
+
/**
|
|
34
|
+
* Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key.
|
|
35
|
+
*
|
|
36
|
+
* @param {Phonic.CreateSessionTokenRequest} request
|
|
37
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
38
|
+
*
|
|
39
|
+
* @throws {@link Phonic.BadRequestError}
|
|
40
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
41
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
42
|
+
* @throws {@link Phonic.InternalServerError}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* await client.auth.createSessionToken({
|
|
46
|
+
* ttl_seconds: 300
|
|
47
|
+
* })
|
|
48
|
+
*/
|
|
49
|
+
createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
|
|
50
|
+
private __createSessionToken;
|
|
51
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../core/index.mjs";
|
|
15
|
+
import * as Phonic from "../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
18
|
+
export class Auth {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key.
|
|
24
|
+
*
|
|
25
|
+
* @param {Phonic.CreateSessionTokenRequest} request
|
|
26
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Phonic.BadRequestError}
|
|
29
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
30
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
31
|
+
* @throws {@link Phonic.InternalServerError}
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.auth.createSessionToken({
|
|
35
|
+
* ttl_seconds: 300
|
|
36
|
+
* })
|
|
37
|
+
*/
|
|
38
|
+
createSessionToken(request = {}, requestOptions) {
|
|
39
|
+
return core.HttpResponsePromise.fromPromise(this.__createSessionToken(request, requestOptions));
|
|
40
|
+
}
|
|
41
|
+
__createSessionToken() {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
45
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
46
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
47
|
+
.base, "auth/session_token"),
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: _headers,
|
|
50
|
+
contentType: "application/json",
|
|
51
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
52
|
+
requestType: "json",
|
|
53
|
+
body: request,
|
|
54
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
55
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
56
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
57
|
+
});
|
|
58
|
+
if (_response.ok) {
|
|
59
|
+
return {
|
|
60
|
+
data: _response.body,
|
|
61
|
+
rawResponse: _response.rawResponse,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (_response.error.reason === "status-code") {
|
|
65
|
+
switch (_response.error.statusCode) {
|
|
66
|
+
case 400:
|
|
67
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
68
|
+
case 401:
|
|
69
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
70
|
+
case 403:
|
|
71
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
72
|
+
case 500:
|
|
73
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
74
|
+
default:
|
|
75
|
+
throw new errors.PhonicError({
|
|
76
|
+
statusCode: _response.error.statusCode,
|
|
77
|
+
body: _response.error.body,
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
switch (_response.error.reason) {
|
|
83
|
+
case "non-json":
|
|
84
|
+
throw new errors.PhonicError({
|
|
85
|
+
statusCode: _response.error.statusCode,
|
|
86
|
+
body: _response.error.rawBody,
|
|
87
|
+
rawResponse: _response.rawResponse,
|
|
88
|
+
});
|
|
89
|
+
case "timeout":
|
|
90
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /auth/session_token.");
|
|
91
|
+
case "unknown":
|
|
92
|
+
throw new errors.PhonicError({
|
|
93
|
+
message: _response.error.errorMessage,
|
|
94
|
+
rawResponse: _response.rawResponse,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
_getAuthorizationHeader() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
102
|
+
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
103
|
+
if (bearer != null) {
|
|
104
|
+
return `Bearer ${bearer}`;
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* ttl_seconds: 300
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface CreateSessionTokenRequest {
|
|
11
|
+
/** Time-to-live for the session token in seconds. */
|
|
12
|
+
ttl_seconds?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type CreateSessionTokenRequest } from "./CreateSessionTokenRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthCreateSessionTokenResponse {
|
|
5
|
+
/** The session token to use for authentication. */
|
|
6
|
+
session_token: string;
|
|
7
|
+
/** When the session token expires. */
|
|
8
|
+
expires_at: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AuthCreateSessionTokenResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AuthCreateSessionTokenResponse.mjs";
|
|
@@ -767,14 +767,7 @@ export class Conversations {
|
|
|
767
767
|
__sipOutboundCall(request, requestOptions) {
|
|
768
768
|
return __awaiter(this, void 0, void 0, function* () {
|
|
769
769
|
var _a, _b, _c, _d;
|
|
770
|
-
const {
|
|
771
|
-
const _queryParams = {};
|
|
772
|
-
if (token != null) {
|
|
773
|
-
_queryParams["token"] = token;
|
|
774
|
-
}
|
|
775
|
-
if (downstreamWebsocketUrl != null) {
|
|
776
|
-
_queryParams["downstream_websocket_url"] = downstreamWebsocketUrl;
|
|
777
|
-
}
|
|
770
|
+
const { "X-Sip-Address": sipAddress, "X-Sip-Auth-Username": sipAuthUsername, "X-Sip-Auth-Password": sipAuthPassword } = request, _body = __rest(request, ["X-Sip-Address", "X-Sip-Auth-Username", "X-Sip-Auth-Password"]);
|
|
778
771
|
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
779
772
|
Authorization: yield this._getAuthorizationHeader(),
|
|
780
773
|
"X-Sip-Address": sipAddress,
|
|
@@ -787,7 +780,7 @@ export class Conversations {
|
|
|
787
780
|
method: "POST",
|
|
788
781
|
headers: _headers,
|
|
789
782
|
contentType: "application/json",
|
|
790
|
-
queryParameters:
|
|
783
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
791
784
|
requestType: "json",
|
|
792
785
|
body: _body,
|
|
793
786
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -11,10 +11,6 @@ import * as Phonic from "../../../../index.mjs";
|
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
13
|
export interface ConversationsSipOutboundCallRequest {
|
|
14
|
-
/** Optional session token used for STS authorization. */
|
|
15
|
-
token?: string;
|
|
16
|
-
/** Optional downstream STS WebSocket URL to override the default. */
|
|
17
|
-
downstream_websocket_url?: string;
|
|
18
14
|
/** SIP address of the user's SIP trunk. Required. */
|
|
19
15
|
"X-Sip-Address": string;
|
|
20
16
|
/** SIP auth username, if your provider requires it. */
|
|
@@ -8,6 +8,8 @@ export * as voices from "./voices/index.mjs";
|
|
|
8
8
|
export * from "./voices/types/index.mjs";
|
|
9
9
|
export * as conversations from "./conversations/index.mjs";
|
|
10
10
|
export * from "./conversations/types/index.mjs";
|
|
11
|
+
export * as auth from "./auth/index.mjs";
|
|
12
|
+
export * from "./auth/types/index.mjs";
|
|
11
13
|
export * as projects from "./projects/index.mjs";
|
|
12
14
|
export * from "./projects/types/index.mjs";
|
|
13
15
|
export * from "./agents/client/requests/index.mjs";
|
|
@@ -15,4 +17,5 @@ export * from "./tools/client/requests/index.mjs";
|
|
|
15
17
|
export * from "./extractionSchemas/client/requests/index.mjs";
|
|
16
18
|
export * from "./voices/client/requests/index.mjs";
|
|
17
19
|
export * from "./conversations/client/requests/index.mjs";
|
|
20
|
+
export * from "./auth/client/requests/index.mjs";
|
|
18
21
|
export * from "./projects/client/requests/index.mjs";
|
|
@@ -8,6 +8,8 @@ export * as voices from "./voices/index.mjs";
|
|
|
8
8
|
export * from "./voices/types/index.mjs";
|
|
9
9
|
export * as conversations from "./conversations/index.mjs";
|
|
10
10
|
export * from "./conversations/types/index.mjs";
|
|
11
|
+
export * as auth from "./auth/index.mjs";
|
|
12
|
+
export * from "./auth/types/index.mjs";
|
|
11
13
|
export * as projects from "./projects/index.mjs";
|
|
12
14
|
export * from "./projects/types/index.mjs";
|
|
13
15
|
export * from "./agents/client/requests/index.mjs";
|
|
@@ -15,4 +17,5 @@ export * from "./tools/client/requests/index.mjs";
|
|
|
15
17
|
export * from "./extractionSchemas/client/requests/index.mjs";
|
|
16
18
|
export * from "./voices/client/requests/index.mjs";
|
|
17
19
|
export * from "./conversations/client/requests/index.mjs";
|
|
20
|
+
export * from "./auth/client/requests/index.mjs";
|
|
18
21
|
export * from "./projects/client/requests/index.mjs";
|
|
@@ -7,8 +7,10 @@ export interface Agent {
|
|
|
7
7
|
id: string;
|
|
8
8
|
/** The name of the agent. */
|
|
9
9
|
name: string;
|
|
10
|
-
/** The phone number that the agent uses to accept
|
|
10
|
+
/** The phone number that the agent uses to accept calls. `null` if the agent is not associated with a phone number, in which can the agent can be used via WebSockets. This field is deprecated. Use `phone_numbers` instead. */
|
|
11
11
|
phone_number: string | null;
|
|
12
|
+
/** Array of phone numbers that the agent uses to accept phone calls. */
|
|
13
|
+
phone_numbers: string[];
|
|
12
14
|
/** The project the agent belongs to. */
|
|
13
15
|
project: Agent.Project;
|
|
14
16
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
@@ -55,6 +55,8 @@ export interface Conversation {
|
|
|
55
55
|
task_results: Record<string, unknown>;
|
|
56
56
|
/** Array of conversation items (turns). */
|
|
57
57
|
items: Phonic.ConversationItem[];
|
|
58
|
+
/** Phone call metadata. `null` for non-phone call conversations. */
|
|
59
|
+
call_info: Conversation.CallInfo | null;
|
|
58
60
|
}
|
|
59
61
|
export declare namespace Conversation {
|
|
60
62
|
/**
|
|
@@ -97,4 +99,15 @@ export declare namespace Conversation {
|
|
|
97
99
|
readonly Assistant: "assistant";
|
|
98
100
|
readonly Error: "error";
|
|
99
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Phone call metadata. `null` for non-phone call conversations.
|
|
104
|
+
*/
|
|
105
|
+
interface CallInfo {
|
|
106
|
+
/** Caller phone number in E.164 format. */
|
|
107
|
+
from_phone_number: string;
|
|
108
|
+
/** Callee phone number in E.164 format. */
|
|
109
|
+
to_phone_number: string;
|
|
110
|
+
/** Twilio Call SID. Only present for user SIP trunking calls. */
|
|
111
|
+
twilio_call_sid?: string;
|
|
112
|
+
}
|
|
100
113
|
}
|
|
@@ -5,7 +5,11 @@ import * as Phonic from "../index.mjs";
|
|
|
5
5
|
export interface CreateAgentRequest {
|
|
6
6
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
7
7
|
name: string;
|
|
8
|
-
phone_number:
|
|
8
|
+
phone_number: CreateAgentRequest.PhoneNumber | null;
|
|
9
|
+
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
10
|
+
custom_phone_number?: string | null;
|
|
11
|
+
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
12
|
+
custom_phone_numbers?: string[];
|
|
9
13
|
/** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
|
|
10
14
|
timezone?: string;
|
|
11
15
|
/** The voice ID to use. */
|
|
@@ -42,6 +46,11 @@ export interface CreateAgentRequest {
|
|
|
42
46
|
configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
|
|
43
47
|
}
|
|
44
48
|
export declare namespace CreateAgentRequest {
|
|
49
|
+
type PhoneNumber = "assign-automatically" | "custom";
|
|
50
|
+
const PhoneNumber: {
|
|
51
|
+
readonly AssignAutomatically: "assign-automatically";
|
|
52
|
+
readonly Custom: "custom";
|
|
53
|
+
};
|
|
45
54
|
/**
|
|
46
55
|
* The audio format of the agent.
|
|
47
56
|
*/
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var CreateAgentRequest;
|
|
5
5
|
(function (CreateAgentRequest) {
|
|
6
|
+
CreateAgentRequest.PhoneNumber = {
|
|
7
|
+
AssignAutomatically: "assign-automatically",
|
|
8
|
+
Custom: "custom",
|
|
9
|
+
};
|
|
6
10
|
CreateAgentRequest.AudioFormat = {
|
|
7
11
|
Pcm44100: "pcm_44100",
|
|
8
12
|
Pcm16000: "pcm_16000",
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.21";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.30.
|
|
1
|
+
export const SDK_VERSION = "0.30.21";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2056,6 +2056,73 @@ await client.conversations.sipOutboundCall({
|
|
|
2056
2056
|
</dl>
|
|
2057
2057
|
</details>
|
|
2058
2058
|
|
|
2059
|
+
## Auth
|
|
2060
|
+
|
|
2061
|
+
<details><summary><code>client.auth.<a href="/src/api/resources/auth/client/Client.ts">createSessionToken</a>({ ...params }) -> Phonic.AuthCreateSessionTokenResponse</code></summary>
|
|
2062
|
+
<dl>
|
|
2063
|
+
<dd>
|
|
2064
|
+
|
|
2065
|
+
#### 📝 Description
|
|
2066
|
+
|
|
2067
|
+
<dl>
|
|
2068
|
+
<dd>
|
|
2069
|
+
|
|
2070
|
+
<dl>
|
|
2071
|
+
<dd>
|
|
2072
|
+
|
|
2073
|
+
Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key.
|
|
2074
|
+
|
|
2075
|
+
</dd>
|
|
2076
|
+
</dl>
|
|
2077
|
+
</dd>
|
|
2078
|
+
</dl>
|
|
2079
|
+
|
|
2080
|
+
#### 🔌 Usage
|
|
2081
|
+
|
|
2082
|
+
<dl>
|
|
2083
|
+
<dd>
|
|
2084
|
+
|
|
2085
|
+
<dl>
|
|
2086
|
+
<dd>
|
|
2087
|
+
|
|
2088
|
+
```typescript
|
|
2089
|
+
await client.auth.createSessionToken({
|
|
2090
|
+
ttl_seconds: 300,
|
|
2091
|
+
});
|
|
2092
|
+
```
|
|
2093
|
+
|
|
2094
|
+
</dd>
|
|
2095
|
+
</dl>
|
|
2096
|
+
</dd>
|
|
2097
|
+
</dl>
|
|
2098
|
+
|
|
2099
|
+
#### ⚙️ Parameters
|
|
2100
|
+
|
|
2101
|
+
<dl>
|
|
2102
|
+
<dd>
|
|
2103
|
+
|
|
2104
|
+
<dl>
|
|
2105
|
+
<dd>
|
|
2106
|
+
|
|
2107
|
+
**request:** `Phonic.CreateSessionTokenRequest`
|
|
2108
|
+
|
|
2109
|
+
</dd>
|
|
2110
|
+
</dl>
|
|
2111
|
+
|
|
2112
|
+
<dl>
|
|
2113
|
+
<dd>
|
|
2114
|
+
|
|
2115
|
+
**requestOptions:** `Auth.RequestOptions`
|
|
2116
|
+
|
|
2117
|
+
</dd>
|
|
2118
|
+
</dl>
|
|
2119
|
+
</dd>
|
|
2120
|
+
</dl>
|
|
2121
|
+
|
|
2122
|
+
</dd>
|
|
2123
|
+
</dl>
|
|
2124
|
+
</details>
|
|
2125
|
+
|
|
2059
2126
|
## Projects
|
|
2060
2127
|
|
|
2061
2128
|
<details><summary><code>client.projects.<a href="/src/api/resources/projects/client/Client.ts">list</a>() -> Phonic.ProjectsListResponse</code></summary>
|