Skip to content

Conversation

@albertsola
Copy link
Contributor

No description provided.

@albertsola albertsola changed the title MPT-12358 Resource client async MPT-12359 Resource client async Aug 26, 2025
@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch from a77013c to ea71df4 Compare August 26, 2025 10:12
@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch from dfb13d0 to bee0dfe Compare August 29, 2025 13:44
@svazquezco
Copy link
Contributor

svazquezco commented Aug 29, 2025

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.

@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch 4 times, most recently from fea6232 to 3d9b549 Compare August 29, 2025 14:35
@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch 7 times, most recently from 80ddf07 to 23c8fab Compare September 1, 2025 09:24
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)
Copy link
Contributor

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:

  1. 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

Copy link
Contributor

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 :-)

Copy link
Contributor Author

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)

@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch 5 times, most recently from c5bc557 to 5b20623 Compare September 1, 2025 13:22
@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch from 5b20623 to 1333fc6 Compare September 1, 2025 14:08
- 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
@albertsola albertsola force-pushed the MPT-12359/async-base-resource-client branch from 1333fc6 to c747af9 Compare September 1, 2025 14:14
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2025

@albertsola albertsola merged commit 35deded into main Sep 1, 2025
3 checks passed
@albertsola albertsola deleted the MPT-12359/async-base-resource-client branch September 1, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants