// Account returns info about the account in an Account struct.
187965
func (c *Connection) Account() (info Account, headers Headers, err error) {
	var resp *http.Response
	resp, headers, err = c.storage(RequestOpts{
		Operation:  "HEAD",
		ErrorMap:   ContainerErrorMap,
		NoResponse: true,
	})
	if err != nil {
		return
	}
	// Parse the headers into a dict
	//
	//    {'Accept-Ranges': 'bytes',
	//     'Content-Length': '0',
	//     'Date': 'Tue, 05 Jul 2011 16:37:06 GMT',
	//     'X-Account-Bytes-Used': '316598182',
	//     'X-Account-Container-Count': '4',
	//     'X-Account-Object-Count': '1433'}
	if info.BytesUsed, err = getInt64FromHeader(resp, "X-Account-Bytes-Used"); err != nil {
		return
	}
	if info.Containers, err = getInt64FromHeader(resp, "X-Account-Container-Count"); err != nil {
		return
	}
	if info.Objects, err = getInt64FromHeader(resp, "X-Account-Object-Count"); err != nil {
		return
	}
	return
}
1214496
func (s *PublicAccountAPI) Accounts() []common.Address {
	addresses := make([]common.Address, 0) // return [] instead of nil if empty
	for _, wallet := range s.am.Wallets() {
		for _, account := range wallet.Accounts() {
			addresses = append(addresses, account.Address)
		}
	}
	return addresses
}
1260748
func (w *Wallet) accountUsed(addrmgrNs walletdb.ReadWriteBucket, account uint32) (bool, error) {
	var used bool
	err := w.Manager.ForEachAccountAddress(addrmgrNs, account,
		func(maddr waddrmgr.ManagedAddress) error {
			used = maddr.Used(addrmgrNs)
			if used {
				return waddrmgr.Break
			}
			return nil
		})
	if err == waddrmgr.Break {
		err = nil
	}
	return used, err
}
60480
func (account *Account) Sync() error {
	insta := account.inst
	data, err := insta.prepareData()
	if err != nil {
		return err
	}
	body, err := insta.sendRequest(&reqOptions{
		Endpoint: urlCurrentUser,
		Query:    generateSignature(data),
		IsPost:   true,
	})
	if err == nil {
		resp := profResp{}
		err = json.Unmarshal(body, &resp)
		if err == nil {
			*account = resp.Account
			account.inst = insta
		}
	}
	return err
}
633279
func (ctx *ShowAccountContext) OK(r *Account) error {
	if ctx.ResponseData.Header().Get("Content-Type") == "" {
		ctx.ResponseData.Header().Set("Content-Type", "application/vnd.account+json")
	}
	return ctx.ResponseData.Service.Send(ctx.Context, 200, r)
}
1073599
func (s *Server) lookupAccount(name string) (*Account, error) {
	if v, ok := s.accounts.Load(name); ok {
		acc := v.(*Account)
		// If we are expired and we have a resolver, then
		// return the latest information from the resolver.
		if acc.IsExpired() {
			var err error
			s.mu.Lock()
			if s.accResolver != nil {
				err = s.updateAccount(acc)
			}
			s.mu.Unlock()
			if err != nil {
				return nil, err
			}
		}
		return acc, nil
	}
	// If we have a resolver see if it can fetch the account.
	if s.accResolver == nil {
		return nil, ErrMissingAccount
	}
	s.mu.Lock()
	acc, err := s.fetchAccount(name)
	s.mu.Unlock()
	return acc, err
}
878671
func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {
	acct := &stripe.Account{}
	err := c.B.Call(http.MethodPost, "/v1/accounts", c.Key, params, acct)
	return acct, err
}
1180985
func NewAccount(ctx context.Context, email string, keyTypeValue string) (*Account, error) {
	keyType := GetKeyType(ctx, keyTypeValue)

	// Create a user. New accounts need an email and private key to start
	privateKey, err := rsa.GenerateKey(rand.Reader, 4096)
	if err != nil {
		return nil, err
	}

	return &Account{
		Email:      email,
		PrivateKey: x509.MarshalPKCS1PrivateKey(privateKey),
		KeyType:    keyType,
	}, nil
}
210623
func (api *Client) GetAccount() (*Account, error) {
	result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(accountPath), &Account{})
	if err != nil {
		return nil, err
	}
	return result.(*Account), nil
}
444765
func (c *Client) AccountFeatureInfo(accountFeatureIdentity string) (*AccountFeature, error) {
	var accountFeature AccountFeature
	return &accountFeature, c.Get(&accountFeature, "/account/features/"+accountFeatureIdentity)
}
414669
func New(params *stripe.AccountParams) (*stripe.Account, error) {
	return getC().New(params)
}
504560
func (a Account) Insert() (int, error) {
	accountMaxID++
	a.ID = accountMaxID
	a.Name = fmt.Sprintf("account_%d", accountMaxID)
	accounts = append(accounts, a)
	return accountMaxID, nil
}
70913
func (s *Server) RegisterAccount(name string) (*Account, error) {
	if _, ok := s.accounts.Load(name); ok {
		return nil, ErrAccountExists
	}
	s.mu.Lock()
	acc := NewAccount(name)
	s.registerAccount(acc)
	s.mu.Unlock()
	return acc, nil
}
822912
func (cache *Cache) get(address crypto.Address) (*accountInfo, error) {
	cache.RLock()
	accInfo := cache.accounts[address]
	cache.RUnlock()
	if accInfo == nil {
		cache.Lock()
		defer cache.Unlock()
		accInfo = cache.accounts[address]
		if accInfo == nil {
			account, err := cache.backend.GetAccount(address)
			if err != nil {
				return nil, err
			}
			accInfo = &accountInfo{
				account: account,
				storage: make(map[binary.Word256]binary.Word256),
			}
			cache.accounts[address] = accInfo
		}
	}
	return accInfo, nil
}
184139
func (t *AccountService) Info() (*AccountInfoResponse, error) {
	u := &url.Values{}
	v := AccountInfoResponse{}
	if err := t.client.do("account.info", u, &v.Response); err != nil {
		return nil, err
	}

	if err := json.Unmarshal(v.RawData, &v.AccountInfo); err != nil {
		return nil, err
	}
	return &v, nil
}
1095738
func (a *Account) Show() (*Account, *http.Response, []error) {
	k := kumoru.New()

	k.Get(fmt.Sprintf("%v/v1/accounts/%v", k.EndPoint.Authorization, a.Email))
	k.SignRequest(true)

	resp, body, errs := k.End()

	if len(errs) > 0 {
		return a, resp, errs
	}

	if resp.StatusCode >= 400 {
		errs = append(errs, fmt.Errorf("%s", resp.Status))
		return a, resp, errs
	}

	err := json.Unmarshal([]byte(body), &a)

	if err != nil {
		errs = append(errs, err)
		return a, resp, errs
	}

	return a, resp, nil
}
899694
func (a *accounter) Stat() accountStat {
	var acntStat accountStat
	a.finishOnce.Do(func() {
		close(a.isFinished)
		acntStat.Total = a.Total
		acntStat.Transferred = atomic.LoadInt64(&a.current)
		acntStat.Speed = a.write(atomic.LoadInt64(&a.current))
	})
	return acntStat
}