crowdin-api 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.rubocop_todo.yml +1 -0
  4. data/AGENTS.md +63 -0
  5. data/CLAUDE.md +1 -0
  6. data/Gemfile.lock +1 -1
  7. data/README.md +23 -1
  8. data/lib/crowdin-api/api_resources/advisor.rb +86 -0
  9. data/lib/crowdin-api/api_resources/ai.rb +974 -0
  10. data/lib/crowdin-api/api_resources/applications.rb +252 -15
  11. data/lib/crowdin-api/api_resources/bundles.rb +45 -29
  12. data/lib/crowdin-api/api_resources/clients.rb +23 -0
  13. data/lib/crowdin-api/api_resources/custom_spellcheckers.rb +36 -0
  14. data/lib/crowdin-api/api_resources/dictionaries.rb +5 -5
  15. data/lib/crowdin-api/api_resources/distributions.rb +15 -15
  16. data/lib/crowdin-api/api_resources/external_qa_checks.rb +36 -0
  17. data/lib/crowdin-api/api_resources/fields.rb +78 -0
  18. data/lib/crowdin-api/api_resources/glossaries.rb +62 -50
  19. data/lib/crowdin-api/api_resources/integrations.rb +201 -0
  20. data/lib/crowdin-api/api_resources/labels.rb +32 -0
  21. data/lib/crowdin-api/api_resources/languages.rb +16 -0
  22. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +17 -0
  23. data/lib/crowdin-api/api_resources/notifications.rb +15 -6
  24. data/lib/crowdin-api/api_resources/organization.rb +33 -0
  25. data/lib/crowdin-api/api_resources/organization_webhooks.rb +71 -0
  26. data/lib/crowdin-api/api_resources/placeholders.rb +182 -0
  27. data/lib/crowdin-api/api_resources/projects.rb +137 -41
  28. data/lib/crowdin-api/api_resources/reports.rb +310 -26
  29. data/lib/crowdin-api/api_resources/screenshots.rb +48 -0
  30. data/lib/crowdin-api/api_resources/security_logs.rb +63 -0
  31. data/lib/crowdin-api/api_resources/source_files.rb +370 -65
  32. data/lib/crowdin-api/api_resources/source_strings.rb +62 -0
  33. data/lib/crowdin-api/api_resources/storages.rb +11 -11
  34. data/lib/crowdin-api/api_resources/string_comments.rb +46 -0
  35. data/lib/crowdin-api/api_resources/string_corrections.rb +21 -6
  36. data/lib/crowdin-api/api_resources/string_translations.rb +96 -0
  37. data/lib/crowdin-api/api_resources/style_guides.rb +71 -0
  38. data/lib/crowdin-api/api_resources/tasks.rb +140 -10
  39. data/lib/crowdin-api/api_resources/teams.rb +99 -0
  40. data/lib/crowdin-api/api_resources/translation_memory.rb +138 -0
  41. data/lib/crowdin-api/api_resources/translation_status.rb +65 -0
  42. data/lib/crowdin-api/api_resources/translations.rb +122 -2
  43. data/lib/crowdin-api/api_resources/users.rb +136 -6
  44. data/lib/crowdin-api/api_resources/vendors.rb +2 -0
  45. data/lib/crowdin-api/api_resources/webhooks.rb +16 -0
  46. data/lib/crowdin-api/api_resources/workflows.rb +24 -0
  47. data/lib/crowdin-api/client/client.rb +3 -8
  48. data/lib/crowdin-api/client/version.rb +1 -1
  49. data/lib/crowdin-api/core/graphql_extensions.rb +22 -0
  50. data/lib/crowdin-api/core/request.rb +1 -1
  51. data/lib/crowdin-api.rb +4 -1
  52. data/spec/api_resources/advisor_spec.rb +45 -0
  53. data/spec/api_resources/ai_spec.rb +863 -0
  54. data/spec/api_resources/applications_spec.rb +138 -0
  55. data/spec/api_resources/bundles_spec.rb +8 -0
  56. data/spec/api_resources/clients_spec.rb +13 -0
  57. data/spec/api_resources/custom_spellcheckers_spec.rb +21 -0
  58. data/spec/api_resources/external_qa_checks_spec.rb +21 -0
  59. data/spec/api_resources/fields_spec.rb +45 -0
  60. data/spec/api_resources/glossaries_spec.rb +18 -0
  61. data/spec/api_resources/integrations_spec.rb +117 -0
  62. data/spec/api_resources/organization_spec.rb +21 -0
  63. data/spec/api_resources/organization_webhooks_spec.rb +45 -0
  64. data/spec/api_resources/placeholders_spec.rb +103 -0
  65. data/spec/api_resources/projects_spec.rb +58 -0
  66. data/spec/api_resources/reports_spec.rb +221 -0
  67. data/spec/api_resources/security_logs_spec.rb +39 -0
  68. data/spec/api_resources/source_files_spec.rb +182 -0
  69. data/spec/api_resources/source_strings_spec.rb +26 -0
  70. data/spec/api_resources/string_comments_spec.rb +18 -0
  71. data/spec/api_resources/string_corrections_spec.rb +25 -19
  72. data/spec/api_resources/string_translations_spec.rb +26 -0
  73. data/spec/api_resources/style_guides_spec.rb +45 -0
  74. data/spec/api_resources/tasks_spec.rb +60 -0
  75. data/spec/api_resources/teams_spec.rb +42 -0
  76. data/spec/api_resources/translation_memory_spec.rb +58 -0
  77. data/spec/api_resources/translation_status_spec.rb +26 -0
  78. data/spec/api_resources/translations_spec.rb +42 -0
  79. data/spec/api_resources/users_spec.rb +84 -0
  80. data/spec/api_resources/workflows_spec.rb +10 -0
  81. data/spec/unit/client_spec.rb +47 -0
  82. metadata +28 -1
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module SourceStrings
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.getMany Enterprise API Documentation}
6
9
  def list_strings(query = {}, project_id = config.project_id)
