Skip to content

Commit

Permalink
rename v2 pubkey contracts endpoint path
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Nov 20, 2024
1 parent 3a63eb8 commit 8f52f3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,19 @@ func (c *Client) V2Contracts(ids []types.FileContractID) (resp []explorer.V2File
return
}

// V2ContractsKey returns the v2 contracts for a particular ed25519 key.
func (c *Client) V2ContractsKey(key types.PublicKey) (resp []explorer.V2FileContract, err error) {
err = c.c.GET(fmt.Sprintf("/pubkey/%s/v2/contracts", key), &resp)
return
}

// V2ContractRevisions returns all the revisions of the contract with the
// specified ID.
func (c *Client) V2ContractRevisions(id types.FileContractID) (resp []explorer.V2FileContract, err error) {
err = c.c.GET(fmt.Sprintf("/v2/contracts/%s/revisions", id), &resp)
return
}

// V2ContractsKey returns the v2 contracts for a particular ed25519 key.
func (c *Client) V2ContractsKey(key types.PublicKey) (resp []explorer.V2FileContract, err error) {
err = c.c.GET(fmt.Sprintf("/v2/pubkey/%s/contracts", key), &resp)
return
}

// Host returns information about the host with a given ed25519 key.
func (c *Client) Host(key types.PublicKey) (resp explorer.Host, err error) {
err = c.c.GET(fmt.Sprintf("/pubkey/%s/host", key), &resp)
Expand Down
9 changes: 5 additions & 4 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ func (s *server) v2ContractsIDRevisionsHandler(jc jape.Context) {
jc.Encode(fcs)
}

func (s *server) pubkeyV2ContractsHandler(jc jape.Context) {
func (s *server) v2PubkeyContractsHandler(jc jape.Context) {
var key types.PublicKey
if jc.DecodeParam("key", &key) != nil {
return
Expand Down Expand Up @@ -705,9 +705,10 @@ func NewServer(e Explorer, cm ChainManager, s Syncer) http.Handler {
"GET /v2/contracts/:id/revisions": srv.v2ContractsIDRevisionsHandler,
"POST /v2/contracts": srv.v2ContractsBatchHandler,

"GET /pubkey/:key/v2/contracts": srv.pubkeyV2ContractsHandler,
"GET /pubkey/:key/contracts": srv.pubkeyContractsHandler,
"GET /pubkey/:key/host": srv.pubkeyHostHandler,
"GET /v2/pubkey/:key/contracts": srv.v2PubkeyContractsHandler,

"GET /pubkey/:key/contracts": srv.pubkeyContractsHandler,
"GET /pubkey/:key/host": srv.pubkeyHostHandler,

"GET /metrics/block": srv.blocksMetricsHandler,
"GET /metrics/block/:id": srv.blocksMetricsIDHandler,
Expand Down

0 comments on commit 8f52f3c

Please sign in to comment.