Skip to content

Commit aed9f25

Browse files
authored
Merge pull request #2 from aviva-verde/deprecate-client
chore(VER-5669): Deprecate Client in clientcredentials.go
2 parents ae09b66 + 20a2b1a commit aed9f25

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clientcredentials/clientcredentials.go

+10
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,20 @@ func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) {
6868
// is returned. See the oauth2.HTTPClient variable.
6969
//
7070
// The returned Client and its Transport should not be modified.
71+
//
72+
// Deprecated: Client exists for historical compatibility and should not be
73+
// used. It is recommended to use ClientWithXRay instead, as it provides much better visibility into the client's behavior.
7174
func (c *Config) Client(ctx context.Context) *http.Client {
7275
return oauth2.NewClient(ctx, c.TokenSource(ctx))
7376
}
7477

78+
// ClientWithXRay returns an HTTP client using the provided token with an attached XRay client..
79+
// The token will auto-refresh as necessary.
80+
//
81+
// The provided context optionally controls which HTTP client
82+
// is returned. See the oauth2.HTTPClient variable.
83+
//
84+
// The returned Client and its Transport should not be modified.
7585
func (c *Config) ClientWithXRay(ctx context.Context, hc *http.Client) *http.Client {
7686
if hc == nil {
7787
hc = http.DefaultClient

0 commit comments

Comments
 (0)