Skip to content

Commit

Permalink
Merge pull request #152 from pteichman/pteichman/new-realtime-client
Browse files Browse the repository at this point in the history
Add NewRealtimeStatsClientForEndpoint API
  • Loading branch information
pteichman authored Apr 14, 2020
2 parents 2f4701a + 6a714b5 commit 94036fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fastly/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ func NewRealtimeStatsClient() *RTSClient {
return &RTSClient{client: c}
}

// NewRealtimeStatsClientForEndpoint creates an RTSClient from a token and endpoint url.
// `token` is a Fastly API token and `endpoint` is RealtimeStatsEndpoint for the production
// realtime stats API.
func NewRealtimeStatsClientForEndpoint(token, endpoint string) (*RTSClient, error) {
c, err := NewClientForEndpoint(token, endpoint)
if err != nil {
return nil, err
}
return &RTSClient{client: c}, nil
}

func (c *Client) init() (*Client, error) {
u, err := url.Parse(c.Address)
if err != nil {
Expand Down

0 comments on commit 94036fe

Please sign in to comment.