Skip to content

Commit

Permalink
fix: solve GetCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Nov 17, 2023
1 parent b27c3ef commit 9aacd07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
8 changes: 2 additions & 6 deletions compress/api_customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (o *compress) GetCredentials() (*Credential, error) {
return nil, err
}
o.debugPrint(resp)
var obj ResponseServer
var obj ResponseServerCredential
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
Expand All @@ -24,9 +24,5 @@ func (o *compress) GetCredentials() (*Credential, error) {
}
o.debugPrint(obj)
//
cred, err := obj.GetCredential()
if err != nil {
return nil, fmt.Errorf("Error casting credentials")
}
return cred, nil
return &obj.Credential, nil

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.19.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.19.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)

Check failure on line 27 in compress/api_customer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

obj.Credential undefined (type ResponseServerCredential has no field or method Credential)
}
13 changes: 5 additions & 8 deletions compress/model_customer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package compress

import "fmt"
/*
*/
type Credential struct {
Expand Down Expand Up @@ -35,10 +34,8 @@ type Credential struct {
}


func (r *ResponseServer) GetCredential() (*Credential, error) {
cred, ok := r.Data.(*Credential)
if !ok {
return nil, fmt.Errorf("unable to cast data to UserData")
}
return cred, nil
}
type ResponseServerCredential struct {
Message string `json:"message"`
Response string `json:"response"`
Data Credential `json:"data"`
}

0 comments on commit 9aacd07

Please sign in to comment.