This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/api.py

56 lines
1.2 KiB
Python

import logging
from flask import request, make_response, jsonify, abort
from flask.ext.login import login_required, current_user
from functools import wraps
from data import model
from app import app
from util import parse_repository_name
logger = logging.getLogger(__name__)
@app.route('/api/')
def welcome():
return make_response('welcome', 200)
@app.route('/api/repository/', methods=['POST'])
@login_required
def create_repo_api():
pass
@app.route('/api/repository/', methods=['GET'])
@login_required
def list_repos_api():
def repo_view(repo_perm):
return {
'namespace': repo_perm.repository.namespace,
'name': repo_perm.repository.name,
'role': repo_perm.role.name,
}
repos = [repo_view(repo)
for repo in model.get_user_repositories(current_user.db_user)]
response = {
'repositories': repos
}
return jsonify(response)
@app.route('/api/repository/<path:repository>', methods=['PUT'])
@login_required
@parse_repository_name
def update_repo_api(namespace, repository):
pass
@app.route('/api/repository/<path:repository>', methods=['GET'])
@login_required
@parse_repository_name
def get_repo_api(namespace, repository):
pass