working commit
This commit is contained in:
@@ -4,50 +4,40 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mbase/pkg/mbctl"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func (util *Util) CreateAccount(cmd *cobra.Command, args []string) {
|
||||
//util.createAccountParams.Filename = args[0]
|
||||
res, err := util.createAccount(util.createAccountParams)
|
||||
util.createAccountParams.Username = args[0]
|
||||
util.createAccountParams.Password = args[1]
|
||||
res, err := util.createAccount(&util.createAccountParams)
|
||||
printResponse(res, err)
|
||||
}
|
||||
|
||||
type createAccountParams struct {
|
||||
type CreateAccountParams struct {
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
type createAccountResult struct{}
|
||||
|
||||
func (util *Util) createAccount(params createAccountParams) (createAccountResult, error) {
|
||||
var err error
|
||||
res := createAccountResult{}
|
||||
/*
|
||||
operParams := &mbctl.CreateAccountParams{
|
||||
Username: params.Username,
|
||||
Password: params.Password,
|
||||
}
|
||||
res, err = util.lg.CreateAccount(ctx, operID, params)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
*/
|
||||
return res, err
|
||||
type CreateAccountResult struct {
|
||||
AccountID string `json:"accountId"`
|
||||
}
|
||||
|
||||
/*
|
||||
func (util *Util) CreateAccount(ctx context.Context, operID string) (*mbctl.CreateAccountResult, error) {
|
||||
func (util *Util) createAccount(params *CreateAccountParams) (*CreateAccountResult, error) {
|
||||
var err error
|
||||
res := &mbctl.CreateAccountResult{}
|
||||
|
||||
params := &mbctl.CreateAccountParams{
|
||||
Username: util.username,
|
||||
Password: util.password,
|
||||
res := &CreateAccountResult{}
|
||||
ctx := context.Background()
|
||||
operParams := &mbctl.CreateAccountParams{
|
||||
Username: params.Username,
|
||||
Password: params.Password,
|
||||
}
|
||||
res, err = util.lg.CreateAccount(ctx, operID, params)
|
||||
operRes, err := util.oper.CreateAccount(ctx, util.operID, operParams)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res.AccountID = operRes.AccountID
|
||||
return res, err
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user