crowdin-api 1.14.0 → 1.15.1

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +1 -0
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +1 -0
  5. data/AGENTS.md +63 -0
  6. data/CLAUDE.md +1 -0
  7. data/Gemfile.lock +7 -7
  8. data/README.md +1 -1
  9. data/crowdin-api.gemspec +1 -1
  10. data/lib/crowdin-api/api_resources/advisor.rb +86 -0
  11. data/lib/crowdin-api/api_resources/ai.rb +974 -0
  12. data/lib/crowdin-api/api_resources/applications.rb +247 -10
  13. data/lib/crowdin-api/api_resources/bundles.rb +45 -29
  14. data/lib/crowdin-api/api_resources/clients.rb +23 -0
  15. data/lib/crowdin-api/api_resources/custom_spellcheckers.rb +36 -0
  16. data/lib/crowdin-api/api_resources/dictionaries.rb +5 -5
  17. data/lib/crowdin-api/api_resources/distributions.rb +15 -15
  18. data/lib/crowdin-api/api_resources/external_qa_checks.rb +36 -0
  19. data/lib/crowdin-api/api_resources/fields.rb +78 -0
  20. data/lib/crowdin-api/api_resources/glossaries.rb +62 -50
  21. data/lib/crowdin-api/api_resources/integrations.rb +201 -0
  22. data/lib/crowdin-api/api_resources/labels.rb +32 -0
  23. data/lib/crowdin-api/api_resources/languages.rb +16 -0
  24. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +17 -0
  25. data/lib/crowdin-api/api_resources/notifications.rb +15 -6
  26. data/lib/crowdin-api/api_resources/organization.rb +33 -0
  27. data/lib/crowdin-api/api_resources/organization_webhooks.rb +71 -0
  28. data/lib/crowdin-api/api_resources/placeholders.rb +182 -0
  29. data/lib/crowdin-api/api_resources/projects.rb +137 -41
  30. data/lib/crowdin-api/api_resources/reports.rb +310 -26
  31. data/lib/crowdin-api/api_resources/screenshots.rb +48 -0
  32. data/lib/crowdin-api/api_resources/security_logs.rb +63 -0
  33. data/lib/crowdin-api/api_resources/source_files.rb +370 -65
  34. data/lib/crowdin-api/api_resources/source_strings.rb +62 -0
  35. data/lib/crowdin-api/api_resources/storages.rb +11 -11
  36. data/lib/crowdin-api/api_resources/string_comments.rb +46 -0
  37. data/lib/crowdin-api/api_resources/string_corrections.rb +21 -6
  38. data/lib/crowdin-api/api_resources/string_translations.rb +96 -0
  39. data/lib/crowdin-api/api_resources/style_guides.rb +71 -0
  40. data/lib/crowdin-api/api_resources/tasks.rb +140 -10
  41. data/lib/crowdin-api/api_resources/teams.rb +99 -0
  42. data/lib/crowdin-api/api_resources/translation_memory.rb +138 -0
  43. data/lib/crowdin-api/api_resources/translation_status.rb +65 -0
  44. data/lib/crowdin-api/api_resources/translations.rb +122 -2
  45. data/lib/crowdin-api/api_resources/users.rb +136 -6
  46. data/lib/crowdin-api/api_resources/vendors.rb +2 -0
  47. data/lib/crowdin-api/api_resources/webhooks.rb +16 -0
  48. data/lib/crowdin-api/api_resources/workflows.rb +24 -0
  49. data/lib/crowdin-api/client/version.rb +1 -1
  50. data/lib/crowdin-api/core/request.rb +1 -1
  51. data/lib/crowdin-api.rb +3 -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. metadata +29 -3
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module Languages
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.languages.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.languages.getMany Enterprise API Documentation}
6
9
  def list_languages(query = {})
7
10
  request = Web::Request.new(
8
11
  connection,
@@ -13,6 +16,9 @@ module Crowdin
13
16
  Web::SendRequest.new(request).perform
14
17
  end
15
18
 
19
+ # @param query [Hash] Request Body
20
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.languages.post API Documentation}
21
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.languages.post Enterprise API Documentation}
16
22
  def add_custom_language(query = {})
