(rw http.ResponseWriter, r *http.Request)
| 251 | } |
| 252 | |
| 253 | func (a *explorerAPI) GetBlockByCountV3(rw http.ResponseWriter, r *http.Request) { |
| 254 | vars := mux.Vars(r) |
| 255 | |
| 256 | dbID, err := a.getDBID(vars) |
| 257 | if err != nil { |
| 258 | sendResponse(400, false, err, nil, rw) |
| 259 | return |
| 260 | } |
| 261 | |
| 262 | countStr := vars["count"] |
| 263 | if countStr == "" { |
| 264 | sendResponse(400, false, "empty count", nil, rw) |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | countNumber, err := strconv.ParseInt(countStr, 10, 32) |
| 269 | if err != nil { |
| 270 | sendResponse(400, false, err, nil, rw) |
| 271 | return |
| 272 | } |
| 273 | |
| 274 | count := int32(countNumber) |
| 275 | |
| 276 | height, block, err := a.service.getBlockByCount(dbID, count) |
| 277 | if err != nil { |
| 278 | sendResponse(500, false, err, nil, rw) |
| 279 | return |
| 280 | } |
| 281 | |
| 282 | op := newPaginationFromReq(r) |
| 283 | |
| 284 | sendResponse(200, true, "", a.formatBlockV3(count, height, block, op), rw) |
| 285 | } |
| 286 | |
| 287 | func (a *explorerAPI) GetBlockByHeight(rw http.ResponseWriter, r *http.Request) { |
| 288 | vars := mux.Vars(r) |
nothing calls this directly
no test coverage detected