Пример #1
0
func NewClientWithToken(Consumer *oauth.Consumer, AccessToken string) *http.Client {
	var token oauth.AccessToken
	token.Token = AccessToken
	client, err := Consumer.MakeHttpClient(&token)
	if err != nil {
		log.Error(err)
	}
	return client
}
Пример #2
0
func NewClientWithToken(url string, consumer *oauth.Consumer, AccessToken string) *Client {
	var token oauth.AccessToken
	token.Token = AccessToken
	client, err := consumer.MakeHttpClient(&token)
	if err != nil {
		log.Error(err)
	}
	return &Client{client, url, AccessToken}
}
Пример #3
0
func MakeClient(consumer *oauth.Consumer, accessToken *oauth.AccessToken) (*http.Client, error) {
	if accessToken == nil && accessTokenCache == nil {
		return nil, fmt.Errorf("MakeClient failed - no oauth.AccessToken")
	}
	if accessToken == nil {
		accessToken = accessTokenCache
	}
	if consumer == nil && consumerCache == nil {
		return nil, fmt.Errorf("MakeClient failed - no consumer")
	}
	if consumer == nil {
		consumer = consumerCache
	}
	return consumer.MakeHttpClient(accessToken)
}