17
23
  request = Web::Request.new(
18
24
  connection,
@@ -23,6 +29,9 @@ module Crowdin
23
29
  Web::SendRequest.new(request).perform
24
30
  end
25
31
 
32
+ # @param language_id [String] Language Identifier
33
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.languages.get API Documentation}
34
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.languages.get Enterprise API Documentation}
26
35
  def get_language(language_id = nil)
27
36
  language_id || raise_parameter_is_required_error(:language_id)
28
37
 
@@ -34,6 +43,9 @@ module Crowdin
34
43
  Web::SendRequest.new(request).perform
35
44
  end
36
45
 
46
+ # @param language_id [String] Language Identifier
47
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.languages.delete API Documentation}
48
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.languages.delete Enterprise API Documentation}
37
49
  def delete_custom_language(language_id = nil)
38
50
  language_id || raise_parameter_is_required_error(:language_id)
39
51
 
@@ -45,6 +57,10 @@ module Crowdin
45
57
  Web::SendRequest.new(request).perform
46
58
  end
47
59
 
60
+ # @param language_id [String] Language Identifier
61
+ # @param query [Hash] Request Body
62
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.languages.patch API Documentation}
63
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.languages.patch Enterprise API Documentation}
48
64
  def edit_custom_language(language_id = nil, query = {})
49
65
  language_id || raise_parameter_is_required_error(:language_id)
50
66
 
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module MachineTranslationEngines
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.mts.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.getMany Enterprise API Documentation}
6
9
  def list_mts(query = {})
7
10
  request = Web::Request.new(
8
11
  connection,
@@ -13,6 +16,9 @@ module Crowdin
13
16
  Web::SendRequest.new(request).perform
14
17
  end
15
18
 
19
+ # @param mt_id [Integer] Machine Translation engine identifier
20
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.mts.get API Documentation}
21
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.get Enterprise API Documentation}
16
22
  def get_mt(mt_id = nil)
17
23
  mt_id || raise_parameter_is_required_error(:mt_id)
18
24
 
@@ -24,6 +30,10 @@ module Crowdin
24
30
  Web::SendRequest.new(request).perform
25
31
  end
26
32
 
33
+ # @param mt_id [Integer] Machine Translation engine identifier
34
+ # @param query [Hash] Request Body
35
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.mts.translations.post API Documentation}
36
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.translations.post Enterprise API Documentation}
27
37
  def translate_via_mt(mt_id = nil, query = {})
28
38
  mt_id || raise_parameter_is_required_error(:mt_id)
29
39
 
@@ -38,6 +48,9 @@ module Crowdin
38
48
 
39
49
  # -- For Enterprise mode only --
40
50
 
51
+ # @param mt_id [Integer] Machine Translation engine identifier
52
+ # @param query [Hash] Request Body
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.patch Enterprise API Documentation}
41
54
  def edit_mt(mt_id = nil, query = {})
42
55
  enterprise_mode? || raise_only_for_enterprise_mode_error
43
56
  mt_id || raise_parameter_is_required_error(:mt_id)
@@ -51,6 +64,8 @@ module Crowdin
51
64
  Web::SendRequest.new(request).perform
52
65
  end
53
66
 
67
+ # @param query [Hash] Request Body
68
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.post Enterprise API Documentation}
54
69
  def add_mt(query = {})
55
70
  enterprise_mode? || raise_only_for_enterprise_mode_error
56
71
 
@@ -63,6 +78,8 @@ module Crowdin
63
78
  Web::SendRequest.new(request).perform
64
79
  end
65
80
 
81
+ # @param mt_id [Integer] Machine Translation engine identifier
82
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.mts.delete Enterprise API Documentation}
66
83
  def delete_mt(mt_id = nil)
67
84
  enterprise_mode? || raise_only_for_enterprise_mode_error
68
85
  mt_id || raise_parameter_is_required_error(:mt_id)
@@ -3,6 +3,8 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
5
  module Notifications
