Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client: rename client to align naming across SDKs #24

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions examples/fast_api_example.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import os
from fastapi import FastAPI
from sinch import ClientAsync
from sinch import SinchClientAsync

"""
Run with: uvicorn fast_api_example:app --reload
"""

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")
Expand Down
4 changes: 2 additions & 2 deletions examples/flask_example.py
Original file line number Diff line number Diff line change
@@ -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

"""
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions examples/logging_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import logging
from sinch import Client
from sinch import SinchClient
"""
Custom logger configuration example.
"""
Expand All @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions sinch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions sinch/core/clients/sinch_client_async.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sinch/core/clients/sinch_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sinch/core/clients/sinch_client_sync.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/authentication/test_token_authentication.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
Loading