func getSet(client flickr.Client, userInfo views.UserInfo, photosetId string, page, pageSize int) (views.PhotosCtx, error) { info, err := client.PhotosetInfo(userInfo.Id, photosetId) if err != nil { return views.PhotosCtx{}, err } resp, err := client.Photoset(userInfo.Id, photosetId, pageSize, page) if err != nil { return views.PhotosCtx{}, err } ctx := views.PhotosCtx{ Title: fmt.Sprintf("ihkh : %s : %s", userInfo.UserName, info.Photoset.Title), Photos: []views.Photo{}, UserInfo: userInfo, } if resp.Photos.Page > 1 { ctx.PrevPage = fmt.Sprintf("/sets/%s/%d", photosetId, resp.Photos.Page-1) } if resp.Photos.Page != resp.Photos.Pages { ctx.NextPage = fmt.Sprintf("/sets/%s/%d", photosetId, resp.Photos.Page+1) } for _, photo := range resp.Photos.Photo { ctx.Photos = append(ctx.Photos, views.Photo{ Id: photo.Id, Src: photo.Url, Width: photo.Width, Height: photo.Height, }) } return ctx, nil }