Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/apiurls.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import functools | import functools | ||||
from typing import Dict, List, Optional | from typing import Dict, List, Optional | ||||
from django.http.response import HttpResponseBase | from django.http.response import HttpResponseBase | ||||
Show All 9 Lines | class APIUrls(UrlsIndex): | ||||
Class to manage API documentation URLs. | Class to manage API documentation URLs. | ||||
- Indexes all routes documented using apidoc's decorators. | - Indexes all routes documented using apidoc's decorators. | ||||
- Tracks endpoint/request processing method relationships for use in | - Tracks endpoint/request processing method relationships for use in | ||||
generating related urls in API documentation | generating related urls in API documentation | ||||
""" | """ | ||||
_apidoc_routes = {} # type: Dict[str, Dict[str, str]] | _apidoc_routes: Dict[str, Dict[str, str]] = {} | ||||
scope = "api" | scope = "api" | ||||
@classmethod | @classmethod | ||||
def get_app_endpoints(cls) -> Dict[str, Dict[str, str]]: | def get_app_endpoints(cls) -> Dict[str, Dict[str, str]]: | ||||
return cls._apidoc_routes | return cls._apidoc_routes | ||||
@classmethod | @classmethod | ||||
def add_doc_route( | def add_doc_route( | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |