Coverage for bc/kwai-bc-portal/src/kwai_bc_portal/applications/application_query.py: 100%
4 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module that defines an interface for an application query."""
3from abc import ABC, abstractmethod
5from kwai_core.domain.repository.query import Query
7from kwai_bc_portal.domain.application import ApplicationIdentifier
10class ApplicationQuery(Query, ABC):
11 """An interface for querying applications."""
13 @abstractmethod
14 def filter_by_id(self, id_: ApplicationIdentifier) -> "ApplicationQuery":
15 """Add a filter on the application id.
17 Args:
18 id_: an id of an application.
19 """
20 raise NotImplementedError
22 @abstractmethod
23 def filter_by_name(self, name: str) -> "ApplicationQuery":
24 """Add a filter on the application name.
26 Args:
27 name: the name of an application.
28 """
29 raise NotImplementedError
31 @abstractmethod
32 def filter_only_news(self) -> "ApplicationQuery":
33 """Only return applications which can contain news."""
34 raise NotImplementedError
36 @abstractmethod
37 def filter_only_pages(self) -> "ApplicationQuery":
38 """Only return applications which can contain pages."""
39 raise NotImplementedError
41 @abstractmethod
42 def filter_only_events(self) -> "ApplicationQuery":
43 """Only return applications which can contain events."""
44 raise NotImplementedError