add api docs

This commit is contained in:
rolux 2014-12-18 13:38:20 +00:00
parent 3a6c3338a2
commit cf836ec172
4 changed files with 33 additions and 18 deletions

View file

@ -162,8 +162,10 @@ def addAnnotation(request, data):
} }
returns { returns {
id: string, // annotation id id: string, // annotation id
... ... // more annotation properties
} }
see: addAnnotation, editAnnotation, findAnnotations, getAnnotation,
getTaskStatus, removeAnnotation
''' '''
for key in ('item', 'layer', 'in', 'out', 'value'): for key in ('item', 'layer', 'in', 'out', 'value'):
if key not in data: if key not in data:
@ -213,13 +215,14 @@ def addAnnotations(request, data):
out: float, // out point in seconds out: float, // out point in seconds
value: string // annotation value value: string // annotation value
}, },
... ... // more annotations
] ]
} }
returns { returns {
taskId: string taskId: string // task id, use `getTaskStatus` to poll
} }
FIXME: Explain what to do with task id see: addAnnotation, editAnnotation, findAnnotations, getAnnotation,
getTaskStatus, removeAnnotation
''' '''
for key in ('item', 'layer', 'annotations'): for key in ('item', 'layer', 'annotations'):
if key not in data: if key not in data:

View file

@ -323,6 +323,18 @@ def direct_upload(request):
@login_required_json @login_required_json
def taskStatus(request, data): def taskStatus(request, data):
'''
Gets the status for a task
takes {
taskId: string // taskId
}
returns {
taskId: string, // taskId
status: string, // status, 'PENDING' or 'OK'
result: object // result data
}
note: To be deprecated, will be wrapped in regular API call
'''
#FIXME: should check if user has permissions to get status #FIXME: should check if user has permissions to get status
if 'taskId' in data: if 'taskId' in data:
task_id = data['taskId'] task_id = data['taskId']

View file

@ -30,24 +30,23 @@ def addClips(request, data):
''' '''
Adds one or more clips to an edit Adds one or more clips to an edit
takes { takes {
edit: string (edit id), edit: string, // edit id,
index: int (position, optional), index: integer, // position within edit (optional),
clips: [ clips: [
{ {
item: string (item id), item: string, // item id
in: float, in: float, // in point in seconds
out: float, out: float, // out point in seconds
}, },
{ {
annotation: string ("item_id/annotation_id") annotation: string, // 'item_id/annotation_id'
} }
... ... // more clips
] ]
} }
returns {} returns {}
Clips are either {item, in, out} or {annotation}. If index is missing, notes: Clips are either {item, in, out} or {annotation}. If index is
clips will be inserted at the end of the edit. missing, clips will be inserted at the end of the edit.
FIXME: Does this really return nothing?
''' '''
response = json_response() response = json_response()
edit = get_edit_or_404_json(data['edit']) edit = get_edit_or_404_json(data['edit'])

View file

@ -531,13 +531,14 @@ def add(request, data):
''' '''
Adds a new item (without video) Adds a new item (without video)
takes { takes {
title: string, // optional title: string, // item title (optional)
} }
returns { returns {
id: string, id: string, // item id
title: string, title: string, // item title
... ... // more item properties
} }
see: edit, find, get, remove, upload
''' '''
if not request.user.get_profile().capability('canAddItems'): if not request.user.get_profile().capability('canAddItems'):
response = json_response(status=403, text='permissino denied') response = json_response(status=403, text='permissino denied')