// NewAPI returns a new API using the supplied caller.
191389
func NewAPI(caller base.APICaller, newWatcher NewWatcherFunc) *API {
	return &API{
		caller:     base.NewFacadeCaller(caller, "ApplicationScaler"),
		newWatcher: newWatcher,
	}
}
258075
func NewNFSAPI(client *Client) *NFSAPI {
	return &NFSAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "appliance"
			},
			FuncBaseSearchCondition: func() *sacloud.Request {
				res := &sacloud.Request{}
				res.AddFilter("Class", "nfs")
				return res
			},
		},
	}
}
1020346
func (s *APIDiscoveryService) NewListApisParams() *ListApisParams {
	p := &ListApisParams{}
	p.p = make(map[string]interface{})
	return p
}
856363
func NewCoreAPI(n *core.IpfsNode, opts ...options.ApiOption) (coreiface.CoreAPI, error) {
	parentOpts, err := options.ApiOptions()
	if err != nil {
		return nil, err
	}

	return (&CoreAPI{nd: n, parentOpts: *parentOpts}).WithOptions(opts...)
}
478082
func NewApiApp(AppId string, AppName string, IsAppFolder bool) *ApiApp {
	s := new(ApiApp)
	s.AppId = AppId
	s.AppName = AppName
	s.IsAppFolder = IsAppFolder
	return s
}
11275
func (c *offerCommand) NewApplicationOffersAPI() (*applicationoffers.Client, error) {
	root, err := c.NewAPIRoot()
	if err != nil {
		return nil, err
	}
	return applicationoffers.NewClient(root), nil
}
376580
func NewAPIBase(backend Backend, resources facade.Resources, authorizer facade.Authorizer) (*APIBase, error) {
	if !(authorizer.AuthMachineAgent() || authorizer.AuthUnitAgent()) {
		return nil, common.ErrPerm
	}
	return &APIBase{
		backend:    backend,
		resources:  resources,
		authorizer: authorizer,
	}, nil
}
343580
func NewAPI(
	apiCaller base.APICaller,
	claimant names.MachineTag,
	entity names.Tag,
) (*API, error) {
	if !names.IsValidMachine(claimant.Id()) {
		return nil, errors.NotValidf("claimant tag")
	}
	switch entity.(type) {
	case names.ModelTag:
	case names.ControllerTag:
	case nil:
		return nil, errors.New("nil entity supplied")
	default:
		return nil, errors.Errorf(
			"invalid entity kind %q for singular API", entity.Kind(),
		)
	}
	facadeCaller := base.NewFacadeCaller(apiCaller, "Singular")
	return &API{
		facadeCaller: facadeCaller,
		claimant:     claimant,
		entity:       entity,
	}, nil
}
675555
func NewAPI(ctx facade.Context) (*API, error) {
	if !ctx.Auth().AuthController() {
		return nil, common.ErrPerm
	}

	return &API{}, nil
}
720141
func NewAPIDocsGen(basePath string, services []*component.Service) *APIDocsGen {
	return &APIDocsGen{
		basePath: basePath,
		services: services,
	}
}
1273348
func NewLeadershipPinningAPI(caller base.APICaller) *LeadershipPinningAPI {
	facadeCaller := base.NewFacadeCaller(
		caller,
		leadershipFacade,
	)
	return NewLeadershipPinningAPIFromFacade(facadeCaller)
}
334271
func NewContextAPI(api APIClient, dataDir string) (*Context, error) {
	results, err := api.List()
	if err != nil {
		return nil, errors.Trace(err)
	}

	ctx := NewContext(api, dataDir)
	for _, result := range results {
		pl := result.Payload
		// TODO(ericsnow) Use id instead of pl.FullID().
		ctx.payloads[pl.FullID()] = pl.Payload
	}
	return ctx, nil
}
130818
func NewAPI(fileStore *storage.FileStore, dns Resolver, feedHandler *feed.Handler, pk *ecdsa.PrivateKey) (self *API) {
	self = &API{
		fileStore: fileStore,
		dns:       dns,
		feed:      feedHandler,
		Decryptor: func(ctx context.Context, credentials string) DecryptFunc {
			return self.doDecrypt(ctx, credentials, pk)
		},
	}
	return
}
1008698
func NewLicenseAPI(client *Client) *LicenseAPI {
	return &LicenseAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "license"
			},
		},
	}
}
635174
func NewAPIClient() (libmachine.API, error) {
	storePath := constants.GetMinipath()
	certsDir := constants.MakeMiniPath("certs")

	return &LocalClient{
		certsDir:     certsDir,
		storePath:    storePath,
		Filestore:    persist.NewFilestore(storePath, certsDir, certsDir),
		legacyClient: NewRPCClient(storePath, certsDir),
	}, nil
}
953765
func NewAPI(
	backend Backend,
	precheckBackend migration.PrecheckBackend,
	pool migration.Pool,
	resources facade.Resources,
	authorizer facade.Authorizer,
	presence facade.Presence,
) (*API, error) {
	if !authorizer.AuthController() {
		return nil, common.ErrPerm
	}
	return &API{
		backend:         backend,
		precheckBackend: precheckBackend,
		pool:            pool,
		authorizer:      authorizer,
		resources:       resources,
		presence:        presence,
	}, nil
}
1141643
func NewClient(apiKey string) *Client {
	c := &Client{
		URL:        BaseURL,
		key:        apiKey,
		post:       http.PostForm,
		argMarshal: marshallArgs,
	}
	c.apiCall = c.liveAPICaller
	return c
}