From 1242716e0730e1069dcd109318445b8b943348c4 Mon Sep 17 00:00:00 2001 From: "Joseph T. French" Date: Sun, 8 Mar 2026 19:46:56 -0500 Subject: [PATCH] Remove upgrade_subscription.py file and update upgrade_subscription_request.py documentation for clarity --- ...scription.py => change_repository_plan.py} | 80 ++++++++++++++----- .../models/upgrade_subscription_request.py | 2 +- 2 files changed, 59 insertions(+), 23 deletions(-) rename robosystems_client/api/subscriptions/{upgrade_subscription.py => change_repository_plan.py} (66%) diff --git a/robosystems_client/api/subscriptions/upgrade_subscription.py b/robosystems_client/api/subscriptions/change_repository_plan.py similarity index 66% rename from robosystems_client/api/subscriptions/upgrade_subscription.py rename to robosystems_client/api/subscriptions/change_repository_plan.py index fe0995d..cf28ffb 100644 --- a/robosystems_client/api/subscriptions/upgrade_subscription.py +++ b/robosystems_client/api/subscriptions/change_repository_plan.py @@ -20,8 +20,8 @@ def _get_kwargs( headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { - "method": "put", - "url": "/v1/graphs/{graph_id}/subscriptions/upgrade".format( + "method": "patch", + "url": "/v1/graphs/{graph_id}/subscriptions".format( graph_id=quote(str(graph_id), safe=""), ), } @@ -42,6 +42,10 @@ def _parse_response( return response_200 + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 @@ -74,15 +78,23 @@ def sync_detailed( client: AuthenticatedClient, body: UpgradeSubscriptionRequest, ) -> Response[Any | GraphSubscriptionResponse | HTTPValidationError]: - """Upgrade Subscription + """Change Repository Plan + + Upgrade or downgrade a shared repository subscription plan. + + Changes the plan on an existing subscription (e.g., SEC starter -> advanced). + Stripe handles proration automatically. - Upgrade a subscription to a different plan. + **Only for shared repositories** - graph subscriptions do not support plan changes + (cancel and re-subscribe instead). - Works for both user graphs and shared repositories. - The subscription will be immediately updated to the new plan and pricing. + **Requirements:** + - User must be an OWNER of their organization + - Subscription must be active + - New plan must exist in the repository's manifest Args: - graph_id (str): Graph ID or repository name + graph_id (str): Repository name (e.g., 'sec') body (UpgradeSubscriptionRequest): Request to upgrade a subscription. Raises: @@ -111,15 +123,23 @@ def sync( client: AuthenticatedClient, body: UpgradeSubscriptionRequest, ) -> Any | GraphSubscriptionResponse | HTTPValidationError | None: - """Upgrade Subscription + """Change Repository Plan + + Upgrade or downgrade a shared repository subscription plan. + + Changes the plan on an existing subscription (e.g., SEC starter -> advanced). + Stripe handles proration automatically. - Upgrade a subscription to a different plan. + **Only for shared repositories** - graph subscriptions do not support plan changes + (cancel and re-subscribe instead). - Works for both user graphs and shared repositories. - The subscription will be immediately updated to the new plan and pricing. + **Requirements:** + - User must be an OWNER of their organization + - Subscription must be active + - New plan must exist in the repository's manifest Args: - graph_id (str): Graph ID or repository name + graph_id (str): Repository name (e.g., 'sec') body (UpgradeSubscriptionRequest): Request to upgrade a subscription. Raises: @@ -143,15 +163,23 @@ async def asyncio_detailed( client: AuthenticatedClient, body: UpgradeSubscriptionRequest, ) -> Response[Any | GraphSubscriptionResponse | HTTPValidationError]: - """Upgrade Subscription + """Change Repository Plan - Upgrade a subscription to a different plan. + Upgrade or downgrade a shared repository subscription plan. - Works for both user graphs and shared repositories. - The subscription will be immediately updated to the new plan and pricing. + Changes the plan on an existing subscription (e.g., SEC starter -> advanced). + Stripe handles proration automatically. + + **Only for shared repositories** - graph subscriptions do not support plan changes + (cancel and re-subscribe instead). + + **Requirements:** + - User must be an OWNER of their organization + - Subscription must be active + - New plan must exist in the repository's manifest Args: - graph_id (str): Graph ID or repository name + graph_id (str): Repository name (e.g., 'sec') body (UpgradeSubscriptionRequest): Request to upgrade a subscription. Raises: @@ -178,15 +206,23 @@ async def asyncio( client: AuthenticatedClient, body: UpgradeSubscriptionRequest, ) -> Any | GraphSubscriptionResponse | HTTPValidationError | None: - """Upgrade Subscription + """Change Repository Plan + + Upgrade or downgrade a shared repository subscription plan. + + Changes the plan on an existing subscription (e.g., SEC starter -> advanced). + Stripe handles proration automatically. - Upgrade a subscription to a different plan. + **Only for shared repositories** - graph subscriptions do not support plan changes + (cancel and re-subscribe instead). - Works for both user graphs and shared repositories. - The subscription will be immediately updated to the new plan and pricing. + **Requirements:** + - User must be an OWNER of their organization + - Subscription must be active + - New plan must exist in the repository's manifest Args: - graph_id (str): Graph ID or repository name + graph_id (str): Repository name (e.g., 'sec') body (UpgradeSubscriptionRequest): Request to upgrade a subscription. Raises: diff --git a/robosystems_client/models/upgrade_subscription_request.py b/robosystems_client/models/upgrade_subscription_request.py index 614b26d..0269bee 100644 --- a/robosystems_client/models/upgrade_subscription_request.py +++ b/robosystems_client/models/upgrade_subscription_request.py @@ -14,7 +14,7 @@ class UpgradeSubscriptionRequest: """Request to upgrade a subscription. Attributes: - new_plan_name (str): New plan name to upgrade to + new_plan_name (str): New plan name to change to """ new_plan_name: str