xrel

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2016 License: GPL-3.0 Imports: 9 Imported by: 1

README

xREL API Package

GoDoc

A golang package to authorize with and access the complete xrel.to API.

If you use the OAuth authentication make sure to save the Config variable somewhere and set it again on your next run. Here is an example 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

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

Constants

This section is empty.

Variables

View Source
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.

http://www.xrel.to/wiki/6312/api-comments-add.html

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.

http://www.xrel.to/wiki/6316/api-favs-list-addentry.html

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

func GetAuthdUser() (types.User, error)

GetAuthdUser returns information about the currently active user. Requires OAuth authentication.

http://www.xrel.to/wiki/1718/api-user-get-authd-user.html

func GetComments

func GetComments(id string, isP2P bool, perPage int, page int) (types.Comments, error)

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

http://www.xrel.to/wiki/6313/api-comments-get.html

func GetExtInfo

func GetExtInfo(id string) (types.ExtendedExtInfo, error)

GetExtInfo returns information about an ExtInfo.

http://www.xrel.to/wiki/2725/api-ext-info-info.html

func GetExtInfoMedia

func GetExtInfoMedia(id string) ([]types.ExtInfoMediaItem, error)

GetExtInfoMedia returns media associated with an Ext Info.

http://www.xrel.to/wiki/6314/api-ext-info-media.html

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.

http://www.xrel.to/wiki/1823/api-favs-list-entries.html

func GetFavsLists

func GetFavsLists() ([]types.FavList, error)

GetFavsLists returns a list of all the current user's favorite lists. Requires OAuth authentication.

http://www.xrel.to/wiki/1754/api-favs-lists.html

func GetLatestReleases

func GetLatestReleases(perPage, page int, filter, archive string) (types.Releases, error)

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.

http://www.xrel.to/wiki/2994/api-release-latest.html

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().

http://www.xrel.to/wiki/3698/api-p2p-categories.html

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.

http://www.xrel.to/wiki/3697/api-p2p-rls-info.html

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

http://www.xrel.to/wiki/3699/api-p2p-releases.html

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

func GetReleaseByExtInfoID(id string, perPage, page int) (types.Releases, error)

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).

http://www.xrel.to/wiki/2822/api-release-ext-info.html

func GetReleaseCategories

func GetReleaseCategories() ([]types.Category, error)

GetReleaseCategories returns a list of available release categories. You can use the category name in BrowseReleaseCategory().

http://www.xrel.to/wiki/6318/api-release-categories.html

func GetReleaseFilters

func GetReleaseFilters() ([]types.Filter, error)

GetReleaseFilters returns a list of public, predefined release filters. You can use the filter ID in GetLatestReleases().

http://www.xrel.to/wiki/2996/api-release-filters.html

func GetReleaseInfo

func GetReleaseInfo(query string, isID bool) (types.Release, error)

GetReleaseInfo returns information about a single release, specified by the complete dirname or an API release id.

http://www.xrel.to/wiki/1680/api-release-info.html

func GetUpcomingTitles

func GetUpcomingTitles() ([]types.UpcomingTitle, error)

GetUpcomingTitles returns a list upcoming movies and their releases.

http://www.xrel.to/wiki/1827/api-calendar-upcoming.html

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.

http://www.xrel.to/wiki/6315/api-ext-info-rate.html

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.

http://www.xrel.to/wiki/6317/api-favs-list-delentry.html

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.

http://www.xrel.to/wiki/6319/api-search-ext-info.html

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.

http://www.xrel.to/wiki/6320/api-search-releases.html

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.

Directories

Path Synopsis
Contains structs and constants for the xREL package, reflecting the xREL API JSON returns.
Contains structs and constants for the xREL package, reflecting the xREL API JSON returns.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL