Back to godoc.org

Package apiController

v1.0.1
Latest Go to latest

The latest major version is .

Published: Jul 22, 2017 | License: MIT | Module: github.com/NyaaPantsu/nyaa

Index

func APICheckTokenHandler

func APICheckTokenHandler(c *gin.Context)

APICheckTokenHandler : Check Token with API

func APIHandler

func APIHandler(c *gin.Context)

*

* @api {get} / Request Torrents index
* @apiVersion 1.1.1
* @apiName GetTorrents
* @apiGroup Torrents
*
* @apiParam {Number} id Torrent unique ID.
*
* @apiSuccess {Object[]} torrents List of torrent object (see view for the properties).
* @apiSuccess {Number} queryRecordCount Number of torrents given.
* @apiSuccess {Number} totalRecordCount Total number of torrents.
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*     {
*			"torrents": [...],
*			"queryRecordCount": 50,
*			"totalRecordCount": 798414
*		}
*
* @apiUse NotFoundError

APIHandler : Controller for api request on torrent list

func APILoginHandler

func APILoginHandler(c *gin.Context)

*

* @api {post} /login/ Login a user
* @apiVersion 1.1.1
* @apiName Login
* @apiGroup Users
*
* @apiParam {String} username Username or Email.
* @apiParam {String} password Password.
*
* @apiSuccess {Boolean} ok The request is done without failing
* @apiSuccess {String[]} infos Messages information relative to the request
* @apiSuccess {Object} data The connected user object
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
* 		{
* 			data:
*       		[{
* 					user_id:1,
*					username:"username",
*					status:1,
*					token:"token",
*					md5:"",
*					created_at:"date",
*					liking_count:0,
*					liked_count:0
*				}],
*			infos: ["Logged", ... ],
*			ok:true
* 		}
*
* @apiUse RequestError

APILoginHandler : Login with API This is not an OAuth api like and shouldn't be used for anything except getting the API Token in order to not store a password

func APIProfileHandler

func APIProfileHandler(c *gin.Context)

*

* @api {post} /profile/ Get a user profile
* @apiVersion 1.1.1
* @apiName Profile
* @apiGroup Users
*
* @apiParam {Number} id User ID.
*
* @apiSuccess {Boolean} ok The request is done without failing
* @apiSuccess {String[]} infos Messages information relative to the request
* @apiSuccess {Object} data The user object
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
* 		{
* 			data:
*       		[{
* 					user_id:1,
*					username:"username",
*					status:1,
*					md5:"",
*					created_at:"date",
*					liking_count:0,
*					liked_count:0
*				}],
*			infos: ["Logged", ... ],
*			ok:true
* 		}
*
* @apiUse RequestError

APIProfileHandler : Get a public profile with API

func APIRefreshTokenHandler

func APIRefreshTokenHandler(c *gin.Context)

APIRefreshTokenHandler : Refresh Token with API

func APISearchHandler

func APISearchHandler(c *gin.Context)

*

* @api {get} /search/ Search Torrents
* @apiVersion 1.1.1
* @apiName FindTorrents
* @apiGroup Torrents
*
* @apiParam {String[]} c In which categories to search.
* @apiParam {String} q Query to search (torrent name).
* @apiParam {Number} page Page of the search results.
* @apiParam {String} limit Number of results per page.
* @apiParam {String} userID Uploader ID owning the torrents.
* @apiParam {String} fromID Show results with torrents ID superior to this.
* @apiParam {String} s Torrent status.
* @apiParam {String} maxage Torrents which have been uploaded the last x days.
* @apiParam {String} toDate Torrents which have been uploaded since x <code>dateType</code>.
* @apiParam {String} fromDate Torrents which have been uploaded the last x <code>dateType</code>.
* @apiParam {String} dateType Which type of date (<code>d</code> for days, <code>m</code> for months, <code>y</code> for years).
* @apiParam {String} minSize Filter by minimal size in <code>sizeType</code>.
* @apiParam {String} maxSize Filter by maximal size in <code>sizeType</code>.
* @apiParam {String} sizeType Which type of size (<code>b</code> for bytes, <code>k</code> for kilobytes, <code>m</code> for megabytes, <code>g</code> for gigabytes).
* @apiParam {String} sort Torrent sorting type (0 = id, 1 = name, 2 = date, 3 = downloads, 4 = size, 5 = seeders, 6 = leechers, 7 = completed).
* @apiParam {Boolean} order Order ascending or descending (true = ascending).
* @apiParam {String[]} lang Filter the languages.
* @apiParam {Number} page Search page.
*
* @apiSuccess {Object[]} torrents List of torrent object (see view for the properties).
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*     {
*			"torrents": [...],
*			"queryRecordCount": 50,
*			"totalRecordCount": 798414
*		}
*
* @apiUse NotFoundError

APISearchHandler : Controller for searching with api

func APIUpdateHandler

func APIUpdateHandler(c *gin.Context)

*

* @api {post} /update/ Update a Torrent
* @apiVersion 1.1.1
* @apiName UpdateTorrent
* @apiGroup Torrents
*
* @apiParam {String} username Torrent uploader name.
* @apiParam {Number} id Torrent ID.
* @apiParam {String} name Torrent name.
* @apiParam {String} category Torrent category.
* @apiParam {Boolean} remake Torrent is a remake.
* @apiParam {String} description Torrent description.
* @apiParam {Number} status Torrent status.
* @apiParam {Boolean} hidden Torrent hidden.
* @apiParam {String} website_link Torrent website link.
* @apiParam {String[]} languages Torrent languages.
*
* @apiSuccess {Boolean} ok The request is done without failing
* @apiSuccess {String[]} infos Messages information relative to the request
* @apiSuccess {Object} data The resulting torrent updated (see view for the properties)
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*
* @apiUse RequestError

