-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add support for AI Translate Strings method #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
saranour700
wants to merge
10
commits into
crowdin:main
from
saranour700:feat/add-ai-translate-endpoint
+124
−1
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1785745
Add support for AI Translate Strings method
saranour700 9faed5c
fix: address review comments
saranour700 f1fe3f6
fix: add enterprise mode check to ai_translate_strings
saranour700 bfb7fcb
fix: update ai_spec to use enterprise mode and improve tests
saranour700 cbc2f7c
fix: address review comments
saranour700 e80e4c2
fix: correct error classes in ai_spec tests
saranour700 ee495d3
fix: use organization_domain variable in ai_spec.rb stub URL
saranour700 fb6950b
fix: move ai_spec.rb to correct directory (spec/api_resources)
saranour700 d0040be
fix: support ai_translate_strings in both Crowdin and Enterprise modes
saranour700 a524ab1
fix: move ai_spec to correct directory
saranour700 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "rdbg", | ||
| "name": "Debug current file with rdbg", | ||
| "request": "launch", | ||
| "script": "${file}", | ||
| "args": [], | ||
| "askParameters": true | ||
| }, | ||
| { | ||
| "type": "rdbg", | ||
| "name": "Attach with rdbg", | ||
| "request": "attach" | ||
| } | ||
| ] | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Crowdin | ||
| module ApiResources | ||
| module AI | ||
| # https://support.crowdin.com/developer/api/v2/#tag/AI/operation/api.users.ai.translate.strings.post | ||
| def ai_translate_strings(user_id = nil, query = {}) | ||
| user_id || raise_parameter_is_required_error(:user_id) | ||
|
|
||
| request = Web::Request.new( | ||
| connection, | ||
| :post, | ||
|
andrii-bodnar marked this conversation as resolved.
|
||
| "#{config.target_api_url}/users/#{user_id}/ai/translations/translate-strings", | ||
| { params: query } | ||
| ) | ||
| Web::SendRequest.new(request).perform | ||
| end | ||
| end | ||
| end | ||
| end | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| describe Crowdin::ApiResources::AI do | ||
| describe 'Default endpoints' do | ||
| describe '#ai_translate_strings' do | ||
| let(:user_id) { 1 } | ||
|
|
||
| it 'when request are valid', :default do | ||
| stub_request(:post, "https://api.crowdin.com/#{target_api_url}/users/#{user_id}/ai/translations/translate-strings") | ||
|
andrii-bodnar marked this conversation as resolved.
Outdated
|
||
| ai_translate_strings = @crowdin.ai_translate_strings(user_id) | ||
| expect(ai_translate_strings).to eq(200) | ||
| end | ||
| end | ||
| end | ||
| end | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.