@unboundcx/sdk 4.13.80 → 4.13.82

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.82",
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
@@ -88,9 +88,10 @@ export class ReportingAgentsService {
88
88
  }
89
89
 
90
90
  /**
91
- * Per-agent per-local-day timesheet rows (net paid hours).
91
+ * Per-agent per-local-day timesheet rows (net paid hours), plus one
92
+ * additive-sum row per agent (`agents`) for grouped totals.
92
93
  * @param {Object} params - { from, to, userIds, teamIds }
93
- * @returns {Promise<Object>} { columns, rows }
94
+ * @returns {Promise<Object>} { columns, rows, agents }
94
95
  * @example
95
96
  * await sdk.reporting.agents.timesheet({ from, to, userIds: ['u1'] });
96
97
  */
@@ -107,13 +108,26 @@ export class ReportingAgentsService {
107
108
  }
108
109
 
109
110
  /**
110
- * CSV export of any of the four views above.
111
- * @param {Object} params - { view: 'summary'|'states'|'interactions'|'timesheet', from, to, userId, userIds, queueIds, teamIds, groupBy }
111
+ * CSV export of any of the four views above. For view: 'timesheet', pass
112
+ * `totals: true` to get one additive-sum row per agent instead of the
113
+ * flat per-agent-per-day rows.
114
+ * @param {Object} params - { view: 'summary'|'states'|'interactions'|'timesheet', from, to, userId, userIds, queueIds, teamIds, groupBy, totals }
112
115
  * @returns {Promise<Object>} raw CSV response (transport-dependent)
113
116
  * @example
114
117
  * await sdk.reporting.agents.export({ view: 'timesheet', from, to });
118
+ * await sdk.reporting.agents.export({ view: 'timesheet', from, to, totals: true });
115
119
  */
116
- async export({ view, from, to, userId, userIds, queueIds, teamIds, groupBy } = {}) {
120
+ async export({
121
+ view,
122
+ from,
123
+ to,
124
+ userId,
125
+ userIds,
126
+ queueIds,
127
+ teamIds,
128
+ groupBy,
129
+ totals,
130
+ } = {}) {
117
131
  this.sdk.validateParams(
118
132
  { from, to },
119
133
  { from: { type: 'string', required: true }, to: { type: 'string', required: true } },
@@ -127,6 +141,7 @@ export class ReportingAgentsService {
127
141
  queueIds,
128
142
  teamIds,
129
143
  groupBy,
144
+ totals: totals ? '1' : undefined,
130
145
  format: 'csv',
131
146
  });
132
147
  return internalRequest(this.sdk, `/reporting/agents/export${qs}`, 'GET', { httpOnly: true });