def get_verify_sms_token(self, mobile, token, insurance_centre_sub_domain,
                             alias_name, resource, x_api_key):
        """Does a GET request to /Account/verifySmsToken.

        تایید توکن پیامک شده به کاربر، برای احراز هویت

        Args:
            mobile (string): شماره موبایل
            token (int): توکن دریافتی کاربر از پیامک
            insurance_centre_sub_domain (string): دامنه یا زیر دامنه ی اختصاصی
                مرکز بیمه
            alias_name (string): نام و نام خانوادگی کاربر
            resource (string): دامنه ی درخواست دهنده
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            Status200: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/Account/verifySmsToken'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'mobile': mobile,
            'token': token,
            'insuranceCentreSubDomain': insurance_centre_sub_domain,
            'aliasName': alias_name,
            'resource': resource
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)

        # Endpoint and global error handling using HTTP status codes.
        if _context.response.status_code == 400:
            raise Status400Exception('Bad Request', _context)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          Status200.from_dictionary)
Example #2
0
    def add_query_parameter(self, name, value):
        """ Add a query parameter to the HttpRequest.

        Args:
	        name (string): The name of the query parameter.
            value (string): The value of the query parameter.

        """
        self.query_url = APIHelper.append_url_with_query_parameters(self.query_url,
                                                                    {name:value})
        self.query_url = APIHelper.clean_url(self.query_url)
    def get_insurance_policy_tracking(self, tracking_code, national_code,
                                      x_api_key):
        """Does a GET request to /InsurancePolicy/Tracking.

        پیگیری وضعیت بیمه نامه

        Args:
            tracking_code (int): شماره ی پیگیری بیمه نامه
            national_code (long|int): کد ملی کاربر
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelInsurancePolicyTracking: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/InsurancePolicy/Tracking'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'trackingCode': tracking_code,
            'nationalCode': national_code
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)

        # Endpoint and global error handling using HTTP status codes.
        if _context.response.status_code == 500:
            raise InternalServerErrorException('Internal Server Error',
                                               _context)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            BaseModelInsurancePolicyTracking.from_dictionary)
    def get_tracking_code(self,
                          tracking_code,
                          x_api_key):
        """Does a GET request to /TrackingDamage/TrackingCode/.

        استعلام وضعیت خسارت

        Args:
            tracking_code (string): کد پیگیری خسارت
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelTrakingCode: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/TrackingDamage/TrackingCode/'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            '/{TrackingCode}': tracking_code
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)

        # Endpoint and global error handling using HTTP status codes.
        if _context.response.status_code == 400:
            raise Status400Exception('Bad Request', _context)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, BaseModelTrakingCode.from_dictionary)
    def get_fire_insurance(self,
                           sub_domain,
                           insurance_policy_id,
                           x_api_key):
        """Does a GET request to /FireInsurance/Initialize.

        دریافت اطلاعات پایه بیمه ی آتش سوزی

        Args:
            sub_domain (string): دامنه یا زیر دامنه ی مرکز بیمه
            insurance_policy_id (int): شناسه ی بیمه نامه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelFireInsurance: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/FireInsurance/Initialize'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'subDomain': sub_domain,
            'insurancePolicyId': insurance_policy_id
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, BaseModelFireInsurance.from_dictionary)
    def get_has_plan(self,
                     sub_domain,
                     insurance_policy_type,
                     x_api_key):
        """Does a GET request to /InsurancePolicyPlan/HasPlan.

        آیا این نوع بیمه نامه، طرح بیمه ای دارد؟

        Args:
            sub_domain (string): دامنه یا زیر دامنه ی مرکز بیمه
            insurance_policy_type (int): شناسه ی نوع بیمه نامه => بیمه بدنه=2
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            HasPlan: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/InsurancePolicyPlan/HasPlan'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'subDomain': sub_domain,
            'insurancePolicyType': insurance_policy_type
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, HasPlan.from_dictionary)
    def upload(self, sub_domain, x_api_key, file):
        """Does a POST request to /FileManager/Upload.

        آپلود فایل در ایزی بیمه
        بعد از آپلود، ادرس فایل باید در api های بعدی ارسال شود.

        Args:
            sub_domain (string): دامنه یا زیر دامنه ی مرکز بیمه
            x_api_key (string): کلید اختصاصی ارتباط با سرور
            file (string): فایل ارسالی

        Returns:
            BaseModelUpload: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/FileManager/Upload'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {'subDomain': sub_domain}
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare form parameters
        _form_parameters = {'file': file}

        # Prepare and execute request
        _request = self.http_client.post(_query_url,
                                         headers=_headers,
                                         parameters=_form_parameters)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          BaseModelUpload.from_dictionary)
    def get_send_sms_token(self, mobile, insurance_centre_sub_domain,
                           x_api_key):
        """Does a GET request to /Account/SendSmsToken.

        ارسال توکن تایید شماره تماس، برای احراز هویت کاربر

        Args:
            mobile (string): شماره موبایل
            insurance_centre_sub_domain (string): دامنه یا زیردامنه ی مرکز
                بیمه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            SendSmsToken: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/Account/SendSmsToken'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'mobile': mobile,
            'insuranceCentreSubDomain': insurance_centre_sub_domain
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          SendSmsToken.from_dictionary)
    def get_medical_specialties(self,
                                id,
                                x_api_key):
        """Does a GET request to /MedicalSpecialties.

        دریافت لیست تخصص های پزشکی

        Args:
            id (string): نوع تخصص => ParamedicalExpertise => پیراپزشکی
                MedicalExpertise => پزشکی
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelMedicalSpecialties: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/MedicalSpecialties'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'id': id
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, BaseModelMedicalSpecialties.from_dictionary)
    def get_status(self,
                   entity_id,
                   x_api_key):
        """Does a GET request to /Status.

        دریافت اطلاعات وضعیت

        Args:
            entity_id (int): شناسه ی وضعیت
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelStatus: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/Status'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'entityId': entity_id
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, BaseModelStatus.from_dictionary)
Example #11
0
    def get_device_brand_types(self, device_group, device_type_id, x_api_key):
        """Does a GET request to /ComboData/DeviceBrandTypes.

        دریافت لیست نوع برند دستگاه

        Args:
            device_group (int): شناسه ی گروه دستگاه
            device_type_id (int): شناسه ی نوع دستگاه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelDeviceBrandTypes: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/ComboData/DeviceBrandTypes'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'deviceGroup': device_group,
            'deviceTypeId': device_type_id
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            BaseModelDeviceBrandTypes.from_dictionary)
    def get_risk_level(self,
                       insurance_policy_type,
                       x_api_key):
        """Does a GET request to /ComboData/RiskLevel.

        دریافت لیست تخفیف های بیمه

        Args:
            insurance_policy_type (int): شناسه ی نوع بیمه نامه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            RiskLevel: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/ComboData/RiskLevel'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'insurancePolicyType': insurance_policy_type
        }
        _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
            _query_parameters, Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {
            'accept': 'application/json',
            'x-api-key': x_api_key
        }

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body, RiskLevel.from_dictionary)
Example #13
0
    def get_insurance_types(self, sub_domain, issue_insurance, x_api_key):
        """Does a GET request to /ComboData/InsuranceTypes.

        دریافت لیست نوع بیمه نامه

        Args:
            sub_domain (string): دامنه یا زیر دامنه ی مرکز بیمه
            issue_insurance (bool): دریافت بیمه نامه های قابل صدور
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            InsuranceTypes: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/ComboData/InsuranceTypes'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {
            'subDomain': sub_domain,
            'issueInsurance': issue_insurance
        }
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(_context.response.raw_body,
                                          InsuranceTypes.from_dictionary)
