arcade-core 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ from .catalog import ToolCatalog as ToolCatalog
2
+ from .toolkit import Toolkit as Toolkit
@@ -0,0 +1,8 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class Inferrable:
6
+ """An annotation indicating that a parameter can be inferred by a model (default: True)."""
7
+
8
+ value: bool = True
arcade_core/auth.py ADDED
@@ -0,0 +1,177 @@
1
+ from enum import Enum
2
+ from typing import Optional
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+
7
+ class AuthProviderType(str, Enum):
8
+ oauth2 = "oauth2"
9
+
10
+
11
+ class ToolAuthorization(BaseModel):
12
+ """Marks a tool as requiring authorization."""
13
+
14
+ model_config = ConfigDict(frozen=True)
15
+
16
+ provider_id: Optional[str] = None
17
+ """The provider ID configured in Arcade that acts as an alias to well-known configuration."""
18
+
19
+ provider_type: AuthProviderType
20
+ """The type of the authorization provider."""
21
+
22
+ id: Optional[str] = None
23
+ """A provider's unique identifier, allowing the tool to specify a specific authorization provider. Recommended for private tools only."""
24
+
25
+ scopes: Optional[list[str]] = None
26
+ """The scope(s) needed for the authorized action."""
27
+
28
+
29
+ class OAuth2(ToolAuthorization):
30
+ """Marks a tool as requiring OAuth 2.0 authorization."""
31
+
32
+ def __init__(self, *, id: str | None, scopes: Optional[list[str]] = None): # noqa: A002
33
+ super().__init__(id=id, scopes=scopes, provider_type=AuthProviderType.oauth2)
34
+
35
+
36
+ class Asana(OAuth2):
37
+ """Marks a tool as requiring Asana authorization."""
38
+
39
+ provider_id: str = "asana"
40
+
41
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
42
+ super().__init__(id=id, scopes=scopes)
43
+
44
+
45
+ class Atlassian(OAuth2):
46
+ """Marks a tool as requiring Atlassian authorization."""
47
+
48
+ provider_id: str = "atlassian"
49
+
50
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
51
+ super().__init__(id=id, scopes=scopes)
52
+
53
+
54
+ class Discord(OAuth2):
55
+ """Marks a tool as requiring Discord authorization."""
56
+
57
+ provider_id: str = "discord"
58
+
59
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
60
+ super().__init__(id=id, scopes=scopes)
61
+
62
+
63
+ class Dropbox(OAuth2):
64
+ """Marks a tool as requiring Dropbox authorization."""
65
+
66
+ provider_id: str = "dropbox"
67
+
68
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
69
+ super().__init__(id=id, scopes=scopes)
70
+
71
+
72
+ class GitHub(OAuth2):
73
+ """Marks a tool as requiring GitHub App authorization."""
74
+
75
+ provider_id: str = "github"
76
+
77
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
78
+ super().__init__(id=id, scopes=scopes)
79
+
80
+
81
+ class Google(OAuth2):
82
+ """Marks a tool as requiring Google authorization."""
83
+
84
+ provider_id: str = "google"
85
+
86
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
87
+ super().__init__(id=id, scopes=scopes)
88
+
89
+
90
+ class Hubspot(OAuth2):
91
+ """Marks a tool as requiring Hubspot authorization."""
92
+
93
+ provider_id: str = "hubspot"
94
+
95
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
96
+ super().__init__(id=id, scopes=scopes)
97
+
98
+
99
+ class LinkedIn(OAuth2):
100
+ """Marks a tool as requiring LinkedIn authorization."""
101
+
102
+ provider_id: str = "linkedin"
103
+
104
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
105
+ super().__init__(id=id, scopes=scopes)
106
+
107
+
108
+ class Microsoft(OAuth2):
109
+ """Marks a tool as requiring Microsoft authorization."""
110
+
111
+ provider_id: str = "microsoft"
112
+
113
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
114
+ super().__init__(id=id, scopes=scopes)
115
+
116
+
117
+ class Notion(OAuth2):
118
+ """Marks a tool as requiring Notion authorization."""
119
+
120
+ provider_id: str = "notion"
121
+
122
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
123
+ super().__init__(id=id, scopes=scopes)
124
+
125
+
126
+ class Reddit(OAuth2):
127
+ """Marks a tool as requiring Reddit authorization."""
128
+
129
+ provider_id: str = "reddit"
130
+
131
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
132
+ super().__init__(id=id, scopes=scopes)
133
+
134
+
135
+ class Slack(OAuth2):
136
+ """Marks a tool as requiring Slack (user token) authorization."""
137
+
138
+ provider_id: str = "slack"
139
+
140
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
141
+ super().__init__(id=id, scopes=scopes)
142
+
143
+
144
+ class Spotify(OAuth2):
145
+ """Marks a tool as requiring Spotify authorization."""
146
+
147
+ provider_id: str = "spotify"
148
+
149
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
150
+ super().__init__(id=id, scopes=scopes)
151
+
152
+
153
+ class Twitch(OAuth2):
154
+ """Marks a tool as requiring Twitch authorization."""
155
+
156
+ provider_id: str = "twitch"
157
+
158
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
159
+ super().__init__(id=id, scopes=scopes)
160
+
161
+
162
+ class X(OAuth2):
163
+ """Marks a tool as requiring X (Twitter) authorization."""
164
+
165
+ provider_id: str = "x"
166
+
167
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
168
+ super().__init__(id=id, scopes=scopes)
169
+
170
+
171
+ class Zoom(OAuth2):
172
+ """Marks a tool as requiring Zoom authorization."""
173
+
174
+ provider_id: str = "zoom"
175
+
176
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
177
+ super().__init__(id=id, scopes=scopes)