// New initializes the Gitter API client
//
// For example:
//  api := gitter.New("YOUR_ACCESS_TOKEN")
423327
func New(token string) *Gitter {

	transport := &httpclient.Transport{
		ConnectTimeout:   5 * time.Second,
		ReadWriteTimeout: 40 * time.Second,
	}
	defer transport.Close()

	s := &Gitter{}
	s.config.apiBaseURL = apiBaseURL
	s.config.streamBaseURL = streamBaseURL
	s.config.token = token
	s.config.client = &http.Client{
		Transport: transport,
	}
	return s
}
630794
func New(auth Auth) (*Client, error) {
	if err := auth.validate(); err != nil {
		return nil, err
	}

	return &Client{
		c:        &http.Client{},
		username: auth.Username,
		apiKey:   auth.Apikey,
	}, nil
}
37410
func New(path ...string) (client ClientAPI, err error) {
	socketPath := socket
	if len(path) > 0 {
		socketPath = path[0]
	}

	conn, err := net.Dial("unix", socketPath)
	if err != nil {
		return
	}

	client = &Client{
		conn:   conn,
		writer: bufio.NewWriter(conn),
		reply:  make(chan Reply),
	}

	go client.read()

	return
}
853100
func New(client *docker.Client, conf *config.Config, logger *log.Logger) *API {
	return &API{client, conf, logger, nil}
}
388700
func New(crioSocketPath string) (CrioClient, error) {
	tr := new(http.Transport)
	configureUnixTransport(tr, "unix", crioSocketPath)
	c := &http.Client{
		Transport: tr,
	}
	return &crioClientImpl{
		client:         c,
		crioSocketPath: crioSocketPath,
	}, nil
}
191400
func New(c Doer) *Client {
	if c == nil {
		c = HTTPClientDoer(http.DefaultClient)
	}
	return &Client{Doer: c}
}
398000
func New(c transport.ClientConfig, opts ...thrift.ClientOption) Interface {
	return client{
		c: thrift.New(thrift.Config{
			Service:      "Echo",
			ClientConfig: c,
		}, opts...),
	}
}
459983
func New() *Client {
	return &Client{
		Concurrency:    DefaultClient.Concurrency,
		MaxRetries:     DefaultClient.MaxRetries,
		Backoff:        DefaultClient.Backoff,
		ErrLog:         DefaultClient.ErrLog,
		wg:             &sync.WaitGroup{},
		RetryOnHTTP429: false,
	}
}
844558
func New(uaaURL, clientKey, secret, callbackURL string, scopes ...string) *Provider {
	uaaURL = strings.TrimSuffix(uaaURL, "/")
	p := &Provider{
		ClientKey:    clientKey,
		Secret:       secret,
		CallbackURL:  callbackURL,
		AuthURL:      uaaURL + "/oauth/authorize",
		TokenURL:     uaaURL + "/oauth/token",
		UserInfoURL:  uaaURL + "/userinfo",
		providerName: "cloudfoundry",
	}
	p.config = newConfig(p, scopes)
	return p
}
502085
func New(caller base.APICaller) API {
	fc := base.NewFacadeCaller(caller, uaFacade)
	return API{facade: fc}
}
278464
func New(params Parameters) (*Client, error) {
	signer, err := LoadX509Signer(params.PrivateKeyPath, params.CertificatePath)
	if err != nil {
		return nil, err
	}
	return &Client{
		Client: minter.NewTokenMinterPRPCClient(&prpc.Client{
			C:    params.Client,
			Host: params.Backend,
			Options: &prpc.Options{
				Retry:    params.Retry,
				Insecure: params.Insecure,
			},
		}),
		Signer: signer,
	}, nil
}
331604
func New(host, authtoken string) (*TCP, error) {
	client := &TCP{
		host:     host,
		messages: make(chan mist.Message),
		token:    authtoken,
	}

	return client, client.connect()
}
124363
func New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {
	return getC().New(params)
}
92363
func New(config []byte, opts ...func(*Client)) (Client, error) {
	var parsedConfig Config

	if err := util.Unmarshal(config, &parsedConfig); err != nil {
		return Client{}, err
	}

	tlsConfig, err := parsedConfig.validateAndInjectDefaults()
	if err != nil {
		return Client{}, err
	}

	// Ensure we use a http.Transport with proper settings: the zero values are not
	// a good choice, as they cause leaking connections:
	// https://github.com/golang/go/issues/19620
	//
	// Also, there's no simple way to copy the values from http.DefaultTransport,
	// see https://github.com/golang/go/issues/26013. Hence, we copy the settings
	// used in the golang sources,
	// https://github.com/golang/go/blob/5fae09b7386de26db59a1184f62fc7b22ec7667b/src/net/http/transport.go#L42-L53
	//   Copyright 2011 The Go Authors. All rights reserved.
	//   Use of this source code is governed by a BSD-style
	//   license that can be found in the LICENSE file.
	var tr http.RoundTripper = &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
		TLSClientConfig:       tlsConfig,
	}

	// copy, we don't want to alter the default client's Transport
	c := *http.DefaultClient
	c.Transport = tr

	client := Client{
		config: parsedConfig,
		Client: c,
	}

	for _, f := range opts {
		f(&client)
	}

	return client, nil
}
1174603
func New(baseurl string) (*Client, error) {
	base, err := url.ParseRequestURI(baseurl)
	if err != nil {
		return nil, err
	} else if !base.IsAbs() || base.Host == "" {
		return nil, fmt.Errorf("URL is not absolute: %s", baseurl)
	}

	// create the client
	client := &Client{
		Driver:     &http.Client{}, // Don't use default client; shares by reference
		Headers:    http.Header(make(map[string][]string)),
		base:       base,
		KeepAlives: true,
	}

	return client, nil
}
793060
func New(c dropbox.Config) Client {
	ctx := apiImpl(dropbox.NewContext(c))
	return &ctx
}
873019
func New(token string, url string) *API {
	api := new(API)
	api.Endpoint = url
	api.Client = newRestClient(token)
	return api
}