6
+ # @param query [Hash] Request Body
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.notify.post API Documentation}
6
8
  def send_notification_to_authenticated_user(query = {})
7
9
  %i[message].each do |param|
8
10
  query[param] || raise_parameter_is_required_error(param)
@@ -17,8 +19,11 @@ module Crowdin
17
19
  Web::SendRequest.new(request).perform
18
20
  end
19
21
 
20
- def send_notification_to_organization_members(query = {})
21
- enterprise_mode? || raise_only_for_enterprise_mode_error
22
+ # @param query [Hash] Request Body
23
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.notify.post API Documentation}
24
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.notify.post Enterprise API Documentation}
25
+ def send_notifications_to_project_members(query = {}, project_id = config.project_id)
26
+ project_id || raise_project_id_is_required_error
22
27
 
23
28
  %i[message].each do |param|
24
29
  query[param] || raise_parameter_is_required_error(param)
@@ -27,14 +32,18 @@ module Crowdin
27
32
  request = Web::Request.new(
28
33
  connection,
29
34
  :post,
30
- "#{config.target_api_url}/notify",
35
+ "#{config.target_api_url}/projects/#{project_id}/notify",
31
36
  { params: query }
32
37
  )
33
38
  Web::SendRequest.new(request).perform
34
39
  end
35
40
 
36
- def send_notifications_to_project_members(query = {}, project_id = config.project_id)
37
- project_id || raise_project_id_is_required_error
41
+ # -- For Enterprise mode only --
42
+
43
+ # @param query [Hash] Request Body
44
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.notify.post Enterprise API Documentation}
45
+ def send_notification_to_organization_members(query = {})
46
+ enterprise_mode? || raise_only_for_enterprise_mode_error
38
47
 
39
48
  %i[message].each do |param|
40
49
  query[param] || raise_parameter_is_required_error(param)
@@ -43,7 +52,7 @@ module Crowdin
43
52
  request = Web::Request.new(
44
53
  connection,
45
54
  :post,
46
- "#{config.target_api_url}/projects/#{project_id}/notify",
55
+ "#{config.target_api_url}/notify",
47
56
  { params: query }
48
57
  )
