// New creates a new session.
427205
func (c Client) New(params *stripe.CheckoutSessionParams) (*stripe.CheckoutSession, error) {
	session := &stripe.CheckoutSession{}
	err := c.B.Call(http.MethodPost, "/v1/checkout/sessions", c.Key, params, session)
	return session, err
}
1026272
func New(stream string) *Handler {
	return NewConfig(k.Config{
		StreamName: stream,
		Client:     kinesis.New(session.New(aws.NewConfig())),
	})
}
1057033
func New(host, port, username string, sams ...ssh.AuthMethod) (*Client, error) {
	config := &ssh.ClientConfig{
		User: username,
		Auth: sams,
	}
	client, err := ssh.Dial("tcp", BuildSSHURL(host, port), config)
	if err != nil {
		return nil, err
	}
	tmpSftpClient, err := sftp.NewClient(client)
	if err != nil {
		return nil, err
	}
	return (*Client)(unsafe.Pointer(tmpSftpClient)), err
}
997054
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
	return &Client{transport: transport, formats: formats}
}
1008625
func New(size int, network, address, password string, keyPairs ...[]byte) (nSessions.Store, error) {
	store, err := redistore.NewRediStore(size, network, address, password, keyPairs...)
	if err != nil {
		return nil, err
	}
	return &rediStore{store}, nil
}
1102170
func New() *Client {
	return &Client{
		state:       clientInitialized,
		Session:     session.NewMemorySession(),
		futureStore: future.NewStore(),
	}
}
831282
func (m *SessionManager) Create(user User) (session Session) {
	// Set the expires from the cookie config
	session = Session{
		Expires: m.nowFunc().Add(m.cookie.Age),
		UserID:  user.ID,
		manager: m,
	}

	// Generate a new random session key
	for {
		session.Key = m.keyFunc()

		// No duplicates - generate a new key if this key already exists
		var duplicate string
		stmt := sol.Select(
			Sessions.C("key"),
		).Where(Sessions.C("key").Equals(session.Key)).Limit(1)
		m.conn.Query(stmt, &duplicate)
		if duplicate == "" {
			break
		}
	}

	// Insert the session
	m.conn.Query(Sessions.Insert().Values(session))
	return
}
663824
func (scope *Scope) New(value interface{}) *Scope {
	return &Scope{db: scope.NewDB(), Search: &search{}, Value: value}
}
94728
func New(serverURI string, idleTimeout time.Duration, logConn bool, gaeEndpoint string) (*Database, error) {
	pool := &redis.Pool{
		Dial:        newDBDialer(serverURI, logConn),
		MaxIdle:     10,
		IdleTimeout: idleTimeout,
	}

	var rc *remote_api.Client
	if gaeEndpoint != "" {
		var err error
		if rc, err = newRemoteClient(gaeEndpoint); err != nil {
			return nil, err
		}
	} else {
		log.Println("remote_api client not setup to use App Engine search")
	}

	return &Database{Pool: pool, RemoteClient: rc}, nil
}
243477
func New(config Config) *Manager {
	if config.Store == nil {
		panic("session: nil store")
	}

	m := Manager{}
	m.config = config

	if m.config.GenerateID == nil {
		m.config.GenerateID = func() string {
			b := make([]byte, 32)
			if _, err := rand.Read(b); err != nil {
				// this should never happened
				// or something wrong with OS's crypto pseudorandom generator
				panic(err)
			}
			return base64.RawURLEncoding.EncodeToString(b)
		}
	}

	if m.config.DisableHashID {
		m.hashID = func(id string) string {
			return id
		}
	} else {
		m.hashID = func(id string) string {
			h := sha256.New()
			h.Write([]byte(id))
			h.Write(config.Secret)
			return base64.RawURLEncoding.EncodeToString(h.Sum(nil))
		}
	}

	if m.config.IdleTimeout <= 0 {
		m.config.IdleTimeout = m.config.MaxAge
	}

	return &m
}
1090731
func New(options *AuthOptions, httpClient *http.Client) *Client {
	if httpClient == nil {
		httpClient = http.DefaultClient
	}

	return &Client{
		Options: options,
		Client:  httpClient,
	}
}
402775
func (c Client) New(params *stripe.UsageRecordParams) (*stripe.UsageRecord, error) {
	path := stripe.FormatURLPath("/v1/subscription_items/%s/usage_records", stripe.StringValue(params.SubscriptionItem))
	record := &stripe.UsageRecord{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, record)
	return record, err
}
228693
func New(network, address string) (*Storage, error) {
	s := &Storage{
		pool: redis.NewPool(func() (redis.Conn, error) {
			return redis.Dial(network, address)
		}, 5)}
	// When using a connection pool, you only get connection errors while trying to send commands.
	// Try to PING so we can fail-fast in the case of invalid address.
	conn := s.pool.Get()
	defer conn.Close()
	if _, err := conn.Do("PING"); err != nil {
		return nil, err
	}
	return s, nil
}
920776
func New(server ...string) (*mc.Client, error) {
	ks := &JavaServerSelector{}

	for _, s := range server {
		err := ks.AddServer(s)
		if err != nil {
			return nil, err
		}
	}

	return mc.NewFromSelector(ks), nil
}
719195
func New(config *redis.Options) *Redis {
	client := redis.NewClient(config)
	return &Redis{Config: config, Client: client}
}
1071479
func New(initializer Initializer, opts ...options.Opt) *Reference {
	return NewWithData(func(interface{}) (interface{}, error) {
		return initializer()
	}, opts...)
}
1339221
func New(accessKey string, secretKey string, tableName string, region string, keyPairs ...[]byte) (nSessions.Store, error) {
	store, err := dynstore.NewDynamoStore(accessKey, secretKey, tableName, region, keyPairs...)

	if err != nil {
		return nil, err
	}
	return &dynamoStore{store}, nil
}