Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acc3e3ddec | |||
| 22396f8276 |
35
chat.go
35
chat.go
@ -752,3 +752,38 @@ func (k *Keybase) ListMembersOfConversation(convID chat1.ConvIDStr) (chat1.ChatM
|
|||||||
}
|
}
|
||||||
return k.ListMembers(opts)
|
return k.ListMembers(opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListConvsOnName returns a list of all conversations for a chat1.ChatChannel
|
||||||
|
func (k *Keybase) ListConvsOnName(channel chat1.ChatChannel) (*[]chat1.ConvSummary, error) {
|
||||||
|
type result struct {
|
||||||
|
Conversations []chat1.ConvSummary `json:"conversations"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type res struct {
|
||||||
|
Result result `json:"result"`
|
||||||
|
Error *Error `json:"error,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var r res
|
||||||
|
|
||||||
|
arg := newListConvsOnNameArg(channel)
|
||||||
|
|
||||||
|
jsonBytes, _ := json.Marshal(arg)
|
||||||
|
fmt.Printf("%#v\n", arg)
|
||||||
|
|
||||||
|
cmdOut, err := k.Exec("chat", "api", "-m", string(jsonBytes))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(cmdOut, &r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.Error != nil {
|
||||||
|
return nil, fmt.Errorf("%v", r.Error.Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &r.Result.Conversations, nil
|
||||||
|
}
|
||||||
|
|||||||
18
types.go
18
types.go
@ -238,6 +238,24 @@ func newListMembersArg(options ListMembersOptions) listMembersArg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type listConvsOnNameParams struct {
|
||||||
|
Options chat1.ChatChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
type listConvsOnNameArg struct {
|
||||||
|
Method string
|
||||||
|
Params listConvsOnNameParams
|
||||||
|
}
|
||||||
|
|
||||||
|
func newListConvsOnNameArg(channel chat1.ChatChannel) listConvsOnNameArg {
|
||||||
|
return listConvsOnNameArg{
|
||||||
|
Method: "listconvsonname",
|
||||||
|
Params: listConvsOnNameParams{
|
||||||
|
Options: channel,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// KVOptions holds a set of options to be passed to the KV methods
|
// KVOptions holds a set of options to be passed to the KV methods
|
||||||
type KVOptions struct {
|
type KVOptions struct {
|
||||||
Team *string `json:"team"`
|
Team *string `json:"team"`
|
||||||
|
|||||||
Reference in New Issue
Block a user