@stack-spot/portal-network 0.208.3 → 0.209.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,100 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { getApiAddresses } from '../api-addresses'
3
+ import { defaults, deleteAssetType, deleteFolder, deleteProject, disassociateProjectAsset, getFolderDetails, getProjectDetails, listAssetTypes, listFolders, saveAssetType, saveFolder, saveProject, updateAsset, updateAssetType, updateFolders, updateProject } from '../api/accountAssetManager'
4
+ import { DefaultAPIError } from '../error/DefaultAPIError'
5
+ import { accountAssetManagerDictionary } from '../error/dictionary/accountAssetManager'
6
+ import { StackspotAPIError } from '../error/StackspotAPIError'
7
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
9
+
10
+ class AccountAssetManagerClient extends ReactQueryNetworkClient {
11
+ constructor() {
12
+ super(getApiAddresses().accountAssetManager.url, defaults)
13
+ }
14
+
15
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
16
+ return new DefaultAPIError(error.data, error.status, accountAssetManagerDictionary, error.headers)
17
+ }
18
+
19
+ /**
20
+ * Save project
21
+ */
22
+ saveProject = this.mutation(removeAuthorizationParam(saveProject))
23
+
24
+ /**
25
+ * Get project details
26
+ */
27
+ getProjectDetails = this.query(removeAuthorizationParam(getProjectDetails))
28
+
29
+ /**
30
+ * Delete project
31
+ */
32
+ deleteProject = this.mutation(removeAuthorizationParam(deleteProject))
33
+
34
+ /**
35
+ * Update project
36
+ */
37
+ updateProject = this.mutation(removeAuthorizationParam(updateProject))
38
+
39
+ /**
40
+ * Disassociate project asset
41
+ */
42
+ disassociateProjectAsset = this.mutation(removeAuthorizationParam(disassociateProjectAsset))
43
+
44
+ /**
45
+ * List account folders
46
+ */
47
+ folders = this.query(removeAuthorizationParam(listFolders))
48
+
49
+ /**
50
+ * Create new folder in account
51
+ */
52
+ createFolder = this.mutation(removeAuthorizationParam(saveFolder))
53
+
54
+ /**
55
+ * Get folder details
56
+ */
57
+ folderDetails = this.query(removeAuthorizationParam(getFolderDetails))
58
+
59
+ /**
60
+ * Delete folder
61
+ */
62
+ deleteFolder = this.mutation(removeAuthorizationParam(deleteFolder))
63
+
64
+ /**
65
+ * Update folder
66
+ */
67
+ updateFolder = this.mutation(removeAuthorizationParam(updateFolders))
68
+
69
+ /**
70
+ * Create asset
71
+ */
72
+ createAsset = this.mutation(removeAuthorizationParam(saveAssetType))
73
+
74
+ /**
75
+ * Update asset
76
+ */
77
+ updateAsset = this.mutation(removeAuthorizationParam(updateAsset))
78
+
79
+ /**
80
+ * List all asset types
81
+ */
82
+ assetTypes = this.query(removeAuthorizationParam(listAssetTypes))
83
+
84
+ /**
85
+ * Save asset type
86
+ */
87
+ saveAssetType = this.mutation(removeAuthorizationParam(saveAssetType))
88
+
89
+ /**
90
+ * Delete asset type
91
+ */
92
+ deleteAssetType = this.mutation(removeAuthorizationParam(deleteAssetType))
93
+
94
+ /**
95
+ * Update asset type
96
+ */
97
+ updateAssetType = this.mutation(removeAuthorizationParam(updateAssetType))
98
+ }
99
+
100
+ export const accountAssetManagerClient = new AccountAssetManagerClient()
package/src/client/ai.ts CHANGED
@@ -45,6 +45,8 @@ import {
45
45
  resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete,
46
46
  runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost,
47
47
  searchKnowledgeSourcesV1KnowledgeSourcesSearchPost,
48
+ tokensByUserV1AnalyticsTokensByUserGet,
49
+ tokensDailyUsageV1AnalyticsTokensDailyUsageGet,
48
50
  startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost,
49
51
  totalV1TokensUsageTotalGet,
50
52
  updateQuickCommandV1QuickCommandsSlugPatch,
@@ -277,6 +279,14 @@ class AIClient extends ReactQueryNetworkClient {
277
279
  */
278
280
  removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
279
281
  /**
282
+ * Get Tokens Daily usage
283
+ */
284
+ analyticsTokensDailyUsage = this.query(removeAuthorizationParam(tokensDailyUsageV1AnalyticsTokensDailyUsageGet))
285
+ /**
286
+ * Get Tokens By User
287
+ */
288
+ analyticsTokensByUser = this.query(removeAuthorizationParam(tokensByUserV1AnalyticsTokensByUserGet))
289
+ /*
280
290
  * Lists all the feature flags for this user.
281
291
  */
282
292
  flags = this.query(getFlagsV1FlagsGet)
@@ -0,0 +1,12 @@
1
+ import { Dictionary } from '@stack-spot/portal-translate'
2
+
3
+ export const accountAssetManagerDictionary = {
4
+ en: {
5
+ FOLDER_BAD_REQUEST_ERROR: 'The provided data is invalid or inconsistent.',
6
+ FOLDER_ALREADY_EXISTS: 'A folder with this name already exists.',
7
+ },
8
+ pt: {
9
+ FOLDER_BAD_REQUEST_ERROR: 'Os dados informados estão inválidos ou inconsistentes.',
10
+ FOLDER_ALREADY_EXISTS: 'Já existe uma pasta com esse nome.',
11
+ },
12
+ } satisfies Dictionary
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CancelledError } from '@tanstack/react-query'
2
2
  export { apiAddresses, getApiAddresses, getApisByTenant, getBaseUrlByTenantWithOverride, setApisOverride } from './api-addresses'
3
3
  export { accountClient } from './client/account'
4
+ export { accountAssetManagerClient } from './client/account-asset-manager'
4
5
  export { agentClient } from './client/agent'
5
6
  export { agentToolsClient } from './client/agent-tools'
6
7
  export { aiClient } from './client/ai'