[#121] client: Make PrmBalanceGet fields public #180

Merged
fyrchik merged 1 commits from aarifullin/frostfs-sdk-go:feature/121-prm_balance_get into master 2023-10-24 08:25:21 +00:00
2 changed files with 10 additions and 9 deletions

View File

@ -17,26 +17,26 @@ import (
// PrmBalanceGet groups parameters of BalanceGet operation. // PrmBalanceGet groups parameters of BalanceGet operation.
type PrmBalanceGet struct { type PrmBalanceGet struct {
prmCommonMeta XHeaders []string
accountSet bool Account *user.ID
account user.ID
} }
// SetAccount sets identifier of the FrostFS account for which the balance is requested. // SetAccount sets identifier of the FrostFS account for which the balance is requested.
// Required parameter. // Required parameter.
//
// Deprecated: Use PrmBalanceGet.Account instead.
func (x *PrmBalanceGet) SetAccount(id user.ID) { func (x *PrmBalanceGet) SetAccount(id user.ID) {
x.account = id x.Account = &id
x.accountSet = true
} }
func (x *PrmBalanceGet) buildRequest(c *Client) (*v2accounting.BalanceRequest, error) { func (x *PrmBalanceGet) buildRequest(c *Client) (*v2accounting.BalanceRequest, error) {
if !x.accountSet { if x.Account == nil {
return nil, errorAccountNotSet return nil, errorAccountNotSet
} }
var accountV2 refs.OwnerID var accountV2 refs.OwnerID
x.account.WriteToV2(&accountV2) x.Account.WriteToV2(&accountV2)
var body v2accounting.BalanceRequestBody var body v2accounting.BalanceRequestBody
body.SetOwnerID(&accountV2) body.SetOwnerID(&accountV2)

View File

@ -417,8 +417,9 @@ func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (acco
return accounting.Decimal{}, err return accounting.Decimal{}, err
} }
var cliPrm sdkClient.PrmBalanceGet cliPrm := sdkClient.PrmBalanceGet{
cliPrm.SetAccount(prm.account) Account: &prm.account,
}
start := time.Now() start := time.Now()
res, err := cl.BalanceGet(ctx, cliPrm) res, err := cl.BalanceGet(ctx, cliPrm)