routes
routes ¶
Route functions — the HTTP boundary of crew_dcs.
Every module in this package maps to one Domo API endpoint family
(access_token.py ↔ /api/data/v1/accesstokens, card.py ↔ the card
APIs, jupyter/ ↔ the Jupyter Workspace APIs, ...), and each function in
a module maps to a single endpoint operation. Routes are deliberately
thin: they build the URL, call crew_dcs.client.get_data.get_data(),
check ResponseGetData.is_success, raise a route-level exception on
failure, and hand back the payload essentially as Domo returned it.
Minimal business logic is a feature, not a gap:
- Predictability — what Domo's API returns is what you get; there is no hidden transformation to reverse-engineer when debugging.
- Docs transfer — Domo's own API documentation (or a browser network trace) applies directly to a route's inputs and outputs.
- Safe composition — the curated entity classes in
crew_dcs.classesbuild on routes without fighting baked-in opinions.
Domo's API documentation for these endpoint families lives in the Domo API Reference.
Anatomy of a route function¶
Abridged from access_token.py — every route follows this shape:
@gd.route_function
@log_call(level_name="route", ...)
async def get_access_tokens(
auth: DomoAuth,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> rgd.ResponseGetData:
url = f"https://{auth.domo_instance}.domo.com/api/data/v1/accesstokens"
res = await gd.get_data(url=url, method="GET", auth=auth, context=context)
if not res.is_success:
raise AccessToken_GET_Error(res=res)
return res
The common signature is auth, domain arguments, then an optional
context: RouteContext | None plus **context_kwargs — so every route
accepts the same debugging/session knobs (debug_api, dry_run,
session, is_log_route, ...) regardless of which API it wraps. The
@gd.route_function decorator builds the RouteContext for you; pass a
pre-built one to share a session or settings across calls.
Route exceptions¶
Each module defines its own exception subclasses of
crew_dcs.base.exceptions.RouteError, named after the HTTP method family:
<Thing>_GET_Error for retrieval failures, <Thing>_CRUD_Error for
create/update/delete failures (plus domain-specific ones where useful,
e.g. SearchAccessTokenNotFoundError). They all carry the failed
ResponseGetData as .res, so the status, response body, and request
metadata stay inspectable inside an except block.
Pagination¶
Collection endpoints are typically wrapped with
crew_dcs.client.get_data.looper(), which iterates offset/limit pages and
aggregates the records — set loop_until_end=True to drain a collection.
Prefer crew_dcs.classes for application code; drop to routes when no
entity wrapper exists yet, when you need the exact API payload, or when
you want the route-level exception types.
Modules¶
access_tokenaccountactivity_logaialertsappdbapplicationappstudioauthbeastmodebootstrapbrandkitbuzzcardcard_gapscloud_amplifiercodeenginedatacenterdataflowdataflow_gapsdatasetenterprise_appsfilesetsfilesharegrantgroupinstance_configjupytermetricsobjectivespagepage_gapspdppublishrolesandboxscheduled_reportsuserworkflows