Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 19:30 UTC
Typecasts to fix linting errors
Prateek committed
Oct 1, 2025 at 16:20 UTC
cfadb82689b285b6d04b1b8866de4039a3e35747
2 files changed
+92
-71
python/composio/core/models/connected_accounts.py
+91
-70
@@ -128,16 +128,19 @@ class AuthScheme:
128
"""
129
Create a new connected account using Composio Link.
130
"""
131
- return {
132
- "auth_scheme": "COMPOSIO_LINK",
133
- "val": t.cast(
134
- connected_account_create_params.ConnectionStateUnionMember2Val,
135
- {
136
- **options,
137
- "status": "INITIALIZING",
138
- },
139
- ),
140
- }
131
+ return t.cast(
132
+ connected_account_create_params.ConnectionState,
133
+ {
134
+ "auth_scheme": "COMPOSIO_LINK",
135
+ "val": t.cast(
136
+ connected_account_create_params.ConnectionStateUnionMember2Val,
137
+ {
138
+ **options,
139
+ "status": "INITIALIZING",
140
+ },
141
+ ),
142
+ },
143
+ )
144
145
def api_key(
146
self, options: connected_account_create_params.ConnectionStateUnionMember3Val
@@ -145,16 +148,19 @@ class AuthScheme:
148
"""
149
Create a new connected account using an API key.
150
"""
148
- return {
149
- "auth_scheme": "API_KEY",
150
- "val": t.cast(
151
- connected_account_create_params.ConnectionStateUnionMember3Val,
152
- {
153
- **options,
154
- "status": "ACTIVE",
155
- },
156
- ),
157
- }
151
+ return t.cast(
152
+ connected_account_create_params.ConnectionState,
153
+ {
154
+ "auth_scheme": "API_KEY",
155
+ "val": t.cast(
156
+ connected_account_create_params.ConnectionStateUnionMember3Val,
157
+ {
158
+ **options,
159
+ "status": "ACTIVE",
160
+ },
161
+ ),
162
+ },
163
+ )
164
165
def basic(
166
self, options: connected_account_create_params.ConnectionStateUnionMember4Val
@@ -162,16 +168,19 @@ class AuthScheme:
168
"""
169
Create a new connected account using basic auth.
170
"""
165
- return {
166
- "auth_scheme": "BASIC",
167
- "val": t.cast(
168
- connected_account_create_params.ConnectionStateUnionMember4Val,
169
- {
170
- **options,
171
- "status": "ACTIVE",
172
- },
173
- ),
174
- }
171
+ return t.cast(
172
+ connected_account_create_params.ConnectionState,
173
+ {
174
+ "auth_scheme": "BASIC",
175
+ "val": t.cast(
176
+ connected_account_create_params.ConnectionStateUnionMember4Val,
177
+ {
178
+ **options,
179
+ "status": "ACTIVE",
180
+ },
181
+ ),
182
+ },
183
+ )
184
185
def bearer_token(
186
self, options: connected_account_create_params.ConnectionStateUnionMember5Val
@@ -179,16 +188,19 @@ class AuthScheme:
188
"""
189
Create a new connected account using a bearer token.
190
"""
182
- return {
183
- "auth_scheme": "BEARER_TOKEN",
184
- "val": t.cast(
185
- connected_account_create_params.ConnectionStateUnionMember5Val,
186
- {
187
- **options,
188
- "status": "ACTIVE",
189
- },
190
- ),
191
- }
191
+ return t.cast(
192
+ connected_account_create_params.ConnectionState,
193
+ {
194
+ "auth_scheme": "BEARER_TOKEN",
195
+ "val": t.cast(
196
+ connected_account_create_params.ConnectionStateUnionMember5Val,
197
+ {
198
+ **options,
199
+ "status": "ACTIVE",
200
+ },
201
+ ),
202
+ },
203
+ )
204
205
def google_service_account(
206
self, options: connected_account_create_params.ConnectionStateUnionMember6Val
@@ -196,16 +208,19 @@ class AuthScheme:
208
"""
209
Create a new connected account using a Google service account.
210
"""
199
- return {
200
- "auth_scheme": "GOOGLE_SERVICE_ACCOUNT",
201
- "val": t.cast(
202
- connected_account_create_params.ConnectionStateUnionMember6Val,
203
- {
204
- **options,
205
- "status": "ACTIVE",
206
- },
207
- ),
208
- }
211
+ return t.cast(
212
+ connected_account_create_params.ConnectionState,
213
+ {
214
+ "auth_scheme": "GOOGLE_SERVICE_ACCOUNT",
215
+ "val": t.cast(
216
+ connected_account_create_params.ConnectionStateUnionMember6Val,
217
+ {
218
+ **options,
219
+ "status": "ACTIVE",
220
+ },
221
+ ),
222
+ },
223
+ )
224
225
def no_auth(
226
self, options: connected_account_create_params.ConnectionStateUnionMember7Val
@@ -247,16 +262,19 @@ class AuthScheme:
262
"""
263
Create a new connected account using Bill.com auth.
264
"""
250
- return {
251
- "auth_scheme": "BILLCOM_AUTH",
252
- "val": t.cast(
253
- connected_account_create_params.ConnectionStateUnionMember9Val,
254
- {
255
- **options,
256
- "status": "ACTIVE",
257
- },
258
- ),
259
- }
265
+ return t.cast(
266
+ connected_account_create_params.ConnectionState,
267
+ {
268
+ "auth_scheme": "BILLCOM_AUTH",
269
+ "val": t.cast(
270
+ connected_account_create_params.ConnectionStateUnionMember9Val,
271
+ {
272
+ **options,
273
+ "status": "ACTIVE",
274
+ },
275
+ ),
276
+ },
277
+ )
278
279
def basic_with_jwt(
280
self, options: connected_account_create_params.ConnectionStateUnionMember10Val
@@ -264,16 +282,19 @@ class AuthScheme:
282
"""
283
Create a new connected account using basic auth with JWT.
284
"""
267
- return {
268
- "auth_scheme": "BASIC_WITH_JWT",
269
- "val": t.cast(
270
- connected_account_create_params.ConnectionStateUnionMember10Val,
271
- {
272
- **options,
273
- "status": "ACTIVE",
274
- },
275
- ),
276
- }
285
+ return t.cast(
286
+ connected_account_create_params.ConnectionState,
287
+ {
288
+ "auth_scheme": "BASIC_WITH_JWT",
289
+ "val": t.cast(
290
+ connected_account_create_params.ConnectionStateUnionMember10Val,
291
+ {
292
+ **options,
293
+ "status": "ACTIVE",
294
+ },
295
+ ),
296
+ },
297
+ )
298
299
300
class ConnectedAccounts:
python/composio/utils/pydantic.py
+1
-1
@@ -4,7 +4,7 @@ import pydantic
4
from composio_client import omit
5
6
7
-def none_to_omit(value: t.Optional[t.Any]) -> t.Union[t.Any, type(omit)]:
7
+def none_to_omit(value: t.Optional[t.Any]) -> t.Any:
8
"""Convert None to omit for composio_client API calls.
9
10
This utility function helps convert Python's None values to composio_client's