@signalwire/sdk 2.0.0 → 2.0.1
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/package.json +1 -1
- package/src/AgentBase.ts +113 -4
- package/src/AgentServer.ts +31 -4
- package/src/ContextBuilder.ts +33 -2
- package/src/DataMap.ts +30 -2
- package/src/FunctionResult.ts +40 -3
- package/src/PomBuilder.ts +29 -1
- package/src/SWMLService.ts +38 -6
- package/src/ServerlessAdapter.ts +20 -1
- package/src/SwmlBuilder.ts +26 -1
- package/src/TypeInference.ts +27 -9
- package/src/WebService.ts +27 -5
- package/src/index.ts +73 -7
- package/src/livewire/index.ts +343 -41
- package/src/prefabs/ConciergeAgent.ts +22 -0
- package/src/prefabs/FAQBotAgent.ts +32 -1
- package/src/prefabs/InfoGathererAgent.ts +41 -1
- package/src/prefabs/ReceptionistAgent.ts +30 -1
- package/src/prefabs/SurveyAgent.ts +26 -1
- package/src/relay/Action.ts +174 -6
- package/src/relay/Call.ts +459 -43
- package/src/relay/Deferred.ts +27 -4
- package/src/relay/Message.ts +54 -3
- package/src/relay/RelayClient.ts +167 -18
- package/src/relay/RelayError.ts +7 -1
- package/src/relay/RelayEvent.ts +52 -0
- package/src/rest/HttpClient.ts +61 -0
- package/src/rest/RestError.ts +14 -0
- package/src/rest/base/BaseResource.ts +16 -3
- package/src/rest/base/CrudResource.ts +52 -5
- package/src/rest/base/CrudWithAddresses.ts +12 -1
- package/src/rest/index.ts +30 -0
- package/src/rest/namespaces/addresses.ts +33 -1
- package/src/rest/namespaces/calling.ts +348 -1
- package/src/rest/namespaces/chat.ts +13 -2
- package/src/rest/namespaces/compat.ts +469 -9
- package/src/rest/namespaces/datasphere.ts +48 -5
- package/src/rest/namespaces/fabric.ts +197 -2
- package/src/rest/namespaces/imported-numbers.ts +13 -2
- package/src/rest/namespaces/logs.ts +68 -1
- package/src/rest/namespaces/lookup.ts +19 -2
- package/src/rest/namespaces/mfa.ts +35 -4
- package/src/rest/namespaces/number-groups.ts +35 -5
- package/src/rest/namespaces/phone-numbers.ts +35 -3
- package/src/rest/namespaces/project.ts +30 -1
- package/src/rest/namespaces/pubsub.ts +13 -2
- package/src/rest/namespaces/queues.ts +29 -4
- package/src/rest/namespaces/recordings.ts +26 -1
- package/src/rest/namespaces/registry.ts +100 -1
- package/src/rest/namespaces/short-codes.ts +27 -1
- package/src/rest/namespaces/sip-profile.ts +18 -3
- package/src/rest/namespaces/verified-callers.ts +22 -3
- package/src/rest/namespaces/video.ts +168 -1
- package/src/rest/pagination.ts +22 -8
- package/src/skills/SkillBase.ts +37 -2
- package/src/skills/SkillManager.ts +8 -4
- package/src/skills/builtin/api_ninjas_trivia.ts +5 -0
- package/src/skills/builtin/ask_claude.ts +5 -0
- package/src/skills/builtin/claude_skills.ts +5 -0
- package/src/skills/builtin/custom_skills.ts +15 -0
- package/src/skills/builtin/datasphere.ts +9 -0
- package/src/skills/builtin/datasphere_serverless.ts +8 -0
- package/src/skills/builtin/datetime.ts +7 -0
- package/src/skills/builtin/google_maps.ts +5 -0
- package/src/skills/builtin/info_gatherer.ts +10 -0
- package/src/skills/builtin/joke.ts +5 -0
- package/src/skills/builtin/math.ts +7 -0
- package/src/skills/builtin/mcp_gateway.ts +8 -0
- package/src/skills/builtin/native_vector_search.ts +9 -0
- package/src/skills/builtin/play_background_file.ts +9 -0
- package/src/skills/builtin/spider.ts +5 -0
- package/src/skills/builtin/swml_transfer.ts +10 -0
- package/src/skills/builtin/weather_api.ts +7 -0
- package/src/skills/builtin/web_search.ts +9 -0
- package/src/skills/builtin/wikipedia_search.ts +5 -0
|
@@ -8,7 +8,11 @@ import type { HttpClient } from '../HttpClient.js';
|
|
|
8
8
|
import type { QueryParams } from '../types.js';
|
|
9
9
|
import { CrudResource } from '../base/CrudResource.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Number group management with membership operations.
|
|
13
|
+
*
|
|
14
|
+
* Access via `client.numberGroups.*`. Extends standard CRUD with membership helpers.
|
|
15
|
+
*/
|
|
12
16
|
export class NumberGroupsResource extends CrudResource {
|
|
13
17
|
protected override _updateMethod: 'PATCH' | 'PUT' = 'PUT';
|
|
14
18
|
|
|
@@ -16,22 +20,48 @@ export class NumberGroupsResource extends CrudResource {
|
|
|
16
20
|
super(http, '/api/relay/rest/number_groups');
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* List memberships (phone-number assignments) in a group.
|
|
25
|
+
*
|
|
26
|
+
* @param groupId - Unique identifier of the number group.
|
|
27
|
+
* @param params - Optional filter / pagination query parameters.
|
|
28
|
+
* @returns A paginated list of number-group memberships.
|
|
29
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
30
|
+
*/
|
|
20
31
|
async listMemberships(groupId: string, params?: QueryParams): Promise<any> {
|
|
21
32
|
return this._http.get(this._path(groupId, 'number_group_memberships'), params);
|
|
22
33
|
}
|
|
23
34
|
|
|
24
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Add a phone number to a group.
|
|
37
|
+
*
|
|
38
|
+
* @param groupId - Unique identifier of the number group.
|
|
39
|
+
* @param body - Membership payload (typically `{ phone_number_id: "..." }`).
|
|
40
|
+
* @returns The newly-created membership record.
|
|
41
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
42
|
+
*/
|
|
25
43
|
async addMembership(groupId: string, body: any): Promise<any> {
|
|
26
44
|
return this._http.post(this._path(groupId, 'number_group_memberships'), body);
|
|
27
45
|
}
|
|
28
46
|
|
|
29
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Fetch a membership by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param membershipId - Unique identifier of the membership.
|
|
51
|
+
* @returns The membership record.
|
|
52
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
53
|
+
*/
|
|
30
54
|
async getMembership(membershipId: string): Promise<any> {
|
|
31
55
|
return this._http.get(`/api/relay/rest/number_group_memberships/${membershipId}`);
|
|
32
56
|
}
|
|
33
57
|
|
|
34
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Remove a number from a group by deleting its membership.
|
|
60
|
+
*
|
|
61
|
+
* @param membershipId - Unique identifier of the membership.
|
|
62
|
+
* @returns The platform's delete response.
|
|
63
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
64
|
+
*/
|
|
35
65
|
async deleteMembership(membershipId: string): Promise<any> {
|
|
36
66
|
return this._http.delete(`/api/relay/rest/number_group_memberships/${membershipId}`);
|
|
37
67
|
}
|
|
@@ -27,17 +27,49 @@ export class PhoneNumbersResource extends CrudResource {
|
|
|
27
27
|
super(http, '/api/relay/rest/phone_numbers');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Purchase / create a phone number resource in this project.
|
|
32
|
+
* Body is optional to match Python's `**kwargs` call convention.
|
|
33
|
+
*
|
|
34
|
+
* @param body - Phone-number creation payload (platform-shaped JSON).
|
|
35
|
+
* Defaults to `{}` when omitted.
|
|
36
|
+
* @returns The newly-created phone-number resource.
|
|
37
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const num = await client.phoneNumbers.create({ number: '+15551234567' });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
31
44
|
override async create(body: any = {}): Promise<any> {
|
|
32
45
|
return this._http.post(this._basePath, body);
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Update a phone number resource by ID. Body is optional to match Python `**kwargs`.
|
|
50
|
+
*
|
|
51
|
+
* @param resourceId - Unique phone-number resource ID.
|
|
52
|
+
* @param body - Partial update payload. Defaults to `{}`.
|
|
53
|
+
* @returns The updated phone-number resource.
|
|
54
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
55
|
+
*/
|
|
36
56
|
override async update(resourceId: string, body: any = {}): Promise<any> {
|
|
37
57
|
return this._http.put(this._path(resourceId), body);
|
|
38
58
|
}
|
|
39
59
|
|
|
40
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Search available phone numbers for purchase.
|
|
62
|
+
*
|
|
63
|
+
* @param params - Search filters (e.g. `areaCode`, `contains`, `region`,
|
|
64
|
+
* `number_type`, pagination).
|
|
65
|
+
* @returns A paginated list of matching available numbers.
|
|
66
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const results = await client.phoneNumbers.search({ areaCode: '512', contains: '5555' });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
41
73
|
async search(params?: QueryParams): Promise<any> {
|
|
42
74
|
return this._http.get(this._path('search'), params);
|
|
43
75
|
}
|
|
@@ -13,21 +13,50 @@ export class ProjectTokens extends BaseResource {
|
|
|
13
13
|
super(http, '/api/project/tokens');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Create a new project-scoped API token.
|
|
18
|
+
*
|
|
19
|
+
* @param body - Token creation payload (friendly name, scopes, etc.).
|
|
20
|
+
* @returns The newly-created token record, including the secret value
|
|
21
|
+
* (which is typically returned ONCE and not retrievable again).
|
|
22
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
23
|
+
*/
|
|
16
24
|
async create(body: any): Promise<any> {
|
|
17
25
|
return this._http.post(this._basePath, body);
|
|
18
26
|
}
|
|
19
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Update a project API token's attributes (e.g. friendly name).
|
|
30
|
+
*
|
|
31
|
+
* @param tokenId - Unique identifier of the token.
|
|
32
|
+
* @param body - Partial update payload.
|
|
33
|
+
* @returns The updated token record.
|
|
34
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
35
|
+
*/
|
|
20
36
|
async update(tokenId: string, body: any): Promise<any> {
|
|
21
37
|
return this._http.patch(this._path(tokenId), body);
|
|
22
38
|
}
|
|
23
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Revoke and delete a project API token.
|
|
42
|
+
*
|
|
43
|
+
* @param tokenId - Unique identifier of the token to revoke.
|
|
44
|
+
* @returns The platform's delete response.
|
|
45
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
46
|
+
*/
|
|
24
47
|
async delete(tokenId: string): Promise<any> {
|
|
25
48
|
return this._http.delete(this._path(tokenId));
|
|
26
49
|
}
|
|
27
50
|
}
|
|
28
51
|
|
|
29
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Project API namespace.
|
|
54
|
+
*
|
|
55
|
+
* Access via `client.project.*`. Manages project-level resources like
|
|
56
|
+
* secondary API tokens.
|
|
57
|
+
*/
|
|
30
58
|
export class ProjectNamespace {
|
|
59
|
+
/** Project-scoped API token create / update / delete. */
|
|
31
60
|
readonly tokens: ProjectTokens;
|
|
32
61
|
|
|
33
62
|
constructor(http: HttpClient) {
|
|
@@ -7,13 +7,24 @@
|
|
|
7
7
|
import type { HttpClient } from '../HttpClient.js';
|
|
8
8
|
import { BaseResource } from '../base/BaseResource.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* PubSub token generation.
|
|
12
|
+
*
|
|
13
|
+
* Access via `client.pubsub.*`. Issues short-lived tokens that browser / mobile
|
|
14
|
+
* clients can use to subscribe to project channels.
|
|
15
|
+
*/
|
|
11
16
|
export class PubSubResource extends BaseResource {
|
|
12
17
|
constructor(http: HttpClient) {
|
|
13
18
|
super(http, '/api/pubsub/tokens');
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Generate a short-lived PubSub token.
|
|
23
|
+
*
|
|
24
|
+
* @param body - Token payload (e.g. `{ namespace, channels, expires_in }`).
|
|
25
|
+
* @returns The token record, typically `{ token: "eyJ..." }`.
|
|
26
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
27
|
+
*/
|
|
17
28
|
async createToken(body: any): Promise<any> {
|
|
18
29
|
return this._http.post(this._basePath, body);
|
|
19
30
|
}
|
|
@@ -8,7 +8,11 @@ import type { HttpClient } from '../HttpClient.js';
|
|
|
8
8
|
import type { QueryParams } from '../types.js';
|
|
9
9
|
import { CrudResource } from '../base/CrudResource.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Queue management with member operations.
|
|
13
|
+
*
|
|
14
|
+
* Access via `client.queues.*`. Extends standard CRUD with member list/fetch.
|
|
15
|
+
*/
|
|
12
16
|
export class QueuesResource extends CrudResource {
|
|
13
17
|
protected override _updateMethod: 'PATCH' | 'PUT' = 'PUT';
|
|
14
18
|
|
|
@@ -16,17 +20,38 @@ export class QueuesResource extends CrudResource {
|
|
|
16
20
|
super(http, '/api/relay/rest/queues');
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* List members in a queue.
|
|
25
|
+
*
|
|
26
|
+
* @param queueId - Unique identifier of the queue.
|
|
27
|
+
* @param params - Optional filter / pagination query parameters.
|
|
28
|
+
* @returns A paginated list of queue members.
|
|
29
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
30
|
+
*/
|
|
20
31
|
async listMembers(queueId: string, params?: QueryParams): Promise<any> {
|
|
21
32
|
return this._http.get(this._path(queueId, 'members'), params);
|
|
22
33
|
}
|
|
23
34
|
|
|
24
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Get the next member to be served in a queue (FIFO head).
|
|
37
|
+
*
|
|
38
|
+
* @param queueId - Unique identifier of the queue.
|
|
39
|
+
* @returns The next queue member record, or a platform-shaped empty
|
|
40
|
+
* response when the queue is empty.
|
|
41
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
42
|
+
*/
|
|
25
43
|
async getNextMember(queueId: string): Promise<any> {
|
|
26
44
|
return this._http.get(this._path(queueId, 'members', 'next'));
|
|
27
45
|
}
|
|
28
46
|
|
|
29
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Fetch a specific queue member by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param queueId - Unique identifier of the queue.
|
|
51
|
+
* @param memberId - Unique identifier of the queue member.
|
|
52
|
+
* @returns The queue member record.
|
|
53
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
54
|
+
*/
|
|
30
55
|
async getMember(queueId: string, memberId: string): Promise<any> {
|
|
31
56
|
return this._http.get(this._path(queueId, 'members', memberId));
|
|
32
57
|
}
|
|
@@ -8,20 +8,45 @@ import type { HttpClient } from '../HttpClient.js';
|
|
|
8
8
|
import type { QueryParams } from '../types.js';
|
|
9
9
|
import { BaseResource } from '../base/BaseResource.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Recording management (read-only + delete).
|
|
13
|
+
*
|
|
14
|
+
* Access via `client.recordings.*`.
|
|
15
|
+
*/
|
|
12
16
|
export class RecordingsResource extends BaseResource {
|
|
13
17
|
constructor(http: HttpClient) {
|
|
14
18
|
super(http, '/api/relay/rest/recordings');
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* List recordings in the project.
|
|
23
|
+
*
|
|
24
|
+
* @param params - Optional filter / pagination query parameters.
|
|
25
|
+
* @returns A paginated list of recordings.
|
|
26
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
27
|
+
*/
|
|
17
28
|
async list(params?: QueryParams): Promise<any> {
|
|
18
29
|
return this._http.get(this._basePath, params);
|
|
19
30
|
}
|
|
20
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Fetch a recording's metadata by ID.
|
|
34
|
+
*
|
|
35
|
+
* @param recordingId - Unique identifier of the recording.
|
|
36
|
+
* @returns The recording metadata record.
|
|
37
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
38
|
+
*/
|
|
21
39
|
async get(recordingId: string): Promise<any> {
|
|
22
40
|
return this._http.get(this._path(recordingId));
|
|
23
41
|
}
|
|
24
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Delete a recording.
|
|
45
|
+
*
|
|
46
|
+
* @param recordingId - Unique identifier of the recording.
|
|
47
|
+
* @returns The platform's delete response.
|
|
48
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
49
|
+
*/
|
|
25
50
|
async delete(recordingId: string): Promise<any> {
|
|
26
51
|
return this._http.delete(this._path(recordingId));
|
|
27
52
|
}
|
|
@@ -14,22 +14,59 @@ export class RegistryBrands extends BaseResource {
|
|
|
14
14
|
super(http, basePath);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* List all 10DLC brands in the project.
|
|
19
|
+
*
|
|
20
|
+
* @param params - Optional filter / pagination query parameters.
|
|
21
|
+
* @returns A paginated list of brands.
|
|
22
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
23
|
+
*/
|
|
17
24
|
async list(params?: QueryParams): Promise<any> {
|
|
18
25
|
return this._http.get(this._basePath, params);
|
|
19
26
|
}
|
|
20
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Register a new 10DLC brand.
|
|
30
|
+
*
|
|
31
|
+
* @param body - Brand registration payload (EIN, legal name, etc.).
|
|
32
|
+
* @returns The newly-registered brand record.
|
|
33
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
34
|
+
*/
|
|
21
35
|
async create(body: any): Promise<any> {
|
|
22
36
|
return this._http.post(this._basePath, body);
|
|
23
37
|
}
|
|
24
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Fetch a brand by ID.
|
|
41
|
+
*
|
|
42
|
+
* @param brandId - Unique identifier of the brand.
|
|
43
|
+
* @returns The brand record.
|
|
44
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
45
|
+
*/
|
|
25
46
|
async get(brandId: string): Promise<any> {
|
|
26
47
|
return this._http.get(this._path(brandId));
|
|
27
48
|
}
|
|
28
49
|
|
|
50
|
+
/**
|
|
51
|
+
* List campaigns registered under a brand.
|
|
52
|
+
*
|
|
53
|
+
* @param brandId - Unique identifier of the brand.
|
|
54
|
+
* @param params - Optional filter / pagination query parameters.
|
|
55
|
+
* @returns A paginated list of campaigns.
|
|
56
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
57
|
+
*/
|
|
29
58
|
async listCampaigns(brandId: string, params?: QueryParams): Promise<any> {
|
|
30
59
|
return this._http.get(this._path(brandId, 'campaigns'), params);
|
|
31
60
|
}
|
|
32
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Register a new campaign under a brand.
|
|
64
|
+
*
|
|
65
|
+
* @param brandId - Unique identifier of the brand.
|
|
66
|
+
* @param body - Campaign registration payload (use case, sample messages, etc.).
|
|
67
|
+
* @returns The newly-registered campaign record.
|
|
68
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
69
|
+
*/
|
|
33
70
|
async createCampaign(brandId: string, body: any): Promise<any> {
|
|
34
71
|
return this._http.post(this._path(brandId, 'campaigns'), body);
|
|
35
72
|
}
|
|
@@ -41,22 +78,61 @@ export class RegistryCampaigns extends BaseResource {
|
|
|
41
78
|
super(http, basePath);
|
|
42
79
|
}
|
|
43
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Fetch a campaign by ID.
|
|
83
|
+
*
|
|
84
|
+
* @param campaignId - Unique identifier of the campaign.
|
|
85
|
+
* @returns The campaign record.
|
|
86
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
87
|
+
*/
|
|
44
88
|
async get(campaignId: string): Promise<any> {
|
|
45
89
|
return this._http.get(this._path(campaignId));
|
|
46
90
|
}
|
|
47
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Update a campaign's attributes.
|
|
94
|
+
*
|
|
95
|
+
* @param campaignId - Unique identifier of the campaign.
|
|
96
|
+
* @param body - Full updated campaign attributes (replace semantics).
|
|
97
|
+
* @returns The updated campaign record.
|
|
98
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
99
|
+
*/
|
|
48
100
|
async update(campaignId: string, body: any): Promise<any> {
|
|
49
101
|
return this._http.put(this._path(campaignId), body);
|
|
50
102
|
}
|
|
51
103
|
|
|
104
|
+
/**
|
|
105
|
+
* List the phone numbers assigned to a campaign.
|
|
106
|
+
*
|
|
107
|
+
* @param campaignId - Unique identifier of the campaign.
|
|
108
|
+
* @param params - Optional filter / pagination query parameters.
|
|
109
|
+
* @returns A paginated list of assigned numbers.
|
|
110
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
111
|
+
*/
|
|
52
112
|
async listNumbers(campaignId: string, params?: QueryParams): Promise<any> {
|
|
53
113
|
return this._http.get(this._path(campaignId, 'numbers'), params);
|
|
54
114
|
}
|
|
55
115
|
|
|
116
|
+
/**
|
|
117
|
+
* List number-assignment orders for a campaign.
|
|
118
|
+
*
|
|
119
|
+
* @param campaignId - Unique identifier of the campaign.
|
|
120
|
+
* @param params - Optional filter / pagination query parameters.
|
|
121
|
+
* @returns A paginated list of number-assignment orders.
|
|
122
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
123
|
+
*/
|
|
56
124
|
async listOrders(campaignId: string, params?: QueryParams): Promise<any> {
|
|
57
125
|
return this._http.get(this._path(campaignId, 'orders'), params);
|
|
58
126
|
}
|
|
59
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Create a new number-assignment order against a campaign.
|
|
130
|
+
*
|
|
131
|
+
* @param campaignId - Unique identifier of the campaign.
|
|
132
|
+
* @param body - Order payload (phone number IDs, etc.).
|
|
133
|
+
* @returns The newly-created order record.
|
|
134
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
135
|
+
*/
|
|
60
136
|
async createOrder(campaignId: string, body: any): Promise<any> {
|
|
61
137
|
return this._http.post(this._path(campaignId, 'orders'), body);
|
|
62
138
|
}
|
|
@@ -68,6 +144,13 @@ export class RegistryOrders extends BaseResource {
|
|
|
68
144
|
super(http, basePath);
|
|
69
145
|
}
|
|
70
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Fetch a number-assignment order by ID.
|
|
149
|
+
*
|
|
150
|
+
* @param orderId - Unique identifier of the order.
|
|
151
|
+
* @returns The order record.
|
|
152
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
153
|
+
*/
|
|
71
154
|
async get(orderId: string): Promise<any> {
|
|
72
155
|
return this._http.get(this._path(orderId));
|
|
73
156
|
}
|
|
@@ -79,16 +162,32 @@ export class RegistryNumbers extends BaseResource {
|
|
|
79
162
|
super(http, basePath);
|
|
80
163
|
}
|
|
81
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Remove a number from a 10DLC campaign assignment.
|
|
167
|
+
*
|
|
168
|
+
* @param numberId - Unique identifier of the assigned number.
|
|
169
|
+
* @returns The platform's delete response.
|
|
170
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
171
|
+
*/
|
|
82
172
|
async delete(numberId: string): Promise<any> {
|
|
83
173
|
return this._http.delete(this._path(numberId));
|
|
84
174
|
}
|
|
85
175
|
}
|
|
86
176
|
|
|
87
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* 10DLC Campaign Registry namespace.
|
|
179
|
+
*
|
|
180
|
+
* Access via `client.registry.*`. Groups brand, campaign, order, and number
|
|
181
|
+
* resources for US A2P 10DLC compliance registration.
|
|
182
|
+
*/
|
|
88
183
|
export class RegistryNamespace {
|
|
184
|
+
/** 10DLC brand CRUD and nested campaign operations. */
|
|
89
185
|
readonly brands: RegistryBrands;
|
|
186
|
+
/** 10DLC campaign CRUD, number listing, and order management. */
|
|
90
187
|
readonly campaigns: RegistryCampaigns;
|
|
188
|
+
/** 10DLC number-assignment order read access. */
|
|
91
189
|
readonly orders: RegistryOrders;
|
|
190
|
+
/** 10DLC number assignment removal. */
|
|
92
191
|
readonly numbers: RegistryNumbers;
|
|
93
192
|
|
|
94
193
|
constructor(http: HttpClient) {
|
|
@@ -8,20 +8,46 @@ import type { HttpClient } from '../HttpClient.js';
|
|
|
8
8
|
import type { QueryParams } from '../types.js';
|
|
9
9
|
import { BaseResource } from '../base/BaseResource.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Short code management (read + update only).
|
|
13
|
+
*
|
|
14
|
+
* Access via `client.shortCodes.*`.
|
|
15
|
+
*/
|
|
12
16
|
export class ShortCodesResource extends BaseResource {
|
|
13
17
|
constructor(http: HttpClient) {
|
|
14
18
|
super(http, '/api/relay/rest/short_codes');
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* List short codes in the project.
|
|
23
|
+
*
|
|
24
|
+
* @param params - Optional filter / pagination query parameters.
|
|
25
|
+
* @returns A paginated list of short codes.
|
|
26
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
27
|
+
*/
|
|
17
28
|
async list(params?: QueryParams): Promise<any> {
|
|
18
29
|
return this._http.get(this._basePath, params);
|
|
19
30
|
}
|
|
20
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Fetch a short code by ID.
|
|
34
|
+
*
|
|
35
|
+
* @param shortCodeId - Unique identifier of the short code.
|
|
36
|
+
* @returns The short-code record.
|
|
37
|
+
* @throws {RestError} On any non-2xx HTTP response (including `404`).
|
|
38
|
+
*/
|
|
21
39
|
async get(shortCodeId: string): Promise<any> {
|
|
22
40
|
return this._http.get(this._path(shortCodeId));
|
|
23
41
|
}
|
|
24
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Update a short code's configuration (webhooks, friendly name, etc.).
|
|
45
|
+
*
|
|
46
|
+
* @param shortCodeId - Unique identifier of the short code.
|
|
47
|
+
* @param body - Full updated short-code attributes (replace semantics).
|
|
48
|
+
* @returns The updated short-code record.
|
|
49
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
50
|
+
*/
|
|
25
51
|
async update(shortCodeId: string, body: any): Promise<any> {
|
|
26
52
|
return this._http.put(this._path(shortCodeId), body);
|
|
27
53
|
}
|
|
@@ -7,18 +7,33 @@
|
|
|
7
7
|
import type { HttpClient } from '../HttpClient.js';
|
|
8
8
|
import { BaseResource } from '../base/BaseResource.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Project SIP profile (singleton resource).
|
|
12
|
+
*
|
|
13
|
+
* Access via `client.sipProfile.*`.
|
|
14
|
+
*/
|
|
11
15
|
export class SipProfileResource extends BaseResource {
|
|
12
16
|
constructor(http: HttpClient) {
|
|
13
17
|
super(http, '/api/relay/rest/sip_profile');
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the project's SIP profile.
|
|
22
|
+
*
|
|
23
|
+
* @returns The SIP profile record for this project.
|
|
24
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
25
|
+
*/
|
|
17
26
|
async get(): Promise<any> {
|
|
18
27
|
return this._http.get(this._basePath);
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Update the project's SIP profile.
|
|
32
|
+
*
|
|
33
|
+
* @param body - Full SIP profile attributes (replace semantics — not patch).
|
|
34
|
+
* @returns The updated SIP profile.
|
|
35
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
36
|
+
*/
|
|
22
37
|
async update(body: any): Promise<any> {
|
|
23
38
|
return this._http.put(this._basePath, body);
|
|
24
39
|
}
|
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
import type { HttpClient } from '../HttpClient.js';
|
|
8
8
|
import { CrudResource } from '../base/CrudResource.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Verified caller ID management with verification flow.
|
|
12
|
+
*
|
|
13
|
+
* Access via `client.verifiedCallers.*`. Extends standard CRUD with
|
|
14
|
+
* `redialVerification()` and `submitVerification()` for the two-step
|
|
15
|
+
* phone-number verification handshake.
|
|
16
|
+
*/
|
|
11
17
|
export class VerifiedCallersResource extends CrudResource {
|
|
12
18
|
protected override _updateMethod: 'PATCH' | 'PUT' = 'PUT';
|
|
13
19
|
|
|
@@ -15,12 +21,25 @@ export class VerifiedCallersResource extends CrudResource {
|
|
|
15
21
|
super(http, '/api/relay/rest/verified_caller_ids');
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Redial the verification call, starting the handshake over from scratch.
|
|
26
|
+
*
|
|
27
|
+
* @param callerId - Unique identifier of the verified caller ID resource.
|
|
28
|
+
* @returns The platform-shaped verification response.
|
|
29
|
+
* @throws {RestError} On any non-2xx HTTP response.
|
|
30
|
+
*/
|
|
19
31
|
async redialVerification(callerId: string): Promise<any> {
|
|
20
32
|
return this._http.post(this._path(callerId, 'verification'));
|
|
21
33
|
}
|
|
22
34
|
|
|
23
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Submit the verification code the caller received on the verification call.
|
|
37
|
+
*
|
|
38
|
+
* @param callerId - Unique identifier of the verified caller ID resource.
|
|
39
|
+
* @param body - Verification payload (typically `{ verification_code: "1234" }`).
|
|
40
|
+
* @returns The completed verification record.
|
|
41
|
+
* @throws {RestError} On any non-2xx HTTP response (including a rejected code).
|
|
42
|
+
*/
|
|
24
43
|
async submitVerification(callerId: string, body: any): Promise<any> {
|
|
25
44
|
return this._http.put(this._path(callerId, 'verification'), body);
|
|
26
45
|
}
|