7
10
  project_id || raise_project_id_is_required_error
8
11
 
@@ -15,6 +18,9 @@ module Crowdin
15
18
  Web::SendRequest.new(request).perform
16
19
  end
17
20
 
21
+ # @param query [Hash] Request Body
22
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.post API Documentation}
23
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.post Enterprise API Documentation}
18
24
  def add_string(query = {}, project_id = config.project_id)
19
25
  project_id || raise_project_id_is_required_error
20
26
 
@@ -27,6 +33,10 @@ module Crowdin
27
33
  Web::SendRequest.new(request).perform
28
34
  end
29
35
 
36
+ # @param string_id [Integer] String Identifier
37
+ # @param query [Hash] Request Query Parameters
38
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.get API Documentation}
39
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.get Enterprise API Documentation}
30
40
  def get_string(string_id = nil, query = {}, project_id = config.project_id)
31
41
  string_id || raise_parameter_is_required_error(:string_id)
32
42
  project_id || raise_project_id_is_required_error
@@ -40,6 +50,9 @@ module Crowdin
40
50
  Web::SendRequest.new(request).perform
41
51
  end
42
52
 
53
+ # @param string_id [Integer] String Identifier
54
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.delete API Documentation}
55
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.delete Enterprise API Documentation}
43
56
  def delete_string(string_id = nil, project_id = config.project_id)
44
57
  string_id || raise_parameter_is_required_error(:string_id)
45
58
  project_id || raise_project_id_is_required_error
@@ -52,6 +65,10 @@ module Crowdin
52
65
  Web::SendRequest.new(request).perform
53
66
  end
54
67
 
68
+ # @param string_id [Integer] String Identifier
69
+ # @param query [Hash] Request Body
70
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.patch API Documentation}
71
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.patch Enterprise API Documentation}
55
72
  def edit_string(string_id = nil, query = {}, project_id = config.project_id)
56
73
  string_id || raise_parameter_is_required_error(:string_id)
57
74
  project_id || raise_project_id_is_required_error
@@ -65,6 +82,9 @@ module Crowdin
65
82
  Web::SendRequest.new(request).perform
66
83
  end
67
84
 
85
+ # @param query [Hash] Request Body
86
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.strings.batchPatch API Documentation}
87
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.strings.batchPatch Enterprise API Documentation}
68
88
  def string_batch_operations(query = {}, project_id = config.project_id)
69
89
  project_id || raise_project_id_is_required_error
70
90
 
@@ -76,6 +96,48 @@ module Crowdin
76
96
  )
77
97
  Web::SendRequest.new(request).perform
78
98
  end
99
+
100
+ # @param body [Hash] Request Body
101
+ # * {https://support.crowdin.com/developer/api/v2/string-based/#operation/api.projects.strings.uploads.post API Documentation}
102
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/string-based/#operation/api.projects.strings.uploads.post Enterprise API Documentation}
103
+ def upload_strings(body = {}, project_id = config.project_id)
104
+ project_id || raise_project_id_is_required_error
105
+
106
+ request = Web::Request.new(
107
+ connection,
108
+ :post,
109
+ "#{config.target_api_url}/projects/#{project_id}/strings/uploads",
110
+ { params: body }
111
+ )
112
+ Web::SendRequest.new(request).perform
113
+ end
114
+
115
+ # @param upload_id [String] Upload Strings Identifier, consists of 36 characters
116
+ # * {https://support.crowdin.com/developer/api/v2/string-based/#operation/api.projects.strings.uploads.get API Documentation}
117
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/string-based/#operation/api.projects.strings.uploads.get Enterprise API Documentation}
118
+ def upload_strings_status(upload_id, project_id = config.project_id)
119
+ project_id || raise_project_id_is_required_error
120
+
121
+ request = Web::Request.new(
122
+ connection,
123
+ :get,
124
+ "#{config.target_api_url}/projects/#{project_id}/strings/uploads/#{upload_id}"
125
+ )
126
+ Web::SendRequest.new(request).perform
127
+ end
128
+
129
+ # @param query [Hash] Request Query Parameters
130
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.strings.getMany API Documentation}
131
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.strings.getMany Enterprise API Documentation}
132
+ def search_strings(query = {})
133
+ request = Web::Request.new(
134
+ connection,
135
+ :get,
136
+ "#{config.target_api_url}/strings",
137
+ { params: query }
138
+ )
139
+ Web::SendRequest.new(request).perform
140
+ end
79
141
  end
80
142
  end
81
143
  end
@@ -3,9 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module Storages
6
- # @param query [Hash] Request Body
7
- # * {https://developer.crowdin.com/api/v2/#operation/api.storages.getMany API Documentation}
8
- # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.storages.getMany Enterprise API Documentation}
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.storages.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.storages.getMany Enterprise API Documentation}
9
9
  def list_storages(query = {})
10
10
  request = Web::Request.new(
11
11
  connection,
@@ -17,8 +17,8 @@ module Crowdin
17
17
  end
18
18
 
19
19
  # @param file [string] File path
20
- # * {https://developer.crowdin.com/api/v2/#operation/api.storages.post API Documentation}
21
- # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.storages.post Enterprise API Documentation}
20
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.storages.post API Documentation}
21
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.storages.post Enterprise API Documentation}
22
22
  def add_storage(file = nil)
23
23
  file || raise_parameter_is_required_error(:file)
24
24
 
@@ -34,9 +34,9 @@ module Crowdin
34
34
  Web::SendRequest.new(request).perform
35
35
  end
36
36
 
37
- # @param storage_id [Integer] Storage ID
38
- # * {https://developer.crowdin.com/api/v2/#operation/api.storages.get API Documentation}
39
- # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.storages.get Enterprise API Documentation}
37
+ # @param storage_id [Integer] Storage Identifier
38
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.storages.get API Documentation}
39
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.storages.get Enterprise API Documentation}
40
40
  def get_storage(storage_id = nil)
