5. Data Debits
Data Debits
Get all the Data Debits
The are 2 ways to fetch data debits:
With default options.
Response:
Array<DataDebit>: An array of Data Debits.
Example:
try {
const result = await hat.dataDebits().getAllDefault();
if (result.parsedBody) {
// result.parsedBody contains an array of Data Debits.
}
} catch (error) {
// Failed to fetch Data Debits.
}
2. With custom options.
Parameters
Type
options
Object
Response:
Array<DataDebit>: An array of Data Debits.
Example:
// In custom options you can specify the following parameters: "ordering", "orderBy", "take", "skip"
const options = {
ordering: "descending",
orderBy: "name"
};
try {
const result = await hat.dataDebits().getAll(options);
if (result.parsedBody) {
// result.parsedBody contains an array of Data Debits.
}
} catch (error) {
// Failed to fetch Data Debits.
}
Get a Data Debit with a specific ID
Parameters
Type
DataDebitId
string
Response: DataDebit: The Data Debit object.
Example:
try {
const result = await hat.dataDebits().getById("your-data-debit-id");
if (result.parsedBody) {
// result.parsedBody contains the data debit.
}
} catch (e) {
// Failed to get Data Debit by ID...
}
Get Data Debit values
Parameters
Type
DataDebitId
string
Response:
DataDebitValues: The Data Debit values bundle.
Response type:
interface DataDebitValues<T> {
bundle: { [endpoint: string]: Array<HatRecord<T>> };
}
Example:
try {
const result = await hat.dataDebits().getDataDebitValues("your-data-debit-id");
if (result.parsedBody) {
// result.parsedBody contains the bundle.
}
} catch (error) {
// Failed to get Data Debit values...
}
Last updated
Was this helpful?