AddCustomerCse module
- class q2_sdk.hq.hq_api.backoffice.AddCustomerCse.ParamsObj(logger, hq_credentials, dal_customer_edit=None, customer_rights=None)[source]
Bases:
BackOfficeAuthenticatedParamsObjParameters definition for AddCustomerCse
See also
AddCustomerCse_modelsfor DataSet schemas and builder functions.- Parameters:
logger (
TypeAliasType) – Reference to calling request’s logger (self.logger in your extension)dal_customer_edit (
Optional[DataSetBuilder]) – DataSetBuilder instancecustomer_rights (
Optional[DataSetBuilder]) – DataSetBuilder instancehq_credentials (
BackOfficeHqCredentials) – Defaults to settings.HQ_CREDENTIALS
- async q2_sdk.hq.hq_api.backoffice.AddCustomerCse.execute(params_obj, use_json=True, **kwargs)[source]
This is the default way to submit the request to HQ.
This endpoint uses DataSet parameters and defaults to the JSON (.ashx) transport. SOAP (.asmx) is not supported for DataSet serialization.
- Parameters:
params_obj (
ParamsObj) – Object containing everything necessary to call this HQ endpointuse_json – If True, will call HQ’s .ashx (json) endpoint instead of .asmx (soap)
- Return type:
- async q2_sdk.hq.hq_api.backoffice.AddCustomerCse.fetch_current(logger, hq_credentials, id, refresh_accounts)[source]
Fetch current state from GetCustomerByIDWithRefreshAccounts for optimistic concurrency.
Calls the GET operation and parses the response into typed model instances with
original_recordpre-populated. Modify the returned instances and pass them to the correspondingbuild_*_dataset()function.Workflow:
# 1. Fetch current state (pre-populates original_record on each instance) current = await AddCustomerCse.fetch_current(logger, hq_creds, ...) # 2. Modify the returned dataclass instances instance = current["ModelClassName"][0] instance.some_field = new_value # 3. Build dataset and execute (original_record produces the Unchanged row) dataset = build_*_dataset(instance) params = AddCustomerCse.ParamsObj(logger, hq_creds, param=dataset) await AddCustomerCse.execute(params)
See also
- Parameters:
logger (
TypeAliasType) – Calling request’s logger (self.logger in your extension)hq_credentials (
BackOfficeHqCredentials) – HQ credentials for the BackOffice sessionid (
int) – Entity identifier for the GET callrefresh_accounts (
bool) – Entity identifier for the GET call
- Return type:
- Returns:
Dict mapping model class names to lists of populated instances
- Raises:
RuntimeError – If the GET operation fails or returns no data