Creates an instance of DataSourceClient.
const httpClient = new HttpClient();
const client = new DataSourceClient(httpClient);
The HttpClient instance to use for API requests.
Creates a new data source.
const request: DataSourceRequest = { name: 'New DataSource', url: 'https://mydatasource.com', schemaId: '123', audience: 'myaudience', subject: 'mysubject', nonce: 'uniqueNonce' };
const response = await client.create(request);
Retrieves a data source by ID.
const id = '123';
const response = await client.get(id);
The ID of the data source to retrieve.
Updates a data source by ID.
const id = '123';
const request: DataSourceRequest = { name: 'Updated DataSource', url: 'https://mydatasource.com', schemaId: '123', audience: 'myaudience', subject: 'mysubject', nonce: 'uniqueNonce' };
const response = await client.update(id, request);
The ID of the data source to update.
Deletes a data source by ID.
const id = '123';
const response = await client.delete(id);
The ID of the data source to delete.
This method refreshes the DataSource token using dataSourceId, tokenLifetimeMinutes & nonceGenerator.
A promise that resolves to an object containing a cancel method that cancels the timer.
try {
const result = await dataSourceClient.scheduleJWSTokenRefresh('myDataSourceId', 'uniqueNonce', 'myTokenLifeTimeMinutes');
// Use the cancel function if needed!
result.cancel();
} catch (error) {
console.error('Error scheduling JWS refresh for data source:', error);
}
The id of the data source.
The refresh interval in minutes for the data source. Defaults to 60 mins. Should be an integer.
Accepts an nonceGenerator, developer can provide their own nonceGenerator, defaults to randomUUID.
Client for interacting with the /dataSource API.