# This is an autogenerated file from the command "q2 generate_hq_api" and will be overwritten if run again
from typing import cast, Optional
from q2_sdk.core.q2_logging.logger import Q2LoggerType
from q2_sdk.hq.models.hq_credentials import BackOfficeHqCredentials
from q2_sdk.hq.models.hq_params.backoffice import BackOfficeAuthenticatedParamsObj
from q2_sdk.hq.models.hq_request.backoffice import BackOfficeRequest
from q2_sdk.hq.models.backoffice_response import BackOfficeResponse
[docs]
class ParamsObj(BackOfficeAuthenticatedParamsObj):
"""Parameters definition for CreateOnlineLogonAdminTokens"""
def __init__(self, logger: Q2LoggerType, hq_credentials: BackOfficeHqCredentials):
"""
:param logger: Reference to calling request's logger (self.logger in your extension)
:param hq_credentials: Defaults to settings.HQ_CREDENTIALS
"""
super().__init__(logger, hq_credentials)
self.request_params.update({})
[docs]
async def execute(
params_obj: ParamsObj, use_json=False, **kwargs
) -> BackOfficeResponse:
"""
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 = BackOfficeRequest(
"CreateOnlineLogonAdminTokens", use_json=use_json, **kwargs
)
return cast(BackOfficeResponse, await request.execute(params_obj, **kwargs))
[docs]
def build_json(params_obj: ParamsObj):
return BackOfficeRequest.build_json(params_obj)
[docs]
def build_soap(params_obj: ParamsObj):
return BackOfficeRequest("CreateOnlineLogonAdminTokens", use_json=False).build_soap(
params_obj
)