@agent-os-sdk/client 0.4.0 → 0.4.2

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.
@@ -7,8 +7,8 @@
7
7
  * - create*, update*, delete* for mutations (NOT remove!)
8
8
  */
9
9
 
10
- import type { RawClient, APIResponse } from "../client/raw.js";
11
- import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
10
+ import type { PaginatedResponse, PaginationParams } from "../client/helpers.js";
11
+ import type { APIResponse, RawClient } from "../client/raw.js";
12
12
 
13
13
  export interface Member {
14
14
  id: string;
@@ -25,6 +25,15 @@ export interface Member {
25
25
  updated_at: string;
26
26
  }
27
27
 
28
+ export interface Role {
29
+ id: string;
30
+ name: string;
31
+ is_system: boolean;
32
+ permissions?: string[];
33
+ created_at?: string;
34
+ members_count?: number;
35
+ }
36
+
28
37
  export interface MemberInviteResponse {
29
38
  member_id: string;
30
39
  invite_token?: string;
@@ -60,6 +69,66 @@ export class MembersModule {
60
69
  });
61
70
  }
62
71
 
72
+
73
+ /**
74
+ * List all roles in the tenant.
75
+ */
76
+ async listRoles(): Promise<APIResponse<{ items: Role[] }>> {
77
+ return this.client.GET<{ items: Role[] }>("/v1/api/roles", {
78
+ headers: this.headers(),
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Get a role by ID.
84
+ */
85
+ async getRole(roleId: string): Promise<APIResponse<Role>> {
86
+ return this.client.GET<Role>("/v1/api/roles/{id}", {
87
+ params: { path: { id: roleId } },
88
+ headers: this.headers(),
89
+ });
90
+ }
91
+
92
+ /**
93
+ * Create a new custom role.
94
+ */
95
+ async createRole(body: { name: string; permissions?: string[] }): Promise<APIResponse<Role>> {
96
+ return this.client.POST<Role>("/v1/api/roles", {
97
+ body,
98
+ headers: this.headers(),
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Update a custom role.
104
+ */
105
+ async updateRole(roleId: string, body: { name?: string; permissions?: string[] }): Promise<APIResponse<Role>> {
106
+ return this.client.PUT<Role>("/v1/api/roles/{id}", {
107
+ params: { path: { id: roleId } },
108
+ body,
109
+ headers: this.headers(),
110
+ });
111
+ }
112
+
113
+ /**
114
+ * Delete a custom role.
115
+ */
116
+ async deleteRole(roleId: string): Promise<APIResponse<void>> {
117
+ return this.client.DELETE<void>("/v1/api/roles/{id}", {
118
+ params: { path: { id: roleId } },
119
+ headers: this.headers(),
120
+ });
121
+ }
122
+
123
+ /**
124
+ * List all available system permissions.
125
+ */
126
+ async listPermissions(): Promise<APIResponse<{ items: string[] }>> {
127
+ return this.client.GET<{ items: string[] }>("/v1/api/roles/permissions", {
128
+ headers: this.headers(),
129
+ });
130
+ }
131
+
63
132
  /**
64
133
  * Invite a new member.
65
134
  */
@@ -125,4 +194,13 @@ export class MembersModule {
125
194
  headers: this.headers(),
126
195
  });
127
196
  }
197
+
198
+ /**
199
+ * Seed default permissions (Dev only)
200
+ */
201
+ async seedDefaults(): Promise<APIResponse<{ message: string }>> {
202
+ return this.client.POST<{ message: string }>("/v1/api/roles/seed-defaults", {
203
+ headers: this.headers(),
204
+ });
205
+ }
128
206
  }