User Attribute Routes


source

UserAttributes_CRUD_Error

 UserAttributes_CRUD_Error (status, message, domo_instance,
                            parent_class:str=None, function_name:str=None)

base exception


source

UserAttributes_GET_Error

 UserAttributes_GET_Error (status, message, domo_instance,
                           parent_class:str=None, function_name:str=None)

base exception


source

UserAttributes_IssuerType

 UserAttributes_IssuerType (value, names=None, module=None, qualname=None,
                            type=None, start=1)

An enumeration.

[{member.name, member.value} for member in UserAttributes_IssuerType]

source

get_user_attributes

 get_user_attributes (auth:domolibrary.client.DomoAuth.DomoAuth,
                      issuer_type_ls:List[__main__.UserAttributes_IssuerTy
                      pe]=None, session:httpx.AsyncClient=None,
                      debug_api:bool=False, parent_class=None,
                      debug_num_stacks_to_drop=1)

retrieves user attributes from Domo user attributes can be UserAttributes_IssuerType – idp, domo, or user-generated API does not filter on the issuer type (despite API accepting filter parameter)

Type Default Details
auth DomoAuth
issuer_type_ls List None
session AsyncClient None use UserAttributes_IssuerType enum
debug_api bool False
parent_class NoneType None
debug_num_stacks_to_drop int 1
# import domolibrary.client.DomoAuth as dmda

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

res = await get_user_attributes(
    auth=token_auth, issuer_type_ls=[UserAttributes_IssuerType.CUSTOM], debug_api=False
)

res.response

source

get_user_attribute_by_id

 get_user_attribute_by_id (auth:domolibrary.client.DomoAuth.DomoAuth,
                           attribute_id:str,
                           session:httpx.AsyncClient=None,
                           debug_api:bool=False, parent_class=None,
                           debug_num_stacks_to_drop=1)

retrieves user attributes from Domo user attributes can be UserAttributes_IssuerType – idp, domo, or user-generated API does not filter on the issuer type (despite API accepting filter parameter)

# import domolibrary.client.DomoAuth as dmda

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

res = await get_user_attribute_by_id(
    attribute_id="DomoLibraryTestFranchise", auth=token_auth, debug_api=False
)

res.response

source

clean_attribute_id

 clean_attribute_id (text)

source

create_user_attribute

 create_user_attribute (auth:domolibrary.client.DomoAuth.DomoAuth,
                        attribute_id, name=None, description=None,
                        data_type:str=None, security_voter=None, issuer_ty
                        pe:__main__.UserAttributes_IssuerType=None,
                        session:httpx.AsyncClient=None,
                        debug_api:bool=False, parent_class=None,
                        debug_num_stacks_to_drop=1)

source

generate_create_user_attribute_body

 generate_create_user_attribute_body (attribute_id:str, name:str=None,
                                      description:str=None, issuer_type:__
                                      main__.UserAttributes_IssuerType=Non
                                      e, security_voter:str=None,
                                      data_type:str=None)
# import domolibrary.client.DomoAuth as dmda

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

try:
    res = await create_user_attribute(
        auth=token_auth,
        attribute_id="Test Library Store",
        name="test library store",
        debug_api=False,
    )

    print(res)
except UserAttributes_CRUD_Error as e:
    print(e)

source

update_user_attribute

 update_user_attribute (auth:domolibrary.client.DomoAuth.DomoAuth,
                        attribute_id, name=None, description=None, issuer_
                        type:__main__.UserAttributes_IssuerType=<UserAttri
                        butes_IssuerType.CUSTOM: 'customer-defined'>,
                        data_type:str=None, security_voter=None,
                        session:httpx.AsyncClient=None,
                        debug_api:bool=False, parent_class=None,
                        debug_num_stacks_to_drop=1)

body must include all attribute parameters, this route wil use the get_user_attribute_by_id function to retrieve existing values (and throw an error if not found) to construct an update statement

# import domolibrary.client.DomoAuth as dmda

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)
try:
    res = await update_user_attribute(
        auth=token_auth,
        attribute_id="TestLibraryStore",
        name=None,
        description=None,
        debug_api=False,
    )

    print(res)

except (UserAttributes_GET_Error, UserAttributes_CRUD_Error) as e:
    print(e)

source

delete_user_attribute

 delete_user_attribute (auth:domolibrary.client.DomoAuth.DomoAuth,
                        attribute_id, session:httpx.AsyncClient=None,
                        debug_api:bool=False, parent_class=None,
                        debug_num_stacks_to_drop=1)
# import domolibrary.client.DomoAuth as dmda

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

try:
    res = await delete_user_attribute(
        auth=token_auth, attribute_id="TestLibraryStore", debug_api=False
    )
    print(res)

except UserAttributes_CRUD_Error as e:
    print(e)