flexibuckets 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,409 @@
1
+ # FlexiBuckets SDK
2
+
3
+ A TypeScript SDK for the [FlexiBuckets](https://github.com/flexibuckets) API. Manage buckets, files, folders, teams, webhooks, and more — all from your TypeScript/Node.js application.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install flexibuckets-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { FlexiBuckets } from "flexibuckets-sdk";
15
+
16
+ const client = new FlexiBuckets({
17
+ baseUrl: "https://your-flexibuckets-instance.com",
18
+ apiKey: "your-api-key",
19
+ });
20
+
21
+ // List all buckets
22
+ const buckets = await client.buckets.list();
23
+
24
+ // List files in a bucket
25
+ const { files, folders } = await client.files.list(bucketId);
26
+
27
+ // Upload a file
28
+ const upload = await client.files.requestUpload({
29
+ fileName: "report.pdf",
30
+ bucketId: 1,
31
+ contentType: "application/pdf",
32
+ fileSize: 1024,
33
+ });
34
+ // Upload your file to upload.uploadUrl via PUT
35
+ await client.files.completeUpload({ fileId: upload.fileId });
36
+ ```
37
+
38
+ ## Configuration
39
+
40
+ ```typescript
41
+ const client = new FlexiBuckets({
42
+ baseUrl: "https://your-flexibuckets-instance.com", // Your FlexiBuckets instance URL (no trailing slash)
43
+ apiKey: "fb_xxxxxxxxxxxxx", // API key from your FlexiBuckets dashboard
44
+ });
45
+ ```
46
+
47
+ The SDK appends `/api` to your `baseUrl` automatically, matching the FlexiBuckets API path structure.
48
+
49
+ ## API Reference
50
+
51
+ ### Buckets
52
+
53
+ ```typescript
54
+ // List all buckets
55
+ await client.buckets.list();
56
+
57
+ // Get bucket details
58
+ await client.buckets.get(bucketId);
59
+
60
+ // Delete a bucket
61
+ await client.buckets.delete(bucketId);
62
+
63
+ // Check bucket limit
64
+ await client.buckets.checkLimit();
65
+
66
+ // Update bucket CORS
67
+ await client.buckets.updateCors();
68
+
69
+ // Preview import objects
70
+ await client.buckets.getImportObjects();
71
+
72
+ // Import existing objects
73
+ await client.buckets.importObjects();
74
+ ```
75
+
76
+ ### Files
77
+
78
+ ```typescript
79
+ // List files and folders in a bucket
80
+ await client.files.list(bucketId);
81
+
82
+ // Get file info
83
+ await client.files.get(fileId);
84
+
85
+ // Rename/update a file
86
+ await client.files.update(fileId, { name: "new-name.pdf" });
87
+
88
+ // Delete a file
89
+ await client.files.delete(fileId);
90
+
91
+ // Request upload URL (step 1 of 2-step upload)
92
+ const { uploadUrl, fileId, s3Key } = await client.files.requestUpload({
93
+ fileName: "photo.jpg",
94
+ bucketId: 1,
95
+ contentType: "image/jpeg",
96
+ fileSize: 500000,
97
+ });
98
+
99
+ // Complete upload (step 2 — call after PUT to uploadUrl)
100
+ await client.files.completeUpload({ fileId });
101
+
102
+ // Get download URL
103
+ const { downloadUrl, fileName } = await client.files.download(fileId);
104
+
105
+ // Share a file
106
+ await client.files.share(fileId, { expiresIn: 3600 });
107
+
108
+ // Delete a shared file
109
+ await client.files.deleteSharedFile({ fileId });
110
+
111
+ // Get presigned URL for direct S3 access
112
+ await client.files.getPresignedUrl({
113
+ endpointUrl: "...",
114
+ accessKey: "...",
115
+ secretKey: "...",
116
+ fileNames: ["file1.jpg"],
117
+ bucketName: "my-bucket",
118
+ region: "us-east-1",
119
+ fileSizes: [1024],
120
+ });
121
+
122
+ // Upload to team bucket
123
+ await client.files.uploadToTeam({ ... });
124
+ ```
125
+
126
+ ### Folders
127
+
128
+ ```typescript
129
+ // Create or upsert a folder
130
+ await client.folders.create({ name: "Documents", bucketId: 1, parentId: null });
131
+
132
+ // Rename a folder
133
+ await client.folders.update(folderId, { name: "Renamed" });
134
+
135
+ // Delete a folder
136
+ await client.folders.delete(folderId);
137
+
138
+ // Share a folder
139
+ await client.folders.share(folderId, { expiresIn: 86400 });
140
+
141
+ // Get shared folder structure
142
+ await client.folders.getStructure(sharedFolderId);
143
+
144
+ // Get parent key
145
+ await client.folders.getParentKey({ key: "path/to/folder" });
146
+
147
+ // Update folder size
148
+ await client.folders.updateSize({ folderId });
149
+
150
+ // Download folder
151
+ await client.folders.download(folderId);
152
+ ```
153
+
154
+ ### Teams
155
+
156
+ ```typescript
157
+ // List your team memberships
158
+ await client.teams.list();
159
+
160
+ // Create a team
161
+ await client.teams.create({ name: "Engineering", description: "Eng team" });
162
+
163
+ // Update a team
164
+ await client.teams.update(teamId, { name: "New Name" });
165
+
166
+ // Delete a team
167
+ await client.teams.delete(teamId);
168
+
169
+ // Check access to a team
170
+ await client.teams.checkAccess(teamId);
171
+
172
+ // List buckets in a team
173
+ await client.teams.listBuckets(teamId);
174
+
175
+ // Add a bucket to a team
176
+ await client.teams.addBucket(teamId, { bucketId: 1, permissions: "READ_WRITE" });
177
+
178
+ // Remove a bucket from a team
179
+ await client.teams.removeBucket(teamId);
180
+
181
+ // Add a member to a team
182
+ await client.teams.addMember(teamId, { userId: "abc123" });
183
+
184
+ // Update member role
185
+ await client.teams.updateMember(teamId, userId, { role: "ADMIN" });
186
+
187
+ // Remove a member
188
+ await client.teams.removeMember(teamId, userId);
189
+ ```
190
+
191
+ ### Webhooks
192
+
193
+ ```typescript
194
+ // List webhooks
195
+ await client.webhooks.list();
196
+
197
+ // Create a webhook
198
+ await client.webhooks.create({
199
+ url: "https://example.com/webhook",
200
+ events: ["FILE_UPLOAD", "FILE_DELETE"],
201
+ description: "My webhook",
202
+ enabled: true,
203
+ });
204
+
205
+ // Update a webhook
206
+ await client.webhooks.update(webhookId, { enabled: false });
207
+
208
+ // Delete a webhook
209
+ await client.webhooks.delete(webhookId);
210
+ ```
211
+
212
+ ### Shares
213
+
214
+ ```typescript
215
+ // Get shared item by short URL
216
+ await client.shares.get("abc123");
217
+
218
+ // Get shared file preview URL
219
+ await client.shares.preview("abc123");
220
+
221
+ // Download shared items
222
+ await client.shares.downloadItems({ fileIds: [1, 2, 3] });
223
+
224
+ // Refresh expiring shares
225
+ await client.shares.refreshExpiring();
226
+ ```
227
+
228
+ ### API Keys
229
+
230
+ ```typescript
231
+ // List API keys
232
+ await client.apiKeys.list();
233
+
234
+ // Create API key
235
+ await client.apiKeys.create({ name: "My Key" });
236
+
237
+ // Delete API key
238
+ await client.apiKeys.delete(keyId);
239
+
240
+ // Regenerate API key
241
+ await client.apiKeys.regenerate(keyId);
242
+ ```
243
+
244
+ ### Session
245
+
246
+ ```typescript
247
+ // Get current session info
248
+ await client.session.get();
249
+ ```
250
+
251
+ ### Audit Logs
252
+
253
+ ```typescript
254
+ // List audit logs
255
+ await client.auditLogs.list();
256
+ ```
257
+
258
+ ### Health
259
+
260
+ ```typescript
261
+ // Get system health status
262
+ await client.health.get();
263
+ ```
264
+
265
+ ### Updates
266
+
267
+ ```typescript
268
+ // Check for updates
269
+ await client.updates.check();
270
+
271
+ // Get update status
272
+ await client.updates.status();
273
+
274
+ // Execute update
275
+ await client.updates.execute();
276
+ ```
277
+
278
+ ### DNS
279
+
280
+ ```typescript
281
+ // Check DNS configuration
282
+ await client.dns.check();
283
+ ```
284
+
285
+ ### Settings
286
+
287
+ ```typescript
288
+ // Get domain settings
289
+ await client.settings.getDomain();
290
+
291
+ // Set domain
292
+ await client.settings.setDomain({ domain: "files.example.com" });
293
+
294
+ // Validate domain
295
+ await client.settings.validateDomain();
296
+
297
+ // Get email settings
298
+ await client.settings.getEmail();
299
+
300
+ // Set email settings
301
+ await client.settings.setEmail({ provider: "RESEND", ... });
302
+
303
+ // Send test email
304
+ await client.settings.testEmail({ to: "test@example.com" });
305
+ ```
306
+
307
+ ### Public Upload Links
308
+
309
+ ```typescript
310
+ // List public upload links
311
+ await client.publicUploadLinks.list();
312
+
313
+ // Create public upload link
314
+ await client.publicUploadLinks.create({
315
+ folderName: "uploads",
316
+ maxFileSize: 10485760,
317
+ maxFileCount: 5,
318
+ });
319
+
320
+ // Delete public upload link
321
+ await client.publicUploadLinks.delete(linkId);
322
+
323
+ // Get upload info by token
324
+ await client.publicUploadLinks.getInfo(token);
325
+
326
+ // Submit files via public upload
327
+ await client.publicUploadLinks.submit(token, { files: [...] });
328
+ ```
329
+
330
+ ### Download
331
+
332
+ ```typescript
333
+ // Download by short URL
334
+ await client.download.byShortUrl("abc123");
335
+
336
+ // Download user file
337
+ await client.download.userFile(fileId);
338
+ ```
339
+
340
+ ## Error Handling
341
+
342
+ All API errors throw a `FlexiBucketsError` with the HTTP status, error code, and message:
343
+
344
+ ```typescript
345
+ import { FlexiBucketsError } from "flexibuckets-sdk";
346
+
347
+ try {
348
+ await client.buckets.get(999);
349
+ } catch (err) {
350
+ if (err instanceof FlexiBucketsError) {
351
+ console.log(err.status); // 404
352
+ console.log(err.code); // "404"
353
+ console.log(err.message); // "Resource not found"
354
+ console.log(err.body); // Raw response body
355
+ }
356
+ }
357
+ ```
358
+
359
+ ## Two-Step File Upload
360
+
361
+ FlexiBuckets uses a two-step upload process:
362
+
363
+ 1. **Request an upload URL** — the server returns a presigned URL and a file ID
364
+ 2. **PUT your file** to the presigned URL directly (bypasses the FlexiBuckets server)
365
+ 3. **Complete the upload** — tells FlexiBuckets the upload is done
366
+
367
+ ```typescript
368
+ // Step 1: Request upload
369
+ const { uploadUrl, fileId } = await client.files.requestUpload({
370
+ fileName: "document.pdf",
371
+ bucketId: 1,
372
+ contentType: "application/pdf",
373
+ fileSize: 2048000,
374
+ });
375
+
376
+ // Step 2: Upload file directly to S3
377
+ await fetch(uploadUrl, {
378
+ method: "PUT",
379
+ body: fileBuffer,
380
+ headers: { "Content-Type": "application/pdf" },
381
+ });
382
+
383
+ // Step 3: Complete upload
384
+ await client.files.completeUpload({ fileId });
385
+ ```
386
+
387
+ ## Publishing to npm
388
+
389
+ 1. Update the version in `package.json`
390
+ 2. Build the project: `npm run build`
391
+ 3. Publish: `npm publish`
392
+
393
+ For scoped packages or first-time publishing, use `npm publish --access public`.
394
+
395
+ ## Development
396
+
397
+ ```bash
398
+ # Install dependencies
399
+ npm install
400
+
401
+ # Build
402
+ npm run build
403
+
404
+ # The compiled output goes to dist/
405
+ ```
406
+
407
+ ## License
408
+
409
+ ISC
@@ -0,0 +1,31 @@
1
+ import { BucketsResource } from "./resources/buckets";
2
+ import { FilesResource } from "./resources/files";
3
+ import { FoldersResource } from "./resources/folders";
4
+ import { TeamsResource } from "./resources/teams";
5
+ import { WebhooksResource } from "./resources/webhooks";
6
+ import { SharesResource } from "./resources/shares";
7
+ import { ApiKeysResource, AuthResource, SessionResource, AuditLogsResource, HealthResource, UpdatesResource, DnsResource, SettingsResource, PublicUploadLinksResource, DownloadResource } from "./resources/misc";
8
+ export interface FlexiBucketsConfig {
9
+ baseUrl: string;
10
+ apiKey: string;
11
+ }
12
+ export declare class FlexiBuckets {
13
+ readonly buckets: BucketsResource;
14
+ readonly files: FilesResource;
15
+ readonly folders: FoldersResource;
16
+ readonly teams: TeamsResource;
17
+ readonly webhooks: WebhooksResource;
18
+ readonly shares: SharesResource;
19
+ readonly apiKeys: ApiKeysResource;
20
+ readonly auth: AuthResource;
21
+ readonly session: SessionResource;
22
+ readonly auditLogs: AuditLogsResource;
23
+ readonly health: HealthResource;
24
+ readonly updates: UpdatesResource;
25
+ readonly dns: DnsResource;
26
+ readonly settings: SettingsResource;
27
+ readonly publicUploadLinks: PublicUploadLinksResource;
28
+ readonly download: DownloadResource;
29
+ private readonly client;
30
+ constructor(config: FlexiBucketsConfig);
31
+ }
package/dist/client.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlexiBuckets = void 0;
4
+ const http_1 = require("./http");
5
+ const buckets_1 = require("./resources/buckets");
6
+ const files_1 = require("./resources/files");
7
+ const folders_1 = require("./resources/folders");
8
+ const teams_1 = require("./resources/teams");
9
+ const webhooks_1 = require("./resources/webhooks");
10
+ const shares_1 = require("./resources/shares");
11
+ const misc_1 = require("./resources/misc");
12
+ class FlexiBuckets {
13
+ constructor(config) {
14
+ const baseUrl = config.baseUrl.replace(/\/+$/, "");
15
+ this.client = new http_1.HttpClient({
16
+ baseUrl: `${baseUrl}/api`,
17
+ apiKey: config.apiKey,
18
+ });
19
+ this.buckets = new buckets_1.BucketsResource(this.client);
20
+ this.files = new files_1.FilesResource(this.client);
21
+ this.folders = new folders_1.FoldersResource(this.client);
22
+ this.teams = new teams_1.TeamsResource(this.client);
23
+ this.webhooks = new webhooks_1.WebhooksResource(this.client);
24
+ this.shares = new shares_1.SharesResource(this.client);
25
+ this.apiKeys = new misc_1.ApiKeysResource(this.client);
26
+ this.auth = new misc_1.AuthResource(this.client);
27
+ this.session = new misc_1.SessionResource(this.client);
28
+ this.auditLogs = new misc_1.AuditLogsResource(this.client);
29
+ this.health = new misc_1.HealthResource(this.client);
30
+ this.updates = new misc_1.UpdatesResource(this.client);
31
+ this.dns = new misc_1.DnsResource(this.client);
32
+ this.settings = new misc_1.SettingsResource(this.client);
33
+ this.publicUploadLinks = new misc_1.PublicUploadLinksResource(this.client);
34
+ this.download = new misc_1.DownloadResource(this.client);
35
+ }
36
+ }
37
+ exports.FlexiBuckets = FlexiBuckets;
38
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AACpC,iDAAsD;AACtD,6CAAkD;AAClD,iDAAsD;AACtD,6CAAkD;AAClD,mDAAwD;AACxD,+CAAoD;AACpD,2CAW0B;AAO1B,MAAa,YAAY;IAoBvB,YAAY,MAA0B;QACpC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAU,CAAC;YAC3B,OAAO,EAAE,GAAG,OAAO,MAAM;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,MAAM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C;CACF;AA5CD,oCA4CC"}
@@ -0,0 +1,6 @@
1
+ export declare class FlexiBucketsError extends Error {
2
+ status: number;
3
+ code: string;
4
+ body: unknown;
5
+ constructor(status: number, code: string, message: string, body?: unknown);
6
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlexiBucketsError = void 0;
4
+ class FlexiBucketsError extends Error {
5
+ constructor(status, code, message, body) {
6
+ super(message);
7
+ this.name = "FlexiBucketsError";
8
+ this.status = status;
9
+ this.code = code;
10
+ this.body = body;
11
+ }
12
+ }
13
+ exports.FlexiBucketsError = FlexiBucketsError;
14
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAkB,SAAQ,KAAK;IAK1C,YAAY,MAAc,EAAE,IAAY,EAAE,OAAe,EAAE,IAAc;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAZD,8CAYC"}
package/dist/http.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export interface HttpClientConfig {
2
+ baseUrl: string;
3
+ apiKey: string;
4
+ }
5
+ export interface RequestOptions {
6
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
7
+ path: string;
8
+ body?: unknown;
9
+ params?: Record<string, string | number | boolean | undefined>;
10
+ headers?: Record<string, string>;
11
+ }
12
+ export declare class HttpClient {
13
+ private baseUrl;
14
+ private apiKey;
15
+ constructor(config: HttpClientConfig);
16
+ request<T>(options: RequestOptions): Promise<T>;
17
+ get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
18
+ post<T>(path: string, body?: unknown): Promise<T>;
19
+ put<T>(path: string, body?: unknown): Promise<T>;
20
+ patch<T>(path: string, body?: unknown): Promise<T>;
21
+ delete<T>(path: string): Promise<T>;
22
+ }
package/dist/http.js ADDED
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpClient = void 0;
4
+ const errors_1 = require("./errors");
5
+ class HttpClient {
6
+ constructor(config) {
7
+ this.baseUrl = config.baseUrl.replace(/\/+$/, "");
8
+ this.apiKey = config.apiKey;
9
+ }
10
+ async request(options) {
11
+ const url = new URL(`${this.baseUrl}${options.path}`);
12
+ if (options.params) {
13
+ for (const [key, value] of Object.entries(options.params)) {
14
+ if (value !== undefined) {
15
+ url.searchParams.set(key, String(value));
16
+ }
17
+ }
18
+ }
19
+ const headers = {
20
+ "Content-Type": "application/json",
21
+ Authorization: `Bearer ${this.apiKey}`,
22
+ ...options.headers,
23
+ };
24
+ let body;
25
+ if (options.body !== undefined) {
26
+ body = JSON.stringify(options.body);
27
+ }
28
+ const response = await fetch(url.toString(), {
29
+ method: options.method,
30
+ headers,
31
+ body,
32
+ });
33
+ if (!response.ok) {
34
+ let errorBody;
35
+ try {
36
+ errorBody = await response.json();
37
+ }
38
+ catch {
39
+ errorBody = await response.text();
40
+ }
41
+ const errorObj = errorBody;
42
+ throw new errors_1.FlexiBucketsError(response.status, String(errorObj.code ?? response.status), String(errorObj.error ?? response.statusText), errorBody);
43
+ }
44
+ if (response.status === 204 || response.headers.get("content-length") === "0") {
45
+ return undefined;
46
+ }
47
+ return response.json();
48
+ }
49
+ get(path, params) {
50
+ return this.request({ method: "GET", path, params });
51
+ }
52
+ post(path, body) {
53
+ return this.request({ method: "POST", path, body });
54
+ }
55
+ put(path, body) {
56
+ return this.request({ method: "PUT", path, body });
57
+ }
58
+ patch(path, body) {
59
+ return this.request({ method: "PATCH", path, body });
60
+ }
61
+ delete(path) {
62
+ return this.request({ method: "DELETE", path });
63
+ }
64
+ }
65
+ exports.HttpClient = HttpClient;
66
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;AAAA,qCAA6C;AAe7C,MAAa,UAAU;IAIrB,YAAY,MAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,OAAuB;QACtC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAEtD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAA2B;YACtC,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;YACtC,GAAG,OAAO,CAAC,OAAO;SACnB,CAAC;QAEF,IAAI,IAAwB,CAAC;QAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAA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E,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAI,IAAY,EAAE,IAAc;QACnC,OAAO,IAAI,CAAC,OAAO,CAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAI,IAAY;QACpB,OAAO,IAAI,CAAC,OAAO,CAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAhFD,gCAgFC"}
@@ -0,0 +1,4 @@
1
+ export { FlexiBuckets, FlexiBucketsConfig } from "./client";
2
+ export { FlexiBucketsError } from "./errors";
3
+ export { HttpClient } from "./http";
4
+ export * from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.HttpClient = exports.FlexiBucketsError = exports.FlexiBuckets = void 0;
18
+ var client_1 = require("./client");
19
+ Object.defineProperty(exports, "FlexiBuckets", { enumerable: true, get: function () { return client_1.FlexiBuckets; } });
20
+ var errors_1 = require("./errors");
21
+ Object.defineProperty(exports, "FlexiBucketsError", { enumerable: true, get: function () { return errors_1.FlexiBucketsError; } });
22
+ var http_1 = require("./http");
23
+ Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_1.HttpClient; } });
24
+ __exportStar(require("./types"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA4D;AAAnD,sGAAA,YAAY,OAAA;AACrB,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAC1B,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,0CAAwB"}
@@ -0,0 +1,15 @@
1
+ import { HttpClient } from "../http";
2
+ import { Bucket, BucketDetail, BucketCheckLimitResponse, BucketCorsResponse, ImportObjectsResponse, ImportObjectsResult } from "../types";
3
+ export declare class BucketsResource {
4
+ private client;
5
+ constructor(client: HttpClient);
6
+ list(): Promise<Bucket[]>;
7
+ get(id: number): Promise<BucketDetail>;
8
+ delete(id: number): Promise<{
9
+ message: string;
10
+ }>;
11
+ checkLimit(): Promise<BucketCheckLimitResponse>;
12
+ updateCors(): Promise<BucketCorsResponse>;
13
+ getImportObjects(): Promise<ImportObjectsResponse>;
14
+ importObjects(): Promise<ImportObjectsResult>;
15
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BucketsResource = void 0;
4
+ class BucketsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ list() {
9
+ return this.client.get("/v1/buckets");
10
+ }
11
+ get(id) {
12
+ return this.client.get(`/v1/buckets/${id}`);
13
+ }
14
+ delete(id) {
15
+ return this.client.delete(`/buckets/${id}`);
16
+ }
17
+ checkLimit() {
18
+ return this.client.post("/buckets/check-limit");
19
+ }
20
+ updateCors() {
21
+ return this.client.post("/buckets/cors");
22
+ }
23
+ getImportObjects() {
24
+ return this.client.get("/buckets/import-objects");
25
+ }
26
+ importObjects() {
27
+ return this.client.post("/buckets/import-objects");
28
+ }
29
+ }
30
+ exports.BucketsResource = BucketsResource;
31
+ //# sourceMappingURL=buckets.js.map