From db2d8759b42d93f857fc2507fe973ef9ef5a0338 Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Tue, 17 Jun 2014 16:24:27 +0200 Subject: [PATCH] Add docs for NewAuthorizedTransportWithCache. --- transport.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/transport.go b/transport.go index 800245a..67ea969 100644 --- a/transport.go +++ b/transport.go @@ -86,13 +86,17 @@ type authorizedTransport struct { mu sync.RWMutex } -// NewAuthorizedTransport creates a tranport that uses the provided +// NewAuthorizedTransport creates a transport that uses the provided // token fetcher to retrieve new tokens if there is no access token // provided or it is expired. func NewAuthorizedTransport(fetcher TokenFetcher, token *Token) Transport { return &authorizedTransport{fetcher: fetcher, token: token} } +// NewAuthorizedTransportWithCache creates a new transport that uses +// the provided token fetcher and cache. Before constructing the new +// transport, it will try to read from the cache to see if there +// is an existing token. func NewAuthorizedTransportWithCache(fetcher TokenFetcher, cache Cache) (transport Transport, err error) { var token *Token if token, err = cache.Read(); err != nil {