49
58
  Web::SendRequest.new(request).perform
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Organization
6
+ # -- For Enterprise mode only --
7
+
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.organization.get Enterprise API Documentation}
9
+ def get_organization_info
10
+ enterprise_mode? || raise_only_for_enterprise_mode_error
11
+
12
+ request = Web::Request.new(
13
+ connection,
14
+ :get,
15
+ "#{config.target_api_url}/organization"
16
+ )
17
+ Web::SendRequest.new(request).perform
18
+ end
19
+
20
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.organization.auth-settings.get Enterprise API Documentation}
21
+ def get_organization_authentication_settings
22
+ enterprise_mode? || raise_only_for_enterprise_mode_error
23
+
24
+ request = Web::Request.new(
25
+ connection,
26
+ :get,
27
+ "#{config.target_api_url}/organization/auth-settings"
28
+ )
29
+ Web::SendRequest.new(request).perform
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module OrganizationWebhooks
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.webhooks.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.webhooks.getMany Enterprise API Documentation}
9
+ def list_organization_webhooks(query = {})
10
+ request = Web::Request.new(
11
+ connection,
12
+ :get,
13
+ "#{config.target_api_url}/webhooks",
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.webhooks.post API Documentation}
21
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.webhooks.post Enterprise API Documentation}
22
+ def add_organization_webhook(body = {})
23
+ request = Web::Request.new(
24
+ connection,
25
+ :post,
26
+ "#{config.target_api_url}/webhooks",
27
+ { params: body }
28
+ )
29
+ Web::SendRequest.new(request).perform
30
+ end
31
+
32
+ # @param organization_webhook_id [Integer] Webhook Identifier
33
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.webhooks.delete API Documentation}
34
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.webhooks.delete Enterprise API Documentation}
35
+ def delete_organization_webhook(organization_webhook_id)
36
+ request = Web::Request.new(
37
+ connection,
38
+ :delete,
39
+ "#{config.target_api_url}/webhooks/#{organization_webhook_id}"
40
+ )
41
+ Web::SendRequest.new(request).perform
42
+ end
43
+
44
+ # @param organization_webhook_id [Integer] Webhook Identifier
45
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.webhooks.get API Documentation}
46
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.webhooks.get Enterprise API Documentation}
47
+ def get_organization_webhook(organization_webhook_id)
48
+ request = Web::Request.new(
49
+ connection,
50
+ :get,
51
+ "#{config.target_api_url}/webhooks/#{organization_webhook_id}"
52
+ )
53
+ Web::SendRequest.new(request).perform
54
+ end
55
+
56
+ # @param organization_webhook_id [Integer] Webhook Identifier
57
+ # @param body [Array] Request Body
58
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.webhooks.patch API Documentation}
59
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.webhooks.patch Enterprise API Documentation}
60
+ def edit_organization_webhook(organization_webhook_id, body = [])
61
+ request = Web::Request.new(
62
+ connection,
63
+ :patch,
64
+ "#{config.target_api_url}/webhooks/#{organization_webhook_id}",
65
+ { params: body }
66
+ )
67
+ Web::SendRequest.new(request).perform
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Placeholders
6
+ # @param query [Hash] Request Query Parameters
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.system-placeholders.getMany API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.system-placeholders.getMany Enterprise API Documentation}
9
+ def list_project_system_placeholders(query = {}, project_id = config.project_id)
10
+ project_id || raise_project_id_is_required_error
11
+
12
+ request = Web::Request.new(
13
+ connection,
14
+ :get,
15
+ "#{config.target_api_url}/projects/#{project_id}/system-placeholders",
16
+ { params: query }
17
+ )
18
+ Web::SendRequest.new(request).perform
19
+ end
20
+
21
+ # @param body [Array] Request Body
22
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.system-placeholders.batchPatch API Documentation}
23
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.system-placeholders.batchPatch Enterprise API Documentation}
24
+ def project_system_placeholder_batch_operations(body = [], project_id = config.project_id)
25
+ project_id || raise_project_id_is_required_error
26
+
27
+ request = Web::Request.new(
28
+ connection,
29
+ :patch,
30
+ "#{config.target_api_url}/projects/#{project_id}/system-placeholders",
31
+ { params: body }
32
+ )
33
+ Web::SendRequest.new(request).perform
34
+ end
35
+
36
+ # -- For Enterprise mode only --
37
+
38
+ # @param query [Hash] Request Query Parameters
39
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.custom-placeholders.getMany Enterprise API Documentation}
40
+ def list_custom_placeholders(query = {})
41
+ enterprise_mode? || raise_only_for_enterprise_mode_error
42
+
43
+ request = Web::Request.new(
44
+ connection,
45
+ :get,
46
+ "#{config.target_api_url}/custom-placeholders",
47
+ { params: query }
48
+ )
49
+ Web::SendRequest.new(request).perform
50
+ end
51
+
52
+ # @param body [Hash] Request Body
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.custom-placeholders.post Enterprise API Documentation}
54
+ def add_custom_placeholder(body = {})
55
+ enterprise_mode? || raise_only_for_enterprise_mode_error
56
+
57
+ request = Web::Request.new(
58
+ connection,
59
+ :post,
60
+ "#{config.target_api_url}/custom-placeholders",
61
+ { params: body }
62
+ )
63
+ Web::SendRequest.new(request).perform
64
+ end
65
+
66
+ # @param custom_placeholder_id [Integer] Custom Placeholder identifier
67
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.custom-placeholders.delete Enterprise API Documentation}
68
+ def delete_custom_placeholder(custom_placeholder_id)
69
+ enterprise_mode? || raise_only_for_enterprise_mode_error
70
+
71
+ request = Web::Request.new(
72
+ connection,
73
+ :delete,
74
+ "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}"
75
+ )
76
+ Web::SendRequest.new(request).perform
77
+ end
78
+
79
+ # @param custom_placeholder_id [Integer] Custom Placeholder identifier
80
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.custom-placeholders.get Enterprise API Documentation}
81
+ def get_custom_placeholder(custom_placeholder_id)
82
+ enterprise_mode? || raise_only_for_enterprise_mode_error
83
+
84
+ request = Web::Request.new(
85
+ connection,
86
+ :get,
87
+ "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}"
88
+ )
89
+ Web::SendRequest.new(request).perform
90
+ end
91
+
92
+ # @param custom_placeholder_id [Integer] Custom Placeholder identifier
93
+ # @param body [Array] Request Body
94
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.custom-placeholders.patch Enterprise API Documentation}
95
+ def edit_custom_placeholder(custom_placeholder_id, body = [])
96
+ enterprise_mode? || raise_only_for_enterprise_mode_error
97
+
98
+ request = Web::Request.new(
99
+ connection,
100
+ :patch,
101
+ "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}",
102
+ { params: body }
103
+ )
104
+ Web::SendRequest.new(request).perform
105
+ end
106
+
107
+ # @param query [Hash] Request Query Parameters
108
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.placeholders.getMany Enterprise API Documentation}
109
+ def list_project_placeholders(query = {}, project_id = config.project_id)
110
+ enterprise_mode? || raise_only_for_enterprise_mode_error
111
+ project_id || raise_project_id_is_required_error
112
+
113
+ request = Web::Request.new(
114
+ connection,
115
+ :get,
116
+ "#{config.target_api_url}/projects/#{project_id}/placeholders",
117
+ { params: query }
118
+ )
119
+ Web::SendRequest.new(request).perform
120
+ end
121
+
122
+ # @param body [Hash] Request Body
123
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.placeholders.post Enterprise API Documentation}
124
+ def add_project_placeholder(body = {}, project_id = config.project_id)
125
+ enterprise_mode? || raise_only_for_enterprise_mode_error
126
+ project_id || raise_project_id_is_required_error
127
+
128
+ request = Web::Request.new(
129
+ connection,
130
+ :post,
131
+ "#{config.target_api_url}/projects/#{project_id}/placeholders",
132
+ { params: body }
133
+ )
134
+ Web::SendRequest.new(request).perform
135
+ end
136
+
137
+ # @param project_placeholder_id [Integer] Project Placeholder identifier
138
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.placeholders.delete Enterprise API Documentation}
139
+ def delete_project_placeholder(project_placeholder_id, project_id = config.project_id)
140
+ enterprise_mode? || raise_only_for_enterprise_mode_error
141
+ project_id || raise_project_id_is_required_error
142
+
143
+ request = Web::Request.new(
144
+ connection,
145
+ :delete,
146
+ "#{config.target_api_url}/projects/#{project_id}/placeholders/#{project_placeholder_id}"
147
+ )
148
+ Web::SendRequest.new(request).perform
149
+ end
150
+
151
+ # @param project_placeholder_id [Integer] Project Placeholder identifier
152
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.placeholders.get Enterprise API Documentation}
153
+ def get_project_placeholder(project_placeholder_id, project_id = config.project_id)
154
+ enterprise_mode? || raise_only_for_enterprise_mode_error
155
+ project_id || raise_project_id_is_required_error
156
+
157
+ request = Web::Request.new(
158
+ connection,
159
+ :get,
160
+ "#{config.target_api_url}/projects/#{project_id}/placeholders/#{project_placeholder_id}"
161
+ )
162
+ Web::SendRequest.new(request).perform
163
+ end
164
+
165
+ # @param project_placeholder_id [Integer] Project Placeholder identifier
166
+ # @param body [Array] Request Body
167
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.placeholders.patch Enterprise API Documentation}
168
+ def edit_project_placeholder(project_placeholder_id, body = [], project_id = config.project_id)
169
+ enterprise_mode? || raise_only_for_enterprise_mode_error
170
+ project_id || raise_project_id_is_required_error
171
+
172
+ request = Web::Request.new(
173
+ connection,
174
+ :patch,
175
+ "#{config.target_api_url}/projects/#{project_id}/placeholders/#{project_placeholder_id}",
176
+ { params: body }
177
+ )
178
+ Web::SendRequest.new(request).perform
179
+ end
180
+ end
181
+ end
182
+ end