working commit
This commit is contained in:
@@ -4,20 +4,32 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mbase/pkg/mbctl"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func (util *Util) ListAccounts(cmd *cobra.Command, args []string) {
|
||||
//util.listAccountsParams.Filename = args[0]
|
||||
res, err := util.listAccounts(util.listAccountsParams)
|
||||
res, err := util.listAccounts(&util.listAccountsParams)
|
||||
printResponse(res, err)
|
||||
}
|
||||
|
||||
type listAccountsParams struct{}
|
||||
type listAccountsResult struct{}
|
||||
type ListAccountsParams struct{}
|
||||
type ListAccountsResult struct {
|
||||
Accounts []*mbctl.AccountShortDescr `json:"accounts"`
|
||||
}
|
||||
|
||||
func (util *Util) listAccounts(params listAccountsParams) (listAccountsResult, error) {
|
||||
func (util *Util) listAccounts(params *ListAccountsParams) (*ListAccountsResult, error) {
|
||||
var err error
|
||||
res := listAccountsResult{}
|
||||
ctx := context.Background()
|
||||
res := &ListAccountsResult{}
|
||||
operParams := &mbctl.ListAccountsParams{}
|
||||
operRes, err := util.oper.ListAccounts(ctx, util.operID, operParams)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res.Accounts = operRes.Accounts
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user