// Accounts returns all accounts the logged in user has access to.
//
// API reference: https://api.cloudflare.com/#accounts-list-accounts
508177
func (api *API) Accounts(pageOpts PaginationOptions) ([]Account, ResultInfo, error) {
	v := url.Values{}
	if pageOpts.PerPage > 0 {
		v.Set("per_page", strconv.Itoa(pageOpts.PerPage))
	}
	if pageOpts.Page > 0 {
		v.Set("page", strconv.Itoa(pageOpts.Page))
	}

	uri := "/accounts"
	if len(v) > 0 {
		uri = uri + "?" + v.Encode()
	}

	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return []Account{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError)
	}

	var accListResponse AccountListResponse
	err = json.Unmarshal(res, &accListResponse)
	if err != nil {
		return []Account{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError)
	}
	return accListResponse.Result, accListResponse.ResultInfo, nil
}
252604
func (l *Client) GetAccounts() ([]*Account, error) {
	res := ApiResp{}
	var data []*Account

	// make the request
	err := l.Get(accountListEndpoint, nil, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
525111
func (a *Account) ListOAuthClients() (clients []*OAuthClient, err error) {
	err = a.get(a.auth.WithScope(scope.Clients), "/api/v2/clients", &clients)
	return clients, err
}
384897
func (c *Config) AccountConfig() (int, int, string, error) {
	scryptN := keystore.StandardScryptN
	scryptP := keystore.StandardScryptP
	if c.UseLightweightKDF {
		scryptN = keystore.LightScryptN
		scryptP = keystore.LightScryptP
	}

	var (
		keydir string
		err    error
	)
	switch {
	case filepath.IsAbs(c.KeyStoreDir):
		keydir = c.KeyStoreDir
	case c.DataDir != "":
		if c.KeyStoreDir == "" {
			keydir = filepath.Join(c.DataDir, datadirDefaultKeyStore)
		} else {
			keydir, err = filepath.Abs(c.KeyStoreDir)
		}
	case c.KeyStoreDir != "":
		keydir, err = filepath.Abs(c.KeyStoreDir)
	}
	return scryptN, scryptP, keydir, err
}
47792
func (c *CloudPersister) ListUsers() ([]*models.User, error) {
	ctx := context.Background()
	Users := make([]*models.User, 0)
	q := datastore.NewQuery("User")

	keys, err := c.DatastoreClient().GetAll(ctx, q, &Users)

	if err != nil {
		return nil, fmt.Errorf("datastoredb: could not list Users: %v", err)
	}

	for i, k := range keys {
		Users[i].ID = k.ID()
	}

	return Users, nil
}
744602
func (c *Client) All(ctx context.Context) ([]chronograf.User, error) {
	users, err := c.showUsers(ctx)
	if err != nil {
		return nil, err
	}

	// For all users we need to look up permissions to add to the user.
	for i, user := range users {
		perms, err := c.userPermissions(ctx, user.Name)
		if err != nil {
			return nil, err
		}

		user.Permissions = append(user.Permissions, perms...)
		users[i] = user
	}
	return users, nil
}
389279
func (auth *Auth) GetUsers(ctx context.Context, userIDs []string) ([]*UserRecord, error) {
	resp, err := auth.client.GetAccountInfo(&identitytoolkit.IdentitytoolkitRelyingpartyGetAccountInfoRequest{
		LocalId: userIDs,
	}).Context(ctx).Do()
	if err != nil {
		return nil, err
	}
	return toUserRecords(resp.Users), nil
}
1065818
func (b *AccountController) List(c *app.ListAccountContext) error {
	accounts := b.db.GetAccounts()
	res := make(app.AccountTinyCollection, len(accounts))
	for i, account := range accounts {
		a := &app.AccountTiny{
			ID:   account.ID,
			Href: app.AccountHref(account.ID),
			Name: account.Name,
		}
		res[i] = a
	}
	return c.OKTiny(res)
}
194216
func (c *Client) ListAccount(ctx context.Context, path string) (*http.Response, error) {
	req, err := c.NewListAccountRequest(ctx, path)
	if err != nil {
		return nil, err
	}
	return c.Client.Do(ctx, req)
}
619779
func (api *SignerAPI) List(ctx context.Context) ([]common.Address, error) {
	var accs []accounts.Account
	for _, wallet := range api.am.Wallets() {
		accs = append(accs, wallet.Accounts()...)
	}
	result, err := api.UI.ApproveListing(&ListRequest{Accounts: accs, Meta: MetadataFromContext(ctx)})
	if err != nil {
		return nil, err
	}
	if result.Accounts == nil {
		return nil, ErrRequestDenied

	}
	addresses := make([]common.Address, 0)
	for _, acc := range result.Accounts {
		addresses = append(addresses, acc.Address)
	}

	return addresses, nil
}
935913
func (v *version) ServiceAccounts() ServiceAccountInformer {
	return &serviceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
1078160
func AccountsAll(q string) ([]Account, error) {
	if q == "" {
		return accounts, nil
	}
	as := []Account{}
	for k, v := range accounts {
		if q == v.Name {
			as = append(as, accounts[k])
		}
	}
	return as, nil
}
1306993
func (r Account) GetAttributes() (resp []datatypes.Account_Attribute, err error) {
	err = r.Session.DoRequest("SoftLayer_Account", "getAttributes", nil, &r.Options, &resp)
	return
}
848397
func (c *Client) GetAccounts(accessToken string) (resp GetAccountsResponse, err error) {
	options := GetAccountsOptions{
		AccountIDs: []string{},
	}
	return c.GetAccountsWithOptions(accessToken, options)
}
721799
func (c *Client) ListUsers() (rec []UserInfo, err error) {
	req, err := newGETRequest(c, "users/")
	if err != nil {
		return []UserInfo{}, err
	}

	if err = executeAndParseRequest(c, req, &rec); err != nil {
		return []UserInfo{}, err
	}

	return rec, nil
}
1070029
func (a *Account) AuthorizedClients() ([]*OAuthClient, error) {
	var clients []*OAuthClient
	err := a.get(a.auth, "/api/v2/users/me/authorized-clients", &clients)
	if err != nil {
		return nil, err
	}

	return clients, nil
}
1132274
func (w *Wallet) AccountProperties(scope waddrmgr.KeyScope, acct uint32) (*waddrmgr.AccountProperties, error) {
	manager, err := w.Manager.FetchScopedKeyManager(scope)
	if err != nil {
		return nil, err
	}

	var props *waddrmgr.AccountProperties
	err = walletdb.View(w.db, func(tx walletdb.ReadTx) error {
		waddrmgrNs := tx.ReadBucket(waddrmgrNamespaceKey)
		var err error
		props, err = manager.AccountProperties(waddrmgrNs, acct)
		return err
	})
	return props, err
}