Skip to content

Commit

Permalink
fix(listall): fixed json output (#348)
Browse files Browse the repository at this point in the history
* fix(listall): fixed json output

* fix(listall): fixed json output
  • Loading branch information
cnlangzi authored Feb 2, 2023
1 parent ae90e72 commit ad06e9d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"
"strings"

"github.com/0chain/gosdk/core/common"
"github.com/0chain/gosdk/zboxcore/fileref"
"github.com/0chain/gosdk/zboxcore/sdk"
"github.com/0chain/zboxcli/util"
Expand Down Expand Up @@ -106,13 +107,15 @@ var listAllCmd = &cobra.Command{
}

type fileResp struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"`
Size int64 `json:"size"`
Hash string `json:"hash,omitempty"`
LookupHash string `json:"lookup_hash"`
EncryptedKey string `json:"encrypted_key,omitempty" `
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"`
Size int64 `json:"size"`
Hash string `json:"hash,omitempty"`
LookupHash string `json:"lookup_hash"`
EncryptedKey string `json:"encrypted_key,omitempty" `
CreatedAt common.Timestamp `json:"created_at"`
UpdatedAt common.Timestamp `json:"updated_at"`
}

fileResps := make([]fileResp, 0)
Expand All @@ -126,6 +129,8 @@ var listAllCmd = &cobra.Command{
Hash: data.Hash,
EncryptedKey: data.EncryptedKey,
LookupHash: data.LookupHash,
CreatedAt: common.Timestamp(data.CreatedAt.Unix()),
UpdatedAt: common.Timestamp(data.UpdatedAt.Unix()),
}
fileResps = append(fileResps, resp)
}
Expand Down

0 comments on commit ad06e9d

Please sign in to comment.