Passed
Pull Request — main (#44)
by
unknown
01:34
created

pincer.objects.integration   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 41
dl 0
loc 156
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# MIT License
3
#
4
# Copyright (c) 2021 Pincer
5
#
6
# Permission is hereby granted, free of charge, to any person obtaining
7
# a copy of this software and associated documentation files
8
# (the "Software"), to deal in the Software without restriction,
9
# including without limitation the rights to use, copy, modify, merge,
10
# publish, distribute, sublicense, and/or sell copies of the Software,
11
# and to permit persons to whom the Software is furnished to do so,
12
# subject to the following conditions:
13
#
14
# The above copyright notice and this permission notice shall be
15
# included in all copies or substantial portions of the Software.
16
#
17
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25
from dataclasses import dataclass
26
from enum import Enum
27
from typing import Optional
28
29
from pincer.objects.user import User
30
from pincer.utils.api_object import APIObject
31
from pincer.utils.constants import MISSING, APINullable
32
from pincer.utils.snowflake import Snowflake
33
from pincer.utils.timestamp import Timestamp
0 ignored issues
show
introduced by
Cannot import 'pincer.utils.timestamp' due to syntax error 'invalid syntax (<unknown>, line 91)'
Loading history...
Bug introduced by
The name timestamp does not seem to exist in module pincer.utils.
Loading history...
34
35
36
class IntegrationExpireBehavior(Enum):
37
    """Represents a Discord Integration expire behavior"""
38
    REMOVE_ROLE = 0
39
    KICK = 1
40
41
42
@dataclass
43
class IntegrationAccount(APIObject):
44
    """
45
    Represents a Discord Integration Account object
46
47
    :param id:
48
        id of the account
49
50
    :param name:
51
        name of the account
52
    """
53
    id: str
1 ignored issue
show
Coding Style Naming introduced by
Attribute name "id" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
54
    name: str
55
56
57
@dataclass
58
class IntegrationApplication(APIObject):
59
    """
60
    Represents a Discord Integration Application object
61
62
    :param id:
63
        the id of the app
64
65
    :param name:
66
        the name of the app
67
68
    :param icon:
69
        the icon hash of the app
70
71
    :param description:
72
        the description of the app
73
74
    :param summary:
75
        the summary of the app
76
77
    :param bot:
78
        the bot associated with this application
79
    """
80
    id: Snowflake
1 ignored issue
show
Coding Style Naming introduced by
Attribute name "id" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
81
    name: str
82
    icon: Optional[str]
83
    description: str
84
    summary: str
85
    bot: APINullable[User] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
86
87
88
@dataclass
0 ignored issues
show
best-practice introduced by
Too many instance attributes (15/7)
Loading history...
89
class Integration(APIObject):
90
    """
91
    Represents a Discord Integration object
92
93
    :param id:
94
        integration id
95
96
    :param name:
97
        integration name
98
99
    :param type:
100
        integration type (twitch, youtube, or discord)$
101
102
    :param enabled:
103
        is this integration enabled
104
105
    :param syncing:
106
        is this integration syncing
107
108
    :param role_id:
109
        id that this integration uses for subscribers
110
111
    :param enable_emoticons:
112
        whether emoticons should be synced for this integration
113
        (twitch only currently)
114
115
    :param expire_behavior:
116
        the behavior of expiring subscribers
117
118
    :param expire_grace_period:
119
        the grace period (in days) before expiring subscribers
120
121
    :param user:
122
        user for this integration
123
124
    :param account:
125
        integration account information
126
127
    :param synced_at:
128
        when this integration was last synced
129
130
    :param subscriber_count:
131
        how many subscribers this integration has
132
133
    :param revoked:
134
        has this integration been revoked
135
136
    :param application:
137
        The bot/OAuth2 application for discord integrations
138
    """
139
140
    id: Snowflake
1 ignored issue
show
Coding Style Naming introduced by
Attribute name "id" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
141
    name: str
142
    type: str
143
    enabled: bool
144
    account: IntegrationAccount
145
146
    syncing: APINullable[bool] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
147
    role_id: APINullable[Snowflake] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
148
    enable_emoticons: APINullable[bool] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
149
    expire_behavior: APINullable[IntegrationExpireBehavior] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
150
    expire_grace_period: APINullable[int] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
151
    user: APINullable[User] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
152
    synced_at: APINullable[Timestamp] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
153
    subscriber_count: APINullable[int] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
154
    revoked: APINullable[bool] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
155
    application: APINullable[IntegrationApplication] = MISSING
0 ignored issues
show
introduced by
Value 'APINullable' is unsubscriptable
Loading history...
156