Merge pull request #1208 from nymkappa/feature/pools-api-endpoint-update
Replaced /mining/pools?interval=X by /mining/pools/X
This commit is contained in:
		
						commit
						5fd05b3602
					
				| @ -256,7 +256,16 @@ class Server { | |||||||
|         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/1y', routes.$getStatisticsByTime.bind(routes, '1y')) |         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/1y', routes.$getStatisticsByTime.bind(routes, '1y')) | ||||||
|         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/2y', routes.$getStatisticsByTime.bind(routes, '2y')) |         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/2y', routes.$getStatisticsByTime.bind(routes, '2y')) | ||||||
|         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/3y', routes.$getStatisticsByTime.bind(routes, '3y')) |         .get(config.MEMPOOL.API_URL_PREFIX + 'statistics/3y', routes.$getStatisticsByTime.bind(routes, '3y')) | ||||||
|         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools', routes.$getPools) |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/24h', routes.$getPools.bind(routes, '24h')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/3d', routes.$getPools.bind(routes, '3d')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/1w', routes.$getPools.bind(routes, '1w')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/1m', routes.$getPools.bind(routes, '1m')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/3m', routes.$getPools.bind(routes, '3m')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/6m', routes.$getPools.bind(routes, '6m')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/1y', routes.$getPools.bind(routes, '1y')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/2y', routes.$getPools.bind(routes, '2y')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/3y', routes.$getPools.bind(routes, '3y')) | ||||||
|  |         .get(config.MEMPOOL.API_URL_PREFIX + 'mining/pools/all', routes.$getPools.bind(routes, 'all')) | ||||||
|         ; |         ; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -532,9 +532,9 @@ class Routes { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async $getPools(req: Request, res: Response) { |   public async $getPools(interval: string, req: Request, res: Response) { | ||||||
|     try { |     try { | ||||||
|       let stats = await miningStats.$getPoolsStats(req.query.interval as string); |       let stats = await miningStats.$getPoolsStats(interval); | ||||||
|       res.header('Pragma', 'public'); |       res.header('Pragma', 'public'); | ||||||
|       res.header('Cache-control', 'public'); |       res.header('Cache-control', 'public'); | ||||||
|       res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); |       res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); | ||||||
|  | |||||||
| @ -122,10 +122,6 @@ export class ApiService { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   listPools$(interval: string | null) : Observable<PoolsStats> { |   listPools$(interval: string | null) : Observable<PoolsStats> { | ||||||
|     let params = {}; |     return this.httpClient.get<PoolsStats>(this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/pools/${interval}`); | ||||||
|     if (interval) { |  | ||||||
|       params = new HttpParams().set('interval', interval); |  | ||||||
|     } |  | ||||||
|     return this.httpClient.get<PoolsStats>(this.apiBaseUrl + this.apiBasePath + '/api/v1/mining/pools', {params}); |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,15 +11,16 @@ do for url in / \ | |||||||
| 	'/api/v1/statistics/1y' \ | 	'/api/v1/statistics/1y' \ | ||||||
| 	'/api/v1/statistics/2y' \ | 	'/api/v1/statistics/2y' \ | ||||||
| 	'/api/v1/statistics/3y' \ | 	'/api/v1/statistics/3y' \ | ||||||
| 	'/api/v1/mining/pools?interval=24h' \ | 	'/api/v1/mining/pools/24h' \ | ||||||
| 	'/api/v1/mining/pools?interval=3d' \ | 	'/api/v1/mining/pools/3d' \ | ||||||
| 	'/api/v1/mining/pools?interval=1w' \ | 	'/api/v1/mining/pools/1w' \ | ||||||
| 	'/api/v1/mining/pools?interval=1m' \ | 	'/api/v1/mining/pools/1m' \ | ||||||
| 	'/api/v1/mining/pools?interval=3m' \ | 	'/api/v1/mining/pools/3m' \ | ||||||
| 	'/api/v1/mining/pools?interval=6m' \ | 	'/api/v1/mining/pools/6m' \ | ||||||
| 	'/api/v1/mining/pools?interval=1y' \ | 	'/api/v1/mining/pools/1y' \ | ||||||
| 	'/api/v1/mining/pools?interval=2y' \ | 	'/api/v1/mining/pools/2y' \ | ||||||
| 	'/api/v1/mining/pools?interval=3y' \ | 	'/api/v1/mining/pools/3y' \ | ||||||
|  | 	'/api/v1/mining/pools/all' \ | ||||||
| 
 | 
 | ||||||
| 	do | 	do | ||||||
| 		curl -s "https://${hostname}${url}" >/dev/null | 		curl -s "https://${hostname}${url}" >/dev/null | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user