Update ChatList() to allow for more filtering
This commit is contained in:
12
chat.go
12
chat.go
@ -203,13 +203,19 @@ func (c Chat) Delete(messageID int) (ChatAPI, error) {
|
||||
}
|
||||
|
||||
// ChatList returns a list of all conversations.
|
||||
func (k *Keybase) ChatList(topicType ...string) (ChatAPI, error) {
|
||||
// You can pass a Channel to use as a filter here, but you'll probably want to
|
||||
// leave the TopicName empty.
|
||||
func (k *Keybase) ChatList(opts ...Channel) (ChatAPI, error) {
|
||||
m := ChatAPI{
|
||||
Params: ¶ms{},
|
||||
}
|
||||
|
||||
if len(topicType) > 0 {
|
||||
m.Params.Options.TopicType = topicType[0]
|
||||
if len(opts) > 0 {
|
||||
m.Params.Options.Name = opts[0].Name
|
||||
m.Params.Options.Public = opts[0].Public
|
||||
m.Params.Options.MembersType = opts[0].MembersType
|
||||
m.Params.Options.TopicType = opts[0].TopicType
|
||||
m.Params.Options.TopicName = opts[0].TopicName
|
||||
}
|
||||
m.Method = "list"
|
||||
|
||||
|
||||
5
types.go
5
types.go
@ -240,7 +240,12 @@ type options struct {
|
||||
FlipConversationID string `json:"flip_conversation_id,omitempty"`
|
||||
MsgID int `json:"msg_id,omitempty"`
|
||||
GameID string `json:"game_id,omitempty"`
|
||||
|
||||
Name string `json:"name"`
|
||||
Public bool `json:"public,omitempty"`
|
||||
MembersType string `json:"members_type,omitempty"`
|
||||
TopicType string `json:"topic_type,omitempty"`
|
||||
TopicName string `json:"topic_name,omitempty"`
|
||||
}
|
||||
type params struct {
|
||||
Options options `json:"options"`
|
||||
|
||||
Reference in New Issue
Block a user