Total Complexity | 0 |
Total Lines | 156 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
|
|||
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 |
||
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
|
|||
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
|
|||
81 | name: str |
||
82 | icon: Optional[str] |
||
83 | description: str |
||
84 | summary: str |
||
85 | bot: APINullable[User] = MISSING |
||
86 | |||
87 | |||
88 | @dataclass |
||
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
|
|||
141 | name: str |
||
142 | type: str |
||
143 | enabled: bool |
||
144 | account: IntegrationAccount |
||
145 | |||
146 | syncing: APINullable[bool] = MISSING |
||
147 | role_id: APINullable[Snowflake] = MISSING |
||
148 | enable_emoticons: APINullable[bool] = MISSING |
||
149 | expire_behavior: APINullable[IntegrationExpireBehavior] = MISSING |
||
150 | expire_grace_period: APINullable[int] = MISSING |
||
151 | user: APINullable[User] = MISSING |
||
152 | synced_at: APINullable[Timestamp] = MISSING |
||
153 | subscriber_count: APINullable[int] = MISSING |
||
154 | revoked: APINullable[bool] = MISSING |
||
155 | application: APINullable[IntegrationApplication] = MISSING |
||
156 |