APIUpdateHandler : Controller for updating a torrent with api

func APIUploadHandler

func APIUploadHandler(c *gin.Context)

*

* @api {post} /upload Upload a Torrent
* @apiVersion 1.1.1
* @apiName UploadTorrent
* @apiGroup Torrents
*
* @apiParam {String} username Torrent uploader name.
* @apiParam {String} name Torrent name.
* @apiParam {String} magnet Torrent magnet URI.
* @apiParam {String} category Torrent category.
* @apiParam {Boolean} remake Torrent is a remake.
* @apiParam {String} description Torrent description.
* @apiParam {Number} status Torrent status.
* @apiParam {Boolean} hidden Torrent hidden.
* @apiParam {String} website_link Torrent website link.
* @apiParam {String[]} languages Torrent languages.
* @apiParam {File} torrent Torrent file to upload (you have to send a torrent file or a magnet, not both!).
*
* @apiSuccess {Boolean} ok The request is done without failing
* @apiSuccess {String[]} infos Messages information relative to the request
* @apiSuccess {Object} data The resulting torrent uploaded (see view for the properties)
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*
* @apiUse RequestError

APIUploadHandler : Controller for uploading a torrent with api

func APIViewHandler

func APIViewHandler(c *gin.Context)

*

* @api {get} /view/:id Request Torrent information
* @apiVersion 1.1.1
* @apiName GetTorrent
* @apiGroup Torrents
*
* @apiParam {Number} id Torrent unique ID.
*
* @apiSuccess {Number} id ID of the torrent.
* @apiSuccess {String} name Name of the torrent.
* @apiSuccess {Number} status Status of the torrent.
* @apiSuccess {String} hash Hash of the torrent.
* @apiSuccess {Date} date Uploaded date of the torrent.
* @apiSuccess {Number} filesize File size in Bytes of the torrent.
* @apiSuccess {String} description Description of the torrent.
* @apiSuccess {Object[]} comments Comments of the torrent.
* @apiSuccess {String} sub_category Sub Category of the torrent.
* @apiSuccess {String} category Category of the torrent.
* @apiSuccess {String} anidb_id Anidb ID of the torrent.
* @apiSuccess {Number} uploader_id ID of the torrent uploader.
* @apiSuccess {String} uploader_name  Username of the torrent uploader.
* @apiSuccess {String} uploader_old  Old username from nyaa of the torrent uploader.
* @apiSuccess {String} website_link  External Link of the torrent.
* @apiSuccess {String[]} languages  Languages of the torrent.
* @apiSuccess {String} magnet  Magnet URI of the torrent.
* @apiSuccess {String} torrent  Download URL of the torrent.
* @apiSuccess {Number} seeders  Number of seeders of the torrent.
* @apiSuccess {Number} leechers  Number of leechers of the torrent.
* @apiSuccess {Number} completed  Downloads completed of the torrent.
* @apiSuccess {Date} last_scrape  Last statistics update of the torrent.
* @apiSuccess {Object[]} file_list  List of files in the torrent.
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*	{
*	"id": 952801,
*	"name": "[HorribleSubs] Uchouten Kazoku S2 [720p]",
*	"status": 1,
*	"hash": "6E4D96F7A0B0456672E80B150CCB7C15868CD47D",
*	"date": "2017-07-05T11:01:39Z",
*	"filesize": 4056160259,
*	"description": "<p>Unofficial batch</p>\n",
*	"comments": [],
*	"sub_category": "5",
*	"category": "3",
*	"anidb_id": "",
*	"downloads": 0,
*	"uploader_id": 7177,
*	"uploader_name": "DarAR92",
*	"uploader_old": "",
*	"website_link": "http://horriblesubs.info/",
*	"languages": [
*	"en-us"
*	],
*	"magnet": "magnet:?xt=urn:btih:6E4D96F7A0B0456672E80B150CCB7C15868CD47D&dn=%5BHorribleSubs%5D+Uchouten+Kazoku+S2+%5B720p%5D&tr=http://nyaa.tracker.wf:7777/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://tracker.doko.moe:6969&tr=http://tracker.anirena.com:80/announce&tr=http://anidex.moe:6969/announce&tr=udp://tracker.opentrackr.org:1337&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://zer0day.ch:1337&tr=udp://9.rarbg.com:2710/announce&tr=udp://tracker2.christianbro.pw:6969/announce&tr=udp://tracker.coppersurfer.tk:6969&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://eddie4.nl:6969/announce&tr=udp://tracker.doko.moe:6969/announce",
*	"torrent": "https://nyaa.pantsu.cat/download/6E4D96F7A0B0456672E80B150CCB7C15868CD47D",
*	"seeders": 4,
*	"leechers": 2,
*	"completed": 28,
*	"last_scrape": "2017-07-07T07:48:32.509635Z",
*	"file_list": [
*	{
*	"path": "[HorribleSubs] Uchouten Kazoku S2 - 01[720p].mkv",
*	"filesize": 338250895
*	},
*	{
*	"path": "[HorribleSubs] Uchouten Kazoku S2 - 12 [720p].mkv",
*	"filesize": 338556275
*	}
*	]
*	}
*
* @apiUse NotFoundError

APIViewHandler : Controller for viewing a torrent by its ID

func APIViewHeadHandler

func APIViewHeadHandler(c *gin.Context)

*

* @api {get} /head/:id Request Torrent Head
* @apiVersion 1.1.1
* @apiName GetTorrentHead
* @apiGroup Torrents
*
* @apiParam {Number} id Torrent unique ID.
*
* @apiSuccessExample Success-Response:
*     HTTP/1.1 200 OK
*
* @apiUse NotFoundError

APIViewHeadHandler : Controller for checking a torrent by its ID

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier