@eleva-io/erp-sdk
Version:
SDK oficial para el ERP de Eleva
97 lines • 3.65 kB
JavaScript
import { CRUD } from '../../../../utils/crud';
import { CommunitiesConfigAPI } from './communities_config';
import { CommunitiesEmployeesAPI } from './employees';
import { CommunitiesBlocksAPI } from './blocks';
import { CommunitiesProvidersAPI } from './providers';
import { CommunitiesAgentsAPI } from './agents';
import { CommunitiesRolesAPI } from './roles';
import { ReceiptsAPI } from './receipts';
import { DocumentsAPI } from './documents';
import { RouteTrackingsConfigAPI } from './route_trackings';
import { CommonAreasAPI } from './common_area';
export class CommunitiesAPI extends CRUD {
_communityId;
constructor(httpClient, baseUrl, _communityId) {
super(httpClient, {
basePath: baseUrl,
id: _communityId,
});
this._communityId = _communityId;
}
config() {
return new CommunitiesConfigAPI(this._httpClient, `${this._config.basePath}/config`);
}
agents() {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommunitiesAgentsAPI(this._httpClient, {
basePath: `${this._config.basePath}/${this._communityId}/agents`,
methods: {
isReadEnabled: false,
},
});
}
roles() {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommunitiesRolesAPI(this._httpClient, {
basePath: `${this._config.basePath}/${this._communityId}/roles`,
methods: {
isReadEnabled: false,
},
});
}
employees() {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommunitiesEmployeesAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/employees`);
}
providers() {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommunitiesProvidersAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/providers`);
}
blocks(id) {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommunitiesBlocksAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/blocks`, id);
}
documents(id) {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new DocumentsAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/documents`, id);
}
receipts(id) {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new ReceiptsAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/receipts`, id);
}
routeTrackings() {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new RouteTrackingsConfigAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/route-tracking`);
}
residents(query) {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return this._httpClient.get(`${this._config.basePath}/${this._communityId}/residents`, {
query,
});
}
commonAreas(id) {
if (!this._communityId) {
throw new Error('Community ID is required');
}
return new CommonAreasAPI(this._httpClient, `${this._config.basePath}/${this._communityId}/common-areas`, id);
}
}
//# sourceMappingURL=communities.js.map