Skip to content

beastmode

beastmode

BeastMode_CRUD_Error

BeastMode_CRUD_Error(
    operation: str,
    entity_id: str | None = None,
    res: ResponseGetData | None = None,
    message: str | None = None,
    **kwargs
)

Bases: RouteError

Raised when BeastMode create, update, or delete operations fail.

This exception is used for failures during lock/unlock operations or other modification operations on BeastModes.

Source code in src/crew_dcs/routes/beastmode.py
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
def __init__(
    self,
    operation: str,
    entity_id: str | None = None,
    res: rgd.ResponseGetData | None = None,
    message: str | None = None,
    **kwargs,
):
    if not message:
        if entity_id:
            message = f"BeastMode {operation} failed for BeastMode {entity_id}"
        else:
            message = f"BeastMode {operation} operation failed"

    super().__init__(
        message=message,
        entity_id=entity_id,
        res=res,
        additional_context={"operation": operation},
        **kwargs,
    )

BeastMode_GET_Error

BeastMode_GET_Error(
    entity_id: str | None = None,
    res: ResponseGetData | None = None,
    message: str | None = None,
    **kwargs
)

Bases: RouteError

Raised when BeastMode retrieval operations fail.

This exception is used for failures during GET operations on BeastModes, including API errors and unexpected response formats.

Source code in src/crew_dcs/routes/beastmode.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def __init__(
    self,
    entity_id: str | None = None,
    res: rgd.ResponseGetData | None = None,
    message: str | None = None,
    **kwargs,
):
    if not message:
        if entity_id:
            message = f"Failed to retrieve BeastMode {entity_id}"
        else:
            message = "Failed to retrieve BeastModes"

    super().__init__(message=message, entity_id=entity_id, res=res, **kwargs)

SearchBeastModeNotFoundError

SearchBeastModeNotFoundError(
    search_criteria: str,
    res: ResponseGetData | None = None,
    **kwargs
)

Bases: RouteError

Raised when BeastMode search operations return no results.

This exception is used when searching for specific BeastModes that don't exist or when search criteria match no BeastModes.

Source code in src/crew_dcs/routes/beastmode.py
129
130
131
132
133
134
135
136
137
138
139
140
141
def __init__(
    self,
    search_criteria: str,
    res: rgd.ResponseGetData | None = None,
    **kwargs,
):
    message = f"No BeastModes found matching: {search_criteria}"
    super().__init__(
        message=message,
        res=res,
        additional_context={"search_criteria": search_criteria},
        **kwargs,
    )

create_beastmode async

