forked from aliforever/gista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstory.go
64 lines (56 loc) · 1.7 KB
/
story.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package gista
import (
"encoding/json"
"fmt"
"github.com/aliforever/gista/constants"
"github.com/aliforever/gista/responses"
)
type story struct {
ig *Instagram
}
func newStory(i *Instagram) *story {
return &story{ig: i}
}
func (s *story) GetUserReelMediaFeed(userId int64) (res *responses.UserReelMediaFeed, err error) {
res = &responses.UserReelMediaFeed{}
err = s.ig.client.Request(fmt.Sprintf(constants.GetUserReelMediaFeed, userId)).
GetResponse(res)
return
}
func (s *story) GetUserStoryFeed(userId int64) (res *responses.UserStoryFeed, err error) {
res = &responses.UserStoryFeed{}
c, _ := json.Marshal(constants.SupportedCapabilities)
err = s.ig.client.Request(fmt.Sprintf(constants.GetUserStoryFeed, userId)).
AddParam("supported_capabilities_new", string(c)).
GetResponse(res)
return
}
func (s *story) GetReelsTrayFeed() (res *responses.ReelsTrayFeed, err error) {
res = &responses.ReelsTrayFeed{}
cps, _ := json.Marshal(constants.SupportedCapabilities)
err = s.ig.client.Request(constants.ReelsTrayFeed).
SetSignedPost(false).
AddPost("supported_capabilities_new", string(cps)).
AddPost("reason", "pull_to_refresh").
AddCSRFPost().
AddUuIdPost().
GetResponse(res)
return
}
func (s *story) GetReelsMediaFeed(feedList []string, source *string) (res *responses.ReelsMedia, err error) {
res = &responses.ReelsMedia{}
src := "feed_timeline"
if source != nil {
src = *source
}
cps, _ := json.Marshal(constants.SupportedCapabilities)
err = s.ig.client.Request(constants.GetReelsMediaFeed).
AddPost("supported_capabilities_new", string(cps)).
AddPost("user_ids", feedList).
AddPost("source", src).
AddCSRFPost().
AddUIdPost().
AddUuIdPost().
GetResponse(res)
return
}