41
41
  storage_id || raise_parameter_is_required_error(:storage_id)
42
42
 
@@ -48,9 +48,9 @@ module Crowdin
48
48
  Web::SendRequest.new(request).perform
49
49
  end
50
50
 
51
- # @param storage_id [Integer] Storage ID
52
- # * {https://developer.crowdin.com/api/v2/#operation/api.storages.delete API Documentation}
53
- # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.storages.delete Enterprise API Documentation}
51
+ # @param storage_id [Integer] Storage Identifier
52
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.storages.delete API Documentation}
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.storages.delete Enterprise API Documentation}
54
54
  def delete_storage(storage_id = nil)
55
55
  storage_id || raise_parameter_is_required_error(:storage_id)
56
56
 
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module StringComments
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.getMany Enterprise API Documentation}
6
9
  def list_string_comments(query = {}, project_id = config.project_id)
7
10
  project_id || raise_project_id_is_required_error
8
11
 
@@ -15,6 +18,9 @@ module Crowdin
15
18
  Web::SendRequest.new(request).perform
16
19
  end
17
20
 
21
+ # @param query [Hash] Request Body
22
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.post API Documentation}
23
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.post Enterprise API Documentation}
18
24
  def add_string_comment(query = {}, project_id = config.project_id)
19
25
  project_id || raise_project_id_is_required_error
20
26
 
@@ -27,6 +33,9 @@ module Crowdin
27
33
  Web::SendRequest.new(request).perform
28
34
  end
29
35
 
36
+ # @param string_comment_id [Hash] Request Body
37
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.get API Documentation}
38
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.get Enterprise API Documentation}
30
39
  def get_string_comment(string_comment_id = nil, project_id = config.project_id)
31
40
  string_comment_id || raise_parameter_is_required_error(:string_comment_id)
32
41
  project_id || raise_project_id_is_required_error
@@ -39,6 +48,9 @@ module Crowdin
39
48
  Web::SendRequest.new(request).perform
40
49
  end
41
50
 
51
+ # @param string_comment_id [Hash] Request Body
52
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.delete API Documentation}
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.delete Enterprise API Documentation}
42
54
  def delete_string_comment(string_comment_id = nil, project_id = config.project_id)
43
55
  string_comment_id || raise_parameter_is_required_error(:string_comment_id)
44
56
  project_id || raise_project_id_is_required_error
@@ -51,6 +63,10 @@ module Crowdin
51
63
  Web::SendRequest.new(request).perform
52
64
  end
53
65
 
66
+ # @param string_comment_id [Hash] Request Body
67
+ # @param query [Hash] Request Body
68
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.patch API Documentation}
69
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.patch Enterprise API Documentation}
54
70
  def edit_string_comment(string_comment_id = nil, query = {}, project_id = config.project_id)
55
71
  string_comment_id || raise_parameter_is_required_error(:string_comment_id)
56
72
  project_id || raise_project_id_is_required_error
@@ -63,6 +79,36 @@ module Crowdin
63
79
  )
64
80
  Web::SendRequest.new(request).perform
65
81
  end
82
+
83
+ # @param body [Array] Request Body
84
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.batchPatch API Documentation}
85
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.batchPatch Enterprise API Documentation}
86
+ def string_asset_comment_batch_operations(body = [], project_id = config.project_id)
87
+ project_id || raise_project_id_is_required_error
88
+
89
+ request = Web::Request.new(
90
+ connection,
91
+ :patch,
92
+ "#{config.target_api_url}/projects/#{project_id}/comments",
93
+ { params: body }
94
+ )
95
+ Web::SendRequest.new(request).perform
96
+ end
97
+
98
+ # @param comment_id [Integer] String Comment Identifier
99
+ # @param attachment_id [Integer] Attachment Identifier
100
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.comments.attachments.delete API Documentation}
101
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.comments.attachments.delete Enterprise API Documentation}
102
+ def delete_attachment_from_string_asset_comment(comment_id, attachment_id, project_id = config.project_id)
103
+ project_id || raise_project_id_is_required_error
104
+
105
+ request = Web::Request.new(
106
+ connection,
107
+ :delete,
108
+ "#{config.target_api_url}/projects/#{project_id}/comments/#{comment_id}/attachments/#{attachment_id}"
109
+ )
110
+ Web::SendRequest.new(request).perform
111
+ end
66
112
  end
