diff --git a/apidoc/api_data.js b/apidoc/api_data.js index 880887fd..616ab6b2 100644 --- a/apidoc/api_data.js +++ b/apidoc/api_data.js @@ -1,1130 +1,1293 @@ -define({ - "api": [{ - "type": "get", - "url": "/search/", - "title": "Search Torrents", - "version": "1.1.1", - "name": "FindTorrents", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "c", - "description": "

In which categories to search.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "q", - "description": "

Query to search (torrent name).

" - }, - { - "group": "Parameter", - "type": "Number", - "optional": false, - "field": "page", - "description": "

Page of the search results.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "limit", - "description": "

Number of results per page.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "userID", - "description": "

Uploader ID owning the torrents.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "fromID", - "description": "

Show results with torrents ID superior to this.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "s", - "description": "

Torrent status.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "maxage", - "description": "

Torrents which have been uploaded the last x days.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "toDate", - "description": "

Torrents which have been uploaded since x dateType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "fromDate", - "description": "

Torrents which have been uploaded the last x dateType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "dateType", - "description": "

Which type of date (d for days, m for months, y for years).

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "minSize", - "description": "

Filter by minimal size in sizeType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "maxSize", - "description": "

Filter by maximal size in sizeType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "sizeType", - "description": "

Which type of size (b for bytes, k for kilobytes, m for megabytes, g for gigabytes).

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "sort", - "description": "

Torrent sorting type (0 = id, 1 = name, 2 = date, 3 = downloads, 4 = size, 5 = seeders, 6 = leechers, 7 = completed).

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "order", - "description": "

Order ascending or descending (true = ascending).

" - }, - { - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "lang", - "description": "

Filter the languages.

" - } - ] - } - }, - "success": { - "fields": { - "Success 200": [{ +define({ "api": [ + { + "type": "get", + "url": "/search/", + "title": "Search Torrents", + "version": "1.1.1", + "name": "FindTorrents", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "c", + "description": "

In which categories to search.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "q", + "description": "

Query to search (torrent name).

" + }, + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "page", + "description": "

Page of the search results.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "limit", + "description": "

Number of results per page.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "userID", + "description": "

Uploader ID owning the torrents.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "fromID", + "description": "

Show results with torrents ID superior to this.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "s", + "description": "

Torrent status.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "maxage", + "description": "

Torrents which have been uploaded the last x days.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "toDate", + "description": "

Torrents which have been uploaded since x dateType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "fromDate", + "description": "

Torrents which have been uploaded the last x dateType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "dateType", + "description": "

Which type of date (d for days, m for months, y for years).

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "minSize", + "description": "

Filter by minimal size in sizeType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "maxSize", + "description": "

Filter by maximal size in sizeType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "sizeType", + "description": "

Which type of size (b for bytes, k for kilobytes, m for megabytes, g for gigabytes).

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "sort", + "description": "

Torrent sorting type (0 = id, 1 = name, 2 = date, 3 = downloads, 4 = size, 5 = seeders, 6 = leechers, 7 = completed).

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "order", + "description": "

Order ascending or descending (true = ascending).

" + }, + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "lang", + "description": "

Filter the languages.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { "group": "Success 200", "type": "Object[]", "optional": false, "field": "torrents", "description": "

List of torrent object (see view for the properties).

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}", "type": "json" - }] - }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { "group": "Error 4xx", "type": "String[]", "optional": false, "field": "errors", "description": "

List of errors messages with a 404 error message in it.

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Error-Response:", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "type": "json" - }] + } + ] + } + }, + { + "type": "get", + "url": "/search/", + "title": "Search Torrents", + "version": "1.0.0", + "name": "FindTorrents", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "c", + "description": "

In which categories to search.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "q", + "description": "

Query to search (torrent name).

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "limit", + "description": "

Number of results per page.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "userID", + "description": "

Uploader ID owning the torrents.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "fromID", + "description": "

Show results with torrents ID superior to this.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "s", + "description": "

Torrent status.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "maxage", + "description": "

Torrents which have been uploaded the last x days.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "toDate", + "description": "

Torrents which have been uploaded since x dateType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "fromDate", + "description": "

Torrents which have been uploaded the last x dateType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "dateType", + "description": "

Which type of date (d for days, m for months, y for years).

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "minSize", + "description": "

Filter by minimal size in sizeType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "maxSize", + "description": "

Filter by maximal size in sizeType.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "sizeType", + "description": "

Which type of size (b for bytes, k for kilobytes, m for megabytes, g for gigabytes).

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "sort", + "description": "

Torrent sorting type (0 = id, 1 = name, 2 = date, 3 = downloads, 4 = size, 5 = seeders, 6 = leechers, 7 = completed).

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "order", + "description": "

Order ascending or descending (true = ascending).

" + }, + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "lang", + "description": "

Filter the languages.

" + }, + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "page", + "description": "

Search page.

" + } + ] } }, - { - "type": "get", - "url": "/search/", - "title": "Search Torrents", - "version": "1.0.0", - "name": "FindTorrents", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "c", - "description": "

In which categories to search.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "q", - "description": "

Query to search (torrent name).

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "limit", - "description": "

Number of results per page.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "userID", - "description": "

Uploader ID owning the torrents.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "fromID", - "description": "

Show results with torrents ID superior to this.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "s", - "description": "

Torrent status.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "maxage", - "description": "

Torrents which have been uploaded the last x days.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "toDate", - "description": "

Torrents which have been uploaded since x dateType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "fromDate", - "description": "

Torrents which have been uploaded the last x dateType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "dateType", - "description": "

Which type of date (d for days, m for months, y for years).

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "minSize", - "description": "

Filter by minimal size in sizeType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "maxSize", - "description": "

Filter by maximal size in sizeType.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "sizeType", - "description": "

Which type of size (b for bytes, k for kilobytes, m for megabytes, g for gigabytes).

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "sort", - "description": "

Torrent sorting type (0 = id, 1 = name, 2 = date, 3 = downloads, 4 = size, 5 = seeders, 6 = leechers, 7 = completed).

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "order", - "description": "

Order ascending or descending (true = ascending).

" - }, - { - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "lang", - "description": "

Filter the languages.

" - }, - { - "group": "Parameter", - "type": "Number", - "optional": false, - "field": "page", - "description": "

Search page.

" - } - ] - } - }, - "success": { - "fields": { - "Success 200": [{ + "success": { + "fields": { + "Success 200": [ + { "group": "Success 200", "type": "Object[]", "optional": false, "field": "torrents", "description": "

List of torrent object (see view for the properties).

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n {\n\t\t\t[...]\n\t\t}", "type": "json" - }] - }, - "filename": "controllers/api/_apidoc.js", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ + } + ] + }, + "filename": "controllers/api/_apidoc.js", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { "group": "Error 4xx", "type": "String[]", "optional": false, "field": "errors", "description": "

List of errors messages with a 404 error message in it.

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Error-Response:", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "type": "json" - }] - } - }, - { - "type": "get", - "url": "/view/:id", - "title": "Request Torrent information", - "version": "1.1.1", - "name": "GetTorrent", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ + } + ] + } + }, + { + "type": "get", + "url": "/view/:id", + "title": "Request Torrent information", + "version": "1.1.1", + "name": "GetTorrent", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { "group": "Parameter", "type": "Number", "optional": false, "field": "id", "description": "

Torrent unique ID.

" - }] - } + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "id", + "description": "

ID of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "name", + "description": "

Name of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "status", + "description": "

Status of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "hash", + "description": "

Hash of the torrent.

" + }, + { + "group": "Success 200", + "type": "Date", + "optional": false, + "field": "date", + "description": "

Uploaded date of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "filesize", + "description": "

File size in Bytes of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "description", + "description": "

Description of the torrent.

" + }, + { + "group": "Success 200", + "type": "Object[]", + "optional": false, + "field": "comments", + "description": "

Comments of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "sub_category", + "description": "

Sub Category of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "category", + "description": "

Category of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "anidb_id", + "description": "

Anidb ID of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "uploader_id", + "description": "

ID of the torrent uploader.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "uploader_name", + "description": "

Username of the torrent uploader.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "uploader_old", + "description": "

Old username from nyaa of the torrent uploader.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "website_link", + "description": "

External Link of the torrent.

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "languages", + "description": "

Languages of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "magnet", + "description": "

Magnet URI of the torrent.

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "torrent", + "description": "

Download URL of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "seeders", + "description": "

Number of seeders of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "leechers", + "description": "

Number of leechers of the torrent.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "completed", + "description": "

Downloads completed of the torrent.

" + }, + { + "group": "Success 200", + "type": "Date", + "optional": false, + "field": "last_scrape", + "description": "

Last statistics update of the torrent.

" + }, + { + "group": "Success 200", + "type": "Object[]", + "optional": false, + "field": "file_list", + "description": "

List of files in the torrent.

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "id", - "description": "

ID of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "name", - "description": "

Name of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "status", - "description": "

Status of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "hash", - "description": "

Hash of the torrent.

" - }, - { - "group": "Success 200", - "type": "Date", - "optional": false, - "field": "date", - "description": "

Uploaded date of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "filesize", - "description": "

File size in Bytes of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "description", - "description": "

Description of the torrent.

" - }, - { - "group": "Success 200", - "type": "Object[]", - "optional": false, - "field": "comments", - "description": "

Comments of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "sub_category", - "description": "

Sub Category of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "category", - "description": "

Category of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "anidb_id", - "description": "

Anidb ID of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "uploader_id", - "description": "

ID of the torrent uploader.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "uploader_name", - "description": "

Username of the torrent uploader.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "uploader_old", - "description": "

Old username from nyaa of the torrent uploader.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "website_link", - "description": "

External Link of the torrent.

" - }, - { - "group": "Success 200", - "type": "String[]", - "optional": false, - "field": "languages", - "description": "

Languages of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "magnet", - "description": "

Magnet URI of the torrent.

" - }, - { - "group": "Success 200", - "type": "String", - "optional": false, - "field": "torrent", - "description": "

Download URL of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "seeders", - "description": "

Number of seeders of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "leechers", - "description": "

Number of leechers of the torrent.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "completed", - "description": "

Downloads completed of the torrent.

" - }, - { - "group": "Success 200", - "type": "Date", - "optional": false, - "field": "last_scrape", - "description": "

Last statistics update of the torrent.

" - }, - { - "group": "Success 200", - "type": "Object[]", - "optional": false, - "field": "file_list", - "description": "

List of files in the torrent.

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n\t{\n\t\"id\": 952801,\n\t\"name\": \"[HorribleSubs] Uchouten Kazoku S2 [720p]\",\n\t\"status\": 1,\n\t\"hash\": \"6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"date\": \"2017-07-05T11:01:39Z\",\n\t\"filesize\": 4056160259,\n\t\"description\": \"

Unofficial batch

\\n\",\n\t\"comments\": [],\n\t\"sub_category\": \"5\",\n\t\"category\": \"3\",\n\t\"anidb_id\": \"\",\n\t\"downloads\": 0,\n\t\"uploader_id\": 7177,\n\t\"uploader_name\": \"DarAR92\",\n\t\"uploader_old\": \"\",\n\t\"website_link\": \"http://horriblesubs.info/\",\n\t\"languages\": [\n\t\"en-us\"\n\t],\n\t\"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\",\n\t\"torrent\": \"https://nyaa.pantsu.cat/download/6E4D96F7A0B0456672E80B150CCB7C15868CD47D\",\n\t\"seeders\": 4,\n\t\"leechers\": 2,\n\t\"completed\": 28,\n\t\"last_scrape\": \"2017-07-07T07:48:32.509635Z\",\n\t\"file_list\": [\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 01[720p].mkv\",\n\t\"filesize\": 338250895\n\t},\n\t{\n\t\"path\": \"[HorribleSubs] Uchouten Kazoku S2 - 12 [720p].mkv\",\n\t\"filesize\": 338556275\n\t}\n\t]\n\t}", "type": "json" - }] - }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { "group": "Error 4xx", "type": "String[]", "optional": false, "field": "errors", "description": "

List of errors messages with a 404 error message in it.

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Error-Response:", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "type": "json" - }] - } - }, - { - "type": "get", - "url": "/head/:id", - "title": "Request Torrent Head", - "version": "1.1.1", - "name": "GetTorrentHead", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ + } + ] + } + }, + { + "type": "get", + "url": "/head/:id", + "title": "Request Torrent Head", + "version": "1.1.1", + "name": "GetTorrentHead", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { "group": "Parameter", "type": "Number", "optional": false, "field": "id", "description": "

Torrent unique ID.

" - }] - } - }, - "success": { - "examples": [{ + } + ] + } + }, + "success": { + "examples": [ + { "title": "Success-Response:", "content": "HTTP/1.1 200 OK", "type": "json" - }] - }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { "group": "Error 4xx", "type": "String[]", "optional": false, "field": "errors", "description": "

List of errors messages with a 404 error message in it.

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Error-Response:", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "type": "json" - }] - } - }, - { - "type": "get", - "url": "/", - "title": "Request Torrents index", - "version": "1.1.1", - "name": "GetTorrents", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ + } + ] + } + }, + { + "type": "get", + "url": "/", + "title": "Request Torrents index", + "version": "1.1.1", + "name": "GetTorrents", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { "group": "Parameter", "type": "Number", "optional": false, "field": "id", "description": "

Torrent unique ID.

" - }] - } + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object[]", + "optional": false, + "field": "torrents", + "description": "

List of torrent object (see view for the properties).

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "queryRecordCount", + "description": "

Number of torrents given.

" + }, + { + "group": "Success 200", + "type": "Number", + "optional": false, + "field": "totalRecordCount", + "description": "

Total number of torrents.

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Object[]", - "optional": false, - "field": "torrents", - "description": "

List of torrent object (see view for the properties).

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "queryRecordCount", - "description": "

Number of torrents given.

" - }, - { - "group": "Success 200", - "type": "Number", - "optional": false, - "field": "totalRecordCount", - "description": "

Total number of torrents.

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n {\n\t\t\t\"torrents\": [...],\n\t\t\t\"queryRecordCount\": 50,\n\t\t\t\"totalRecordCount\": 798414\n\t\t}", "type": "json" - }] - }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { "group": "Error 4xx", "type": "String[]", "optional": false, "field": "errors", "description": "

List of errors messages with a 404 error message in it.

" - }] - }, - "examples": [{ + } + ] + }, + "examples": [ + { "title": "Error-Response:", "content": "HTTP/1.1 404 Not Found\n{\n \"errors\": [ \"404_not_found\", ... ]\n}", "type": "json" - }] + } + ] + } + }, + { + "type": "post", + "url": "/update/", + "title": "Update a Torrent", + "version": "1.1.1", + "name": "UpdateTorrent", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "username", + "description": "

Torrent uploader name.

" + }, + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "id", + "description": "

Torrent ID.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "name", + "description": "

Torrent name.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "category", + "description": "

Torrent category.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "remake", + "description": "

Torrent is a remake.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "description", + "description": "

Torrent description.

" + }, + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "status", + "description": "

Torrent status.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "hidden", + "description": "

Torrent hidden.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "website_link", + "description": "

Torrent website link.

" + }, + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "languages", + "description": "

Torrent languages.

" + } + ] } }, - { - "type": "post", - "url": "/update/", - "title": "Update a Torrent", - "version": "1.1.1", - "name": "UpdateTorrent", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ - "group": "Parameter", - "type": "String", - "optional": false, - "field": "username", - "description": "

Torrent uploader name.

" - }, - { - "group": "Parameter", - "type": "Number", - "optional": false, - "field": "id", - "description": "

Torrent ID.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "name", - "description": "

Torrent name.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "category", - "description": "

Torrent category.

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "remake", - "description": "

Torrent is a remake.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "description", - "description": "

Torrent description.

" - }, - { - "group": "Parameter", - "type": "Number", - "optional": false, - "field": "status", - "description": "

Torrent status.

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "hidden", - "description": "

Torrent hidden.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "website_link", - "description": "

Torrent website link.

" - }, - { - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "languages", - "description": "

Torrent languages.

" - } - ] - } + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The resulting torrent updated (see view for the properties)

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request is done without failing

" - }, - { - "group": "Success 200", - "type": "String[]", - "optional": false, - "field": "infos", - "description": "

Messages information relative to the request

" - }, - { - "group": "Success 200", - "type": "Object", - "optional": false, - "field": "data", - "description": "

The resulting torrent updated (see view for the properties)

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": "HTTP/1.1 200 OK", "type": "json" - }] + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ - "group": "Error 4xx", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request couldn't be done due to some errors.

" - }, - { - "group": "Error 4xx", - "type": "String[]", - "optional": false, - "field": "errors", - "description": "

List of errors messages.

" - }, - { - "group": "Error 4xx", - "type": "Object[]", - "optional": false, - "field": "all_errors", - "description": "

List of errors object messages for each wrong field

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Error-Response:", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "type": "json" - }] + } + ] + } + }, + { + "type": "post", + "url": "/upload", + "title": "Upload a Torrent", + "version": "1.1.1", + "name": "UploadTorrent", + "group": "Torrents", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "username", + "description": "

Torrent uploader name.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "name", + "description": "

Torrent name.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "magnet", + "description": "

Torrent magnet URI.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "category", + "description": "

Torrent category.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "remake", + "description": "

Torrent is a remake.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "description", + "description": "

Torrent description.

" + }, + { + "group": "Parameter", + "type": "Number", + "optional": false, + "field": "status", + "description": "

Torrent status.

" + }, + { + "group": "Parameter", + "type": "Boolean", + "optional": false, + "field": "hidden", + "description": "

Torrent hidden.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "website_link", + "description": "

Torrent website link.

" + }, + { + "group": "Parameter", + "type": "String[]", + "optional": false, + "field": "languages", + "description": "

Torrent languages.

" + }, + { + "group": "Parameter", + "type": "File", + "optional": false, + "field": "torrent", + "description": "

Torrent file to upload (you have to send a torrent file or a magnet, not both!).

" + } + ] } }, - { - "type": "post", - "url": "/upload", - "title": "Upload a Torrent", - "version": "1.1.1", - "name": "UploadTorrent", - "group": "Torrents", - "parameter": { - "fields": { - "Parameter": [{ - "group": "Parameter", - "type": "String", - "optional": false, - "field": "username", - "description": "

Torrent uploader name.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "name", - "description": "

Torrent name.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "magnet", - "description": "

Torrent magnet URI.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "category", - "description": "

Torrent category.

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "remake", - "description": "

Torrent is a remake.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "description", - "description": "

Torrent description.

" - }, - { - "group": "Parameter", - "type": "Number", - "optional": false, - "field": "status", - "description": "

Torrent status.

" - }, - { - "group": "Parameter", - "type": "Boolean", - "optional": false, - "field": "hidden", - "description": "

Torrent hidden.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "website_link", - "description": "

Torrent website link.

" - }, - { - "group": "Parameter", - "type": "String[]", - "optional": false, - "field": "languages", - "description": "

Torrent languages.

" - }, - { - "group": "Parameter", - "type": "File", - "optional": false, - "field": "torrent", - "description": "

Torrent file to upload (you have to send a torrent file or a magnet, not both!).

" - } - ] - } + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The resulting torrent uploaded (see view for the properties)

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request is done without failing

" - }, - { - "group": "Success 200", - "type": "String[]", - "optional": false, - "field": "infos", - "description": "

Messages information relative to the request

" - }, - { - "group": "Success 200", - "type": "Object", - "optional": false, - "field": "data", - "description": "

The resulting torrent uploaded (see view for the properties)

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": "HTTP/1.1 200 OK", "type": "json" - }] + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Torrents", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] }, - "filename": "controllers/api/api.go", - "groupTitle": "Torrents", - "error": { - "fields": { - "Error 4xx": [{ - "group": "Error 4xx", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request couldn't be done due to some errors.

" - }, - { - "group": "Error 4xx", - "type": "String[]", - "optional": false, - "field": "errors", - "description": "

List of errors messages.

" - }, - { - "group": "Error 4xx", - "type": "Object[]", - "optional": false, - "field": "all_errors", - "description": "

List of errors object messages for each wrong field

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Error-Response:", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "type": "json" - }] + } + ] + } + }, + { + "type": "post", + "url": "/login/", + "title": "Login a user", + "version": "1.1.1", + "name": "Login", + "group": "Users", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "username", + "description": "

Username or Email.

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "

Password.

" + } + ] } }, - { - "type": "post", - "url": "/login/", - "title": "Login a user", - "version": "1.1.1", - "name": "Login", - "group": "Users", - "parameter": { - "fields": { - "Parameter": [{ - "group": "Parameter", - "type": "String", - "optional": false, - "field": "username", - "description": "

Username or Email.

" - }, - { - "group": "Parameter", - "type": "String", - "optional": false, - "field": "password", - "description": "

Password.

" - } - ] - } + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The connected user object

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request is done without failing

" - }, - { - "group": "Success 200", - "type": "String[]", - "optional": false, - "field": "infos", - "description": "

Messages information relative to the request

" - }, - { - "group": "Success 200", - "type": "Object", - "optional": false, - "field": "data", - "description": "

The connected user object

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\ttoken:\"token\",\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", "type": "json" - }] + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Users", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] }, - "filename": "controllers/api/api.go", - "groupTitle": "Users", - "error": { - "fields": { - "Error 4xx": [{ - "group": "Error 4xx", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request couldn't be done due to some errors.

" - }, - { - "group": "Error 4xx", - "type": "String[]", - "optional": false, - "field": "errors", - "description": "

List of errors messages.

" - }, - { - "group": "Error 4xx", - "type": "Object[]", - "optional": false, - "field": "all_errors", - "description": "

List of errors object messages for each wrong field

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Error-Response:", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "type": "json" - }] + } + ] + } + }, + { + "type": "post", + "url": "/user/", + "title": "Get a private user profile", + "version": "1.1.1", + "name": "Private_Profile", + "group": "Users", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "access_token", + "description": "

Token sent by the OAuth API

" + } + ] } }, - { - "type": "get", - "url": "/profile/", - "title": "Get a user profile", - "version": "1.1.1", - "name": "Profile", - "group": "Users", - "parameter": { - "fields": { - "Parameter": [{ + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The connected user object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\ttoken:\"token\",\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", + "type": "json" + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Users", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", + "type": "json" + } + ] + } + }, + { + "type": "get", + "url": "/profile/", + "title": "Get a user profile", + "version": "1.1.1", + "name": "Profile", + "group": "Users", + "parameter": { + "fields": { + "Parameter": [ + { "group": "Parameter", "type": "Number", "optional": false, "field": "id", "description": "

User ID.

" - }] - } + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The user object

" + } + ] }, - "success": { - "fields": { - "Success 200": [{ - "group": "Success 200", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request is done without failing

" - }, - { - "group": "Success 200", - "type": "String[]", - "optional": false, - "field": "infos", - "description": "

Messages information relative to the request

" - }, - { - "group": "Success 200", - "type": "Object", - "optional": false, - "field": "data", - "description": "

The user object

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Success-Response:", "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", "type": "json" - }] + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Users", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] }, - "filename": "controllers/api/api.go", - "groupTitle": "Users", - "error": { - "fields": { - "Error 4xx": [{ - "group": "Error 4xx", - "type": "Boolean", - "optional": false, - "field": "ok", - "description": "

The request couldn't be done due to some errors.

" - }, - { - "group": "Error 4xx", - "type": "String[]", - "optional": false, - "field": "errors", - "description": "

List of errors messages.

" - }, - { - "group": "Error 4xx", - "type": "Object[]", - "optional": false, - "field": "all_errors", - "description": "

List of errors object messages for each wrong field

" - } - ] - }, - "examples": [{ + "examples": [ + { "title": "Error-Response:", "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", "type": "json" - }] - } + } + ] } - ] -}); + } +] }); diff --git a/apidoc/api_data.json b/apidoc/api_data.json index 4213e574..ba0887ef 100644 --- a/apidoc/api_data.json +++ b/apidoc/api_data.json @@ -1108,6 +1108,97 @@ ] } }, + { + "type": "post", + "url": "/user/", + "title": "Get a private user profile", + "version": "1.1.1", + "name": "Private_Profile", + "group": "Users", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "access_token", + "description": "

Token sent by the OAuth API

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request is done without failing

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "infos", + "description": "

Messages information relative to the request

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

The connected user object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": " HTTP/1.1 200 OK\n\t\t{\n\t\t\tdata:\n \t\t[{\n\t\t\t\t\tuser_id:1,\n\t\t\t\t\tusername:\"username\",\n\t\t\t\t\tstatus:1,\n\t\t\t\t\ttoken:\"token\",\n\t\t\t\t\tmd5:\"\",\n\t\t\t\t\tcreated_at:\"date\",\n\t\t\t\t\tliking_count:0,\n\t\t\t\t\tliked_count:0\n\t\t\t\t}],\n\t\t\tinfos: [\"Logged\", ... ],\n\t\t\tok:true\n\t\t}", + "type": "json" + } + ] + }, + "filename": "controllers/api/api.go", + "groupTitle": "Users", + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "Boolean", + "optional": false, + "field": "ok", + "description": "

The request couldn't be done due to some errors.

" + }, + { + "group": "Error 4xx", + "type": "String[]", + "optional": false, + "field": "errors", + "description": "

List of errors messages.

" + }, + { + "group": "Error 4xx", + "type": "Object[]", + "optional": false, + "field": "all_errors", + "description": "

List of errors object messages for each wrong field

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": " HTTP/1.1 200 OK\n {\n \"ok\": false,\n \"errors\": [ ... ]\n \"all_errors\": {\n\t\t \t\"username\": [ ... ],\n }\n }", + "type": "json" + } + ] + } + }, { "type": "get", "url": "/profile/", diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cf3b174a..6e28be8e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -6,7 +6,7 @@ define({ "url": "https://nyaa.pantsu.cat/api", "header": { "title": "Information", - "content": "

Information

\n

You can use this API without being logged or any token API

\n

Except for Upload

\n

When you upload, you have to provide your username and api token!

\n" + "content": "

Information

\n

You can use this API without being logged or any token API

\n

Except for Upload

\n

When you upload, you have to provide your username and API token!

\n" }, "order": [ "GetTorrents", @@ -26,7 +26,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2017-07-22T15:20:08.679Z", + "time": "2017-10-16T09:11:10.675Z", "url": "http://apidocjs.com", "version": "0.17.6" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 24409c9b..a11644f3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -6,7 +6,7 @@ "url": "https://nyaa.pantsu.cat/api", "header": { "title": "Information", - "content": "

Information

\n

You can use this API without being logged or any token API

\n

Except for Upload

\n

When you upload, you have to provide your username and api token!

\n" + "content": "

Information

\n

You can use this API without being logged or any token API

\n

Except for Upload

\n

When you upload, you have to provide your username and API token!

\n" }, "order": [ "GetTorrents", @@ -26,7 +26,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2017-07-22T15:20:08.679Z", + "time": "2017-10-16T09:11:10.675Z", "url": "http://apidocjs.com", "version": "0.17.6" } diff --git a/apidoc/index.html b/apidoc/index.html index b5751e28..5f04deda 100644 --- a/apidoc/index.html +++ b/apidoc/index.html @@ -1,249 +1,287 @@ + + + Loading... + + + + + + + + + - - - Loading... - - - - - - - - - - - - + {{/if}} + {{else}} +
  • + {{title}} +
  • + {{/if}} + {{/if}} + {{/each}} + + + - + + + + {{/if}} +
    + - + - + - + {{/if}} + {{/if}} + - + - + {{/each}} + + {{/if_gt}} - + + + {{/if_gt}} + {{/if}} + - + {{/if}} + - + {{#if typeDel}} +
    +
    {{{compare.content}}}
    +
    + {{/if}} - + {{/each_compare_title}} + - + + + + + {{/if}} + {{/each_compare_title}} + + {{/if}} + {{/if}} + - + {{/if}} -
    -
    -
    -
    -
    - -
    - -
    -
    -
    + {{#if typeIns}} + + + {{{splitFill source.field "." "  "}}} + {{#if source.optional}} {{__ "optional"}}{{/if}} + + + {{#if source.type}} + {{{source.type}}} + {{else}} + {{{typRowTd}}} + {{/if}} + + + {{{nl2br source.description}}} + {{#if source.defaultValue}}

    {{__ "Default value:"}} {{{source.defaultValue}}}

    {{/if}} + + + {{/if}} + + {{#if typeDel}} + + + {{{splitFill compare.field "." "  "}}} + {{#if compare.optional}} {{__ "optional"}}{{/if}} + + + {{#if compare.type}} + {{{compare.type}}} + {{else}} + {{{typRowTd}}} + {{/if}} + + + {{{nl2br compare.description}}} + {{#if compare.defaultValue}}

    {{__ "Default value:"}} {{{compare.defaultValue}}}

    {{/if}} + + + {{/if}} + + {{/each_compare_field}} + + + +

    +
    +
    +
    +
    + +
    + +
    +
    +
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Loading...

    -
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Loading...

    +
    +
    - - - + + diff --git a/apidoc/locales/ca.js b/apidoc/locales/ca.js index 7ccb7e3c..65af5df2 100644 --- a/apidoc/locales/ca.js +++ b/apidoc/locales/ca.js @@ -1,25 +1,25 @@ define({ - ca: { - 'Allowed values:': 'Valors permesos:', - 'Compare all with predecessor': 'Comparar tot amb versió anterior', - 'compare changes to:': 'comparar canvis amb:', - 'compared to': 'comparat amb', - 'Default value:': 'Valor per defecte:', - 'Description': 'Descripció', - 'Field': 'Camp', - 'General': 'General', - 'Generated with': 'Generat amb', - 'Name': 'Nom', - 'No response values.': 'Sense valors en la resposta.', - 'optional': 'opcional', - 'Parameter': 'Paràmetre', - 'Permission:': 'Permisos:', - 'Response': 'Resposta', - 'Send': 'Enviar', - 'Send a Sample Request': 'Enviar una petició d\'exemple', - 'show up to version:': 'mostrar versió:', - 'Size range:': 'Tamany de rang:', - 'Type': 'Tipus', - 'url': 'url' - } + ca: { + 'Allowed values:' : 'Valors permesos:', + 'Compare all with predecessor': 'Comparar tot amb versió anterior', + 'compare changes to:' : 'comparar canvis amb:', + 'compared to' : 'comparat amb', + 'Default value:' : 'Valor per defecte:', + 'Description' : 'Descripció', + 'Field' : 'Camp', + 'General' : 'General', + 'Generated with' : 'Generat amb', + 'Name' : 'Nom', + 'No response values.' : 'Sense valors en la resposta.', + 'optional' : 'opcional', + 'Parameter' : 'Paràmetre', + 'Permission:' : 'Permisos:', + 'Response' : 'Resposta', + 'Send' : 'Enviar', + 'Send a Sample Request' : 'Enviar una petició d\'exemple', + 'show up to version:' : 'mostrar versió:', + 'Size range:' : 'Tamany de rang:', + 'Type' : 'Tipus', + 'url' : 'url' + } }); diff --git a/apidoc/locales/de.js b/apidoc/locales/de.js index b3ca0119..f66420d0 100644 --- a/apidoc/locales/de.js +++ b/apidoc/locales/de.js @@ -1,25 +1,25 @@ define({ - de: { - 'Allowed values:': 'Erlaubte Werte:', - 'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern', - 'compare changes to:': 'vergleiche Änderungen mit:', - 'compared to': 'verglichen mit', - 'Default value:': 'Standardwert:', - 'Description': 'Beschreibung', - 'Field': 'Feld', - 'General': 'Allgemein', - 'Generated with': 'Erstellt mit', - 'Name': 'Name', - 'No response values.': 'Keine Rückgabewerte.', - 'optional': 'optional', - 'Parameter': 'Parameter', - 'Permission:': 'Berechtigung:', - 'Response': 'Antwort', - 'Send': 'Senden', - 'Send a Sample Request': 'Eine Beispielanfrage senden', - 'show up to version:': 'zeige bis zur Version:', - 'Size range:': 'Größenbereich:', - 'Type': 'Typ', - 'url': 'url' - } + de: { + 'Allowed values:' : 'Erlaubte Werte:', + 'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern', + 'compare changes to:' : 'vergleiche Änderungen mit:', + 'compared to' : 'verglichen mit', + 'Default value:' : 'Standardwert:', + 'Description' : 'Beschreibung', + 'Field' : 'Feld', + 'General' : 'Allgemein', + 'Generated with' : 'Erstellt mit', + 'Name' : 'Name', + 'No response values.' : 'Keine Rückgabewerte.', + 'optional' : 'optional', + 'Parameter' : 'Parameter', + 'Permission:' : 'Berechtigung:', + 'Response' : 'Antwort', + 'Send' : 'Senden', + 'Send a Sample Request' : 'Eine Beispielanfrage senden', + 'show up to version:' : 'zeige bis zur Version:', + 'Size range:' : 'Größenbereich:', + 'Type' : 'Typ', + 'url' : 'url' + } }); diff --git a/apidoc/locales/es.js b/apidoc/locales/es.js index 172cb9f8..3d47e800 100644 --- a/apidoc/locales/es.js +++ b/apidoc/locales/es.js @@ -1,25 +1,25 @@ define({ - es: { - 'Allowed values:': 'Valores permitidos:', - 'Compare all with predecessor': 'Comparar todo con versión anterior', - 'compare changes to:': 'comparar cambios con:', - 'compared to': 'comparado con', - 'Default value:': 'Valor por defecto:', - 'Description': 'Descripción', - 'Field': 'Campo', - 'General': 'General', - 'Generated with': 'Generado con', - 'Name': 'Nombre', - 'No response values.': 'Sin valores en la respuesta.', - 'optional': 'opcional', - 'Parameter': 'Parámetro', - 'Permission:': 'Permisos:', - 'Response': 'Respuesta', - 'Send': 'Enviar', - 'Send a Sample Request': 'Enviar una petición de ejemplo', - 'show up to version:': 'mostrar a versión:', - 'Size range:': 'Tamaño de rango:', - 'Type': 'Tipo', - 'url': 'url' - } + es: { + 'Allowed values:' : 'Valores permitidos:', + 'Compare all with predecessor': 'Comparar todo con versión anterior', + 'compare changes to:' : 'comparar cambios con:', + 'compared to' : 'comparado con', + 'Default value:' : 'Valor por defecto:', + 'Description' : 'Descripción', + 'Field' : 'Campo', + 'General' : 'General', + 'Generated with' : 'Generado con', + 'Name' : 'Nombre', + 'No response values.' : 'Sin valores en la respuesta.', + 'optional' : 'opcional', + 'Parameter' : 'Parámetro', + 'Permission:' : 'Permisos:', + 'Response' : 'Respuesta', + 'Send' : 'Enviar', + 'Send a Sample Request' : 'Enviar una petición de ejemplo', + 'show up to version:' : 'mostrar a versión:', + 'Size range:' : 'Tamaño de rango:', + 'Type' : 'Tipo', + 'url' : 'url' + } }); diff --git a/apidoc/locales/fr.js b/apidoc/locales/fr.js index 8393c607..100a6429 100644 --- a/apidoc/locales/fr.js +++ b/apidoc/locales/fr.js @@ -1,25 +1,25 @@ define({ - fr: { - 'Allowed values:': 'Valeurs autorisées :', - 'Compare all with predecessor': 'Tout comparer avec ...', - 'compare changes to:': 'comparer les changements à :', - 'compared to': 'comparer à', - 'Default value:': 'Valeur par défaut :', - 'Description': 'Description', - 'Field': 'Champ', - 'General': 'Général', - 'Generated with': 'Généré avec', - 'Name': 'Nom', - 'No response values.': 'Aucune valeur de réponse.', - 'optional': 'optionnel', - 'Parameter': 'Paramètre', - 'Permission:': 'Permission :', - 'Response': 'Réponse', - 'Send': 'Envoyer', - 'Send a Sample Request': 'Envoyer une requête représentative', - 'show up to version:': 'Montrer à partir de la version :', - 'Size range:': 'Ordre de grandeur :', - 'Type': 'Type', - 'url': 'url' - } + fr: { + 'Allowed values:' : 'Valeurs autorisées :', + 'Compare all with predecessor': 'Tout comparer avec ...', + 'compare changes to:' : 'comparer les changements à :', + 'compared to' : 'comparer à', + 'Default value:' : 'Valeur par défaut :', + 'Description' : 'Description', + 'Field' : 'Champ', + 'General' : 'Général', + 'Generated with' : 'Généré avec', + 'Name' : 'Nom', + 'No response values.' : 'Aucune valeur de réponse.', + 'optional' : 'optionnel', + 'Parameter' : 'Paramètre', + 'Permission:' : 'Permission :', + 'Response' : 'Réponse', + 'Send' : 'Envoyer', + 'Send a Sample Request' : 'Envoyer une requête représentative', + 'show up to version:' : 'Montrer à partir de la version :', + 'Size range:' : 'Ordre de grandeur :', + 'Type' : 'Type', + 'url' : 'url' + } }); diff --git a/apidoc/locales/it.js b/apidoc/locales/it.js index 32057b25..8117108c 100644 --- a/apidoc/locales/it.js +++ b/apidoc/locales/it.js @@ -1,25 +1,25 @@ define({ - it: { - 'Allowed values:': 'Valori permessi:', - 'Compare all with predecessor': 'Confronta tutto con versioni precedenti', - 'compare changes to:': 'confronta modifiche con:', - 'compared to': 'confrontato con', - 'Default value:': 'Valore predefinito:', - 'Description': 'Descrizione', - 'Field': 'Campo', - 'General': 'Generale', - 'Generated with': 'Creato con', - 'Name': 'Nome', - 'No response values.': 'Nessun valore di risposta.', - 'optional': 'opzionale', - 'Parameter': 'Parametro', - 'Permission:': 'Permessi:', - 'Response': 'Risposta', - 'Send': 'Invia', - 'Send a Sample Request': 'Invia una richiesta di esempio', - 'show up to version:': 'mostra alla versione:', - 'Size range:': 'Intervallo dimensione:', - 'Type': 'Tipo', - 'url': 'url' - } + it: { + 'Allowed values:' : 'Valori permessi:', + 'Compare all with predecessor': 'Confronta tutto con versioni precedenti', + 'compare changes to:' : 'confronta modifiche con:', + 'compared to' : 'confrontato con', + 'Default value:' : 'Valore predefinito:', + 'Description' : 'Descrizione', + 'Field' : 'Campo', + 'General' : 'Generale', + 'Generated with' : 'Creato con', + 'Name' : 'Nome', + 'No response values.' : 'Nessun valore di risposta.', + 'optional' : 'opzionale', + 'Parameter' : 'Parametro', + 'Permission:' : 'Permessi:', + 'Response' : 'Risposta', + 'Send' : 'Invia', + 'Send a Sample Request' : 'Invia una richiesta di esempio', + 'show up to version:' : 'mostra alla versione:', + 'Size range:' : 'Intervallo dimensione:', + 'Type' : 'Tipo', + 'url' : 'url' + } }); diff --git a/apidoc/locales/locale.js b/apidoc/locales/locale.js index 08cb4421..ba82385a 100644 --- a/apidoc/locales/locale.js +++ b/apidoc/locales/locale.js @@ -1,50 +1,50 @@ define([ - './locales/ca.js', - './locales/de.js', - './locales/es.js', - './locales/fr.js', - './locales/it.js', - './locales/nl.js', - './locales/pl.js', - './locales/pt_br.js', - './locales/ro.js', - './locales/ru.js', - './locales/tr.js', - './locales/vi.js', - './locales/zh.js', - './locales/zh_cn.js' -], function () { - var langId = (navigator.language || navigator.userLanguage).toLowerCase().replace('-', '_'); - var language = langId.substr(0, 2); - var locales = {}; + './locales/ca.js', + './locales/de.js', + './locales/es.js', + './locales/fr.js', + './locales/it.js', + './locales/nl.js', + './locales/pl.js', + './locales/pt_br.js', + './locales/ro.js', + './locales/ru.js', + './locales/tr.js', + './locales/vi.js', + './locales/zh.js', + './locales/zh_cn.js' +], function() { + var langId = (navigator.language || navigator.userLanguage).toLowerCase().replace('-', '_'); + var language = langId.substr(0, 2); + var locales = {}; - for (index in arguments) { - for (property in arguments[index]) - locales[property] = arguments[index][property]; - } - if (!locales['en']) - locales['en'] = {}; + for (index in arguments) { + for (property in arguments[index]) + locales[property] = arguments[index][property]; + } + if ( ! locales['en']) + locales['en'] = {}; - if (!locales[langId] && !locales[language]) - language = 'en'; + if ( ! locales[langId] && ! locales[language]) + language = 'en'; - var locale = (locales[langId] ? locales[langId] : locales[language]); + var locale = (locales[langId] ? locales[langId] : locales[language]); - function __(text) { - var index = locale[text]; - if (index === undefined) - return text; - return index; - }; + function __(text) { + var index = locale[text]; + if (index === undefined) + return text; + return index; + }; - function setLanguage(language) { - locale = locales[language]; - } + function setLanguage(language) { + locale = locales[language]; + } - return { - __: __, - locales: locales, - locale: locale, - setLanguage: setLanguage - }; + return { + __ : __, + locales : locales, + locale : locale, + setLanguage: setLanguage + }; }); diff --git a/apidoc/locales/nl.js b/apidoc/locales/nl.js index 989f3e00..bddfeeb1 100644 --- a/apidoc/locales/nl.js +++ b/apidoc/locales/nl.js @@ -1,25 +1,25 @@ define({ - nl: { - 'Allowed values:': 'Toegestane waarden:', - 'Compare all with predecessor': 'Vergelijk alle met voorgaande versie', - 'compare changes to:': 'vergelijk veranderingen met:', - 'compared to': 'vergelijk met', - 'Default value:': 'Standaard waarde:', - 'Description': 'Omschrijving', - 'Field': 'Veld', - 'General': 'Algemeen', - 'Generated with': 'Gegenereerd met', - 'Name': 'Naam', - 'No response values.': 'Geen response waardes.', - 'optional': 'optioneel', - 'Parameter': 'Parameter', - 'Permission:': 'Permissie:', - 'Response': 'Antwoorden', - 'Send': 'Sturen', - 'Send a Sample Request': 'Stuur een sample aanvragen', - 'show up to version:': 'toon tot en met versie:', - 'Size range:': 'Maatbereik:', - 'Type': 'Type', - 'url': 'url' - } + nl: { + 'Allowed values:' : 'Toegestane waarden:', + 'Compare all with predecessor': 'Vergelijk alle met voorgaande versie', + 'compare changes to:' : 'vergelijk veranderingen met:', + 'compared to' : 'vergelijk met', + 'Default value:' : 'Standaard waarde:', + 'Description' : 'Omschrijving', + 'Field' : 'Veld', + 'General' : 'Algemeen', + 'Generated with' : 'Gegenereerd met', + 'Name' : 'Naam', + 'No response values.' : 'Geen response waardes.', + 'optional' : 'optioneel', + 'Parameter' : 'Parameter', + 'Permission:' : 'Permissie:', + 'Response' : 'Antwoorden', + 'Send' : 'Sturen', + 'Send a Sample Request' : 'Stuur een sample aanvragen', + 'show up to version:' : 'toon tot en met versie:', + 'Size range:' : 'Maatbereik:', + 'Type' : 'Type', + 'url' : 'url' + } }); diff --git a/apidoc/locales/pl.js b/apidoc/locales/pl.js index bab52dad..db645ee1 100644 --- a/apidoc/locales/pl.js +++ b/apidoc/locales/pl.js @@ -1,25 +1,25 @@ define({ - pl: { - 'Allowed values:': 'Dozwolone wartości:', - 'Compare all with predecessor': 'Porównaj z poprzednimi wersjami', - 'compare changes to:': 'porównaj zmiany do:', - 'compared to': 'porównaj do:', - 'Default value:': 'Wartość domyślna:', - 'Description': 'Opis', - 'Field': 'Pole', - 'General': 'Generalnie', - 'Generated with': 'Wygenerowano z', - 'Name': 'Nazwa', - 'No response values.': 'Brak odpowiedzi.', - 'optional': 'opcjonalny', - 'Parameter': 'Parametr', - 'Permission:': 'Uprawnienia:', - 'Response': 'Odpowiedź', - 'Send': 'Wyślij', - 'Send a Sample Request': 'Wyślij przykładowe żądanie', - 'show up to version:': 'pokaż do wersji:', - 'Size range:': 'Zakres rozmiaru:', - 'Type': 'Typ', - 'url': 'url' - } + pl: { + 'Allowed values:' : 'Dozwolone wartości:', + 'Compare all with predecessor': 'Porównaj z poprzednimi wersjami', + 'compare changes to:' : 'porównaj zmiany do:', + 'compared to' : 'porównaj do:', + 'Default value:' : 'Wartość domyślna:', + 'Description' : 'Opis', + 'Field' : 'Pole', + 'General' : 'Generalnie', + 'Generated with' : 'Wygenerowano z', + 'Name' : 'Nazwa', + 'No response values.' : 'Brak odpowiedzi.', + 'optional' : 'opcjonalny', + 'Parameter' : 'Parametr', + 'Permission:' : 'Uprawnienia:', + 'Response' : 'Odpowiedź', + 'Send' : 'Wyślij', + 'Send a Sample Request' : 'Wyślij przykładowe żądanie', + 'show up to version:' : 'pokaż do wersji:', + 'Size range:' : 'Zakres rozmiaru:', + 'Type' : 'Typ', + 'url' : 'url' + } }); diff --git a/apidoc/locales/pt_br.js b/apidoc/locales/pt_br.js index 44ffae27..2bd78b0d 100644 --- a/apidoc/locales/pt_br.js +++ b/apidoc/locales/pt_br.js @@ -1,25 +1,25 @@ define({ - 'pt_br': { - 'Allowed values:': 'Valores permitidos:', - 'Compare all with predecessor': 'Compare todos com antecessores', - 'compare changes to:': 'comparar alterações com:', - 'compared to': 'comparado com', - 'Default value:': 'Valor padrão:', - 'Description': 'Descrição', - 'Field': 'Campo', - 'General': 'Geral', - 'Generated with': 'Gerado com', - 'Name': 'Nome', - 'No response values.': 'Sem valores de resposta.', - 'optional': 'opcional', - 'Parameter': 'Parâmetro', - 'Permission:': 'Permissão:', - 'Response': 'Resposta', - 'Send': 'Enviar', - 'Send a Sample Request': 'Enviar um Exemplo de Pedido', - 'show up to version:': 'aparecer para a versão:', - 'Size range:': 'Faixa de tamanho:', - 'Type': 'Tipo', - 'url': 'url' - } + 'pt_br': { + 'Allowed values:' : 'Valores permitidos:', + 'Compare all with predecessor': 'Compare todos com antecessores', + 'compare changes to:' : 'comparar alterações com:', + 'compared to' : 'comparado com', + 'Default value:' : 'Valor padrão:', + 'Description' : 'Descrição', + 'Field' : 'Campo', + 'General' : 'Geral', + 'Generated with' : 'Gerado com', + 'Name' : 'Nome', + 'No response values.' : 'Sem valores de resposta.', + 'optional' : 'opcional', + 'Parameter' : 'Parâmetro', + 'Permission:' : 'Permissão:', + 'Response' : 'Resposta', + 'Send' : 'Enviar', + 'Send a Sample Request' : 'Enviar um Exemplo de Pedido', + 'show up to version:' : 'aparecer para a versão:', + 'Size range:' : 'Faixa de tamanho:', + 'Type' : 'Tipo', + 'url' : 'url' + } }); diff --git a/apidoc/locales/ro.js b/apidoc/locales/ro.js index 0935337d..8d4e4ed8 100644 --- a/apidoc/locales/ro.js +++ b/apidoc/locales/ro.js @@ -1,25 +1,25 @@ define({ - ro: { - 'Allowed values:': 'Valori permise:', - 'Compare all with predecessor': 'Compară toate cu versiunea precedentă', - 'compare changes to:': 'compară cu versiunea:', - 'compared to': 'comparat cu', - 'Default value:': 'Valoare implicită:', - 'Description': 'Descriere', - 'Field': 'Câmp', - 'General': 'General', - 'Generated with': 'Generat cu', - 'Name': 'Nume', - 'No response values.': 'Nici o valoare returnată.', - 'optional': 'opțional', - 'Parameter': 'Parametru', - 'Permission:': 'Permisiune:', - 'Response': 'Răspuns', - 'Send': 'Trimite', - 'Send a Sample Request': 'Trimite o cerere de probă', - 'show up to version:': 'arată până la versiunea:', - 'Size range:': 'Interval permis:', - 'Type': 'Tip', - 'url': 'url' - } + ro: { + 'Allowed values:' : 'Valori permise:', + 'Compare all with predecessor': 'Compară toate cu versiunea precedentă', + 'compare changes to:' : 'compară cu versiunea:', + 'compared to' : 'comparat cu', + 'Default value:' : 'Valoare implicită:', + 'Description' : 'Descriere', + 'Field' : 'Câmp', + 'General' : 'General', + 'Generated with' : 'Generat cu', + 'Name' : 'Nume', + 'No response values.' : 'Nici o valoare returnată.', + 'optional' : 'opțional', + 'Parameter' : 'Parametru', + 'Permission:' : 'Permisiune:', + 'Response' : 'Răspuns', + 'Send' : 'Trimite', + 'Send a Sample Request' : 'Trimite o cerere de probă', + 'show up to version:' : 'arată până la versiunea:', + 'Size range:' : 'Interval permis:', + 'Type' : 'Tip', + 'url' : 'url' + } }); diff --git a/apidoc/locales/ru.js b/apidoc/locales/ru.js index 3d3e2d01..c5f33821 100644 --- a/apidoc/locales/ru.js +++ b/apidoc/locales/ru.js @@ -1,25 +1,25 @@ define({ - ru: { - 'Allowed values:': 'Допустимые значения:', - 'Compare all with predecessor': 'Сравнить с предыдущей версией', - 'compare changes to:': 'сравнить с:', - 'compared to': 'в сравнении с', - 'Default value:': 'По умолчанию:', - 'Description': 'Описание', - 'Field': 'Название', - 'General': 'Общая информация', - 'Generated with': 'Сгенерировано с помощью', - 'Name': 'Название', - 'No response values.': 'Нет значений для ответа.', - 'optional': 'необязательный', - 'Parameter': 'Параметр', - 'Permission:': 'Разрешено:', - 'Response': 'Ответ', - 'Send': 'Отправить', - 'Send a Sample Request': 'Отправить тестовый запрос', - 'show up to version:': 'показать версию:', - 'Size range:': 'Ограничения:', - 'Type': 'Тип', - 'url': 'URL' - } + ru: { + 'Allowed values:' : 'Допустимые значения:', + 'Compare all with predecessor': 'Сравнить с предыдущей версией', + 'compare changes to:' : 'сравнить с:', + 'compared to' : 'в сравнении с', + 'Default value:' : 'По умолчанию:', + 'Description' : 'Описание', + 'Field' : 'Название', + 'General' : 'Общая информация', + 'Generated with' : 'Сгенерировано с помощью', + 'Name' : 'Название', + 'No response values.' : 'Нет значений для ответа.', + 'optional' : 'необязательный', + 'Parameter' : 'Параметр', + 'Permission:' : 'Разрешено:', + 'Response' : 'Ответ', + 'Send' : 'Отправить', + 'Send a Sample Request' : 'Отправить тестовый запрос', + 'show up to version:' : 'показать версию:', + 'Size range:' : 'Ограничения:', + 'Type' : 'Тип', + 'url' : 'URL' + } }); diff --git a/apidoc/locales/tr.js b/apidoc/locales/tr.js index beef64c2..5c64e52d 100644 --- a/apidoc/locales/tr.js +++ b/apidoc/locales/tr.js @@ -1,25 +1,25 @@ define({ - tr: { - 'Allowed values:': 'İzin verilen değerler:', - 'Compare all with predecessor': 'Tümünü öncekiler ile karşılaştır', - 'compare changes to:': 'değişiklikleri karşılaştır:', - 'compared to': 'karşılaştır', - 'Default value:': 'Varsayılan değer:', - 'Description': 'Açıklama', - 'Field': 'Alan', - 'General': 'Genel', - 'Generated with': 'Oluşturan', - 'Name': 'İsim', - 'No response values.': 'Dönüş verisi yok.', - 'optional': 'opsiyonel', - 'Parameter': 'Parametre', - 'Permission:': 'İzin:', - 'Response': 'Dönüş', - 'Send': 'Gönder', - 'Send a Sample Request': 'Örnek istek gönder', - 'show up to version:': 'bu versiyona kadar göster:', - 'Size range:': 'Boyut aralığı:', - 'Type': 'Tip', - 'url': 'url' - } + tr: { + 'Allowed values:' : 'İzin verilen değerler:', + 'Compare all with predecessor': 'Tümünü öncekiler ile karşılaştır', + 'compare changes to:' : 'değişiklikleri karşılaştır:', + 'compared to' : 'karşılaştır', + 'Default value:' : 'Varsayılan değer:', + 'Description' : 'Açıklama', + 'Field' : 'Alan', + 'General' : 'Genel', + 'Generated with' : 'Oluşturan', + 'Name' : 'İsim', + 'No response values.' : 'Dönüş verisi yok.', + 'optional' : 'opsiyonel', + 'Parameter' : 'Parametre', + 'Permission:' : 'İzin:', + 'Response' : 'Dönüş', + 'Send' : 'Gönder', + 'Send a Sample Request' : 'Örnek istek gönder', + 'show up to version:' : 'bu versiyona kadar göster:', + 'Size range:' : 'Boyut aralığı:', + 'Type' : 'Tip', + 'url' : 'url' + } }); diff --git a/apidoc/locales/vi.js b/apidoc/locales/vi.js index d6d8d8f7..7ce77050 100644 --- a/apidoc/locales/vi.js +++ b/apidoc/locales/vi.js @@ -1,25 +1,25 @@ define({ - vi: { - 'Allowed values:': 'Giá trị chấp nhận:', - 'Compare all with predecessor': 'So sánh với tất cả phiên bản trước', - 'compare changes to:': 'so sánh sự thay đổi với:', - 'compared to': 'so sánh với', - 'Default value:': 'Giá trị mặc định:', - 'Description': 'Chú thích', - 'Field': 'Trường dữ liệu', - 'General': 'Tổng quan', - 'Generated with': 'Được tạo bởi', - 'Name': 'Tên', - 'No response values.': 'Không có kết quả trả về.', - 'optional': 'Tùy chọn', - 'Parameter': 'Tham số', - 'Permission:': 'Quyền hạn:', - 'Response': 'Kết quả', - 'Send': 'Gửi', - 'Send a Sample Request': 'Gửi một yêu cầu mẫu', - 'show up to version:': 'hiển thị phiên bản:', - 'Size range:': 'Kích cỡ:', - 'Type': 'Kiểu', - 'url': 'liên kết' - } + vi: { + 'Allowed values:' : 'Giá trị chấp nhận:', + 'Compare all with predecessor': 'So sánh với tất cả phiên bản trước', + 'compare changes to:' : 'so sánh sự thay đổi với:', + 'compared to' : 'so sánh với', + 'Default value:' : 'Giá trị mặc định:', + 'Description' : 'Chú thích', + 'Field' : 'Trường dữ liệu', + 'General' : 'Tổng quan', + 'Generated with' : 'Được tạo bởi', + 'Name' : 'Tên', + 'No response values.' : 'Không có kết quả trả về.', + 'optional' : 'Tùy chọn', + 'Parameter' : 'Tham số', + 'Permission:' : 'Quyền hạn:', + 'Response' : 'Kết quả', + 'Send' : 'Gửi', + 'Send a Sample Request' : 'Gửi một yêu cầu mẫu', + 'show up to version:' : 'hiển thị phiên bản:', + 'Size range:' : 'Kích cỡ:', + 'Type' : 'Kiểu', + 'url' : 'liên kết' + } }); diff --git a/apidoc/locales/zh.js b/apidoc/locales/zh.js index 095cdb6a..66522067 100644 --- a/apidoc/locales/zh.js +++ b/apidoc/locales/zh.js @@ -1,25 +1,25 @@ define({ - zh: { - 'Allowed values​​:': '允許值:', - 'Compare all with predecessor': '預先比較所有', - 'compare changes to:': '比較變更:', - 'compared to': '對比', - 'Default value:': '默認值:', - 'Description': '描述', - 'Field': '字段', - 'General': '概括', - 'Generated with': '生成工具', - 'Name': '名稱', - 'No response values​​.': '無對應資料.', - 'optional': '選項', - 'Parameter': '參數', - 'Permission:': '允許:', - 'Response': '回應', - 'Send': '發送', - 'Send a Sample Request': '發送試用需求', - 'show up to version:': '顯示到版本:', - 'Size range:': '尺寸範圍:', - 'Type': '類型', - 'url': '網址' - } + zh: { + 'Allowed values​​:' : '允許值:', + 'Compare all with predecessor': '預先比較所有', + 'compare changes to:' : '比較變更:', + 'compared to' : '對比', + 'Default value:' : '默認值:', + 'Description' : '描述', + 'Field' : '字段', + 'General' : '概括', + 'Generated with' : '生成工具', + 'Name' : '名稱', + 'No response values​​.' : '無對應資料.', + 'optional' : '選項', + 'Parameter' : '參數', + 'Permission:' : '允許:', + 'Response' : '回應', + 'Send' : '發送', + 'Send a Sample Request' : '發送試用需求', + 'show up to version:' : '顯示到版本:', + 'Size range:' : '尺寸範圍:', + 'Type' : '類型', + 'url' : '網址' + } }); diff --git a/apidoc/locales/zh_cn.js b/apidoc/locales/zh_cn.js index 1ffa5b8e..1938ca18 100644 --- a/apidoc/locales/zh_cn.js +++ b/apidoc/locales/zh_cn.js @@ -1,25 +1,25 @@ define({ - 'zh_cn': { - 'Allowed values:': '允许值:', - 'Compare all with predecessor': '与所有较早的比较', - 'compare changes to:': '将当前版本与指定版本比较:', - 'compared to': '相比于', - 'Default value:': '默认值:', - 'Description': '描述', - 'Field': '字段', - 'General': '概要', - 'Generated with': '基于', - 'Name': '名称', - 'No response values.': '无返回值.', - 'optional': '可选', - 'Parameter': '参数', - 'Permission:': '权限:', - 'Response': '返回', - 'Send': '发送', - 'Send a Sample Request': '发送示例请求', - 'show up to version:': '显示到指定版本:', - 'Size range:': '取值范围:', - 'Type': '类型', - 'url': '网址' - } + 'zh_cn': { + 'Allowed values:' : '允许值:', + 'Compare all with predecessor': '与所有较早的比较', + 'compare changes to:' : '将当前版本与指定版本比较:', + 'compared to' : '相比于', + 'Default value:' : '默认值:', + 'Description' : '描述', + 'Field' : '字段', + 'General' : '概要', + 'Generated with' : '基于', + 'Name' : '名称', + 'No response values.' : '无返回值.', + 'optional' : '可选', + 'Parameter' : '参数', + 'Permission:' : '权限:', + 'Response' : '返回', + 'Send' : '发送', + 'Send a Sample Request' : '发送示例请求', + 'show up to version:' : '显示到指定版本:', + 'Size range:' : '取值范围:', + 'Type' : '类型', + 'url' : '网址' + } }); diff --git a/apidoc/main.js b/apidoc/main.js index 842ca58b..9d31fa5f 100644 --- a/apidoc/main.js +++ b/apidoc/main.js @@ -1,848 +1,827 @@ require.config({ - paths: { - bootstrap: './vendor/bootstrap.min', - diffMatchPatch: './vendor/diff_match_patch.min', - handlebars: './vendor/handlebars.min', - handlebarsExtended: './utils/handlebars_helper', - jquery: './vendor/jquery.min', - locales: './locales/locale', - lodash: './vendor/lodash.custom.min', - pathToRegexp: './vendor/path-to-regexp/index', - prettify: './vendor/prettify/prettify', - semver: './vendor/semver.min', - utilsSampleRequest: './utils/send_sample_request', - webfontloader: './vendor/webfontloader', - list: './vendor/list.min' - }, - shim: { - bootstrap: { - deps: ['jquery'] + paths: { + bootstrap: './vendor/bootstrap.min', + diffMatchPatch: './vendor/diff_match_patch.min', + handlebars: './vendor/handlebars.min', + handlebarsExtended: './utils/handlebars_helper', + jquery: './vendor/jquery.min', + locales: './locales/locale', + lodash: './vendor/lodash.custom.min', + pathToRegexp: './vendor/path-to-regexp/index', + prettify: './vendor/prettify/prettify', + semver: './vendor/semver.min', + utilsSampleRequest: './utils/send_sample_request', + webfontloader: './vendor/webfontloader', + list: './vendor/list.min' }, - diffMatchPatch: { - exports: 'diff_match_patch' + shim: { + bootstrap: { + deps: ['jquery'] + }, + diffMatchPatch: { + exports: 'diff_match_patch' + }, + handlebars: { + exports: 'Handlebars' + }, + handlebarsExtended: { + deps: ['jquery', 'handlebars'], + exports: 'Handlebars' + }, + prettify: { + exports: 'prettyPrint' + } }, - handlebars: { - exports: 'Handlebars' - }, - handlebarsExtended: { - deps: ['jquery', 'handlebars'], - exports: 'Handlebars' - }, - prettify: { - exports: 'prettyPrint' - } - }, - urlArgs: 'v=' + (new Date()).getTime(), - waitSeconds: 15 + urlArgs: 'v=' + (new Date()).getTime(), + waitSeconds: 15 }); require([ - 'jquery', - 'lodash', - 'locales', - 'handlebarsExtended', - './api_project.js', - './api_data.js', - 'prettify', - 'utilsSampleRequest', - 'semver', - 'webfontloader', - 'bootstrap', - 'pathToRegexp', - 'list' -], function ($, _, locale, Handlebars, apiProject, apiData, prettyPrint, sampleRequest, semver, WebFont) { + 'jquery', + 'lodash', + 'locales', + 'handlebarsExtended', + './api_project.js', + './api_data.js', + 'prettify', + 'utilsSampleRequest', + 'semver', + 'webfontloader', + 'bootstrap', + 'pathToRegexp', + 'list' +], function($, _, locale, Handlebars, apiProject, apiData, prettyPrint, sampleRequest, semver, WebFont) { - // load google web fonts - loadGoogleFontCss(); + // load google web fonts + loadGoogleFontCss(); - var api = apiData.api; + var api = apiData.api; - // - // Templates - // - var templateHeader = Handlebars.compile($('#template-header').html()); - var templateFooter = Handlebars.compile($('#template-footer').html()); - var templateArticle = Handlebars.compile($('#template-article').html()); - var templateCompareArticle = Handlebars.compile($('#template-compare-article').html()); - var templateGenerator = Handlebars.compile($('#template-generator').html()); - var templateProject = Handlebars.compile($('#template-project').html()); - var templateSections = Handlebars.compile($('#template-sections').html()); - var templateSidenav = Handlebars.compile($('#template-sidenav').html()); + // + // Templates + // + var templateHeader = Handlebars.compile( $('#template-header').html() ); + var templateFooter = Handlebars.compile( $('#template-footer').html() ); + var templateArticle = Handlebars.compile( $('#template-article').html() ); + var templateCompareArticle = Handlebars.compile( $('#template-compare-article').html() ); + var templateGenerator = Handlebars.compile( $('#template-generator').html() ); + var templateProject = Handlebars.compile( $('#template-project').html() ); + var templateSections = Handlebars.compile( $('#template-sections').html() ); + var templateSidenav = Handlebars.compile( $('#template-sidenav').html() ); - // - // apiProject defaults - // - if (!apiProject.template) - apiProject.template = {}; + // + // apiProject defaults + // + if ( ! apiProject.template) + apiProject.template = {}; - if (apiProject.template.withCompare == null) - apiProject.template.withCompare = true; + if (apiProject.template.withCompare == null) + apiProject.template.withCompare = true; - if (apiProject.template.withGenerator == null) - apiProject.template.withGenerator = true; + if (apiProject.template.withGenerator == null) + apiProject.template.withGenerator = true; - if (apiProject.template.forceLanguage) - locale.setLanguage(apiProject.template.forceLanguage); + if (apiProject.template.forceLanguage) + locale.setLanguage(apiProject.template.forceLanguage); - // Setup jQuery Ajax - $.ajaxSetup(apiProject.template.jQueryAjaxSetup); + // Setup jQuery Ajax + $.ajaxSetup(apiProject.template.jQueryAjaxSetup); - // - // Data transform - // - // grouped by group - var apiByGroup = _.groupBy(api, function (entry) { - return entry.group; - }); - - // grouped by group and name - var apiByGroupAndName = {}; - $.each(apiByGroup, function (index, entries) { - apiByGroupAndName[index] = _.groupBy(entries, function (entry) { - return entry.name; + // + // Data transform + // + // grouped by group + var apiByGroup = _.groupBy(api, function(entry) { + return entry.group; }); - }); - // - // sort api within a group by title ASC and custom order - // - var newList = []; - var umlauts = { - 'ä': 'ae', - 'ü': 'ue', - 'ö': 'oe', - 'ß': 'ss' - }; // TODO: remove in version 1.0 - $.each(apiByGroupAndName, function (index, groupEntries) { - // get titles from the first entry of group[].name[] (name has versioning) - var titles = []; - $.each(groupEntries, function (titleName, entries) { - var title = entries[0].title; - if (title !== undefined) { - title.toLowerCase().replace(/[äöüß]/g, function ($0) { - return umlauts[$0]; + // grouped by group and name + var apiByGroupAndName = {}; + $.each(apiByGroup, function(index, entries) { + apiByGroupAndName[index] = _.groupBy(entries, function(entry) { + return entry.name; }); - titles.push(title + '#~#' + titleName); // '#~#' keep reference to titleName after sorting - } }); - // sort by name ASC - titles.sort(); + + // + // sort api within a group by title ASC and custom order + // + var newList = []; + var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; // TODO: remove in version 1.0 + $.each (apiByGroupAndName, function(index, groupEntries) { + // get titles from the first entry of group[].name[] (name has versioning) + var titles = []; + $.each (groupEntries, function(titleName, entries) { + var title = entries[0].title; + if(title !== undefined) { + title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; }); + titles.push(title + '#~#' + titleName); // '#~#' keep reference to titleName after sorting + } + }); + // sort by name ASC + titles.sort(); + + // custom order + if (apiProject.order) + titles = sortByOrder(titles, apiProject.order, '#~#'); + + // add single elements to the new list + titles.forEach(function(name) { + var values = name.split('#~#'); + var key = values[1]; + groupEntries[key].forEach(function(entry) { + newList.push(entry); + }); + }); + }); + // api overwrite with ordered list + api = newList; + + // + // Group- and Versionlists + // + var apiGroups = {}; + var apiGroupTitles = {}; + var apiVersions = {}; + apiVersions[apiProject.version] = 1; + + $.each(api, function(index, entry) { + apiGroups[entry.group] = 1; + apiGroupTitles[entry.group] = entry.groupTitle || entry.group; + apiVersions[entry.version] = 1; + }); + + // sort groups + apiGroups = Object.keys(apiGroups); + apiGroups.sort(); // custom order if (apiProject.order) - titles = sortByOrder(titles, apiProject.order, '#~#'); + apiGroups = sortByOrder(apiGroups, apiProject.order); - // add single elements to the new list - titles.forEach(function (name) { - var values = name.split('#~#'); - var key = values[1]; - groupEntries[key].forEach(function (entry) { - newList.push(entry); - }); - }); - }); - // api overwrite with ordered list - api = newList; + // sort versions DESC + apiVersions = Object.keys(apiVersions); + apiVersions.sort(semver.compare); + apiVersions.reverse(); - // - // Group- and Versionlists - // - var apiGroups = {}; - var apiGroupTitles = {}; - var apiVersions = {}; - apiVersions[apiProject.version] = 1; - - $.each(api, function (index, entry) { - apiGroups[entry.group] = 1; - apiGroupTitles[entry.group] = entry.groupTitle || entry.group; - apiVersions[entry.version] = 1; - }); - - // sort groups - apiGroups = Object.keys(apiGroups); - apiGroups.sort(); - - // custom order - if (apiProject.order) - apiGroups = sortByOrder(apiGroups, apiProject.order); - - // sort versions DESC - apiVersions = Object.keys(apiVersions); - apiVersions.sort(semver.compare); - apiVersions.reverse(); - - // - // create Navigationlist - // - var nav = []; - apiGroups.forEach(function (group) { - // Mainmenu entry - nav.push({ - group: group, - isHeader: true, - title: apiGroupTitles[group] - }); - - // Submenu - var oldName = ''; - api.forEach(function (entry) { - if (entry.group === group) { - if (oldName !== entry.name) { - nav.push({ - title: entry.title, - group: group, - name: entry.name, - type: entry.type, - version: entry.version - }); - } else { - nav.push({ - title: entry.title, - group: group, - hidden: true, - name: entry.name, - type: entry.type, - version: entry.version - }); - } - oldName = entry.name; - } - }); - }); - - /** - * Add navigation items by analyzing the HTML content and searching for h1 and h2 tags - * @param nav Object the navigation array - * @param content string the compiled HTML content - * @param index where to insert items - * @return boolean true if any good-looking (i.e. with a group identifier)

    tag was found - */ - function add_nav(nav, content, index) { - var found_level1 = false; - if (!content) { - return found_level1; - } - var topics = content.match(/(.+?)<\/h(1|2)>/gi); - if (topics) { - topics.forEach(function (entry) { - var level = entry.substring(2, 3); - var title = entry.replace(/<.+?>/g, ''); // Remove all HTML tags for the title - var entry_tags = entry.match(/id="api-([^\-]+)(?:-(.+))?"/); // Find the group and name in the id property - var group = (entry_tags ? entry_tags[1] : null); - var name = (entry_tags ? entry_tags[2] : null); - if (level == 1 && title && group) { - nav.splice(index, 0, { + // + // create Navigationlist + // + var nav = []; + apiGroups.forEach(function(group) { + // Mainmenu entry + nav.push({ group: group, isHeader: true, - title: title, - isFixed: true - }); - index++; - found_level1 = true; - } - if (level == 2 && title && group && name) { - nav.splice(index, 0, { - group: group, - name: name, - isHeader: false, - title: title, - isFixed: false, - version: '1.0' - }); - index++; - } - }); - } - return found_level1; - } + title: apiGroupTitles[group] + }); - // Mainmenu Header entry - if (apiProject.header) { - var found_level1 = add_nav(nav, apiProject.header.content, 0); // Add level 1 and 2 titles - if (!found_level1) { // If no Level 1 tags were found, make a title - nav.unshift({ - group: '_', - isHeader: true, - title: (apiProject.header.title == null) ? locale.__('General') : apiProject.header.title, - isFixed: true - }); - } - } - - // Mainmenu Footer entry - if (apiProject.footer) { - var last_nav_index = nav.length; - var found_level1 = add_nav(nav, apiProject.footer.content, nav.length); // Add level 1 and 2 titles - if (!found_level1 && apiProject.footer.title != null) { // If no Level 1 tags were found, make a title - nav.splice(last_nav_index, 0, { - group: '_footer', - isHeader: true, - title: apiProject.footer.title, - isFixed: true - }); - } - } - - // render pagetitle - var title = apiProject.title ? apiProject.title : 'apiDoc: ' + apiProject.name + ' - ' + apiProject.version; - $(document).attr('title', title); - - // remove loader - $('#loader').remove(); - - // render sidenav - var fields = { - nav: nav - }; - $('#sidenav').append(templateSidenav(fields)); - - // render Generator - $('#generator').append(templateGenerator(apiProject)); - - // render Project - _.extend(apiProject, { - versions: apiVersions - }); - $('#project').append(templateProject(apiProject)); - - // render apiDoc, header/footer documentation - if (apiProject.header) - $('#header').append(templateHeader(apiProject.header)); - - if (apiProject.footer) - $('#footer').append(templateFooter(apiProject.footer)); - - // - // Render Sections and Articles - // - var articleVersions = {}; - var content = ''; - apiGroups.forEach(function (groupEntry) { - var articles = []; - var oldName = ''; - var fields = {}; - var title = groupEntry; - var description = ''; - articleVersions[groupEntry] = {}; - - // render all articles of a group - api.forEach(function (entry) { - if (groupEntry === entry.group) { - if (oldName !== entry.name) { - // determine versions - api.forEach(function (versionEntry) { - if (groupEntry === versionEntry.group && entry.name === versionEntry.name) { - if (!articleVersions[entry.group].hasOwnProperty(entry.name)) { - articleVersions[entry.group][entry.name] = []; - } - articleVersions[entry.group][entry.name].push(versionEntry.version); + // Submenu + var oldName = ''; + api.forEach(function(entry) { + if (entry.group === group) { + if (oldName !== entry.name) { + nav.push({ + title: entry.title, + group: group, + name: entry.name, + type: entry.type, + version: entry.version + }); + } else { + nav.push({ + title: entry.title, + group: group, + hidden: true, + name: entry.name, + type: entry.type, + version: entry.version + }); + } + oldName = entry.name; } + }); + }); + + /** + * Add navigation items by analyzing the HTML content and searching for h1 and h2 tags + * @param nav Object the navigation array + * @param content string the compiled HTML content + * @param index where to insert items + * @return boolean true if any good-looking (i.e. with a group identifier)

    tag was found + */ + function add_nav(nav, content, index) { + var found_level1 = false; + if ( ! content) { + return found_level1; + } + var topics = content.match(/(.+?)<\/h(1|2)>/gi); + if ( topics ) { + topics.forEach(function(entry) { + var level = entry.substring(2,3); + var title = entry.replace(/<.+?>/g, ''); // Remove all HTML tags for the title + var entry_tags = entry.match(/id="api-([^\-]+)(?:-(.+))?"/); // Find the group and name in the id property + var group = (entry_tags ? entry_tags[1] : null); + var name = (entry_tags ? entry_tags[2] : null); + if (level==1 && title && group) { + nav.splice(index, 0, { + group: group, + isHeader: true, + title: title, + isFixed: true + }); + index++; + found_level1 = true; + } + if (level==2 && title && group && name) { + nav.splice(index, 0, { + group: group, + name: name, + isHeader: false, + title: title, + isFixed: false, + version: '1.0' + }); + index++; + } }); - fields = { - article: entry, - versions: articleVersions[entry.group][entry.name] - }; - } else { - fields = { - article: entry, - hidden: true, - versions: articleVersions[entry.group][entry.name] - }; + } + return found_level1; + } + + // Mainmenu Header entry + if (apiProject.header) { + var found_level1 = add_nav(nav, apiProject.header.content, 0); // Add level 1 and 2 titles + if (!found_level1) { // If no Level 1 tags were found, make a title + nav.unshift({ + group: '_', + isHeader: true, + title: (apiProject.header.title == null) ? locale.__('General') : apiProject.header.title, + isFixed: true + }); + } + } + + // Mainmenu Footer entry + if (apiProject.footer) { + var last_nav_index = nav.length; + var found_level1 = add_nav(nav, apiProject.footer.content, nav.length); // Add level 1 and 2 titles + if (!found_level1 && apiProject.footer.title != null) { // If no Level 1 tags were found, make a title + nav.splice(last_nav_index, 0, { + group: '_footer', + isHeader: true, + title: apiProject.footer.title, + isFixed: true + }); + } + } + + // render pagetitle + var title = apiProject.title ? apiProject.title : 'apiDoc: ' + apiProject.name + ' - ' + apiProject.version; + $(document).attr('title', title); + + // remove loader + $('#loader').remove(); + + // render sidenav + var fields = { + nav: nav + }; + $('#sidenav').append( templateSidenav(fields) ); + + // render Generator + $('#generator').append( templateGenerator(apiProject) ); + + // render Project + _.extend(apiProject, { versions: apiVersions}); + $('#project').append( templateProject(apiProject) ); + + // render apiDoc, header/footer documentation + if (apiProject.header) + $('#header').append( templateHeader(apiProject.header) ); + + if (apiProject.footer) + $('#footer').append( templateFooter(apiProject.footer) ); + + // + // Render Sections and Articles + // + var articleVersions = {}; + var content = ''; + apiGroups.forEach(function(groupEntry) { + var articles = []; + var oldName = ''; + var fields = {}; + var title = groupEntry; + var description = ''; + articleVersions[groupEntry] = {}; + + // render all articles of a group + api.forEach(function(entry) { + if(groupEntry === entry.group) { + if (oldName !== entry.name) { + // determine versions + api.forEach(function(versionEntry) { + if (groupEntry === versionEntry.group && entry.name === versionEntry.name) { + if ( ! articleVersions[entry.group].hasOwnProperty(entry.name) ) { + articleVersions[entry.group][entry.name] = []; + } + articleVersions[entry.group][entry.name].push(versionEntry.version); + } + }); + fields = { + article: entry, + versions: articleVersions[entry.group][entry.name] + }; + } else { + fields = { + article: entry, + hidden: true, + versions: articleVersions[entry.group][entry.name] + }; + } + + // add prefix URL for endpoint + if (apiProject.url) + fields.article.url = apiProject.url + fields.article.url; + + addArticleSettings(fields, entry); + + if (entry.groupTitle) + title = entry.groupTitle; + + // TODO: make groupDescription compareable with older versions (not important for the moment) + if (entry.groupDescription) + description = entry.groupDescription; + + articles.push({ + article: templateArticle(fields), + group: entry.group, + name: entry.name + }); + oldName = entry.name; + } + }); + + // render Section with Articles + var fields = { + group: groupEntry, + title: title, + description: description, + articles: articles + }; + content += templateSections(fields); + }); + $('#sections').append( content ); + + // Bootstrap Scrollspy + $(this).scrollspy({ target: '#scrollingNav', offset: 18 }); + + // Content-Scroll on Navigation click. + $('.sidenav').find('a').on('click', function(e) { + e.preventDefault(); + var id = $(this).attr('href'); + if ($(id).length > 0) + $('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400); + window.location.hash = $(this).attr('href'); + }); + + // Quickjump on Pageload to hash position. + if(window.location.hash) { + var id = window.location.hash; + if ($(id).length > 0) + $('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0); + } + + /** + * Check if Parameter (sub) List has a type Field. + * Example: @apiSuccess varname1 No type. + * @apiSuccess {String} varname2 With type. + * + * @param {Object} fields + */ + function _hasTypeInFields(fields) { + var result = false; + $.each(fields, function(name) { + result = result || _.some(fields[name], function(item) { return item.type; }); + }); + return result; + } + + /** + * On Template changes, recall plugins. + */ + function initDynamic() { + // Bootstrap popover + $('button[data-toggle="popover"]').popover().click(function(e) { + e.preventDefault(); + }); + + var version = $('#version strong').html(); + $('#sidenav li').removeClass('is-new'); + if (apiProject.template.withCompare) { + $('#sidenav li[data-version=\'' + version + '\']').each(function(){ + var group = $(this).data('group'); + var name = $(this).data('name'); + var length = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').length; + var index = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').index($(this)); + if (length === 1 || index === (length - 1)) + $(this).addClass('is-new'); + }); } - // add prefix URL for endpoint - if (apiProject.url) - fields.article.url = apiProject.url + fields.article.url; + // tabs + $('.nav-tabs-examples a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + }); + $('.nav-tabs-examples').find('a:first').tab('show'); + + // sample request switch + $('.sample-request-switch').click(function (e) { + var name = '.' + $(this).attr('name') + '-fields'; + $(name).addClass('hide'); + $(this).parent().next(name).removeClass('hide'); + }); + + // call scrollspy refresh method + $(window).scrollspy('refresh'); + + // init modules + sampleRequest.initDynamic(); + } + initDynamic(); + + // Pre- / Code-Format + prettyPrint(); + + // + // HTML-Template specific jQuery-Functions + // + // Change Main Version + $('#versions li.version a').on('click', function(e) { + e.preventDefault(); + + var selectedVersion = $(this).html(); + $('#version strong').html(selectedVersion); + + // hide all + $('article').addClass('hide'); + $('#sidenav li:not(.nav-fixed)').addClass('hide'); + + // show 1st equal or lower Version of each entry + $('article[data-version]').each(function(index) { + var group = $(this).data('group'); + var name = $(this).data('name'); + var version = $(this).data('version'); + + if (semver.lte(version, selectedVersion)) { + if ($('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible').length === 0) { + // enable Article + $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); + // enable Navigation + $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); + $('#sidenav li.nav-header[data-group=\'' + group + '\']').removeClass('hide'); + } + } + }); + + // show 1st equal or lower Version of each entry + $('article[data-version]').each(function(index) { + var group = $(this).data('group'); + $('section#api-' + group).removeClass('hide'); + if ($('section#api-' + group + ' article:visible').length === 0) { + $('section#api-' + group).addClass('hide'); + } else { + $('section#api-' + group).removeClass('hide'); + } + }); + + initDynamic(); + return; + }); + + // compare all article with their predecessor + $('#compareAllWithPredecessor').on('click', changeAllVersionCompareTo); + + // change version of an article + $('article .versions li.version a').on('click', changeVersionCompareTo); + + // compare url-parameter + $.urlParam = function(name) { + var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); + return (results && results[1]) ? results[1] : null; + }; + + if ($.urlParam('compare')) { + // URL Paramter ?compare=1 is set + $('#compareAllWithPredecessor').trigger('click'); + + if (window.location.hash) { + var id = window.location.hash; + $('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0); + } + } + + /** + * Initialize search + */ + var options = { + valueNames: [ 'nav-list-item' ] + }; + var endpointsList = new List('scrollingNav', options); + + /** + * Set initial focus to search input + */ + $('#scrollingNav .sidenav-search input.search').focus(); + + /** + * Detect ESC key to reset search + */ + $(document).keyup(function(e) { + if (e.keyCode === 27) $('span.search-reset').click(); + }); + + /** + * Search reset + */ + $('span.search-reset').on('click', function() { + $('#scrollingNav .sidenav-search input.search') + .val("") + .focus() + ; + endpointsList.search(); + }); + + /** + * Change version of an article to compare it to an other version. + */ + function changeVersionCompareTo(e) { + e.preventDefault(); + + var $root = $(this).parents('article'); + var selectedVersion = $(this).html(); + var $button = $root.find('.version'); + var currentVersion = $button.find('strong').html(); + $button.find('strong').html(selectedVersion); + + var group = $root.data('group'); + var name = $root.data('name'); + var version = $root.data('version'); + + var compareVersion = $root.data('compare-version'); + + if (compareVersion === selectedVersion) + return; + + if ( ! compareVersion && version == selectedVersion) + return; + + if (compareVersion && articleVersions[group][name][0] === selectedVersion || version === selectedVersion) { + // the version of the entry is set to the highest version (reset) + resetArticle(group, name, version); + } else { + var $compareToArticle = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + selectedVersion + '\']'); + + var sourceEntry = {}; + var compareEntry = {}; + $.each(apiByGroupAndName[group][name], function(index, entry) { + if (entry.version === version) + sourceEntry = entry; + if (entry.version === selectedVersion) + compareEntry = entry; + }); + + var fields = { + article: sourceEntry, + compare: compareEntry, + versions: articleVersions[group][name] + }; + + // add unique id + // TODO: replace all group-name-version in template with id. + fields.article.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; + fields.article.id = fields.article.id.replace(/\./g, '_'); + + fields.compare.id = fields.compare.group + '-' + fields.compare.name + '-' + fields.compare.version; + fields.compare.id = fields.compare.id.replace(/\./g, '_'); + + var entry = sourceEntry; + if (entry.parameter && entry.parameter.fields) + fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); + + if (entry.error && entry.error.fields) + fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); + + if (entry.success && entry.success.fields) + fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); + + if (entry.info && entry.info.fields) + fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); + + var entry = compareEntry; + if (fields._hasTypeInParameterFields !== true && entry.parameter && entry.parameter.fields) + fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); + + if (fields._hasTypeInErrorFields !== true && entry.error && entry.error.fields) + fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); + + if (fields._hasTypeInSuccessFields !== true && entry.success && entry.success.fields) + fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); + + if (fields._hasTypeInInfoFields !== true && entry.info && entry.info.fields) + fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); + + var content = templateCompareArticle(fields); + $root.after(content); + var $content = $root.next(); + + // Event on.click re-assign + $content.find('.versions li.version a').on('click', changeVersionCompareTo); + + // select navigation + $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + currentVersion + '\']').addClass('has-modifications'); + + $root.remove(); + // TODO: on change main version or select the highest version re-render + } + + initDynamic(); + } + + /** + * Compare all currently selected Versions with their predecessor. + */ + function changeAllVersionCompareTo(e) { + e.preventDefault(); + $('article:visible .versions').each(function(){ + var $root = $(this).parents('article'); + var currentVersion = $root.data('version'); + var $foundElement = null; + $(this).find('li.version a').each(function() { + var selectVersion = $(this).html(); + if (selectVersion < currentVersion && ! $foundElement) + $foundElement = $(this); + }); + + if($foundElement) + $foundElement.trigger('click'); + }); + initDynamic(); + } + + /** + * Sort the fields. + */ + function sortFields(fields_object) { + $.each(fields_object, function (key, fields) { + + var reversed = fields.slice().reverse() + + var max_dot_count = Math.max.apply(null, reversed.map(function (item) { + return item.field.split(".").length - 1; + })) + + for (var dot_count = 1; dot_count <= max_dot_count; dot_count++) { + reversed.forEach(function (item, index) { + var parts = item.field.split("."); + if (parts.length - 1 == dot_count) { + var fields_names = fields.map(function (item) { return item.field; }); + if (parts.slice(1).length >= 1) { + var prefix = parts.slice(0, parts.length - 1).join("."); + var prefix_index = fields_names.indexOf(prefix); + if (prefix_index > -1) { + fields.splice(fields_names.indexOf(item.field), 1); + fields.splice(prefix_index + 1, 0, item); + } + } + } + }); + } + }); + } + + /** + * Add article settings. + */ + function addArticleSettings(fields, entry) { + // add unique id + // TODO: replace all group-name-version in template with id. + fields.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; + fields.id = fields.id.replace(/\./g, '_'); + + if (entry.header && entry.header.fields) { + sortFields(entry.header.fields); + fields._hasTypeInHeaderFields = _hasTypeInFields(entry.header.fields); + } + + if (entry.parameter && entry.parameter.fields) { + sortFields(entry.parameter.fields); + fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); + } + + if (entry.error && entry.error.fields) { + sortFields(entry.error.fields); + fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); + } + + if (entry.success && entry.success.fields) { + sortFields(entry.success.fields); + fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); + } + + if (entry.info && entry.info.fields) { + sortFields(entry.info.fields); + fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); + } + + // add template settings + fields.template = apiProject.template; + } + + /** + * Render Article. + */ + function renderArticle(group, name, version) { + var entry = {}; + $.each(apiByGroupAndName[group][name], function(index, currentEntry) { + if (currentEntry.version === version) + entry = currentEntry; + }); + var fields = { + article: entry, + versions: articleVersions[group][name] + }; addArticleSettings(fields, entry); - if (entry.groupTitle) - title = entry.groupTitle; - - // TODO: make groupDescription compareable with older versions (not important for the moment) - if (entry.groupDescription) - description = entry.groupDescription; - - articles.push({ - article: templateArticle(fields), - group: entry.group, - name: entry.name - }); - oldName = entry.name; - } - }); - - // render Section with Articles - var fields = { - group: groupEntry, - title: title, - description: description, - articles: articles - }; - content += templateSections(fields); - }); - $('#sections').append(content); - - // Bootstrap Scrollspy - $(this).scrollspy({ - target: '#scrollingNav', - offset: 18 - }); - - // Content-Scroll on Navigation click. - $('.sidenav').find('a').on('click', function (e) { - e.preventDefault(); - var id = $(this).attr('href'); - if ($(id).length > 0) - $('html,body').animate({ - scrollTop: parseInt($(id).offset().top) - }, 400); - window.location.hash = $(this).attr('href'); - }); - - // Quickjump on Pageload to hash position. - if (window.location.hash) { - var id = window.location.hash; - if ($(id).length > 0) - $('html,body').animate({ - scrollTop: parseInt($(id).offset().top) - }, 0); - } - - /** - * Check if Parameter (sub) List has a type Field. - * Example: @apiSuccess varname1 No type. - * @apiSuccess {String} varname2 With type. - * - * @param {Object} fields - */ - function _hasTypeInFields(fields) { - var result = false; - $.each(fields, function (name) { - result = result || _.some(fields[name], function (item) { - return item.type; - }); - }); - return result; - } - - /** - * On Template changes, recall plugins. - */ - function initDynamic() { - // Bootstrap popover - $('button[data-toggle="popover"]').popover().click(function (e) { - e.preventDefault(); - }); - - var version = $('#version strong').html(); - $('#sidenav li').removeClass('is-new'); - if (apiProject.template.withCompare) { - $('#sidenav li[data-version=\'' + version + '\']').each(function () { - var group = $(this).data('group'); - var name = $(this).data('name'); - var length = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').length; - var index = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').index($(this)); - if (length === 1 || index === (length - 1)) - $(this).addClass('is-new'); - }); + return templateArticle(fields); } - // tabs - $('.nav-tabs-examples a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - }); - $('.nav-tabs-examples').find('a:first').tab('show'); + /** + * Render original Article and remove the current visible Article. + */ + function resetArticle(group, name, version) { + var $root = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible'); + var content = renderArticle(group, name, version); - // sample request switch - $('.sample-request-switch').click(function (e) { - var name = '.' + $(this).attr('name') + '-fields'; - $(name).addClass('hide'); - $(this).parent().next(name).removeClass('hide'); - }); + $root.after(content); + var $content = $root.next(); - // call scrollspy refresh method - $(window).scrollspy('refresh'); + // Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) + $content.find('.versions li.version a').on('click', changeVersionCompareTo); - // init modules - sampleRequest.initDynamic(); - } - initDynamic(); + $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('has-modifications'); - // Pre- / Code-Format - prettyPrint(); - - // - // HTML-Template specific jQuery-Functions - // - // Change Main Version - $('#versions li.version a').on('click', function (e) { - e.preventDefault(); - - var selectedVersion = $(this).html(); - $('#version strong').html(selectedVersion); - - // hide all - $('article').addClass('hide'); - $('#sidenav li:not(.nav-fixed)').addClass('hide'); - - // show 1st equal or lower Version of each entry - $('article[data-version]').each(function (index) { - var group = $(this).data('group'); - var name = $(this).data('name'); - var version = $(this).data('version'); - - if (semver.lte(version, selectedVersion)) { - if ($('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible').length === 0) { - // enable Article - $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); - // enable Navigation - $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); - $('#sidenav li.nav-header[data-group=\'' + group + '\']').removeClass('hide'); - } - } - }); - - // show 1st equal or lower Version of each entry - $('article[data-version]').each(function (index) { - var group = $(this).data('group'); - $('section#api-' + group).removeClass('hide'); - if ($('section#api-' + group + ' article:visible').length === 0) { - $('section#api-' + group).addClass('hide'); - } else { - $('section#api-' + group).removeClass('hide'); - } - }); - - initDynamic(); - return; - }); - - // compare all article with their predecessor - $('#compareAllWithPredecessor').on('click', changeAllVersionCompareTo); - - // change version of an article - $('article .versions li.version a').on('click', changeVersionCompareTo); - - // compare url-parameter - $.urlParam = function (name) { - var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); - return (results && results[1]) ? results[1] : null; - }; - - if ($.urlParam('compare')) { - // URL Paramter ?compare=1 is set - $('#compareAllWithPredecessor').trigger('click'); - - if (window.location.hash) { - var id = window.location.hash; - $('html,body').animate({ - scrollTop: parseInt($(id).offset().top) - 18 - }, 0); - } - } - - /** - * Initialize search - */ - var options = { - valueNames: ['nav-list-item'] - }; - var endpointsList = new List('scrollingNav', options); - - /** - * Set initial focus to search input - */ - $('#scrollingNav .sidenav-search input.search').focus(); - - /** - * Detect ESC key to reset search - */ - $(document).keyup(function (e) { - if (e.keyCode === 27) $('span.search-reset').click(); - }); - - /** - * Search reset - */ - $('span.search-reset').on('click', function () { - $('#scrollingNav .sidenav-search input.search') - .val("") - .focus(); - endpointsList.search(); - }); - - /** - * Change version of an article to compare it to an other version. - */ - function changeVersionCompareTo(e) { - e.preventDefault(); - - var $root = $(this).parents('article'); - var selectedVersion = $(this).html(); - var $button = $root.find('.version'); - var currentVersion = $button.find('strong').html(); - $button.find('strong').html(selectedVersion); - - var group = $root.data('group'); - var name = $root.data('name'); - var version = $root.data('version'); - - var compareVersion = $root.data('compare-version'); - - if (compareVersion === selectedVersion) - return; - - if (!compareVersion && version == selectedVersion) - return; - - if (compareVersion && articleVersions[group][name][0] === selectedVersion || version === selectedVersion) { - // the version of the entry is set to the highest version (reset) - resetArticle(group, name, version); - } else { - var $compareToArticle = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + selectedVersion + '\']'); - - var sourceEntry = {}; - var compareEntry = {}; - $.each(apiByGroupAndName[group][name], function (index, entry) { - if (entry.version === version) - sourceEntry = entry; - if (entry.version === selectedVersion) - compareEntry = entry; - }); - - var fields = { - article: sourceEntry, - compare: compareEntry, - versions: articleVersions[group][name] - }; - - // add unique id - // TODO: replace all group-name-version in template with id. - fields.article.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; - fields.article.id = fields.article.id.replace(/\./g, '_'); - - fields.compare.id = fields.compare.group + '-' + fields.compare.name + '-' + fields.compare.version; - fields.compare.id = fields.compare.id.replace(/\./g, '_'); - - var entry = sourceEntry; - if (entry.parameter && entry.parameter.fields) - fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); - - if (entry.error && entry.error.fields) - fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); - - if (entry.success && entry.success.fields) - fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); - - if (entry.info && entry.info.fields) - fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); - - var entry = compareEntry; - if (fields._hasTypeInParameterFields !== true && entry.parameter && entry.parameter.fields) - fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); - - if (fields._hasTypeInErrorFields !== true && entry.error && entry.error.fields) - fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); - - if (fields._hasTypeInSuccessFields !== true && entry.success && entry.success.fields) - fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); - - if (fields._hasTypeInInfoFields !== true && entry.info && entry.info.fields) - fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); - - var content = templateCompareArticle(fields); - $root.after(content); - var $content = $root.next(); - - // Event on.click re-assign - $content.find('.versions li.version a').on('click', changeVersionCompareTo); - - // select navigation - $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + currentVersion + '\']').addClass('has-modifications'); - - $root.remove(); - // TODO: on change main version or select the highest version re-render + $root.remove(); + return; } - initDynamic(); - } - - /** - * Compare all currently selected Versions with their predecessor. - */ - function changeAllVersionCompareTo(e) { - e.preventDefault(); - $('article:visible .versions').each(function () { - var $root = $(this).parents('article'); - var currentVersion = $root.data('version'); - var $foundElement = null; - $(this).find('li.version a').each(function () { - var selectVersion = $(this).html(); - if (selectVersion < currentVersion && !$foundElement) - $foundElement = $(this); - }); - - if ($foundElement) - $foundElement.trigger('click'); - }); - initDynamic(); - } - - /** - * Sort the fields. - */ - function sortFields(fields_object) { - $.each(fields_object, function (key, fields) { - - var reversed = fields.slice().reverse() - - var max_dot_count = Math.max.apply(null, reversed.map(function (item) { - return item.field.split(".").length - 1; - })) - - for (var dot_count = 1; dot_count <= max_dot_count; dot_count++) { - reversed.forEach(function (item, index) { - var parts = item.field.split("."); - if (parts.length - 1 == dot_count) { - var fields_names = fields.map(function (item) { - return item.field; - }); - if (parts.slice(1).length >= 1) { - var prefix = parts.slice(0, parts.length - 1).join("."); - var prefix_index = fields_names.indexOf(prefix); - if (prefix_index > -1) { - fields.splice(fields_names.indexOf(item.field), 1); - fields.splice(prefix_index + 1, 0, item); - } + /** + * Load google fonts. + */ + function loadGoogleFontCss() { + WebFont.load({ + active: function() { + // Update scrollspy + $(window).scrollspy('refresh') + }, + google: { + families: ['Source Code Pro', 'Source Sans Pro:n4,n6,n7'] } - } }); - } - }); - } - - /** - * Add article settings. - */ - function addArticleSettings(fields, entry) { - // add unique id - // TODO: replace all group-name-version in template with id. - fields.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; - fields.id = fields.id.replace(/\./g, '_'); - - if (entry.header && entry.header.fields) { - sortFields(entry.header.fields); - fields._hasTypeInHeaderFields = _hasTypeInFields(entry.header.fields); } - if (entry.parameter && entry.parameter.fields) { - sortFields(entry.parameter.fields); - fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); - } - - if (entry.error && entry.error.fields) { - sortFields(entry.error.fields); - fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); - } - - if (entry.success && entry.success.fields) { - sortFields(entry.success.fields); - fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); - } - - if (entry.info && entry.info.fields) { - sortFields(entry.info.fields); - fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); - } - - // add template settings - fields.template = apiProject.template; - } - - /** - * Render Article. - */ - function renderArticle(group, name, version) { - var entry = {}; - $.each(apiByGroupAndName[group][name], function (index, currentEntry) { - if (currentEntry.version === version) - entry = currentEntry; - }); - var fields = { - article: entry, - versions: articleVersions[group][name] - }; - - addArticleSettings(fields, entry); - - return templateArticle(fields); - } - - /** - * Render original Article and remove the current visible Article. - */ - function resetArticle(group, name, version) { - var $root = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible'); - var content = renderArticle(group, name, version); - - $root.after(content); - var $content = $root.next(); - - // Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) - $content.find('.versions li.version a').on('click', changeVersionCompareTo); - - $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('has-modifications'); - - $root.remove(); - return; - } - - /** - * Load google fonts. - */ - function loadGoogleFontCss() { - WebFont.load({ - active: function () { - // Update scrollspy - $(window).scrollspy('refresh') - }, - google: { - families: ['Source Code Pro', 'Source Sans Pro:n4,n6,n7'] - } - }); - } - - /** - * Return ordered entries by custom order and append not defined entries to the end. - * @param {String[]} elements - * @param {String[]} order - * @param {String} splitBy - * @return {String[]} Custom ordered list. - */ - function sortByOrder(elements, order, splitBy) { - var results = []; - order.forEach(function (name) { - if (splitBy) - elements.forEach(function (element) { - var parts = element.split(splitBy); - var key = parts[1]; // reference keep for sorting - if (key == name) - results.push(element); + /** + * Return ordered entries by custom order and append not defined entries to the end. + * @param {String[]} elements + * @param {String[]} order + * @param {String} splitBy + * @return {String[]} Custom ordered list. + */ + function sortByOrder(elements, order, splitBy) { + var results = []; + order.forEach (function(name) { + if (splitBy) + elements.forEach (function(element) { + var parts = element.split(splitBy); + var key = parts[1]; // reference keep for sorting + if (key == name) + results.push(element); + }); + else + elements.forEach (function(key) { + if (key == name) + results.push(name); + }); }); - else - elements.forEach(function (key) { - if (key == name) - results.push(name); + // Append all other entries that ar not defined in order + elements.forEach(function(element) { + if (results.indexOf(element) === -1) + results.push(element); }); - }); - // Append all other entries that ar not defined in order - elements.forEach(function (element) { - if (results.indexOf(element) === -1) - results.push(element); - }); - return results; - } + return results; + } }); diff --git a/controllers/api/api.go b/controllers/api/api.go index 6fd52a84..c0ac1a38 100644 --- a/controllers/api/api.go +++ b/controllers/api/api.go @@ -515,7 +515,7 @@ func APILoginHandler(c *gin.Context) { } /** - * @api {post} /profile/ Get a user profile + * @api {get} /profile/ Get a user profile * @apiVersion 1.1.1 * @apiName Profile * @apiGroup Users