ds_provider_unimicro_py_lib.linked_service ========================================== .. py:module:: ds_provider_unimicro_py_lib.linked_service .. autoapi-nested-parse:: **File:** ``__init__.py`` **Region:** ``ds_provider_unimicro_py_lib/linked_service`` Unimicro Linked Service This module defines the Unimicro linked service for the Unimicro provider. .. rubric:: Example >>> from uuid import UUID >>> linked_service = UnimicroLinkedService( ... id=UUID("12345678-1234-5678-1234-1234567890ab"), ... name="unimicro-linked-service", ... version="v1.0.0", ... settings=UnimicroLinkedServiceSettings( ... company_key="my-company-id", ... client_id="my-client-id", ... certificate="my-certificate", ... certificate_password="my-certificate-password", ... ), ... ) >>> linked_service.connect() >>> linked_service.test_connection() Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ds_provider_unimicro_py_lib/linked_service/unimicro/index Classes ------- .. autoapisummary:: ds_provider_unimicro_py_lib.linked_service.UnimicroLinkedService ds_provider_unimicro_py_lib.linked_service.UnimicroLinkedServiceSettings Package Contents ---------------- .. py:class:: UnimicroLinkedService Bases: :py:obj:`ds_protocol_http_py_lib.HttpLinkedService`\ [\ :py:obj:`UnimicroLinkedServiceSettingsType`\ ], :py:obj:`Generic`\ [\ :py:obj:`UnimicroLinkedServiceSettingsType`\ ] Unimicro linked service. This class represents the Unimicro linked service, which is used to connect to the Unimicro API. It extends the HttpLinkedService and uses the UnimicroLinkedServiceSettings for its configuration. .. py:attribute:: settings :type: UnimicroLinkedServiceSettingsType The settings for the Unimicro linked service. .. py:property:: type :type: ds_provider_unimicro_py_lib.enums.ResourceType Get the resource type for Unimicro linked service. :returns: The resource type for Unimicro linked service. :rtype: ResourceType .. py:method:: __post_init__() -> None Post-initialization for the Unimicro linked service. This method is called after the dataclass is initialized. It can be used to perform any additional setup or validation for the Unimicro linked service. .. py:method:: _configure_custom_auth(http: ds_protocol_http_py_lib.utils.http.Http) -> None Configure custom authentication. Calls the configured token endpoint and extracts an access token from the JSON response using common token key names. The resulting token is stored in the session Authorization header. :param http: The Http client instance to configure. :raises AuthenticationError: If the token is missing in the response. :raises LinkedServiceException: If custom auth settings are missing. .. py:method:: _get_private_key() -> cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey Get the private key used for authenticating with the Unimicro API. The certificate and certificate password are used to generate the private key for authentication. :returns: The private key used for authentication. :rtype: RSAPrivateKey .. py:method:: _create_client_token(client_id: str, private_key: cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey, token_endpoint: str) -> str Create a client token for the Unimicro API using the provided client ID and private key. :param client_id: The client ID for the Unimicro API. :type client_id: str :param private_key: The private key used for authentication. :type private_key: RSAPrivateKey :param token_endpoint: The token endpoint URL for the Unimicro API. :type token_endpoint: str :returns: The generated client token. :rtype: str .. py:method:: _get_token_endpoint() -> str Get the token endpoint URL for the Unimicro API. :returns: The token endpoint URL. :rtype: str .. py:class:: UnimicroLinkedServiceSettings Bases: :py:obj:`ds_protocol_http_py_lib.HttpLinkedServiceSettings` Unimicro linked service settings. This class extends the HttpLinkedServiceSettings and includes the necessary configuration for connecting to the Unimicro API. .. py:attribute:: certificate :type: str Base64-encoded PKCS#12 certificate used for authentication. .. py:attribute:: certificate_password :type: str The password for the certificate used for authenticating with the Unimicro API. .. py:attribute:: client_id :type: str The client ID for the Unimicro API. .. py:attribute:: company_key :type: str | None :value: None The company key used for fetching data from Unimicro. .. py:attribute:: scope :type: str :value: 'AppFramework' The scope for the Unimicro API authentication. .. py:attribute:: auth_url :type: str :value: 'https://login.unimicro.no' The URL for the Unimicro authentication service used for authentication. .. py:attribute:: host :type: str :value: 'https://app.unimicro.no' The URL for the Unimicro API host. .. py:attribute:: auth_type :type: ds_protocol_http_py_lib.enums.AuthType Authentication type for Unimicro API. .. py:attribute:: custom :type: ds_protocol_http_py_lib.linked_service.CustomAuthSettings | None :value: None Custom authentication settings for Unimicro API.