pincer.objects.user.integration   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 136
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 44
dl 0
loc 136
rs 10
c 0
b 0
f 0
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
from __future__ import annotations
5
6
from dataclasses import dataclass
7
from enum import IntEnum
8
from typing import Optional, TYPE_CHECKING
9
10
from ...utils.api_object import APIObject
11
from ...utils.types import MISSING
12
13
if TYPE_CHECKING:
14
    from .user import User
15
    from ...utils.types import APINullable
16
    from ...utils.snowflake import Snowflake
17
    from ...utils.timestamp import Timestamp
18
19
20
class IntegrationExpireBehavior(IntEnum):
21
    """Represents a Discord Integration expire behavior
22
23
    Attributes
24
    ----------
25
    REMOVE_ROLE:
26
        Remove role on expire.
27
    KICK:
28
        Kick on expire.
29
    """
30
31
    REMOVE_ROLE = 0
32
    KICK = 1
33
34
35
@dataclass(repr=False)
36
class IntegrationAccount(APIObject):
37
    """Represents a Discord Integration Account object
38
39
    Attributes
40
    ----------
41
    id: :class:`str`
42
        Id of the account
43
    name: :class:`str`
44
        Name of the account
45
    """
46
47
    id: str
48
    name: str
49
50
51
@dataclass(repr=False)
52
class IntegrationApplication(APIObject):
53
    """Represents a Discord Integration Application object
54
55
    Attributes
56
    ----------
57
    id: :class:`~pincer.utils.snowflake.Snowflake`
58
        The id of the app
59
    name: :class:`str`
60
        The name of the app
61
    icon: Optional[:class:`str`]
62
        The icon hash of the app
63
    description: :class:`str`
64
        The description of the app
65
    summary: :class:`str`
66
        The summary of the app
67
    bot: APINullable[:class:`~pincer.objects.user.user.User`]
68
        The bot associated with this application
69
    """
70
71
    id: Snowflake
72
    name: str
73
    icon: Optional[str]
74
    description: str
75
    summary: str
76
    bot: APINullable[User] = MISSING
77
78
79
@dataclass(repr=False)
80
class Integration(APIObject):
0 ignored issues
show
best-practice introduced by
Too many instance attributes (15/7)
Loading history...
81
    """Represents a Discord Integration object
82
83
    Attributes
84
    ----------
85
    id: :class:`~pincer.utils.snowflake.Snowflake`
86
        Integration id
87
    name: :class:`str`
88
        Integration name
89
    type: :class:`str`
90
        Integration type (twitch, YouTube, or discord)$
91
    enabled: :class:`bool`
92
        Is this integration enabled
93
    account: :class:`~pincer.objects.user.integration.IntegrationAccount`
94
        Integration account information
95
    syncing: APINullable[:class:`bool`]
96
        Is this integration syncing
97
    role_id: APINullable[:class:`~pincer.utils.snowflake.Snowflake`]
98
        Id that this integration uses for subscribers
99
    enable_emoticons: APINullable[:class:`bool`]
100
        Whether emoticons should be synced for this integration
101
        (twitch only currently)
102
    expire_behavior: APINullable[:class:`~pincer.objects.user.integration.IntegrationExpireBehavior`]
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
103
        The behavior of expiring subscribers
104
    expire_grace_period: APINullable[:class:`int`]
105
        The grace period (in days) before expiring subscribers
106
    user: APINullable[:class:`~pincer.objects.user.user.User`]
107
        User for this integration
108
    synced_at: APINullable[:class:`~pincer.utils.timestamp.Timestamp`]
109
        When this integration was last synced
110
    subscriber_count: APINullable[:class:`int`]
111
        How many subscribers this integration has
112
    revoked: APINullable[:class:`bool`]
113
        Has this integration been revoked
114
    application: APINullable[:class:`~pincer.objects.user.integration.IntegrationApplication`]
115
        The bot/OAuth2 application for discord integrations
116
    """
117
118
    # noqa: E501
119
120
    id: Snowflake
121
    name: str
122
    type: str
123
    enabled: bool
124
    account: IntegrationAccount
125
126
    syncing: APINullable[bool] = MISSING
127
    role_id: APINullable[Snowflake] = MISSING
128
    enable_emoticons: APINullable[bool] = MISSING
129
    expire_behavior: APINullable[IntegrationExpireBehavior] = MISSING
130
    expire_grace_period: APINullable[int] = MISSING
131
    user: APINullable[User] = MISSING
132
    synced_at: APINullable[Timestamp] = MISSING
133
    subscriber_count: APINullable[int] = MISSING
134
    revoked: APINullable[bool] = MISSING
135
    application: APINullable[IntegrationApplication] = MISSING
136