apiController

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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)

*

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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