Skip to content

user_attributes

user_attributes

UserAttribute dataclass

UserAttribute(
    auth: DomoAuth,
    id: str,
    raw: dict,
    name: str,
    description: str,
    issuer_type: UserAttributes_IssuerType,
    customer_id: str,
    value_type: str,
    validator: str,
    validator_configuration: None,
    security_voter: str,
    custom: bool,
)

Bases: DomoEntity

utility class that absorbs many of the domo instance configuration methods

get_by_id async classmethod

get_by_id(
    auth: DomoAuth,
    entity_id: str,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@classmethod
async def get_by_id(
    cls,
    auth: DomoAuth,
    entity_id: str,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    res = await user_attribute_routes.get_user_attribute_by_id(
        auth=auth,
        entity_id=entity_id,
        context=context,
    )

    if return_raw:
        return res
    return cls.from_dict(obj=res.response, auth=auth)

get_entity_by_id async classmethod

get_entity_by_id(auth: DomoAuth, entity_id: str, **kwargs)

Fetch a user attribute by ID; delegates to get_by_id.

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
64
65
66
67
@classmethod
async def get_entity_by_id(cls, auth: DomoAuth, entity_id: str, **kwargs):
    """Fetch a user attribute by ID; delegates to ``get_by_id``."""
    return await cls.get_by_id(auth=auth, entity_id=entity_id, **kwargs)

update async

update(
    name=None,
    description=None,
    issuer_type: UserAttributes_IssuerType | None = None,
    data_type: str | None = None,
    security_voter=None,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
129
130
131
132
133
134
135
136
137
138
139
async def update(
    self,
    name=None,
    description=None,
    issuer_type: user_attribute_routes.UserAttributes_IssuerType | None = None,
    data_type: str | None = None,
    security_voter=None,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    await user_attribute_routes.update_user_attribute(
        auth=self.auth,
        attribute_id=self.id,
        name=name,
        description=description,
        issuer_type=issuer_type,
        data_type=data_type,
        security_voter=security_voter,
        context=context,
    )

    new = await UserAttribute.get_by_id(
        entity_id=self.id, auth=self.auth, context=context
    )

    [setattr(self, key, value) for key, value in new.__dict__.items()]

    return self

UserAttributes dataclass

UserAttributes(
    auth: DomoAuth, attributes: list[UserAttribute] = list()
)

Bases: DomoManager

create async

create(
    attribute_id: str,
    name=None,
    description=f"updated via domolibrary {strftime('%Y-%m-%d - %H:%M')}",
    data_type: str = "ANY_VALUE",
    security_voter="FULL_VIS_ADMIN_IDP",
    issuer_type: UserAttributes_IssuerType | None = CUSTOM,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
async def create(
    self,
    attribute_id: str,
    name=None,
    description=f"updated via domolibrary {dt.datetime.now().strftime('%Y-%m-%d - %H:%M')}",  # noqa: B008
    data_type: str = "ANY_VALUE",
    security_voter="FULL_VIS_ADMIN_IDP",
    issuer_type: (
        user_attribute_routes.UserAttributes_IssuerType | None
    ) = user_attribute_routes.UserAttributes_IssuerType.CUSTOM,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    auth = self.auth
    attribute_id = user_attribute_routes.clean_attribute_id(attribute_id)

    res = await user_attribute_routes.create_user_attribute(
        auth=auth,
        issuer_type=issuer_type,
        name=name,
        attribute_id=attribute_id,
        description=description,
        data_type=data_type,
        security_voter=security_voter,
        context=context,
    )

    await self.get(context=context)

    if return_raw:
        return res

    return await UserAttribute.get_by_id(
        auth=auth, entity_id=attribute_id, context=context
    )

get async

get(
    issuer_type_ls: list[UserAttributes_IssuerType] = [],
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
async def get(
    self,
    issuer_type_ls: list[
        user_attribute_routes.UserAttributes_IssuerType
    ] = [],  # use `UserAttributes_IssuerType` enum  # noqa: B006
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    auth = self.auth

    res = await user_attribute_routes.get_user_attributes(
        auth=auth,
        issuer_type_ls=issuer_type_ls,
        context=context,
    )

    if return_raw:
        return res

    self.attributes = [
        UserAttribute.from_dict(obj=obj, auth=auth) for obj in res.response
    ]
    return self.attributes

create async

create(
    self: UserAttributes,
    attribute_id: str,
    name=None,
    description=f"updated via domolibrary {strftime('%Y-%m-%d - %H:%M')}",
    data_type: str = "ANY_VALUE",
    security_voter="FULL_VIS_ADMIN_IDP",
    issuer_type: UserAttributes_IssuerType | None = CUSTOM,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
async def create(
    self: UserAttributes,
    attribute_id: str,
    name=None,
    description=f"updated via domolibrary {dt.datetime.now().strftime('%Y-%m-%d - %H:%M')}",  # noqa: B008
    data_type: str = "ANY_VALUE",
    security_voter="FULL_VIS_ADMIN_IDP",
    issuer_type: (
        user_attribute_routes.UserAttributes_IssuerType | None
    ) = user_attribute_routes.UserAttributes_IssuerType.CUSTOM,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    auth = self.auth
    attribute_id = user_attribute_routes.clean_attribute_id(attribute_id)

    res = await user_attribute_routes.create_user_attribute(
        auth=auth,
        issuer_type=issuer_type,
        name=name,
        attribute_id=attribute_id,
        description=description,
        data_type=data_type,
        security_voter=security_voter,
        context=context,
    )

    await self.get(context=context)

    if return_raw:
        return res

    return await UserAttribute.get_by_id(
        auth=auth, entity_id=attribute_id, context=context
    )

delete async

delete(
    self: UserAttributes,
    attribute_id: str,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
async def delete(
    self: UserAttributes,
    attribute_id: str,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    auth = self.auth

    res = await user_attribute_routes.delete_user_attribute(
        auth=auth,
        attribute_id=attribute_id,
        context=context,
    )

    await self.get(context=context)

    return res

update async

update(
    self: UserAttribute,
    name=None,
    description=None,
    issuer_type: UserAttributes_IssuerType | None = None,
    data_type: str | None = None,
    security_voter=None,
    session: AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoInstanceConfig/user_attributes.py
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
169
170
171
172
173
174
175
176
177
178
179
180
181
async def update(
    self: UserAttribute,
    name=None,
    description=None,
    issuer_type: user_attribute_routes.UserAttributes_IssuerType | None = None,
    data_type: str | None = None,
    security_voter=None,
    session: httpx.AsyncClient | None = None,
    debug_api: bool = False,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    await user_attribute_routes.update_user_attribute(
        auth=self.auth,
        attribute_id=self.id,
        name=name,
        description=description,
        issuer_type=issuer_type,
        data_type=data_type,
        security_voter=security_voter,
        context=context,
    )

    new = await UserAttribute.get_by_id(
        entity_id=self.id, auth=self.auth, context=context
    )

    [setattr(self, key, value) for key, value in new.__dict__.items()]

    return self