Coverage for bc/kwai-bc-identity/src/kwai_bc_identity/tokens/access_token_query.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module that defines an interface for an access token query.""" 

2 

3from abc import abstractmethod 

4from typing import Self 

5 

6from kwai_core.domain.repository.query import Query 

7 

8from kwai_bc_identity.tokens.access_token import AccessTokenIdentifier 

9from kwai_bc_identity.tokens.token_identifier import TokenIdentifier 

10from kwai_bc_identity.users.user_account import UserAccountEntity 

11 

12 

13class AccessTokenQuery(Query): 

14 """An interface for querying an access token.""" 

15 

16 @abstractmethod 

17 def filter_by_id(self, id_: AccessTokenIdentifier) -> Self: 

18 """Filter for the given id.""" 

19 raise NotImplementedError 

20 

21 @abstractmethod 

22 def filter_by_token_identifier(self, identifier: TokenIdentifier) -> Self: 

23 """Filter for the given token identifier.""" 

24 raise NotImplementedError 

25 

26 @abstractmethod 

27 def filter_by_user_account(self, user_account: UserAccountEntity) -> Self: 

28 """Filter for the given user account.""" 

29 raise NotImplementedError