DomoAccount
DomoAccount ¶
Account module providing Domo account management functionality.
This module contains classes for managing Domo accounts, credentials, configurations, and OAuth settings.
Classes:
| Name | Description |
|---|---|
DomoAccount |
Main account class |
DomoAccount_Default |
Base account functionality |
DomoAccount_Credential |
Account credential management |
DomoAccount_OAuth |
OAuth account configurations |
AccountConfig |
Account configuration classes |
DomoAccounts |
Collection class for managing multiple accounts |
Example
Basic account usage:
>>> from crew_dcs.classes.Account import DomoAccount
>>> account = DomoAccount.from_dict(account_data)
Working with account collections:
>>> from crew_dcs.classes.Account import DomoAccounts
>>> accounts = await DomoAccounts(auth=auth).get()
DomoAccount
dataclass
¶
DomoAccount(
auth: DomoAuth,
id: int,
raw: dict,
name: str = None,
display_name: str = None,
data_provider_type: str = None,
created_dt: datetime = None,
modified_dt: datetime = None,
owners: list[Any] = None,
is_admin_summary: bool = True,
dataset_count: int = None,
Config: DomoAccount_Config = None,
)
Bases: DomoAccount_Default
from_dict
classmethod
¶
from_dict(
auth: DomoAuth,
obj: dict[str, Any],
is_admin_summary: bool = True,
is_use_default_class: bool = False,
new_cls: Any = None,
**kwargs
)
converts data_v1_accounts API response into an accounts class object
Source code in src/crew_dcs/classes/DomoAccount/core.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
DomoAccountCredential
dataclass
¶
DomoAccountCredential(
auth: DomoAuth,
id: int,
raw: dict,
name: str = None,
display_name: str = None,
data_provider_type: str = None,
created_dt: datetime = None,
modified_dt: datetime = None,
owners: list[Any] = None,
is_admin_summary: bool = True,
dataset_count: int = None,
Config: DomoAccount_Config = None,
target_auth: DomoAuth = None,
target_user: DomoUser = None,
target_access_token: DomoAccessToken = None,
target_instance: str = None,
is_valid_full_auth: bool = None,
is_valid_token_auth: bool = None,
_token_auth: DomoAuth = None,
_full_auth: DomoAuth = None,
)
Bases: DomoAccount_Default
Account credential management class for Domo accounts.
This class extends DomoAccount_Default to provide credential management capabilities including authentication testing, password management, and access token operations.
Attributes:
| Name | Type | Description |
|---|---|---|
target_instance |
str
|
Target Domo instance for credential operations |
is_valid_full_auth |
bool
|
Whether full authentication is valid |
is_valid_token_auth |
bool
|
Whether token authentication is valid |
target_auth |
DomoAuth
|
Active authentication object for target instance |
target_user |
DomoUser
|
DomoUser object for the target user |
target_access_token |
DomoAccessToken
|
Access token for the account |
from_dict
classmethod
¶
from_dict(
obj: dict[str, Any],
is_admin_summary: bool = True,
auth: DomoAuth | None = None,
is_use_default_account_class: bool = False,
**kwargs
)
Create Account_Credential from dictionary representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
dict[str, Any]
|
Dictionary containing account data |
required |
is_admin_summary
|
bool
|
Whether this is an admin summary view |
True
|
auth
|
DomoAuth | None
|
Authentication object |
None
|
**kwargs
|
Additional keyword arguments including target_instance |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoAccount_Credential instance |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
get_target_access_token
async
¶
get_target_access_token(
token_name: str | None = None,
user_email: str | None = None,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccessToken
Retrieve an access token for the target user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_name
|
str | None
|
Name of the access token (defaults to account name) |
None
|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccessToken
|
DomoAccessToken object if found, None otherwise |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
DAC_NoAccessTokenName
|
If token name is not provided or available |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
get_target_user
async
¶
get_target_user(
user_email: str | None = None,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoUser
Retrieve the target user for this account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
DomoUser
|
DomoUser object for the target user |
Raises:
| Type | Description |
|---|---|
DAC_NoUserName
|
If user email is not provided or configured |
DACValidAuthError
|
If target authentication is not available |
DAC_NoTargetUser
|
If user cannot be found |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
regenerate_target_access_token
async
¶
regenerate_target_access_token(
token_name: str | None = None,
duration_in_days: int = 90,
user_email: str | None = None,
is_update_account: bool = True,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccountCredential
Regenerate or create an access token for the target user.
If a token with the given name exists, it will be regenerated. Otherwise, a new token will be created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_name
|
str | None
|
Name of the access token (defaults to account name) |
None
|
duration_in_days
|
int
|
Token validity duration in days (default: 90) |
90
|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
is_update_account
|
bool
|
Whether to update the account config with new token |
True
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccountCredential
|
Self for method chaining |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
DAC_NoTargetUser
|
If target user cannot be retrieved |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
set_access_token ¶
set_access_token(access_token: str) -> bool
Set the access token in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_token
|
str
|
New access token to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
169 170 171 172 173 174 175 176 177 178 179 | |
set_password ¶
set_password(password: str) -> bool
Set the password in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password
|
str
|
New password to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
145 146 147 148 149 150 151 152 153 154 155 | |
set_username ¶
set_username(username: str) -> bool
Set the username in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
New username to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
157 158 159 160 161 162 163 164 165 166 167 | |
test_auths
async
¶
test_auths(
backup_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
) -> dict
Test both token and full authentication methods.
Attempts to validate both authentication methods and sets the best available as the target authentication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backup_auth
|
DomoAuth | None
|
Backup authentication to use if configured auths fail |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with authentication test results |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
test_full_auth
async
¶
test_full_auth(
debug_api: bool = False,
session: AsyncClient | None = None,
) -> bool
Test full authentication (username/password) for the account.
Generates a DomoFullAuth object and validates it against the target instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if authentication is valid, False otherwise |
Raises:
| Type | Description |
|---|---|
DAC_NoUserName
|
If username is not configured |
DAC_NoPassword
|
If password is not configured |
DAC_NoTargetInstance
|
If target instance is not set |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
test_token_auth
async
¶
test_token_auth(
debug_api: bool = False,
session: AsyncClient | None = None,
) -> bool
Test token authentication for the account.
Generates a DomoTokenAuth object and validates it against the target instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if authentication is valid, False otherwise |
Raises:
| Type | Description |
|---|---|
DAC_NoAccessToken
|
If access token is not configured |
DAC_NoTargetInstance
|
If target instance is not set |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
to_dict ¶
to_dict(return_snake_case: bool = False) -> dict
Convert credential information to dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary containing account ID, alias, instance, and auth validity status |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
update_target_user_password
async
¶
update_target_user_password(
new_password: str,
user_email: str | None = None,
is_update_account: bool = True,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccountCredential
Update the password for the target user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_password
|
str
|
New password to set for the user |
required |
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
is_update_account
|
bool
|
Whether to update the account config with new password |
True
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccountCredential
|
Self for method chaining |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
DomoAccount_Config
dataclass
¶
DomoAccount_Config(
data_provider_type: str,
is_oauth: bool,
allow_external_use: bool = True,
parent: Any = None,
raw: dict = None,
)
Bases: DomoBase
DomoAccount Config abstract base class
from_dict
classmethod
¶
from_dict(
obj: dict[str, Any], parent: Any = None, **kwargs
)
Create instance from dict, handling camelCase, snake_case, and _field_map. Robust to missing or None _field_map. Uses _field_map for both directions.
Source code in src/crew_dcs/classes/DomoAccount/account_configs/_base.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
to_dict ¶
to_dict(
export_fields: list[str] | None = None,
override_fn: Callable | None = None,
return_snake_case: bool = False,
**kwargs
) -> dict
Convert config to dictionary using provided fields or all _fields_for_serialization.
Source code in src/crew_dcs/classes/DomoAccount/account_configs/_base.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
validate_compare_serialization ¶
validate_compare_serialization(
raise_on_mismatch: bool = True,
) -> bool
Validate that to_dict() output matches raw data keys (ignoring values).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raise_on_mismatch
|
bool
|
If True, raises AccountConfig_SerializationMismatchError on mismatch. If False, returns False on mismatch. |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
True if keys match, False otherwise (only if raise_on_mismatch=False) |
Raises:
| Type | Description |
|---|---|
AccountConfig_SerializationMismatchError
|
If keys don't match and raise_on_mismatch=True |
Source code in src/crew_dcs/classes/DomoAccount/account_configs/_base.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
DomoAccount_Default
dataclass
¶
DomoAccount_Default(
auth: DomoAuth,
id: int,
raw: dict,
name: str = None,
display_name: str = None,
data_provider_type: str = None,
created_dt: datetime = None,
modified_dt: datetime = None,
owners: list[Any] = None,
is_admin_summary: bool = True,
dataset_count: int = None,
Config: DomoAccount_Config = None,
)
Bases: DomoEntity
from_dict
classmethod
¶
from_dict(
auth: DomoAuth,
obj: dict[str, Any],
is_admin_summary: bool = True,
new_cls: Any = None,
**kwargs
)
converts data_v1_accounts API response into an accounts class object
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
account_id: int,
is_suppress_no_config: bool = True,
session: AsyncClient = None,
return_raw: bool = False,
debug_api: bool = False,
debug_num_stacks_to_drop=2,
is_use_default_account_class=False,
is_unmask=True,
*,
context: RouteContext | None = None,
**context_kwargs
)
retrieves account metadata and attempts to retrieve config
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
get_entity_by_id
async
classmethod
¶
get_entity_by_id(entity_id, **kwargs)
Alias for get_by_id
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
327 328 329 330 | |
refresh
async
¶
refresh(
auth: DomoAuth = None,
is_suppress_no_config: bool = True,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccount_Default
Reload entity properties from the API and refresh the account Config.
Thin wrapper that chains
super().refresh()— callsget_entity_by_id(i.e.get_by_id) to reload all entity-level attributes (name, data_provider_type, owners, etc.)._get_config()— fetches and parses the account credential config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Auth to use for config retrieval (defaults to |
None
|
is_suppress_no_config
|
bool
|
Suppress errors when no |
True
|
debug_api
|
bool
|
Enable API debug logging. |
False
|
session
|
AsyncClient | None
|
Optional reusable |
None
|
context
|
RouteContext | None
|
Optional |
None
|
Returns:
| Type | Description |
|---|---|
DomoAccount_Default
|
Self, mutated in-place with refreshed data. |
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
share
async
¶
share(
user_id: int | None = None,
group_id: int | None = None,
access_level: (
AccountAccess | AccountAccess_v1 | str | None
) = None,
session: AsyncClient | None = None,
debug_api: bool = False,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Share this account with a user or group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int | None
|
User ID to share with (mutually exclusive with group_id) |
None
|
group_id
|
int | None
|
Group ID to share with (mutually exclusive with user_id) |
None
|
access_level
|
AccountAccess | AccountAccess_v1 | str | None
|
Access level (AccessLevel enum) |
None
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
return_raw
|
bool
|
Return raw response without processing |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData if return_raw=True, else the updated account |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither user_id nor group_id is provided |
Account_Share_Error
|
If sharing operation fails |
Example
from crew_dcs.routes.account import AccountAccess account = await DomoAccount.get_by_id(auth=auth, account_id="123") await account.share( ... user_id=456, ... access_level=AccountAccess.CAN_EDIT ... )
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
upsert_target_account
async
¶
upsert_target_account(
target_auth: DomoAuth,
account_name: str | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
upsert an account in a target instance with self.Config
Source code in src/crew_dcs/classes/DomoAccount/account_default.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
DomoAccount_OAuth
dataclass
¶
DomoAccount_OAuth(
auth: DomoAuth,
id: int,
raw: dict,
name: str = None,
display_name: str = None,
data_provider_type: str = None,
created_dt: datetime = None,
modified_dt: datetime = None,
owners: list[Any] = None,
is_admin_summary: bool = True,
dataset_count: int = None,
Config: DomoAccount_Config = None,
)
Bases: DomoAccount_Default
create
async
classmethod
¶
create(
auth: DomoAuth,
account_name: str,
oauth_config: OAuthConfig,
origin: str = "OAUTH_CONFIGURATION",
debug_api: bool = False,
session: AsyncClient = None,
debug_num_stacks_to_drop=2,
*,
context: RouteContext | None = None,
**context_kwargs
)
Create a new OAuth account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
account_name
|
str
|
Display name for the OAuth account |
required |
oauth_config
|
OAuthConfig
|
OAuth configuration object (OAuthConfig enum member) |
required |
origin
|
str
|
Origin type for the OAuth account (default: "OAUTH_CONFIGURATION") |
'OAUTH_CONFIGURATION'
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient
|
HTTP client session (optional) |
None
|
debug_num_stacks_to_drop
|
Stack frames to drop for debugging |
2
|
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoAccount_OAuth instance with configuration loaded |
Raises:
| Type | Description |
|---|---|
Account_CRUD_Error
|
If account creation fails |
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
delete
async
¶
delete(
debug_api: bool = False,
debug_num_stacks_to_drop=2,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
Delete this OAuth account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
Stack frames to drop for debugging |
2
|
|
session
|
AsyncClient
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData object confirming deletion |
Raises:
| Type | Description |
|---|---|
Account_CRUD_Error
|
If account deletion fails |
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
account_id: int,
is_suppress_no_config: bool = True,
session: AsyncClient = None,
return_raw: bool = False,
debug_api: bool = False,
debug_num_stacks_to_drop=2,
*,
context: RouteContext | None = None,
**context_kwargs
)
Retrieve OAuth account metadata and attempt to retrieve configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
account_id
|
int
|
ID of the OAuth account to retrieve |
required |
is_suppress_no_config
|
bool
|
Suppress errors when config is not defined |
True
|
session
|
AsyncClient
|
HTTP client session (optional) |
None
|
return_raw
|
bool
|
Return raw response without processing |
False
|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
Stack frames to drop for debugging |
2
|
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
DomoAccount_OAuth |
OAuth account instance with configuration |
Raises:
| Type | Description |
|---|---|
AccountNoMatchError
|
If OAuth account is not found |
Account_GET_Error
|
If OAuth account retrieval fails |
Account_Config_Error
|
If configuration retrieval fails |
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
share
async
¶
share(
user_id: int | None = None,
group_id: int | None = None,
access_level: AccountAccess | str | None = None,
session: AsyncClient | None = None,
debug_api: bool = False,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Share this OAuth account with a user or group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int | None
|
User ID to share with (mutually exclusive with group_id) |
None
|
group_id
|
int | None
|
Group ID to share with (mutually exclusive with user_id) |
None
|
access_level
|
AccountAccess | str | None
|
Access level (ShareAccount_AccessLevel enum) |
None
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
return_raw
|
bool
|
Return raw response without processing |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
ResponseGetData if return_raw=True, else the updated account |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither user_id nor group_id is provided |
Account_Share_Error
|
If sharing operation fails |
Example
from crew_dcs.routes.account import AccountAccess account = await DomoAccount_OAuth.get_by_id(auth=auth, account_id=123) await account.share( ... user_id=456, ... access_level=AccountAccess.CAN_EDIT ... )
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | |
update_config
async
¶
update_config(
oauth_config: OAuthConfig = None,
debug_api: bool = False,
debug_num_stacks_to_drop=2,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
Update the configuration of this OAuth account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
oauth_config
|
OAuthConfig
|
New OAuth configuration (defaults to current config if None) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
Stack frames to drop for debugging |
2
|
|
session
|
AsyncClient
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
Self (DomoAccount_OAuth) with updated configuration |
Raises:
| Type | Description |
|---|---|
Account_Config_Error
|
If configuration update fails |
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
update_name
async
¶
update_name(
account_name: str,
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
Update the name of this OAuth account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_name
|
str
|
New display name for the account |
required |
debug_api
|
bool
|
Enable API debugging |
False
|
debug_num_stacks_to_drop
|
int
|
Stack frames to drop for debugging |
2
|
session
|
AsyncClient
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
Self (DomoAccount_OAuth) with updated name |
Raises:
| Type | Description |
|---|---|
Account_CRUD_Error
|
If name update fails |
Source code in src/crew_dcs/classes/DomoAccount/account_oauth.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
DomoAccounts
dataclass
¶
DomoAccounts(
auth: DomoAuth,
accounts: list[DomoAccount] = None,
oauths: list[DomoAccount_OAuth] = None,
)
Bases: DomoManager
get_accounts_queryapi
async
¶
get_accounts_queryapi(
additional_filters_ls=None,
is_use_default_account_class: bool = False,
return_raw: bool = False,
debug_api: bool = False,
debug_num_stacks_to_drop: int = 2,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
v2 api for works with group_account_v2 beta
Source code in src/crew_dcs/classes/DomoAccount/core.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
search_by_name
async
¶
search_by_name(
account_name: str,
data_provider_type: str | None = None,
is_use_default_account_class: bool = True,
is_suppress_not_found_exception: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccount | None
Search for an account by name (matches display_name or name).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_name
|
str
|
Account name to search for (case-insensitive) |
required |
data_provider_type
|
str | None
|
Optional filter by data provider type |
None
|
is_use_default_account_class
|
bool
|
Use default account class |
True
|
is_suppress_not_found_exception
|
bool
|
Suppress not found exceptions |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters (session, debug_api, etc.) |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccount | None
|
Matching DomoAccount or None if not found |
Raises:
| Type | Description |
|---|---|
DomoError
|
If account retrieval fails |
Source code in src/crew_dcs/classes/DomoAccount/core.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
upsert_account
async
classmethod
¶
upsert_account(
auth: DomoAuth,
account_id: str | None = None,
account_name: str | None = None,
account_config: AccountConfig = None,
data_provider_type: str | None = None,
debug_api: bool = False,
return_raw: bool = False,
return_search: bool = False,
is_use_default_account_class: bool = True,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs
)
search for an account and upsert it
Source code in src/crew_dcs/classes/DomoAccount/core.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |