ministry-platform-provider
Version:
TypeScript client library for Ministry Platform API integration
38 lines (37 loc) • 1.26 kB
JavaScript
export class DomainService {
client;
constructor(client) {
this.client = client;
}
/**
* Returns the basic information about the current domain.
* @returns Promise with the domain information
*/
async getDomainInfo() {
try {
await this.client.ensureValidToken();
return await this.client.getHttpClient().get('/domain');
}
catch (error) {
console.error('Error getting domain info:', error);
throw error;
}
}
/**
* Returns the lookup values to be used as global filters. The key corresponds to
* an identifier and the value corresponds to a friendly name (description). Zero (0)
* identifier corresponds to records with not assigned filters.
* @param params Optional parameters for the global filters request
* @returns Promise with an array of global filter items
*/
async getGlobalFilters(params) {
try {
await this.client.ensureValidToken();
return await this.client.getHttpClient().get('/domain/filters', params);
}
catch (error) {
console.error('Error getting global filters:', error);
throw error;
}
}
}