Exemplo n.º 1
0
Arquivo: api.py Projeto: 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'})
Exemplo n.º 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]
Exemplo n.º 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'
            })
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 7
0
Arquivo: api.py Projeto: 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]