Files
update_field_api/node_modules/@arco/clarizen-lib/dist/objects.js
T

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-06-09 18:35:55 -03:00
export function entityObjectPath(typeName, id) {
const type = encodeURIComponent(typeName);
if (id) {
const entityId = id.includes("/") ? id.split("/").pop() : id;
return `/V2.0/services/data/objects/${type}/${encodeURIComponent(entityId)}`;
}
return `/V2.0/services/data/objects/${type}`;
}
export class EntityObjectsService {
http;
constructor(http) {
this.http = http;
}
get(typeName, id, options) {
const query = {};
if (options?.fields?.length) {
query.fields = options.fields.join(",");
}
return this.http.request(entityObjectPath(typeName, id), {
method: "GET",
query,
});
}
create(typeName, fields) {
return this.http.request(entityObjectPath(typeName), {
method: "PUT",
body: fields,
});
}
update(typeName, id, fields) {
return this.http.request(entityObjectPath(typeName, id), {
method: "POST",
body: fields,
});
}
delete(typeName, id) {
return this.http.request(entityObjectPath(typeName, id), {
method: "DELETE",
});
}
}
//# sourceMappingURL=objects.js.map