forked from aliforever/gista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
direct.go
44 lines (38 loc) · 1.21 KB
/
direct.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package gista
import (
"github.com/aliforever/gista/constants"
"github.com/aliforever/gista/responses"
)
type direct struct {
ig *Instagram
}
func newDirect(i *Instagram) *direct {
return &direct{ig: i}
}
func (p *direct) GetPresences() (res *responses.Presences, err error) {
res = &responses.Presences{}
err = p.ig.client.Request(constants.Presence).GetResponse(res)
return
}
func (p *direct) GetInbox(cursorId *string) (res *responses.DirectInbox, err error) {
res = &responses.DirectInbox{}
req := p.ig.client.Request(constants.DirectInbox).AddParam("persistentBadging", "true").AddParam("use_unified_inbox", "true")
if cursorId != nil {
req.AddParam("cursor", *cursorId)
}
err = req.GetResponse(res)
return
}
func (p *direct) GetRankedRecipients(mode string, showThreads bool, query *string) (res *responses.DirectRankedRecipients, err error) {
res = &responses.DirectRankedRecipients{}
showThreadsStr := "false"
if showThreads {
showThreadsStr = "true"
}
req := p.ig.client.Request(constants.DirectRankedRecipients).AddParam("mode", mode).AddParam("show_threads", showThreadsStr).AddParam("use_unified_inbox", "true")
if query != nil {
req.AddParam("query", *query)
}
err = req.GetResponse(res)
return
}