Skip to content

Commit 92929ec

Browse files
committed
godoc cleanup
1 parent fb5fc84 commit 92929ec

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

benchmarks/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func NewClient(cfg *Config, logger retryablehttp.LeveledLogger) (*Client, error)
3636
}, nil
3737
}
3838

39-
// Shutdown gracefully shuts down the Pythnet Hermes client.
39+
// Shutdown gracefully shuts down the Pyth Benchmarks client.
4040
func (c *Client) Shutdown() {
4141
c.client.HTTPClient.CloseIdleConnections()
4242
}

benchmarks/price_updates.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/calbera/go-pyth-client/feeds"
1212
)
1313

14+
// GetHistoricalPriceUpdatesSync queries the `v1/updates/price/{timestamp}` endpoint for all price
15+
// feed IDs together. Takes the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth
16+
// PriceFeed struct and the price feed update data for each pair.
1417
func (c *Client) GetHistoricalPriceUpdatesSync(
1518
_ context.Context, timestamp time.Time, priceFeeds ...string,
1619
) (map[string]*apyth.PythStructsPriceFeed, error) {

client.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,50 @@ import (
1010
"github.com/calbera/go-pyth-client/types"
1111
)
1212

13-
// Benchmarks is the interface that wraps the methods of the benchmarks.Client.
13+
// Benchmarks is the interface of the Benchmarks client.
1414
type Benchmarks interface {
15+
// Queries the `v1/updates/price/{timestamp}` endpoint for all price feed IDs together. Takes
16+
// the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct
17+
// and the price feed update data for each pair.
1518
GetHistoricalPriceUpdatesSync(
1619
ctx context.Context, timestamp time.Time, priceFeeds ...string,
1720
) (map[string]*apyth.PythStructsPriceFeed, error)
21+
22+
// Shutdown gracefully shuts down the Pyth Benchmarks client.
1823
Shutdown()
1924
}
2025

2126
// NewBenchmarks creates a new Pyth Benchmarks client.
2227
var NewBenchmarks = benchmarks.NewClient
2328

24-
// Hermes is the interface that wraps the methods of the hermes.Client.
29+
// Hermes is the interface of the Hermes client.
2530
type Hermes interface {
26-
GetCachedLatestPriceUpdates(
27-
ctx context.Context, priceFeeds ...string,
28-
) (map[string]*types.LatestPriceData, error)
31+
// Queries the `v2/updates/price/latest` endpoint for each price feed individually, in
32+
// parallel. Takes the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth
33+
// PriceFeed struct and the price feed update data for each pair.
2934
GetLatestPriceUpdatesAsync(
3035
ctx context.Context, priceFeeds ...string,
3136
) (map[string]*types.LatestPriceData, error)
37+
38+
// Queries the `v2/updates/price/latest` endpoint for all price feed ID together. Takes the
39+
// price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct and the
40+
// price feed update data for each pair.
3241
GetLatestPriceUpdatesSync(
3342
ctx context.Context, priceFeeds ...string,
3443
) (map[string]*types.LatestPriceData, error)
44+
45+
// Subscribe price feed from the streaming `v2/updates/price/stream` endpoint. Ensures this
46+
// only happens once in the scope of runtime. Any further calls to this are unnecessary and
47+
// no-ops.
3548
SubscribePriceStreaming(ctx context.Context, priceFeeds ...string)
49+
50+
// Queries cached price feed update data, obtained from the SSE streaming endpoint.
51+
// Returns the Pyth PriceFeed struct and the price feed update data for each pair.
52+
GetCachedLatestPriceUpdates(
53+
ctx context.Context, priceFeeds ...string,
54+
) (map[string]*types.LatestPriceData, error)
55+
56+
// Gracefully shuts down the Pyth Hermes client.
3657
Shutdown()
3758
}
3859

hermes/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/calbera/go-pyth-client/types"
1313
)
1414

15-
// Client is a client for the Pythnet Hermes API (https://hermes.pyth.network/docs)
15+
// Client is a client for the Pyth Hermes API (https://hermes.pyth.network/docs)
1616
type Client struct {
1717
// Config for Pyth and HTTP calls.
1818
cfg *Config
@@ -33,7 +33,7 @@ type Client struct {
3333
subscribeOnce sync.Once
3434
}
3535

36-
// NewClient creates a client for the Pythnet Hermes API.
36+
// NewClient creates a client for the Pyth Hermes API.
3737
func NewClient(cfg *Config, logger retryablehttp.LeveledLogger) (*Client, error) {
3838
// Ensure the given configuration is valid.
3939
if err := cfg.Validate(); err != nil {
@@ -67,7 +67,7 @@ func NewClient(cfg *Config, logger retryablehttp.LeveledLogger) (*Client, error)
6767
}, nil
6868
}
6969

70-
// Shutdown gracefully shuts down the Pythnet Hermes client.
70+
// Shutdown gracefully shuts down the Pyth Hermes client.
7171
func (c *Client) Shutdown() {
7272
c.client.HTTPClient.CloseIdleConnections()
7373
}

0 commit comments

Comments
 (0)