From 0402f0bac65576d784e183c092f1662e758f0dc1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 28 Oct 2023 00:51:08 +0300 Subject: [PATCH] CLS 109 fix getting genesis block (#4) * remove requiered tag from block height * added block requests --- .run/requests/block.http | 24 ++++++++++++++++++++++++ cmd/api/handler/block.go | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .run/requests/block.http diff --git a/.run/requests/block.http b/.run/requests/block.http new file mode 100644 index 00000000..ce7ef006 --- /dev/null +++ b/.run/requests/block.http @@ -0,0 +1,24 @@ +### Get blocks list +http://{{host}}/v1/block + +### Get blocks count +http://{{host}}/v1/block/count + +### Get genesis block +http://{{host}}/v1/block/0 + +### Get block by height +http://{{host}}/v1/block/12 + +### Get block events +http://{{host}}/v1/block/20345/events + +### Get block stats +http://{{host}}/v1/block/20345/stats + +### Get block namespaces +http://{{host}}/v1/block/20345/namespace + +### Get block namespaces count +http://{{host}}/v1/block/20345/namespace/count + diff --git a/cmd/api/handler/block.go b/cmd/api/handler/block.go index 24adfb95..ee1ce808 100644 --- a/cmd/api/handler/block.go +++ b/cmd/api/handler/block.go @@ -40,11 +40,11 @@ func NewBlockHandler( } type getBlockByHeightRequest struct { - Height types.Level `param:"height" validate:"required,min=0"` + Height types.Level `param:"height" validate:"min=0"` } type getBlockRequest struct { - Height types.Level `param:"height" validate:"required,min=0"` + Height types.Level `param:"height" validate:"min=0"` Stats bool `query:"stats" validate:"omitempty"` }