cloudkit-js
Version:
A JS library for managing a CloudKit container
42 lines (41 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UrlBuilder = void 0;
class UrlBuilder {
constructor(initParams) {
this.versionNumber = 1;
this.containerName = initParams.containerName;
this.environment = initParams.environment;
this.database = initParams.database || "public";
}
getBasePath() {
return [
`/database`,
this.versionNumber,
this.containerName,
this.environment,
this.database
].join('/');
}
/** Records */
getModifyRecordsPath() {
return `${this.getBasePath()}/records/modify`;
}
getQueryRecordsPath() {
return `${this.getBasePath()}/records/query`;
}
getLookupRecordsPath() {
return `${this.getBasePath()}/records/lookup`;
}
getResolveRecordsPath() {
return `${this.getBasePath()}/records/resolve`;
}
getShareAcceptPath() {
return `${this.getBasePath()}/records/shares/accept`;
}
/** Assets */
getUploadAssetsPath() {
return `${this.getBasePath()}/assets/upload`;
}
}
exports.UrlBuilder = UrlBuilder;