"""Interface for the ows-account microservice.""" from owsresponse import response, status as ows_status from notifications.api import ows_client from notifications.constants import error from notifications.constants.service_name import OWS_ACCOUNT def get_vendor_assigned_to(vendor_id: str | int) -> response.Response: """Get vendor assigned to.""" response_ = ows_client.get(OWS_ACCOUNT, f'/vendor/{vendor_id}/assigned-to') if response_.status_code != ows_status.OK: return response.create_error_response( status=response_.status_code, code=error.ERROR_CODE_OWS_ACCOUNT_REQUEST, message=response_.text, ) response_data = response_.json() if not response_data: return response.create_not_found_response('No assign found') return response.Response(response_data)