codeapp-js 1.0.2 → 1.1.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.
Files changed (128) hide show
  1. package/AI/skills/autoreview/SKILL.md +69 -0
  2. package/AI/skills/connections/SKILL.md +4 -4
  3. package/AI/skills/dataverse/SKILL.md +4 -2
  4. package/AI/skills/keyvault/SKILL.md +139 -0
  5. package/AI/skills/office365-groups/SKILL.md +46 -25
  6. package/AI/skills/office365-outlook/SKILL.md +56 -25
  7. package/AI/skills/office365-users/SKILL.md +41 -36
  8. package/AI/skills/sharepoint/SKILL.md +174 -31
  9. package/AI/skills/start/SKILL.md +1 -0
  10. package/codeApp/dist/connectors/autoreview.js +1654 -0
  11. package/codeApp/dist/connectors/office365groups.js +2995 -432
  12. package/{examples/outlook Demo/.power/schemas/office365/office365.Schema.json → codeApp/dist/connectors/office365outlook.js} +7439 -16
  13. package/codeApp/dist/connectors/office365users.js +2990 -349
  14. package/codeApp/dist/connectors/sharepoint.js +529 -308
  15. package/examples/combined demo/dist/connectors/office365outlook.js +28521 -0
  16. package/examples/combined demo/dist/connectors/office365users.js +3154 -0
  17. package/examples/combined demo/dist/index.js +2 -6
  18. package/examples/combined demo/power.config.json +1 -1
  19. package/examples/groups Demo/{.power/schemas/office365groups/office365groups.Schema.json → dist/connectors/office365groups.js } +3205 -2204
  20. package/examples/groups Demo/dist/index.js +1 -5
  21. package/examples/groups Demo/power.config.json +1 -1
  22. package/examples/myProfile/dist/connectors/office365users.js +3154 -0
  23. package/examples/myProfile/dist/index.js +1 -5
  24. package/examples/myProfile/power.config.json +1 -1
  25. package/examples/outlook Demo/dist/connectors/office365outlook.js +28521 -0
  26. package/examples/outlook Demo/dist/index.js +2 -5
  27. package/examples/outlook Demo/power.config.json +1 -1
  28. package/examples/sharePoint Demo/dist/connectors/sharepoint.js +687 -0
  29. package/examples/sharePoint Demo/dist/index.js +86 -127
  30. package/examples/sharePoint Demo/power.config.json +1 -1
  31. package/package.json +1 -1
  32. package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6275
  33. package/codeApp/.power/schemas/jira/jira.Schema.json +0 -6903
  34. package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +0 -1600
  35. package/codeApp/.power/schemas/office365groups/office365groups.Schema.json +0 -2204
  36. package/codeApp/.power/schemas/teams/teams.Schema.json +0 -11112
  37. package/codeApp/dist/connectors/outlook.js +0 -1393
  38. package/codeApp/src/generated/models/AzureKeyVaultModel.ts +0 -107
  39. package/codeApp/src/generated/models/JiraModel.ts +0 -501
  40. package/codeApp/src/generated/models/Office365GroupsModel.ts +0 -363
  41. package/codeApp/src/generated/models/Office365OutlookModel.ts +0 -2046
  42. package/codeApp/src/generated/models/Office365UsersModel.ts +0 -254
  43. package/codeApp/src/generated/services/AzureKeyVaultService.ts +0 -257
  44. package/codeApp/src/generated/services/JiraService.ts +0 -1124
  45. package/codeApp/src/generated/services/Office365GroupsService.ts +0 -326
  46. package/codeApp/src/generated/services/Office365OutlookService.ts +0 -2476
  47. package/codeApp/src/generated/services/Office365UsersService.ts +0 -358
  48. package/examples/apps/kanban/dist/dataverse.js +0 -94
  49. package/examples/apps/kanban/dist/environmentVar.js +0 -55
  50. package/examples/apps/kanban/dist/index.css +0 -605
  51. package/examples/apps/kanban/dist/index.html +0 -21
  52. package/examples/apps/kanban/dist/index.js +0 -860
  53. package/examples/apps/kanban/dist/office365groups.js +0 -97
  54. package/examples/apps/kanban/dist/office365users.js +0 -451
  55. package/examples/apps/kanban/dist/outlook.js +0 -162
  56. package/examples/apps/kanban/dist/power-apps-data.js +0 -2953
  57. package/examples/apps/kanban/dist/sharepoint.js +0 -435
  58. package/examples/apps/kanban/power.config.json +0 -35
  59. package/examples/apps/kanban/src/generated/index.ts +0 -14
  60. package/examples/apps/kanban/src/generated/models/Office365GroupsModel.ts +0 -363
  61. package/examples/apps/kanban/src/generated/models/Office365OutlookModel.ts +0 -2046
  62. package/examples/apps/kanban/src/generated/models/Office365UsersModel.ts +0 -254
  63. package/examples/apps/kanban/src/generated/services/Office365GroupsService.ts +0 -326
  64. package/examples/apps/kanban/src/generated/services/Office365OutlookService.ts +0 -2476
  65. package/examples/apps/kanban/src/generated/services/Office365UsersService.ts +0 -358
  66. package/examples/apps/planning Poker/additional files/AgilePoker_1_0_0_1.zip +0 -0
  67. package/examples/apps/planning Poker/additional files/PokerTables_1_0_0_1.zip +0 -0
  68. package/examples/apps/planning Poker/additional files/customizations (tables).xml +0 -6429
  69. package/examples/apps/planning Poker/additional files/dataverse-tables.json +0 -165
  70. package/examples/apps/planning Poker/additional files/readme.md +0 -122
  71. package/examples/apps/planning Poker/dist/dataverse.js +0 -78
  72. package/examples/apps/planning Poker/dist/index.html +0 -198
  73. package/examples/apps/planning Poker/dist/index.js +0 -955
  74. package/examples/apps/planning Poker/dist/power-apps-data.js +0 -2953
  75. package/examples/apps/planning Poker/dist/styles.css +0 -815
  76. package/examples/apps/planning Poker/power.config.json +0 -50
  77. package/examples/apps/solution explorer/dist/codeapp.js +0 -1098
  78. package/examples/apps/solution explorer/dist/icon-512.png +0 -0
  79. package/examples/apps/solution explorer/dist/index.html +0 -80
  80. package/examples/apps/solution explorer/dist/index.js +0 -735
  81. package/examples/apps/solution explorer/dist/power-apps-data.js +0 -3007
  82. package/examples/apps/solution explorer/dist/styles.css +0 -571
  83. package/examples/apps/solution explorer/power.config.json +0 -151
  84. package/examples/apps/todo/dist/dataverse.js +0 -64
  85. package/examples/apps/todo/dist/icon192.png +0 -0
  86. package/examples/apps/todo/dist/index.html +0 -75
  87. package/examples/apps/todo/dist/index.js +0 -9
  88. package/examples/apps/todo/dist/power-apps-data.js +0 -2953
  89. package/examples/apps/todo/dist/renderer.js +0 -375
  90. package/examples/apps/todo/dist/styles.css +0 -691
  91. package/examples/apps/todo/power.config.json +0 -35
  92. package/examples/combined demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6275
  93. package/examples/combined demo/.power/schemas/jira/jira.Schema.json +0 -6903
  94. package/examples/combined demo/.power/schemas/keyvault/keyvault.Schema.json +0 -1600
  95. package/examples/combined demo/.power/schemas/teams/teams.Schema.json +0 -11112
  96. package/examples/combined demo/dist/office365users.js +0 -513
  97. package/examples/combined demo/dist/outlook.js +0 -1393
  98. package/examples/combined demo/src/generated/index.ts +0 -12
  99. package/examples/combined demo/src/generated/models/AzureKeyVaultModel.ts +0 -107
  100. package/examples/combined demo/src/generated/models/JiraModel.ts +0 -501
  101. package/examples/combined demo/src/generated/models/Office365GroupsModel.ts +0 -363
  102. package/examples/combined demo/src/generated/models/Office365OutlookModel.ts +0 -2046
  103. package/examples/combined demo/src/generated/models/Office365UsersModel.ts +0 -254
  104. package/examples/combined demo/src/generated/services/AzureKeyVaultService.ts +0 -257
  105. package/examples/combined demo/src/generated/services/JiraService.ts +0 -1124
  106. package/examples/combined demo/src/generated/services/Office365GroupsService.ts +0 -326
  107. package/examples/combined demo/src/generated/services/Office365OutlookService.ts +0 -2476
  108. package/examples/combined demo/src/generated/services/Office365UsersService.ts +0 -358
  109. package/examples/groups Demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -613
  110. package/examples/groups Demo/dist/office365groups.js +0 -642
  111. package/examples/groups Demo/src/generated/index.ts +0 -10
  112. package/examples/groups Demo/src/generated/models/Office365GroupsModel.ts +0 -363
  113. package/examples/groups Demo/src/generated/services/Office365GroupsService.ts +0 -326
  114. package/examples/myProfile/dist/office365users.js +0 -517
  115. package/examples/outlook Demo/.power/schemas/appschemas/dataSourcesInfo.ts +0 -6512
  116. package/examples/outlook Demo/dist/outlook.js +0 -1393
  117. package/examples/outlook Demo/src/generated/index.ts +0 -10
  118. package/examples/outlook Demo/src/generated/models/Office365OutlookModel.ts +0 -2046
  119. package/examples/outlook Demo/src/generated/services/Office365OutlookService.ts +0 -2476
  120. package/examples/sharePoint Demo/dist/sharepoint.js +0 -466
  121. package/examples/sharePoint Demo/src/generated/index.ts +0 -14
  122. package/examples/sharePoint Demo/src/generated/models/Office365GroupsModel.ts +0 -363
  123. package/examples/sharePoint Demo/src/generated/models/Office365OutlookModel.ts +0 -2046
  124. package/examples/sharePoint Demo/src/generated/models/Office365UsersModel.ts +0 -254
  125. package/examples/sharePoint Demo/src/generated/services/Office365GroupsService.ts +0 -326
  126. package/examples/sharePoint Demo/src/generated/services/Office365OutlookService.ts +0 -2476
  127. package/examples/sharePoint Demo/src/generated/services/Office365UsersService.ts +0 -358
  128. package/readme.md +0 -590
