-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
import "encoding/json" | ||
|
||
type Balance struct { | ||
Key | ||
Attributes BalanceAttributes `json:"attributes"` | ||
} | ||
type BalanceResponse struct { | ||
Data Balance `json:"data"` | ||
Included Included `json:"included"` | ||
} | ||
|
||
type BalanceListResponse struct { | ||
Data []Balance `json:"data"` | ||
Included Included `json:"included"` | ||
Links *Links `json:"links"` | ||
Meta json.RawMessage `json:"meta,omitempty"` | ||
} | ||
|
||
func (r *BalanceListResponse) PutMeta(v interface{}) (err error) { | ||
r.Meta, err = json.Marshal(v) | ||
return err | ||
} | ||
|
||
func (r *BalanceListResponse) GetMeta(out interface{}) error { | ||
return json.Unmarshal(r.Meta, out) | ||
} | ||
|
||
// MustBalance - returns Balance from include collection. | ||
// if entry with specified key does not exist - returns nil | ||
// if entry with specified key exists but type or ID mismatches - panics | ||
func (c *Included) MustBalance(key Key) *Balance { | ||
var balance Balance | ||
if c.tryFindEntry(key, &balance) { | ||
return &balance | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* GENERATED. Do not modify. Your changes might be overwritten! | ||
*/ | ||
|
||
package resources | ||
|
||
import "math/big" | ||
|
||
type BalanceAttributes struct { | ||
// Amount of the tokens on the user address | ||
Amount *big.Int `json:"amount"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters