@smartbear/mcp 0.6.0 → 0.7.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 +20 -3
- package/dist/api-hub/client/api.js +253 -0
- package/dist/api-hub/client/configuration.js +27 -0
- package/dist/api-hub/client/index.js +5 -0
- package/dist/api-hub/client/portal-types.js +131 -0
- package/dist/api-hub/client/registry-types.js +55 -0
- package/dist/api-hub/client/tools.js +86 -0
- package/dist/api-hub/client.js +64 -404
- package/dist/bugsnag/client/api/CurrentUser.js +16 -10
- package/dist/bugsnag/client/api/Error.js +35 -35
- package/dist/bugsnag/client/api/Project.js +21 -9
- package/dist/bugsnag/client/api/base.js +7 -4
- package/dist/bugsnag/client/api/filters.js +9 -9
- package/dist/bugsnag/client.js +165 -140
- package/dist/common/info.js +1 -1
- package/dist/common/server.js +35 -27
- package/dist/index.js +11 -4
- package/dist/pactflow/client/ai.js +20 -20
- package/dist/pactflow/client/base.js +48 -13
- package/dist/pactflow/client/prompts.js +10 -12
- package/dist/pactflow/client/tools.js +10 -10
- package/dist/pactflow/client/utils.js +1 -1
- package/dist/pactflow/client.js +16 -9
- package/dist/qmetry/client/api/client-api.js +39 -0
- package/dist/qmetry/client/handlers.js +11 -0
- package/dist/qmetry/client/project.js +27 -0
- package/dist/qmetry/client/testcase.js +104 -0
- package/dist/qmetry/client/tools.js +222 -0
- package/dist/qmetry/client.js +95 -0
- package/dist/qmetry/config/constants.js +12 -0
- package/dist/qmetry/config/rest-endpoints.js +11 -0
- package/dist/qmetry/types/common.js +174 -0
- package/dist/qmetry/types/testcase.js +19 -0
- package/dist/reflect/client.js +14 -14
- package/package.json +6 -5
package/dist/api-hub/client.js
CHANGED
|
@@ -1,429 +1,89 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { MCP_SERVER_NAME, MCP_SERVER_VERSION } from "../common/info.js";
|
|
2
|
+
import { ApiHubAPI, ApiHubConfiguration, TOOLS, } from "./client/index.js";
|
|
3
3
|
// Tool definitions for API Hub API client
|
|
4
4
|
export class ApiHubClient {
|
|
5
|
-
|
|
5
|
+
config;
|
|
6
|
+
api;
|
|
6
7
|
name = "API Hub";
|
|
7
8
|
prefix = "api_hub";
|
|
8
9
|
constructor(token) {
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
"Content-Type": "application/json",
|
|
12
|
-
"User-Agent": `${MCP_SERVER_NAME}/${MCP_SERVER_VERSION}`,
|
|
13
|
-
};
|
|
10
|
+
this.config = new ApiHubConfiguration({ token });
|
|
11
|
+
this.api = new ApiHubAPI(this.config, `${MCP_SERVER_NAME}/${MCP_SERVER_VERSION}`);
|
|
14
12
|
}
|
|
13
|
+
// Delegate API methods to the ApiHubAPI instance
|
|
15
14
|
async getPortals() {
|
|
16
|
-
|
|
17
|
-
method: "GET",
|
|
18
|
-
headers: this.headers,
|
|
19
|
-
});
|
|
20
|
-
return response.json();
|
|
15
|
+
return this.api.getPortals();
|
|
21
16
|
}
|
|
22
17
|
async createPortal(body) {
|
|
23
|
-
|
|
24
|
-
method: "POST",
|
|
25
|
-
headers: this.headers,
|
|
26
|
-
body: JSON.stringify(body),
|
|
27
|
-
});
|
|
28
|
-
return response.json();
|
|
18
|
+
return this.api.createPortal(body);
|
|
29
19
|
}
|
|
30
|
-
async getPortal(
|
|
31
|
-
|
|
32
|
-
method: "GET",
|
|
33
|
-
headers: this.headers,
|
|
34
|
-
});
|
|
35
|
-
return response.json();
|
|
20
|
+
async getPortal(args) {
|
|
21
|
+
return this.api.getPortal(args.portalId);
|
|
36
22
|
}
|
|
37
|
-
async deletePortal(
|
|
38
|
-
|
|
39
|
-
method: "DELETE",
|
|
40
|
-
headers: this.headers,
|
|
41
|
-
});
|
|
23
|
+
async deletePortal(args) {
|
|
24
|
+
return this.api.deletePortal(args.portalId);
|
|
42
25
|
}
|
|
43
|
-
async updatePortal(
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
headers: this.headers,
|
|
47
|
-
body: JSON.stringify(body),
|
|
48
|
-
});
|
|
49
|
-
return response.json();
|
|
26
|
+
async updatePortal(args) {
|
|
27
|
+
const { portalId, ...body } = args;
|
|
28
|
+
return this.api.updatePortal(portalId, body);
|
|
50
29
|
}
|
|
51
|
-
async getPortalProducts(
|
|
52
|
-
|
|
53
|
-
method: "GET",
|
|
54
|
-
headers: this.headers,
|
|
55
|
-
});
|
|
56
|
-
return response.json();
|
|
30
|
+
async getPortalProducts(args) {
|
|
31
|
+
return this.api.getPortalProducts(args.portalId);
|
|
57
32
|
}
|
|
58
|
-
async createPortalProduct(
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
headers: this.headers,
|
|
62
|
-
body: JSON.stringify(body),
|
|
63
|
-
});
|
|
64
|
-
return response.json();
|
|
33
|
+
async createPortalProduct(args) {
|
|
34
|
+
const { portalId, ...body } = args;
|
|
35
|
+
return this.api.createPortalProduct(portalId, body);
|
|
65
36
|
}
|
|
66
|
-
async getPortalProduct(
|
|
67
|
-
|
|
68
|
-
method: "GET",
|
|
69
|
-
headers: this.headers,
|
|
70
|
-
});
|
|
71
|
-
return response.json();
|
|
37
|
+
async getPortalProduct(args) {
|
|
38
|
+
return this.api.getPortalProduct(args.productId);
|
|
72
39
|
}
|
|
73
|
-
async deletePortalProduct(
|
|
74
|
-
|
|
75
|
-
method: "DELETE",
|
|
76
|
-
headers: this.headers,
|
|
77
|
-
});
|
|
40
|
+
async deletePortalProduct(args) {
|
|
41
|
+
return this.api.deletePortalProduct(args.productId);
|
|
78
42
|
}
|
|
79
|
-
async updatePortalProduct(
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
43
|
+
async updatePortalProduct(args) {
|
|
44
|
+
const { productId, ...body } = args;
|
|
45
|
+
return this.api.updatePortalProduct(productId, body);
|
|
46
|
+
}
|
|
47
|
+
// Registry API methods for SwaggerHub Design functionality
|
|
48
|
+
async searchApis(args = {}) {
|
|
49
|
+
return this.api.searchApis(args);
|
|
50
|
+
}
|
|
51
|
+
async getApiDefinition(args) {
|
|
52
|
+
return this.api.getApiDefinition(args);
|
|
86
53
|
}
|
|
87
54
|
registerTools(register, _getInput) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
name: "subdomain",
|
|
110
|
-
type: z.string(),
|
|
111
|
-
required: true,
|
|
112
|
-
description: "The portal subdomain.",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "offline",
|
|
116
|
-
type: z.boolean(),
|
|
117
|
-
required: false,
|
|
118
|
-
description: "If set to true the portal will not be visible to customers.",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "routing",
|
|
122
|
-
type: z.string(),
|
|
123
|
-
required: false,
|
|
124
|
-
description: "Determines the routing strategy ('browser' or 'proxy').",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "credentialsEnabled",
|
|
128
|
-
type: z.string(),
|
|
129
|
-
required: false,
|
|
130
|
-
description: "Indicates if credentials are enabled for the portal.",
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "swaggerHubOrganizationId",
|
|
134
|
-
type: z.string(),
|
|
135
|
-
required: true,
|
|
136
|
-
description: "The corresponding API Hub (formerly SwaggerHub) organization UUID.",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "openapiRenderer",
|
|
140
|
-
type: z.string(),
|
|
141
|
-
required: false,
|
|
142
|
-
description: "Portal level setting for the OpenAPI renderer. SWAGGER_UI - Use the Swagger UI renderer. ELEMENTS - Use the Elements renderer. TOGGLE - Switch between the two renderers with elements set as the default.",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "pageContentFormat",
|
|
146
|
-
type: z.string(),
|
|
147
|
-
required: false,
|
|
148
|
-
description: "The format of the page content.",
|
|
55
|
+
TOOLS.forEach((tool) => {
|
|
56
|
+
const { handler, formatResponse, ...toolParams } = tool;
|
|
57
|
+
register(toolParams, async (args, _extra) => {
|
|
58
|
+
try {
|
|
59
|
+
// Dynamic method invocation
|
|
60
|
+
const handlerFn = this[handler];
|
|
61
|
+
if (typeof handlerFn !== "function") {
|
|
62
|
+
throw new Error(`Handler '${handler}' not found on ApiHubClient`);
|
|
63
|
+
}
|
|
64
|
+
const result = await handlerFn.call(this, args);
|
|
65
|
+
// Use custom formatter if available, otherwise return JSON
|
|
66
|
+
const formattedResult = formatResponse
|
|
67
|
+
? formatResponse(result)
|
|
68
|
+
: result;
|
|
69
|
+
const responseText = typeof formattedResult === "string"
|
|
70
|
+
? formattedResult
|
|
71
|
+
: JSON.stringify(formattedResult);
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: "text", text: responseText }],
|
|
74
|
+
};
|
|
149
75
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
title: "Get Portal",
|
|
160
|
-
summary: "Retrieve information about a specific portal.",
|
|
161
|
-
parameters: [
|
|
162
|
-
{
|
|
163
|
-
name: "portalId",
|
|
164
|
-
type: z.string(),
|
|
165
|
-
description: "Portal UUID or subdomain.",
|
|
166
|
-
required: true
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
}, async (args, _extra) => {
|
|
170
|
-
const portalArgs = args;
|
|
171
|
-
const response = await this.getPortal(portalArgs.portalId);
|
|
172
|
-
return {
|
|
173
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
174
|
-
};
|
|
175
|
-
});
|
|
176
|
-
register({
|
|
177
|
-
title: "Delete Portal",
|
|
178
|
-
summary: "Delete a specific portal.",
|
|
179
|
-
parameters: [
|
|
180
|
-
{
|
|
181
|
-
name: "portalId",
|
|
182
|
-
type: z.string(),
|
|
183
|
-
description: "Portal UUID or subdomain.",
|
|
184
|
-
required: true
|
|
185
|
-
}
|
|
186
|
-
],
|
|
187
|
-
}, async (args, _extra) => {
|
|
188
|
-
const portalArgs = args;
|
|
189
|
-
await this.deletePortal(portalArgs.portalId);
|
|
190
|
-
return {
|
|
191
|
-
content: [{ type: "text", text: "Portal deleted successfully." }],
|
|
192
|
-
};
|
|
193
|
-
});
|
|
194
|
-
register({
|
|
195
|
-
title: "Update Portal",
|
|
196
|
-
summary: "Update a specific portal's configuration.",
|
|
197
|
-
parameters: [
|
|
198
|
-
{
|
|
199
|
-
name: "portalId",
|
|
200
|
-
type: z.string(),
|
|
201
|
-
description: "Portal UUID or subdomain.",
|
|
202
|
-
required: true
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: "name",
|
|
206
|
-
type: z.string(),
|
|
207
|
-
description: "The portal name.",
|
|
208
|
-
required: false
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: "subdomain",
|
|
212
|
-
type: z.string(),
|
|
213
|
-
description: "The portal subdomain.",
|
|
214
|
-
required: false
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "customDomain",
|
|
218
|
-
type: z.boolean(),
|
|
219
|
-
description: "Indicates if the portal has a custom domain.",
|
|
220
|
-
required: false
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: "gtmKey",
|
|
224
|
-
type: z.string(),
|
|
225
|
-
description: "Google Tag Manager key for the portal.",
|
|
226
|
-
required: false
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: "offline",
|
|
230
|
-
type: z.boolean(),
|
|
231
|
-
description: "If set to true the portal will not be visible to customers.",
|
|
232
|
-
required: false
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "routing",
|
|
236
|
-
type: z.string(),
|
|
237
|
-
description: "Determines the routing strategy ('browser' or 'proxy').",
|
|
238
|
-
required: false
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: "credentialsEnabled",
|
|
242
|
-
type: z.boolean(),
|
|
243
|
-
description: "Indicates if credentials are enabled for the portal.",
|
|
244
|
-
required: false
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "openapiRenderer",
|
|
248
|
-
type: z.string(),
|
|
249
|
-
description: "Portal level setting for the OpenAPI renderer. SWAGGER_UI - Use the Swagger UI renderer. ELEMENTS - Use the Elements renderer. TOGGLE - Switch between the two renderers with elements set as the default.",
|
|
250
|
-
required: false
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: "pageContentFormat",
|
|
254
|
-
type: z.string(),
|
|
255
|
-
description: "The format of the page content.",
|
|
256
|
-
required: false
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
}, async (args, _extra) => {
|
|
260
|
-
const updatePortalArgs = args;
|
|
261
|
-
const response = await this.updatePortal(updatePortalArgs.portalId, updatePortalArgs);
|
|
262
|
-
return {
|
|
263
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
register({
|
|
267
|
-
title: "List Portal Products",
|
|
268
|
-
summary: "Get products for a specific portal that match your criteria.",
|
|
269
|
-
parameters: [
|
|
270
|
-
{
|
|
271
|
-
name: "portalId",
|
|
272
|
-
type: z.string(),
|
|
273
|
-
description: "Portal UUID or subdomain.",
|
|
274
|
-
required: true
|
|
275
|
-
}
|
|
276
|
-
],
|
|
277
|
-
}, async (args, _extra) => {
|
|
278
|
-
const portalArgs = args;
|
|
279
|
-
const response = await this.getPortalProducts(portalArgs.portalId);
|
|
280
|
-
return {
|
|
281
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
282
|
-
};
|
|
283
|
-
});
|
|
284
|
-
register({
|
|
285
|
-
title: "Create Portal Product",
|
|
286
|
-
summary: "Create a new product for a specific portal.",
|
|
287
|
-
parameters: [
|
|
288
|
-
{
|
|
289
|
-
name: "portalId",
|
|
290
|
-
type: z.string(),
|
|
291
|
-
description: "Portal UUID or subdomain.",
|
|
292
|
-
required: true
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: "type",
|
|
296
|
-
type: z.string(),
|
|
297
|
-
description: "Product type (Allowed values: 'new', 'copy').",
|
|
298
|
-
required: true
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: "name",
|
|
302
|
-
type: z.string(),
|
|
303
|
-
description: "Product name.",
|
|
304
|
-
required: true
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
name: "slug",
|
|
308
|
-
type: z.string(),
|
|
309
|
-
description: "URL component for this product. Must be unique within the portal.",
|
|
310
|
-
required: true
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: "description",
|
|
314
|
-
type: z.string(),
|
|
315
|
-
description: "Product description.",
|
|
316
|
-
required: false
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
name: "public",
|
|
320
|
-
type: z.boolean(),
|
|
321
|
-
description: "Indicates if the product is public.",
|
|
322
|
-
required: false
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
name: "hidden",
|
|
326
|
-
type: z.string(),
|
|
327
|
-
description: "Indicates if the product is hidden.",
|
|
328
|
-
required: false
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
name: "role",
|
|
332
|
-
type: z.boolean(),
|
|
333
|
-
description: "Indicates if the product has a role.",
|
|
334
|
-
required: false
|
|
335
|
-
}
|
|
336
|
-
],
|
|
337
|
-
}, async (args, _extra) => {
|
|
338
|
-
const createProductArgs = args;
|
|
339
|
-
const response = await this.createPortalProduct(createProductArgs.portalId, createProductArgs);
|
|
340
|
-
return {
|
|
341
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
342
|
-
};
|
|
343
|
-
});
|
|
344
|
-
register({
|
|
345
|
-
title: "Get Portal Product",
|
|
346
|
-
summary: "Retrieve information about a specific product resource.",
|
|
347
|
-
parameters: [
|
|
348
|
-
{
|
|
349
|
-
name: "productId",
|
|
350
|
-
type: z.string(),
|
|
351
|
-
description: "Product UUID, or identifier in the format.",
|
|
352
|
-
required: true
|
|
353
|
-
}
|
|
354
|
-
],
|
|
355
|
-
}, async (args, _extra) => {
|
|
356
|
-
const productArgs = args;
|
|
357
|
-
const response = await this.getPortalProduct(productArgs.productId);
|
|
358
|
-
return {
|
|
359
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
360
|
-
};
|
|
361
|
-
});
|
|
362
|
-
register({
|
|
363
|
-
title: "Delete Portal Product",
|
|
364
|
-
summary: "Delete a product from a specific portal",
|
|
365
|
-
parameters: [
|
|
366
|
-
{
|
|
367
|
-
name: "productId",
|
|
368
|
-
type: z.string(),
|
|
369
|
-
description: "Product UUID, or identifier in the format.",
|
|
370
|
-
required: true
|
|
371
|
-
}
|
|
372
|
-
],
|
|
373
|
-
}, async (args, _extra) => {
|
|
374
|
-
const productArgs = args;
|
|
375
|
-
await this.deletePortalProduct(productArgs.productId);
|
|
376
|
-
return {
|
|
377
|
-
content: [{ type: "text", text: "Product deleted successfully." }],
|
|
378
|
-
};
|
|
379
|
-
});
|
|
380
|
-
register({
|
|
381
|
-
title: "Update Portal Product",
|
|
382
|
-
summary: "Update a product's settings within a specific portal.",
|
|
383
|
-
parameters: [
|
|
384
|
-
{
|
|
385
|
-
name: "productId",
|
|
386
|
-
type: z.string(),
|
|
387
|
-
description: "Product UUID, or identifier in the format.",
|
|
388
|
-
required: true
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
name: "name",
|
|
392
|
-
type: z.string(),
|
|
393
|
-
description: "Product name.",
|
|
394
|
-
required: false
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
name: "slug",
|
|
398
|
-
type: z.string(),
|
|
399
|
-
description: "URL component for this product. Must be unique within the portal.",
|
|
400
|
-
required: false
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
name: "description",
|
|
404
|
-
type: z.string(),
|
|
405
|
-
description: "Product description.",
|
|
406
|
-
required: false
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
name: "public",
|
|
410
|
-
type: z.boolean(),
|
|
411
|
-
description: "Indicates if the product is public.",
|
|
412
|
-
required: false
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: "hidden",
|
|
416
|
-
type: z.string(),
|
|
417
|
-
description: "Indicates if the product is hidden.",
|
|
418
|
-
required: false
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: "text",
|
|
81
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
419
85
|
}
|
|
420
|
-
|
|
421
|
-
}, async (args, _extra) => {
|
|
422
|
-
const updateProductArgs = args;
|
|
423
|
-
const response = await this.updatePortalProduct(updateProductArgs.productId, updateProductArgs);
|
|
424
|
-
return {
|
|
425
|
-
content: [{ type: "text", text: JSON.stringify(response) }],
|
|
426
|
-
};
|
|
86
|
+
});
|
|
427
87
|
});
|
|
428
88
|
}
|
|
429
89
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { BaseAPI, pickFieldsFromArray } from
|
|
1
|
+
import { BaseAPI, pickFieldsFromArray } from "./base.js";
|
|
2
2
|
// --- API Class ---
|
|
3
3
|
export class CurrentUserAPI extends BaseAPI {
|
|
4
|
-
static filterFields = [
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
static filterFields = [
|
|
5
|
+
"collaborators_url",
|
|
6
|
+
"projects_url",
|
|
7
|
+
"upgrade_url",
|
|
8
|
+
];
|
|
9
|
+
static organizationFields = ["id", "name", "slug"];
|
|
10
|
+
static projectFields = ["id", "name", "slug", "api_key"];
|
|
7
11
|
constructor(configuration) {
|
|
8
12
|
super(configuration, CurrentUserAPI.filterFields);
|
|
9
13
|
}
|
|
@@ -15,20 +19,22 @@ export class CurrentUserAPI extends BaseAPI {
|
|
|
15
19
|
const { admin, paginate = false, ...queryOptions } = options;
|
|
16
20
|
const params = new URLSearchParams();
|
|
17
21
|
if (admin !== undefined)
|
|
18
|
-
params.append(
|
|
22
|
+
params.append("admin", String(admin));
|
|
19
23
|
for (const [key, value] of Object.entries(queryOptions)) {
|
|
20
24
|
if (value !== undefined)
|
|
21
25
|
params.append(key, String(value));
|
|
22
26
|
}
|
|
23
|
-
const url = params.toString()
|
|
27
|
+
const url = params.toString()
|
|
28
|
+
? `/user/organizations?${params}`
|
|
29
|
+
: "/user/organizations";
|
|
24
30
|
const data = await this.request({
|
|
25
|
-
method:
|
|
31
|
+
method: "GET",
|
|
26
32
|
url,
|
|
27
33
|
}, paginate);
|
|
28
34
|
// Only return allowed fields
|
|
29
35
|
return {
|
|
30
36
|
...data,
|
|
31
|
-
body: pickFieldsFromArray(data.body || [], CurrentUserAPI.organizationFields)
|
|
37
|
+
body: pickFieldsFromArray(data.body || [], CurrentUserAPI.organizationFields),
|
|
32
38
|
};
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
@@ -49,12 +55,12 @@ export class CurrentUserAPI extends BaseAPI {
|
|
|
49
55
|
? `/organizations/${organizationId}/projects?${params}`
|
|
50
56
|
: `/organizations/${organizationId}/projects`;
|
|
51
57
|
const data = await this.request({
|
|
52
|
-
method:
|
|
58
|
+
method: "GET",
|
|
53
59
|
url,
|
|
54
60
|
}, true); // Always paginate for projects
|
|
55
61
|
return {
|
|
56
62
|
...data,
|
|
57
|
-
body: pickFieldsFromArray(data.body || [], CurrentUserAPI.projectFields)
|
|
63
|
+
body: pickFieldsFromArray(data.body || [], CurrentUserAPI.projectFields),
|
|
58
64
|
};
|
|
59
65
|
}
|
|
60
66
|
}
|