-
Notifications
You must be signed in to change notification settings - Fork 0
MPT-12359 Resource client async #20
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
Conversation
a77013c to
ea71df4
Compare
dfb13d0 to
bee0dfe
Compare
|
Please, review the docstrings and typing. Also, the following comments I wrote before the last changes: It might be a good idea to split the generic files that include async and sync classes into async_xxx.py and sync_xxx.py class. |
fea6232 to
3d9b549
Compare
80ddf07 to
23c8fab
Compare
mpt_api_client/mpt_client.py
Outdated
| api_key: str | None = None, | ||
| http_client: HTTPClient | None = None, | ||
| ): | ||
| self.http_client = http_client or HTTPClient(base_url=base_url, api_token=api_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about splitting the constructor into two parts:
- straight forward the only one
def __init__(
self,
base_url: str,
api_key: str,
):
self.http_client = HTTPClient(base_url=base_url, api_token=api_key)
@classmethod
def from_http_client(cls, http_client):
return cls(http_client.base_url, http_client.api_token)
or vice-versa, don't know what is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends on what is more used way to do it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but this breaks dependency injection.
What about:
def init(http_client):
def.http_client = http_client
def from_credentials(api_token, base_url=PROD_ENDPOINT):
return cls(HTTPClient(base_url, api_token)
c5bc557 to
5b20623
Compare
5b20623 to
1333fc6
Compare
- Unified ResourceClient and CollectionClient in Service - Renamed Resource Client to Service - Renamed Collection Client to Service - Renamed Resource to Model - Unified naming by adding Async as prefix to all Async implementation - Removed required custom collections in Services (CollectionClient) - Removed Resource Registry - Added Async Orders - Added Async MPT
1333fc6 to
c747af9
Compare
|



No description provided.