Changeset View
Changeset View
Standalone View
Standalone View
swh/search/interface.py
# Copyright (C) 2020-2022 The Software Heritage developers | # Copyright (C) 2020-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 General Public License version 3, or any later version | # License: GNU 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 | ||||
from collections import Counter | from collections import Counter | ||||
from typing import Iterable, List, Optional, TypeVar | from typing import Any, Dict, Iterable, List, Optional, TypeVar | ||||
from typing_extensions import TypedDict | from typing_extensions import TypedDict | ||||
from swh.core.api import remote_api_endpoint | from swh.core.api import remote_api_endpoint | ||||
from swh.core.api.classes import PagedResult as CorePagedResult | from swh.core.api.classes import PagedResult as CorePagedResult | ||||
TResult = TypeVar("TResult") | TResult = TypeVar("TResult") | ||||
PagedResult = CorePagedResult[TResult, str] | PagedResult = CorePagedResult[TResult, str] | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | ) -> PagedResult[MinimalOriginDict]: | ||||
Returns: | Returns: | ||||
PagedResult of origin dicts matching the search criteria. If next_page_token | PagedResult of origin dicts matching the search criteria. If next_page_token | ||||
is None, there is no longer data to retrieve. | is None, there is no longer data to retrieve. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("origin/get") | |||||
def origin_get(self, url: str) -> Optional[Dict[str, Any]]: | |||||
"""Returns the full documents associated to the given origin URLs. | |||||
Order is arbitrary; unknown origins are not returned. | |||||
""" | |||||
@remote_api_endpoint("visit_types_count") | @remote_api_endpoint("visit_types_count") | ||||
def visit_types_count(self) -> Counter: | def visit_types_count(self) -> Counter: | ||||
"""Returns origin counts per visit type (git, hg, svn, ...).""" | """Returns origin counts per visit type (git, hg, svn, ...).""" | ||||
... | ... |