Skip to content

Commit

Permalink
iRelease: v1.0.34-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-the-h committed Mar 19, 2023
1 parent a6fb34f commit 5f64550
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ Changelog
=========
All notable changes to this project will be documented in this file.

v1.0.34-alpha
-------------

### Changed

- Fixed response struct unmarshalling issue

v1.0.33-alpha
-------------

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Installation
-----------------

```bash
go get github.com/amir-the-h/[email protected].33-alpha
go get github.com/amir-the-h/[email protected].34-alpha
```

Usage
Expand Down
2 changes: 1 addition & 1 deletion definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ const (
CandleStick1m = CandleStickWsBarSize("candle1m")
)

func (t JSONTime) String() string { return time.Time(t).String() }
func (t *JSONTime) String() string { return (time.Time)(*t).String() }

func (t *JSONTime) UnmarshalJSON(s []byte) (err error) {
r := strings.Replace(string(s), `"`, ``, -1)
Expand Down
2 changes: 1 addition & 1 deletion requests/rest/tradedata/trade_data_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type (
Ccy string `json:"ccy"`
Begin int64 `json:"before,omitempty,string"`
End int64 `json:"limit,omitempty,string"`
InstType okex.InstrumentType `json:"instType,string"`
InstType okex.InstrumentType `json:"instType"`
Period okex.BarSize `json:"period,string,omitempty"`
}
GetRatio struct {
Expand Down
20 changes: 0 additions & 20 deletions responses/responses.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
package responses

import (
"encoding/json"
"fmt"
)

type (
Basic struct {
Code int `json:"code,string"`
Msg string `json:"msg,omitempty"`
}
)

type resCode Basic

func (b *Basic) UnmarshalJSON(bf []byte) error {
var r resCode
err := json.Unmarshal(bf, &r)
if err != nil {
return err
}
b = (*Basic)(&r)
if b.Code != 0 {
return fmt.Errorf("recevied error:%+v", b)
}
return nil
}

0 comments on commit 5f64550

Please sign in to comment.