@unboundcx/sdk 4.13.80 → 4.13.81

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.80",
3
+ "version": "4.13.81",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -5,7 +5,12 @@ export class PermissionsService {
5
5
  }
6
6
 
7
7
  /**
8
- * List permission groups
8
+ * List permission groups. Server-filtered to what the caller can see
9
+ * (group access model): account admin / admin:group:manage /
10
+ * admin:group:view see every group; a group manager or member sees only
11
+ * their own group(s). Each row carries `members: [{id, role}]`,
12
+ * `canManage` (name/description/members), and `canManagePermissionSets`
13
+ * (account admin / admin:group:manage only).
9
14
  * @returns {Promise<Object>} Object with results: Array of permission groups
10
15
  * @example
11
16
  * const { results } = await sdk.permissions.listGroups();
@@ -112,11 +117,13 @@ export class PermissionsService {
112
117
  * Add a user to a permission group
113
118
  * @param {string} groupId - Group ID
114
119
  * @param {string} userId - User ID to add
120
+ * @param {string} [role] - 'member' (default) or 'manager'
115
121
  * @returns {Promise<Object>} Membership confirmation
116
122
  * @example
117
123
  * await sdk.permissions.addGroupMember('group-123', 'user-456');
124
+ * await sdk.permissions.addGroupMember('group-123', 'user-456', 'manager');
118
125
  */
119
- async addGroupMember(groupId, userId) {
126
+ async addGroupMember(groupId, userId, role) {
120
127
  groupId = String(groupId);
121
128
  userId = String(userId);
122
129
  this.sdk.validateParams(
@@ -127,11 +134,14 @@ export class PermissionsService {
127
134
  },
128
135
  );
129
136
 
137
+ const body = { userId };
138
+ if (role !== undefined) body.role = role;
139
+
130
140
  const params = {
131
- body: { userId },
141
+ body,
132
142
  };
133
143
 
134
- const result = await internalRequest(this.sdk,
144
+ const result = await internalRequest(this.sdk,
135
145
  `/permissions/groups/${groupId}/members`,
136
146
  'POST',
137
147
  params,
@@ -139,6 +149,41 @@ export class PermissionsService {
139
149
  return result;
140
150
  }
141
151
 
152
+ /**
153
+ * Change a group member's role (Member / Manager) — group-manager-safe:
154
+ * account admin, admin:group:manage, or a manager of this group can call
155
+ * it; plain members cannot.
156
+ * @param {string} groupId - Group ID
157
+ * @param {string} userId - User ID
158
+ * @param {string} role - 'member' or 'manager'
159
+ * @returns {Promise<Object>} { groupId, userId, role }
160
+ * @example
161
+ * await sdk.permissions.updateGroupMemberRole('group-123', 'user-456', 'manager');
162
+ */
163
+ async updateGroupMemberRole(groupId, userId, role) {
164
+ groupId = String(groupId);
165
+ userId = String(userId);
166
+ this.sdk.validateParams(
167
+ { groupId, userId, role },
168
+ {
169
+ groupId: { type: 'string', required: true },
170
+ userId: { type: 'string', required: true },
171
+ role: { type: 'string', required: true },
172
+ },
173
+ );
174
+
175
+ const params = {
176
+ body: { role },
177
+ };
178
+
179
+ const result = await internalRequest(this.sdk,
180
+ `/permissions/groups/${groupId}/members/${userId}`,
181
+ 'PUT',
182
+ params,
183
+ );
184
+ return result;
185
+ }
186
+
142
187
  /**
143
188
  * Remove a user from a permission group
144
189
  * @param {string} groupId - Group ID