diff --git a/README.md b/README.md index 28a15424..a79d2e15 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ To initialize communication with Sinch backed, credentials obtained from Sinch p It's highly advised to not hardcode those credentials, but to fetch them from environment variables: ```python -from sinch import Client +from sinch import SinchClient -sinch_client = Client( +sinch_client = SinchClient( key_id="key_id", key_secret="key_secret", project_id="some_project", @@ -56,9 +56,9 @@ sinch_client = Client( ```python import os -from sinch import Client +from sinch import SinchClient -sinch_client = Client( +sinch_client = SinchClient( key_id=os.getenv("KEY_ID"), key_secret=os.getenv("KEY_SECRET"), project_id=os.getenv("PROJECT_ID"), @@ -139,9 +139,9 @@ By default, two HTTP implementations are provided: - Synchronous using `requests` HTTP library - Asynchronous using `aiohttp` HTTP library -For creating custom HTTP client code, use either `Client` or `ClientAsync` client and inject your transport during initialisation: +For creating custom HTTP client code, use either `SinchClient` or `SinchClientAsync` client and inject your transport during initialisation: ```python -sinch_client = ClientAsync( +sinch_client = SinchClientAsync( key_id="Spanish", key_secret="Inquisition", project_id="some_project", diff --git a/examples/fast_api_example.py b/examples/fast_api_example.py index d546ac5e..d54c5514 100644 --- a/examples/fast_api_example.py +++ b/examples/fast_api_example.py @@ -1,6 +1,6 @@ import os from fastapi import FastAPI -from sinch import ClientAsync +from sinch import SinchClientAsync """ Run with: uvicorn fast_api_example:app --reload @@ -8,7 +8,7 @@ app = FastAPI() -sinch_client = ClientAsync( +sinch_client = SinchClientAsync( key_id=os.getenv("KEY_ID"), key_secret=os.getenv("KEY_SECRET"), project_id=os.getenv("PROJECT_ID") diff --git a/examples/flask_example.py b/examples/flask_example.py index f8a68ac2..4382be81 100644 --- a/examples/flask_example.py +++ b/examples/flask_example.py @@ -1,6 +1,6 @@ import os from flask import Flask -from sinch import Client +from sinch import SinchClient from sinch.domains.conversation.enums import ConversationChannel """ @@ -9,7 +9,7 @@ app = Flask("Sinch_example") -sinch_client = Client( +sinch_client = SinchClient( key_id=os.getenv("KEY_ID"), key_secret=os.getenv("KEY_SECRET"), project_id=os.getenv("PROJECT_ID") diff --git a/examples/logging_example.py b/examples/logging_example.py index ab619f09..478326ce 100644 --- a/examples/logging_example.py +++ b/examples/logging_example.py @@ -1,6 +1,6 @@ import os import logging -from sinch import Client +from sinch import SinchClient """ Custom logger configuration example. """ @@ -22,7 +22,7 @@ logger.addHandler(file_handler) logger.addHandler(console_handler) -sinch_client = Client( +sinch_client = SinchClient( key_id=os.getenv("KEY_ID"), key_secret=os.getenv("KEY_SECRET"), project_id=os.getenv("PROJECT_ID"), diff --git a/sinch/__init__.py b/sinch/__init__.py index 4fcd66a5..3910b3f0 100644 --- a/sinch/__init__.py +++ b/sinch/__init__.py @@ -3,7 +3,7 @@ """ __version__ = "0.3.2" -from sinch.core.clients.sinch_client_sync import Client -from sinch.core.clients.sinch_client_async import ClientAsync +from sinch.core.clients.sinch_client_sync import SinchClient +from sinch.core.clients.sinch_client_async import SinchClientAsync -__all__ = (Client, ClientAsync) +__all__ = (SinchClient, SinchClientAsync) diff --git a/sinch/core/clients/sinch_client_async.py b/sinch/core/clients/sinch_client_async.py index aab97e5c..a86f2931 100644 --- a/sinch/core/clients/sinch_client_async.py +++ b/sinch/core/clients/sinch_client_async.py @@ -1,5 +1,5 @@ from logging import Logger -from sinch.core.clients.sinch_client_base import ClientBase +from sinch.core.clients.sinch_client_base import SinchClientBase from sinch.core.clients.sinch_client_configuration import Configuration from sinch.core.token_manager import TokenManagerAsync from sinch.core.adapters.asyncio_http_adapter import HTTPTransportAioHTTP @@ -10,7 +10,7 @@ from sinch.domains.verification import Verification as VerificationAsync -class ClientAsync(ClientBase): +class SinchClientAsync(SinchClientBase): """ Asynchronous implementation of the Sinch Client By default this implementation uses HTTPTransportAioHTTP based on AioHTTP library diff --git a/sinch/core/clients/sinch_client_base.py b/sinch/core/clients/sinch_client_base.py index 45d6754b..f32f9dec 100644 --- a/sinch/core/clients/sinch_client_base.py +++ b/sinch/core/clients/sinch_client_base.py @@ -7,7 +7,7 @@ from sinch.domains.sms import SMSBase -class ClientBase(ABC): +class SinchClientBase(ABC): """ Sinch abstract base class for concrete Sinch Client implementations. By default, this SDK provides two implementations - sync and async. diff --git a/sinch/core/clients/sinch_client_sync.py b/sinch/core/clients/sinch_client_sync.py index 5e81b789..3692418a 100644 --- a/sinch/core/clients/sinch_client_sync.py +++ b/sinch/core/clients/sinch_client_sync.py @@ -1,5 +1,5 @@ from logging import Logger -from sinch.core.clients.sinch_client_base import ClientBase +from sinch.core.clients.sinch_client_base import SinchClientBase from sinch.core.clients.sinch_client_configuration import Configuration from sinch.core.token_manager import TokenManager from sinch.core.adapters.requests_http_transport import HTTPTransportRequests @@ -10,7 +10,7 @@ from sinch.domains.verification import Verification -class Client(ClientBase): +class SinchClient(SinchClientBase): """ Synchronous implementation of the Sinch Client By default this implementation uses HTTPTransportRequests based on Requests library diff --git a/tests/conftest.py b/tests/conftest.py index a7cb74fb..7f01e269 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,8 +2,8 @@ import pytest from dataclasses import dataclass -from sinch import Client -from sinch import ClientAsync +from sinch import SinchClient +from sinch import SinchClientAsync from sinch.core.models.http_response import HTTPResponse from sinch.domains.authentication.models.authentication import OAuthToken from sinch.core.models.base_model import SinchBaseModel, SinchRequestBaseModel @@ -310,7 +310,7 @@ def sinch_client_sync( project_id ): return configure_origin( - Client( + SinchClient( key_id=key_id, key_secret=key_secret, project_id=project_id, @@ -343,7 +343,7 @@ def sinch_client_async( project_id ): return configure_origin( - ClientAsync( + SinchClientAsync( key_id=key_id, key_secret=key_secret, project_id=project_id, diff --git a/tests/e2e/authentication/test_token_authentication.py b/tests/e2e/authentication/test_token_authentication.py index 04c2dd2b..75a965b8 100644 --- a/tests/e2e/authentication/test_token_authentication.py +++ b/tests/e2e/authentication/test_token_authentication.py @@ -1,6 +1,6 @@ import pytest -from sinch import Client +from sinch import SinchClient from sinch.domains.authentication.models.authentication import OAuthToken from sinch.domains.authentication.exceptions import AuthenticationException @@ -11,7 +11,7 @@ def test_basic_auth_token_generation(sinch_client_sync): def test_basic_auth_token_generation_invalid_credentials(project_id): - sinch_client = Client( + sinch_client = SinchClient( key_id="silly", key_secret="walk", project_id=project_id diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 4f3d7e1e..24907c27 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -1,9 +1,9 @@ -from sinch import Client, ClientAsync +from sinch import SinchClient, SinchClientAsync from sinch.core.clients.sinch_client_configuration import Configuration def test_sinch_client_initialization(): - sinch_client_sync = Client( + sinch_client_sync = SinchClient( key_id="test", key_secret="test_secret", project_id="test_project_id" @@ -12,7 +12,7 @@ def test_sinch_client_initialization(): def test_sinch_client_async_initialization(): - sinch_client_async = ClientAsync( + sinch_client_async = SinchClientAsync( key_id="test", key_secret="test_secret", project_id="test_project_id"