Documentation ¶
Overview ¶
Package types contains structs and constants for the xREL package, reflecting the xREL API JSON returns.
Index ¶
- Constants
- Variables
- type AddProofResult
- type Author
- type Category
- type Comment
- type Comments
- type Edits
- type Error
- type ExtInfoExternal
- type ExtInfoExternalSource
- type ExtInfoMediaItem
- type ExtInfoReleaseDate
- type ExtInfoSearchResult
- type ExtendedExtInfo
- type FavList
- type FavListEntryModificationResult
- type Filter
- type Flags
- type Group
- type OAuth2Token
- type P2PCategory
- type P2PRelease
- type P2PReleases
- type Pagination
- type Rating
- type Release
- type ReleaseSearchResult
- type Releases
- type ShortExtInfo
- type ShortFavList
- type Size
- type UpcomingTitle
- type UpcomingTitleP2PRelease
- type UpcomingTitleRelease
- type User
- type Votes
Constants ¶
const ( TYPE_MOVIE = "movie" TYPE_TV = "tv" TYPE_GAME = "game" TYPE_CONSOLE = "console" TYPE_SOFTWARE = "software" TYPE_XXX = "xxx" // 2006-01-02 15:04:05.999999999 -0700 MST TIME_FORMAT_COMMENT = "02. Jan 2006, 03:04 pm" TIME_FORMAT_RELEASE = "02.01.2006 03:04 pm" )
const ( RELEASE_DATE_TYPE_R5 = "r5" RELEASE_DATE_TYPE_DE_CINE = "de-cine" RELEASE_DATE_TYPE_DE_RENTAL = "de-rental" RELEASE_DATE_TYPE_DE_RETAIL = "de-retail" RELEASE_DATE_TYPE_DE_HD = "de-hd" RELEASE_DATE_TYPE_DE_WEB = "de-web" RELEASE_DATE_TYPE_EN_CINE = "de-cine" RELEASE_DATE_TYPE_EN_RENTAL = "de-rental" RELEASE_DATE_TYPE_EN_RETAIL = "de-retail" RELEASE_DATE_TYPE_EN_HD = "de-hd" RELEASE_DATE_TYPE_EN_WEB = "de-web" )
const ( MEDIA_TYPE_IMAGE = "image" MEDIA_TYPE_VIDEO = "video" )
const ( P2P_RELEASE_MAIN_LANGUAGE_DE = "german" P2P_RELEASE_MAIN_LANGUAGE_EN = "english" )
const ERROR_TYPE_API = "api"
const ERROR_TYPE_CLIENT = "client"
const ERROR_TYPE_OAUTH = "oauth2"
Variables ¶
var Config = struct { OAuth2Token OAuth2Token // 24h caching http://www.xrel.to/wiki/6318/api-release-categories.html LastCategoryRequest int64 Categories []Category // 24h caching http://www.xrel.to/wiki/2996/api-release-filters.html LastFilterRequest int64 Filters []Filter // 24h caching http://www.xrel.to/wiki/3698/api-p2p-categories.html LastP2PCategoryRequest int64 P2PCategories []P2PCategory RateLimitMax int RateLimitRemaining int RateLimitResetUnix int64 }{}
Config contains the OAuth2 Token and cached results. Save this somewhere and restore it on every run.
The rate limit information gets set on any request.
Functions ¶
This section is empty.
Types ¶
type AddProofResult ¶
type Comment ¶
type Comments ¶
type Comments struct { TotalCount int `json:"total_count"` Pagination Pagination `json:"pagination"` List []Comment `json:"list"` }
type Edits ¶
func (*Edits) GetLastEditTime ¶
type Error ¶
type Error struct { Type string `json:"error_type"` Code string `json:"error"` Extra string Description string `json:"error_description"` }
Error is a struct which implements the normal `error` type, all methods may return this struct. Additional to the `Error()` function this struct contains some variables.
Errors with type `ERROR_TYPE_API` are xREL.to errors (https://www.xrel.to/wiki/6435/api-errors.html), for all other types and error codes see the `NewError` function.
To use this in your code try to cast it: err := xrel.SomeMethod()
if eErr, ok := err.(*types.Error); ok { // Is of type types.Error, you can use the variables } else {
// Is normal error }
type ExtInfoExternal ¶
type ExtInfoExternal struct { Source ExtInfoExternalSource `json:"source"` LinkURL string `json:"link_url"` Plot string `json:"plot"` }
type ExtInfoExternalSource ¶
type ExtInfoMediaItem ¶
type ExtInfoMediaItem struct { Type string `json:"type"` Description string `json:"description"` TimeUnix int64 `json:"time"` URLFull string `json:"url_full"` // IsImage() URLThumb string `json:"url_thumb"` YoutubeID string `json:"youtube_id"` // IsVideo() VideoURL string `json:"video_url"` // IsVideo() }
func (*ExtInfoMediaItem) GetTime ¶
func (extInfoMediaItem *ExtInfoMediaItem) GetTime() time.Time
type ExtInfoReleaseDate ¶
type ExtInfoSearchResult ¶
type ExtInfoSearchResult struct { Total int `json:"total"` Results []ShortExtInfo `json:"results"` }
type ExtendedExtInfo ¶
type ExtendedExtInfo struct { ID string `json:"id"` Type string `json:"type"` Title string `json:"title"` LinkURL string `json:"link_href"` Genre string `json:"genre"` AltTitle string `json:"alt_title"` CoverURL string `json:"cover_url"` URIs []string `json:"uris"` Rating float32 `json:"rating"` OwnRating int `json:"own_rating"` NumRatings int `json:"num_ratings"` ReleaseDates []ExtInfoReleaseDate `json:"release_dates"` Externals []ExtInfoExternal `json:"externals"` Releases []Release `json:"releases"` P2PReleases []P2PRelease `json:"p2p_releases"` }
type FavList ¶
type FavList struct { ID int `json:"id"` Name string `json:"name"` IsPublic bool `json:"public"` DoNotify bool `json:"notify"` DoAutoRead bool `json:"auto_read"` IncludesP2P bool `json:"include_p2p"` Description string `json:"description"` PasswordHash string `json:"passwort_hash"` EntryCount int `json:"entry_count"` UnreadReleases int `json:"unread_releases"` }
func (*FavList) TestPassword ¶
TestPassword tests if a password for a list is correct.
type FavListEntryModificationResult ¶
type FavListEntryModificationResult struct { FavList ShortFavList `json:"fav_list"` ExtInfo ShortExtInfo `json:"ext_info"` }
type Flags ¶
type OAuth2Token ¶
type P2PCategory ¶
type P2PRelease ¶
type P2PRelease struct { ID string `json:"id"` Dirname string `json:"dirname"` LinkURL string `json:"link_href"` MainLanguage string `json:"main_lang"` PubTimeUnix int64 `json:"pub_time"` PostTimeUnix int64 `json:"post_time"` SizeInMB int `json:"size_mb"` Group Group `json:"group"` NumRatings int `json:"num_ratings"` VideoRating float32 `json:"video_rating"` AudioRating float32 `json:"audio_rating"` ExtInfo ShortExtInfo `json:"ext_info"` TVSeason int `json:"tv_season"` TVEpisode int `json:"tv_episode"` Comments int `json:"comments"` }
func (*P2PRelease) GetPostTime ¶
func (p2pRelease *P2PRelease) GetPostTime() time.Time
func (*P2PRelease) GetPubTime ¶
func (p2pRelease *P2PRelease) GetPubTime() time.Time
type P2PReleases ¶
type P2PReleases struct { TotalCount int `json:"total_count"` Pagination Pagination `json:"pagination"` List []P2PRelease `json:"list"` }
type Pagination ¶
type Release ¶
type Release struct { ID string `json:"id"` Dirname string `json:"dirname"` LinkURL string `json:"link_href"` TimeUnix int64 `json:"time"` GroupName string `json:"group_name"` NukeReason string `json:"nuke_reason"` Size Size `json:"size"` VideoType string `json:"video_type"` AudioType string `json:"audio_type"` NumRatings int `json:"num_ratings"` VideoRating float32 `json:"video_rating"` AudioRating float32 `json:"audio_rating"` ExtInfo ShortExtInfo `json:"ext_info"` TVSeason int `json:"tv_season"` TVEpisode int `json:"tv_episode"` Comments int `json:"comments"` Flags Flags `json:"flags"` ProofURL string `json:"proof_url"` }
type ReleaseSearchResult ¶
type ReleaseSearchResult struct { Total int `json:"total"` SceneResults []Release `json:"results"` P2PResults []P2PRelease `json:"p2p_results"` }
type Releases ¶
type Releases struct { TotalCount int `json:"total_count"` Pagination Pagination `json:"pagination"` List []Release `json:"list"` }
type ShortExtInfo ¶
type ShortFavList ¶
type UpcomingTitle ¶
type UpcomingTitle struct { ID string `json:"id"` Type string `json:"type"` Title string `json:"title"` LinkHref string `json:"link_href"` Genre string `json:"genre"` AltTitle string `json:"alt_title"` CoverURL string `json:"cover_url"` Releases []UpcomingTitleRelease `json:"releases"` P2PReleases []UpcomingTitleP2PRelease `json:"p2p_releases"` }
type UpcomingTitleP2PRelease ¶
type UpcomingTitleP2PRelease struct { ID string `json:"id"` Dirname string `json:"dirname"` LinkURL string `json:"link_href"` PubTimeUnix int64 `json:"pub_time"` }
func (*UpcomingTitleP2PRelease) GetPubTime ¶
func (upcomingTitleP2PRelease *UpcomingTitleP2PRelease) GetPubTime() time.Time
type UpcomingTitleRelease ¶
type UpcomingTitleRelease struct { ID string `json:"id"` Dirname string `json:"dirname"` LinkURL string `json:"link_href"` TimeUnix int64 `json:"time"` Flags Flags `json:"flags"` }
func (*UpcomingTitleRelease) GetTime ¶
func (upcomingTitleRelease *UpcomingTitleRelease) GetTime() time.Time