Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22396f8276 |
35
chat.go
35
chat.go
@ -752,3 +752,38 @@ func (k *Keybase) ListMembersOfConversation(convID chat1.ConvIDStr) (chat1.ChatM
|
||||
}
|
||||
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 res struct {
|
||||
Result []chat1.ConvSummary `json:"result"`
|
||||
Error *Error `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
var r res
|
||||
|
||||
opts := SendMessageOptions{
|
||||
Channel: channel,
|
||||
}
|
||||
|
||||
arg := newSendMessageArg(opts)
|
||||
arg.Method = "listconvsonname"
|
||||
|
||||
jsonBytes, _ := json.Marshal(arg)
|
||||
|
||||
cmdOut, err := k.Exec("chat", "api", "-m", string(jsonBytes))
|
||||
if err != nil {
|
||||
return r.Result, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(cmdOut, &r)
|
||||
if err != nil {
|
||||
return r.Result, err
|
||||
}
|
||||
|
||||
if r.Error != nil {
|
||||
return r.Result, fmt.Errorf("%v", r.Error.Message)
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user