@@ -1,97 +0,0 @@
1
- import { getClient } from "@microsoft/power-apps/data";
2
-
3
- // ── Data source name (must match the generated connector data source name) ──
4
- const DATA_SOURCE = "office365groups";
5
-
6
- const GROUPS_APIS = {
7
- ListOwnedGroups: {
8
- path: "/{connectionId}/v1.0/me/memberOf/$/microsoft.graph.group",
9
- method: "GET",
10
- parameters: [
11
- { name: "connectionId", in: "path", required: true },
12
- ],
13
- },
14
- ListGroupMembers: {
15
- path: "/{connectionId}/v1.0/groups/{groupId}/members",
16
- method: "GET",
17
- parameters: [
18
- { name: "connectionId", in: "path", required: true },
19
- { name: "groupId", in: "path", required: true },
20
- { name: "$top", in: "query", required: false },
21
- ],
22
- },
23
- HttpRequest: {
24
- path: "/{connectionId}/httprequest",
25
- method: "POST",
26
- parameters: [
27
- { name: "connectionId", in: "path", required: true },
28
- ],
29
- },
30
- };
31
-
32
- // ── Initialize SDK client for the Office 365 Groups connector ──
33
- function initClient() {
34
- const dataSourcesInfo = {
35
- [DATA_SOURCE]: {
36
- tableId: "",
37
- version: "",
38
- primaryKey: "",
39
- dataSourceType: "Connector",
40
- apis: GROUPS_APIS,
41
- },
42
- };
43
- return getClient(dataSourcesInfo);
44
- }
45
-
46
- // ── Internal: execute a connector operation ────────────────────
47
- async function execOp(operationName, parameters) {
48
- const client = await initClient();
49
- const result = await client.executeAsync({
50
- connectorOperation: {
51
- tableName: DATA_SOURCE,
52
- operationName,
53
- parameters,
54
- },
55
- });
56
-
57
- if (!result.success) {
58
- throw new Error(result.error?.message || "Operation failed");
59
- }
60
-
61
- return Object.prototype.hasOwnProperty.call(result, "data") ? result.data : result;
62
- }
63
-
64
- // ═══════════════════════════════════════════════════════════════
65
- // GENERIC
66
- // ═══════════════════════════════════════════════════════════════
67
-
68
- // ── Call any Office 365 Groups operation by name ───────────────
69
- export async function callGroupsOperation(operationName, parameters = {}) {
70
- return execOp(operationName, parameters);
71
- }
72
-
73
- // ── Open HTTP Request ──────────────────────────────────────────
74
- export async function openHttpRequest({ method = "GET", uri, headers, body }) {
75
- return execOp("HttpRequest", {
76
- method,
77
- uri,
78
- headers: headers || {},
79
- body: body || "",
80
- });
81
- }
82
-
83
- // ═══════════════════════════════════════════════════════════════
84
- // GROUPS
85
- // ═══════════════════════════════════════════════════════════════
86
-
87
- // ── List My Groups ─────────────────────────────────────────────
88
- export async function listMyGroups() {
89
- return execOp("ListOwnedGroups", {});
90
- }
91
-
92
- // ── List Members of a Group ────────────────────────────────────
93
- export async function listGroupMembers(groupId) {
94
- return execOp("ListGroupMembers", {
95
- groupId,
96
- });
97
- }
@@ -1,451 +0,0 @@
1
- import { getClient } from "@microsoft/power-apps/data";
2
-
3
- // ── Data source name (must match connectionReferences in power.config.json) ──
4
- const DATA_SOURCE = "office365users";
5
-
6
- const USERS_APIS = {
7
- UpdateMyProfile: {
8
- path: "/{connectionId}/codeless/v1.0/me",
9
- method: "PATCH",
10
- parameters: [
11
- { name: "connectionId", in: "path", required: true },
12
- { name: "body", in: "body", required: false },
13
- ],
14
- },
15
- MyProfile_V2: {
16
- path: "/{connectionId}/codeless/v1.0/me",
17
- method: "GET",
18
- parameters: [
19
- { name: "connectionId", in: "path", required: true },
20
- { name: "$select", in: "query", required: false },
21
- ],
22
- },
23
- UpdateMyPhoto: {
24
- path: "/{connectionId}/codeless/v1.0/me/photo/$value",
25
- method: "PUT",
26
- parameters: [
27
- { name: "connectionId", in: "path", required: true },
28
- { name: "body", in: "body", required: true },
29
- { name: "Content_Type", in: "header", required: true },
30
- ],
31
- },
32
- MyTrendingDocuments: {
33
- path: "/{connectionId}/codeless/v1.0/me/insights/trending",
34
- method: "GET",
35
- parameters: [
36
- { name: "connectionId", in: "path", required: true },
37
- { name: "$filter", in: "query", required: false },
38
- { name: "extractSensitivityLabel", in: "query", required: false },
39
- { name: "fetchSensitivityLabelMetadata", in: "query", required: false },
40
- ],
41
- },
42
- RelevantPeople: {
43
- path: "/{connectionId}/codeless/v1.0/users/{userId}/people",
44
- method: "GET",
45
- parameters: [
46
- { name: "connectionId", in: "path", required: true },
47
- { name: "userId", in: "path", required: true },
48
- ],
49
- },
50
- UserProfile_V2: {
51
- path: "/{connectionId}/codeless/v1.0/users/{id}",
52
- method: "GET",
53
- parameters: [
54
- { name: "connectionId", in: "path", required: true },
55
- { name: "id", in: "path", required: true },
56
- { name: "$select", in: "query", required: false },
57
- ],
58
- },
59
- UserPhotoMetadata: {
60
- path: "/{connectionId}/codeless/v1.0/users/{userId}/photo",
61
- method: "GET",
62
- parameters: [
63
- { name: "connectionId", in: "path", required: true },
64
- { name: "userId", in: "path", required: true },
65
- ],
66
- },
67
- Manager_V2: {
68
- path: "/{connectionId}/codeless/v1.0/users/{id}/manager",
69
- method: "GET",
70
- parameters: [
71
- { name: "connectionId", in: "path", required: true },
72
- { name: "id", in: "path", required: true },
73
- { name: "$select", in: "query", required: false },
74
- ],
75
- },
76
- DirectReports_V2: {
77
- path: "/{connectionId}/codeless/v1.0/users/{id}/directReports",
78
- method: "GET",
79
- parameters: [
80
- { name: "connectionId", in: "path", required: true },
81
- { name: "id", in: "path", required: true },
82
- { name: "$select", in: "query", required: false },
83
- { name: "$top", in: "query", required: false },
84
- ],
85
- },
86
- UserPhoto_V2: {
87
- path: "/{connectionId}/codeless/v1.0/users/{id}/photo/$value",
88
- method: "GET",
89
- parameters: [
90
- { name: "connectionId", in: "path", required: true },
91
- { name: "id", in: "path", required: true },
92
- ],
93
- responseInfo: { "200": "image/jpeg" },
94
- },
95
- TrendingDocuments: {
96
- path: "/{connectionId}/codeless/v1.0/users/{id}/insights/trending",
97
- method: "GET",
98
- parameters: [
99
- { name: "connectionId", in: "path", required: true },
100
- { name: "id", in: "path", required: true },
101
- { name: "$filter", in: "query", required: false },
102
- { name: "extractSensitivityLabel", in: "query", required: false },
103
- { name: "fetchSensitivityLabelMetadata", in: "query", required: false },
104
- ],
105
- },
106
- SearchUserV2: {
107
- path: "/{connectionId}/codeless/v1.0/users",
108
- method: "GET",
109
- parameters: [
110
- { name: "connectionId", in: "path", required: true },
111
- { name: "searchTerm", in: "query", required: false },
112
- { name: "top", in: "query", required: false },
113
- { name: "isSearchTermRequired", in: "query", required: false },
114
- { name: "skipToken", in: "query", required: false },
115
- ],
116
- },
117
- SearchUser_V2: {
118
- path: "/{connectionId}/codeless/v1.0/users",
119
- method: "GET",
120
- parameters: [
121
- { name: "connectionId", in: "path", required: true },
122
- { name: "searchTerm", in: "query", required: false },
123
- { name: "top", in: "query", required: false },
124
- { name: "isSearchTermRequired", in: "query", required: false },
125
- { name: "skipToken", in: "query", required: false },
126
- ],
127
- },
128
- HttpRequest: {
129
- path: "/{connectionId}/codeless/v1.0/httprequest",
130
- method: "POST",
131
- parameters: [
132
- { name: "connectionId", in: "path", required: true },
133
- { name: "Uri", in: "header", required: true },
134
- { name: "Method", in: "header", required: true },
135
- { name: "Body", in: "body", required: false },
136
- { name: "ContentType", in: "header", required: false },
137
- { name: "CustomHeader1", in: "header", required: false },
138
- { name: "CustomHeader2", in: "header", required: false },
139
- { name: "CustomHeader3", in: "header", required: false },
140
- { name: "CustomHeader4", in: "header", required: false },
141
- { name: "CustomHeader5", in: "header", required: false },
142
- ],
143
- },
144
- };
145
-
146
- // ── Initialize SDK client for the Office 365 Users connector ───
147
- function initClient() {
148
- const dataSourcesInfo = {
149
- [DATA_SOURCE]: {
150
- tableId: "",
151
- version: "",
152
- primaryKey: "",
153
- dataSourceType: "Connector",
154
- apis: USERS_APIS,
155
- },
156
- };
157
- return getClient(dataSourcesInfo);
158
- }
159
-
160
- function unwrapResult(result) {
161
- if (result && result.success === false) {
162
- throw new Error(result.error?.message || "Operation failed");
163
- }
164
-
165
- return result && Object.prototype.hasOwnProperty.call(result, "data") ? result.data : result;
166
- }
167
-
168
- function isUsersObject(value) {
169
- return !!value && typeof value === "object" && !Array.isArray(value);
170
- }
171
-
172
- function pickUsersValue() {
173
- for (let iIndex = 0; iIndex < arguments.length; iIndex += 1) {
174
- const value = arguments[iIndex];
175
- if (value !== undefined && value !== null) return value;
176
- }
177
-
178
- return undefined;
179
- }
180
-
181
- function setUsersIfDefined(target, key, value) {
182
- if (value !== undefined && value !== null) {
183
- target[key] = value;
184
- }
185
- }
186
-
187
- function normalizeUsersSelect(value) {
188
- if (Array.isArray(value)) return value.join(",");
189
- return value;
190
- }
191
-
192
- function normalizeUsersSelectOptions(options) {
193
- if (isUsersObject(options)) return options;
194
- if (options === undefined || options === null) return {};
195
- return { select: options };
196
- }
197
-
198
- function normalizeUsersDirectReportsOptions(options) {
199
- if (isUsersObject(options)) return options;
200
- if (typeof options === "number") return { top: options };
201
- if (options === undefined || options === null) return {};
202
- return { select: options };
203
- }
204
-
205
- function normalizeUsersSearchOptions(options) {
206
- if (typeof options === "string") return { searchTerm: options };
207
- return isUsersObject(options) ? options : {};
208
- }
209
-
210
- function normalizeUsersTrendingOptions(options) {
211
- if (typeof options === "string") return { filter: options };
212
- return isUsersObject(options) ? options : {};
213
- }
214
-
215
- function extractUsersSkipToken(nextLink) {
216
- if (!nextLink || typeof nextLink !== "string") return undefined;
217
-
218
- try {
219
- const url = new URL(nextLink);
220
- return pickUsersValue(
221
- url.searchParams.get("skipToken"),
222
- url.searchParams.get("$skiptoken"),
223
- url.searchParams.get("$skipToken"),
224
- url.searchParams.get("skiptoken")
225
- );
226
- } catch {
227
- return undefined;
228
- }
229
- }
230
-
231
- function getUsersHeaderValue(headers, name) {
232
- if (!isUsersObject(headers)) return undefined;
233
-
234
- const headerName = String(name).toLowerCase();
235
- const entries = Object.entries(headers);
236
- for (let iIndex = 0; iIndex < entries.length; iIndex += 1) {
237
- const [currentName, value] = entries[iIndex];
238
- if (String(currentName).toLowerCase() === headerName) {
239
- return value;
240
- }
241
- }
242
-
243
- return undefined;
244
- }
245
-
246
- function normalizeUsersCustomHeaders(headers, customHeaders) {
247
- const resolved = Array.isArray(customHeaders) ? customHeaders.filter((value) => value != null) : [];
248
-
249
- if (!isUsersObject(headers)) return resolved.slice(0, 5);
250
-
251
- const entries = Object.entries(headers);
252
- for (let iIndex = 0; iIndex < entries.length; iIndex += 1) {
253
- const [headerName, value] = entries[iIndex];
254
- if (value === undefined || value === null) continue;
255
- if (String(headerName).toLowerCase() === "content-type") continue;
256
- resolved.push(String(headerName) + ": " + String(value));
257
- if (resolved.length >= 5) break;
258
- }
259
-
260
- return resolved.slice(0, 5);
261
- }
262
-
263
- // ── Internal: execute a connector operation ────────────────────
264
- async function execOp(operationName, parameters) {
265
- const client = await initClient();
266
- const result = await client.executeAsync({
267
- connectorOperation: {
268
- tableName: DATA_SOURCE,
269
- operationName,
270
- parameters,
271
- },
272
- });
273
- return unwrapResult(result);
274
- }
275
-
276
- // ═══════════════════════════════════════════════════════════════
277
- // GENERIC
278
- // ═══════════════════════════════════════════════════════════════
279
-
280
- // ── Call any Office 365 Users operation by name ────────────────
281
- export async function callUsersOperation(operationName, parameters = {}) {
282
- return execOp(operationName, parameters);
283
- }
284
-
285
- // ── Open HTTP Request ──────────────────────────────────────────
286
- export async function openHttpRequest({ method = "GET", uri, headers, body, contentType, customHeaders } = {}) {
287
- const resolvedHeaders = normalizeUsersCustomHeaders(headers, customHeaders);
288
- return execOp("HttpRequest", {
289
- Uri: uri,
290
- Method: method,
291
- Body: body,
292
- ContentType: pickUsersValue(contentType, getUsersHeaderValue(headers, "Content-Type")),
293
- CustomHeader1: resolvedHeaders[0],
294
- CustomHeader2: resolvedHeaders[1],
295
- CustomHeader3: resolvedHeaders[2],
296
- CustomHeader4: resolvedHeaders[3],
297
- CustomHeader5: resolvedHeaders[4],
298
- });
299
- }
300
-
301
- export async function updateMyProfile(profile = {}) {
302
- const body = isUsersObject(profile) && "body" in profile ? profile.body : profile;
303
- return execOp("UpdateMyProfile", { body });
304
- }
305
-
306
- // ═══════════════════════════════════════════════════════════════
307
- // PROFILE
308
- // ═══════════════════════════════════════════════════════════════
309
-
310
- // ── Get My Profile ─────────────────────────────────────────────
311
- export async function getMyProfile(options) {
312
- const resolvedOptions = normalizeUsersSelectOptions(options);
313
- const params = {};
314
- setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(resolvedOptions.select, resolvedOptions.$select)));
315
- return execOp("MyProfile_V2", params);
316
- }
317
-
318
- // ── Get User Profile ───────────────────────────────────────────
319
- export async function getUserProfile(userId, options) {
320
- if (isUsersObject(userId)) {
321
- options = userId;
322
- userId = pickUsersValue(options.userId, options.id);
323
- }
324
-
325
- const resolvedOptions = normalizeUsersSelectOptions(options);
326
- const params = { id: userId };
327
- setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(resolvedOptions.select, resolvedOptions.$select)));
328
- return execOp("UserProfile_V2", params);
329
- }
330
-
331
- // ═══════════════════════════════════════════════════════════════
332
- // MANAGER & REPORTS
333
- // ═══════════════════════════════════════════════════════════════
334
-
335
- // ── Get Manager ────────────────────────────────────────────────
336
- export async function getManager(userId, options) {
337
- if (isUsersObject(userId)) {
338
- options = userId;
339
- userId = pickUsersValue(options.userId, options.id);
340
- }
341
-
342
- const resolvedOptions = normalizeUsersSelectOptions(options);
343
- const params = { id: userId };
344
- setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(resolvedOptions.select, resolvedOptions.$select)));
345
- return execOp("Manager_V2", params);
346
- }
347
-
348
- // ── Get Direct Reports ─────────────────────────────────────────
349
- export async function getDirectReports(userId, options) {
350
- if (isUsersObject(userId)) {
351
- options = userId;
352
- userId = pickUsersValue(options.userId, options.id);
353
- }
354
-
355
- const resolvedOptions = normalizeUsersDirectReportsOptions(options);
356
- const params = { id: userId };
357
- setUsersIfDefined(params, "$select", normalizeUsersSelect(pickUsersValue(resolvedOptions.select, resolvedOptions.$select)));
358
- setUsersIfDefined(params, "$top", pickUsersValue(resolvedOptions.top, resolvedOptions.$top));
359
- return execOp("DirectReports_V2", params);
360
- }
361
-
362
- export async function getMyTrendingDocuments(options = {}) {
363
- const resolvedOptions = normalizeUsersTrendingOptions(options);
364
- const params = {};
365
- setUsersIfDefined(params, "$filter", pickUsersValue(resolvedOptions.filter, resolvedOptions.$filter));
366
- setUsersIfDefined(params, "extractSensitivityLabel", resolvedOptions.extractSensitivityLabel);
367
- setUsersIfDefined(params, "fetchSensitivityLabelMetadata", resolvedOptions.fetchSensitivityLabelMetadata);
368
- return execOp("MyTrendingDocuments", params);
369
- }
370
-
371
- export async function getRelevantPeople(userId) {
372
- if (isUsersObject(userId)) {
373
- userId = pickUsersValue(userId.userId, userId.id);
374
- }
375
-
376
- return execOp("RelevantPeople", { userId });
377
- }
378
-
379
- // ═══════════════════════════════════════════════════════════════
380
- // PHOTO
381
- // ═══════════════════════════════════════════════════════════════
382
-
383
- // ── Get User Photo ─────────────────────────────────────────────
384
- export async function updateMyPhoto(bodyOrOptions, contentType) {
385
- if (isUsersObject(bodyOrOptions)) {
386
- contentType = pickUsersValue(bodyOrOptions.contentType, bodyOrOptions.Content_Type, bodyOrOptions.mimeType);
387
- bodyOrOptions = pickUsersValue(bodyOrOptions.body, bodyOrOptions.content, bodyOrOptions.photo, bodyOrOptions.fileContent);
388
- }
389
-
390
- return execOp("UpdateMyPhoto", {
391
- body: bodyOrOptions,
392
- Content_Type: contentType,
393
- });
394
- }
395
-
396
- export async function getUserPhotoMetadata(userId) {
397
- if (isUsersObject(userId)) {
398
- userId = pickUsersValue(userId.userId, userId.id);
399
- }
400
-
401
- return execOp("UserPhotoMetadata", { userId });
402
- }
403
-
404
- export async function getUserPhoto(userId) {
405
- if (isUsersObject(userId)) {
406
- userId = pickUsersValue(userId.userId, userId.id);
407
- }
408
-
409
- return execOp("UserPhoto_V2", { id: userId });
410
- }
411
-
412
- export async function getTrendingDocuments(userId, options = {}) {
413
- if (isUsersObject(userId)) {
414
- options = userId;
415
- userId = pickUsersValue(options.userId, options.id);
416
- }
417
-
418
- const resolvedOptions = normalizeUsersTrendingOptions(options);
419
- const params = { id: userId };
420
- setUsersIfDefined(params, "$filter", pickUsersValue(resolvedOptions.filter, resolvedOptions.$filter));
421
- setUsersIfDefined(params, "extractSensitivityLabel", resolvedOptions.extractSensitivityLabel);
422
- setUsersIfDefined(params, "fetchSensitivityLabelMetadata", resolvedOptions.fetchSensitivityLabelMetadata);
423
- return execOp("TrendingDocuments", params);
424
- }
425
-
426
- // ═══════════════════════════════════════════════════════════════
427
- // SEARCH
428
- // ═══════════════════════════════════════════════════════════════
429
-
430
- // ── Search for Users ───────────────────────────────────────────
431
- export async function searchForUsers(options = {}) {
432
- const resolvedOptions = normalizeUsersSearchOptions(options);
433
- const params = {};
434
- setUsersIfDefined(params, "searchTerm", resolvedOptions.searchTerm);
435
- setUsersIfDefined(params, "top", pickUsersValue(resolvedOptions.top, resolvedOptions.$top));
436
- setUsersIfDefined(params, "isSearchTermRequired", resolvedOptions.isSearchTermRequired);
437
-
438
- const skipToken = pickUsersValue(
439
- resolvedOptions.skipToken,
440
- resolvedOptions.$skipToken,
441
- resolvedOptions.$skiptoken,
442
- extractUsersSkipToken(resolvedOptions.nextLink),
443
- resolvedOptions.skip
444
- );
445
-
446
- if (skipToken !== undefined && skipToken !== null) {
447
- params.skipToken = String(skipToken);
448
- }
449
-
450
- return execOp("SearchUserV2", params);
451
- }