@@ -15,37 +15,13 @@ class Assets extends Api
1515 /**
1616 * Get the paginated list of all assets and their metrics and profiles.
1717 *
18- * @param bool $withMetrics existence of this query param filters assets to those with quantitative data
19- * @param bool $withProfiles existence of this query param filters assets to those with qualitative data
20- * @param string|null $fields pare down the returned fields (comma , separated, drill down with a slash /)
21- * @param string|null $sort default sort is "marketcap desc", but the only valid value for this query
22- * param is "id" which translates to "id asc", which is useful for a stable sort while paginating
23- * @param int|null $page Page number, starts at 1. Increment to paginate through
24- * results (until result is empty array)
25- * @param int|null $limit default is 20, max is 500
18+ * @param array $params
2619 * @return array
2720 * @throws Exception
2821 */
29- public function getAll (
30- bool $ withMetrics = false ,
31- bool $ withProfiles = false ,
32- ?string $ fields = null ,
33- ?string $ sort = null ,
34- ?int $ page = null ,
35- ?int $ limit = null
36- ): array {
37- $ params = compact ('fields ' , 'sort ' , 'page ' , 'limit ' );
38- if (true === $ withMetrics ) {
39- $ params ['with-metrics ' ] = '' ;
40- }
41- if (true === $ withProfiles ) {
42- $ params ['with-profiles ' ] = '' ;
43- }
44-
45- $ query = $ this ->queryBuilder ->buildQuery ($ params );
46- $ response = $ this ->client ->getBaseClient ()->get ('/assets ' . $ query );
47-
48- return $ this ->transformer ->transform ($ response );
22+ public function getAll ($ params = []): array
23+ {
24+ return $ this ->all ('assets ' , $ params );
4925 }
5026
5127 /**
@@ -118,35 +94,14 @@ public function getMarketData(string $assetKey, ?string $fields = null): array
11894 * Retrieve historical timeseries data for an asset.
11995 *
12096 * @param string $assetKey This "key" can be the asset's ID (unique), slug (unique), or symbol (non-unique)
121- * @param string $metricID The metricID is a unique identifier which describes the type of data returned by
97+ * @param string $metricId The metricID is a unique identifier which describes the type of data returned by
12298 * time-series endpoints.
123- * @param string|null $start The "start" query parameter can be used to set the start date after which points
124- * are returned.
125- * @param string|null $end The "end" query parameter can be used to set the end date after which no more points
126- * will be returned.
127- * @param string|null $interval Defines what interval the resulting points will be returned in.
128- * @param string|null $columns A comma separated list of strings that controls which columns will be returned and
129- * in what order.
130- * @param string|null $order Order controls whether points in the response are returned in ascending or
131- * descending order.
132- * @param string|null $format Specify format = csv to download data as CSV.
99+ * @param array $params
133100 * @return array
134101 * @throws Exception
135102 */
136- public function getTimeseries (
137- string $ assetKey ,
138- string $ metricID ,
139- ?string $ start = null ,
140- ?string $ end = null ,
141- ?string $ interval = null ,
142- ?string $ columns = null ,
143- ?string $ order = null ,
144- ?string $ format = null
145- ): array {
146- $ query = $ this ->queryBuilder ->buildQuery (compact ('start ' , 'end ' , 'interval ' , 'columns ' , 'order ' , 'format ' ));
147- $ response = $ this ->client ->getBaseClient ()->get ('/assets/ ' . strtolower ($ assetKey ) . '/metrics/ '
148- . $ metricID . '/time-series ' . $ query );
149-
150- return $ this ->transformer ->transform ($ response );
103+ public function getTimeseries (string $ assetKey , string $ metricId , array $ params = []): array
104+ {
105+ return $ this ->timeseries ('assets ' , $ assetKey , $ metricId , $ params );
151106 }
152107}
0 commit comments