DomoGroup
DomoGroup ¶
DomoGroup
dataclass
¶
DomoGroup(
auth: DomoAuth,
id: str,
raw: dict,
name: str = None,
type: str = None,
is_system: bool = None,
description: str = None,
members_id_ls: list[str] = list(),
owner_id_ls: list[str] = list(),
members_ls: list[dict] = list(),
owner_ls: list[dict] = list(),
custom_attributes: dict = dict(),
)
Bases: DomoEntity
Represents a Domo group.
A group in Domo can contain multiple users and has properties like name, type, and ownership. System groups are automatically created and managed by Domo.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The unique identifier of the group. |
name |
str
|
The name of the group. |
type |
str
|
The group type (e.g., "open", "system"). |
is_system |
bool
|
Whether this is a system-managed group. |
description |
str
|
A description of the group. |
members_id_ls |
list[str]
|
List of user IDs that are members of this group. |
owner_id_ls |
list[str]
|
List of user IDs that own this group. |
members_ls |
list[dict]
|
List of member objects with full details. |
owner_ls |
list[dict]
|
List of owner objects with full details. |
custom_attributes |
dict
|
Custom attributes associated with the group. |
display_url
property
¶
display_url: str
Generate the URL to display this group in the Domo admin interface.
create_from_name
async
classmethod
¶
create_from_name(
auth: DomoAuth,
group_name: str | None = None,
group_type: GroupType_Enum | str = "open",
description: str | None = None,
is_include_manage_groups_role: bool = True,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> DomoGroup
Create a new group in Domo.
Creates a new group with the specified name and optional type and description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for Domo API access. |
required |
group_name
|
str | None
|
The name of the group to create. |
None
|
group_type
|
GroupType_Enum | str
|
The type of the group (e.g., "open", "system"). Defaults to "open". Should use GroupType_Enum for type safety. |
'open'
|
description
|
str | None
|
Optional description for the group. |
None
|
is_include_manage_groups_role
|
bool
|
Whether to include the manage groups role. Defaults to True. (This parameter is not passed to the API call.) |
True
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
DomoGroup
|
A DomoGroup instance representing the newly created group. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 200 201 202 | |
delete
async
¶
delete(
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData
Delete this group from Domo.
Removes the group from Domo via the API. The API response is returned with the parent class name attached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData
|
The API response object with parent_class set to self.class.name |
ResponseGetData
|
(typically "DomoGroup", or a subclass's name if called on one). |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 | |
from_dict
classmethod
¶
Create a DomoGroup instance from a dictionary.
Extracts group data from various API response formats and creates a DomoGroup object. Handles both "id" and "groupId" keys, and both "type" and "groupType" keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for Domo API access. |
required |
obj
|
dict[str, Any]
|
Dictionary containing group data from the Domo API response. |
required |
Returns:
| Type | Description |
|---|---|
DomoGroup
|
A DomoGroup instance initialized from the provided dictionary. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
group_id: str,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData | DomoGroup
Fetch a group by its ID from the Domo API.
Retrieves group details from Domo using the provided group ID and authentication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for Domo API access. |
required |
group_id
|
str
|
The unique identifier of the group to fetch. |
required |
return_raw
|
bool
|
If True, return the raw API response; otherwise return a DomoGroup instance. Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | DomoGroup
|
The fetched group, or the raw API response if return_raw is True. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
111 112 113 114 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 144 145 146 147 148 149 150 151 | |
get_entity_by_id
async
classmethod
¶
get_entity_by_id(entity_id, **kwargs)
Internal method to get an entity by ID.
Source code in src/crew_dcs/classes/DomoGroup/core.py
153 154 155 156 157 158 | |
get_membership
async
¶
get_membership(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
)
Load this group's member list.
Returns raw route response when return_raw=True; otherwise returns the
member payload list and updates members_ls / members_id_ls.
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 | |
update_metadata
async
¶
update_metadata(
auth: DomoAuth = None,
group_name: str | None = None,
group_type: str | None = None,
description: str | None = None,
additional_params: dict | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData | DomoGroup
Update the group's metadata (name, type, description).
Updates the group in Domo and refreshes the current instance with the latest values. If the update fails due to a group type change, raises DomoGroupError with a helpful message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for Domo API access. If None, uses self.auth. |
None
|
group_name
|
str | None
|
New name for the group. If None, name is not updated. |
None
|
group_type
|
str | None
|
New type for the group. If None, type is not updated. Should use GroupType_Enum for type safety. |
None
|
description
|
str | None
|
New description for the group. If None, description is not updated. |
None
|
additional_params
|
dict | None
|
Additional parameters to pass to the API. |
None
|
return_raw
|
bool
|
If True, return the raw API response; otherwise return self. Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | DomoGroup
|
If return_raw is True, returns the raw API response. Otherwise, returns self |
ResponseGetData | DomoGroup
|
with updated name, description, and type attributes. |
Raises:
| Type | Description |
|---|---|
DomoGroupError
|
If the group type change fails, with a message suggesting to use additional_params instead. |
Group_CRUD_Error
|
Other CRUD operation errors from the API. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 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 | |
DomoGroupError ¶
DomoGroupError(
cls: Any = None,
cls_instance: Any = None,
entity_id_col: str | None = "id",
**kwargs
)
Bases: ClassError
Base group class exception for scripting callers.
Source code in src/crew_dcs/base/exceptions.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
DomoGroups
dataclass
¶
Bases: DomoManager
Manager for Domo groups.
Provides methods to retrieve, search, and manage multiple Domo groups. Handles operations on collections of groups including toggling system group visibility.
Attributes:
| Name | Type | Description |
|---|---|---|
is_hide_system_groups |
bool
|
Tracks whether system groups are currently hidden. |
groups |
list[DomoGroup]
|
List of DomoGroup instances. |
get
async
¶
get(
is_hide_system_groups: bool = True,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData | list[DomoGroup]
Fetch all groups from Domo.
Retrieves all groups from the Domo API, optionally hiding or showing system groups. First toggles the system group visibility setting, then fetches all groups and converts them to DomoGroup instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_hide_system_groups
|
bool
|
If True, hide system groups in the results. Defaults to True. |
True
|
return_raw
|
bool
|
If True, return the raw API response; otherwise return a list of DomoGroup instances. Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | list[DomoGroup]
|
If return_raw is True, returns the raw API response. Otherwise, returns |
ResponseGetData | list[DomoGroup]
|
a list of DomoGroup instances (possibly empty). |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 | |
get_is_system_groups_visible
async
¶
get_is_system_groups_visible(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData | bool
Check if system groups are currently visible.
Fetches the current visibility setting for system groups from the Domo API and updates is_hide_system_groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
return_raw
|
bool
|
If True, return the raw API response; otherwise return the boolean visibility value. Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | bool
|
If return_raw is True, returns the raw API response. Otherwise, returns |
ResponseGetData | bool
|
a boolean indicating whether system groups are hidden (is_hide_system_groups). |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 395 396 397 398 | |
search_by_name
async
¶
search_by_name(
group_name: list[str],
is_hide_system_groups: bool | None = None,
only_allow_one: bool = True,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> DomoGroup | list[DomoGroup]
Search for groups by name.
Fetches all groups and filters them by name (case-insensitive). Can return a single matching group or a list of matches depending on only_allow_one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_name
|
list[str]
|
Group name or list of group names to search for (case-insensitive). |
required |
is_hide_system_groups
|
bool | None
|
Whether to hide system groups. If None, uses the current setting. Defaults to None. |
None
|
only_allow_one
|
bool
|
If True, return only the first matching group and raise DomoGroupError if none found. If False, return all matching groups. Defaults to True. |
True
|
return_raw
|
bool
|
If True, return the raw API response from get(). Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
DomoGroup | list[DomoGroup]
|
If return_raw is True, returns the raw API response from get(). If only_allow_one |
DomoGroup | list[DomoGroup]
|
is True, returns a single DomoGroup. Otherwise, returns a list of DomoGroup instances. |
Raises:
| Type | Description |
|---|---|
DomoGroupError
|
If no groups match the search criteria and only_allow_one is True. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 562 563 | |
toggle_show_system_groups
async
¶
toggle_show_system_groups(
is_hide_system_groups: bool,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> ResponseGetData | bool
Toggle the visibility of system groups.
Sets whether system groups should be hidden or shown. If the setting matches the current state, returns without making an API call. The actual value returned is the inverse of the response value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_hide_system_groups
|
bool
|
If True, hide system groups; if False, show them. |
required |
return_raw
|
bool
|
If True, return the raw API response; otherwise return the new visibility state. Defaults to False. |
False
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | bool
|
If return_raw is True, returns the raw API response. Otherwise, returns |
ResponseGetData | bool
|
the updated is_hide_system_groups value (the inverse of res.response["value"]). |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 431 432 433 434 435 436 437 438 439 440 441 | |
upsert
async
¶
upsert(
group_name: str,
group_type: str | None = None,
description: str | None = None,
additional_params: dict | None = None,
*,
context: RouteContext | None = None,
**context_kwargs: Any
) -> DomoGroup
Create a new group or update an existing one by name.
Searches for a group with the given name. If found, updates its metadata. If not found, creates a new group. If update_metadata fails, falls back to a plain update_group call with name/description/additional_params — that fallback does not retry the group_type change, so a type-change failure leaves the group's type unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_name
|
str
|
The name of the group to create or update. |
required |
group_type
|
str | None
|
The type for a new group or to update to. Should use GroupType_Enum for type safety. Defaults to None. Not applied by the fallback path if update_metadata fails. |
None
|
description
|
str | None
|
Description for the group. Defaults to None. |
None
|
additional_params
|
dict | None
|
Additional parameters for the API call, used as a fallback if update_metadata fails. Defaults to None. |
None
|
context
|
RouteContext | None
|
Optional RouteContext for configuring the request. |
None
|
**context_kwargs
|
Any
|
Additional keyword arguments passed to RouteContext.build_context(). |
{}
|
Returns:
| Type | Description |
|---|---|
DomoGroup
|
The created or updated DomoGroup instance. |
Source code in src/crew_dcs/classes/DomoGroup/core.py
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 | |