Beispiel #1
0
func printAlbums(client *media.Client) {
	albums, err := client.ListAlbums("")
	if err != nil {
		panic(err)
	}
	table := make([][]string, 0)
	table = append(table, []string{
		"ID",
		"UpdatedAt",
		"Access",
		"NumPhotos",
		"BytesUsed",
		"Title",
	})
	for _, a := range albums {
		table = append(table, []string{
			a.ID,
			a.UpdatedAt.Local().Format(time.RFC3339),
			string(a.Access),
			fmt.Sprintf("%d/%d", a.NumPhotos, (a.NumPhotos + a.NumPhotosRemaining)),
			fmt.Sprintf("%d", a.BytesUsed),
			a.Title,
		})
	}
	printTable(table)
}