67
113
  end
68
114
  end
@@ -3,8 +3,12 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module StringCorrections
6
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.getMany Enterprise API Documentation}
6
+ # -- For Enterprise mode only --
7
+
8
+ # @param query [Hash] Request Query Parameters
9
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.getMany Enterprise API Documentation}
7
10
  def list_corrections(query = {}, project_id = config.project_id)
11
+ enterprise_mode? || raise_only_for_enterprise_mode_error
8
12
  project_id || raise_project_id_is_required_error
9
13
 
10
14
  request = Web::Request.new(
@@ -16,8 +20,10 @@ module Crowdin
16
20
  Web::SendRequest.new(request).perform
17
21
  end
18
22
 
19
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.post Enterprise API Documentation}
23
+ # @param body [Hash] Request Body
24
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.post Enterprise API Documentation}
20
25
  def add_correction(body = {}, project_id = config.project_id)
26
+ enterprise_mode? || raise_only_for_enterprise_mode_error
21
27
  project_id || raise_project_id_is_required_error
22
28
 
23
29
  request = Web::Request.new(
@@ -29,8 +35,11 @@ module Crowdin
29
35
  Web::SendRequest.new(request).perform
30
36
  end
31
37
 
32
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.get Enterprise API Documentation}
38
+ # @param correction_id [Integer] Correction Identifier
39
+ # @param query [Hash] Request Query Parameters
40
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.get Enterprise API Documentation}
33
41
  def get_correction(correction_id = nil, query = {}, project_id = config.project_id)
42
+ enterprise_mode? || raise_only_for_enterprise_mode_error
34
43
  correction_id || raise_parameter_is_required_error(:correction_id)
35
44
  project_id || raise_project_id_is_required_error
36
45
 
@@ -43,8 +52,10 @@ module Crowdin
43
52
  Web::SendRequest.new(request).perform
44
53
  end
45
54
 
46
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.deleteMany Enterprise API Documentation}
55
+ # @param query [Hash] Request Query Parameters
56
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.deleteMany Enterprise API Documentation}
47
57
  def delete_corrections(query = {}, project_id = config.project_id)
58
+ enterprise_mode? || raise_only_for_enterprise_mode_error
48
59
  project_id || raise_project_id_is_required_error
49
60
 
50
61
  request = Web::Request.new(
@@ -56,8 +67,10 @@ module Crowdin
56
67
  Web::SendRequest.new(request).perform
57
68
  end
58
69
 
59
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.delete Enterprise API Documentation}
70
+ # @param correction_id [Integer] Correction Identifier
71
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.delete Enterprise API Documentation}
60
72
  def delete_correction(correction_id = nil, project_id = config.project_id)
73
+ enterprise_mode? || raise_only_for_enterprise_mode_error
61
74
  correction_id || raise_parameter_is_required_error(:correction_id)
62
75
  project_id || raise_project_id_is_required_error
63
76
 
@@ -69,8 +82,10 @@ module Crowdin
69
82
  Web::SendRequest.new(request).perform
70
83
  end
71
84
 
72
- # * {https://support.crowdin.com/developer/enterprise/api/v2/#tag/String-Corrections/operation/api.projects.corrections.put Enterprise API Documentation}
85
+ # @param correction_id [Integer] Correction Identifier
86
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.corrections.put Enterprise API Documentation}
73
87
  def restore_correction(correction_id = nil, project_id = config.project_id)
88
+ enterprise_mode? || raise_only_for_enterprise_mode_error
74
89
  correction_id || raise_parameter_is_required_error(:correction_id)
