diff --git a/appview/database/models.go b/appview/database/models.go index 9e22815..e2e374c 100644 --- a/appview/database/models.go +++ b/appview/database/models.go @@ -14,7 +14,7 @@ type Subscription struct { ID uint `gorm:"primaryKey"` DID string `gorm:"size:255;not null;index:idx_subscriptions_did_rkey,unique;index:idx_subscriptions_did"` Rkey string `gorm:"size:512;not null;index:idx_subscriptions_did_rkey,unique"` - FeedID int `gorm:"not null;index:idx_subscriptions_feed_id"` + FeedID int64 `gorm:"not null;index:idx_subscriptions_feed_id"` FeedURL string `gorm:"size:2048"` PodcastGuid string `gorm:"size:512"` CreatedAt string `gorm:"size:64;not null"` @@ -28,8 +28,8 @@ type Comment struct { DID string `gorm:"size:255;not null;index:idx_comments_did_rkey,unique;index:idx_comments_did"` Rkey string `gorm:"size:512;not null;index:idx_comments_did_rkey,unique"` ATURI string `gorm:"size:1024;index;not null"` - FeedID int `gorm:"not null;index:idx_comments_episode"` - EpisodeID int `gorm:"not null;index:idx_comments_episode"` + FeedID int64 `gorm:"not null;index:idx_comments_episode"` + EpisodeID int64 `gorm:"not null;index:idx_comments_episode"` EpisodeGuid string `gorm:"size:512"` PodcastGuid string `gorm:"size:512"` Text string `gorm:"type:text;not null"` @@ -47,8 +47,8 @@ type Recommendation struct { ID uint `gorm:"primaryKey"` DID string `gorm:"size:255;not null;index:idx_recommendations_did_rkey,unique;index:idx_recommendations_did"` Rkey string `gorm:"size:512;not null;index:idx_recommendations_did_rkey,unique"` - FeedID int `gorm:"not null;index:idx_recommendations_episode"` - EpisodeID int `gorm:"not null;index:idx_recommendations_episode"` + FeedID int64 `gorm:"not null;index:idx_recommendations_episode"` + EpisodeID int64 `gorm:"not null;index:idx_recommendations_episode"` EpisodeGuid string `gorm:"size:512"` PodcastGuid string `gorm:"size:512"` Text string `gorm:"type:text"` @@ -75,8 +75,8 @@ type Bookmark struct { ID uint `gorm:"primaryKey"` DID string `gorm:"size:255;not null;index:idx_bookmarks_did_rkey,unique;index:idx_bookmarks_did"` Rkey string `gorm:"size:512;not null;index:idx_bookmarks_did_rkey,unique"` - FeedID int `gorm:"not null;index:idx_bookmarks_episode"` - EpisodeID int `gorm:"not null;index:idx_bookmarks_episode"` + FeedID int64 `gorm:"not null;index:idx_bookmarks_episode"` + EpisodeID int64 `gorm:"not null;index:idx_bookmarks_episode"` EpisodeGuid string `gorm:"size:512"` PodcastGuid string `gorm:"size:512"` TimestampS *int `gorm:"index"` @@ -108,7 +108,7 @@ type PICache struct { func (PICache) TableName() string { return "pi_cache" } type PodcastStats struct { - FeedID int `gorm:"primaryKey"` + FeedID int64 `gorm:"primaryKey"` SubscriberCount int `gorm:"default:0"` CommentCount int `gorm:"default:0"` RecommendationCount int `gorm:"default:0"` @@ -118,8 +118,8 @@ type PodcastStats struct { func (PodcastStats) TableName() string { return "podcast_stats" } type EpisodeStats struct { - EpisodeID int `gorm:"primaryKey"` - FeedID int `gorm:"not null;index:idx_episode_stats_feed"` + EpisodeID int64 `gorm:"primaryKey"` + FeedID int64 `gorm:"not null;index:idx_episode_stats_feed"` CommentCount int `gorm:"default:0"` RecommendationCount int `gorm:"default:0"` BookmarkCount int `gorm:"default:0"` @@ -132,8 +132,8 @@ type EpisodeState struct { ID uint `gorm:"primaryKey"` DID string `gorm:"size:255;not null;index:idx_episode_states_did_rkey,unique;index:idx_episode_states_did"` Rkey string `gorm:"size:512;not null;index:idx_episode_states_did_rkey,unique"` - FeedID int `gorm:"not null;index:idx_episode_states_episode,unique"` - EpisodeID int `gorm:"not null;index:idx_episode_states_episode,unique"` + FeedID int64 `gorm:"not null;index:idx_episode_states_episode,unique"` + EpisodeID int64 `gorm:"not null;index:idx_episode_states_episode,unique"` EpisodeGuid string `gorm:"size:512"` PodcastGuid string `gorm:"size:512"` PositionS *int diff --git a/appview/handlers/bookmark.go b/appview/handlers/bookmark.go index 47d2819..196824c 100644 --- a/appview/handlers/bookmark.go +++ b/appview/handlers/bookmark.go @@ -13,8 +13,8 @@ func (h *Handlers) GetBookmarks(c echo.Context) error { return writeError(c, http.StatusBadRequest, "InvalidRequest", "did is required") } - feedID := parseInt(c.QueryParam("feedId"), 0) - episodeID := parseInt(c.QueryParam("episodeId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) + episodeID := parseInt64(c.QueryParam("episodeId"), 0) limit := parseLimit(c.QueryParam("limit"), 50, 100) cursor := c.QueryParam("cursor") diff --git a/appview/handlers/comment.go b/appview/handlers/comment.go index 8a69338..9842d9a 100644 --- a/appview/handlers/comment.go +++ b/appview/handlers/comment.go @@ -8,8 +8,8 @@ import ( ) func (h *Handlers) GetComments(c echo.Context) error { - feedID := parseInt(c.QueryParam("feedId"), 0) - episodeID := parseInt(c.QueryParam("episodeId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) + episodeID := parseInt64(c.QueryParam("episodeId"), 0) if feedID <= 0 || episodeID <= 0 { return writeError(c, http.StatusBadRequest, "InvalidRequest", "feedId and episodeId are required") } diff --git a/appview/handlers/episode_state.go b/appview/handlers/episode_state.go index 3f18a6b..ecf5734 100644 --- a/appview/handlers/episode_state.go +++ b/appview/handlers/episode_state.go @@ -13,7 +13,7 @@ func (h *Handlers) GetEpisodeStates(c echo.Context) error { return writeError(c, http.StatusBadRequest, "InvalidRequest", "did is required") } - feedID := parseInt(c.QueryParam("feedId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) limit := parseLimit(c.QueryParam("limit"), 50, 100) cursor := c.QueryParam("cursor") diff --git a/appview/handlers/episodes.go b/appview/handlers/episodes.go index cc68b62..a8068fd 100644 --- a/appview/handlers/episodes.go +++ b/appview/handlers/episodes.go @@ -8,7 +8,7 @@ import ( ) func (h *Handlers) GetEpisodes(c echo.Context) error { - feedID := parseInt(c.QueryParam("feedId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) feedURL := c.QueryParam("feedUrl") max := parseLimit(c.QueryParam("max"), 50, 200) @@ -46,10 +46,10 @@ func (h *Handlers) GetEpisodes(c echo.Context) error { items = append(items, v) continue } - episodeID := anyToInt(item["id"]) + episodeID := anyToInt64(item["id"]) if episodeID > 0 { if feedID <= 0 { - feedID = anyToInt(item["feedId"]) + feedID = anyToInt64(item["feedId"]) } item["social"] = h.episodeSocialCounts(c.Request().Context(), feedID, episodeID) } @@ -61,7 +61,7 @@ func (h *Handlers) GetEpisodes(c echo.Context) error { } func (h *Handlers) GetEpisode(c echo.Context) error { - episodeID := parseInt(c.QueryParam("episodeId"), 0) + episodeID := parseInt64(c.QueryParam("episodeId"), 0) if episodeID <= 0 { return writeError(c, http.StatusBadRequest, "InvalidRequest", "episodeId is required") } @@ -77,8 +77,8 @@ func (h *Handlers) GetEpisode(c echo.Context) error { return writeJSONBlob(c, raw) } - feedID := parseInt(c.QueryParam("feedId"), 0) - payload["social"] = h.episodeSocialCounts(c.Request().Context(), feedID, episodeID) + feedID2 := parseInt64(c.QueryParam("feedId"), 0) + payload["social"] = h.episodeSocialCounts(c.Request().Context(), feedID2, episodeID) return c.JSON(http.StatusOK, payload) } diff --git a/appview/handlers/handlers.go b/appview/handlers/handlers.go index af90ad4..220ab5a 100644 --- a/appview/handlers/handlers.go +++ b/appview/handlers/handlers.go @@ -22,6 +22,17 @@ func New(db *gorm.DB, pi *podcastindex.CachedClient, logger *slog.Logger) *Handl return &Handlers{db: db, pi: pi, logger: logger} } +func parseInt64(raw string, fallback int64) int64 { + if raw == "" { + return fallback + } + v, err := strconv.ParseInt(raw, 10, 64) + if err != nil { + return fallback + } + return v +} + func parseInt(raw string, fallback int) int { if raw == "" { return fallback diff --git a/appview/handlers/inbox.go b/appview/handlers/inbox.go index 3eea64f..aee60b6 100644 --- a/appview/handlers/inbox.go +++ b/appview/handlers/inbox.go @@ -32,8 +32,8 @@ func (h *Handlers) GetInbox(c echo.Context) error { } type seenKey struct { - FeedID int - EpisodeID int + FeedID int64 + EpisodeID int64 } seen := map[seenKey]struct{}{} items := make([]map[string]any, 0) @@ -58,7 +58,7 @@ func (h *Handlers) GetInbox(c echo.Context) error { if !ok { continue } - episodeID := anyToInt(item["id"]) + episodeID := anyToInt64(item["id"]) if episodeID <= 0 { continue } diff --git a/appview/handlers/podcast.go b/appview/handlers/podcast.go index 2334eb5..f556608 100644 --- a/appview/handlers/podcast.go +++ b/appview/handlers/podcast.go @@ -8,8 +8,8 @@ import ( ) func (h *Handlers) GetPodcast(c echo.Context) error { - feedID := parseInt(c.QueryParam("feedId"), 0) - itunesID := parseInt(c.QueryParam("itunesId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) + itunesID := parseInt64(c.QueryParam("itunesId"), 0) var raw json.RawMessage var err error @@ -102,9 +102,9 @@ func (h *Handlers) GetStats(c echo.Context) error { return writeJSONBlob(c, raw) } -func feedIDFromPayload(payload map[string]any) int { +func feedIDFromPayload(payload map[string]any) int64 { if feed, ok := payload["feed"].(map[string]any); ok { - return anyToInt(feed["id"]) + return anyToInt64(feed["id"]) } return 0 } diff --git a/appview/handlers/recommendation.go b/appview/handlers/recommendation.go index 02bf28b..91aadcb 100644 --- a/appview/handlers/recommendation.go +++ b/appview/handlers/recommendation.go @@ -9,8 +9,8 @@ import ( ) func (h *Handlers) GetRecommendations(c echo.Context) error { - feedID := parseInt(c.QueryParam("feedId"), 0) - episodeID := parseInt(c.QueryParam("episodeId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) + episodeID := parseInt64(c.QueryParam("episodeId"), 0) limit := parseLimit(c.QueryParam("limit"), 50, 100) cursor := c.QueryParam("cursor") @@ -42,8 +42,8 @@ func (h *Handlers) GetRecommendations(c echo.Context) error { } type popularRow struct { - FeedID int `json:"feedId"` - EpisodeID int `json:"episodeId"` + FeedID int64 `json:"feedId"` + EpisodeID int64 `json:"episodeId"` Count int64 `json:"count"` } diff --git a/appview/handlers/social.go b/appview/handlers/social.go index f77e129..de6222e 100644 --- a/appview/handlers/social.go +++ b/appview/handlers/social.go @@ -22,35 +22,35 @@ type EpisodeSocialCounts struct { BookmarkCount int `json:"bookmarkCount"` } -func anyToInt(v any) int { +func anyToInt64(v any) int64 { switch x := v.(type) { case int: - return x + return int64(x) case int8: - return int(x) + return int64(x) case int16: - return int(x) + return int64(x) case int32: - return int(x) + return int64(x) case int64: - return int(x) + return x case uint: - return int(x) + return int64(x) case uint8: - return int(x) + return int64(x) case uint16: - return int(x) + return int64(x) case uint32: - return int(x) + return int64(x) case uint64: - return int(x) + return int64(x) case float64: - return int(x) + return int64(x) case json.Number: i, _ := x.Int64() - return int(i) + return i case string: - i, _ := strconv.Atoi(x) + i, _ := strconv.ParseInt(x, 10, 64) return i default: return 0 @@ -93,17 +93,17 @@ func storeFeedItems(payload map[string]any, key string, items []map[string]any) payload[key] = arr } -func feedIDFromItem(item map[string]any) int { - if id := anyToInt(item["feedId"]); id > 0 { +func feedIDFromItem(item map[string]any) int64 { + if id := anyToInt64(item["feedId"]); id > 0 { return id } - if id := anyToInt(item["id"]); id > 0 { + if id := anyToInt64(item["id"]); id > 0 { return id } return 0 } -func (h *Handlers) podcastSocialCounts(ctx context.Context, feedID int) SocialCounts { +func (h *Handlers) podcastSocialCounts(ctx context.Context, feedID int64) SocialCounts { if feedID <= 0 { return SocialCounts{} } @@ -135,16 +135,16 @@ func (h *Handlers) podcastSocialCounts(ctx context.Context, feedID int) SocialCo func sortEpisodeItemsByPublishedDesc(items []map[string]any) { sort.SliceStable(items, func(i, j int) bool { - left := anyToInt(items[i]["datePublished"]) - right := anyToInt(items[j]["datePublished"]) + left := anyToInt64(items[i]["datePublished"]) + right := anyToInt64(items[j]["datePublished"]) if left == right { - return anyToInt(items[i]["id"]) > anyToInt(items[j]["id"]) + return anyToInt64(items[i]["id"]) > anyToInt64(items[j]["id"]) } return left > right }) } -func (h *Handlers) episodeSocialCounts(ctx context.Context, feedID, episodeID int) EpisodeSocialCounts { +func (h *Handlers) episodeSocialCounts(ctx context.Context, feedID, episodeID int64) EpisodeSocialCounts { if episodeID <= 0 { return EpisodeSocialCounts{} } diff --git a/appview/handlers/subscription.go b/appview/handlers/subscription.go index d46017a..9947970 100644 --- a/appview/handlers/subscription.go +++ b/appview/handlers/subscription.go @@ -39,7 +39,7 @@ func (h *Handlers) GetSubscriptions(c echo.Context) error { } func (h *Handlers) GetSubscribers(c echo.Context) error { - feedID := parseInt(c.QueryParam("feedId"), 0) + feedID := parseInt64(c.QueryParam("feedId"), 0) if feedID <= 0 { return writeError(c, http.StatusBadRequest, "InvalidRequest", "feedId is required") } diff --git a/appview/indexer/bookmark.go b/appview/indexer/bookmark.go index b2d56c0..493cdc5 100644 --- a/appview/indexer/bookmark.go +++ b/appview/indexer/bookmark.go @@ -12,11 +12,11 @@ func (idx *Indexer) indexBookmark(ctx context.Context, did, rkey string, rec map if !ok { return fmt.Errorf("bookmark missing episode object") } - feedID, ok := asInt(episode["feedId"]) + feedID, ok := asInt64(episode["feedId"]) if !ok || feedID <= 0 { return fmt.Errorf("bookmark missing valid episode.feedId") } - episodeID, ok := asInt(episode["episodeId"]) + episodeID, ok := asInt64(episode["episodeId"]) if !ok || episodeID <= 0 { return fmt.Errorf("bookmark missing valid episode.episodeId") } @@ -30,8 +30,9 @@ func (idx *Indexer) indexBookmark(ctx context.Context, did, rkey string, rec map PodcastGuid: asString(episode["podcastGuid"]), CreatedAt: asString(rec["createdAt"]), } - if ts, ok := asInt(rec["timestamp"]); ok { - bookmark.TimestampS = &ts + if ts, ok := asInt64(rec["timestamp"]); ok { + tsInt := int(ts) + bookmark.TimestampS = &tsInt } db := idx.db.WithContext(ctx) diff --git a/appview/indexer/comment.go b/appview/indexer/comment.go index b7cd74c..01841b3 100644 --- a/appview/indexer/comment.go +++ b/appview/indexer/comment.go @@ -12,11 +12,11 @@ func (idx *Indexer) indexComment(ctx context.Context, did, rkey string, rec map[ if !ok { return fmt.Errorf("comment missing episode object") } - feedID, ok := asInt(episode["feedId"]) + feedID, ok := asInt64(episode["feedId"]) if !ok || feedID <= 0 { return fmt.Errorf("comment missing valid episode.feedId") } - episodeID, ok := asInt(episode["episodeId"]) + episodeID, ok := asInt64(episode["episodeId"]) if !ok || episodeID <= 0 { return fmt.Errorf("comment missing valid episode.episodeId") } @@ -34,8 +34,9 @@ func (idx *Indexer) indexComment(ctx context.Context, did, rkey string, rec map[ Facets: jsonBytes(rec["facets"]), } - if ts, ok := asInt(rec["timestamp"]); ok { - comment.TimestampS = &ts + if ts, ok := asInt64(rec["timestamp"]); ok { + tsInt := int(ts) + comment.TimestampS = &tsInt } if reply, ok := asMap(rec["reply"]); ok { diff --git a/appview/indexer/episode_state.go b/appview/indexer/episode_state.go index 345d173..731384d 100644 --- a/appview/indexer/episode_state.go +++ b/appview/indexer/episode_state.go @@ -12,11 +12,11 @@ func (idx *Indexer) indexEpisodeState(ctx context.Context, did, rkey string, rec if !ok { return fmt.Errorf("episodeState missing episode object") } - feedID, ok := asInt(episode["feedId"]) + feedID, ok := asInt64(episode["feedId"]) if !ok || feedID <= 0 { return fmt.Errorf("episodeState missing valid episode.feedId") } - episodeID, ok := asInt(episode["episodeId"]) + episodeID, ok := asInt64(episode["episodeId"]) if !ok || episodeID <= 0 { return fmt.Errorf("episodeState missing valid episode.episodeId") } @@ -34,11 +34,13 @@ func (idx *Indexer) indexEpisodeState(ctx context.Context, did, rkey string, rec CreatedAt: asString(rec["createdAt"]), UpdatedAt: asString(rec["updatedAt"]), } - if pos, ok := asInt(rec["positionS"]); ok { - state.PositionS = &pos + if pos, ok := asInt64(rec["positionS"]); ok { + posInt := int(pos) + state.PositionS = &posInt } - if dur, ok := asInt(rec["durationS"]); ok { - state.DurationS = &dur + if dur, ok := asInt64(rec["durationS"]); ok { + durInt := int(dur) + state.DurationS = &durInt } db := idx.db.WithContext(ctx) diff --git a/appview/indexer/indexer.go b/appview/indexer/indexer.go index 5d8d904..29a6a53 100644 --- a/appview/indexer/indexer.go +++ b/appview/indexer/indexer.go @@ -124,30 +124,30 @@ func asString(v any) string { return s } -func asInt(v any) (int, bool) { +func asInt64(v any) (int64, bool) { switch x := v.(type) { case int: - return x, true + return int64(x), true case int8: - return int(x), true + return int64(x), true case int16: - return int(x), true + return int64(x), true case int32: - return int(x), true + return int64(x), true case int64: - return int(x), true + return x, true case uint: - return int(x), true + return int64(x), true case uint8: - return int(x), true + return int64(x), true case uint16: - return int(x), true + return int64(x), true case uint32: - return int(x), true + return int64(x), true case uint64: - return int(x), true + return int64(x), true case float64: - return int(x), true + return int64(x), true default: return 0, false } diff --git a/appview/indexer/recommendation.go b/appview/indexer/recommendation.go index 27bc362..0364d12 100644 --- a/appview/indexer/recommendation.go +++ b/appview/indexer/recommendation.go @@ -12,11 +12,11 @@ func (idx *Indexer) indexRecommendation(ctx context.Context, did, rkey string, r if !ok { return fmt.Errorf("recommendation missing subject") } - feedID, ok := asInt(subject["feedId"]) + feedID, ok := asInt64(subject["feedId"]) if !ok || feedID <= 0 { return fmt.Errorf("recommendation missing valid subject.feedId") } - episodeID, ok := asInt(subject["episodeId"]) + episodeID, ok := asInt64(subject["episodeId"]) if !ok || episodeID <= 0 { return fmt.Errorf("recommendation missing valid subject.episodeId") } diff --git a/appview/indexer/stats.go b/appview/indexer/stats.go index 4c189ef..ea49a14 100644 --- a/appview/indexer/stats.go +++ b/appview/indexer/stats.go @@ -8,7 +8,7 @@ import ( "gorm.io/gorm/clause" ) -func (idx *Indexer) refreshPodcastStats(ctx context.Context, feedID int) error { +func (idx *Indexer) refreshPodcastStats(ctx context.Context, feedID int64) error { if feedID <= 0 { return nil } @@ -44,7 +44,7 @@ func (idx *Indexer) refreshPodcastStats(ctx context.Context, feedID int) error { }).Create(&row).Error } -func (idx *Indexer) refreshEpisodeStats(ctx context.Context, feedID, episodeID int) error { +func (idx *Indexer) refreshEpisodeStats(ctx context.Context, feedID, episodeID int64) error { if feedID <= 0 || episodeID <= 0 { return nil } diff --git a/appview/indexer/subscription.go b/appview/indexer/subscription.go index c86033f..649de3d 100644 --- a/appview/indexer/subscription.go +++ b/appview/indexer/subscription.go @@ -12,7 +12,7 @@ func (idx *Indexer) indexSubscription(ctx context.Context, did, rkey string, rec if !ok { return fmt.Errorf("subscription missing podcast object") } - feedID, ok := asInt(podcast["feedId"]) + feedID, ok := asInt64(podcast["feedId"]) if !ok || feedID <= 0 { return fmt.Errorf("subscription missing valid podcast.feedId") } diff --git a/appview/podcastindex/cache.go b/appview/podcastindex/cache.go index 887f12f..832a1d7 100644 --- a/appview/podcastindex/cache.go +++ b/appview/podcastindex/cache.go @@ -69,21 +69,21 @@ func (cc *CachedClient) SearchEpisodesByTerm(query string, max int) (json.RawMes }) } -func (cc *CachedClient) GetPodcastByFeedID(feedID int) (json.RawMessage, error) { +func (cc *CachedClient) GetPodcastByFeedID(feedID int64) (json.RawMessage, error) { key := fmt.Sprintf("podcast:%d", feedID) return cc.getOrFetch(key, 24*time.Hour, func() (json.RawMessage, error) { return cc.inner.GetPodcastByFeedID(feedID) }) } -func (cc *CachedClient) GetEpisodesByFeedID(feedID int, max int) (json.RawMessage, error) { +func (cc *CachedClient) GetEpisodesByFeedID(feedID int64, max int) (json.RawMessage, error) { key := fmt.Sprintf("episodes:%d:%d", feedID, max) return cc.getOrFetch(key, 15*time.Minute, func() (json.RawMessage, error) { return cc.inner.GetEpisodesByFeedID(feedID, max) }) } -func (cc *CachedClient) GetEpisodeByID(episodeID int) (json.RawMessage, error) { +func (cc *CachedClient) GetEpisodeByID(episodeID int64) (json.RawMessage, error) { key := fmt.Sprintf("episode:%d", episodeID) return cc.getOrFetch(key, 6*time.Hour, func() (json.RawMessage, error) { return cc.inner.GetEpisodeByID(episodeID) @@ -111,7 +111,7 @@ func (cc *CachedClient) GetRecentEpisodes(max int) (json.RawMessage, error) { }) } -func (cc *CachedClient) GetPodcastByItunesID(itunesID int) (json.RawMessage, error) { +func (cc *CachedClient) GetPodcastByItunesID(itunesID int64) (json.RawMessage, error) { key := fmt.Sprintf("podcast:itunes:%d", itunesID) return cc.getOrFetch(key, 24*time.Hour, func() (json.RawMessage, error) { return cc.inner.GetPodcastByItunesID(itunesID) diff --git a/appview/podcastindex/client.go b/appview/podcastindex/client.go index d6a0ba6..645f501 100644 --- a/appview/podcastindex/client.go +++ b/appview/podcastindex/client.go @@ -66,18 +66,18 @@ func (c *Client) SearchEpisodesByTerm(query string, max int) (json.RawMessage, e return c.get("/search/byterm", params) } -func (c *Client) GetPodcastByFeedID(feedID int) (json.RawMessage, error) { - params := url.Values{"id": {strconv.Itoa(feedID)}} +func (c *Client) GetPodcastByFeedID(feedID int64) (json.RawMessage, error) { + params := url.Values{"id": {strconv.FormatInt(feedID, 10)}} return c.get("/podcasts/byfeedid", params) } -func (c *Client) GetEpisodesByFeedID(feedID int, max int) (json.RawMessage, error) { - params := url.Values{"id": {strconv.Itoa(feedID)}, "max": {strconv.Itoa(max)}} +func (c *Client) GetEpisodesByFeedID(feedID int64, max int) (json.RawMessage, error) { + params := url.Values{"id": {strconv.FormatInt(feedID, 10)}, "max": {strconv.Itoa(max)}} return c.get("/episodes/byfeedid", params) } -func (c *Client) GetEpisodeByID(episodeID int) (json.RawMessage, error) { - params := url.Values{"id": {strconv.Itoa(episodeID)}} +func (c *Client) GetEpisodeByID(episodeID int64) (json.RawMessage, error) { + params := url.Values{"id": {strconv.FormatInt(episodeID, 10)}} return c.get("/episodes/byid", params) } @@ -101,8 +101,8 @@ func (c *Client) GetRecentEpisodes(max int) (json.RawMessage, error) { return c.get("/recent/episodes", params) } -func (c *Client) GetPodcastByItunesID(itunesID int) (json.RawMessage, error) { - params := url.Values{"id": {strconv.Itoa(itunesID)}} +func (c *Client) GetPodcastByItunesID(itunesID int64) (json.RawMessage, error) { + params := url.Values{"id": {strconv.FormatInt(itunesID, 10)}} return c.get("/podcasts/byitunesid", params) } diff --git a/appview/podcastindex/models.go b/appview/podcastindex/models.go index 5ad5ce4..163a798 100644 --- a/appview/podcastindex/models.go +++ b/appview/podcastindex/models.go @@ -2,14 +2,14 @@ package podcastindex // These are minimal model stubs used for documentation and future typed decoding. type Podcast struct { - ID int `json:"id"` + ID int64 `json:"id"` Title string `json:"title"` URL string `json:"url"` } type Episode struct { - ID int `json:"id"` - FeedID int `json:"feedId"` + ID int64 `json:"id"` + FeedID int64 `json:"feedId"` Title string `json:"title"` EnclosureURL string `json:"enclosureUrl"` }