-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added directory tree & usage method. (#107)
- Loading branch information
Showing
5 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Usage information of credits | ||
*/ | ||
export interface Consumption { | ||
/** | ||
* UTC millis timestamp of the day. | ||
*/ | ||
day: number | ||
|
||
/** | ||
* Number of credits consumed for the specific day. | ||
*/ | ||
usage: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { getUsage } from './index' | ||
|
||
describe('Test Tatum Service', () => { | ||
it('Test getUsage', async () => { | ||
const usage = await getUsage() | ||
expect(usage).not.toBeNull() | ||
expect(Array.isArray(usage)).toBe(true) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { get } from '../connector/tatum' | ||
import {Currency} from '../model'; | ||
import {Fiat} from '../model'; | ||
import {Rate} from '../model/response/common/Rate'; | ||
import { Consumption, Currency, Fiat, Rate } from '../model'; | ||
|
||
/** | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/getExchangeRate" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const getExchangeRate = async (currency: Fiat | Currency, basePair = Fiat.EUR): Promise<Rate> => | ||
get(`/v3/tatum/rate/${currency}?basePair=${basePair}`); | ||
get(`/v3/tatum/rate/${currency}?basePair=${basePair}`); | ||
|
||
/** | ||
* Returns credit consumption last of month. | ||
* | ||
* For more details, see <a href="https://tatum.io/apidoc#operation/getCredits" target="_blank">Tatum API documentation</a> | ||
*/ | ||
export const getUsage = async (): Promise<Consumption[]> => get('/v3/tatum/usage') |