From 8f52f3ceadd752ee6f8938d7496ef3a9c6acd3e9 Mon Sep 17 00:00:00 2001 From: Christopher Tarry Date: Wed, 20 Nov 2024 18:31:26 -0500 Subject: [PATCH] rename v2 pubkey contracts endpoint path --- api/client.go | 12 ++++++------ api/server.go | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/api/client.go b/api/client.go index d1d723c4..9316bdc5 100644 --- a/api/client.go +++ b/api/client.go @@ -222,12 +222,6 @@ 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) { @@ -235,6 +229,12 @@ func (c *Client) V2ContractRevisions(id types.FileContractID) (resp []explorer.V 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) diff --git a/api/server.go b/api/server.go index e40fd296..fa4615aa 100644 --- a/api/server.go +++ b/api/server.go @@ -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 @@ -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,