Skip to content

Commit

Permalink
feat: add missing upload fn in bucket api
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Feb 27, 2024
1 parent ebbb4ff commit 0c0e5c0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/storage-kit/src/domains/bucket/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* view the LICENSE file that was distributed with this source code.
*/

import type { AnalysisFile } from '@privateaim/core/src';
import type { BuildInput } from 'rapiq';
import { buildQuery } from 'rapiq';
import { nullifyEmptyObjectProperties } from '@privateaim/core';
Expand Down Expand Up @@ -39,4 +40,14 @@ export class BucketAPI extends BaseAPI {
const response = await this.client.post(`buckets/${id}`, nullifyEmptyObjectProperties(data));
return response.data;
}

async upload(id: Bucket['id'], formData: FormData): Promise<CollectionResourceResponse<AnalysisFile>> {
const response = await this.client.post(`buckets/${id}`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});

return response.data;
}
}

0 comments on commit 0c0e5c0

Please sign in to comment.