This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: orders metrics endpoints added (#602)
* feat: orders metrics endpoints added * fix: console.log removed
- Loading branch information
Showing
5 changed files
with
59 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import BaseExtend from '../extends/base' | ||
import { formatQueryParams } from '../utils/helpers' | ||
|
||
class MetricsEndpoint extends BaseExtend { | ||
constructor(endpoint) { | ||
super(endpoint) | ||
|
||
this.endpoint = 'metrics' | ||
} | ||
|
||
TotalOrders(query) { | ||
const formattedString = formatQueryParams(query) | ||
return this.request.send( | ||
`${this.endpoint}/orders/total?${formattedString}`, | ||
'GET' | ||
) | ||
} | ||
|
||
TotalValue(query) { | ||
const formattedString = formatQueryParams(query) | ||
return this.request.send( | ||
`${this.endpoint}/orders/value?${formattedString}`, | ||
'GET' | ||
) | ||
} | ||
} | ||
|
||
export default MetricsEndpoint |
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
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,19 @@ | ||
import { ResourcePage } from './core' | ||
|
||
export interface MetricsBase { | ||
value: number | ||
time: string | ||
} | ||
|
||
export interface MetricsQuery { | ||
currency?: string | ||
from: string | ||
to: string | ||
interval: string | ||
} | ||
|
||
export interface MetricsEndpoint { | ||
TotalOrders(query: MetricsQuery): Promise<ResourcePage<MetricsBase>> | ||
|
||
TotalValue(query: MetricsQuery): Promise<ResourcePage<MetricsBase>> | ||
} |
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