ministry-platform-provider
Version:
TypeScript client library for Ministry Platform API integration
34 lines (33 loc) • 990 B
JavaScript
export class MetadataService {
client;
constructor(client) {
this.client = client;
}
/**
* Triggers an update of the metadata cache on all servers and in all applications.
*/
async refreshMetadata() {
try {
await this.client.ensureValidToken();
await this.client.getHttpClient().get('/refreshMetadata');
}
catch (error) {
console.error('Error refreshing metadata:', error);
throw error;
}
}
/**
* Returns the list of tables available to the current user with basic metadata.
*/
async getTables(search) {
try {
await this.client.ensureValidToken();
const params = search ? { $search: search } : undefined;
return await this.client.getHttpClient().get('/tables', params);
}
catch (error) {
console.error('Error getting tables:', error);
throw error;
}
}
}