Documentation
¶
Index ¶
- Constants
- Variables
- func FetchLetterboxdListIdentifier(userName, listSlug string) (lid string, err error)
- func FetchLetterboxdUserIdentifier(userName string) (lid string, err error)
- func GetListIdBySlug(userId, slug string) (string, error)
- func GetListIdByUserNameAndSlug(userName, slug string) (string, error)
- func GetUserIdByName(user_name string) (string, error)
- func InvalidateListCache(list *LetterboxdList)
- func UpsertList(list *LetterboxdList) (err error)
- type APIClient
- func (c *APIClient) FetchList(params *FetchListParams) (request.APIResponse[List], error)
- func (c *APIClient) FetchListEntries(params *FetchListEntriesParams) (request.APIResponse[ListEntriesResponse], error)
- func (c *APIClient) FetchMemberStatistics(params *FetchMemberStatisticsParams) (request.APIResponse[FetchMemberStatisticsData], error)
- func (c *APIClient) FetchMemberWatchlist(params *FetchMemberWatchlistParams) (request.APIResponse[FetchMemberWatchlistData], error)
- func (c *APIClient) GetRetryAfter() time.Duration
- func (c *APIClient) Request(method, path string, params request.Context, v request.ResponseContainer) (*http.Response, error)
- func (c *APIClient) Search(params *SearchParams) (request.APIResponse[SearchResponse], error)
- type APIClientConfig
- type APIClientConfigOAuth
- type APIClientOAuth
- type AbstractSearchItem
- type AccountStatus
- type CommentPolicy
- type ContributionType
- type ContributorSummary
- type Ctx
- type FetchListEntriesParams
- type FetchListParams
- type FetchMemberStatisticsData
- type FetchMemberStatisticsParams
- type FetchMemberWatchlistData
- type FetchMemberWatchlistParams
- type FilmRelationship
- type FilmSummary
- type FilmsMemberRelationship
- type FilmsMetadata
- type FilmsRelationship
- type FilmsRelationshipCounts
- type Genre
- type Image
- type ImageSize
- type LetterboxdItem
- type LetterboxdItemGenre
- type LetterboxdList
- type LetterboxdListItem
- type Link
- type LinkType
- type List
- type ListEntriesResponse
- type ListEntry
- type ListEntryOccurrence
- type ListEntrySummary
- type ListIdentifier
- type ListSummary
- type MemberFilmRelationship
- type MemberIdentifier
- type MemberStatisticsCounts
- type MemberStatus
- type MemberSummary
- type PrivacyPolicy
- type Pronoun
- type RatingsHistogramBar
- type ResponseError
- type SearchMethod
- type SearchParams
- type SearchResponse
- type SearchResultType
- type SharePolicy
- type Tag
Constants ¶
View Source
const ID_PREFIX_DYNAMIC = "~:"
View Source
const ID_PREFIX_USER_WATCHLIST = ID_PREFIX_DYNAMIC + "watchlist:"
View Source
const ItemGenreTableName = "letterboxd_item_genre"
View Source
const ItemTableName = "letterboxd_item"
View Source
const ListItemTableName = "letterboxd_list_item"
View Source
const ListTableName = "letterboxd_list"
View Source
const MAX_LIST_ITEM_COUNT = 5000
View Source
const SITE_BASE_URL = "https://letterboxd.com"
Variables ¶
View Source
var GenreNames = func() []string { genreNames := make([]string, 0, len(genreNameById)) for _, name := range genreNameById { genreNames = append(genreNames, name) } return genreNames }()
View Source
var ItemColumn = struct { Id string Name string ReleaseYear string Runtime string Rating string Adult string Poster string UpdatedAt string }{ Id: "id", Name: "name", ReleaseYear: "release_year", Runtime: "runtime", Rating: "rating", Adult: "adult", Poster: "poster", UpdatedAt: "uat", }
View Source
var ItemColumns = []string{ ItemColumn.Id, ItemColumn.Name, ItemColumn.ReleaseYear, ItemColumn.Runtime, ItemColumn.Rating, ItemColumn.Adult, ItemColumn.Poster, ItemColumn.UpdatedAt, }
View Source
var ItemGenreColumn = struct { ItemId string GenreId string }{ ItemId: "item_id", GenreId: "genre_id", }
View Source
var LetterboxdEnabled = config.Integration.Letterboxd.IsEnabled()
View Source
var LetterboxdPiggybacked = config.Integration.Letterboxd.IsPiggybacked()
View Source
var ListColumn = struct { Id string UserId string UserName string Name string Slug string Description string Private string ItemCount string Version string UpdatedAt string }{ Id: "id", UserId: "user_id", UserName: "user_name", Name: "name", Slug: "slug", Description: "description", Private: "private", ItemCount: "item_count", Version: "v", UpdatedAt: "uat", }
View Source
var ListColumns = []string{ ListColumn.Id, ListColumn.UserId, ListColumn.UserName, ListColumn.Name, ListColumn.Slug, ListColumn.Description, ListColumn.Private, ListColumn.ItemCount, ListColumn.Version, ListColumn.UpdatedAt, }
View Source
var ListItemColumn = struct { ListId string ItemId string Rank string }{ ListId: "list_id", ItemId: "item_id", Rank: "rank", }
View Source
var Peer = peer.NewAPIClient(&peer.APIClientConfig{ BaseURL: config.PeerURL, })
View Source
var SITE_BASE_URL_PARSED = util.MustParseURL(SITE_BASE_URL)
Functions ¶
func GetListIdBySlug ¶
func GetUserIdByName ¶
func InvalidateListCache ¶
func InvalidateListCache(list *LetterboxdList)
func UpsertList ¶
func UpsertList(list *LetterboxdList) (err error)
Types ¶
type APIClient ¶
type APIClient struct {
BaseURL *url.URL
OAuth APIClientOAuth
// contains filtered or unexported fields
}
func GetSystemClient ¶
func GetSystemClient() *APIClient
func NewAPIClient ¶
func NewAPIClient(conf *APIClientConfig) *APIClient
func (*APIClient) FetchList ¶
func (c *APIClient) FetchList(params *FetchListParams) (request.APIResponse[List], error)
func (*APIClient) FetchListEntries ¶
func (c *APIClient) FetchListEntries(params *FetchListEntriesParams) (request.APIResponse[ListEntriesResponse], error)
func (*APIClient) FetchMemberStatistics ¶
func (c *APIClient) FetchMemberStatistics(params *FetchMemberStatisticsParams) (request.APIResponse[FetchMemberStatisticsData], error)
func (*APIClient) FetchMemberWatchlist ¶
func (c *APIClient) FetchMemberWatchlist(params *FetchMemberWatchlistParams) (request.APIResponse[FetchMemberWatchlistData], error)
func (*APIClient) GetRetryAfter ¶
func (*APIClient) Search ¶
func (c *APIClient) Search(params *SearchParams) (request.APIResponse[SearchResponse], error)
type APIClientConfig ¶
type APIClientConfig struct {
HTTPClient *http.Client
OAuth *APIClientConfigOAuth
}
type APIClientConfigOAuth ¶
type APIClientConfigOAuth struct {
GetTokenSource func(oauth2.Config) oauth2.TokenSource
}
type APIClientOAuth ¶
type APIClientOAuth struct {
Config oauth2.Config
TokenSource oauth2.TokenSource
}
type AbstractSearchItem ¶
type AbstractSearchItem struct {
Score float32 `json:"score"`
Type SearchResultType `json:"type"`
Member *MemberSummary `json:"member,omitempty"`
List *ListSummary `json:"list,omitempty"`
}
type AccountStatus ¶
type AccountStatus string
const ( AccountStatusActive AccountStatus = "Active" AccountStatusMemorialized AccountStatus = "Memorialized" )
type CommentPolicy ¶
type CommentPolicy string
const ( CommentPolicyAnyone CommentPolicy = "Anyone" CommentPolicyFriends CommentPolicy = "Friends" CommentPolicyYou CommentPolicy = "You" )
type ContributionType ¶
type ContributionType string
var ( ContributionTypeDirector ContributionType = "Director" ContributionTypeCoDirector ContributionType = "CoDirector" ContributionTypeActor ContributionType = "Actor" ContributionTypeProducer ContributionType = "Producer" ContributionTypeWriter ContributionType = "Writer" ContributionTypeOriginalWriter ContributionType = "OriginalWriter" ContributionTypeStory ContributionType = "Story" ContributionTypeCasting ContributionType = "Casting" ContributionTypeEditor ContributionType = "Editor" ContributionTypeCinematography ContributionType = "Cinematography" ContributionTypeAssistantDirector ContributionType = "AssistantDirector" ContributionTypeAdditionalDirecting ContributionType = "AdditionalDirecting" ContributionTypeExecutiveProducer ContributionType = "ExecutiveProducer" ContributionTypeLighting ContributionType = "Lighting" ContributionTypeCameraOperator ContributionType = "CameraOperator" ContributionTypeAdditionalPhotography ContributionType = "AdditionalPhotography" ContributionTypeProductionDesign ContributionType = "ProductionDesign" ContributionTypeArtDirection ContributionType = "ArtDirection" ContributionTypeSetDecoration ContributionType = "SetDecoration" ContributionTypeSpecialEffects ContributionType = "SpecialEffects" ContributionTypeVisualEffects ContributionType = "VisualEffects" ContributionTypeTitleDesign ContributionType = "TitleDesign" ContributionTypeStunts ContributionType = "Stunts" ContributionTypeChoreography ContributionType = "Choreography" ContributionTypeComposer ContributionType = "Composer" ContributionTypeSongs ContributionType = "Songs" ContributionTypeSound ContributionType = "Sound" ContributionTypeCostumes ContributionType = "Costumes" ContributionTypeCreator ContributionType = "Creator" ContributionTypeMakeUp ContributionType = "MakeUp" ContributionTypeHairstyling ContributionType = "Hairstyling" ContributionTypeStudio ContributionType = "Studio" )
type ContributorSummary ¶
type FetchListEntriesParams ¶
type FetchListParams ¶
type FetchMemberStatisticsData ¶
type FetchMemberStatisticsData struct {
ResponseError
Member MemberIdentifier `json:"member"`
Counts MemberStatisticsCounts `json:"counts"`
RatingsHistogram []RatingsHistogramBar `json:"ratingsHistogram"`
YearsInReview []int `json:"yearsInReview"` // Only supported for paying members
}
type FetchMemberWatchlistData ¶
type FetchMemberWatchlistData struct {
ResponseError
Next string `json:"next"`
Items []FilmSummary `json:"items"`
}
type FilmRelationship ¶
type FilmRelationship struct {
Watched bool `json:"watched"`
WhenWatched string `json:"whenWatched,omitempty"`
Liked bool `json:"liked"`
WhenLiked string `json:"whenLiked,omitempty"`
Favorited bool `json:"favorited"`
Owned bool `json:"owned,omitempty"`
InWatchlist bool `json:"inWatchlist,omitempty"`
WhenAddedToWatchlist string `json:"whenAddedToWatchlist,omitempty"`
WhenCompletedInWatchlist string `json:"whenCompletedInWatchlist,omitempty"`
Rating float32 `json:"rating,omitempty"`
Reviews []string `json:"reviews"`
DiaryEntries []string `json:"diaryEntries"`
Rewatched bool `json:"rewatched,omitempty"`
PrivacyPolicy PrivacyPolicy `json:"privacyPolicy,omitempty"`
}
type FilmSummary ¶
type FilmSummary struct {
Id string `json:"id"`
Name string `json:"name"`
OriginalName string `json:"originalName,omitempty"` // FIRST PARTY
SortingName string `json:"sortingName"`
AlternativeNames []string `json:"alternativeNames,omitempty"` // FIRST PARTY
ReleaseYear int `json:"releaseYear"`
RunTime int `json:"runTime,omitempty"`
Rating float32 `json:"rating,omitempty"`
Directors []ContributorSummary `json:"directors"`
Poster *Image `json:"poster,omitempty"`
AdultPoster *Image `json:"adultPoster,omitempty"`
Top250Position int32 `json:"top250Position,omitempty"`
Adult bool `json:"adult"`
ReviewsHidden bool `json:"reviewsHidden"`
PosterCustomizable bool `json:"posterCustomizable"`
BackdropCustomizable bool `json:"backdropCustomizable"`
FilmCollectionId string `json:"filmCollectionId,omitempty"`
Links []Link `json:"links"`
Relationships []MemberFilmRelationship `json:"relationships,omitempty"`
Genres []Genre `json:"genres"`
PosterPickerURL string `json:"posterPickerUrl,omitempty"` // FIRST PARTY
BackdropPickerURL string `json:"backdropPickerUrl,omitempty"` // FIRST PARTY
}
func (FilmSummary) GenreIds ¶
func (fs FilmSummary) GenreIds() []string
func (FilmSummary) GetIdMap ¶
func (fs FilmSummary) GetIdMap() *meta.IdMap
func (FilmSummary) GetPoster ¶
func (fs FilmSummary) GetPoster() string
type FilmsMemberRelationship ¶
type FilmsMemberRelationship struct {
Member MemberSummary `json:"member"`
Relationship FilmsRelationship `json:"relationship"`
}
type FilmsMetadata ¶
type FilmsRelationship ¶
type FilmsRelationship struct {
Counts FilmsRelationshipCounts `json:"counts"`
}
type FilmsRelationshipCounts ¶
type LetterboxdItem ¶
type LetterboxdItem struct {
Id string
Name string
ReleaseYear int
Runtime int
Rating int
Adult bool
Poster string
UpdatedAt db.Timestamp
GenreIds db.JSONStringList `json:"-"`
IdMap *meta.IdMap `json:"-"`
Rank int `json:"-"`
}
func GetListItems ¶
func GetListItems(listId string) ([]LetterboxdItem, error)
func (LetterboxdItem) GenreNames ¶
func (li LetterboxdItem) GenreNames() []string
type LetterboxdItemGenre ¶
type LetterboxdList ¶
type LetterboxdList struct {
Id string
UserId string
UserName string
Name string
Slug string
Description string
Private bool
ItemCount int
Version int64
UpdatedAt db.Timestamp
Items []LetterboxdItem `json:"-"`
}
func GetListById ¶
func GetListById(id string) (*LetterboxdList, error)
func (*LetterboxdList) Fetch ¶
func (l *LetterboxdList) Fetch() error
func (*LetterboxdList) GetURL ¶
func (l *LetterboxdList) GetURL() string
func (*LetterboxdList) HasUnfetchedItems ¶
func (l *LetterboxdList) HasUnfetchedItems() bool
func (*LetterboxdList) IsStale ¶
func (l *LetterboxdList) IsStale() bool
func (*LetterboxdList) IsUserWatchlist ¶
func (l *LetterboxdList) IsUserWatchlist() bool
func (*LetterboxdList) StaleIn ¶
func (l *LetterboxdList) StaleIn() time.Duration
type LetterboxdListItem ¶
type LinkType ¶
type LinkType string
const ( LinkTypeLetterboxd LinkType = "letterboxd" LinkTypeBoxd LinkType = "boxd" LinkTypeTMDB LinkType = "tmdb" LinkTypeIMDB LinkType = "imdb" LinkTypeJustWatch LinkType = "justwatch" LinkTypeFacebook LinkType = "facebook" LinkTypeInstagram LinkType = "instagram" LinkTypeTwitter LinkType = "twitter" LinkTypeYouTube LinkType = "youtube" LinkTypeTickets LinkType = "tickets" LinkTypeTikTok LinkType = "tiktok" LinkTypeBluesky LinkType = "bluesky" LinkTypeThreads LinkType = "threads" )
type List ¶
type List struct {
Id string `json:"id"`
Name string `json:"name"`
Version int64 `json:"version,omitempty"`
FilmCount int `json:"filmCount"`
Published bool `json:"published"`
Ranked bool `json:"ranked"`
HasEntriesWithNotes bool `json:"hasEntriesWithNotes"`
DescriptionLbml string `json:"descriptionLbml,omitempty"`
Tags []string `json:"tags,omitempty"`
Tags2 []Tag `json:"tags2"`
WhenCreated string `json:"whenCreated"`
WhenPublished string `json:"whenPublished,omitempty"`
WhenUpdated string `json:"whenUpdated"`
CommentPolicy CommentPolicy `json:"commentPolicy,omitempty"`
Owner MemberSummary `json:"owner"`
ClonedFrom *ListIdentifier `json:"clonedFrom,omitempty"`
PreviewEntries []ListEntrySummary `json:"previewEntries"`
Links []Link `json:"links"`
Backdrop *Image `json:"backdrop,omitempty"`
BackdropFocalPoint float32 `json:"backdropFocalPoint,omitempty"`
Description string `json:"description,omitempty"`
}
func (List) GetLetterboxdSlug ¶
type ListEntriesResponse ¶
type ListEntriesResponse struct {
ResponseError
Next string `json:"next,omitempty"`
Items []ListEntry `json:"items"`
ItemCount int `json:"itemCount"`
Metadata FilmsMetadata `json:"metadata"`
Relationships []FilmsMemberRelationship `json:"relationships"`
}
type ListEntry ¶
type ListEntry struct {
Rank int `json:"rank,omitempty"`
EntryId string `json:"entryId"`
NotesLbml string `json:"notesLbml,omitempty"`
PosterPickerURL string `json:"posterPickerUrl,omitempty"` // FIRST PARTY
BackdropPickerURL string `json:"backdropPickerUrl,omitempty"` // FIRST PARTY
ContainsSpoilers bool `json:"containsSpoilers,omitempty"`
Film FilmSummary `json:"film"`
WhenAdded string `json:"whenAdded"`
Notes string `json:"notes,omitempty"`
}
type ListEntryOccurrence ¶
type ListEntrySummary ¶
type ListEntrySummary struct {
Rank int `json:"rank,omitempty"`
Film FilmSummary `json:"film"`
}
type ListIdentifier ¶
type ListIdentifier struct {
Id string `json:"id"`
}
type ListSummary ¶
type ListSummary struct {
Id string `json:"id"`
Name string `json:"name"`
Version int64 `json:"version,omitempty"`
FilmCount int `json:"filmCount"`
Published bool `json:"published"`
Ranked bool `json:"ranked"`
DescriptionLbml string `json:"descriptionLbml,omitempty"`
DescriptionTruncated bool `json:"descriptionTruncated,omitempty"`
Owner MemberSummary `json:"owner"`
ClonedFrom *ListIdentifier `json:"clonedFrom,omitempty"`
PreviewEntries []ListEntrySummary `json:"previewEntries"`
EntriesOfNote []ListEntryOccurrence `json:"entriesOfNote,omitempty"`
Description string `json:"description,omitempty"`
WhenCreated string `json:"whenCreated"`
WhenPublished string `json:"whenPublished,omitempty"`
WhenUpdated string `json:"whenUpdated"`
}
type MemberFilmRelationship ¶
type MemberFilmRelationship struct {
Member MemberSummary `json:"member"`
Relationship FilmRelationship `json:"relationship"`
}
type MemberIdentifier ¶
type MemberIdentifier struct {
Id string `json:"id"`
}
type MemberStatisticsCounts ¶
type MemberStatisticsCounts struct {
FilmLikes int `json:"filmLikes"`
ListLikes int `json:"listLikes"`
ReviewLikes int `json:"reviewLikes"`
StoryLikes int `json:"storyLikes"`
Watches int `json:"watches"`
Ratings int `json:"ratings"`
Reviews int `json:"reviews"`
DiaryEntries int `json:"diaryEntries"`
DiaryEntriesThisYear int `json:"diaryEntriesThisYear"`
FilmsInDiaryThisYear int `json:"filmsInDiaryThisYear"`
FilmsInDiaryLastYear int `json:"filmsInDiaryLastYear"`
Watchlist int `json:"watchlist"`
Lists int `json:"lists"`
UnpublishedLists int `json:"unpublishedLists,omitempty"`
Followers int `json:"followers"`
Following int `json:"following"`
ListTags int `json:"listTags"`
FilmTags int `json:"filmTags"`
}
type MemberStatus ¶
type MemberStatus string
const ( MemberStatusCrew MemberStatus = "Crew" MemberStatusAlum MemberStatus = "Alum" MemberStatusHq MemberStatus = "Hq" MemberStatusPatron MemberStatus = "Patron" MemberStatusPro MemberStatus = "Pro" MemberStatusMember MemberStatus = "Member" )
type MemberSummary ¶
type MemberSummary struct {
Id string `json:"id"`
Username string `json:"username"`
GivenName string `json:"givenName,omitempty"`
FamilyName string `json:"familyName,omitempty"`
DisplayName string `json:"displayName"`
ShortName string `json:"shortName"`
Pronoun *Pronoun `json:"pronoun,omitempty"`
Avatar *Image `json:"avatar,omitempty"`
MemberStatus MemberStatus `json:"memberStatus"`
HideAdsInContent bool `json:"hideAdsInContent"`
AccountStatus AccountStatus `json:"accountStatus"`
}
type PrivacyPolicy ¶
type PrivacyPolicy string
const ( PrivacyPolicyAnyone PrivacyPolicy = "Anyone" PrivacyPolicyFriends PrivacyPolicy = "Friends" PrivacyPolicyYou PrivacyPolicy = "You" PrivacyPolicyDraft PrivacyPolicy = "Draft" )
type Pronoun ¶
type Pronoun struct {
Id string `json:"id"`
Label string `json:"label"`
SubjectPronoun string `json:"subjectPronoun"`
ObjectPronoun string `json:"objectPronoun"`
PossessiveAdjective string `json:"possessiveAdjective"`
PossessivePronoun string `json:"possessivePronoun"`
Reflexive string `json:"reflexive"`
}
type RatingsHistogramBar ¶
type ResponseError ¶
type ResponseError struct {
Err bool `json:"error,omitempty"`
Message string `json:"message,omitempty"`
Code string `json:"code,omitempty"`
}
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type SearchMethod ¶
type SearchMethod string
var ( SearchMethodFullText SearchMethod = "FullText" SearchMethodAutocomplete SearchMethod = "Autocomplete" SearchMethodNamesAndKeywords SearchMethod = "NamesAndKeywords" )
type SearchParams ¶
type SearchParams struct {
Ctx
Cursor string
PerPage int // default 20, max 100
Input string
SearchMethod SearchMethod
Include SearchResultType
ContributionType ContributionType
Adult bool
ExcludeMemberFilmRelationships bool
}
type SearchResponse ¶
type SearchResponse struct {
ResponseError
Next string `json:"next"`
Items []AbstractSearchItem `json:"items"`
ItemCount int `json:"itemCount"`
}
type SearchResultType ¶
type SearchResultType string
var ( SearchResultTypeContributorSearchItem SearchResultType = "ContributorSearchItem" SearchResultTypeFilmSearchItem SearchResultType = "FilmSearchItem" SearchResultTypeListSearchItem SearchResultType = "ListSearchItem" SearchResultTypeMemberSearchItem SearchResultType = "MemberSearchItem" SearchResultTypeReviewSearchItem SearchResultType = "ReviewSearchItem" SearchResultTypeTagSearchItem SearchResultType = "TagSearchItem" SearchResultTypeStorySearchItem SearchResultType = "StorySearchItem" SearchResultTypeArticleSearchItem SearchResultType = "ArticleSearchItem" SearchResultTypePodcastSearchItem SearchResultType = "PodcastSearchItem" )
Click to show internal directories.
Click to hide internal directories.