api-structs #117

Merged
lash merged 35 commits from api-structs into master 2024-10-24 15:53:46 +02:00
Showing only changes of commit 2b34a0900c - Show all commits

View File

@ -84,14 +84,17 @@ func (as *AccountService) TrackAccountStatus(publicKey string) (*api.OKResponse,
errResponse.Description = err.Error()
return nil, err
}
err = json.Unmarshal([]byte(body), &okResponse)
if err != nil {
if resp.StatusCode >= http.StatusBadRequest {
err := json.Unmarshal([]byte(body), &errResponse)
if err != nil {
return nil, err
}
return nil, errors.New(errResponse.Description)
}
err = json.Unmarshal([]byte(body), &okResponse)
if err != nil {
return nil, err
Outdated
Review

I would just use the literal 0 here

I would just use the literal `0` here

If there is no matching tracking id, result.otx will be null.

If there is no matching tracking id, result.otx will be null.
Outdated
Review

@kamikazechaser please elaborate is there a missing case?

@kamikazechaser please elaborate is there a missing case?
}
if len(okResponse.Result) == 0 {
return nil, errors.New("Empty api result")
}
@ -148,15 +151,17 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) {
if err != nil {
return nil, err
}
err = json.Unmarshal([]byte(body), &okResponse)
if err != nil {
if resp.StatusCode >= http.StatusBadRequest {
err := json.Unmarshal([]byte(body), &errResponse)
if err != nil {
return nil, err
}
return nil, errors.New(errResponse.Description)
}
err = json.Unmarshal([]byte(body), &okResponse)
if err != nil {
return nil, err
}
if len(okResponse.Result) == 0 {
return nil, errors.New("Empty api result")
}