Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing top-level HAL links (except for /POST transactions) #2407

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,22 @@ type Root struct {
Accounts *hal.Link `json:"accounts,omitempty"`
AccountTransactions hal.Link `json:"account_transactions"`
Assets hal.Link `json:"assets"`
Effects hal.Link `json:"effects"`
FeeStats hal.Link `json:"fee_stats"`
Friendbot *hal.Link `json:"friendbot,omitempty"`
Ledger hal.Link `json:"ledger"`
Ledgers hal.Link `json:"ledgers"`
Offer *hal.Link `json:"offer,omitempty"`
Offers *hal.Link `json:"offers,omitempty"`
Operation hal.Link `json:"operation"`
Operations hal.Link `json:"operations"`
OrderBook hal.Link `json:"order_book"`
Payments hal.Link `json:"payments"`
Self hal.Link `json:"self"`
StrictReceivePaths *hal.Link `json:"strict_receive_paths"`
StrictSendPaths *hal.Link `json:"strict_send_paths"`
TradeAggregations hal.Link `json:"trade_aggregations"`
Trades hal.Link `json:"trades"`
2opremio marked this conversation as resolved.
Show resolved Hide resolved
Transaction hal.Link `json:"transaction"`
Transactions hal.Link `json:"transactions"`
} `json:"_links"`
Expand Down
9 changes: 9 additions & 0 deletions services/horizon/internal/resourceadapter/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func PopulateRoot(
dest.Links.Account = lb.Link("/accounts/{account_id}")
dest.Links.AccountTransactions = lb.PagedLink("/accounts/{account_id}/transactions")
dest.Links.Assets = lb.Link("/assets{?asset_code,asset_issuer,cursor,limit,order}")
dest.Links.Effects = lb.Link("/effects{?cursor,limit,order}")
dest.Links.Ledger = lb.Link("/ledger/{sequence}")
dest.Links.Ledger = lb.Link("/ledgers{?cursor,limit,order}")
dest.Links.FeeStats = lb.Link("/fee_stats")
dest.Links.Operation = lb.Link("/operations/{id}")
dest.Links.Operations = lb.Link("/operations{?cursor,limit,order,include_failed}")
dest.Links.Payments = lb.Link("/payments{?cursor,limit,order,include_failed}")
dest.Links.TradeAggregations = lb.Link("/trade_aggregations?base_asset_type={base_asset_type}&base_asset_code={base_asset_code}&base_asset_issuer={base_asset_issuer}&counter_asset_type={counter_asset_type}&counter_asset_code={counter_asset_code}&counter_asset_issuer={counter_asset_issuer}")
dest.Links.Trades = lb.Link("/trades?base_asset_type={base_asset_type}&base_asset_code={base_asset_code}&base_asset_issuer={base_asset_issuer}&counter_asset_type={counter_asset_type}&counter_asset_code={counter_asset_code}&counter_asset_issuer={counter_asset_issuer}")

accountsLink := lb.Link(templates["accounts"])
offerLink := lb.Link("/offers/{offer_id}")
Expand Down