Coverage for bc/kwai-bc-portal/src/kwai_bc_portal/pages/page_query.py: 100%
6 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 for defining an interface for a page query."""
3from abc import abstractmethod
4from typing import Self
6from kwai_core.domain.repository.query import Query
7from kwai_core.domain.value_objects.unique_id import UniqueId
9from kwai_bc_portal.domain.page import PageIdentifier
12class PageQuery(Query):
13 """An interface for a page query."""
15 @abstractmethod
16 def filter_by_id(self, id_: PageIdentifier) -> Self:
17 """Add a filter on the page id.
19 Args:
20 id_: an id of a page.
21 """
22 raise NotImplementedError
24 @abstractmethod
25 def filter_by_application(self, application: int | str) -> Self:
26 """Add a filter to return only pages for the given application.
28 Args:
29 application: The id or the name of the application
30 """
31 raise NotImplementedError
33 @abstractmethod
34 def filter_by_active(self) -> Self:
35 """Add a filter to only return active pages."""
36 raise NotImplementedError
38 @abstractmethod
39 def filter_by_user(self, user: int | UniqueId) -> Self:
40 """Add a filter to only return pages of the given user.
42 Args:
43 user: The id or unique id of the user.
44 """
45 raise NotImplementedError