feat(ai): add AI Gateway methods support#252
Open
innomaxx wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Crowdin API client support for the new AI Gateway provider methods, enabling SDK users to proxy/manage provider gateway requests via GET/POST/PUT/PATCH/DELETE for both regular and Enterprise endpoints (per #238).
Changes:
- Added AI Gateway helper + request methods to
AIResourceandEnterpriseAIResource. - Added unit tests covering the new gateway path builder and request wrappers (including “no body” variants for write methods).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
crowdin_api/api_resources/ai/resource.py |
Implements AI Gateway path builder and CRUD-like gateway request wrappers for both standard and Enterprise resources. |
crowdin_api/api_resources/ai/tests/test_ai_resources.py |
Adds tests validating gateway path construction and requester invocation for new methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+807
to
+810
| def get_ai_provider_gateway_path( | ||
| self, user_id: int, ai_provider_id: int, path: str | ||
| ) -> str: | ||
| return f"users/{user_id}/ai/providers/{ai_provider_id}/gateway/{path}" |
Comment on lines
+1634
to
+1635
| def get_ai_provider_gateway_path(self, ai_provider_id: int, path: str) -> str: | ||
| return f"ai/providers/{ai_provider_id}/gateway/{path}" |
Comment on lines
+1269
to
+1274
| ( | ||
| ( | ||
| {"user_id": 1, "ai_provider_id": 2, "path": "v1/chat/completions"}, | ||
| "users/1/ai/providers/2/gateway/v1/chat/completions", | ||
| ), | ||
| ), |
Comment on lines
+2581
to
+2586
| ( | ||
| ( | ||
| {"ai_provider_id": 2, "path": "v1/chat/completions"}, | ||
| "ai/providers/2/gateway/v1/chat/completions", | ||
| ), | ||
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #238