// AddClient implements the Store interface
498469
func (fs *FileStore) AddClient(info *spb.ClientInfo) (*Client, error) {
	fs.Lock()
	if _, err := fs.fm.lockFile(fs.clientsFile); err != nil {
		fs.Unlock()
		return nil, err
	}
	_, size, err := writeRecord(fs.clientsFile.handle, nil, addClient, info, info.Size(), fs.crcTable)
	if err != nil {
		fs.fm.unlockFile(fs.clientsFile)
		fs.Unlock()
		return nil, err
	}
	fs.cliFileSize += int64(size)
	fs.fm.unlockFile(fs.clientsFile)
	client := &Client{*info}
	fs.clients[client.ID] = client
	fs.Unlock()
	return client, nil
}
898281
func NewClient(apiDef *raml.APIDefinition, dir string) Client {
	return Client{
		APIDef: apiDef,
		Dir:    dir,
	}
}
229551
func (s *Storage) RemoveClient(id string) (err error) {
	return dbconn.DB.Where("id = ?", id).Delete(&service.Client{}).Error
}
432511
func NewClient(config Config) *Client {
	userAgent := fmt.Sprintf("%s/%s (%s; %s %s)", config.AppName, config.AppVersion, runtime.Version(), runtime.GOARCH, runtime.GOOS)
	return &Client{
		clock:              new(internal.RealTime),
		userAgent:          userAgent,
		jobPollingInterval: config.JobPollingInterval,
		jobPollingTimeout:  config.JobPollingTimeout,
		wrappers:           append([]ConnectionWrapper{newErrorWrapper()}, config.Wrappers...),
	}
}
761390
func GetClient(ctx context.Context) *Client {
	c, ok := ctx.Value(ctxKeyClient).(*Client)
	if !ok {
		return nil
	}
	return c
}
899532
func SetClient(client httptransport.HTTPClient) ClientOption {
	return func(c *Client) { c.client = client }
}
406688
func WithClient(client *http.Client) DevToolsOption {
	return func(d *DevTools) {
		d.client = client
	}
}
1141643
func NewClient(apiKey string) *Client {
	c := &Client{
		URL:        BaseURL,
		key:        apiKey,
		post:       http.PostForm,
		argMarshal: marshallArgs,
	}
	c.apiCall = c.liveAPICaller
	return c
}
1111977
func NewClient(opts ...ClientOpt) *Client {
	c := &Client{
		run:          run,
		declarations: make([]Declaration, 0),
		consumers:    make(map[*Consumer]struct{}),
		publishers:   make(map[*Publisher]struct{}),
		errs:         make(chan error, 100),
		blocking:     make(chan amqp.Blocking, 10),
	}

	for _, o := range opts {
		o(c)
	}
	return c
}
38788
func (m *MockStorage) GetClient(arg0 context.Context, arg1 string) (fosite.Client, error) {
	ret := m.ctrl.Call(m, "GetClient", arg0, arg1)
	ret0, _ := ret[0].(fosite.Client)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1179420
func (s Server) getClient(auth *BasicAuth, storage Storage, w *Response) Client {
	client, err := storage.GetClient(auth.Username)
	if err == ErrNotFound {
		s.setErrorAndLog(w, E_UNAUTHORIZED_CLIENT, nil, "get_client=%s", "not found")
		return nil
	}
	if err != nil {
		s.setErrorAndLog(w, E_SERVER_ERROR, err, "get_client=%s", "error finding client")
		return nil
	}
	if client == nil {
		s.setErrorAndLog(w, E_UNAUTHORIZED_CLIENT, nil, "get_client=%s", "client is nil")
		return nil
	}

	if !CheckClientSecret(client, auth.Password) {
		s.setErrorAndLog(w, E_UNAUTHORIZED_CLIENT, nil, "get_client=%s, client_id=%v", "client check failed", client.GetId())
		return nil
	}

	if client.GetRedirectUri() == "" {
		s.setErrorAndLog(w, E_UNAUTHORIZED_CLIENT, nil, "get_client=%s", "client redirect uri is empty")
		return nil
	}
	return client
}
4909
func NewClient(params ClientParams) Client {
	return newClient(params.ServiceName, params.ClientConfig, params.Options...)
}
1259015
func NewClient(cfg *api.Config) (store *Client, err error) {
	var c *api.Client
	if c, err = api.NewClient(cfg); err != nil {
		return nil, fmt.Errorf("failed to create Consul client %s", err)
	}

	peers, err := c.Status().Peers()
	if err != nil {
		return nil, err
	}
	consulLogger.Infof("consul peers: %v", peers)

	return &Client{
		client: c,
	}, nil

}
559543
func NewClient(host string, port int) (client *Client, err error) {
	client = new(Client)
	client.Host = host
	client.Port = port
	client.Connection, err = net.Dial("tcp", fmt.Sprintf("%v:%v", client.Host, client.Port))
	return
}
597682
func NewClient(endpoint *Endpoint, user, password string) (*Client, error) {
	return NewClientWithParameters(endpoint, user, password, DefaultParameters)
}
556780
func NewClient(config *triton.ClientConfig) (*StorageClient, error) {
	// TODO: Utilize config interface within the function itself
	client, err := client.New(
		config.TritonURL,
		config.MantaURL,
		config.AccountName,
		config.Signers...,
	)
	if err != nil {
		return nil, err
	}
	return newStorageClient(client), nil
}
51153
func (s *storage) GetClient(id string) (osin.Client, error) {
	c, err := s.client.Get(id, metav1.GetOptions{})
	if err != nil {
		if kerrors.IsNotFound(err) {
			return nil, nil
		}
		return nil, err
	}
	return &clientWrapper{id, c}, nil
}