from q2_sdk.core.q2_logging.logger import Q2LoggerType
from q2_sdk.hq.models.hq_credentials import BackOfficeHqCredentials
from .base import BaseParamsObj
[docs]
class BackOfficeParamsObj(BaseParamsObj):
"""
For use with HQ Endpoints defined within the BackOffice.asmx route
"""
ENDPOINT_PATH = "Backoffice"
def __init__(self, logger, hq_credentials):
super().__init__(logger, hq_credentials=hq_credentials)
if not self.hq_credentials.hq_url:
self.hq_url = "{}/{}".format(
self.hq_credentials.reported_hq_url, self.ENDPOINT_PATH
)
[docs]
class BackOfficeAuthenticatedParamsObj(BackOfficeParamsObj):
"""
Same as BackOfficeParamsObj but requires a BackOfficeHqCredentials type as input
"""
def __init__(
self,
logger: Q2LoggerType,
hq_credentials: BackOfficeHqCredentials,
):
msg = "BackOffice endpoints expect BackOfficeHqCredentials"
assert isinstance(hq_credentials, BackOfficeHqCredentials), msg
super().__init__(logger, hq_credentials)