create_beastmode(
    auth: DomoAuth,
    name: str,
    expression: str,
    dataset_id: str,
    data_type: str = "STRING",
    aggregated: bool = False,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Create a new BeastMode (calculated field) template.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
name str

Display name for the BeastMode

required
expression str

SQL-like formula expression

required
dataset_id str

ID of the dataset to associate the BeastMode with

required
data_type str

Data type of the result (default: "STRING")

'STRING'
aggregated bool

Whether the formula is aggregated (default: False)

False
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters

{}

Returns:

Type Description
ResponseGetData

ResponseGetData containing the created BeastMode data

Raises:

Type Description
BeastMode_CRUD_Error

If creation fails

Source code in src/crew_dcs/routes/beastmode.py
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_beastmode(
    auth: DomoAuth,
    name: str,
    expression: str,
    dataset_id: str,
    data_type: str = "STRING",
    aggregated: bool = False,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Create a new BeastMode (calculated field) template.

    Args:
        auth: Authentication object containing instance and credentials
        name: Display name for the BeastMode
        expression: SQL-like formula expression
        dataset_id: ID of the dataset to associate the BeastMode with
        data_type: Data type of the result (default: "STRING")
        aggregated: Whether the formula is aggregated (default: False)
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters

    Returns:
        ResponseGetData containing the created BeastMode data

    Raises:
        BeastMode_CRUD_Error: If creation fails
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/template"

    # The dataset is associated via `links` (resource type DATA_SOURCE), NOT a
    # top-level dataSourceId — sending dataSourceId causes a 500. columnPositions
    # are derived from the backticked columns referenced in the expression.
    column_positions = [
        {"columnName": m.group(0), "columnPosition": m.start()}
        for m in _BACKTICK_COLUMN.finditer(expression)
    ]
    body = {
        "name": name,
        "expression": expression,
        "dataType": data_type,
        "aggregated": aggregated,
        "variable": False,
        "hidden": False,
        "nonAggregatedColumns": [],
        "columnPositions": column_positions,
        "links": [
            {
                "resource": {"type": "DATA_SOURCE", "id": dataset_id},
                "visible": True,
                "active": False,
            }
        ],
    }

    res = await gd.get_data(
        auth=auth,
        method="POST",
        url=url,
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise BeastMode_CRUD_Error(operation="create", res=res)

    return res

delete_beastmode async

delete_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Delete a BeastMode template.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
beastmode_id str

Unique identifier of the BeastMode to delete

required
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters

{}

Returns:

Type Description
ResponseGetData

ResponseGetData confirming deletion

Raises:

Type Description
BeastMode_CRUD_Error

If deletion fails

Source code in src/crew_dcs/routes/beastmode.py
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Delete a BeastMode template.

    Args:
        auth: Authentication object containing instance and credentials
        beastmode_id: Unique identifier of the BeastMode to delete
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters

    Returns:
        ResponseGetData confirming deletion

    Raises:
        BeastMode_CRUD_Error: If deletion fails
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/template/{beastmode_id}"

    res = await gd.get_data(
        auth=auth,
        method="DELETE",
        url=url,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise BeastMode_CRUD_Error(
            operation="delete",
            entity_id=str(beastmode_id),
            res=res,
        )

    return res

generate_beastmode_body

generate_beastmode_body(
    name: str | None = None,
    filters: list[dict] | None = None,
    is_unlocked: bool | None = None,
    is_not_variable: bool | None = True,
    link: Search_BeastModeLink = None,
)

Build the POST body for /query/v1/functions/search.

The Functions API backs both beast modes and variables. The is_not_variable flag selects which:

  • True (default): exclude variables — beast modes only (adds notvariable).
  • False: only variables (adds variable).
  • None: no variable filter — return both.
Source code in src/crew_dcs/routes/beastmode.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
def generate_beastmode_body(
    name: str | None = None,
    filters: list[dict] | None = None,
    is_unlocked: bool | None = None,
    is_not_variable: bool | None = True,
    link: Search_BeastModeLink = None,
):
    """Build the POST body for ``/query/v1/functions/search``.

    The Functions API backs both beast modes and variables. The ``is_not_variable``
    flag selects which:

    - ``True`` (default): exclude variables — beast modes only (adds ``notvariable``).
    - ``False``: only variables (adds ``variable``).
    - ``None``: no variable filter — return both.
    """
    filters = list(filters or [])

    if is_not_variable is True:
        filters = [{"field": "notvariable"}, *filters]
    elif is_not_variable is False:
        filters = [{"field": "variable"}, *filters]

    if is_unlocked is True:
        filters = [{"field": "unlocked"}, *filters]

    if link is not None:
        link_value = link.value if isinstance(link, Search_BeastModeLink) else link
        filters = [{"field": "resourceType", "value": link_value}, *filters]

    return {
        "name": name or "",
        "filters": filters,
        "sort": {"field": "name", "ascending": True},
    }

get_beastmode_by_id async

get_beastmode_by_id(
    auth: DomoAuth,
    beastmode_id: str,
    include_hidden: bool = False,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Retrieve a specific BeastMode by its ID.

Fetches details for a single BeastMode identified by its unique ID. Returns information about the BeastMode including its formula, name, and associated resources.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
beastmode_id str

Unique identifier for the BeastMode to retrieve

required
include_hidden bool

Include hidden/internal calculations in the response

False
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
ResponseGetData

ResponseGetData object containing the specific BeastMode data

Raises:

Type Description
BeastMode_GET_Error

If BeastMode retrieval fails

SearchBeastModeNotFoundError: If no BeastMode with the specified ID exists

Example

beastmode_res = await get_beastmode_by_id(auth, "1165", include_hidden=True) bm_data = beastmode_res.response print(f"BeastMode: {bm_data['name']}")

Source code in src/crew_dcs/routes/beastmode.py
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
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_beastmode_by_id(
    auth: DomoAuth,
    beastmode_id: str,
    include_hidden: bool = False,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """
    Retrieve a specific BeastMode by its ID.

    Fetches details for a single BeastMode identified by its unique ID.
    Returns information about the BeastMode including its formula, name,
    and associated resources.

    Args:
        auth: Authentication object containing instance and credentials
        beastmode_id: Unique identifier for the BeastMode to retrieve
        include_hidden: Include hidden/internal calculations in the response
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        ResponseGetData object containing the specific BeastMode data

    Raises:
        BeastMode_GET_Error: If BeastMode retrieval fails
    SearchBeastModeNotFoundError: If no BeastMode with the specified ID exists

    Example:
        >>> beastmode_res = await get_beastmode_by_id(auth, "1165", include_hidden=True)
        >>> bm_data = beastmode_res.response
        >>> print(f"BeastMode: {bm_data['name']}")
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/template/{beastmode_id}"
    if include_hidden:
        url += "?hidden=true"

    res = await gd.get_data(
        auth=auth,
        method="GET",
        url=url,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        if res.status == 404:
            raise SearchBeastModeNotFoundError(
                search_criteria=f"ID: {beastmode_id}",
                res=res,
            )
        raise BeastMode_GET_Error(
            entity_id=str(beastmode_id),
            res=res,
        )

    return res

get_card_beastmodes async

get_card_beastmodes(
    auth: DomoAuth,
    card_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> list[dict]

Get BeastModes associated with a specific card.

Retrieves all BeastModes that are linked to the specified card. This function searches all BeastModes and filters for those with links to the given card ID.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
card_id str

Unique identifier for the card

required
return_raw bool

Return raw API response without filtering

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
list[dict]

list of BeastMode dictionaries containing id, name, locked status,

list[dict]

legacyId, status, and links

Example

card_beastmodes = await get_card_beastmodes(auth, "card-123") for bm in card_beastmodes: ... print(f"BeastMode: {bm['name']}")

Source code in src/crew_dcs/routes/beastmode.py
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
async def get_card_beastmodes(
    auth: DomoAuth,
    card_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> list[dict]:
    """
    Get BeastModes associated with a specific card.

    Retrieves all BeastModes that are linked to the specified card.
    This function searches all BeastModes and filters for those with
    links to the given card ID.

    Args:
        auth: Authentication object containing instance and credentials
        card_id: Unique identifier for the card
        return_raw: Return raw API response without filtering
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        list of BeastMode dictionaries containing id, name, locked status,
        legacyId, status, and links

    Example:
        >>> card_beastmodes = await get_card_beastmodes(auth, "card-123")
        >>> for bm in card_beastmodes:
        ...     print(f"BeastMode: {bm['name']}")
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    res = await search_beastmodes(
        auth=auth,
        context=context,
    )

    if return_raw:
        return res

    all_bms = res.response

    filter_bms = [
        bm
        for bm in all_bms
        if any(
            True
            for link in bm["links"]
            if link["resource"]["type"] == "CARD" and link["resource"]["id"] == card_id
        )
    ]

    return [
        {
            "id": bm["id"],
            "name": bm["name"],
            "locked": bm["locked"],
            "legacyId": bm["legacyId"],
            "status": bm["status"],
            "links": bm["links"],
        }
        for bm in filter_bms
    ]

lock_beastmode async

lock_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    is_locked: bool,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Lock or unlock a BeastMode.

Sets the lock status of a BeastMode to prevent or allow modifications. Locked BeastModes cannot be edited or deleted.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
beastmode_id str

Unique identifier for the BeastMode

required
is_locked bool

True to lock the BeastMode, False to unlock it

required
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
ResponseGetData

ResponseGetData object containing the updated BeastMode data

Raises:

Type Description
BeastMode_CRUD_Error

If lock/unlock operation fails

Example

result = await lock_beastmode(auth, "beastmode-123", is_locked=True) print(f"BeastMode locked: {result.is_success}")

Source code in src/crew_dcs/routes/beastmode.py
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def lock_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    is_locked: bool,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """
    Lock or unlock a BeastMode.

    Sets the lock status of a BeastMode to prevent or allow modifications.
    Locked BeastModes cannot be edited or deleted.

    Args:
        auth: Authentication object containing instance and credentials
        beastmode_id: Unique identifier for the BeastMode
        is_locked: True to lock the BeastMode, False to unlock it
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        ResponseGetData object containing the updated BeastMode data

    Raises:
        BeastMode_CRUD_Error: If lock/unlock operation fails

    Example:
        >>> result = await lock_beastmode(auth, "beastmode-123", is_locked=True)
        >>> print(f"BeastMode locked: {result.is_success}")
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/template/{beastmode_id}"

    body = {"locked": is_locked}

    res = await gd.get_data(
        auth=auth,
        method="PUT",
        url=url,
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        operation = "lock" if is_locked else "unlock"
        raise BeastMode_CRUD_Error(
            operation=operation,
            entity_id=str(beastmode_id),
            res=res,
        )

    return res

search_beastmodes async

search_beastmodes(
    auth: DomoAuth,
    filters: list[dict] | None = None,
    debug_loop: bool = False,
    name: str | None = None,
    is_unlocked: bool | None = None,
    is_not_variable: bool | None = True,
    link: Search_BeastModeLink | None = None,
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs
) -> ResponseGetData

Search for BeastModes with optional filters.

Searches for BeastModes (calculated fields) in the Domo instance using optional filter criteria. Returns a paginated list of matching BeastModes.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
filters list[dict] | None

Optional list of filter dictionaries to apply to the search

None
debug_loop bool

Enable detailed loop iteration logging

False
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
ResponseGetData

ResponseGetData object containing list of BeastModes

Raises:

Type Description
BeastMode_GET_Error

If search operation fails

Example

beastmodes_res = await search_beastmodes(auth) for bm in beastmodes_res.response: ... print(f"BeastMode: {bm['name']}, ID: {bm['id']}")

Source code in src/crew_dcs/routes/beastmode.py
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
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_beastmodes(
    auth: DomoAuth,
    filters: list[dict] | None = None,
    debug_loop: bool = False,
    name: str | None = None,
    is_unlocked: bool | None = None,
    is_not_variable: bool | None = True,
    link: Search_BeastModeLink | None = None,
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """
    Search for BeastModes with optional filters.

    Searches for BeastModes (calculated fields) in the Domo instance using
    optional filter criteria. Returns a paginated list of matching BeastModes.

    Args:
        auth: Authentication object containing instance and credentials
        filters: Optional list of filter dictionaries to apply to the search
        debug_loop: Enable detailed loop iteration logging
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        ResponseGetData object containing list of BeastModes

    Raises:
        BeastMode_GET_Error: If search operation fails

    Example:
        >>> beastmodes_res = await search_beastmodes(auth)
        >>> for bm in beastmodes_res.response:
        ...     print(f"BeastMode: {bm['name']}, ID: {bm['id']}")
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    offset_params = {
        "offset": "offset",
        "limit": "limit",
    }
    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/search"

    body = generate_beastmode_body(
        name=name,
        filters=filters,
        is_unlocked=is_unlocked,
        is_not_variable=is_not_variable,
        link=link,
    )

    def arr_fn(res) -> list[dict]:
        return res.response["results"]

    res = await gd.looper(
        auth=auth,
        method="POST",
        url=url,
        arr_fn=arr_fn,
        body=body,
        offset_params_in_body=True,
        offset_params=offset_params,
        loop_until_end=True,
        debug_loop=debug_loop,
        return_raw=return_raw,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise BeastMode_GET_Error(res=res)

    return res

search_variables async

search_variables(
    auth: DomoAuth,
    filters: list[dict] | None = None,
    name: str | None = None,
    debug_loop: bool = False,
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs
) -> ResponseGetData

Search for Domo variables.

Variables share the Functions API with beast modes; this is search_beastmodes with the variable filter instead of notvariable.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials.

required
filters list[dict] | None

Optional extra filter dictionaries.

None
name str | None

Optional name to filter by.

None
debug_loop bool

Enable detailed loop iteration logging.

False
return_raw bool

Return raw API response without processing.

False
context RouteContext | None

Optional RouteContext for request configuration.

None

Returns:

Type Description
ResponseGetData

ResponseGetData whose response is the list of variable function templates.

Source code in src/crew_dcs/routes/beastmode.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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_variables(
    auth: DomoAuth,
    filters: list[dict] | None = None,
    name: str | None = None,
    debug_loop: bool = False,
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Search for Domo variables.

    Variables share the Functions API with beast modes; this is
    ``search_beastmodes`` with the ``variable`` filter instead of ``notvariable``.

    Args:
        auth: Authentication object containing instance and credentials.
        filters: Optional extra filter dictionaries.
        name: Optional name to filter by.
        debug_loop: Enable detailed loop iteration logging.
        return_raw: Return raw API response without processing.
        context: Optional RouteContext for request configuration.

    Returns:
        ResponseGetData whose ``response`` is the list of variable function templates.
    """
    return await search_beastmodes(
        auth=auth,
        filters=filters,
        name=name,
        is_not_variable=False,
        debug_loop=debug_loop,
        context=context,
        return_raw=return_raw,
        **context_kwargs,
    )

update_beastmode async

update_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    name: str | None = None,
    expression: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Update an existing BeastMode template.

Only fields that are not None are included in the update body.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing instance and credentials

required
beastmode_id str

Unique identifier of the BeastMode to update

required
name str | None

New display name (omitted if None)

None
expression str | None

New formula expression (omitted if None)

None
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None
**context_kwargs

Additional context parameters

{}

Returns:

Type Description
ResponseGetData

ResponseGetData containing the updated BeastMode data

Raises:

Type Description
BeastMode_CRUD_Error

If update fails

Source code in src/crew_dcs/routes/beastmode.py
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_beastmode(
    auth: DomoAuth,
    beastmode_id: str,
    name: str | None = None,
    expression: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Update an existing BeastMode template.

    Only fields that are not None are included in the update body.

    Args:
        auth: Authentication object containing instance and credentials
        beastmode_id: Unique identifier of the BeastMode to update
        name: New display name (omitted if None)
        expression: New formula expression (omitted if None)
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration
        **context_kwargs: Additional context parameters

    Returns:
        ResponseGetData containing the updated BeastMode data

    Raises:
        BeastMode_CRUD_Error: If update fails
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/functions/template/{beastmode_id}"

    body: dict = {}
    if name is not None:
        body["name"] = name
    if expression is not None:
        body["expression"] = expression

    if not body:
        raise BeastMode_CRUD_Error(
            operation="update",
            entity_id=str(beastmode_id),
            message="update_beastmode requires at least one of: name, expression",
        )

    res = await gd.get_data(
        auth=auth,
        method="PUT",
        url=url,
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise BeastMode_CRUD_Error(
            operation="update",
            entity_id=str(beastmode_id),
            res=res,
        )

    return res