@stack-spot/portal-network 0.77.0 → 0.78.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.
@@ -0,0 +1,359 @@
1
+ /**
2
+ * FastAPI
3
+ * 0.1.0
4
+ * DO NOT MODIFY - This file has been generated using oazapfts.
5
+ * See https://www.npmjs.com/package/oazapfts
6
+ */
7
+ import * as Oazapfts from "@oazapfts/runtime";
8
+ import * as QS from "@oazapfts/runtime/query";
9
+ export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
10
+ headers: {},
11
+ baseUrl: "/",
12
+ };
13
+ const oazapfts = Oazapfts.runtime(defaults);
14
+ export const servers = {};
15
+ export type NewWorkspaceRequest = {
16
+ name: string;
17
+ slug: string;
18
+ description?: string | null;
19
+ logo?: string | null;
20
+ };
21
+ export type NewWorkspaceResponse = {
22
+ id: string;
23
+ };
24
+ export type ValidationError = {
25
+ loc: (string | number)[];
26
+ msg: string;
27
+ "type": string;
28
+ };
29
+ export type HttpValidationError = {
30
+ detail?: ValidationError[];
31
+ };
32
+ export type WorkspaceResponse = {
33
+ id: string;
34
+ slug: string;
35
+ name: string;
36
+ description: string | null;
37
+ logo: string | null;
38
+ created_by: string;
39
+ };
40
+ export type UpdateWorkspaceRequest = {
41
+ name: string;
42
+ description?: string | null;
43
+ logo?: string | null;
44
+ };
45
+ export type Action = "edit" | "read" | "manager";
46
+ export type PermissionListRequest = {
47
+ identifier: string;
48
+ action: Action;
49
+ };
50
+ export type PermissionType = "group" | "member";
51
+ export type WorkspacePermissionRequest = {
52
+ permission_list: PermissionListRequest[];
53
+ permission_type: PermissionType;
54
+ };
55
+ export type ResourceType = "knowledge_source" | "quick_command" | "agent" | "stack";
56
+ export type AddWorkspaceResourceRequest = {
57
+ resource_identifier: string[];
58
+ is_account_resource: boolean;
59
+ };
60
+ /**
61
+ * Create Workspace
62
+ */
63
+ export function createWorkspaceV1WorkspacesPost({ authorization, xAccountId, newWorkspaceRequest }: {
64
+ authorization: string;
65
+ xAccountId?: string | null;
66
+ newWorkspaceRequest: NewWorkspaceRequest;
67
+ }, opts?: Oazapfts.RequestOpts) {
68
+ return oazapfts.ok(oazapfts.fetchJson<{
69
+ status: 201;
70
+ data: NewWorkspaceResponse;
71
+ } | {
72
+ status: 404;
73
+ } | {
74
+ status: 422;
75
+ data: HttpValidationError;
76
+ }>("/v1/workspaces", oazapfts.json({
77
+ ...opts,
78
+ method: "POST",
79
+ body: newWorkspaceRequest,
80
+ headers: oazapfts.mergeHeaders(opts?.headers, {
81
+ authorization,
82
+ "x-account-id": xAccountId
83
+ })
84
+ })));
85
+ }
86
+ /**
87
+ * List Workspaces
88
+ */
89
+ export function listWorkspacesV1WorkspacesGet({ authorization, xAccountId }: {
90
+ authorization: string;
91
+ xAccountId?: string | null;
92
+ }, opts?: Oazapfts.RequestOpts) {
93
+ return oazapfts.ok(oazapfts.fetchJson<{
94
+ status: 200;
95
+ data: WorkspaceResponse[];
96
+ } | {
97
+ status: 404;
98
+ } | {
99
+ status: 422;
100
+ data: HttpValidationError;
101
+ }>("/v1/workspaces", {
102
+ ...opts,
103
+ headers: oazapfts.mergeHeaders(opts?.headers, {
104
+ authorization,
105
+ "x-account-id": xAccountId
106
+ })
107
+ }));
108
+ }
109
+ /**
110
+ * Get Workspace By Slug
111
+ */
112
+ export function getWorkspaceBySlugV1WorkspacesIdGet({ id, authorization, xAccountId }: {
113
+ id: string;
114
+ authorization: string;
115
+ xAccountId?: string | null;
116
+ }, opts?: Oazapfts.RequestOpts) {
117
+ return oazapfts.ok(oazapfts.fetchJson<{
118
+ status: 200;
119
+ data: WorkspaceResponse;
120
+ } | {
121
+ status: 404;
122
+ } | {
123
+ status: 422;
124
+ data: HttpValidationError;
125
+ }>(`/v1/workspaces/${encodeURIComponent(id)}`, {
126
+ ...opts,
127
+ headers: oazapfts.mergeHeaders(opts?.headers, {
128
+ authorization,
129
+ "x-account-id": xAccountId
130
+ })
131
+ }));
132
+ }
133
+ /**
134
+ * Update Workspace
135
+ */
136
+ export function updateWorkspaceV1WorkspacesWorkspaceIdPatch({ workspaceId, authorization, xAccountId, updateWorkspaceRequest }: {
137
+ workspaceId: string;
138
+ authorization: string;
139
+ xAccountId?: string | null;
140
+ updateWorkspaceRequest: UpdateWorkspaceRequest;
141
+ }, opts?: Oazapfts.RequestOpts) {
142
+ return oazapfts.ok(oazapfts.fetchJson<{
143
+ status: 204;
144
+ } | {
145
+ status: 404;
146
+ } | {
147
+ status: 422;
148
+ data: HttpValidationError;
149
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}`, oazapfts.json({
150
+ ...opts,
151
+ method: "PATCH",
152
+ body: updateWorkspaceRequest,
153
+ headers: oazapfts.mergeHeaders(opts?.headers, {
154
+ authorization,
155
+ "x-account-id": xAccountId
156
+ })
157
+ })));
158
+ }
159
+ /**
160
+ * Delete Workspace
161
+ */
162
+ export function deleteWorkspaceV1WorkspacesWorkspaceIdDelete({ workspaceId, authorization, xAccountId }: {
163
+ workspaceId: string;
164
+ authorization: string;
165
+ xAccountId?: string | null;
166
+ }, opts?: Oazapfts.RequestOpts) {
167
+ return oazapfts.ok(oazapfts.fetchJson<{
168
+ status: 204;
169
+ } | {
170
+ status: 404;
171
+ } | {
172
+ status: 422;
173
+ data: HttpValidationError;
174
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}`, {
175
+ ...opts,
176
+ method: "DELETE",
177
+ headers: oazapfts.mergeHeaders(opts?.headers, {
178
+ authorization,
179
+ "x-account-id": xAccountId
180
+ })
181
+ }));
182
+ }
183
+ /**
184
+ * Add Permission
185
+ */
186
+ export function addPermissionV1WorkspacesWorkspaceIdPermissionPatch({ workspaceId, authorization, xAccountId, workspacePermissionRequest }: {
187
+ workspaceId: string;
188
+ authorization: string;
189
+ xAccountId?: string | null;
190
+ workspacePermissionRequest: WorkspacePermissionRequest;
191
+ }, opts?: Oazapfts.RequestOpts) {
192
+ return oazapfts.ok(oazapfts.fetchJson<{
193
+ status: 204;
194
+ } | {
195
+ status: 404;
196
+ } | {
197
+ status: 422;
198
+ data: HttpValidationError;
199
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/permission`, oazapfts.json({
200
+ ...opts,
201
+ method: "PATCH",
202
+ body: workspacePermissionRequest,
203
+ headers: oazapfts.mergeHeaders(opts?.headers, {
204
+ authorization,
205
+ "x-account-id": xAccountId
206
+ })
207
+ })));
208
+ }
209
+ /**
210
+ * Remove Permission
211
+ */
212
+ export function removePermissionV1WorkspacesWorkspaceIdPermissionDelete({ workspaceId, authorization, xAccountId, workspacePermissionRequest }: {
213
+ workspaceId: string;
214
+ authorization: string;
215
+ xAccountId?: string | null;
216
+ workspacePermissionRequest: WorkspacePermissionRequest;
217
+ }, opts?: Oazapfts.RequestOpts) {
218
+ return oazapfts.ok(oazapfts.fetchJson<{
219
+ status: 204;
220
+ } | {
221
+ status: 404;
222
+ } | {
223
+ status: 422;
224
+ data: HttpValidationError;
225
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/permission`, oazapfts.json({
226
+ ...opts,
227
+ method: "DELETE",
228
+ body: workspacePermissionRequest,
229
+ headers: oazapfts.mergeHeaders(opts?.headers, {
230
+ authorization,
231
+ "x-account-id": xAccountId
232
+ })
233
+ })));
234
+ }
235
+ /**
236
+ * List Groups Permission In Workspace
237
+ */
238
+ export function listGroupsPermissionInWorkspaceV1WorkspacesWorkspaceIdPermissionsGet({ workspaceId, authorization, xAccountId }: {
239
+ workspaceId: string;
240
+ authorization: string;
241
+ xAccountId?: string | null;
242
+ }, opts?: Oazapfts.RequestOpts) {
243
+ return oazapfts.ok(oazapfts.fetchJson<{
244
+ status: 200;
245
+ data: object;
246
+ } | {
247
+ status: 404;
248
+ } | {
249
+ status: 422;
250
+ data: HttpValidationError;
251
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/permissions`, {
252
+ ...opts,
253
+ headers: oazapfts.mergeHeaders(opts?.headers, {
254
+ authorization,
255
+ "x-account-id": xAccountId
256
+ })
257
+ }));
258
+ }
259
+ /**
260
+ * Add Resource
261
+ */
262
+ export function addResourceV1WorkspacesWorkspaceIdResourceTypePost({ workspaceId, resourceType, authorization, xAccountId, addWorkspaceResourceRequest }: {
263
+ workspaceId: string;
264
+ resourceType: ResourceType;
265
+ authorization: string;
266
+ xAccountId?: string | null;
267
+ addWorkspaceResourceRequest: AddWorkspaceResourceRequest;
268
+ }, opts?: Oazapfts.RequestOpts) {
269
+ return oazapfts.ok(oazapfts.fetchJson<{
270
+ status: 200;
271
+ data: object;
272
+ } | {
273
+ status: 404;
274
+ } | {
275
+ status: 422;
276
+ data: HttpValidationError;
277
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(resourceType)}`, oazapfts.json({
278
+ ...opts,
279
+ method: "POST",
280
+ body: addWorkspaceResourceRequest,
281
+ headers: oazapfts.mergeHeaders(opts?.headers, {
282
+ authorization,
283
+ "x-account-id": xAccountId
284
+ })
285
+ })));
286
+ }
287
+ /**
288
+ * List All By Resource Type
289
+ */
290
+ export function listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet({ workspaceId, resourceType, authorization, xAccountId }: {
291
+ workspaceId: string;
292
+ resourceType: ResourceType;
293
+ authorization: string;
294
+ xAccountId?: string | null;
295
+ }, opts?: Oazapfts.RequestOpts) {
296
+ return oazapfts.ok(oazapfts.fetchJson<{
297
+ status: 200;
298
+ data: any;
299
+ } | {
300
+ status: 404;
301
+ } | {
302
+ status: 422;
303
+ data: HttpValidationError;
304
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(resourceType)}`, {
305
+ ...opts,
306
+ headers: oazapfts.mergeHeaders(opts?.headers, {
307
+ authorization,
308
+ "x-account-id": xAccountId
309
+ })
310
+ }));
311
+ }
312
+ /**
313
+ * Remove Resource
314
+ */
315
+ export function removeResourceV1WorkspacesWorkspaceIdResourceTypeResourceIdDelete({ workspaceId, resourceType, resourceId, authorization, xAccountId }: {
316
+ workspaceId: string;
317
+ resourceType: ResourceType;
318
+ resourceId: string;
319
+ authorization: string;
320
+ xAccountId?: string | null;
321
+ }, opts?: Oazapfts.RequestOpts) {
322
+ return oazapfts.ok(oazapfts.fetchJson<{
323
+ status: 204;
324
+ } | {
325
+ status: 404;
326
+ } | {
327
+ status: 422;
328
+ data: HttpValidationError;
329
+ }>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}`, {
330
+ ...opts,
331
+ method: "DELETE",
332
+ headers: oazapfts.mergeHeaders(opts?.headers, {
333
+ authorization,
334
+ "x-account-id": xAccountId
335
+ })
336
+ }));
337
+ }
338
+ /**
339
+ * Healthz
340
+ */
341
+ export function healthzHealthzGet(opts?: Oazapfts.RequestOpts) {
342
+ return oazapfts.ok(oazapfts.fetchJson<{
343
+ status: 200;
344
+ data: any;
345
+ }>("/healthz", {
346
+ ...opts
347
+ }));
348
+ }
349
+ /**
350
+ * Base Get
351
+ */
352
+ export function baseGetGet(opts?: Oazapfts.RequestOpts) {
353
+ return oazapfts.ok(oazapfts.fetchJson<{
354
+ status: 200;
355
+ data: any;
356
+ }>("/", {
357
+ ...opts
358
+ }));
359
+ }
package/src/apis.json CHANGED
@@ -7,6 +7,14 @@
7
7
  },
