@chatbotkit/sdk 1.30.0 → 1.31.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/dist/cjs/space/index.cjs +2 -0
- package/dist/cjs/space/index.d.ts +2 -0
- package/dist/cjs/space/storage/index.cjs +30 -0
- package/dist/cjs/space/storage/index.d.ts +11 -0
- package/dist/cjs/space/storage/v1.cjs +52 -0
- package/dist/cjs/space/storage/v1.d.ts +20 -0
- package/dist/cjs/types/ability.d.ts +522 -36
- package/dist/cjs/types/api/v1.d.ts +420 -4
- package/dist/esm/space/index.d.ts +2 -0
- package/dist/esm/space/index.js +2 -0
- package/dist/esm/space/storage/index.d.ts +11 -0
- package/dist/esm/space/storage/index.js +26 -0
- package/dist/esm/space/storage/v1.d.ts +20 -0
- package/dist/esm/space/storage/v1.js +44 -0
- package/dist/esm/types/ability.d.ts +522 -36
- package/dist/esm/types/api/v1.d.ts +420 -4
- package/package.json +51 -1
|
@@ -4772,6 +4772,147 @@ export interface paths {
|
|
|
4772
4772
|
patch?: never;
|
|
4773
4773
|
trace?: never;
|
|
4774
4774
|
};
|
|
4775
|
+
"/space/{spaceId}/storage/copy/{path}": {
|
|
4776
|
+
parameters: {
|
|
4777
|
+
query?: never;
|
|
4778
|
+
header?: never;
|
|
4779
|
+
path?: never;
|
|
4780
|
+
cookie?: never;
|
|
4781
|
+
};
|
|
4782
|
+
get?: never;
|
|
4783
|
+
put?: never;
|
|
4784
|
+
/**
|
|
4785
|
+
* Copy a file in space storage
|
|
4786
|
+
* @description Copy a file from one location to another within space storage. The
|
|
4787
|
+
* source file path is specified in the URL after /copy/. The
|
|
4788
|
+
* destinationPath in the request body specifies where to copy the file.
|
|
4789
|
+
*
|
|
4790
|
+
*/
|
|
4791
|
+
post: operations["copySpaceStoragePath"];
|
|
4792
|
+
delete?: never;
|
|
4793
|
+
options?: never;
|
|
4794
|
+
head?: never;
|
|
4795
|
+
patch?: never;
|
|
4796
|
+
trace?: never;
|
|
4797
|
+
};
|
|
4798
|
+
"/space/{spaceId}/storage/delete/{path}": {
|
|
4799
|
+
parameters: {
|
|
4800
|
+
query?: never;
|
|
4801
|
+
header?: never;
|
|
4802
|
+
path?: never;
|
|
4803
|
+
cookie?: never;
|
|
4804
|
+
};
|
|
4805
|
+
get?: never;
|
|
4806
|
+
put?: never;
|
|
4807
|
+
/**
|
|
4808
|
+
* Delete a file or directory from space storage
|
|
4809
|
+
* @description Delete a file or directory from space storage. The path is specified
|
|
4810
|
+
* in the URL after /delete/. If recursive is true and the path is a
|
|
4811
|
+
* directory, all files within it will be deleted.
|
|
4812
|
+
*
|
|
4813
|
+
*/
|
|
4814
|
+
post: operations["deleteSpaceStoragePath"];
|
|
4815
|
+
delete?: never;
|
|
4816
|
+
options?: never;
|
|
4817
|
+
head?: never;
|
|
4818
|
+
patch?: never;
|
|
4819
|
+
trace?: never;
|
|
4820
|
+
};
|
|
4821
|
+
"/space/{spaceId}/storage/download/{path}": {
|
|
4822
|
+
parameters: {
|
|
4823
|
+
query?: never;
|
|
4824
|
+
header?: never;
|
|
4825
|
+
path?: never;
|
|
4826
|
+
cookie?: never;
|
|
4827
|
+
};
|
|
4828
|
+
/**
|
|
4829
|
+
* Download a file from space storage
|
|
4830
|
+
* @description Download a file from space storage. The file path is specified in the
|
|
4831
|
+
* URL after /download/. Can return either the direct file content
|
|
4832
|
+
* (default) or a presigned download URL (when Accept: application/json).
|
|
4833
|
+
*
|
|
4834
|
+
*/
|
|
4835
|
+
get: operations["downloadSpaceStoragePath"];
|
|
4836
|
+
put?: never;
|
|
4837
|
+
post?: never;
|
|
4838
|
+
delete?: never;
|
|
4839
|
+
options?: never;
|
|
4840
|
+
head?: never;
|
|
4841
|
+
patch?: never;
|
|
4842
|
+
trace?: never;
|
|
4843
|
+
};
|
|
4844
|
+
"/space/{spaceId}/storage/list/{path}": {
|
|
4845
|
+
parameters: {
|
|
4846
|
+
query?: never;
|
|
4847
|
+
header?: never;
|
|
4848
|
+
path?: never;
|
|
4849
|
+
cookie?: never;
|
|
4850
|
+
};
|
|
4851
|
+
/**
|
|
4852
|
+
* List files and directories in space storage
|
|
4853
|
+
* @description List files and directories in the space's storage. Supports both flat
|
|
4854
|
+
* and recursive listing. The path is specified in the URL after /list/.
|
|
4855
|
+
* Omit the path to list the root directory.
|
|
4856
|
+
*
|
|
4857
|
+
*/
|
|
4858
|
+
get: operations["listSpaceStoragePath"];
|
|
4859
|
+
put?: never;
|
|
4860
|
+
post?: never;
|
|
4861
|
+
delete?: never;
|
|
4862
|
+
options?: never;
|
|
4863
|
+
head?: never;
|
|
4864
|
+
patch?: never;
|
|
4865
|
+
trace?: never;
|
|
4866
|
+
};
|
|
4867
|
+
"/space/{spaceId}/storage/move/{path}": {
|
|
4868
|
+
parameters: {
|
|
4869
|
+
query?: never;
|
|
4870
|
+
header?: never;
|
|
4871
|
+
path?: never;
|
|
4872
|
+
cookie?: never;
|
|
4873
|
+
};
|
|
4874
|
+
get?: never;
|
|
4875
|
+
put?: never;
|
|
4876
|
+
/**
|
|
4877
|
+
* Move (rename) a file in space storage
|
|
4878
|
+
* @description Move a file from one location to another within space storage, or
|
|
4879
|
+
* rename a file by moving it to a new path. The source file path is
|
|
4880
|
+
* specified in the URL after /move/. The destinationPath in the request
|
|
4881
|
+
* body is the target location for the file.
|
|
4882
|
+
*
|
|
4883
|
+
*/
|
|
4884
|
+
post: operations["moveSpaceStoragePath"];
|
|
4885
|
+
delete?: never;
|
|
4886
|
+
options?: never;
|
|
4887
|
+
head?: never;
|
|
4888
|
+
patch?: never;
|
|
4889
|
+
trace?: never;
|
|
4890
|
+
};
|
|
4891
|
+
"/space/{spaceId}/storage/upload/{path}": {
|
|
4892
|
+
parameters: {
|
|
4893
|
+
query?: never;
|
|
4894
|
+
header?: never;
|
|
4895
|
+
path?: never;
|
|
4896
|
+
cookie?: never;
|
|
4897
|
+
};
|
|
4898
|
+
get?: never;
|
|
4899
|
+
put?: never;
|
|
4900
|
+
/**
|
|
4901
|
+
* Upload a file to space storage
|
|
4902
|
+
* @description Upload a file to space storage. The file path is specified in the URL
|
|
4903
|
+
* after /upload/. The file can be specified either as a HTTP URL, a data
|
|
4904
|
+
* URL, a multipart/form-data, or as a raw file stream. The maximum file
|
|
4905
|
+
* size for uploads is determined dynamically based on user limits and
|
|
4906
|
+
* configuration, and may vary.
|
|
4907
|
+
*
|
|
4908
|
+
*/
|
|
4909
|
+
post: operations["uploadSpaceStoragePath"];
|
|
4910
|
+
delete?: never;
|
|
4911
|
+
options?: never;
|
|
4912
|
+
head?: never;
|
|
4913
|
+
patch?: never;
|
|
4914
|
+
trace?: never;
|
|
4915
|
+
};
|
|
4775
4916
|
"/space/{spaceId}/update": {
|
|
4776
4917
|
parameters: {
|
|
4777
4918
|
query?: never;
|
|
@@ -8105,8 +8246,8 @@ export interface operations {
|
|
|
8105
8246
|
requestBody: {
|
|
8106
8247
|
content: {
|
|
8107
8248
|
"application/json": {
|
|
8108
|
-
/** @description The text of the message to send */
|
|
8109
|
-
text
|
|
8249
|
+
/** @description The text of the message to send. Omit to continue receiving from the existing conversation state without sending a new user message. */
|
|
8250
|
+
text?: string;
|
|
8110
8251
|
/** @description Known entities */
|
|
8111
8252
|
entities?: {
|
|
8112
8253
|
/** @description The entity type */
|
|
@@ -8495,8 +8636,8 @@ export interface operations {
|
|
|
8495
8636
|
requestBody: {
|
|
8496
8637
|
content: {
|
|
8497
8638
|
"application/json": {
|
|
8498
|
-
/** @description The text of the message to send */
|
|
8499
|
-
text
|
|
8639
|
+
/** @description The text of the message to send. Omit to continue receiving from the existing conversation state without sending a new user message. */
|
|
8640
|
+
text?: string;
|
|
8500
8641
|
/** @description Known entities */
|
|
8501
8642
|
entities?: {
|
|
8502
8643
|
/** @description The entity type */
|
|
@@ -23813,6 +23954,281 @@ export interface operations {
|
|
|
23813
23954
|
};
|
|
23814
23955
|
};
|
|
23815
23956
|
};
|
|
23957
|
+
copySpaceStoragePath: {
|
|
23958
|
+
parameters: {
|
|
23959
|
+
query?: never;
|
|
23960
|
+
header?: never;
|
|
23961
|
+
path: {
|
|
23962
|
+
spaceId: string;
|
|
23963
|
+
path: string;
|
|
23964
|
+
};
|
|
23965
|
+
cookie?: never;
|
|
23966
|
+
};
|
|
23967
|
+
requestBody: {
|
|
23968
|
+
content: {
|
|
23969
|
+
"application/json": {
|
|
23970
|
+
/** @description The destination file path */
|
|
23971
|
+
destinationPath: string;
|
|
23972
|
+
};
|
|
23973
|
+
};
|
|
23974
|
+
};
|
|
23975
|
+
responses: {
|
|
23976
|
+
/** @description The file was copied successfully */
|
|
23977
|
+
200: {
|
|
23978
|
+
headers: {
|
|
23979
|
+
[name: string]: unknown;
|
|
23980
|
+
};
|
|
23981
|
+
content: {
|
|
23982
|
+
"application/json": {
|
|
23983
|
+
/** @description The destination file path */
|
|
23984
|
+
path: string;
|
|
23985
|
+
};
|
|
23986
|
+
};
|
|
23987
|
+
};
|
|
23988
|
+
/** @description An error response */
|
|
23989
|
+
default: {
|
|
23990
|
+
headers: {
|
|
23991
|
+
[name: string]: unknown;
|
|
23992
|
+
};
|
|
23993
|
+
content?: never;
|
|
23994
|
+
};
|
|
23995
|
+
};
|
|
23996
|
+
};
|
|
23997
|
+
deleteSpaceStoragePath: {
|
|
23998
|
+
parameters: {
|
|
23999
|
+
query?: never;
|
|
24000
|
+
header?: never;
|
|
24001
|
+
path: {
|
|
24002
|
+
spaceId: string;
|
|
24003
|
+
path: string;
|
|
24004
|
+
};
|
|
24005
|
+
cookie?: never;
|
|
24006
|
+
};
|
|
24007
|
+
requestBody?: {
|
|
24008
|
+
content: {
|
|
24009
|
+
"application/json": {
|
|
24010
|
+
/**
|
|
24011
|
+
* @description Whether to delete directory contents recursively
|
|
24012
|
+
* @default false
|
|
24013
|
+
*/
|
|
24014
|
+
recursive?: boolean;
|
|
24015
|
+
};
|
|
24016
|
+
};
|
|
24017
|
+
};
|
|
24018
|
+
responses: {
|
|
24019
|
+
/** @description The file or directory was deleted successfully */
|
|
24020
|
+
200: {
|
|
24021
|
+
headers: {
|
|
24022
|
+
[name: string]: unknown;
|
|
24023
|
+
};
|
|
24024
|
+
content: {
|
|
24025
|
+
"application/json": {
|
|
24026
|
+
/** @description The deleted file or directory path */
|
|
24027
|
+
path: string;
|
|
24028
|
+
};
|
|
24029
|
+
};
|
|
24030
|
+
};
|
|
24031
|
+
/** @description An error response */
|
|
24032
|
+
default: {
|
|
24033
|
+
headers: {
|
|
24034
|
+
[name: string]: unknown;
|
|
24035
|
+
};
|
|
24036
|
+
content?: never;
|
|
24037
|
+
};
|
|
24038
|
+
};
|
|
24039
|
+
};
|
|
24040
|
+
downloadSpaceStoragePath: {
|
|
24041
|
+
parameters: {
|
|
24042
|
+
query?: never;
|
|
24043
|
+
header?: never;
|
|
24044
|
+
path: {
|
|
24045
|
+
spaceId: string;
|
|
24046
|
+
path: string;
|
|
24047
|
+
};
|
|
24048
|
+
cookie?: never;
|
|
24049
|
+
};
|
|
24050
|
+
requestBody?: never;
|
|
24051
|
+
responses: {
|
|
24052
|
+
/** @description The file was downloaded successfully */
|
|
24053
|
+
200: {
|
|
24054
|
+
headers: {
|
|
24055
|
+
[name: string]: unknown;
|
|
24056
|
+
};
|
|
24057
|
+
content: {
|
|
24058
|
+
"application/json": {
|
|
24059
|
+
/** @description The ID of the file */
|
|
24060
|
+
id: string;
|
|
24061
|
+
/** @description The presigned URL to download the file */
|
|
24062
|
+
url: string;
|
|
24063
|
+
};
|
|
24064
|
+
"application/octet-stream": string;
|
|
24065
|
+
};
|
|
24066
|
+
};
|
|
24067
|
+
/** @description An error response */
|
|
24068
|
+
default: {
|
|
24069
|
+
headers: {
|
|
24070
|
+
[name: string]: unknown;
|
|
24071
|
+
};
|
|
24072
|
+
content?: never;
|
|
24073
|
+
};
|
|
24074
|
+
};
|
|
24075
|
+
};
|
|
24076
|
+
listSpaceStoragePath: {
|
|
24077
|
+
parameters: {
|
|
24078
|
+
query?: {
|
|
24079
|
+
recursive?: boolean;
|
|
24080
|
+
};
|
|
24081
|
+
header?: never;
|
|
24082
|
+
path: {
|
|
24083
|
+
spaceId: string;
|
|
24084
|
+
path: string;
|
|
24085
|
+
};
|
|
24086
|
+
cookie?: never;
|
|
24087
|
+
};
|
|
24088
|
+
requestBody?: never;
|
|
24089
|
+
responses: {
|
|
24090
|
+
/** @description The list of files was retrieved successfully */
|
|
24091
|
+
200: {
|
|
24092
|
+
headers: {
|
|
24093
|
+
[name: string]: unknown;
|
|
24094
|
+
};
|
|
24095
|
+
content: {
|
|
24096
|
+
"application/json": {
|
|
24097
|
+
items: {
|
|
24098
|
+
/** @description The ID of the file or directory */
|
|
24099
|
+
id?: string;
|
|
24100
|
+
/** @description The relative path of the file or directory */
|
|
24101
|
+
path?: string;
|
|
24102
|
+
/** @description The size of the file in bytes (0 for directories) */
|
|
24103
|
+
size?: number;
|
|
24104
|
+
/** @description The timestamp (ms) when the file was last modified */
|
|
24105
|
+
updatedAt?: number;
|
|
24106
|
+
/** @description Whether this is a directory */
|
|
24107
|
+
isDirectory?: boolean;
|
|
24108
|
+
}[];
|
|
24109
|
+
/** @description Token to use for next page of results */
|
|
24110
|
+
nextToken?: string;
|
|
24111
|
+
};
|
|
24112
|
+
};
|
|
24113
|
+
};
|
|
24114
|
+
/** @description An error response */
|
|
24115
|
+
default: {
|
|
24116
|
+
headers: {
|
|
24117
|
+
[name: string]: unknown;
|
|
24118
|
+
};
|
|
24119
|
+
content?: never;
|
|
24120
|
+
};
|
|
24121
|
+
};
|
|
24122
|
+
};
|
|
24123
|
+
moveSpaceStoragePath: {
|
|
24124
|
+
parameters: {
|
|
24125
|
+
query?: never;
|
|
24126
|
+
header?: never;
|
|
24127
|
+
path: {
|
|
24128
|
+
spaceId: string;
|
|
24129
|
+
path: string;
|
|
24130
|
+
};
|
|
24131
|
+
cookie?: never;
|
|
24132
|
+
};
|
|
24133
|
+
requestBody: {
|
|
24134
|
+
content: {
|
|
24135
|
+
"application/json": {
|
|
24136
|
+
/** @description The destination file path */
|
|
24137
|
+
destinationPath: string;
|
|
24138
|
+
};
|
|
24139
|
+
};
|
|
24140
|
+
};
|
|
24141
|
+
responses: {
|
|
24142
|
+
/** @description The file was moved successfully */
|
|
24143
|
+
200: {
|
|
24144
|
+
headers: {
|
|
24145
|
+
[name: string]: unknown;
|
|
24146
|
+
};
|
|
24147
|
+
content: {
|
|
24148
|
+
"application/json": {
|
|
24149
|
+
/** @description The destination file path */
|
|
24150
|
+
path: string;
|
|
24151
|
+
};
|
|
24152
|
+
};
|
|
24153
|
+
};
|
|
24154
|
+
/** @description An error response */
|
|
24155
|
+
default: {
|
|
24156
|
+
headers: {
|
|
24157
|
+
[name: string]: unknown;
|
|
24158
|
+
};
|
|
24159
|
+
content?: never;
|
|
24160
|
+
};
|
|
24161
|
+
};
|
|
24162
|
+
};
|
|
24163
|
+
uploadSpaceStoragePath: {
|
|
24164
|
+
parameters: {
|
|
24165
|
+
query?: never;
|
|
24166
|
+
header?: never;
|
|
24167
|
+
path: {
|
|
24168
|
+
spaceId: string;
|
|
24169
|
+
path: string;
|
|
24170
|
+
};
|
|
24171
|
+
cookie?: never;
|
|
24172
|
+
};
|
|
24173
|
+
requestBody: {
|
|
24174
|
+
content: {
|
|
24175
|
+
"application/json": {
|
|
24176
|
+
/** @description The file to upload either as http: or data: URL */
|
|
24177
|
+
file?: string;
|
|
24178
|
+
} | {
|
|
24179
|
+
/** @description The file definition to upload */
|
|
24180
|
+
file?: {
|
|
24181
|
+
/** @description The file type */
|
|
24182
|
+
type: string;
|
|
24183
|
+
/** @description The file size */
|
|
24184
|
+
size: number;
|
|
24185
|
+
/** @description Optional metadata */
|
|
24186
|
+
meta?: Record<string, never>;
|
|
24187
|
+
};
|
|
24188
|
+
};
|
|
24189
|
+
"multipart/form-data": {
|
|
24190
|
+
/**
|
|
24191
|
+
* Format: binary
|
|
24192
|
+
* @description The file to upload
|
|
24193
|
+
*/
|
|
24194
|
+
file: string;
|
|
24195
|
+
};
|
|
24196
|
+
"*/*": string;
|
|
24197
|
+
};
|
|
24198
|
+
};
|
|
24199
|
+
responses: {
|
|
24200
|
+
/** @description The file was uploaded successfully */
|
|
24201
|
+
200: {
|
|
24202
|
+
headers: {
|
|
24203
|
+
[name: string]: unknown;
|
|
24204
|
+
};
|
|
24205
|
+
content: {
|
|
24206
|
+
"application/json": {
|
|
24207
|
+
/** @description The ID of the uploaded file */
|
|
24208
|
+
id: string;
|
|
24209
|
+
/** @description The path where the file is stored */
|
|
24210
|
+
path: string;
|
|
24211
|
+
/** @description The request required to upload the file */
|
|
24212
|
+
uploadRequest?: {
|
|
24213
|
+
/** @description The HTTP method to use */
|
|
24214
|
+
method: string;
|
|
24215
|
+
/** @description The HTTP url to use */
|
|
24216
|
+
url: string;
|
|
24217
|
+
/** @description The HTTP headers to use */
|
|
24218
|
+
headers: Record<string, never>;
|
|
24219
|
+
};
|
|
24220
|
+
};
|
|
24221
|
+
};
|
|
24222
|
+
};
|
|
24223
|
+
/** @description An error response */
|
|
24224
|
+
default: {
|
|
24225
|
+
headers: {
|
|
24226
|
+
[name: string]: unknown;
|
|
24227
|
+
};
|
|
24228
|
+
content?: never;
|
|
24229
|
+
};
|
|
24230
|
+
};
|
|
24231
|
+
};
|
|
23816
24232
|
updateSpace: {
|
|
23817
24233
|
parameters: {
|
|
23818
24234
|
query?: never;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export class SpaceClient extends ChatBotKitClient {
|
|
2
|
+
storage: SpaceStorageClient;
|
|
2
3
|
list(request?: import("./v1.js").SpaceListRequest): ResponsePromise<import("./v1.js").SpaceListResponse, import("./v1.js").SpaceListStreamType>;
|
|
3
4
|
fetch(spaceId: string): ResponsePromise<import("./v1.js").SpaceFetchResponse, never>;
|
|
4
5
|
create(request: import("./v1.js").SpaceCreateRequest): Promise<import("./v1.js").SpaceCreateResponse>;
|
|
@@ -8,3 +9,4 @@ export class SpaceClient extends ChatBotKitClient {
|
|
|
8
9
|
export default SpaceClient;
|
|
9
10
|
export type ResponsePromise<T, U> = import("../client.js").ResponsePromise<T, U>;
|
|
10
11
|
import { ChatBotKitClient } from '../client.js';
|
|
12
|
+
import { SpaceStorageClient } from './storage/index.js';
|
package/dist/esm/space/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ChatBotKitClient } from '../client.js';
|
|
2
|
+
import { SpaceStorageClient } from './storage/index.js';
|
|
2
3
|
import { createSpace, deleteSpace, fetchSpace, listSpaces, updateSpace, } from './v1.js';
|
|
3
4
|
export class SpaceClient extends ChatBotKitClient {
|
|
4
5
|
constructor(options) {
|
|
5
6
|
super(options);
|
|
7
|
+
this.storage = new SpaceStorageClient(options);
|
|
6
8
|
}
|
|
7
9
|
list(request) {
|
|
8
10
|
return listSpaces(this, request);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class SpaceStorageClient extends ChatBotKitClient {
|
|
2
|
+
list(spaceId: string, path?: string, request?: import("./v1.js").SpaceStorageListRequest): ResponsePromise<import("./v1.js").SpaceStorageListResponse, never>;
|
|
3
|
+
download(spaceId: string, path: string, request?: import("./v1.js").SpaceStorageDownloadRequest): ResponsePromise<import("./v1.js").SpaceStorageDownloadResponse, never>;
|
|
4
|
+
upload(spaceId: string, path: string, request: import("./v1.js").SpaceStorageUploadRequest): Promise<import("./v1.js").SpaceStorageUploadResponse>;
|
|
5
|
+
delete(spaceId: string, path: string, request?: import("./v1.js").SpaceStorageDeleteRequest): Promise<import("./v1.js").SpaceStorageDeleteResponse>;
|
|
6
|
+
copy(spaceId: string, path: string, request: import("./v1.js").SpaceStorageCopyRequest): Promise<import("./v1.js").SpaceStorageCopyResponse>;
|
|
7
|
+
move(spaceId: string, path: string, request: import("./v1.js").SpaceStorageMoveRequest): Promise<import("./v1.js").SpaceStorageMoveResponse>;
|
|
8
|
+
}
|
|
9
|
+
export default SpaceStorageClient;
|
|
10
|
+
export type ResponsePromise<T, U> = import("../../client.js").ResponsePromise<T, U>;
|
|
11
|
+
import { ChatBotKitClient } from '../../client.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChatBotKitClient } from '../../client.js';
|
|
2
|
+
import { copySpaceStorage, deleteSpaceStorage, downloadSpaceStorage, listSpaceStorage, moveSpaceStorage, uploadSpaceStorage, } from './v1.js';
|
|
3
|
+
export class SpaceStorageClient extends ChatBotKitClient {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super(options);
|
|
6
|
+
}
|
|
7
|
+
list(spaceId, path, request) {
|
|
8
|
+
return listSpaceStorage(this, spaceId, path, request);
|
|
9
|
+
}
|
|
10
|
+
download(spaceId, path, request) {
|
|
11
|
+
return downloadSpaceStorage(this, spaceId, path, request);
|
|
12
|
+
}
|
|
13
|
+
upload(spaceId, path, request) {
|
|
14
|
+
return uploadSpaceStorage(this, spaceId, path, request);
|
|
15
|
+
}
|
|
16
|
+
delete(spaceId, path, request) {
|
|
17
|
+
return deleteSpaceStorage(this, spaceId, path, request);
|
|
18
|
+
}
|
|
19
|
+
copy(spaceId, path, request) {
|
|
20
|
+
return copySpaceStorage(this, spaceId, path, request);
|
|
21
|
+
}
|
|
22
|
+
move(spaceId, path, request) {
|
|
23
|
+
return moveSpaceStorage(this, spaceId, path, request);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default SpaceStorageClient;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function listSpaceStorage(client: ChatBotKitClient, spaceId: string, path?: string, request?: SpaceStorageListRequest): ResponsePromise<SpaceStorageListResponse, never>;
|
|
2
|
+
export function downloadSpaceStorage(client: ChatBotKitClient, spaceId: string, path: string, request?: SpaceStorageDownloadRequest): ResponsePromise<SpaceStorageDownloadResponse, never>;
|
|
3
|
+
export function uploadSpaceStorage(client: ChatBotKitClient, spaceId: string, path: string, request: SpaceStorageUploadRequest): Promise<SpaceStorageUploadResponse>;
|
|
4
|
+
export function deleteSpaceStorage(client: ChatBotKitClient, spaceId: string, path: string, request?: SpaceStorageDeleteRequest): Promise<SpaceStorageDeleteResponse>;
|
|
5
|
+
export function copySpaceStorage(client: ChatBotKitClient, spaceId: string, path: string, request: SpaceStorageCopyRequest): Promise<SpaceStorageCopyResponse>;
|
|
6
|
+
export function moveSpaceStorage(client: ChatBotKitClient, spaceId: string, path: string, request: SpaceStorageMoveRequest): Promise<SpaceStorageMoveResponse>;
|
|
7
|
+
export type ChatBotKitClient = import("../../client.js").ChatBotKitClient;
|
|
8
|
+
export type ResponsePromise<T, U> = import("../../client.js").ResponsePromise<T, U>;
|
|
9
|
+
export type SpaceStorageListRequest = NonNullable<import("../../types/api/v1.js").operations["listSpaceStoragePath"]["parameters"]["query"]>;
|
|
10
|
+
export type SpaceStorageListResponse = import("../../types/api/v1.js").operations["listSpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
11
|
+
export type SpaceStorageDownloadRequest = NonNullable<import("../../types/api/v1.js").operations["downloadSpaceStoragePath"]["parameters"]["query"]>;
|
|
12
|
+
export type SpaceStorageDownloadResponse = import("../../types/api/v1.js").operations["downloadSpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
13
|
+
export type SpaceStorageUploadRequest = import("../../types/api/v1.js").operations["uploadSpaceStoragePath"]["requestBody"]["content"]["application/json"];
|
|
14
|
+
export type SpaceStorageUploadResponse = import("../../types/api/v1.js").operations["uploadSpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
15
|
+
export type SpaceStorageDeleteRequest = NonNullable<import("../../types/api/v1.js").operations["deleteSpaceStoragePath"]["requestBody"]>["content"]["application/json"];
|
|
16
|
+
export type SpaceStorageDeleteResponse = import("../../types/api/v1.js").operations["deleteSpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
17
|
+
export type SpaceStorageCopyRequest = import("../../types/api/v1.js").operations["copySpaceStoragePath"]["requestBody"]["content"]["application/json"];
|
|
18
|
+
export type SpaceStorageCopyResponse = import("../../types/api/v1.js").operations["copySpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
19
|
+
export type SpaceStorageMoveRequest = import("../../types/api/v1.js").operations["moveSpaceStoragePath"]["requestBody"]["content"]["application/json"];
|
|
20
|
+
export type SpaceStorageMoveResponse = import("../../types/api/v1.js").operations["moveSpaceStoragePath"]["responses"]["200"]["content"]["application/json"];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function encodeStoragePath(path) {
|
|
2
|
+
return path.split('/').map(encodeURIComponent).join('/');
|
|
3
|
+
}
|
|
4
|
+
export function listSpaceStorage(client, spaceId, path, request) {
|
|
5
|
+
const url = `/api/v1/space/${spaceId}/storage/list${path ? `/${encodeStoragePath(path)}` : ''}`;
|
|
6
|
+
const response = client.clientFetch(url, { query: request });
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
9
|
+
export function downloadSpaceStorage(client, spaceId, path, request) {
|
|
10
|
+
const url = `/api/v1/space/${spaceId}/storage/download/${encodeStoragePath(path)}`;
|
|
11
|
+
const response = client.clientFetch(url, {
|
|
12
|
+
headers: { Accept: 'application/json' },
|
|
13
|
+
query: request,
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
17
|
+
export async function uploadSpaceStorage(client, spaceId, path, request) {
|
|
18
|
+
const url = `/api/v1/space/${spaceId}/storage/upload/${encodeStoragePath(path)}`;
|
|
19
|
+
const response = await client.clientFetch(url, {
|
|
20
|
+
record: { ...request },
|
|
21
|
+
});
|
|
22
|
+
return response;
|
|
23
|
+
}
|
|
24
|
+
export async function deleteSpaceStorage(client, spaceId, path, request) {
|
|
25
|
+
const url = `/api/v1/space/${spaceId}/storage/delete/${encodeStoragePath(path)}`;
|
|
26
|
+
const response = await client.clientFetch(url, {
|
|
27
|
+
record: request ? { ...request } : {},
|
|
28
|
+
});
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
31
|
+
export async function copySpaceStorage(client, spaceId, path, request) {
|
|
32
|
+
const url = `/api/v1/space/${spaceId}/storage/copy/${encodeStoragePath(path)}`;
|
|
33
|
+
const response = await client.clientFetch(url, {
|
|
34
|
+
record: { ...request },
|
|
35
|
+
});
|
|
36
|
+
return response;
|
|
37
|
+
}
|
|
38
|
+
export async function moveSpaceStorage(client, spaceId, path, request) {
|
|
39
|
+
const url = `/api/v1/space/${spaceId}/storage/move/${encodeStoragePath(path)}`;
|
|
40
|
+
const response = await client.clientFetch(url, {
|
|
41
|
+
record: { ...request },
|
|
42
|
+
});
|
|
43
|
+
return response;
|
|
44
|
+
}
|