75
90
  project_id || raise_project_id_is_required_error
76
91
 
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module StringTranslations
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.getMany Enterprise API Documentation}
6
9
  def list_translation_approvals(query = {}, project_id = config.project_id)
7
10
  project_id || raise_project_id_is_required_error
8
11
 
@@ -15,6 +18,9 @@ module Crowdin
15
18
  Web::SendRequest.new(request).perform
16
19
  end
17
20
 
21
+ # @param query [Hash] Request Body
22
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.post API Documentation}
23
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.post Enterprise API Documentation}
18
24
  def add_approval(query = {}, project_id = config.project_id)
19
25
  project_id || raise_project_id_is_required_error
20
26
 
@@ -27,6 +33,9 @@ module Crowdin
27
33
  Web::SendRequest.new(request).perform
28
34
  end
29
35
 
36
+ # @param approval_id [Integer] Approval Identifier
37
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.get API Documentation}
38
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.get Enterprise API Documentation}
30
39
  def get_approval(approval_id = nil, project_id = config.project_id)
31
40
  approval_id || raise_parameter_is_required_error(:approval_id)
32
41
  project_id || raise_project_id_is_required_error
@@ -39,6 +48,9 @@ module Crowdin
39
48
  Web::SendRequest.new(request).perform
40
49
  end
41
50
 
51
+ # @param approval_id [Integer] Approval Identifier
52
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.delete API Documentation}
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.delete Enterprise API Documentation}
42
54
  def remove_approval(approval_id = nil, project_id = config.project_id)
43
55
  approval_id || raise_parameter_is_required_error(:approval_id)
44
56
  project_id || raise_project_id_is_required_error
@@ -51,6 +63,9 @@ module Crowdin
51
63
  Web::SendRequest.new(request).perform
52
64
  end
53
65
 
66
+ # @param query [Hash] Request Query Parameters
67
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.deleteMany API Documentation}
68
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.deleteMany Enterprise API Documentation}
54
69
  def remove_string_approvals(query = {}, project_id = config.project_id)
55
70
  project_id || raise_project_id_is_required_error
56
71
 
@@ -63,6 +78,10 @@ module Crowdin
63
78
  Web::SendRequest.new(request).perform
64
79
  end
65
80
 
81
+ # @param language_id [String] Language Identifier
82
+ # @param query [Hash] Request Query Parameters
83
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.languages.translations.getMany API Documentation}
84
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.languages.translations.getMany Enterprise API Documentation}
66
85
  def list_language_translations(language_id = nil, query = {}, project_id = config.project_id)
67
86
  language_id || raise_parameter_is_required_error(:language_id)
68
87
  project_id || raise_project_id_is_required_error
@@ -76,6 +95,9 @@ module Crowdin
76
95
  Web::SendRequest.new(request).perform
77
96
  end
78
97
 
98
+ # @param query [Hash] Request Query Parameters
99
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.getMany API Documentation}
100
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.getMany Enterprise API Documentation}
79
101
  def list_string_translations(query = {}, project_id = config.project_id)
80
102
  project_id || raise_project_id_is_required_error
81
103
 
@@ -88,6 +110,9 @@ module Crowdin
88
110
  Web::SendRequest.new(request).perform
89
111
  end
90
112
 
113
+ # @param query [Hash] Request Body
114
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.post API Documentation}
115
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.post Enterprise API Documentation}
91
116
  def add_translation(query = {}, project_id = config.project_id)
92
117
  project_id || raise_project_id_is_required_error
93
118
 
@@ -100,6 +125,9 @@ module Crowdin
100
125
  Web::SendRequest.new(request).perform
101
126
  end
102
127
 
128
+ # @param query [Hash] Request Query Parameters
129
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.deleteMany API Documentation}
130
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.deleteMany Enterprise API Documentation}
103
131
  def delete_string_translations(query = {}, project_id = config.project_id)
104
132
  project_id || raise_project_id_is_required_error
