Exemple #1
0
func main() {
	client := http.Client{
		Transport: httplogger.NewLoggedTransport(http.DefaultTransport, newLogger()),
	}

	client.Get("http://google.com")
}
Exemple #2
0
// NewClient return a new Client
func NewClient(apiUrl, apiKey string, httpClients ...*http.Client) *Client {
	var httpClient *http.Client

	if len(httpClients) > 0 {
		httpClient = httpClients[0]
	} else {
		httpClient = &http.Client{
			Transport: httplogger.NewLoggedTransport(http.DefaultTransport, newLogger()),
		}
	}

	base := sling.New().Client(httpClient).Base(apiUrl).Set("X-Dostow-Group-Access-Key", apiKey)
	return &Client{
		sling:  base,
		Schema: newSchemaService(base.New()),
		Auth:   newAuthService(base.New()),
		Store:  newStoreService(base.New()),
	}
}