@oystehr/sdk
Version:
Oystehr SDK
87 lines (84 loc) • 3.9 kB
JavaScript
import { SDKResource } from '../../client/client.js';
import { uploadFile, downloadFile, getPresignedUrlForZ3Url } from './z3-ext.js';
// AUTOGENERATED -- DO NOT EDIT
class Z3 extends SDKResource {
constructor(config) {
super(config);
}
#baseUrlThunk() {
return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
}
/**
* Uploads a file to the bucket and key. Files should be Blobs.
* @param params upload file params
*/
uploadFile = uploadFile;
/**
* Downloads an object matching the bucket and key. File content is returned as an ArrayBuffer.
* @param params download file params
*/
downloadFile = downloadFile;
/**
* This helper performs a `getPresignedUrl` request for Z3 URLs of the forms
* `https://projects-api.oystehr.com/v1/z3/<bucket>/<key>` or `z3://<bucket>/<key>`
* instead of the standard SDK `Z3GetPresignedUrlParams`.
* @param params url and action
*/
getPresignedUrlForZ3Url = getPresignedUrlForZ3Url;
/**
* List all Z3 Buckets. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:ListBuckets`
* Access Policy Resource: `Z3:BucketName`
*/
listBuckets(request) {
return this.request('/z3', 'get', this.#baseUrlThunk.bind(this))(request);
}
/**
* Create a Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:CreateBucket`
* Access Policy Resource: `Z3:*`
*/
createBucket(params, request) {
return this.request('/z3/{bucketName}', 'put', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Delete the Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:DeleteBucket`
* Access Policy Resource: `Z3:BucketName`
*/
deleteBucket(params, request) {
return this.request('/z3/{bucketName}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* List all Z3 Objects at the provided path in the Bucket with the provided name [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:ListObjects`
* Access Policy Resource: `Z3:BucketName:ObjectPath`
*/
listObjects(params, request) {
return this.request('/z3/{bucketName}/{objectPath+}', 'get', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Get a link for downloading or uploading a Z3 Object to the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:PutObject` or `Z3:GetObject`
* Access Policy Resource: `Z3:BucketName:ObjectPath`
*/
getPresignedUrl(params, request) {
return this.request('/z3/{bucketName}/{objectPath+}', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Delete the Z3 Object at the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
*
* Access Policy Action: `Z3:DeleteObject`
* Access Policy Resource: `Z3:BucketName:ObjectPath`
*/
deleteObject(params, request) {
return this.request('/z3/{bucketName}/{objectPath+}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
}
}
export { Z3 };
//# sourceMappingURL=z3.js.map