def search_records_using(searchtype): soapheaders = get_soapheaders() if soapheaders: soapheaders['searchPreferences'] = SearchPreferences( bodyFieldsOnly=False, returnSearchColumns=True, pageSize=20) return get_service().search(searchRecord=searchtype, _soapheaders=soapheaders)
def get_async_job_status(job_id): soapheaders = get_soapheaders() if not job_id: return None if not soapheaders: return None response = get_service().checkAsyncStatus(jobId=job_id, _soapheaders=soapheaders) return response
def async_update_multiple(array_of_records): soapheaders = get_soapheaders() if not array_of_records: return None if not soapheaders: return None if len(array_of_records) == 0: return None response = get_service().asyncUpdateList(array_of_records, _soapheaders=soapheaders) return response
def get_multiple(array_of_record_references): soapheaders = get_soapheaders() if not array_of_record_references: return None if len(array_of_record_references) == 0: return None if not soapheaders: return None response = get_service().getList(array_of_record_references, _soapheaders=soapheaders) return response
def get_or_create_customer(customer_data): soapheaders = get_soapheaders() if not soapheaders: return None """ Lookup customer, add a customer if lookup fails. """ internal_id = lookup_customer_id_by_name_and_email(customer_data) if not internal_id: customer_data['entityId'] = str(uuid.uuid4()) customer = Customer(**customer_data) response = get_service().add(customer, _soapheaders=soapheaders) r = response.body.writeResponse if r.status.isSuccess: internal_id = r.baseRef.internalId return get_customer(internal_id)
def delete(record): return _call(record, get_service().delete)
def update(record): return _call(record, get_service().update)
def add(record): return _call(record, get_service().add)
def get(record): return _call(record, get_service().get)