Skip to content

Commit

Permalink
ref: standardize result type structs
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesKimara committed Oct 19, 2021
1 parent ee4cbd0 commit 18b3ba2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 36 deletions.
12 changes: 6 additions & 6 deletions api_script.go
Expand Up @@ -35,13 +35,13 @@ type methodOptions struct {
}

type ScriptAllResult struct {
Scripts []Script
Err error
Res []Script
Err error
}

type ScriptRedeemerResult struct {
ScriptRedeemers []ScriptRedeemer
Err error
Res []ScriptRedeemer
Err error
}

func (c *apiClient) Scripts(ctx context.Context, query APIQueryParams) (scripts []Script, err error) {
Expand Down Expand Up @@ -86,7 +86,7 @@ func (c *apiClient) ScriptsAll(ctx context.Context) <-chan ScriptAllResult {
if len(sc) != j.query.Count || err != nil {
quit <- true
}
res := ScriptAllResult{Scripts: sc, Err: err}
res := ScriptAllResult{Res: sc, Err: err}
ch <- res
}

Expand Down Expand Up @@ -170,7 +170,7 @@ func (c *apiClient) ScriptRedeemersAll(ctx context.Context, address string) <-ch
if len(sr) != j.query.Count || err != nil {
quit <- true
}
res := ScriptRedeemerResult{ScriptRedeemers: sr, Err: err}
res := ScriptRedeemerResult{Res: sr, Err: err}
ch <- res
}

Expand Down
5 changes: 1 addition & 4 deletions testdata/ipfsresourcepinintegration.golden
@@ -1,4 +1 @@
{
"ipfs_hash": "QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn",
"state": "queued"
}
{"ipfs_hash":"QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn","state":"queued"}
8 changes: 1 addition & 7 deletions testdata/ipfsresourcepinnedintegration.golden
@@ -1,7 +1 @@
{
"time_created": 1634301841660,
"time_pinned": 1634512069777,
"ipfs_hash": "QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn",
"state": "queued",
"size": "131"
}
{"time_created":1634301841660,"time_pinned":1634616360072,"ipfs_hash":"QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn","state":"queued","size":"131"}
17 changes: 1 addition & 16 deletions testdata/ipfsresourcepinnedobjectsintegration.golden
@@ -1,16 +1 @@
[
{
"time_created": 1632252357454,
"time_pinned": 1632260783786,
"ipfs_hash": "QmWWTSbjJ7MFeLjDnnibybkJiFJ11FZYxgf7Rn2A5Zj94V",
"state": "pinned",
"size": "24"
},
{
"time_created": 1634301841660,
"time_pinned": 1634512069777,
"ipfs_hash": "QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn",
"state": "queued",
"size": "131"
}
]
[{"time_created":1632252357454,"time_pinned":1632260783786,"ipfs_hash":"QmWWTSbjJ7MFeLjDnnibybkJiFJ11FZYxgf7Rn2A5Zj94V","state":"pinned","size":"24"},{"time_created":1634301841660,"time_pinned":1634616360072,"ipfs_hash":"QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn","state":"queued","size":"131"}]
4 changes: 1 addition & 3 deletions testdata/ipfsresourceremoveintegration.golden
@@ -1,3 +1 @@
{
"ipfs_hash": "QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn"
}
{"ipfs_hash":"QmRFKhzSSRMRTnLf1gRdDbP9PgQxsoXD2QYEHZeBA6gLHn"}

0 comments on commit 18b3ba2

Please sign in to comment.