More API documentation
This commit is contained in:
1 parent
a5cc1859d1
commit
b164674ff7
7 files changed
+88
-31
No files matched your search
@@ -33,15 +33,12 @@ class Updater(Plugin):
|
|||||||
'desc': 'Get updater information',
|
'desc': 'Get updater information',
|
||||||
'return': {
|
'return': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'example': """
|
'example': """{
|
||||||
{
|
'repo_name': "Name of used repository",
|
||||||
'repo_name': "Name of used repository",
|
'last_check': "last checked for update",
|
||||||
'last_check': "last checked for update",
|
'update_version': "available update version or empty",
|
||||||
'update_version': "available update version or empty",
|
'version': current_cp_version
|
||||||
'version': current_cp_version
|
}"""}
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
addApiView('updater.update', self.doUpdateView)
|
addApiView('updater.update', self.doUpdateView)
|
||||||
addApiView('updater.check', self.checkView, docs = {
|
addApiView('updater.check', self.checkView, docs = {
|
||||||
|
|||||||
@@ -58,10 +58,28 @@ class MoviePlugin(Plugin):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
addApiView('movie.available_chars', self.charView)
|
addApiView('movie.available_chars', self.charView)
|
||||||
|
addApiView('movie.add', self.addView, docs = {
|
||||||
addApiView('movie.add', self.addView)
|
'desc': 'Add new movie to the wanted list',
|
||||||
addApiView('movie.edit', self.edit)
|
'params': {
|
||||||
addApiView('movie.delete', self.delete)
|
'identifier': {'desc': 'IMDB id of the movie your want to add.'},
|
||||||
|
'profile_id': {'desc': 'ID of quality profile you want the add the movie in. If empty will use the default profile.'},
|
||||||
|
'title': {'desc': 'Movie title to use for searches. Has to be one of the titles returned by movie.search.'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
addApiView('movie.edit', self.edit, docs = {
|
||||||
|
'desc': 'Add new movie to the wanted list',
|
||||||
|
'params': {
|
||||||
|
'id': {'desc': 'Movie ID you want to edit'},
|
||||||
|
'profile_id': {'desc': 'ID of quality profile you want the edit the movie to.'},
|
||||||
|
'default_title': {'desc': 'Movie title to use for searches. Has to be one of the titles returned by movie.search.'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
addApiView('movie.delete', self.delete, docs = {
|
||||||
|
'desc': 'Delete a movie from the wanted list',
|
||||||
|
'params': {
|
||||||
|
'id': {'desc': 'Movie ID you want to delete'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
addEvent('movie.add', self.add)
|
addEvent('movie.add', self.add)
|
||||||
addEvent('movie.get', self.get)
|
addEvent('movie.get', self.get)
|
||||||
|
|||||||
@@ -16,8 +16,18 @@ class Release(Plugin):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
addEvent('release.add', self.add)
|
addEvent('release.add', self.add)
|
||||||
|
|
||||||
addApiView('release.download', self.download)
|
addApiView('release.download', self.download, docs = {
|
||||||
addApiView('release.delete', self.delete)
|
'desc': 'Send a release manually to the downloaders',
|
||||||
|
'params': {
|
||||||
|
'id': {'type': 'id', 'desc': 'ID of the release object in release-table'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
addApiView('release.delete', self.delete, docs = {
|
||||||
|
'desc': 'Check for available update',
|
||||||
|
'params': {
|
||||||
|
'id': {'type': 'id', 'desc': 'ID of the release object in release-table'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
def add(self, group):
|
def add(self, group):
|
||||||
db = get_session()
|
db = get_session()
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
addApiView('renamer.scan', self.scanView)
|
addApiView('renamer.scan', self.scanView, docs = {
|
||||||
|
'desc': 'For the renamer to check for new files to rename',
|
||||||
|
})
|
||||||
|
|
||||||
addEvent('renamer.scan', self.scan)
|
addEvent('renamer.scan', self.scan)
|
||||||
addEvent('app.load', self.scan)
|
addEvent('app.load', self.scan)
|
||||||
@@ -31,7 +33,7 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
def scanView(self):
|
def scanView(self):
|
||||||
|
|
||||||
fireEvent('renamer.scan')
|
fireEventAsync('renamer.scan')
|
||||||
|
|
||||||
return jsonified({
|
return jsonified({
|
||||||
'success': True
|
'success': True
|
||||||
|
|||||||
@@ -29,7 +29,13 @@ class StatusPlugin(Plugin):
|
|||||||
addEvent('status.all', self.all)
|
addEvent('status.all', self.all)
|
||||||
addEvent('app.initialize', self.fill)
|
addEvent('app.initialize', self.fill)
|
||||||
|
|
||||||
addApiView('status.list', self.list)
|
addApiView('status.list', self.list, docs = {
|
||||||
|
'desc': 'Check for available update',
|
||||||
|
'return': {'type': 'object', 'example': """{
|
||||||
|
'success': True,
|
||||||
|
'list': array, statuses
|
||||||
|
}"""}
|
||||||
|
})
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
@@ -5,15 +6,22 @@ html {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, h5 {
|
h1, h2, h3, h4, h5 {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
|
padding: 20px 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
@@ -21,18 +29,23 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
background: #ccc;
|
background: #eee;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 2%;
|
padding: 10px;
|
||||||
width: 96%;
|
width: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api {
|
.api, .missing {
|
||||||
margin-bottom: 20px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
padding: 40px;
|
||||||
}
|
}
|
||||||
|
.api:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
.api .description {
|
.api .description {
|
||||||
color: #333;
|
color: #333;
|
||||||
@@ -40,7 +53,7 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.api .params {
|
.api .params {
|
||||||
background: #f5f5f5;
|
background: #fafafa;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.api h3 {
|
.api h3 {
|
||||||
@@ -54,6 +67,14 @@ pre {
|
|||||||
width: 700px;
|
width: 700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.api .params td, .api .params th {
|
||||||
|
padding: 3px 5px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
.api .params tr:last-child td, .api .params tr:last-child th {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.api .params .param {
|
.api .params .param {
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
@@ -67,9 +88,10 @@ pre {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api .return {
|
.api .return {
|
||||||
float: left;
|
float: left;
|
||||||
width: 700px;
|
width: 700px;
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>API</h1>
|
<h1>CouchPotato API Documentation</h1>
|
||||||
{% for route in routes %}
|
{% for route in routes %}
|
||||||
{% if api_docs.get(route) %}
|
{% if api_docs.get(route) %}
|
||||||
<div class="api">
|
<div class="api">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
{% if api_docs[route].get('params') %}
|
{% if api_docs[route].get('params') %}
|
||||||
<h3>Params</h3>
|
<h3>Params</h3>
|
||||||
<table class="params">
|
<table class="params" cellspacing="0" cellpadding="0">
|
||||||
{% for param in api_docs[route]['params'] %}
|
{% for param in api_docs[route]['params'] %}
|
||||||
<tr class="param">
|
<tr class="param">
|
||||||
<th>{{param}}</th>
|
<th>{{param}}</th>
|
||||||
@@ -42,8 +42,10 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<h1>Missing documentation</h1>
|
<div class="missing">
|
||||||
<div class="missing">{{', '.join(api_docs_missing)}}</div>
|
<h1>Missing documentation</h1>
|
||||||
|
{{', '.join(api_docs_missing)}}
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user