Example #14
0
    def get_portal_landing_page(self, id, x_api_key):
        """Does a GET request to /InsuranceCentre/PortalLandingPage.

        در یافت اطلاعات لندینگ مراکز بیمه

        Args:
            id (string): دامنه یا زیر دامنه ی مرکز بیمه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelPortalLandingPage: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/InsuranceCentre/PortalLandingPage'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {'id': id}
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            BaseModelPortalLandingPage.from_dictionary)
Example #15
0
    def get_divice_franchisee(self, device_model_id, x_api_key):
        """Does a GET request to /ElectronicEquipmentInsurance/DiviceFranchisee.

        دریافت لیست فرانشیر استعلام بیمه نامه ی تجهیزات الکترونیک

        Args:
            device_model_id (int): شناسه ی مدل دستگاه
            x_api_key (string): کلید اختصاصی ارتباط با سرور

        Returns:
            BaseModelDiviceFranchisee: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """

        # Prepare query URL
        _url_path = '/ElectronicEquipmentInsurance/DiviceFranchisee'
        _query_builder = Configuration.get_base_uri()
        _query_builder += _url_path
        _query_parameters = {'deviceModelId': device_model_id}
        _query_builder = APIHelper.append_url_with_query_parameters(
            _query_builder, _query_parameters,
            Configuration.array_serialization)
        _query_url = APIHelper.clean_url(_query_builder)

        # Prepare headers
        _headers = {'accept': 'application/json', 'x-api-key': x_api_key}

        # Prepare and execute request
        _request = self.http_client.get(_query_url, headers=_headers)
        _context = self.execute_request(_request)
        self.validate_response(_context)

        # Return appropriate type
        return APIHelper.json_deserialize(
            _context.response.raw_body,
            BaseModelDiviceFranchisee.from_dictionary)