Skip to content

Commit

Permalink
Chore(refactor): expose raw response
Browse files Browse the repository at this point in the history
  • Loading branch information
till committed Sep 30, 2024
1 parent 04237d7 commit 8ec9339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions internal/cmd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func CreateUser(cCtx *cli.Context) error {

email := cCtx.String("email")

user, err := client.CreateUser(email)
user, _, err := client.CreateUser(email)
if err != nil {
return err
}
Expand All @@ -55,7 +55,7 @@ func ShowUser(cCtx *cli.Context) error {

email := cCtx.String("email")

user, err := client.GetUser(email)
user, _, err := client.GetUser(email)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/ostor/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import "github.com/go-resty/resty/v2"
// query parameter for user management
const qUsers string = "ostor-users"

func (o *Ostor) CreateUser(email string) (*OstorCreateUserResponse, error) {
func (o *Ostor) CreateUser(email string) (*OstorCreateUserResponse, *resty.Response, error) {
var user *OstorCreateUserResponse
_, err := o.put(qUsers, qUsers+"&emailAddress="+email, &user)
return user, err
resp, err := o.put(qUsers, qUsers+"&emailAddress="+email, &user)
return user, resp, err
}

func (o *Ostor) ListUsers() (*OstorUsersListResponse, error) {
Expand All @@ -17,10 +17,10 @@ func (o *Ostor) ListUsers() (*OstorUsersListResponse, error) {
return users, err
}

func (o *Ostor) GetUser(email string) (*OstorUser, error) {
func (o *Ostor) GetUser(email string) (*OstorUser, *resty.Response, error) {
var user *OstorUser
_, err := o.get(qUsers, map[string]string{"emailAddress": email}, &user)
return user, err
resp, err := o.get(qUsers, map[string]string{"emailAddress": email}, &user)
return user, resp, err
}

func (o *Ostor) LockUnlockUser(email string, lock bool) (*resty.Response, error) {
Expand Down

0 comments on commit 8ec9339

Please sign in to comment.