mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 10:18:04 +08:00
pin cmd: document pin ls output types
This commit is contained in:
parent
58ea970135
commit
4ec37b6f7b
@ -393,19 +393,7 @@ Example:
|
||||
},
|
||||
}
|
||||
|
||||
type PinLsObject struct {
|
||||
Cid string `json:",omitempty"`
|
||||
Type string `json:",omitempty"`
|
||||
}
|
||||
|
||||
type PinLsType struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
type PinLsList struct {
|
||||
Keys map[string]PinLsType `json:",omitempty"`
|
||||
}
|
||||
|
||||
// PinLsOutputWrapper is the output type of the pin ls command.
|
||||
// Pin ls needs to output two different type depending on if it's streamed or not.
|
||||
// We use this to bypass the cmds lib refusing to have interface{}
|
||||
type PinLsOutputWrapper struct {
|
||||
@ -413,6 +401,22 @@ type PinLsOutputWrapper struct {
|
||||
PinLsObject
|
||||
}
|
||||
|
||||
// PinLsList is a set of pins with their type
|
||||
type PinLsList struct {
|
||||
Keys map[string]PinLsType `json:",omitempty"`
|
||||
}
|
||||
|
||||
// PinLsType contains the type of a pin
|
||||
type PinLsType struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
// PinLsObject contains the description of a pin
|
||||
type PinLsObject struct {
|
||||
Cid string `json:",omitempty"`
|
||||
Type string `json:",omitempty"`
|
||||
}
|
||||
|
||||
func pinLsKeys(req *cmds.Request, typeStr string, n *core.IpfsNode, api coreiface.CoreAPI, emit func(value interface{}) error) error {
|
||||
mode, ok := pin.StringToMode(typeStr)
|
||||
if !ok {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user