Add docs for NewAuthorizedTransportWithCache.

This commit is contained in:
Burcu Dogan 2014-06-17 16:24:27 +02:00
Родитель 4337573be3
Коммит db2d8759b4
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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 {