Documentation ¶
Overview ¶
Package xrel contains functions to authorize with and access the complete xREL.to API.
Here is an example on how to use the OAuth authentication:
xREL.SetOAuthConsumerKeyAndSecret("CONSUMER_KEY", "CONSUMER_SECRET") requestToken, url, err := xREL.GetOAuthRequestTokenAndUrl() ok(err) // get verificationCode from the provided URL accessToken, err := xREL.GetOAuthAccessToken(requestToken, verificationCode) ok(err) xREL.Config.OAuthAccessToken = *accessToken
Index ¶
- Variables
- func AddComment(id string, isP2P bool, text string, videoRating, audioRating int) (types.Comment, error)
- func AddFavsListEntry(id, extInfoID string) (types.FavListEntryModificationResult, error)
- func BrowseReleaseCategory(categoryName, extInfoType string, perPage, page int) (types.Releases, error)
- func GetAuthdUser() (types.User, error)
- func GetComments(id string, isP2P bool, perPage int, page int) (types.Comments, error)
- func GetExtInfo(id string) (types.ExtendedExtInfo, error)
- func GetExtInfoMedia(id string) ([]types.ExtInfoMediaItem, error)
- func GetFavsListEntries(id string, getReleases bool) ([]types.ExtendedExtInfo, error)
- func GetFavsLists() ([]types.FavList, error)
- func GetLatestReleases(perPage, page int, filter, archive string) (types.Releases, error)
- func GetOAuthAccessToken(requestToken *oauth.RequestToken, verificationCode string) (*oauth.AccessToken, error)
- func GetOAuthRequestTokenAndURL() (*oauth.RequestToken, string, error)
- func GetP2PCategories() ([]types.P2PCategory, error)
- func GetP2PReleaseInfo(query string, isID bool) (types.P2PRelease, error)
- func GetP2PReleases(perPage, page int, categoryID, groupID, extInfoID string) (types.P2PReleases, error)
- func GetRateLimitStatus() (types.RateLimitStatus, error)
- func GetReleaseByExtInfoID(id string, perPage, page int) (types.Releases, error)
- func GetReleaseCategories() ([]types.Category, error)
- func GetReleaseFilters() ([]types.Filter, error)
- func GetReleaseInfo(query string, isID bool) (types.Release, error)
- func GetUpcomingTitles() ([]types.UpcomingTitle, error)
- func RateExtInfo(id string, rating int) (types.ExtendedExtInfo, error)
- func RemoveFavsListEntry(id, extInfoID string) (types.FavListEntryModificationResult, error)
- func SearchExtInfos(query, extInfoType string, limit int) (types.ExtInfoSearchResult, error)
- func SearchReleases(query string, includeScene, includeP2P bool, limit int) (types.ReleaseSearchResult, error)
- func SetOAuthConsumerKeyAndSecret(key, secret string)
Constants ¶
This section is empty.
Variables ¶
var Config = struct { OAuthAccessToken oauth.AccessToken // 24h caching http://www.xrel.to/wiki/6318/api-release-categories.html LastCategoryRequest int64 Categories []types.Category // 24h caching http://www.xrel.to/wiki/2996/api-release-filters.html LastFilterRequest int64 Filters []types.Filter // 24h caching http://www.xrel.to/wiki/3698/api-p2p-categories.html LastP2PCategoryRequest int64 P2PCategories []types.P2PCategory }{}
Config contains the OAuth Token and cached results. Save this somewhere and restore it on every run.
Functions ¶
func AddComment ¶
func AddComment(id string, isP2P bool, text string, videoRating, audioRating int) (types.Comment, error)
AddComment adds a comment to a given API release id or API P2P release id.
id API release id or API P2P release id. isP2P If the provided id is a P2P release id. text := "" The comment. You may use BBCode to format the text. Can be empty if both video_rating and audio_rating are set. videoRating := 0 audioRating := 0 Video and audio rating between 1 (bad) to 10 (good). 0 means no rating. You must always rate both or none. You may only vote once, and may not change your vote.
func AddFavsListEntry ¶
func AddFavsListEntry(id, extInfoID string) (types.FavListEntryModificationResult, error)
AddFavsListEntry adds an ExtInfo to a favorite list. Requires OAuth authentication.
id The favorite list ID, as obtained through GetFavsLists(). extInfoID The Ext Info ID, as obtained through other API calls.
func BrowseReleaseCategory ¶
func BrowseReleaseCategory(categoryName, extInfoType string, perPage, page int) (types.Releases, error)
BrowseReleaseCategory returns scene releases from the given category.
categoryName Category name from GetReleaseCategories() extInfoType := "" Use one of: movie|tv|game|console|software|xxx - or leave empty to browse releases of all types
http://www.xrel.to/wiki/3751/api-release-browse-category.html
func GetAuthdUser ¶
GetAuthdUser returns information about the currently active user. Requires OAuth authentication.
func GetComments ¶
GetComments returns comments for a given API release id or API P2P release id. Only the id is required.
isP2P := false perPage := 25 // min. 5, max 100 page := 1
func GetExtInfo ¶
func GetExtInfo(id string) (types.ExtendedExtInfo, error)
GetExtInfo returns information about an ExtInfo.
func GetExtInfoMedia ¶
func GetExtInfoMedia(id string) ([]types.ExtInfoMediaItem, error)
GetExtInfoMedia returns media associated with an Ext Info.
func GetFavsListEntries ¶
func GetFavsListEntries(id string, getReleases bool) ([]types.ExtendedExtInfo, error)
GetFavsListEntries returns entries of a favorite list. Requires OAuth authentication.
id The favorite list ID, as obtained through GetFavsLists(). getReleases := false If true, an inline list of unread(!) releases will be returned with each ext_info entry.
func GetFavsLists ¶
GetFavsLists returns a list of all the current user's favorite lists. Requires OAuth authentication.
func GetLatestReleases ¶
GetLatestReleases returns the latest releases. Also allows to browse the archive by month.
perPage := 25 Number of releases per page. Min. 5, max. 100. page := 1 Page number (1 to N). filter := "" Filter ID (from GetReleaseFilters()) or "overview" to use the currently logged in user's overview filter. archive := "" Empty = current releases, YYYY-MM for archive.
func GetOAuthAccessToken ¶
func GetOAuthAccessToken(requestToken *oauth.RequestToken, verificationCode string) (*oauth.AccessToken, error)
GetOAuthAccessToken returns the access token to use in authenticated requests using the request token and verification code from GetOAuthRequestTokenAndUrl(). Save this in xREL.Config.OAuthAccessToken.
func GetOAuthRequestTokenAndURL ¶
func GetOAuthRequestTokenAndURL() (*oauth.RequestToken, string, error)
GetOAuthRequestTokenAndURL returns a new request token and an URL where the user can login and get a verification code from.
func GetP2PCategories ¶
func GetP2PCategories() ([]types.P2PCategory, error)
GetP2PCategories returns a list of available P2P release categories and their IDs. You can use the category ID in GetP2PReleases().
func GetP2PReleaseInfo ¶
func GetP2PReleaseInfo(query string, isID bool) (types.P2PRelease, error)
GetP2PReleaseInfo returns information about a single release, specified by the complete dirname or an API release id.
func GetP2PReleases ¶
func GetP2PReleases(perPage, page int, categoryID, groupID, extInfoID string) (types.P2PReleases, error)
GetP2PReleases allows to browse P2P/non-scene releases.
perPage := 25 Number of releases per page. Min. 5, max. 100. page := 1 Page number (1 to N). Set only one of the following: categoryID := "" P2P category ID from GetP2PCategories() groupID := "" P2P release group ID extInfoID := "" Ext Info ID
func GetRateLimitStatus ¶
func GetRateLimitStatus() (types.RateLimitStatus, error)
GetRateLimitStatus shows how many calls the user (if an OAuth session is present) or the IP address (otherwise) has left before none will be answered.
http://www.xrel.to/wiki/1795/api-user-rate-limit-status.html
func GetReleaseByExtInfoID ¶
GetReleaseByExtInfoID returns all releases associated with a given ExtInfo.
id ExtInfoID. perPage := 25 Number of releases per page. Min. 5, max. 100. page := 1 Page number (1 to N).
func GetReleaseCategories ¶
GetReleaseCategories returns a list of available release categories. You can use the category name in BrowseReleaseCategory().
func GetReleaseFilters ¶
GetReleaseFilters returns a list of public, predefined release filters. You can use the filter ID in GetLatestReleases().
func GetReleaseInfo ¶
GetReleaseInfo returns information about a single release, specified by the complete dirname or an API release id.
func GetUpcomingTitles ¶
func GetUpcomingTitles() ([]types.UpcomingTitle, error)
GetUpcomingTitles returns a list upcoming movies and their releases.
func RateExtInfo ¶
func RateExtInfo(id string, rating int) (types.ExtendedExtInfo, error)
RateExtInfo rates an ExtInfo. Requires OAuth authentication.
id Ext Info ID. rating Rating between 1 (bad) to 10 (good). You may only vote once, and may not change your vote.
func RemoveFavsListEntry ¶
func RemoveFavsListEntry(id, extInfoID string) (types.FavListEntryModificationResult, error)
RemoveFavsListEntry removes an ExtInfo from a favorite list. Requires OAuth authentication.
id The favorite list ID, as obtained through GetFavsLists(). extInfoID The ExtInfo ID, as obtained through other API calls.
func SearchExtInfos ¶
func SearchExtInfos(query, extInfoType string, limit int) (types.ExtInfoSearchResult, error)
SearchExtInfos searches for ExtInfos. Please note that additional search rate limiting applies. See http://www.xrel.to/wiki/2727/api-rate-limiting.html
query Search keyword. extInfoType := "" One of: movie|tv|game|console|software|xxx - or leave empty to search Ext Infos of all types. limit := 25 Number of returned search results. Maximum and default 25.
func SearchReleases ¶
func SearchReleases(query string, includeScene, includeP2P bool, limit int) (types.ReleaseSearchResult, error)
SearchReleases searches for Scene and P2P releases. Please note that additional search rate limiting applies. See http://www.xrel.to/wiki/2727/api-rate-limiting.html
query Search keyword. (required) includeScene := false If true, Scene releases will be included in the search results. includeP2P := false If true, P2P releases will be included in the search results. limit := 25 Number of returned search results. Maximum and default 25.
func SetOAuthConsumerKeyAndSecret ¶
func SetOAuthConsumerKeyAndSecret(key, secret string)
SetOAuthConsumerKeyAndSecret sets the OAuth consumer key and secret you received from xREL. Get them here: http://www.xrel.to/api-apps.html
Types ¶
This section is empty.