Skip to content

Commit

Permalink
refactor: removal of dead endpoints (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
Highjhacker authored Nov 14, 2020
1 parent b2a1cfb commit 0cc9000
Show file tree
Hide file tree
Showing 21 changed files with 1 addition and 1,062 deletions.
12 changes: 0 additions & 12 deletions client/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,3 @@ func (s *BlocksService) Transactions(ctx context.Context, id int64, query *Pagin

return responseStruct, resp, err
}

// Filter all blocks by the given criteria.
func (s *BlocksService) Search(ctx context.Context, query *Pagination, body *BlocksSearchRequest) (*Blocks, *http.Response, error) {
var responseStruct *Blocks
resp, err := s.client.SendRequest(ctx, "POST", "blocks/search", query, body, &responseStruct)

if err != nil {
return nil, resp, err
}

return responseStruct, resp, err
}
24 changes: 0 additions & 24 deletions client/blocks_requests.go

This file was deleted.

101 changes: 0 additions & 101 deletions client/blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,104 +424,3 @@ func TestBlocksService_Transactions(t *testing.T) {
}},
})
}

// Filter all blocks by the given criteria.
func TestBlocksService_Search(t *testing.T) {
client, mux, _, teardown := setupTest()
defer teardown()

mux.HandleFunc("/blocks/search", func(writer http.ResponseWriter, request *http.Request) {
testMethod(t, request, "POST")
fmt.Fprint(writer,
`{
"meta": {
"count": 1,
"pageCount": 1,
"totalCount": 1,
"next": null,
"previous": null,
"self": "/api/blocks/search?page=1&limit=1",
"first": "/api/blocks/search?page=1&limit=1",
"last": "/api/blocks/search?page=1&limit=1"
},
"data": [
{
"id": "dummy",
"version": 0,
"height": 10,
"previous": "dummy",
"forged": {
"reward": "200000000",
"fee": "0",
"total": "200000000",
"amount": "0"
},
"payload": {
"hash": "dummy",
"length": 0
},
"generator": {
"username": "dummy",
"address": "dummy",
"publicKey": "dummy"
},
"signature": "dummy",
"confirmations": 0,
"transactions": 0,
"timestamp": {
"epoch": 40678848,
"unix": 1530780048,
"human": "2018-07-05T08:40:48Z"
}
}
]
}`)
})

query := &Pagination{Limit: 1}
body := &BlocksSearchRequest{Id: "dummy"}
responseStruct, response, err := client.Blocks.Search(context.Background(), query, body)
testGeneralError(t, "Blocks.Search", err)
testResponseUrl(t, "Blocks.Search", response, "/api/blocks/search")
testResponseStruct(t, "Blocks.Search", responseStruct, &Blocks{
Meta: Meta{
Count: 1,
PageCount: 1,
TotalCount: 1,
Next: "",
Previous: "",
Self: "/api/blocks/search?page=1&limit=1",
First: "/api/blocks/search?page=1&limit=1",
Last: "/api/blocks/search?page=1&limit=1",
},
Data: []Block{{
Id: "dummy",
Version: 0,
Height: 10,
Previous: "dummy",
Forged: BlockForged{
Reward: 200000000,
Fee: 0,
Total: 200000000,
Amount: 0,
},
Payload: BlockPayload{
Hash: "dummy",
Length: 0,
},
Generator: BlockGenerator{
Username: "dummy",
Address: "dummy",
PublicKey: "dummy",
},
Signature: "dummy",
Confirmations: 0,
Transactions: 0,
Timestamp: Timestamp{
Epoch: 40678848,
Unix: 1530780048,
Human: "2018-07-05T08:40:48Z",
},
}},
})
}
17 changes: 0 additions & 17 deletions client/bridgechain_requests.go

This file was deleted.

56 changes: 0 additions & 56 deletions client/bridgechains.go

This file was deleted.

26 changes: 0 additions & 26 deletions client/bridgechains_responses.go

This file was deleted.

Loading

0 comments on commit 0cc9000

Please sign in to comment.