@amigo-ai/platform-sdk 0.1.0 → 0.3.0
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/README.md +126 -8
- package/dist/core/branded-types.js +1 -0
- package/dist/core/branded-types.js.map +1 -1
- package/dist/core/errors.js +43 -3
- package/dist/core/errors.js.map +1 -1
- package/dist/core/openapi-client.js +60 -48
- package/dist/core/openapi-client.js.map +1 -1
- package/dist/core/rate-limit.js +13 -0
- package/dist/core/rate-limit.js.map +1 -0
- package/dist/core/webhooks.js +17 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/generated/api.js +2 -0
- package/dist/{types → generated}/api.js.map +1 -1
- package/dist/index.cjs +1668 -371
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +59 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1658 -371
- package/dist/index.mjs.map +4 -4
- package/dist/resources/actions.js +52 -0
- package/dist/resources/actions.js.map +1 -0
- package/dist/resources/agents.js +30 -30
- package/dist/resources/agents.js.map +1 -1
- package/dist/resources/analytics.js +34 -15
- package/dist/resources/analytics.js.map +1 -1
- package/dist/resources/api-keys.js +17 -19
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/audit.js +35 -0
- package/dist/resources/audit.js.map +1 -0
- package/dist/resources/base.js +12 -44
- package/dist/resources/base.js.map +1 -1
- package/dist/resources/billing.js +35 -7
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/calls.js +25 -9
- package/dist/resources/calls.js.map +1 -1
- package/dist/resources/compliance.js +19 -0
- package/dist/resources/compliance.js.map +1 -0
- package/dist/resources/context-graphs.js +46 -18
- package/dist/resources/context-graphs.js.map +1 -1
- package/dist/resources/data-sources.js +30 -12
- package/dist/resources/data-sources.js.map +1 -1
- package/dist/resources/functions.js +42 -0
- package/dist/resources/functions.js.map +1 -0
- package/dist/resources/integrations.js +32 -15
- package/dist/resources/integrations.js.map +1 -1
- package/dist/resources/memory.js +13 -4
- package/dist/resources/memory.js.map +1 -1
- package/dist/resources/operators.js +102 -0
- package/dist/resources/operators.js.map +1 -0
- package/dist/resources/personas.js +31 -0
- package/dist/resources/personas.js.map +1 -0
- package/dist/resources/phone-numbers.js +31 -16
- package/dist/resources/phone-numbers.js.map +1 -1
- package/dist/resources/recordings.js +19 -0
- package/dist/resources/recordings.js.map +1 -0
- package/dist/resources/review-queue.js +94 -0
- package/dist/resources/review-queue.js.map +1 -0
- package/dist/resources/safety.js +31 -0
- package/dist/resources/safety.js.map +1 -0
- package/dist/resources/services.js +18 -12
- package/dist/resources/services.js.map +1 -1
- package/dist/resources/settings.js +50 -24
- package/dist/resources/settings.js.map +1 -1
- package/dist/resources/simulations.js +23 -17
- package/dist/resources/simulations.js.map +1 -1
- package/dist/resources/skills.js +22 -16
- package/dist/resources/skills.js.map +1 -1
- package/dist/resources/triggers.js +51 -0
- package/dist/resources/triggers.js.map +1 -0
- package/dist/resources/webhook-destinations.js +44 -0
- package/dist/resources/webhook-destinations.js.map +1 -0
- package/dist/resources/workspaces.js +24 -38
- package/dist/resources/workspaces.js.map +1 -1
- package/dist/resources/world.js +58 -60
- package/dist/resources/world.js.map +1 -1
- package/dist/types/core/branded-types.d.ts +3 -0
- package/dist/types/core/branded-types.d.ts.map +1 -1
- package/dist/types/core/errors.d.ts +3 -0
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/openapi-client.d.ts +13 -5
- package/dist/types/core/openapi-client.d.ts.map +1 -1
- package/dist/types/core/rate-limit.d.ts +8 -0
- package/dist/types/core/rate-limit.d.ts.map +1 -0
- package/dist/types/core/webhooks.d.ts +9 -0
- package/dist/types/core/webhooks.d.ts.map +1 -0
- package/dist/types/generated/api.d.ts +35120 -0
- package/dist/types/generated/api.d.ts.map +1 -0
- package/dist/types/index.d.ts +45 -43
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/actions.d.ts +158 -0
- package/dist/types/resources/actions.d.ts.map +1 -0
- package/dist/types/resources/agents.d.ts +70 -22
- package/dist/types/resources/agents.d.ts.map +1 -1
- package/dist/types/resources/analytics.d.ts +100 -118
- package/dist/types/resources/analytics.d.ts.map +1 -1
- package/dist/types/resources/api-keys.d.ts +36 -7
- package/dist/types/resources/api-keys.d.ts.map +1 -1
- package/dist/types/resources/audit.d.ts +70 -0
- package/dist/types/resources/audit.d.ts.map +1 -0
- package/dist/types/resources/base.d.ts +13 -13
- package/dist/types/resources/base.d.ts.map +1 -1
- package/dist/types/resources/billing.d.ts +52 -12
- package/dist/types/resources/billing.d.ts.map +1 -1
- package/dist/types/resources/calls.d.ts +89 -35
- package/dist/types/resources/calls.d.ts.map +1 -1
- package/dist/types/resources/compliance.d.ts +45 -0
- package/dist/types/resources/compliance.d.ts.map +1 -0
- package/dist/types/resources/context-graphs.d.ts +77 -14
- package/dist/types/resources/context-graphs.d.ts.map +1 -1
- package/dist/types/resources/data-sources.d.ts +105 -9
- package/dist/types/resources/data-sources.d.ts.map +1 -1
- package/dist/types/resources/functions.d.ts +46 -0
- package/dist/types/resources/functions.d.ts.map +1 -0
- package/dist/types/resources/integrations.d.ts +83 -12
- package/dist/types/resources/integrations.d.ts.map +1 -1
- package/dist/types/resources/memory.d.ts +26 -73
- package/dist/types/resources/memory.d.ts.map +1 -1
- package/dist/types/resources/operators.d.ts +157 -0
- package/dist/types/resources/operators.d.ts.map +1 -0
- package/dist/types/resources/personas.d.ts +60 -0
- package/dist/types/resources/personas.d.ts.map +1 -0
- package/dist/types/resources/phone-numbers.d.ts +70 -10
- package/dist/types/resources/phone-numbers.d.ts.map +1 -1
- package/dist/types/resources/recordings.d.ts +29 -0
- package/dist/types/resources/recordings.d.ts.map +1 -0
- package/dist/types/resources/review-queue.d.ts +184 -0
- package/dist/types/resources/review-queue.d.ts.map +1 -0
- package/dist/types/resources/safety.d.ts +57 -0
- package/dist/types/resources/safety.d.ts.map +1 -0
- package/dist/types/resources/services.d.ts +85 -5
- package/dist/types/resources/services.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts +79 -78
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/simulations.d.ts +41 -12
- package/dist/types/resources/simulations.d.ts.map +1 -1
- package/dist/types/resources/skills.d.ts +131 -6
- package/dist/types/resources/skills.d.ts.map +1 -1
- package/dist/types/resources/triggers.d.ts +129 -0
- package/dist/types/resources/triggers.d.ts.map +1 -0
- package/dist/types/resources/webhook-destinations.d.ts +75 -0
- package/dist/types/resources/webhook-destinations.d.ts.map +1 -0
- package/dist/types/resources/workspaces.d.ts +60 -15
- package/dist/types/resources/workspaces.d.ts.map +1 -1
- package/dist/types/resources/world.d.ts +152 -143
- package/dist/types/resources/world.d.ts.map +1 -1
- package/package.json +13 -5
- package/dist/types/api.js +0 -12
- package/dist/types/types/api.d.ts +0 -739
- package/dist/types/types/api.d.ts.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manage actions — reusable AI capabilities that agents can call.
|
|
4
|
+
* Actions define a structured input/output schema and an execution tier.
|
|
5
|
+
*
|
|
6
|
+
* Note: The underlying API paths use `/skills/` for backward compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export class ActionsResource extends WorkspaceScopedResource {
|
|
9
|
+
/** Create a new action */
|
|
10
|
+
async create(body) {
|
|
11
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/skills', {
|
|
12
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
13
|
+
body,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
/** List actions in the workspace */
|
|
17
|
+
async list(params) {
|
|
18
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/skills', {
|
|
19
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
/** Get a single action */
|
|
23
|
+
async get(actionId) {
|
|
24
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/skills/{skill_id}', {
|
|
25
|
+
params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
/** Update an action */
|
|
29
|
+
async update(actionId, body) {
|
|
30
|
+
return extractData(await this.client.PUT('/v1/{workspace_id}/skills/{skill_id}', {
|
|
31
|
+
params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
|
|
32
|
+
body,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/** Delete an action */
|
|
36
|
+
async delete(actionId) {
|
|
37
|
+
await this.client.DELETE('/v1/{workspace_id}/skills/{skill_id}', {
|
|
38
|
+
params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Test an action with a sample input.
|
|
43
|
+
* Executes the action in a sandbox and returns the result.
|
|
44
|
+
*/
|
|
45
|
+
async test(actionId, body) {
|
|
46
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/skills/{skill_id}/test', {
|
|
47
|
+
params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
|
|
48
|
+
body,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/resources/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAShE;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,uBAAuB;IAC1D,0BAA0B;IAC1B,KAAK,CAAC,MAAM,CAAC,IAAiD;QAC5D,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAClD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;YACpD,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MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2CAA2C,EAAE;YAClE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YACxE,IAAI;SACL,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
package/dist/resources/agents.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { WorkspaceScopedResource,
|
|
2
|
-
/**
|
|
3
|
-
* Manage agents — the AI personas that handle calls and interactions.
|
|
4
|
-
* Each agent can be assigned skills, a persona, and a model.
|
|
5
|
-
*/
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
6
2
|
export class AgentsResource extends WorkspaceScopedResource {
|
|
7
|
-
/** Create a new agent */
|
|
8
3
|
async create(body) {
|
|
9
|
-
return this.
|
|
10
|
-
|
|
11
|
-
body
|
|
12
|
-
});
|
|
4
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/agents', {
|
|
5
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
6
|
+
body,
|
|
7
|
+
}));
|
|
13
8
|
}
|
|
14
|
-
/** List agents in the workspace */
|
|
15
9
|
async list(params) {
|
|
16
|
-
return this.
|
|
10
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/agents', {
|
|
11
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
12
|
+
}));
|
|
17
13
|
}
|
|
18
|
-
/** Get a single agent */
|
|
19
14
|
async get(agentId) {
|
|
20
|
-
return this.
|
|
15
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/agents/{agent_id}', {
|
|
16
|
+
params: { path: { workspace_id: this.workspaceId, agent_id: agentId } },
|
|
17
|
+
}));
|
|
21
18
|
}
|
|
22
|
-
/** Update an agent's configuration */
|
|
23
19
|
async update(agentId, body) {
|
|
24
|
-
return this.
|
|
25
|
-
|
|
26
|
-
body
|
|
27
|
-
});
|
|
20
|
+
return extractData(await this.client.PUT('/v1/{workspace_id}/agents/{agent_id}', {
|
|
21
|
+
params: { path: { workspace_id: this.workspaceId, agent_id: agentId } },
|
|
22
|
+
body,
|
|
23
|
+
}));
|
|
28
24
|
}
|
|
29
|
-
/** Delete an agent */
|
|
30
25
|
async delete(agentId) {
|
|
31
|
-
|
|
26
|
+
await this.client.DELETE('/v1/{workspace_id}/agents/{agent_id}', {
|
|
27
|
+
params: { path: { workspace_id: this.workspaceId, agent_id: agentId } },
|
|
28
|
+
});
|
|
32
29
|
}
|
|
33
|
-
/** List all versions of an agent */
|
|
34
30
|
async listVersions(agentId, params) {
|
|
35
|
-
return this.
|
|
31
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/agents/{agent_id}/versions', {
|
|
32
|
+
params: { path: { workspace_id: this.workspaceId, agent_id: agentId }, query: params },
|
|
33
|
+
}));
|
|
36
34
|
}
|
|
37
|
-
/** Get a specific version of an agent — pass `"latest"` to get the most recent */
|
|
38
35
|
async getVersion(agentId, version) {
|
|
39
|
-
return this.
|
|
36
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/agents/{agent_id}/versions/{version}', {
|
|
37
|
+
params: {
|
|
38
|
+
path: { workspace_id: this.workspaceId, agent_id: agentId, version: String(version) },
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
40
41
|
}
|
|
41
|
-
/** Create a new version of an agent */
|
|
42
42
|
async createVersion(agentId, body) {
|
|
43
|
-
return this.
|
|
44
|
-
|
|
45
|
-
body
|
|
46
|
-
});
|
|
43
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/agents/{agent_id}/versions', {
|
|
44
|
+
params: { path: { workspace_id: this.workspaceId, agent_id: agentId } },
|
|
45
|
+
body,
|
|
46
|
+
}));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=agents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/agents.ts"],"names":[],"mapp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------------------
|
|
3
|
-
// Resource
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
5
2
|
/**
|
|
6
3
|
* Analytics — aggregate metrics about calls, agents, quality, and usage.
|
|
7
4
|
*/
|
|
8
5
|
export class AnalyticsResource extends WorkspaceScopedResource {
|
|
9
6
|
/** High-level dashboard summary — pass `days` (default: 7) for the lookback window */
|
|
10
7
|
async getDashboard(params) {
|
|
11
|
-
return this.
|
|
8
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/dashboard', {
|
|
9
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
10
|
+
}));
|
|
12
11
|
}
|
|
13
12
|
/** Call volume and duration metrics */
|
|
14
13
|
async getCalls(params) {
|
|
15
|
-
return this.
|
|
14
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/calls', {
|
|
15
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
16
|
+
}));
|
|
16
17
|
}
|
|
17
18
|
/** Per-agent performance breakdown */
|
|
18
19
|
async getAgents(params) {
|
|
19
|
-
return this.
|
|
20
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/agents', {
|
|
21
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
22
|
+
}));
|
|
20
23
|
}
|
|
21
24
|
/** Call quality — sentiment, transcription confidence, flagged calls */
|
|
22
25
|
async getCallQuality(params) {
|
|
23
|
-
return this.
|
|
26
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/call-quality', {
|
|
27
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
28
|
+
}));
|
|
24
29
|
}
|
|
25
30
|
/** Emotion trend data over time */
|
|
26
31
|
async getEmotionTrends(params) {
|
|
27
|
-
return this.
|
|
32
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/emotion-trends', {
|
|
33
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
34
|
+
}));
|
|
28
35
|
}
|
|
29
36
|
/** Voice pipeline latency metrics (TTFB, response time) */
|
|
30
37
|
async getLatency(params) {
|
|
31
|
-
return this.
|
|
38
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/latency', {
|
|
39
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
40
|
+
}));
|
|
32
41
|
}
|
|
33
42
|
/** Tool call performance — success rates and latency per tool */
|
|
34
43
|
async getToolPerformance(params) {
|
|
35
|
-
return this.
|
|
44
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/tool-performance', {
|
|
45
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
46
|
+
}));
|
|
36
47
|
}
|
|
37
48
|
/** Data quality metrics for the workspace world model */
|
|
38
49
|
async getDataQuality(params) {
|
|
39
|
-
return this.
|
|
50
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/data-quality', {
|
|
51
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
52
|
+
}));
|
|
40
53
|
}
|
|
41
54
|
/** Usage summary — API requests, call minutes, storage */
|
|
42
55
|
async getUsage(params) {
|
|
43
|
-
return this.
|
|
56
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/usage', {
|
|
57
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
58
|
+
}));
|
|
44
59
|
}
|
|
45
60
|
/** Advanced call statistics (abandonment, transfers, silence, hour-of-day) */
|
|
46
61
|
async getAdvancedCallStats(params) {
|
|
47
|
-
return this.
|
|
62
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/calls/advanced', {
|
|
63
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
64
|
+
}));
|
|
48
65
|
}
|
|
49
66
|
/** Compare two time periods side by side */
|
|
50
67
|
async compareCallPeriods(params) {
|
|
51
|
-
return this.
|
|
68
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/analytics/calls/comparison', {
|
|
69
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
70
|
+
}));
|
|
52
71
|
}
|
|
53
72
|
}
|
|
54
73
|
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/resources/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/resources/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhE;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,uBAAuB;IAC5D,sFAAsF;IACtF,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,wCAAwC,EAAE;YAC9D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,QAAQ,CAAC,MAMd;QACC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,EAAE;YAC1D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,sCAAsC;IACtC,KAAK,CAAC,SAAS,CAAC,MAA4B;QAC1C,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAA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CAAC,2CAA2C,EAAE;YACjE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,0DAA0D;IAC1D,KAAK,CAAC,QAAQ,CAAC,MAOd;QACC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,EAAE;YAC1D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,8EAA8E;IAC9E,KAAK,CAAC,oBAAoB,CAAC,MAM1B;QACC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6CAA6C,EAAE;YACnE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,4CAA4C;IAC5C,KAAK,CAAC,kBAAkB,CAAC,MAMxB;QACC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,+CAA+C,EAAE;YACrE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { WorkspaceScopedResource,
|
|
2
|
-
import { createApiError } from '../core/errors.js';
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
3
2
|
/**
|
|
4
3
|
* Manage API keys for a workspace.
|
|
5
4
|
*
|
|
@@ -12,34 +11,33 @@ export class ApiKeysResource extends WorkspaceScopedResource {
|
|
|
12
11
|
* Does not require a workspace ID in the path.
|
|
13
12
|
*/
|
|
14
13
|
async me() {
|
|
15
|
-
|
|
16
|
-
const response = await globalThis.fetch(url, { headers: this.headers });
|
|
17
|
-
if (!response.ok)
|
|
18
|
-
throw await createApiError(response);
|
|
19
|
-
return response.json();
|
|
14
|
+
return extractData(await this.client.GET('/v1/auth/me', {}));
|
|
20
15
|
}
|
|
21
16
|
/** Create a new API key */
|
|
22
17
|
async create(body) {
|
|
23
|
-
return this.
|
|
24
|
-
|
|
25
|
-
body
|
|
26
|
-
});
|
|
18
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/api-keys', {
|
|
19
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
20
|
+
body,
|
|
21
|
+
}));
|
|
27
22
|
}
|
|
28
23
|
/** List API keys in the workspace */
|
|
29
24
|
async list(params) {
|
|
30
|
-
return this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
async get(keyId) {
|
|
34
|
-
return this.fetch(`/api-keys/${keyId}`);
|
|
25
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/api-keys', {
|
|
26
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
27
|
+
}));
|
|
35
28
|
}
|
|
36
29
|
/** Revoke an API key */
|
|
37
30
|
async revoke(keyId) {
|
|
38
|
-
|
|
31
|
+
await this.client.DELETE('/v1/{workspace_id}/api-keys/{key_id}', {
|
|
32
|
+
params: { path: { workspace_id: this.workspaceId, key_id: keyId } },
|
|
33
|
+
});
|
|
39
34
|
}
|
|
40
35
|
/** Rotate an API key — invalidates the old key and issues a new one */
|
|
41
|
-
async rotate(keyId) {
|
|
42
|
-
return this.
|
|
36
|
+
async rotate(keyId, body) {
|
|
37
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/api-keys/{key_id}/rotate', {
|
|
38
|
+
params: { path: { workspace_id: this.workspaceId, key_id: keyId } },
|
|
39
|
+
body,
|
|
40
|
+
}));
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
//# sourceMappingURL=api-keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGhE;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,uBAAuB;IAC1D;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,OAAO,WAAW,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,2BAA2B;IAC3B,KAAK,CAAC,MAAM,CAAC,IAAkD;QAC7D,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACpD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;YACpD,IAAI;SACL,CAAC,CACH,CAAA;IACH,CAAC;IAED,qCAAqC;IACrC,KAAK,CAAC,IAAI,CAAC,MAA6C;QACtD,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,EAAE;YACnD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,wBAAwB;IACxB,KAAK,CAAC,MAAM,CAAC,KAAwB;QACnC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sCAAsC,EAAE;YAC/D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;SACpE,CAAC,CAAA;IACJ,CAAC;IAED,uEAAuE;IACvE,KAAK,CAAC,MAAM,CAAC,KAAwB,EAAE,IAAkD;QACvF,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6CAA6C,EAAE;YACpE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YACnE,IAAI;SACL,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
2
|
+
export class AuditResource extends WorkspaceScopedResource {
|
|
3
|
+
async list(params) {
|
|
4
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/audit', {
|
|
5
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
async getSummary(params) {
|
|
9
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/audit/summary', {
|
|
10
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
async getPhiAccess(params) {
|
|
14
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/audit/phi-access', {
|
|
15
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
async createExport(body) {
|
|
19
|
+
return extractData(await this.client.POST('/v1/{workspace_id}/audit/export', {
|
|
20
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
21
|
+
body,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
async listExports() {
|
|
25
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/audit/exports', {
|
|
26
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
async getEntityAccessLog(entityId, params) {
|
|
30
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/audit/entity/{entity_id}/access-log', {
|
|
31
|
+
params: { path: { workspace_id: this.workspaceId, entity_id: entityId }, query: params },
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/resources/audit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AA8BhE,MAAM,OAAO,aAAc,SAAQ,uBAAuB;IACxD,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,EAAE;YAChD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA+D;QAC9E,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,EAAE;YACxD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAwB;QACzC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAiD;QAClE,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE;YACxD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;YACpD,IAAI;SACL,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,EAAE;YACxD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;SACrD,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,MAA8B;QACvE,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,wDAAwD,EAAE;YAC9E,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACzF,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
package/dist/resources/base.js
CHANGED
|
@@ -1,50 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Base class for
|
|
3
|
-
*
|
|
2
|
+
* Base class for workspace-scoped resources.
|
|
3
|
+
*
|
|
4
|
+
* Uses the openapi-fetch client (with auth + error + retry middleware)
|
|
5
|
+
* injected from AmigoClient. Resources call typed HTTP methods that
|
|
6
|
+
* flow through the middleware chain automatically.
|
|
4
7
|
*/
|
|
5
|
-
import {
|
|
8
|
+
import { extractData } from '../core/utils.js';
|
|
6
9
|
export class WorkspaceScopedResource {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
client;
|
|
11
|
+
workspaceId;
|
|
12
|
+
constructor(client, workspaceId) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
this.workspaceId = workspaceId;
|
|
10
15
|
}
|
|
11
|
-
get headers() {
|
|
12
|
-
return {
|
|
13
|
-
Authorization: `Bearer ${this.config.apiKey}`,
|
|
14
|
-
'Content-Type': 'application/json',
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
workspaceUrl(path) {
|
|
18
|
-
return `${this.config.baseUrl}/v1/${this.config.workspaceId}${path}`;
|
|
19
|
-
}
|
|
20
|
-
async fetch(path, init = {}) {
|
|
21
|
-
const url = this.workspaceUrl(path);
|
|
22
|
-
const response = await globalThis.fetch(url, {
|
|
23
|
-
...init,
|
|
24
|
-
headers: {
|
|
25
|
-
...this.headers,
|
|
26
|
-
...init.headers,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
throw await createApiError(response);
|
|
31
|
-
}
|
|
32
|
-
if (response.status === 204)
|
|
33
|
-
return undefined;
|
|
34
|
-
return response.json();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
export function buildQuery(params) {
|
|
39
|
-
if (!params)
|
|
40
|
-
return '';
|
|
41
|
-
const entries = Object.entries(params).filter(([, v]) => v !== undefined && v !== null);
|
|
42
|
-
if (entries.length === 0)
|
|
43
|
-
return '';
|
|
44
|
-
const searchParams = new URLSearchParams();
|
|
45
|
-
for (const [k, v] of entries) {
|
|
46
|
-
searchParams.set(k, String(v));
|
|
47
|
-
}
|
|
48
|
-
return '?' + searchParams.toString();
|
|
49
16
|
}
|
|
17
|
+
export { extractData };
|
|
50
18
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,OAAgB,uBAAuB;IAEtB;IACA;IAFrB,YACqB,MAAqB,EACrB,WAAmB;QADnB,WAAM,GAAN,MAAM,CAAe;QACrB,gBAAW,GAAX,WAAW,CAAQ;IACrC,CAAC;CACL;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import { WorkspaceScopedResource,
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
2
2
|
/**
|
|
3
|
-
* Billing — usage summaries and
|
|
3
|
+
* Billing — dashboard, usage summaries, invoices, and usage trends.
|
|
4
4
|
*/
|
|
5
5
|
export class BillingResource extends WorkspaceScopedResource {
|
|
6
|
-
/** Get
|
|
7
|
-
async
|
|
8
|
-
return this.
|
|
6
|
+
/** Get composite billing dashboard — KPIs, period comparison, top meters, invoice summary */
|
|
7
|
+
async getDashboard() {
|
|
8
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/dashboard', {
|
|
9
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
10
|
+
}));
|
|
9
11
|
}
|
|
10
|
-
/**
|
|
12
|
+
/** Get usage summary for the workspace */
|
|
13
|
+
async getUsage() {
|
|
14
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/usage', {
|
|
15
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/** Get usage time-series per meter for trend charts */
|
|
19
|
+
async getUsageTrends(params) {
|
|
20
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/usage/trends', {
|
|
21
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
/** List invoices for the workspace */
|
|
11
25
|
async listInvoices(params) {
|
|
12
|
-
return this.
|
|
26
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/invoices', {
|
|
27
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
/** Get invoice detail */
|
|
31
|
+
async getInvoice(invoiceId) {
|
|
32
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/invoices/{invoice_id}', {
|
|
33
|
+
params: { path: { workspace_id: this.workspaceId, invoice_id: invoiceId } },
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
/** Get presigned S3 URL for invoice PDF download */
|
|
37
|
+
async getInvoicePdf(invoiceId) {
|
|
38
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/billing/invoices/{invoice_id}/pdf', {
|
|
39
|
+
params: { path: { workspace_id: this.workspaceId, invoice_id: invoiceId } },
|
|
40
|
+
}));
|
|
13
41
|
}
|
|
14
42
|
}
|
|
15
43
|
//# sourceMappingURL=billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAgBhE;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,uBAAuB;IAC1D,6FAA6F;IAC7F,KAAK,CAAC,YAAY;QAChB,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sCAAsC,EAAE;YAC5D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;SACrD,CAAC,CACH,CAAA;IACH,CAAC;IAED,0CAA0C;IAC1C,KAAK,CAAC,QAAQ;QACZ,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,EAAE;YACxD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CA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aceScopedResource,
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
2
2
|
/**
|
|
3
3
|
* Access call records and intelligence.
|
|
4
4
|
* Calls are read-only in the SDK — they are created by the voice pipeline.
|
|
@@ -6,23 +6,39 @@ import { WorkspaceScopedResource, buildQuery } from './base.js';
|
|
|
6
6
|
export class CallsResource extends WorkspaceScopedResource {
|
|
7
7
|
/** List calls with optional filtering */
|
|
8
8
|
async list(params) {
|
|
9
|
-
return this.
|
|
9
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls', {
|
|
10
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
11
|
+
}));
|
|
10
12
|
}
|
|
11
|
-
/** Get full call detail including
|
|
12
|
-
async get(
|
|
13
|
-
return this.
|
|
13
|
+
/** Get full call detail including turns, escalation, safety, and recording info */
|
|
14
|
+
async get(callId) {
|
|
15
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}', {
|
|
16
|
+
params: { path: { workspace_id: this.workspaceId, call_id: callId } },
|
|
17
|
+
}));
|
|
14
18
|
}
|
|
15
19
|
/** Get AI intelligence for a call */
|
|
16
|
-
async getIntelligence(
|
|
17
|
-
return this.
|
|
20
|
+
async getIntelligence(callId) {
|
|
21
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/intelligence', {
|
|
22
|
+
params: { path: { workspace_id: this.workspaceId, call_id: callId } },
|
|
23
|
+
}));
|
|
18
24
|
}
|
|
19
25
|
/** Get active intelligence across all in-progress calls */
|
|
20
26
|
async getActiveIntelligence() {
|
|
21
|
-
return this.
|
|
27
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls/active/intelligence', {
|
|
28
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
29
|
+
}));
|
|
22
30
|
}
|
|
23
31
|
/** Get performance benchmarks for a time period */
|
|
24
32
|
async getBenchmarks(params) {
|
|
25
|
-
return this.
|
|
33
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls/benchmarks', {
|
|
34
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
/** Get deep call trace analysis */
|
|
38
|
+
async getTraceAnalysis(callId) {
|
|
39
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/trace-analysis', {
|
|
40
|
+
params: { path: { workspace_id: this.workspaceId, call_id: callId } },
|
|
41
|
+
}));
|
|
26
42
|
}
|
|
27
43
|
}
|
|
28
44
|
//# sourceMappingURL=calls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../../src/resources/calls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../../src/resources/calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAehE;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,uBAAuB;IACxD,yCAAyC;IACzC,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,EAAE;YAChD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,mFAAmF;IACnF,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,EAAE;YAC1D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;SACtE,CAAC,CACH,CAAA;IACH,CAAC;IAED,qCAAqC;IACrC,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iDAAiD,EAAE;YACvE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;SACtE,CAAC,CACH,CAAA;IACH,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,qBAAqB;QACzB,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8CAA8C,EAAE;YACpE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;SACrD,CAAC,CACH,CAAA;IACH,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,aAAa,CAAC,MAA0B;QAC5C,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mDAAmD,EAAE;YACzE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;SACtE,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { WorkspaceScopedResource, extractData } from './base.js';
|
|
2
|
+
export class ComplianceResource extends WorkspaceScopedResource {
|
|
3
|
+
async getDashboard() {
|
|
4
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/compliance/dashboard', {
|
|
5
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
async getHipaa(params) {
|
|
9
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/compliance/hipaa', {
|
|
10
|
+
params: { path: { workspace_id: this.workspaceId }, query: params },
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
async getAccessReview() {
|
|
14
|
+
return extractData(await this.client.GET('/v1/{workspace_id}/compliance/access-review', {
|
|
15
|
+
params: { path: { workspace_id: this.workspaceId } },
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=compliance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance.js","sourceRoot":"","sources":["../../src/resources/compliance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,OAAO,kBAAmB,SAAQ,uBAAuB;IAC7D,KAAK,CAAC,YAAY;QAChB,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,yCAAyC,EAAE;YAC/D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;SACrD,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAwC;QACrD,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6CAA6C,EAAE;YACnE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE;SACrD,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|