@autonomys/auto-drive 1.2.8 → 1.3.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/.env +6 -0
- package/README.md +22 -25
- package/dist/api/calls/download.d.ts +3 -3
- package/dist/api/calls/download.d.ts.map +1 -1
- package/dist/api/calls/index.d.ts +26 -19
- package/dist/api/calls/index.d.ts.map +1 -1
- package/dist/api/calls/read.d.ts +35 -18
- package/dist/api/calls/read.d.ts.map +1 -1
- package/dist/api/calls/read.js +39 -9
- package/dist/api/calls/upload.d.ts +11 -11
- package/dist/api/calls/upload.d.ts.map +1 -1
- package/dist/api/calls/upload.js +5 -5
- package/dist/api/calls/write.d.ts +9 -9
- package/dist/api/calls/write.d.ts.map +1 -1
- package/dist/api/calls/write.js +4 -4
- package/dist/api/connection.d.ts +2 -24
- package/dist/api/connection.d.ts.map +1 -1
- package/dist/api/connection.js +6 -30
- package/dist/api/handler.d.ts +3 -0
- package/dist/api/handler.d.ts.map +1 -0
- package/dist/api/handler.js +30 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/models/objects.d.ts +4 -0
- package/dist/api/models/objects.d.ts.map +1 -1
- package/dist/api/type.d.ts +172 -0
- package/dist/api/type.d.ts.map +1 -0
- package/dist/api/type.js +8 -0
- package/dist/api/types.d.ts +172 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +8 -0
- package/dist/api/wrappers.d.ts +2 -115
- package/dist/api/wrappers.d.ts.map +1 -1
- package/dist/api/wrappers.js +178 -240
- package/dist/fs/wrappers.d.ts +1 -2
- package/dist/fs/wrappers.d.ts.map +1 -1
- package/dist/fs/wrappers.js +18 -19
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +25 -2
- package/package.json +4 -4
- package/src/api/calls/download.ts +3 -3
- package/src/api/calls/read.ts +61 -18
- package/src/api/calls/upload.ts +11 -11
- package/src/api/calls/write.ts +10 -10
- package/src/api/connection.ts +6 -61
- package/src/api/handler.ts +34 -0
- package/src/api/index.ts +2 -0
- package/src/api/models/objects.ts +5 -0
- package/src/api/types.ts +201 -0
- package/src/api/wrappers.ts +247 -300
- package/src/fs/wrappers.ts +11 -14
- package/src/node.ts +2 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/utils/folder.d.ts +0 -2
- package/dist/utils/folder.d.ts.map +0 -1
- package/dist/utils/folder.js +0 -23
- package/dist/utils/observable.d.ts +0 -7
- package/dist/utils/observable.d.ts.map +0 -1
- package/dist/utils/observable.js +0 -15
- package/dist/utils/stream.d.ts +0 -3
- package/dist/utils/stream.d.ts.map +0 -1
- package/dist/utils/stream.js +0 -22
package/.env
ADDED
package/README.md
CHANGED
|
@@ -23,16 +23,16 @@ yarn add @autonomys/auto-drive
|
|
|
23
23
|
To interact with the Auto-Drive API, you'll need to create an API key. Follow these steps:
|
|
24
24
|
|
|
25
25
|
- Go to [Auto-Drive](https://ai3.storage) and login with your preffered SSO.
|
|
26
|
-
- Once you're logged in, click on the
|
|
27
|
-
- In the
|
|
26
|
+
- Once you're logged in, click on the developers section in the left sidebar menu.
|
|
27
|
+
- In the developers section, click on 'Create API Key'
|
|
28
28
|
- Read the modal message and click on generate
|
|
29
29
|
|
|
30
30
|
### How to upload a file from filepath? (Not available in browser)
|
|
31
31
|
|
|
32
|
-
Here is an example of how to use the `uploadFileFromFilepath` method to upload a file with optional encryption and compression:
|
|
32
|
+
Here is an example of how to use the `fs.uploadFileFromFilepath` method to upload a file with optional encryption and compression:
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
import {
|
|
35
|
+
import { fs,createAutoDriveApi } from '@autonomys/auto-drive'
|
|
36
36
|
import { NetworkId } from '@autonomys/auto-utils'
|
|
37
37
|
|
|
38
38
|
const api = createAutoDriveApi({ apiKey: 'your-api-key', network: NetworkId.TAURUS }) // Initialize your API instance with API key
|
|
@@ -46,7 +46,7 @@ const options = {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const cid = await uploadFileFromFilepath(api, filePath, options)
|
|
49
|
+
const cid = await fs.uploadFileFromFilepath(api, filePath, options)
|
|
50
50
|
|
|
51
51
|
console.log(`The file is uploaded and its cid is ${cid}`)
|
|
52
52
|
```
|
|
@@ -65,7 +65,7 @@ const options = {
|
|
|
65
65
|
password: 'your-encryption-password', // Optional: specify a password for encryption
|
|
66
66
|
compression: true,
|
|
67
67
|
}
|
|
68
|
-
const cid = await uploadFileFromInput(
|
|
68
|
+
const cid = await api.uploadFileFromInput(file, options)
|
|
69
69
|
|
|
70
70
|
console.log(`The file is uploaded and its cid is ${cid}`)
|
|
71
71
|
```
|
|
@@ -113,7 +113,7 @@ const options = {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
const cid = uploadFile(
|
|
116
|
+
const cid = api.uploadFile(genericFile, options)
|
|
117
117
|
|
|
118
118
|
console.log(`The file is uploaded and its cid is ${cid}`)
|
|
119
119
|
```
|
|
@@ -121,7 +121,7 @@ console.log(`The file is uploaded and its cid is ${cid}`)
|
|
|
121
121
|
### How to upload a folder from folder? (Not available in browser)
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
|
-
import { createAutoDriveApi,
|
|
124
|
+
import { createAutoDriveApi, fs } from '@autonomys/auto-drive'
|
|
125
125
|
import { NetworkId } from '@autonomys/auto-utils'
|
|
126
126
|
|
|
127
127
|
const api = createAutoDriveApi({ apiKey: 'your-api-key', network: NetworkId.TAURUS }) // Initialize your API instance with API key
|
|
@@ -136,7 +136,7 @@ const options = {
|
|
|
136
136
|
},
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
const folderCID = await uploadFolderFromFolderPath(api, folderPath, options)
|
|
139
|
+
const folderCID = await fs.uploadFolderFromFolderPath(api, folderPath, options)
|
|
140
140
|
|
|
141
141
|
console.log(`The folder is uploaded and its cid is ${folderCID}`)
|
|
142
142
|
```
|
|
@@ -148,14 +148,14 @@ console.log(`The folder is uploaded and its cid is ${folderCID}`)
|
|
|
148
148
|
Here is an example of how to use the `downloadFile` method to download a file from the server:
|
|
149
149
|
|
|
150
150
|
```typescript
|
|
151
|
-
import { createAutoDriveApi
|
|
151
|
+
import { createAutoDriveApi } from '@autonomys/auto-drive'
|
|
152
152
|
import { NetworkId } from '@autonomys/auto-utils'
|
|
153
153
|
|
|
154
154
|
const api = createAutoDriveApi({ apiKey: 'your-api-key', network: NetworkId.TAURUS }) // Initialize your API instance with API key
|
|
155
155
|
|
|
156
156
|
try {
|
|
157
157
|
const cid = '..'
|
|
158
|
-
const stream = await downloadFile(
|
|
158
|
+
const stream = await api.downloadFile(cid)
|
|
159
159
|
let file = Buffer.alloc(0)
|
|
160
160
|
for await (const chunk of stream) {
|
|
161
161
|
file = Buffer.concat([file, chunk])
|
|
@@ -171,14 +171,14 @@ try {
|
|
|
171
171
|
Here is an example of how to use the `publishObject` method to publish an object and get its public download URL:
|
|
172
172
|
|
|
173
173
|
```typescript
|
|
174
|
-
import { createAutoDriveApi
|
|
174
|
+
import { createAutoDriveApi } from '@autonomys/auto-drive'
|
|
175
175
|
import { NetworkId } from '@autonomys/auto-utils'
|
|
176
176
|
|
|
177
177
|
const api = createAutoDriveApi({ apiKey: 'your-api-key', network: NetworkId.TAURUS }) // Initialize your API instance with API key
|
|
178
178
|
|
|
179
179
|
try {
|
|
180
180
|
const cid = 'your-file-cid'
|
|
181
|
-
const publicUrl = await publishObject(
|
|
181
|
+
const publicUrl = await api.publishObject(cid)
|
|
182
182
|
console.log('Public download URL:', publicUrl)
|
|
183
183
|
} catch (error) {
|
|
184
184
|
console.error('Error publishing object:', error)
|
|
@@ -187,26 +187,23 @@ try {
|
|
|
187
187
|
|
|
188
188
|
**Note: For retrieving the link of an already published object just call again `publishObject` method**
|
|
189
189
|
|
|
190
|
-
### Example Usage of
|
|
190
|
+
### Example Usage of getMyFiles
|
|
191
191
|
|
|
192
|
-
Here is an example of how to use the `
|
|
192
|
+
Here is an example of how to use the `getMyFiles` method to retrieve the root directories:
|
|
193
193
|
|
|
194
194
|
```typescript
|
|
195
|
-
import { createAutoDriveApi
|
|
195
|
+
import { createAutoDriveApi } from '@autonomys/auto-drive'
|
|
196
196
|
import { NetworkId } from '@autonomys/auto-utils'
|
|
197
197
|
|
|
198
198
|
const api = createAutoDriveApi({ apiKey: 'your-api-key', network: NetworkId.TAURUS }) // Initialize your API instance with API key
|
|
199
199
|
|
|
200
200
|
try {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.log(`Retrieved ${myFiles.rows.length} files of ${myFiles.totalCount} total`)
|
|
208
|
-
for (const file of myFiles.rows) {
|
|
209
|
-
console.log(`${file.name} - ${file.headCid}: ${file.size}`)
|
|
201
|
+
for (let i = 0; i < 10; i++) {
|
|
202
|
+
const myFiles = await api.getMyFiles(i, 100)
|
|
203
|
+
console.log(`Retrieved ${myFiles.rows.length} files of ${myFiles.totalCount} total`)
|
|
204
|
+
for (const file of myFiles.rows) {
|
|
205
|
+
console.log(`${file.name} - ${file.headCid}: ${file.size}`)
|
|
206
|
+
}
|
|
210
207
|
}
|
|
211
208
|
} catch (error) {
|
|
212
209
|
console.error('Error downloading file:', error)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgsWithoutPagination } from '../../utils/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const downloadObject: (api:
|
|
2
|
+
import { AutoDriveApiHandler } from '../types';
|
|
3
|
+
export declare const downloadObject: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
4
4
|
cid: string;
|
|
5
5
|
}>) => Promise<ReadableStream<Uint8Array>>;
|
|
6
|
-
export declare const publicDownloadUrl: (api:
|
|
6
|
+
export declare const publicDownloadUrl: (api: AutoDriveApiHandler, cid: string) => string;
|
|
7
7
|
//# sourceMappingURL=download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/api/calls/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/api/calls/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,cAAc,QACpB,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAcpC,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAS,mBAAmB,OAAO,MAAM,KAAG,MAEzE,CAAA"}
|
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
export declare const apiCalls: {
|
|
2
|
-
shareObject: (api: import("..").
|
|
2
|
+
shareObject: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
3
3
|
cid: string;
|
|
4
4
|
publicId: string;
|
|
5
5
|
}>) => Promise<any>;
|
|
6
|
-
markObjectAsDeleted: (api: import("..").
|
|
6
|
+
markObjectAsDeleted: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
7
7
|
cid: string;
|
|
8
8
|
}>) => Promise<void>;
|
|
9
|
-
restoreObject: (api: import("..").
|
|
9
|
+
restoreObject: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
10
10
|
cid: string;
|
|
11
11
|
}>) => Promise<void>;
|
|
12
|
-
publishObject: (api: import("..").
|
|
12
|
+
publishObject: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
13
13
|
cid: string;
|
|
14
14
|
}>) => Promise<{
|
|
15
15
|
result: string;
|
|
16
16
|
}>;
|
|
17
|
-
createFileUpload: (api: import("..").
|
|
17
|
+
createFileUpload: (api: import("..").AutoDriveApiHandler, { mimeType, filename, uploadOptions, }: import("../../utils").ArgsWithoutPagination<{
|
|
18
18
|
mimeType?: string;
|
|
19
19
|
filename: string;
|
|
20
20
|
uploadOptions: import("..").FileUploadOptions | null;
|
|
21
21
|
}>) => Promise<import("..").FileUpload>;
|
|
22
|
-
createFolderUpload: (api: import("..").
|
|
22
|
+
createFolderUpload: (api: import("..").AutoDriveApiHandler, { fileTree, uploadOptions, }: import("../../utils").ArgsWithoutPagination<{
|
|
23
23
|
fileTree: import("../models/folderTree").FolderTree;
|
|
24
24
|
uploadOptions?: import("..").FileUploadOptions;
|
|
25
25
|
}>) => Promise<import("..").FolderUpload>;
|
|
26
|
-
createFileUploadWithinFolderUpload: (api: import("..").
|
|
26
|
+
createFileUploadWithinFolderUpload: (api: import("..").AutoDriveApiHandler, { uploadId, name, mimeType, relativeId, uploadOptions, }: import("../../utils").ArgsWithoutPagination<{
|
|
27
27
|
uploadId: string;
|
|
28
28
|
name: string;
|
|
29
29
|
mimeType?: string;
|
|
30
30
|
relativeId: string;
|
|
31
31
|
uploadOptions: import("..").FileUploadOptions;
|
|
32
32
|
}>) => Promise<import("..").FileUpload>;
|
|
33
|
-
uploadFileChunk: (api: import("..").
|
|
33
|
+
uploadFileChunk: (api: import("..").AutoDriveApiHandler, { uploadId, chunk, index, }: import("../../utils").ArgsWithoutPagination<{
|
|
34
34
|
uploadId: string;
|
|
35
35
|
chunk: Buffer;
|
|
36
36
|
index: number;
|
|
37
37
|
}>) => Promise<void>;
|
|
38
|
-
completeUpload: (api: import("..").
|
|
38
|
+
completeUpload: (api: import("..").AutoDriveApiHandler, { uploadId }: import("../../utils").ArgsWithoutPagination<{
|
|
39
39
|
uploadId: string;
|
|
40
40
|
}>) => Promise<import("..").CompleteUploadResponse>;
|
|
41
|
-
getRoots: (api: import("..").
|
|
41
|
+
getRoots: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithPagination<{
|
|
42
42
|
scope: import("..").Scope;
|
|
43
43
|
}>) => Promise<import("../models/common").PaginatedResult<import("..").ObjectSummary>>;
|
|
44
|
-
getSharedWithMe: (api: import("..").
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
getSharedWithMe: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithPagination) => Promise<import("../models/common").PaginatedResult<import("..").ObjectSummary>>;
|
|
45
|
+
searchByNameOrCID: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
46
|
+
value: string;
|
|
47
|
+
scope: import("..").Scope;
|
|
48
|
+
}>) => Promise<import("..").ObjectSearchResult[]>;
|
|
49
|
+
getDeleted: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithPagination) => Promise<import("../models/common").PaginatedResult<import("..").ObjectSummary>>;
|
|
50
|
+
getObject: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
47
51
|
cid: string;
|
|
48
52
|
}>) => Promise<import("..").ObjectInformation>;
|
|
49
|
-
|
|
53
|
+
getObjectSummary: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
54
|
+
cid: string;
|
|
55
|
+
}>) => Promise<import("..").ObjectSummary>;
|
|
56
|
+
getObjectUploadStatus: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
50
57
|
cid: string;
|
|
51
58
|
}>) => Promise<import("..").ObjectInformation["uploadStatus"]>;
|
|
52
|
-
getObjectOwners: (api: import("..").
|
|
59
|
+
getObjectOwners: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
53
60
|
cid: string;
|
|
54
61
|
}>) => Promise<import("..").ObjectInformation["owners"]>;
|
|
55
|
-
getObjectMetadata: (api: import("..").
|
|
62
|
+
getObjectMetadata: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
56
63
|
cid: string;
|
|
57
64
|
}>) => Promise<import("..").ObjectInformation["metadata"]>;
|
|
58
|
-
getMe: (api: import("..").
|
|
59
|
-
downloadObject: (api: import("..").
|
|
65
|
+
getMe: (api: import("..").AutoDriveApiHandler) => Promise<import("../models/user").UserInfo>;
|
|
66
|
+
downloadObject: (api: import("..").AutoDriveApiHandler, query: import("../../utils").ArgsWithoutPagination<{
|
|
60
67
|
cid: string;
|
|
61
68
|
}>) => Promise<ReadableStream<Uint8Array>>;
|
|
62
|
-
publicDownloadUrl: (api: import("..").
|
|
69
|
+
publicDownloadUrl: (api: import("..").AutoDriveApiHandler, cid: string) => string;
|
|
63
70
|
};
|
|
64
71
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/calls/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/calls/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;gBAMg1B,CAAC;;;;;;qBAA8vC,CAAC;;;;;gBAAgjD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADrpH,CAAA"}
|
package/dist/api/calls/read.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ArgsWithoutPagination, ArgsWithPagination } from '../../utils/types';
|
|
2
|
-
import { AutoDriveApi } from '../connection';
|
|
3
2
|
import { PaginatedResult } from '../models/common';
|
|
4
|
-
import { ObjectInformation, ObjectSummary, Scope } from '../models/objects';
|
|
3
|
+
import { ObjectInformation, ObjectSearchResult, ObjectSummary, Scope } from '../models/objects';
|
|
5
4
|
import { UserInfo } from '../models/user';
|
|
5
|
+
import { AutoDriveApiHandler } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the root objects based on the specified scope.
|
|
8
8
|
*
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
10
10
|
* @param {ArgsWithPagination<{ scope: Scope }>} query - The query parameters including scope, limit, and offset.
|
|
11
11
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the root objects.
|
|
12
12
|
* @throws {Error} - Throws an error if the request fails.
|
|
13
13
|
*/
|
|
14
|
-
export declare const getRoots: (api:
|
|
14
|
+
export declare const getRoots: (api: AutoDriveApiHandler, query: ArgsWithPagination<{
|
|
15
15
|
scope: Scope;
|
|
16
16
|
}>) => Promise<PaginatedResult<ObjectSummary>>;
|
|
17
17
|
/**
|
|
@@ -20,38 +20,55 @@ export declare const getRoots: (api: AutoDriveApi, query: ArgsWithPagination<{
|
|
|
20
20
|
* This method sends a request to the server to fetch a list of objects
|
|
21
21
|
* that are shared with the user, based on the specified pagination parameters.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
24
24
|
* @param {ArgsWithPagination} query - The query parameters including limit and offset for pagination.
|
|
25
25
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the shared objects.
|
|
26
26
|
* @throws {Error} - Throws an error if the request fails.
|
|
27
27
|
*/
|
|
28
|
-
export declare const getSharedWithMe: (api:
|
|
28
|
+
export declare const getSharedWithMe: (api: AutoDriveApiHandler, query: ArgsWithPagination) => Promise<PaginatedResult<ObjectSummary>>;
|
|
29
|
+
export declare const searchByNameOrCID: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
30
|
+
value: string;
|
|
31
|
+
scope: Scope;
|
|
32
|
+
}>) => Promise<ObjectSearchResult[]>;
|
|
29
33
|
/**
|
|
30
34
|
* Retrieves the objects that have been marked as deleted.
|
|
31
35
|
*
|
|
32
36
|
* This method sends a request to the server to fetch a list of objects
|
|
33
37
|
* that have been deleted, based on the specified pagination parameters.
|
|
34
38
|
*
|
|
35
|
-
* @param {
|
|
39
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
36
40
|
* @param {ArgsWithPagination} query - The query parameters including limit and offset for pagination.
|
|
37
41
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the deleted objects.
|
|
38
42
|
* @throws {Error} - Throws an error if the request fails.
|
|
39
43
|
*/
|
|
40
|
-
export declare const getDeleted: (api:
|
|
44
|
+
export declare const getDeleted: (api: AutoDriveApiHandler, query: ArgsWithPagination) => Promise<PaginatedResult<ObjectSummary>>;
|
|
41
45
|
/**
|
|
42
46
|
* Retrieves the aggregated information of a specific object identified by its CID.
|
|
43
47
|
*
|
|
44
48
|
* This method sends a request to the server to fetch details about the
|
|
45
49
|
* object, including its metadata and other relevant information.
|
|
46
50
|
*
|
|
47
|
-
* @param {
|
|
51
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
48
52
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object to retrieve.
|
|
49
53
|
* @returns {Promise<ObjectInformation>} - A promise that resolves to the information of the requested object.
|
|
50
54
|
* @throws {Error} - Throws an error if the request fails.
|
|
51
55
|
*/
|
|
52
|
-
export declare const getObject: (api:
|
|
56
|
+
export declare const getObject: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
53
57
|
cid: string;
|
|
54
58
|
}>) => Promise<ObjectInformation>;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves the summary of a specific object identified by its CID.
|
|
61
|
+
*
|
|
62
|
+
* This method sends a request to the server to fetch the summary of the object.
|
|
63
|
+
*
|
|
64
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
65
|
+
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose upload status is to be retrieved.
|
|
66
|
+
* @returns {Promise<ObjectSummary>} - A promise that resolves to the summary of the requested object.
|
|
67
|
+
* @throws {Error} - Throws an error if the request fails.
|
|
68
|
+
*/
|
|
69
|
+
export declare const getObjectSummary: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
70
|
+
cid: string;
|
|
71
|
+
}>) => Promise<ObjectSummary>;
|
|
55
72
|
/**
|
|
56
73
|
* Retrieves the upload status of a specific object identified by its CID.
|
|
57
74
|
*
|
|
@@ -59,12 +76,12 @@ export declare const getObject: (api: AutoDriveApi, query: ArgsWithoutPagination
|
|
|
59
76
|
* of the object, which can indicate whether the upload is pending, completed,
|
|
60
77
|
* or failed.
|
|
61
78
|
*
|
|
62
|
-
* @param {
|
|
79
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
63
80
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose upload status is to be retrieved.
|
|
64
81
|
* @returns {Promise<ObjectInformation['uploadStatus']>} - A promise that resolves to the upload status of the requested object.
|
|
65
82
|
* @throws {Error} - Throws an error if the request fails.
|
|
66
83
|
*/
|
|
67
|
-
export declare const getObjectUploadStatus: (api:
|
|
84
|
+
export declare const getObjectUploadStatus: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
68
85
|
cid: string;
|
|
69
86
|
}>) => Promise<ObjectInformation["uploadStatus"]>;
|
|
70
87
|
/**
|
|
@@ -74,12 +91,12 @@ export declare const getObjectUploadStatus: (api: AutoDriveApi, query: ArgsWitho
|
|
|
74
91
|
* associated with the object. The owners can provide insights into who
|
|
75
92
|
* has access to or control over the object.
|
|
76
93
|
*
|
|
77
|
-
* @param {
|
|
94
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
78
95
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose owners are to be retrieved.
|
|
79
96
|
* @returns {Promise<ObjectInformation['owners']>} - A promise that resolves to the list of owners of the requested object.
|
|
80
97
|
* @throws {Error} - Throws an error if the request fails.
|
|
81
98
|
*/
|
|
82
|
-
export declare const getObjectOwners: (api:
|
|
99
|
+
export declare const getObjectOwners: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
83
100
|
cid: string;
|
|
84
101
|
}>) => Promise<ObjectInformation["owners"]>;
|
|
85
102
|
/**
|
|
@@ -89,20 +106,20 @@ export declare const getObjectOwners: (api: AutoDriveApi, query: ArgsWithoutPagi
|
|
|
89
106
|
* with the object. The metadata can include various details about the object,
|
|
90
107
|
* such as its name, type, size, and other relevant information.
|
|
91
108
|
*
|
|
92
|
-
* @param {
|
|
109
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
93
110
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose metadata is to be retrieved.
|
|
94
111
|
* @returns {Promise<ObjectInformation['metadata']>} - A promise that resolves to the metadata of the requested object.
|
|
95
112
|
* @throws {Error} - Throws an error if the request fails.
|
|
96
113
|
*/
|
|
97
|
-
export declare const getObjectMetadata: (api:
|
|
114
|
+
export declare const getObjectMetadata: (api: AutoDriveApiHandler, query: ArgsWithoutPagination<{
|
|
98
115
|
cid: string;
|
|
99
116
|
}>) => Promise<ObjectInformation["metadata"]>;
|
|
100
117
|
/**
|
|
101
118
|
* Get upload and download limits of the user
|
|
102
119
|
*
|
|
103
|
-
* @param {
|
|
120
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
104
121
|
* @returns {Promise<UserInfo>} - A promise that resolves to the user info.
|
|
105
122
|
* @throws {Error} - Throws an error if the request fails.
|
|
106
123
|
*/
|
|
107
|
-
export declare const getMe: (api:
|
|
124
|
+
export declare const getMe: (api: AutoDriveApiHandler) => Promise<UserInfo>;
|
|
108
125
|
//# sourceMappingURL=read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/api/calls/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/api/calls/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,QACd,mBAAmB,SACjB,kBAAkB,CAAC;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,KAC1C,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAaxC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,QACrB,mBAAmB,SACjB,kBAAkB,KACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAaxC,CAAA;AAED,eAAO,MAAM,iBAAiB,QACvB,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,KAC5D,OAAO,CAAC,kBAAkB,EAAE,CAa9B,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,QAChB,mBAAmB,SACjB,kBAAkB,KACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAaxC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,QACf,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,iBAAiB,CAU3B,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,QACtB,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,aAAa,CAUvB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAC3B,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAU3C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,QACrB,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAUrC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,QACvB,mBAAmB,SACjB,qBAAqB,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,KAC5C,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAUvC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,QAAe,mBAAmB,KAAG,OAAO,CAAC,QAAQ,CAStE,CAAA"}
|
package/dist/api/calls/read.js
CHANGED
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getMe = exports.getObjectMetadata = exports.getObjectOwners = exports.getObjectUploadStatus = exports.getObject = exports.getDeleted = exports.getSharedWithMe = exports.getRoots = void 0;
|
|
12
|
+
exports.getMe = exports.getObjectMetadata = exports.getObjectOwners = exports.getObjectUploadStatus = exports.getObjectSummary = exports.getObject = exports.getDeleted = exports.searchByNameOrCID = exports.getSharedWithMe = exports.getRoots = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves the root objects based on the specified scope.
|
|
15
15
|
*
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
17
17
|
* @param {ArgsWithPagination<{ scope: Scope }>} query - The query parameters including scope, limit, and offset.
|
|
18
18
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the root objects.
|
|
19
19
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -34,7 +34,7 @@ exports.getRoots = getRoots;
|
|
|
34
34
|
* This method sends a request to the server to fetch a list of objects
|
|
35
35
|
* that are shared with the user, based on the specified pagination parameters.
|
|
36
36
|
*
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
38
38
|
* @param {ArgsWithPagination} query - The query parameters including limit and offset for pagination.
|
|
39
39
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the shared objects.
|
|
40
40
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -49,13 +49,23 @@ const getSharedWithMe = (api, query) => __awaiter(void 0, void 0, void 0, functi
|
|
|
49
49
|
return response.json();
|
|
50
50
|
});
|
|
51
51
|
exports.getSharedWithMe = getSharedWithMe;
|
|
52
|
+
const searchByNameOrCID = (api, query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const response = yield api.sendRequest(`/objects/search?cid=${encodeURIComponent(query.value)}&scope=${query.scope}`, {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
});
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
throw new Error(`Failed to search by name or CID: ${response.statusText}`);
|
|
58
|
+
}
|
|
59
|
+
return response.json();
|
|
60
|
+
});
|
|
61
|
+
exports.searchByNameOrCID = searchByNameOrCID;
|
|
52
62
|
/**
|
|
53
63
|
* Retrieves the objects that have been marked as deleted.
|
|
54
64
|
*
|
|
55
65
|
* This method sends a request to the server to fetch a list of objects
|
|
56
66
|
* that have been deleted, based on the specified pagination parameters.
|
|
57
67
|
*
|
|
58
|
-
* @param {
|
|
68
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
59
69
|
* @param {ArgsWithPagination} query - The query parameters including limit and offset for pagination.
|
|
60
70
|
* @returns {Promise<ObjectSummary[]>} - A promise that resolves to an array of ObjectSummary representing the deleted objects.
|
|
61
71
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -76,7 +86,7 @@ exports.getDeleted = getDeleted;
|
|
|
76
86
|
* This method sends a request to the server to fetch details about the
|
|
77
87
|
* object, including its metadata and other relevant information.
|
|
78
88
|
*
|
|
79
|
-
* @param {
|
|
89
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
80
90
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object to retrieve.
|
|
81
91
|
* @returns {Promise<ObjectInformation>} - A promise that resolves to the information of the requested object.
|
|
82
92
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -91,6 +101,26 @@ const getObject = (api, query) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
91
101
|
return response.json();
|
|
92
102
|
});
|
|
93
103
|
exports.getObject = getObject;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves the summary of a specific object identified by its CID.
|
|
106
|
+
*
|
|
107
|
+
* This method sends a request to the server to fetch the summary of the object.
|
|
108
|
+
*
|
|
109
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
110
|
+
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose upload status is to be retrieved.
|
|
111
|
+
* @returns {Promise<ObjectSummary>} - A promise that resolves to the summary of the requested object.
|
|
112
|
+
* @throws {Error} - Throws an error if the request fails.
|
|
113
|
+
*/
|
|
114
|
+
const getObjectSummary = (api, query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
+
const response = yield api.sendRequest(`/objects/${query.cid}/summary`, {
|
|
116
|
+
method: 'GET',
|
|
117
|
+
});
|
|
118
|
+
if (!response.ok) {
|
|
119
|
+
throw new Error(`Failed to get object summary: ${response.statusText}`);
|
|
120
|
+
}
|
|
121
|
+
return response.json();
|
|
122
|
+
});
|
|
123
|
+
exports.getObjectSummary = getObjectSummary;
|
|
94
124
|
/**
|
|
95
125
|
* Retrieves the upload status of a specific object identified by its CID.
|
|
96
126
|
*
|
|
@@ -98,7 +128,7 @@ exports.getObject = getObject;
|
|
|
98
128
|
* of the object, which can indicate whether the upload is pending, completed,
|
|
99
129
|
* or failed.
|
|
100
130
|
*
|
|
101
|
-
* @param {
|
|
131
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
102
132
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose upload status is to be retrieved.
|
|
103
133
|
* @returns {Promise<ObjectInformation['uploadStatus']>} - A promise that resolves to the upload status of the requested object.
|
|
104
134
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -120,7 +150,7 @@ exports.getObjectUploadStatus = getObjectUploadStatus;
|
|
|
120
150
|
* associated with the object. The owners can provide insights into who
|
|
121
151
|
* has access to or control over the object.
|
|
122
152
|
*
|
|
123
|
-
* @param {
|
|
153
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
124
154
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose owners are to be retrieved.
|
|
125
155
|
* @returns {Promise<ObjectInformation['owners']>} - A promise that resolves to the list of owners of the requested object.
|
|
126
156
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -142,7 +172,7 @@ exports.getObjectOwners = getObjectOwners;
|
|
|
142
172
|
* with the object. The metadata can include various details about the object,
|
|
143
173
|
* such as its name, type, size, and other relevant information.
|
|
144
174
|
*
|
|
145
|
-
* @param {
|
|
175
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
146
176
|
* @param {ArgsWithoutPagination<{ cid: string }>} query - The query parameters containing the CID of the object whose metadata is to be retrieved.
|
|
147
177
|
* @returns {Promise<ObjectInformation['metadata']>} - A promise that resolves to the metadata of the requested object.
|
|
148
178
|
* @throws {Error} - Throws an error if the request fails.
|
|
@@ -160,7 +190,7 @@ exports.getObjectMetadata = getObjectMetadata;
|
|
|
160
190
|
/**
|
|
161
191
|
* Get upload and download limits of the user
|
|
162
192
|
*
|
|
163
|
-
* @param {
|
|
193
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
164
194
|
* @returns {Promise<UserInfo>} - A promise that resolves to the user info.
|
|
165
195
|
* @throws {Error} - Throws an error if the request fails.
|
|
166
196
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ArgsWithoutPagination } from '../../utils/types';
|
|
2
|
-
import { AutoDriveApi } from '../connection';
|
|
3
2
|
import { FolderTree } from '../models/folderTree';
|
|
4
3
|
import { CompleteUploadResponse, FileUpload, FileUploadOptions, FolderUpload } from '../models/uploads';
|
|
4
|
+
import { AutoDriveApiHandler } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Initiates a file upload to the server.
|
|
7
7
|
*
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
9
9
|
* @param {ArgsWithoutPagination<{ mimeType?: string; filename: string; uploadOptions: FileUploadOptions | null }>} args - The arguments for the file upload.
|
|
10
10
|
* @param {string} args.mimeType - The MIME type of the file (optional).
|
|
11
11
|
* @param {string} args.filename - The name of the file to be uploaded.
|
|
@@ -13,7 +13,7 @@ import { CompleteUploadResponse, FileUpload, FileUploadOptions, FolderUpload } f
|
|
|
13
13
|
* @returns {Promise<FileUpload>} - A promise that resolves to the file upload information.
|
|
14
14
|
* @throws {Error} - Throws an error if the upload fails.
|
|
15
15
|
*/
|
|
16
|
-
export declare const createFileUpload: (api:
|
|
16
|
+
export declare const createFileUpload: (api: AutoDriveApiHandler, { mimeType, filename, uploadOptions, }: ArgsWithoutPagination<{
|
|
17
17
|
mimeType?: string;
|
|
18
18
|
filename: string;
|
|
19
19
|
uploadOptions: FileUploadOptions | null;
|
|
@@ -21,21 +21,21 @@ export declare const createFileUpload: (api: AutoDriveApi, { mimeType, filename,
|
|
|
21
21
|
/**
|
|
22
22
|
* Initiates a folder upload to the server.
|
|
23
23
|
*
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
25
25
|
* @param {ArgsWithoutPagination<{ fileTree: FolderTree; uploadOptions: FileUploadOptions }>} args - The arguments for the folder upload.
|
|
26
26
|
* @param {FolderTree} args.fileTree - The structure of the folder and its contents to be uploaded.
|
|
27
27
|
* @param {FileUploadOptions} args.uploadOptions - Additional options for the folder upload.
|
|
28
28
|
* @returns {Promise<FolderUpload>} - A promise that resolves to the folder upload information.
|
|
29
29
|
* @throws {Error} - Throws an error if the upload fails.
|
|
30
30
|
*/
|
|
31
|
-
export declare const createFolderUpload: (api:
|
|
31
|
+
export declare const createFolderUpload: (api: AutoDriveApiHandler, { fileTree, uploadOptions, }: ArgsWithoutPagination<{
|
|
32
32
|
fileTree: FolderTree;
|
|
33
33
|
uploadOptions?: FileUploadOptions;
|
|
34
34
|
}>) => Promise<FolderUpload>;
|
|
35
35
|
/**
|
|
36
36
|
* Creates a file upload within an existing folder upload.
|
|
37
37
|
*
|
|
38
|
-
* @param {
|
|
38
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
39
39
|
* @param {ArgsWithoutPagination<{ uploadId: string; name: string; mimeType: string; relativeId: string; uploadOptions: FileUploadOptions }>} args - The arguments for the file upload.
|
|
40
40
|
* @param {string} args.uploadId - The ID of the folder upload to which the file will be added.
|
|
41
41
|
* @param {string} args.name - The name of the file to be uploaded.
|
|
@@ -45,7 +45,7 @@ export declare const createFolderUpload: (api: AutoDriveApi, { fileTree, uploadO
|
|
|
45
45
|
* @returns {Promise<FileUpload>} - A promise that resolves to the file upload information.
|
|
46
46
|
* @throws {Error} - Throws an error if the upload fails.
|
|
47
47
|
*/
|
|
48
|
-
export declare const createFileUploadWithinFolderUpload: (api:
|
|
48
|
+
export declare const createFileUploadWithinFolderUpload: (api: AutoDriveApiHandler, { uploadId, name, mimeType, relativeId, uploadOptions, }: ArgsWithoutPagination<{
|
|
49
49
|
uploadId: string;
|
|
50
50
|
name: string;
|
|
51
51
|
mimeType?: string;
|
|
@@ -60,7 +60,7 @@ export declare const createFileUploadWithinFolderUpload: (api: AutoDriveApi, { u
|
|
|
60
60
|
* index to the server, which can be used to reconstruct the file on the
|
|
61
61
|
* server side.
|
|
62
62
|
*
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
64
64
|
* @param {ArgsWithoutPagination<{ uploadId: string; chunk: Buffer; index: number }>} args - The arguments for the file chunk upload.
|
|
65
65
|
* @param {string} args.uploadId - The ID of the upload session.
|
|
66
66
|
* @param {Buffer} args.chunk - The chunk of the file to be uploaded.
|
|
@@ -68,7 +68,7 @@ export declare const createFileUploadWithinFolderUpload: (api: AutoDriveApi, { u
|
|
|
68
68
|
* @returns {Promise<void>} - A promise that resolves when the chunk is uploaded successfully.
|
|
69
69
|
* @throws {Error} - Throws an error if the upload fails.
|
|
70
70
|
*/
|
|
71
|
-
export declare const uploadFileChunk: (api:
|
|
71
|
+
export declare const uploadFileChunk: (api: AutoDriveApiHandler, { uploadId, chunk, index, }: ArgsWithoutPagination<{
|
|
72
72
|
uploadId: string;
|
|
73
73
|
chunk: Buffer;
|
|
74
74
|
index: number;
|
|
@@ -81,13 +81,13 @@ export declare const uploadFileChunk: (api: AutoDriveApi, { uploadId, chunk, ind
|
|
|
81
81
|
* typically called after all file chunks have been uploaded. This method
|
|
82
82
|
* can be used to complete both file and folder uploads.
|
|
83
83
|
*
|
|
84
|
-
* @param {
|
|
84
|
+
* @param {AutoDriveApiHandler} api - The API instance used to send requests.
|
|
85
85
|
* @param {ArgsWithoutPagination<{ uploadId: string }>} args - The arguments for completing the upload.
|
|
86
86
|
* @param {string} args.uploadId - The ID of the upload session to complete.
|
|
87
87
|
* @returns {Promise<any>} - A promise that resolves to the response from the server.
|
|
88
88
|
* @throws {Error} - Throws an error if the completion of the upload fails.
|
|
89
89
|
*/
|
|
90
|
-
export declare const completeUpload: (api:
|
|
90
|
+
export declare const completeUpload: (api: AutoDriveApiHandler, { uploadId }: ArgsWithoutPagination<{
|
|
91
91
|
uploadId: string;
|
|
92
92
|
}>) => Promise<CompleteUploadResponse>;
|
|
93
93
|
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/api/calls/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/api/calls/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,QACtB,mBAAmB,0CAKrB,qBAAqB,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACxC,CAAC,KACD,OAAO,CAAC,UAAU,CAiBpB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,QACxB,mBAAmB,gCAIrB,qBAAqB,CAAC;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAAC,KACpF,OAAO,CAAC,YAAY,CAiBtB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kCAAkC,QACxC,mBAAmB,4DAOrB,qBAAqB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,iBAAiB,CAAA;CACjC,CAAC,KACD,OAAO,CAAC,UAAU,CAiBpB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,QACrB,mBAAmB,+BAKrB,qBAAqB,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,KAC3E,OAAO,CAAC,IAAI,CAgBd,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,QACpB,mBAAmB,gBACV,qBAAqB,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,KACxD,OAAO,CAAC,sBAAsB,CAUhC,CAAA"}
|