From 59c16d6824149b17b9543bdfc515fb5be2bf2fb5 Mon Sep 17 00:00:00 2001 From: Jasper Madrone Date: Thu, 20 Nov 2025 10:30:01 -0500 Subject: [PATCH 1/2] Make last_seen field User model optional (#41) Add optional last_seen field to User model and update API spec --- .gitignore | 1 + openapitools.json | 2 +- .../cli/utils/exception_handler.py | 13 +++++++++++-- .../client/workato_api/docs/User.md | 2 +- .../client/workato_api/models/user.py | 7 ++++++- workato-api-spec.yaml | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 1e0417f..da9c3dc 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ target/ src/workato_platform_cli/_version.py +.workato-ignore diff --git a/openapitools.json b/openapitools.json index a82623d..8244df4 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.14.0" + "version": "7.16.0" } } diff --git a/src/workato_platform_cli/cli/utils/exception_handler.py b/src/workato_platform_cli/cli/utils/exception_handler.py index 9b5b1b8..17d5d3b 100644 --- a/src/workato_platform_cli/cli/utils/exception_handler.py +++ b/src/workato_platform_cli/cli/utils/exception_handler.py @@ -246,11 +246,19 @@ def _handle_auth_error(e: UnauthorizedException) -> None: return click.echo("❌ Authentication failed") - click.echo(" Your API token may be invalid") - click.echo("💡 Please check your authentication:") + click.echo(" Your API token may be invalid or lack sufficient permissions") + click.echo() + click.echo("💡 This could be due to:") + click.echo(" • Invalid or expired API token") + click.echo(" • API client lacking required permissions for this operation") + click.echo() + click.echo("🔧 To resolve:") click.echo(" • Verify your API token is correct") click.echo(" • Run 'workato profiles list' to check your profile") click.echo(" • Run 'workato profiles use' to update your credentials") + click.echo() + click.echo("📚 Learn more about API client permissions and permissions required for the client:") + click.echo(" https://docs.workato.com/en/platform-cli.html#authentication") def _handle_forbidden_error(e: ForbiddenException) -> None: @@ -274,6 +282,7 @@ def _handle_forbidden_error(e: ForbiddenException) -> None: if error_details: click.echo(f" {error_details}") + click.echo() click.echo("💡 Please check:") click.echo(" • Your account has the required permissions") click.echo(" • You're working in the correct workspace/folder") diff --git a/src/workato_platform_cli/client/workato_api/docs/User.md b/src/workato_platform_cli/client/workato_api/docs/User.md index dadf663..da01a7f 100644 --- a/src/workato_platform_cli/client/workato_api/docs/User.md +++ b/src/workato_platform_cli/client/workato_api/docs/User.md @@ -17,7 +17,7 @@ Name | Type | Description | Notes **interested_applications** | **List[str]** | | [optional] **company_name** | **str** | | **location** | **str** | | -**last_seen** | **datetime** | | +**last_seen** | **datetime** | | [optional] **contact_phone** | **str** | | [optional] **contact_email** | **str** | | [optional] **about_me** | **str** | | [optional] diff --git a/src/workato_platform_cli/client/workato_api/models/user.py b/src/workato_platform_cli/client/workato_api/models/user.py index 6c05427..dddd0c2 100644 --- a/src/workato_platform_cli/client/workato_api/models/user.py +++ b/src/workato_platform_cli/client/workato_api/models/user.py @@ -39,7 +39,7 @@ class User(BaseModel): interested_applications: Optional[List[StrictStr]] = None company_name: Optional[StrictStr] location: Optional[StrictStr] - last_seen: datetime + last_seen: Optional[datetime] = None contact_phone: Optional[StrictStr] = None contact_email: Optional[StrictStr] = None about_me: Optional[StrictStr] = None @@ -98,6 +98,11 @@ def to_dict(self) -> Dict[str, Any]: if self.location is None and "location" in self.model_fields_set: _dict['location'] = None + # set to None if last_seen (nullable) is None + # and model_fields_set contains the field + if self.last_seen is None and "last_seen" in self.model_fields_set: + _dict['last_seen'] = None + # set to None if contact_phone (nullable) is None # and model_fields_set contains the field if self.contact_phone is None and "contact_phone" in self.model_fields_set: diff --git a/workato-api-spec.yaml b/workato-api-spec.yaml index 60257ab..f94b3f3 100644 --- a/workato-api-spec.yaml +++ b/workato-api-spec.yaml @@ -1469,7 +1469,6 @@ components: - recipes_count - company_name - location - - last_seen - email - active_recipes_count - root_folder_id @@ -1518,6 +1517,7 @@ components: last_seen: type: string format: date-time + nullable: true example: "2020-08-23T23:22:24.329-07:00" contact_phone: type: string From 83e4e6fb9f2df66ea35fbeeabac13dcd27006545 Mon Sep 17 00:00:00 2001 From: Shihan Pan Date: Tue, 6 Jan 2026 16:48:21 -0800 Subject: [PATCH 2/2] Improve 401 Unauthorized error message with permission guidance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Clarify that 401 errors can be due to invalid/expired API token OR insufficient permissions - Add direct link to Workato API client management documentation - Restructure error message to show both possible causes and resolution steps - Improve actionability of error message for users debugging auth issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- first_cp/my_new_recipe.recipe.json | 21 +++++++++++++++++++ .../cli/utils/exception_handler.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 first_cp/my_new_recipe.recipe.json diff --git a/first_cp/my_new_recipe.recipe.json b/first_cp/my_new_recipe.recipe.json new file mode 100644 index 0000000..05f5f08 --- /dev/null +++ b/first_cp/my_new_recipe.recipe.json @@ -0,0 +1,21 @@ +{ + "name": "My new recipe", + "description": "", + "version": 1, + "private": true, + "concurrency": 1, + "code": { + "number": 0, + "keyword": "trigger", + "input": { + }, + "block": [ + + ], + "uuid": "455da0fe-638d-4c30-9408-f06b13da3e5c", + "unfinished": false + }, + "config": [ + + ] +} \ No newline at end of file diff --git a/src/workato_platform_cli/cli/utils/exception_handler.py b/src/workato_platform_cli/cli/utils/exception_handler.py index 17d5d3b..42291e7 100644 --- a/src/workato_platform_cli/cli/utils/exception_handler.py +++ b/src/workato_platform_cli/cli/utils/exception_handler.py @@ -257,7 +257,7 @@ def _handle_auth_error(e: UnauthorizedException) -> None: click.echo(" • Run 'workato profiles list' to check your profile") click.echo(" • Run 'workato profiles use' to update your credentials") click.echo() - click.echo("📚 Learn more about API client permissions and permissions required for the client:") + click.echo("📚 Learn more about permissions required for API client") click.echo(" https://docs.workato.com/en/platform-cli.html#authentication")