bacommon.login

Functionality related to cloud based assets.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""Functionality related to cloud based assets."""
 4
 5from __future__ import annotations
 6
 7from enum import Enum
 8from typing import TYPE_CHECKING
 9
10if TYPE_CHECKING:
11    pass
12
13
14# NOTE TO SELF:
15# Whenever adding login types here, make sure to update all
16# basn nodes before trying to send values through to bamaster,
17# as they need to be extractable by basn en route.
18
19
20class LoginType(Enum):
21    """Types of logins available."""
22
23    # Email/password
24    EMAIL = 'email'
25
26    # Google Play Game Services
27    GPGS = 'gpgs'
28
29    # Apple's Game Center
30    GAME_CENTER = 'game_center'
31
32    @property
33    def displayname(self) -> str:
34        """Human readable name for this value."""
35        cls = type(self)
36        match self:
37            case cls.EMAIL:
38                return 'Email/Password'
39            case cls.GPGS:
40                return 'Google Play Games'
41            case cls.GAME_CENTER:
42                return 'Game Center'
43
44    @property
45    def displaynameshort(self) -> str:
46        """Human readable name for this value."""
47        cls = type(self)
48        match self:
49            case cls.EMAIL:
50                return 'Email'
51            case cls.GPGS:
52                return 'GPGS'
53            case cls.GAME_CENTER:
54                return 'Game Center'
class LoginType(enum.Enum):
21class LoginType(Enum):
22    """Types of logins available."""
23
24    # Email/password
25    EMAIL = 'email'
26
27    # Google Play Game Services
28    GPGS = 'gpgs'
29
30    # Apple's Game Center
31    GAME_CENTER = 'game_center'
32
33    @property
34    def displayname(self) -> str:
35        """Human readable name for this value."""
36        cls = type(self)
37        match self:
38            case cls.EMAIL:
39                return 'Email/Password'
40            case cls.GPGS:
41                return 'Google Play Games'
42            case cls.GAME_CENTER:
43                return 'Game Center'
44
45    @property
46    def displaynameshort(self) -> str:
47        """Human readable name for this value."""
48        cls = type(self)
49        match self:
50            case cls.EMAIL:
51                return 'Email'
52            case cls.GPGS:
53                return 'GPGS'
54            case cls.GAME_CENTER:
55                return 'Game Center'

Types of logins available.

EMAIL = <LoginType.EMAIL: 'email'>
GPGS = <LoginType.GPGS: 'gpgs'>
GAME_CENTER = <LoginType.GAME_CENTER: 'game_center'>
displayname: str
33    @property
34    def displayname(self) -> str:
35        """Human readable name for this value."""
36        cls = type(self)
37        match self:
38            case cls.EMAIL:
39                return 'Email/Password'
40            case cls.GPGS:
41                return 'Google Play Games'
42            case cls.GAME_CENTER:
43                return 'Game Center'

Human readable name for this value.

displaynameshort: str
45    @property
46    def displaynameshort(self) -> str:
47        """Human readable name for this value."""
48        cls = type(self)
49        match self:
50            case cls.EMAIL:
51                return 'Email'
52            case cls.GPGS:
53                return 'GPGS'
54            case cls.GAME_CENTER:
55                return 'Game Center'

Human readable name for this value.

Inherited Members
enum.Enum
name
value