Example #1
0
File: api.py Project: DColl/Flexget
def cs_root():
    root_schema = get_schema()
    hyper_schema = {'properties': {}, 'links': [{'self': '/api/config/'}]}
    hs_props = hyper_schema['properties']
    for key, key_schema in root_schema.get('properties', {}).iteritems():
        hs_props[key] = {'links': [{'rel': 'self', 'href': key}]}
        if key not in root_schema.get('required', []):
            hs_props[key]['links'].append({'rel': 'delete', 'href': '', 'method': 'DELETE'})
Example #2
0
def cs_tasks(root_key):
    root_schema = get_schema()
    if root_key not in root_schema['properties']:
        return 'Not found', 404
    hyper_schema = {
        'links': [{
            'rel': 'edit',
            'href': 'PUT',
        }]
    }
    return root_schema['properties'][root_key]
Example #3
0
def cs_root():
    root_schema = get_schema()
    hyper_schema = {'properties': {}, 'links': [{'self': '/api/config/'}]}
    hs_props = hyper_schema['properties']
    for key, key_schema in root_schema.get('properties', {}).iteritems():
        hs_props[key] = {'links': [{'rel': 'self', 'href': key}]}
        if key not in root_schema.get('required', []):
            hs_props[key]['links'].append({
                'rel': 'delete',
                'href': '',
                'method': 'DELETE'
            })
Example #4
0
def cs_root():
    root_schema = get_schema()
    hyper_schema = root_schema.copy()
    hyper_schema['links'] = [{'rel': 'self', 'href': '/api/config/'}]
    hyper_schema['properties'] = root_schema.get('properties', {}).copy()
    hs_props = hyper_schema['properties']
    for key, key_schema in root_schema.get('properties', {}).iteritems():
        hs_props[key] = hs_props[key].copy()
        hs_props[key]['links'] = [{'rel': 'self', 'href': key}]
        if key not in root_schema.get('required', []):
            hs_props[key]['links'].append({'rel': 'delete', 'href': '', 'method': 'DELETE'})
    return jsonify(hyper_schema)
Example #5
0
def cs_root():
    root_schema = get_schema()
    hyper_schema = root_schema.copy()
    hyper_schema["links"] = [{"rel": "self", "href": "/api/config/"}]
    hyper_schema["properties"] = root_schema.get("properties", {}).copy()
    hs_props = hyper_schema["properties"]
    for key, key_schema in root_schema.get("properties", {}).iteritems():
        hs_props[key] = hs_props[key].copy()
        hs_props[key]["links"] = [{"rel": "self", "href": key}]
        if key not in root_schema.get("required", []):
            hs_props[key]["links"].append({"rel": "delete", "href": "", "method": "DELETE"})
    return jsonify(hyper_schema)
Example #6
0
def cs_root():
    root_schema = get_schema()
    hyper_schema = root_schema.copy()
    hyper_schema['links'] = [{'rel': 'self', 'href': '/api/config/'}]
    hyper_schema['properties'] = root_schema.get('properties', {}).copy()
    hs_props = hyper_schema['properties']
    for key, key_schema in root_schema.get('properties', {}).iteritems():
        hs_props[key] = hs_props[key].copy()
        hs_props[key]['links'] = [{'rel': 'self', 'href': key}]
        if key not in root_schema.get('required', []):
            hs_props[key]['links'].append({
                'rel': 'delete',
                'href': '',
                'method': 'DELETE'
            })
    return jsonify(hyper_schema)
Example #7
0
File: api.py Project: DColl/Flexget
def cs_tasks(root_key):
    root_schema = get_schema()
    if root_key not in root_schema['properties']:
        return 'Not found', 404
    hyper_schema = {'links': [{'rel': 'edit', 'href': 'PUT', }]}
    return root_schema['properties'][root_key]