-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
57 lines (45 loc) · 1.06 KB
/
main.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
package main
import (
"fmt"
"github.com/andreas/podio-go"
)
func main() {
authToken, err := podio.AuthWithUserCredentials("my-client-id", "my-client-secret", "my-username", "my-password")
if err != nil {
fmt.Println("Auth failed: ", err)
return
}
client := podio.NewClient(authToken)
orgs, err := client.GetOrganizations()
if err != nil {
fmt.Println("Failed to get orgs: ", err)
return
}
for _, org := range orgs {
fmt.Println("Org: ", org.Name)
spaces, err := client.GetSpaces(org.Id)
if err != nil {
fmt.Println("Failed to get spaces: ", err)
continue
}
for _, space := range spaces {
fmt.Println("Space: ", space.Name)
apps, err := client.GetApps(space.Id)
if err != nil {
fmt.Println("Failed to get apps: ", err)
continue
}
for _, app := range apps {
fmt.Println("App: ", app.Name)
items, err := client.GetItems(app.Id)
if err != nil {
fmt.Println("Failed to get items: ", err)
continue
}
for _, item := range items.Items {
fmt.Printf("Item: %v\n", item)
}
}
}
}
}