105
133
 
@@ -112,6 +140,10 @@ module Crowdin
112
140
  Web::SendRequest.new(request).perform
113
141
  end
114
142
 
143
+ # @param translation_id [Integer] Translation Identifier
144
+ # @param query [Hash] Request Query Parameters
145
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.get API Documentation}
146
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.get Enterprise API Documentation}
115
147
  def get_translation(translation_id = nil, query = {}, project_id = config.project_id)
116
148
  translation_id || raise_parameter_is_required_error(:translation_id)
117
149
  project_id || raise_project_id_is_required_error
@@ -125,6 +157,9 @@ module Crowdin
125
157
  Web::SendRequest.new(request).perform
126
158
  end
127
159
 
160
+ # @param translation_id [Integer] Translation Identifier
161
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.put API Documentation}
162
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.put Enterprise API Documentation}
128
163
  def restore_translation(translation_id = nil, project_id = config.project_id)
129
164
  translation_id || raise_parameter_is_required_error(:translation_id)
130
165
  project_id || raise_project_id_is_required_error
@@ -137,6 +172,9 @@ module Crowdin
137
172
  Web::SendRequest.new(request).perform
138
173
  end
139
174
 
175
+ # @param translation_id [Integer] Translation Identifier
176
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.delete API Documentation}
177
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.delete Enterprise API Documentation}
140
178
  def delete_translation(translation_id = nil, project_id = config.project_id)
141
179
  translation_id || raise_parameter_is_required_error(:translation_id)
142
180
  project_id || raise_project_id_is_required_error
@@ -149,6 +187,9 @@ module Crowdin
149
187
  Web::SendRequest.new(request).perform
150
188
  end
151
189
 
190
+ # @param query [Hash] Request Query Parameters
191
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.votes.getMany API Documentation}
192
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.votes.getMany Enterprise API Documentation}
152
193
  def list_translation_votes(query = {}, project_id = config.project_id)
153
194
  project_id || raise_project_id_is_required_error
154
195
 
@@ -161,6 +202,9 @@ module Crowdin
161
202
  Web::SendRequest.new(request).perform
162
203
  end
163
204
 
205
+ # @param query [Hash] Request Body
206
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.votes.post API Documentation}
207
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.votes.post Enterprise API Documentation}
164
208
  def add_vote(query = {}, project_id = config.project_id)
165
209
  project_id || raise_project_id_is_required_error
166
210
 
@@ -173,6 +217,9 @@ module Crowdin
173
217
  Web::SendRequest.new(request).perform
174
218
  end
175
219
 
220
+ # @param vote_id [Integer] Vote Identifier
221
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.votes.get API Documentation}
222
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.votes.get Enterprise API Documentation}
176
223
  def get_vote(vote_id = nil, project_id = config.project_id)
177
224
  vote_id || raise_parameter_is_required_error(:vote_id)
178
225
  project_id || raise_project_id_is_required_error
@@ -185,6 +232,9 @@ module Crowdin
185
232
  Web::SendRequest.new(request).perform
186
233
  end
187
234
 
235
+ # @param vote_id [Integer] Vote Identifier
236
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.votes.delete API Documentation}
237
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.votes.delete Enterprise API Documentation}
188
238
  def cancel_vote(vote_id = nil, project_id = config.project_id)
189
239
  vote_id || raise_parameter_is_required_error(:vote_id)
190
240
  project_id || raise_project_id_is_required_error
@@ -197,6 +247,9 @@ module Crowdin
197
247
  Web::SendRequest.new(request).perform
198
248
  end
199
249
 
250
+ # @param query [Hash] Request Body
251
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.alignment.post API Documentation}
252
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.alignment.post Enterprise API Documentation}
200
253
  def add_translation_alignment(project_id = nil, query = {})
201
254
  project_id || raise_project_id_is_required_error
202
255
 
@@ -212,6 +265,49 @@ module Crowdin
212
265
  )
213
266
  Web::SendRequest.new(request).perform
