Source code for q2_sdk.hq.hq_api.q2_api.GetUserLoginInfoByLoginName

# This is an autogenerated file from the command "q2 generate_hq_api" and will be overwritten if run again

"""
Get user login information

Sample response (may differ slightly in your environment)

.. code-block:: xml

    <Q2API HqVersion="4.5.0.6095" HqAssemblyVersion="4.5.0.0" ServerDateTime="2024-03-06T13:27:15.0468572-06:00" AuditId="13633308">
        <Result>
            <ErrorCode ErrorType="Success">0</ErrorCode>
            <ErrorDescription />
            <HydraErrorReturnCode>0</HydraErrorReturnCode>
        </Result>
        <Data>
            <DalUserLogonList>
                <Q2_UserLogonList>
                    <UserLogonID>2</UserLogonID>
                    <UserID>2</UserID>
                    <LoginName>retail0</LoginName>
                    <Channel>Internet</Channel>
                    <LastChange>2022-01-28T11:58:12.947-06:00</LastChange>
                    <LastLogon>2024-03-06T12:55:37.09-06:00</LastLogon>
                    <Status>Normal</Status>
                    <LastFailed>2024-02-29T04:17:05.217-06:00</LastFailed>
                    <CreateDate>2022-01-28T11:56:35.353-06:00</CreateDate>
                    <NumInvalidAttempts>0</NumInvalidAttempts>
                    <AutoGenerated>false</AutoGenerated>
                    <StatusShortName>Normal</StatusShortName>
                    <FirstName>SDK</FirstName>
                    <MiddleName />
                    <LastName>User</LastName>
                    <CustomerName>Gorczany Inc Inc</CustomerName>
                    <IsCompany>false</IsCompany>
                    <GroupID>4</GroupID>
                    <GroupName>Q2 Test Group - DO NOT DELETE</GroupName>
                    <UseCustomerAccounts>false</UseCustomerAccounts>
                    <PlanName>No Charge</PlanName>
                    <CustomerID>2</CustomerID>
                    <ProfileUpdated>true</ProfileUpdated>
                    <CustomerPrimaryCIF>07212010</CustomerPrimaryCIF>
                    <UserPrimaryCIF>07212010</UserPrimaryCIF>
                    <UISourceID>1</UISourceID>
                    <ChallengeCodeEnabled>false</ChallengeCodeEnabled>
                    <IsEnrolledInBillpay>false</IsEnrolledInBillpay>
                    <SecurityAlertProfile>Commercial - Standard Events</SecurityAlertProfile>
                    <DashboardProfile>No Dashboard Elements</DashboardProfile>
                    <EmailAddress>noreply@q2ebanking.com</EmailAddress>
                    <HasAuthorizationToken>true</HasAuthorizationToken>
                    <IsCommercialGroup>true</IsCommercialGroup>
                    <IsCorporate>false</IsCorporate>
                    <ManageUsers>false</ManageUsers>
                    <ManageUserRoles>false</ManageUserRoles>
                    <UserStatus>Active</UserStatus>
                    <EffectiveUserStatus>Active</EffectiveUserStatus>
                    <UiSelectionShortName>q2</UiSelectionShortName>
                    <UiLanguageID>1</UiLanguageID>
                    <LanguageShortName>USEnglish</LanguageShortName>
                    <HasPendingChanges>false</HasPendingChanges>
                    <IsProduction>true</IsProduction>
                </Q2_UserLogonList>
            </DalUserLogonList>
        </Data>
    </Q2API>

"""

from dataclasses import dataclass

from typing import List, Optional, Union


from lxml.objectify import FloatElement, StringElement, IntElement, BoolElement

from q2_sdk.core.q2_logging.logger import Q2LoggerType
from q2_sdk.hq.models.hq_response import HqResponse
from q2_sdk.hq.models.hq_credentials import HqCredentials

from q2_sdk.hq.models.hq_params.q2_api import Q2ApiParamsObj
from q2_sdk.hq.models.hq_request.q2_api import Q2ApiRequest


[docs] class ParamsObj(Q2ApiParamsObj): """Parameters definition for GetUserLoginInfoByLoginName""" def __init__( self, logger: Q2LoggerType, end_user_logon_name: str, ui_source: str, hq_credentials: Optional[HqCredentials] = None, ): """ :param logger: Reference to calling request's logger (self.logger in your extension) :param end_user_logon_name: Q2_UserLogon.LoginName :param ui_source: ShortName of Q2_UiSource row. Should almost always be OnlineBanking :param hq_credentials: Defaults to settings.HQ_CREDENTIALS """ super().__init__(logger, hq_credentials) self.request_params.update({ "EndUserLogonName": end_user_logon_name, "UiSource": ui_source, })
[docs] @dataclass class Q2_UserLogonList: AutoGenerated: BoolElement ChallengeCodeEnabled: BoolElement Channel: StringElement CreateDate: StringElement CustomerID: IntElement CustomerName: StringElement CustomerPrimaryCIF: StringElement DashboardProfile: StringElement EffectiveUserStatus: StringElement EmailAddress: StringElement FirstName: StringElement GroupID: IntElement GroupName: StringElement HasAuthorizationToken: BoolElement HasPendingChanges: BoolElement IsCommercialGroup: BoolElement IsCompany: BoolElement IsCorporate: BoolElement IsEnrolledInBillpay: BoolElement IsProduction: BoolElement LanguageShortName: StringElement LastChange: StringElement LastFailed: StringElement LastLogon: StringElement LastName: StringElement LoginName: StringElement ManageUserRoles: BoolElement ManageUsers: BoolElement MiddleName: StringElement NumInvalidAttempts: IntElement PlanName: StringElement ProfileUpdated: BoolElement SecurityAlertProfile: StringElement Status: StringElement StatusShortName: StringElement UISourceID: IntElement UiLanguageID: IntElement UiSelectionShortName: StringElement UseCustomerAccounts: BoolElement UserID: IntElement UserLogonID: IntElement UserPrimaryCIF: StringElement UserStatus: StringElement
[docs] @dataclass class DalUserLogonList: Q2_UserLogonList: Union[Q2_UserLogonList, List[Q2_UserLogonList]]
[docs] @dataclass class Data: DalUserLogonList: Union[DalUserLogonList, List[DalUserLogonList]]
[docs] class ResultNode: def __init__(self): self.Data = Data()
[docs] class HqResponse(HqResponse): def __init__(self, raw_response: Union[str, dict]): super().__init__(raw_response) self.result_node: ResultNode = None
[docs] async def execute(params_obj: ParamsObj, use_json=False, **kwargs) -> HqResponse: """ This is the default way to submit the request to HQ. In theory, both json and soap payloads are equally accepted by HQ, though several variables may affect that (HQ version, Q2SDK implementation bugs, etc). This should not affect anything about the way your code deals with the data. In fact, the only difference to consuming extensions is the logging. Basically, call this with default parameters unless you find a compelling reason not to. :param params_obj: Object containing everything necessary to call this HQ endpoint :param use_json: If True, will call HQ's .ashx (json) endpoint instead of .asmx (soap) """ request = Q2ApiRequest("GetUserLoginInfoByLoginName", use_json=use_json, **kwargs) return await request.execute(params_obj, **kwargs)
[docs] async def get_soap(params_obj: ParamsObj, **kwargs) -> HqResponse: """Deprecated. Please use execute instead""" params_obj.logger.warning( "GetUserLoginInfoByLoginName.get_soap is deprecated. Please use GetUserLoginInfoByLoginName.execute instead." ) return await execute(params_obj, **kwargs)
[docs] async def get_json(params_obj: ParamsObj, **kwargs) -> HqResponse: """Deprecated. Please use execute instead""" params_obj.logger.warning( "GetUserLoginInfoByLoginName.get_json is deprecated. Please use GetUserLoginInfoByLoginName.execute instead." ) return await execute(params_obj, use_json=True, **kwargs)
[docs] def build_json(params_obj: ParamsObj): return Q2ApiRequest.build_json(params_obj)
[docs] def build_soap(params_obj: ParamsObj): return Q2ApiRequest("GetUserLoginInfoByLoginName", use_json=False).build_soap( params_obj )