2 Commits

Author SHA1 Message Date
6d42a230d1 Fix bugs with direct message api 2021-05-08 15:44:18 -04:00
7166300503 Add more attachment values 2021-05-08 15:44:18 -04:00
2 changed files with 14 additions and 10 deletions

View File

@ -82,6 +82,7 @@ func (c *Client) IndexDirectMessages(ctx context.Context, otherUserID string, re
query.Add("since_id", req.SinceID.String())
}
}
httpReq.URL.RawQuery = query.Encode()
var resp IndexDirectMessagesResponse
err = c.doWithAuthToken(ctx, httpReq, &resp)
@ -127,7 +128,7 @@ func (c *Client) CreateDirectMessage(ctx context.Context, m *Message) (*Message,
}
var resp struct {
*Message `json:"message"`
*Message `json:"direct_message"`
}
err = c.doWithAuthToken(ctx, httpReq, &resp)
if err != nil {

21
json.go
View File

@ -146,15 +146,18 @@ const (
// Attachment is a GroupMe message attachment, returned in JSON API responses
type Attachment struct {
Type attachmentType `json:"type,omitempty"`
Loci [][]int `json:"loci,omitempty"`
UserIDs []ID `json:"user_ids,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
Latitude string `json:"lat,omitempty"`
Longitude string `json:"lng,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Charmap [][]int `json:"charmap,omitempty"`
Type attachmentType `json:"type,omitempty"`
Loci [][]int `json:"loci,omitempty"`
UserIDs []ID `json:"user_ids,omitempty"`
URL string `json:"url,omitempty"`
FileID string `json:"file_id,omitempty"`
VideoPreviewURL string `json:"preview_url,omitempty"`
Name string `json:"name,omitempty"`
Latitude string `json:"lat,omitempty"`
Longitude string `json:"lng,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Charmap [][]int `json:"charmap,omitempty"`
ReplyID ID `json:"reply_id,omitempty"`
}
func (a *Attachment) String() string {