214
267
  end
268
+
269
+ # @param body [Array] Request Body
270
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.approvals.patch API Documentation}
271
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.approvals.patch Enterprise API Documentation}
272
+ def approval_batch_operations(body = [], project_id = config.project_id)
273
+ project_id || raise_project_id_is_required_error
274
+
275
+ request = Web::Request.new(
276
+ connection,
277
+ :patch,
278
+ "#{config.target_api_url}/projects/#{project_id}/approvals",
279
+ { params: body }
280
+ )
281
+ Web::SendRequest.new(request).perform
282
+ end
283
+
284
+ # @param body [Array] Request Body
285
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.translations.patch API Documentation}
286
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.translations.patch Enterprise API Documentation}
287
+ def translation_batch_operations(body = [], project_id = config.project_id)
288
+ project_id || raise_project_id_is_required_error
289
+
290
+ request = Web::Request.new(
291
+ connection,
292
+ :patch,
293
+ "#{config.target_api_url}/projects/#{project_id}/translations",
294
+ { params: body }
295
+ )
296
+ Web::SendRequest.new(request).perform
297
+ end
298
+
299
+ # @param query [Hash] Request Query Parameters
300
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.translations.getMany API Documentation}
301
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.translations.getMany Enterprise API Documentation}
302
+ def search_translations(query = {})
303
+ request = Web::Request.new(
304
+ connection,
305
+ :get,
306
+ "#{config.target_api_url}/translations",
307
+ { params: query }
308
+ )
309
+ Web::SendRequest.new(request).perform
310
+ end
215
311
  end
216
312
  end
217
313
  end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module StyleGuides
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.style-guides.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.style-guides.getMany Enterprise API Documentation}
9
+ def list_style_guides(query = {})
10
+ request = Web::Request.new(
11
+ connection,
12
+ :get,
13
+ "#{config.target_api_url}/style-guides",
14
+ { params: query }
15
+ )
16
+ Web::SendRequest.new(request).perform
17
+ end
18
+
19
+ # @param body [Hash] Request Body
20
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.style-guides.post API Documentation}
21
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.style-guides.post Enterprise API Documentation}
22
+ def create_style_guide(body = {})
23
+ request = Web::Request.new(
24
+ connection,
25
+ :post,
26
+ "#{config.target_api_url}/style-guides",
27
+ { params: body }
28
+ )
29
+ Web::SendRequest.new(request).perform
30
+ end
31
+
32
+ # @param style_guide_id [Integer] Style Guide Identifier
33
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.style-guides.delete API Documentation}
34
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.style-guides.delete Enterprise API Documentation}
35
+ def delete_style_guide(style_guide_id)
36
+ request = Web::Request.new(
37
+ connection,
38
+ :delete,
39
+ "#{config.target_api_url}/style-guides/#{style_guide_id}"
40
+ )
41
+ Web::SendRequest.new(request).perform
42
+ end
43
+
44
+ # @param style_guide_id [Integer] Style Guide Identifier
45
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.style-guides.get API Documentation}
46
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.style-guides.get Enterprise API Documentation}
47
+ def get_style_guide(style_guide_id)
48
+ request = Web::Request.new(
49
+ connection,
50
+ :get,
51
+ "#{config.target_api_url}/style-guides/#{style_guide_id}"
52
+ )
53
+ Web::SendRequest.new(request).perform
54
+ end
55
+
56
+ # @param style_guide_id [Integer] Style Guide Identifier
57
+ # @param body [Array] Request Body
58
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.style-guides.patch API Documentation}
59
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.style-guides.patch Enterprise API Documentation}
60
+ def edit_style_guide(style_guide_id, body = [])
61
+ request = Web::Request.new(
62
+ connection,
63
+ :patch,
64
+ "#{config.target_api_url}/style-guides/#{style_guide_id}",
65
+ { params: body }
66
+ )
67
+ Web::SendRequest.new(request).perform
68
+ end
69
+ end
70
+ end
71
+ end