Skip to content

core

core

DomoAppStudio dataclass

DomoAppStudio(
    auth: DomoAuth,
    id: int,
    raw: dict,
    title: str = None,
    is_locked: bool = None,
    owners: list = list(),
    custom_attributes: dict = dict(),
    Lineage: DomoLineage = None,
    Definition: (
        DomoAppStudio_DefinitionManager | None
    ) = None,
    Views: DomoAppStudio_ViewsManager | None = None,
)

Bases: DomoEntity_w_Lineage

from_dict classmethod

from_dict(auth: DomoAuth, obj: dict[str, Any])

Create a DomoAppStudio instance from a dictionary representation.

Source code in src/crew_dcs/classes/DomoAppStudio/core.py
165
166
167
168
@classmethod
def from_dict(cls, auth: DomoAuth, obj: dict[str, Any]):
    """Create a DomoAppStudio instance from a dictionary representation."""
    return cls._from_content_stacks_v3(page_obj=obj, auth=auth)

optimize_style async

optimize_style(
    preset_name: str = "minimal_light",
    save: bool = True,
    *,
    context: RouteContext | None = None,
    **context_kwargs
)

Apply a style preset to the entire app (definition + all views).

Convenience method that delegates to the styling optimizer module.

Parameters:

Name Type Description Default
preset_name str

Name of the preset to apply (case-insensitive). Available presets: MINIMAL_LIGHT, MINIMAL_DARK, EXECUTIVE, DENSE.

'minimal_light'
save bool

If True, saves all changes to the API.

True
context RouteContext | None

Optional RouteContext for request configuration.

None
**context_kwargs

Additional context parameters.

{}

Returns:

Type Description

The updated AppStudioDefinition.

Source code in src/crew_dcs/classes/DomoAppStudio/core.py
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
async def optimize_style(
    self,
    preset_name: str = "minimal_light",
    save: bool = True,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    """Apply a style preset to the entire app (definition + all views).

    Convenience method that delegates to the styling optimizer module.

    Args:
        preset_name: Name of the preset to apply (case-insensitive).
            Available presets: MINIMAL_LIGHT, MINIMAL_DARK, EXECUTIVE, DENSE.
        save: If True, saves all changes to the API.
        context: Optional RouteContext for request configuration.
        **context_kwargs: Additional context parameters.

    Returns:
        The updated AppStudioDefinition.
    """
    from .styling_optimizer import get_preset_by_name, optimize_app

    context = RouteContext.build_context(context=context, **context_kwargs)
    preset = get_preset_by_name(preset_name)

    return await optimize_app(
        app=self,
        preset=preset,
        save=save,
        context=context,
    )

DomoAppStudios dataclass

DomoAppStudios()

get_appstudios async classmethod

get_appstudios(
    auth=DomoAuth,
    return_raw: bool = False,
    debug_api: bool = False,
    debug_loop: bool = False,
    session: AsyncClient = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
)

use admin_summary to retrieve all appstudios in an instance -- regardless of user access NOTE: some appstudios APIs will not return results if appstudio access isn't explicitly shared

Source code in src/crew_dcs/classes/DomoAppStudio/core.py
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
461
462
463
464
@classmethod
async def get_appstudios(
    cls,
    auth=DomoAuth,
    return_raw: bool = False,
    debug_api: bool = False,
    debug_loop: bool = False,
    session: httpx.AsyncClient = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    """use admin_summary to retrieve all appstudios in an instance -- regardless of user access
    NOTE: some appstudios APIs will not return results if appstudio access isn't explicitly shared
    """
    is_close_session = not session

    session = session or httpx.AsyncClient()

    context = RouteContext.build_context(
        session=session,
        debug_api=debug_api,
        parent_class=cls.__name__,
        **context_kwargs,
    )

    try:
        res = await appstudio_routes.get_appstudios_adminsummary(
            auth=auth, debug_loop=debug_loop, context=context
        )

        if return_raw:
            return res

        if not res.is_success:
            raise Exception("unable to retrieve appstudios")

        return await dmce.gather_with_concurrency(
            n=60,
            *[  # noqa: B026
                DomoAppStudio._from_adminsummary(
                    page_obj, auth=auth, context=context
                )
                for page_obj in res.response
            ],
        )

    finally:
        if is_close_session:
            await session.aclose()