chargebee / chargebee-python

Python library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=python
MIT License
41 stars 32 forks source link

Include Subscription Data in response from `Customer.retrieve` #61

Open TheBitShepherd opened 8 months ago

TheBitShepherd commented 8 months ago

What problem does your feature request address?

Currently the only way to retrieve a list of subscriptions related to a single customer is through chargebee.Subscription.list({"customer_id[is]": "<customer-id>"}). This returns a ListResult response which includes duplicative customer information for each item in the list result. This ultimately makes parsing the response into something like a dataclass more difficult than it should be.

Describe the desired solution

It would be more convenient to have Customer.retrieve({"id[is]": "<customer_id>"}) return subscriptions along with the customer information in the following format:

{
    "customer": {
        "id": "<id>",
        ...
        "subscriptions": [
              { <subscription-one> },
              { <subscription-two> },
              ...
         ]
{

Alternatives Considered

I'd love to know if there is a way to include additional info from the Customer.retrieve method; however, documentation states that this call only returns the Customer and (an optional) Card objects.

github-actions[bot] commented 8 months ago

Hello @TheBitShepherd, thank you for raising the issue. Your contribution is greatly appreciated and we look forward to addressing it.