8
8
  "docs": "/openapi.json"
9
9
  },
10
+ "workspace-ai": {
11
+ "url": {
12
+ "dev": "https://genai-workspace-ai-api.dev.stackspot.com",
13
+ "stg": "https://genai-workspace-ai-api.stg.stackspot.com",
14
+ "prd": "https://genai-workspace-ai-api.stackspot.com"
15
+ },
16
+ "docs": "/openapi.json"
17
+ },
10
18
  "agent": {
11
19
  "url": {
12
20
  "dev": "https://genai-ai-agent-mgmt-api.dev.stackspot.com",
@@ -92,6 +92,7 @@ import {
92
92
  updateUser,
93
93
  validateNewPartnerData,
94
94
  validatePartnerAssociationLimit,
95
+ getResourceMembers,
95
96
  } from '../api/account'
96
97
  import apis from '../apis.json'
97
98
  import { DefaultAPIError } from '../error/DefaultAPIError'
@@ -687,6 +688,11 @@ class AccountClient extends ReactQueryNetworkClient {
687
688
  */
688
689
  deleteExtensionLink = this.mutation(deleteExtensionLink)
689
690
 
691
+ /**
692
+ * Get members by resource id
693
+ */
694
+ membersByResourceId = this.query(getResourceMembers)
695
+
690
696
  /*
691
697
  * Delete profile image
692
698
  */
@@ -0,0 +1,101 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { GetAiStackResponse, KnowledgeSourceItemResponse, QuickCommandResponse } from '../api/ai'
3
+ import {
4
+ addPermissionV1WorkspacesWorkspaceIdPermissionPatch,
5
+ addResourceV1WorkspacesWorkspaceIdResourceTypePost,
6
+ createWorkspaceV1WorkspacesPost,
7
+ defaults,
8
+ deleteWorkspaceV1WorkspacesWorkspaceIdDelete,
9
+ getWorkspaceBySlugV1WorkspacesIdGet,
10
+ HttpValidationError,
11
+ listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet,
12
+ listGroupsPermissionInWorkspaceV1WorkspacesWorkspaceIdPermissionsGet,
13
+ listWorkspacesV1WorkspacesGet,
14
+ removePermissionV1WorkspacesWorkspaceIdPermissionDelete,
15
+ removeResourceV1WorkspacesWorkspaceIdResourceTypeResourceIdDelete,
16
+ updateWorkspaceV1WorkspacesWorkspaceIdPatch,
17
+ } from '../api/workspace-ai'
18
+ import apis from '../apis.json'
19
+ import { StackspotAPIError } from '../error/StackspotAPIError'
20
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
21
+ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
22
+ import { AgentResponse } from '../api/agent'
23
+
24
+ class WorkspaceAiClient extends ReactQueryNetworkClient {
25
+ constructor() {
26
+ super(apis['workspace-ai'].url, defaults)
27
+ }
28
+
29
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
30
+ return new StackspotAPIError({
31
+ status: error.status,
32
+ headers: error.headers,
33
+ stack: error.stack,
34
+ message: (error.data as HttpValidationError | undefined)?.detail?.map(d => d.msg)?.join('\n'),
35
+ })
36
+ }
37
+
38
+ createWorkspaceAi = this.mutation(removeAuthorizationParam(createWorkspaceV1WorkspacesPost))
39
+ workspacesAi = this.query(removeAuthorizationParam(listWorkspacesV1WorkspacesGet))
40
+ workspaceAi = this.query(removeAuthorizationParam(getWorkspaceBySlugV1WorkspacesIdGet))
41
+ updateWorkspaceAi = this.mutation(removeAuthorizationParam(updateWorkspaceV1WorkspacesWorkspaceIdPatch))
42
+ deleteWorkspaceAi = this.mutation(removeAuthorizationParam(deleteWorkspaceV1WorkspacesWorkspaceIdDelete))
43
+ addResourceTypeToWorkspaceAi = this.mutation(removeAuthorizationParam(addResourceV1WorkspacesWorkspaceIdResourceTypePost))
44
+
45
+ getKSFromWorkspaceAi = this.query({
46
+ name: 'KsWorkspaceAi',
47
+ request: (
48
+ signal,
49
+ variables: Omit<Parameters<typeof listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet>[0],
50
+ 'authorization' | 'resourceType'>,
51
+ ) =>
52
+ listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet({ ...variables, resourceType: 'knowledge_source', authorization: '' },
53
+ { signal }) as unknown as Promise<KnowledgeSourceItemResponse[]>,
54
+ permission: this.createPermissionFunctionFor(listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet),
55
+ })
56
+
57
+ getStackFromWorkspaceAi = this.query({
58
+ name: 'StackWorkspaceAi',
59
+ request: (
60
+ signal,
61
+ variables: Omit<Parameters<typeof listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet>[0],
62
+ 'authorization' | 'resourceType'>,
63
+ ) =>
64
+ listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet({ ...variables, resourceType: 'stack', authorization: '' },
65
+ { signal }) as unknown as Promise<GetAiStackResponse[]>,
66
+ permission: this.createPermissionFunctionFor(listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet),
67
+ })
68
+
69
+ getQCFromWorkspaceAi = this.query({
70
+ name: 'QcWorkspaceAi',
71
+ request: (
72
+ signal,
73
+ variables: Omit<Parameters<typeof listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet>[0],
74
+ 'authorization' | 'resourceType'>,
75
+ ) =>
76
+ listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet({ ...variables, resourceType: 'quick_command', authorization: '' },
77
+ { signal }) as unknown as Promise<QuickCommandResponse[]>,
78
+ permission: this.createPermissionFunctionFor(listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet),
79
+ })
80
+
81
+ getAgentFromWorkspaceAi = this.query({
82
+ name: 'AgentWorkspaceAi',
83
+ request: (
84
+ signal,
85
+ variables: Omit<Parameters<typeof listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet>[0],
86
+ 'authorization' | 'resourceType'>,
87
+ ) =>
88
+ listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet({ ...variables, resourceType: 'agent', authorization: '' },
89
+ { signal }) as unknown as Promise<AgentResponse[]>,
90
+ permission: this.createPermissionFunctionFor(listAllByResourceTypeV1WorkspacesWorkspaceIdResourceTypeGet),
91
+ })
92
+
93
+ deleteResourceTypeFromWorkspaceAi = this.mutation(removeAuthorizationParam(
94
+ removeResourceV1WorkspacesWorkspaceIdResourceTypeResourceIdDelete))
95
+ addPermissionToWorkspaceAi = this.mutation(removeAuthorizationParam(addPermissionV1WorkspacesWorkspaceIdPermissionPatch))
96
+ editPermissionToWorkspaceAi = this.mutation(removeAuthorizationParam(updateWorkspaceV1WorkspacesWorkspaceIdPatch))
97
+ removePermissionToWorkspaceAi = this.mutation(removeAuthorizationParam(removePermissionV1WorkspacesWorkspaceIdPermissionDelete))
98
+ groupsOfWorkspaceAi = this.mutation(removeAuthorizationParam(listGroupsPermissionInWorkspaceV1WorkspacesWorkspaceIdPermissionsGet))
99
+ }
100
+
101
+ export const workspaceAiClient = new WorkspaceAiClient()
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export { secretsClient } from './client/secrets'
16
16
  export * from './client/types'
17
17
  export { workflowClient } from './client/workflow'
18
18
  export { workspaceClient } from './client/workspace'
19
+ export { workspaceAiClient } from './client/workspace-ai'
19
20
  export { workspaceManagerClient } from './client/workspace-manager'
20
21
  export { workspaceSearchClient } from './client/workspace-search'
21
22
  export { DefaultAPIError } from './error/DefaultAPIError'