-
Notifications
You must be signed in to change notification settings - Fork 10
/
saved_test.go
71 lines (61 loc) · 1.18 KB
/
saved_test.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
65
66
67
68
69
70
71
package instago
import (
"fmt"
"os"
"testing"
)
func ExampleGetSavedPosts(t *testing.T) {
mgr, err := NewInstagramApiManager("auth.json")
if err != nil {
t.Error(err)
return
}
items, err := mgr.GetSavedPosts(12)
if err != nil {
t.Error(err)
return
}
for _, item := range items {
err = PrintPostItem(&item)
if err != nil {
t.Error(err)
return
}
fmt.Println(item.SavedCollectionIds)
PrintTaggedUsers(item.Usertags)
for _, cm := range item.CarouselMedia {
PrintTaggedUsers(cm.Usertags)
}
}
}
func ExampleGetSavedCollection(t *testing.T) {
mgr, err := NewInstagramApiManager("auth.json")
if err != nil {
t.Error(err)
return
}
items, err := mgr.GetSavedCollection(os.Getenv("COLLECTION_ID"))
if err != nil {
t.Error(err)
return
}
for _, item := range items {
fmt.Println(item.GetPostUrl())
fmt.Println(item.SavedCollectionIds)
}
}
func ExampleGetSavedCollectionList(t *testing.T) {
mgr, err := NewInstagramApiManager("auth.json")
if err != nil {
t.Error(err)
return
}
collections, err := mgr.GetSavedCollectionList()
if err != nil {
t.Error(err)
return
}
for _, collection := range collections {
fmt.Println(collection)
}
}