@rymi/node 2.2.0 → 2.4.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 +4 -0
- package/dist/index.d.mts +77 -1
- package/dist/index.d.ts +77 -1
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,9 @@ yarn add @rymi/node
|
|
|
43
43
|
import { Rymi } from '@rymi/node';
|
|
44
44
|
|
|
45
45
|
const rymi = new Rymi({ apiKey: process.env.RYMI_API_KEY });
|
|
46
|
+
// Optional: act in another workspace you can reach.
|
|
47
|
+
// const rymi = new Rymi({ apiKey: process.env.RYMI_API_KEY, workspace: 'workspace-id' });
|
|
48
|
+
// Or set RYMI_WORKSPACE. The client sends it as the Rymi-Workspace header.
|
|
46
49
|
|
|
47
50
|
// Create a voice agent
|
|
48
51
|
const agent = await rymi.agents.create({
|
|
@@ -79,6 +82,7 @@ The client exposes one namespace per resource group:
|
|
|
79
82
|
| `contacts` | Contacts and per-channel consent |
|
|
80
83
|
| `compliance` | Compliance attestations (e.g. an external DNC scrub) |
|
|
81
84
|
| `toolSecrets` | Secrets for API-tool headers, referenced as `{{secrets.NAME}}` |
|
|
85
|
+
| `workspaces` | List, create and update workspaces, including client workspaces (`create({ name, parent })`) that your agency pays for, with a monthly `spend_cap_cents_monthly`. `usage(id, { month })` for invoicing; `listMembers`, `addMember`, `removeMember`. Pass `workspace` (or `RYMI_WORKSPACE`) to act in one of them. |
|
|
82
86
|
|
|
83
87
|
## 📖 Documentation
|
|
84
88
|
|
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,11 @@ interface ClientOptions {
|
|
|
15
15
|
* network socket (e.g. Fastify app.inject). Defaults to global fetch.
|
|
16
16
|
*/
|
|
17
17
|
fetch?: typeof globalThis.fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Act in this workspace (sent as `Rymi-Workspace`). Defaults to the
|
|
20
|
+
* `RYMI_WORKSPACE` environment variable, else the key's own workspace.
|
|
21
|
+
*/
|
|
22
|
+
workspace?: string;
|
|
18
23
|
}
|
|
19
24
|
declare class RymiError extends Error {
|
|
20
25
|
status?: number;
|
|
@@ -25,6 +30,7 @@ declare class RymiClient {
|
|
|
25
30
|
private apiKey;
|
|
26
31
|
private baseURL;
|
|
27
32
|
private fetchImpl;
|
|
33
|
+
private workspace?;
|
|
28
34
|
constructor(options?: ClientOptions);
|
|
29
35
|
private request;
|
|
30
36
|
get<T>(path: string): Promise<T>;
|
|
@@ -1408,6 +1414,75 @@ declare class ToolSecretsResource {
|
|
|
1408
1414
|
}>;
|
|
1409
1415
|
}
|
|
1410
1416
|
|
|
1417
|
+
interface Workspace {
|
|
1418
|
+
id: string;
|
|
1419
|
+
name: string;
|
|
1420
|
+
role: 'owner' | 'admin' | 'client';
|
|
1421
|
+
/** The agency, for a client workspace. */
|
|
1422
|
+
parent_id: string | null;
|
|
1423
|
+
operating_country: string | null;
|
|
1424
|
+
/** Client workspaces only; absent for the client role. */
|
|
1425
|
+
spend_cap_cents_monthly?: number | null;
|
|
1426
|
+
current?: boolean;
|
|
1427
|
+
}
|
|
1428
|
+
interface CreateWorkspaceParams {
|
|
1429
|
+
name: string;
|
|
1430
|
+
/** ISO-3166 alpha-2, e.g. "IN". */
|
|
1431
|
+
operating_country?: string | null;
|
|
1432
|
+
/** An agency workspace you run: makes this a client workspace that the agency pays for. */
|
|
1433
|
+
parent?: string;
|
|
1434
|
+
}
|
|
1435
|
+
interface UpdateWorkspaceParams {
|
|
1436
|
+
name?: string;
|
|
1437
|
+
operating_country?: string | null;
|
|
1438
|
+
/** Client workspaces only. Credits per calendar month (1 credit = $0.01); null removes the cap. */
|
|
1439
|
+
spend_cap_cents_monthly?: number | null;
|
|
1440
|
+
}
|
|
1441
|
+
interface WorkspaceUsage {
|
|
1442
|
+
workspace_id: string;
|
|
1443
|
+
/** YYYY-MM, UTC. */
|
|
1444
|
+
month: string;
|
|
1445
|
+
calls: number;
|
|
1446
|
+
minutes: number;
|
|
1447
|
+
/** Left out for the client role. */
|
|
1448
|
+
credits?: number;
|
|
1449
|
+
}
|
|
1450
|
+
interface WorkspaceMember {
|
|
1451
|
+
user_id: string;
|
|
1452
|
+
email: string | null;
|
|
1453
|
+
role: 'owner' | 'admin' | 'client';
|
|
1454
|
+
}
|
|
1455
|
+
declare class WorkspacesResource {
|
|
1456
|
+
private client;
|
|
1457
|
+
constructor(client: RymiClient);
|
|
1458
|
+
list(): Promise<{
|
|
1459
|
+
workspaces: Workspace[];
|
|
1460
|
+
}>;
|
|
1461
|
+
create(data: CreateWorkspaceParams): Promise<{
|
|
1462
|
+
workspace: Workspace;
|
|
1463
|
+
}>;
|
|
1464
|
+
update(id: string, data: UpdateWorkspaceParams): Promise<{
|
|
1465
|
+
ok: true;
|
|
1466
|
+
}>;
|
|
1467
|
+
/** Calls, minutes and credits for one month (default: this month, UTC). */
|
|
1468
|
+
usage(id: string, params?: {
|
|
1469
|
+
month?: string;
|
|
1470
|
+
}): Promise<WorkspaceUsage>;
|
|
1471
|
+
listMembers(id: string): Promise<{
|
|
1472
|
+
members: WorkspaceMember[];
|
|
1473
|
+
}>;
|
|
1474
|
+
/** Someone without a Rymi account gets an invite email. Client workspaces take the client role. */
|
|
1475
|
+
addMember(id: string, data: {
|
|
1476
|
+
email: string;
|
|
1477
|
+
role?: 'admin' | 'client';
|
|
1478
|
+
}): Promise<{
|
|
1479
|
+
member: WorkspaceMember;
|
|
1480
|
+
}>;
|
|
1481
|
+
removeMember(id: string, userId: string): Promise<{
|
|
1482
|
+
ok: true;
|
|
1483
|
+
}>;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1411
1486
|
declare class Rymi {
|
|
1412
1487
|
private client;
|
|
1413
1488
|
agents: AgentsResource;
|
|
@@ -1423,7 +1498,8 @@ declare class Rymi {
|
|
|
1423
1498
|
contacts: ContactsResource;
|
|
1424
1499
|
compliance: ComplianceResource;
|
|
1425
1500
|
toolSecrets: ToolSecretsResource;
|
|
1501
|
+
workspaces: WorkspacesResource;
|
|
1426
1502
|
constructor(options?: ClientOptions);
|
|
1427
1503
|
}
|
|
1428
1504
|
|
|
1429
|
-
export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentShareLink, type AgentShareLinkSettings, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type AttestParams, type AttestResponse, type Attestation, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type CampaignAttemptListResponse, type CampaignBatch, type CampaignBatchListResponse, type CampaignFollowupJob, type CampaignFollowupListResponse, type CampaignIntake, type CampaignIntakeSettings, type CampaignListResponse, type CampaignMemberListResponse, type CampaignReportResponse, type CampaignRoute, type CampaignRouteListResponse, type CampaignSuggestion, type CampaignSuggestionListResponse, CampaignsResource, type ChangeEntry, type ClientOptions, ComplianceResource, type ConnectTelephonyParams, type ContactListResponse, ContactsResource, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreateCampaignParams, type CreateCampaignRouteParams, type CreateContactParams, type CreateContactResponse, type CreatePublishableKeyParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, type FanoutCallParams, type ImportCampaignMembersParams, type ImportCampaignMembersResponse, type ImportContactsParams, type ImportContactsResponse, type ImproveCampaignResponse, KeysResource, type LaunchBlocker, type LaunchCampaignResponse, type ListAttestationsResponse, type ListCallsParams, type ListCampaignAttemptsParams, type ListCampaignBatchesParams, type ListCampaignFollowupsParams, type ListCampaignMembersParams, type ListCampaignRoutesParams, type ListCampaignSuggestionsParams, type ListCampaignsParams, type ListContactsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishAgentResponse, type PublishValidationIssue, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type SetConsentParams, type SetConsentResponse, type TelephonyProvider, TelephonyResource, TemplatesResource, type ToolSecretRecord, ToolSecretsResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, Rymi as default };
|
|
1505
|
+
export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentShareLink, type AgentShareLinkSettings, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type AttestParams, type AttestResponse, type Attestation, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type CampaignAttemptListResponse, type CampaignBatch, type CampaignBatchListResponse, type CampaignFollowupJob, type CampaignFollowupListResponse, type CampaignIntake, type CampaignIntakeSettings, type CampaignListResponse, type CampaignMemberListResponse, type CampaignReportResponse, type CampaignRoute, type CampaignRouteListResponse, type CampaignSuggestion, type CampaignSuggestionListResponse, CampaignsResource, type ChangeEntry, type ClientOptions, ComplianceResource, type ConnectTelephonyParams, type ContactListResponse, ContactsResource, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreateCampaignParams, type CreateCampaignRouteParams, type CreateContactParams, type CreateContactResponse, type CreatePublishableKeyParams, type CreateWorkspaceParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, type FanoutCallParams, type ImportCampaignMembersParams, type ImportCampaignMembersResponse, type ImportContactsParams, type ImportContactsResponse, type ImproveCampaignResponse, KeysResource, type LaunchBlocker, type LaunchCampaignResponse, type ListAttestationsResponse, type ListCallsParams, type ListCampaignAttemptsParams, type ListCampaignBatchesParams, type ListCampaignFollowupsParams, type ListCampaignMembersParams, type ListCampaignRoutesParams, type ListCampaignSuggestionsParams, type ListCampaignsParams, type ListContactsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishAgentResponse, type PublishValidationIssue, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type SetConsentParams, type SetConsentResponse, type TelephonyProvider, TelephonyResource, TemplatesResource, type ToolSecretRecord, ToolSecretsResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UpdateWorkspaceParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, type Workspace, type WorkspaceMember, type WorkspaceUsage, WorkspacesResource, Rymi as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ interface ClientOptions {
|
|
|
15
15
|
* network socket (e.g. Fastify app.inject). Defaults to global fetch.
|
|
16
16
|
*/
|
|
17
17
|
fetch?: typeof globalThis.fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Act in this workspace (sent as `Rymi-Workspace`). Defaults to the
|
|
20
|
+
* `RYMI_WORKSPACE` environment variable, else the key's own workspace.
|
|
21
|
+
*/
|
|
22
|
+
workspace?: string;
|
|
18
23
|
}
|
|
19
24
|
declare class RymiError extends Error {
|
|
20
25
|
status?: number;
|
|
@@ -25,6 +30,7 @@ declare class RymiClient {
|
|
|
25
30
|
private apiKey;
|
|
26
31
|
private baseURL;
|
|
27
32
|
private fetchImpl;
|
|
33
|
+
private workspace?;
|
|
28
34
|
constructor(options?: ClientOptions);
|
|
29
35
|
private request;
|
|
30
36
|
get<T>(path: string): Promise<T>;
|
|
@@ -1408,6 +1414,75 @@ declare class ToolSecretsResource {
|
|
|
1408
1414
|
}>;
|
|
1409
1415
|
}
|
|
1410
1416
|
|
|
1417
|
+
interface Workspace {
|
|
1418
|
+
id: string;
|
|
1419
|
+
name: string;
|
|
1420
|
+
role: 'owner' | 'admin' | 'client';
|
|
1421
|
+
/** The agency, for a client workspace. */
|
|
1422
|
+
parent_id: string | null;
|
|
1423
|
+
operating_country: string | null;
|
|
1424
|
+
/** Client workspaces only; absent for the client role. */
|
|
1425
|
+
spend_cap_cents_monthly?: number | null;
|
|
1426
|
+
current?: boolean;
|
|
1427
|
+
}
|
|
1428
|
+
interface CreateWorkspaceParams {
|
|
1429
|
+
name: string;
|
|
1430
|
+
/** ISO-3166 alpha-2, e.g. "IN". */
|
|
1431
|
+
operating_country?: string | null;
|
|
1432
|
+
/** An agency workspace you run: makes this a client workspace that the agency pays for. */
|
|
1433
|
+
parent?: string;
|
|
1434
|
+
}
|
|
1435
|
+
interface UpdateWorkspaceParams {
|
|
1436
|
+
name?: string;
|
|
1437
|
+
operating_country?: string | null;
|
|
1438
|
+
/** Client workspaces only. Credits per calendar month (1 credit = $0.01); null removes the cap. */
|
|
1439
|
+
spend_cap_cents_monthly?: number | null;
|
|
1440
|
+
}
|
|
1441
|
+
interface WorkspaceUsage {
|
|
1442
|
+
workspace_id: string;
|
|
1443
|
+
/** YYYY-MM, UTC. */
|
|
1444
|
+
month: string;
|
|
1445
|
+
calls: number;
|
|
1446
|
+
minutes: number;
|
|
1447
|
+
/** Left out for the client role. */
|
|
1448
|
+
credits?: number;
|
|
1449
|
+
}
|
|
1450
|
+
interface WorkspaceMember {
|
|
1451
|
+
user_id: string;
|
|
1452
|
+
email: string | null;
|
|
1453
|
+
role: 'owner' | 'admin' | 'client';
|
|
1454
|
+
}
|
|
1455
|
+
declare class WorkspacesResource {
|
|
1456
|
+
private client;
|
|
1457
|
+
constructor(client: RymiClient);
|
|
1458
|
+
list(): Promise<{
|
|
1459
|
+
workspaces: Workspace[];
|
|
1460
|
+
}>;
|
|
1461
|
+
create(data: CreateWorkspaceParams): Promise<{
|
|
1462
|
+
workspace: Workspace;
|
|
1463
|
+
}>;
|
|
1464
|
+
update(id: string, data: UpdateWorkspaceParams): Promise<{
|
|
1465
|
+
ok: true;
|
|
1466
|
+
}>;
|
|
1467
|
+
/** Calls, minutes and credits for one month (default: this month, UTC). */
|
|
1468
|
+
usage(id: string, params?: {
|
|
1469
|
+
month?: string;
|
|
1470
|
+
}): Promise<WorkspaceUsage>;
|
|
1471
|
+
listMembers(id: string): Promise<{
|
|
1472
|
+
members: WorkspaceMember[];
|
|
1473
|
+
}>;
|
|
1474
|
+
/** Someone without a Rymi account gets an invite email. Client workspaces take the client role. */
|
|
1475
|
+
addMember(id: string, data: {
|
|
1476
|
+
email: string;
|
|
1477
|
+
role?: 'admin' | 'client';
|
|
1478
|
+
}): Promise<{
|
|
1479
|
+
member: WorkspaceMember;
|
|
1480
|
+
}>;
|
|
1481
|
+
removeMember(id: string, userId: string): Promise<{
|
|
1482
|
+
ok: true;
|
|
1483
|
+
}>;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1411
1486
|
declare class Rymi {
|
|
1412
1487
|
private client;
|
|
1413
1488
|
agents: AgentsResource;
|
|
@@ -1423,7 +1498,8 @@ declare class Rymi {
|
|
|
1423
1498
|
contacts: ContactsResource;
|
|
1424
1499
|
compliance: ComplianceResource;
|
|
1425
1500
|
toolSecrets: ToolSecretsResource;
|
|
1501
|
+
workspaces: WorkspacesResource;
|
|
1426
1502
|
constructor(options?: ClientOptions);
|
|
1427
1503
|
}
|
|
1428
1504
|
|
|
1429
|
-
export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentShareLink, type AgentShareLinkSettings, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type AttestParams, type AttestResponse, type Attestation, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type CampaignAttemptListResponse, type CampaignBatch, type CampaignBatchListResponse, type CampaignFollowupJob, type CampaignFollowupListResponse, type CampaignIntake, type CampaignIntakeSettings, type CampaignListResponse, type CampaignMemberListResponse, type CampaignReportResponse, type CampaignRoute, type CampaignRouteListResponse, type CampaignSuggestion, type CampaignSuggestionListResponse, CampaignsResource, type ChangeEntry, type ClientOptions, ComplianceResource, type ConnectTelephonyParams, type ContactListResponse, ContactsResource, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreateCampaignParams, type CreateCampaignRouteParams, type CreateContactParams, type CreateContactResponse, type CreatePublishableKeyParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, type FanoutCallParams, type ImportCampaignMembersParams, type ImportCampaignMembersResponse, type ImportContactsParams, type ImportContactsResponse, type ImproveCampaignResponse, KeysResource, type LaunchBlocker, type LaunchCampaignResponse, type ListAttestationsResponse, type ListCallsParams, type ListCampaignAttemptsParams, type ListCampaignBatchesParams, type ListCampaignFollowupsParams, type ListCampaignMembersParams, type ListCampaignRoutesParams, type ListCampaignSuggestionsParams, type ListCampaignsParams, type ListContactsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishAgentResponse, type PublishValidationIssue, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type SetConsentParams, type SetConsentResponse, type TelephonyProvider, TelephonyResource, TemplatesResource, type ToolSecretRecord, ToolSecretsResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, Rymi as default };
|
|
1505
|
+
export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentShareLink, type AgentShareLinkSettings, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type AttestParams, type AttestResponse, type Attestation, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type CampaignAttemptListResponse, type CampaignBatch, type CampaignBatchListResponse, type CampaignFollowupJob, type CampaignFollowupListResponse, type CampaignIntake, type CampaignIntakeSettings, type CampaignListResponse, type CampaignMemberListResponse, type CampaignReportResponse, type CampaignRoute, type CampaignRouteListResponse, type CampaignSuggestion, type CampaignSuggestionListResponse, CampaignsResource, type ChangeEntry, type ClientOptions, ComplianceResource, type ConnectTelephonyParams, type ContactListResponse, ContactsResource, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreateCampaignParams, type CreateCampaignRouteParams, type CreateContactParams, type CreateContactResponse, type CreatePublishableKeyParams, type CreateWorkspaceParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, type FanoutCallParams, type ImportCampaignMembersParams, type ImportCampaignMembersResponse, type ImportContactsParams, type ImportContactsResponse, type ImproveCampaignResponse, KeysResource, type LaunchBlocker, type LaunchCampaignResponse, type ListAttestationsResponse, type ListCallsParams, type ListCampaignAttemptsParams, type ListCampaignBatchesParams, type ListCampaignFollowupsParams, type ListCampaignMembersParams, type ListCampaignRoutesParams, type ListCampaignSuggestionsParams, type ListCampaignsParams, type ListContactsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishAgentResponse, type PublishValidationIssue, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type SetConsentParams, type SetConsentResponse, type TelephonyProvider, TelephonyResource, TemplatesResource, type ToolSecretRecord, ToolSecretsResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UpdateWorkspaceParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, type Workspace, type WorkspaceMember, type WorkspaceUsage, WorkspacesResource, Rymi as default };
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
TemplatesResource: () => TemplatesResource,
|
|
48
48
|
ToolSecretsResource: () => ToolSecretsResource,
|
|
49
49
|
WebhooksResource: () => WebhooksResource,
|
|
50
|
+
WorkspacesResource: () => WorkspacesResource,
|
|
50
51
|
default: () => index_default
|
|
51
52
|
});
|
|
52
53
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -66,6 +67,7 @@ var RymiClient = class {
|
|
|
66
67
|
apiKey;
|
|
67
68
|
baseURL;
|
|
68
69
|
fetchImpl;
|
|
70
|
+
workspace;
|
|
69
71
|
constructor(options) {
|
|
70
72
|
const key = options?.apiKey || (typeof process !== "undefined" ? process.env.RYMI_API_KEY : void 0);
|
|
71
73
|
if (!key) {
|
|
@@ -77,6 +79,7 @@ var RymiClient = class {
|
|
|
77
79
|
if (this.baseURL.endsWith("/")) {
|
|
78
80
|
this.baseURL = this.baseURL.slice(0, -1);
|
|
79
81
|
}
|
|
82
|
+
this.workspace = options?.workspace || (typeof process !== "undefined" ? process.env.RYMI_WORKSPACE : void 0) || void 0;
|
|
80
83
|
}
|
|
81
84
|
async request(method, path, body) {
|
|
82
85
|
const url = `${this.baseURL}${path.startsWith("/") ? path : `/${path}`}`;
|
|
@@ -85,6 +88,7 @@ var RymiClient = class {
|
|
|
85
88
|
"Accept": "application/json",
|
|
86
89
|
"User-Agent": "rymi-node/1.0.0"
|
|
87
90
|
};
|
|
91
|
+
if (this.workspace) headers["Rymi-Workspace"] = this.workspace;
|
|
88
92
|
const init = {
|
|
89
93
|
method,
|
|
90
94
|
headers
|
|
@@ -858,6 +862,37 @@ var ToolSecretsResource = class {
|
|
|
858
862
|
}
|
|
859
863
|
};
|
|
860
864
|
|
|
865
|
+
// src/resources/workspaces.ts
|
|
866
|
+
var WorkspacesResource = class {
|
|
867
|
+
constructor(client) {
|
|
868
|
+
this.client = client;
|
|
869
|
+
}
|
|
870
|
+
async list() {
|
|
871
|
+
return this.client.get("/workspaces");
|
|
872
|
+
}
|
|
873
|
+
async create(data) {
|
|
874
|
+
return this.client.post("/workspaces", data);
|
|
875
|
+
}
|
|
876
|
+
async update(id, data) {
|
|
877
|
+
return this.client.patch(`/workspaces/${encodeURIComponent(id)}`, data);
|
|
878
|
+
}
|
|
879
|
+
/** Calls, minutes and credits for one month (default: this month, UTC). */
|
|
880
|
+
async usage(id, params = {}) {
|
|
881
|
+
const query = params.month ? `?month=${encodeURIComponent(params.month)}` : "";
|
|
882
|
+
return this.client.get(`/workspaces/${encodeURIComponent(id)}/usage${query}`);
|
|
883
|
+
}
|
|
884
|
+
async listMembers(id) {
|
|
885
|
+
return this.client.get(`/workspaces/${encodeURIComponent(id)}/members`);
|
|
886
|
+
}
|
|
887
|
+
/** Someone without a Rymi account gets an invite email. Client workspaces take the client role. */
|
|
888
|
+
async addMember(id, data) {
|
|
889
|
+
return this.client.post(`/workspaces/${encodeURIComponent(id)}/members`, data);
|
|
890
|
+
}
|
|
891
|
+
async removeMember(id, userId) {
|
|
892
|
+
return this.client.delete(`/workspaces/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
|
|
861
896
|
// src/index.ts
|
|
862
897
|
__reExport(index_exports, require("@rymi/sdk-types"), module.exports);
|
|
863
898
|
var Rymi = class {
|
|
@@ -875,6 +910,7 @@ var Rymi = class {
|
|
|
875
910
|
contacts;
|
|
876
911
|
compliance;
|
|
877
912
|
toolSecrets;
|
|
913
|
+
workspaces;
|
|
878
914
|
constructor(options) {
|
|
879
915
|
this.client = new RymiClient(options);
|
|
880
916
|
this.agents = new AgentsResource(this.client);
|
|
@@ -890,6 +926,7 @@ var Rymi = class {
|
|
|
890
926
|
this.contacts = new ContactsResource(this.client);
|
|
891
927
|
this.compliance = new ComplianceResource(this.client);
|
|
892
928
|
this.toolSecrets = new ToolSecretsResource(this.client);
|
|
929
|
+
this.workspaces = new WorkspacesResource(this.client);
|
|
893
930
|
}
|
|
894
931
|
};
|
|
895
932
|
var index_default = Rymi;
|
|
@@ -911,6 +948,7 @@ var index_default = Rymi;
|
|
|
911
948
|
TemplatesResource,
|
|
912
949
|
ToolSecretsResource,
|
|
913
950
|
WebhooksResource,
|
|
951
|
+
WorkspacesResource,
|
|
914
952
|
...require("@rymi/sdk-types")
|
|
915
953
|
});
|
|
916
954
|
//# sourceMappingURL=index.js.map
|