Changeset View
Changeset View
Standalone View
Standalone View
swh/web/ui/views/api.py
Show All 17 Lines | def api_stats(): | ||||
Returns: | Returns: | ||||
SWH storage's statistics. | SWH storage's statistics. | ||||
""" | """ | ||||
return service.stat_counters() | return service.stat_counters() | ||||
@app.route('/api/1/stat/visits/<int:origin_id>/') | |||||
def api_origin_visits(origin_id): | |||||
"""Return visit dates for the given revision. | |||||
Returns: | |||||
A list of SWH visit occurrence timestamps, sorted from oldest to | |||||
newest. | |||||
""" | |||||
date_gen = (item['date'] for item in service.stat_origin_visits(origin_id)) | |||||
return sorted(date_gen) | |||||
@app.route('/api/1/search/', methods=['POST']) | @app.route('/api/1/search/', methods=['POST']) | ||||
@app.route('/api/1/search/<string:q>/') | @app.route('/api/1/search/<string:q>/') | ||||
def api_search(q=None): | def api_search(q=None): | ||||
"""Search a content per hash. | """Search a content per hash. | ||||
Args: | Args: | ||||
q is of the form algo_hash:hash with algo_hash in | q is of the form algo_hash:hash with algo_hash in | ||||
(sha1, sha1_git, sha256). | (sha1, sha1_git, sha256). | ||||
▲ Show 20 Lines • Show All 925 Lines • Show Last 20 Lines |