azure_cognitiveservices_contentmoderator 0.16.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 (78) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator.rb +93 -0
  4. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/content_moderator_client.rb +167 -0
  5. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/image_moderation.rb +1399 -0
  6. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_image.rb +637 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_image_lists.rb +610 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term.rb +429 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term_lists.rb +618 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/address.rb +58 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/apierror.rb +47 -0
  12. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/azure_region_base_url.rb +27 -0
  13. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/body.rb +70 -0
  14. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/body_metadata.rb +57 -0
  15. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/candidate.rb +57 -0
  16. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/classification.rb +82 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/content.rb +47 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_review_body_item.rb +101 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_review_body_item_metadata_item.rb +58 -0
  20. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_video_reviews_body_item.rb +144 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_video_reviews_body_item_metadata_item.rb +58 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_video_reviews_body_item_video_frames_item.rb +112 -0
  23. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_video_reviews_body_item_video_frames_item_metadata_item.rb +59 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/create_video_reviews_body_item_video_frames_item_reviewer_result_tags_item.rb +60 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/detected_language.rb +69 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/detected_terms.rb +81 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/email.rb +80 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/error.rb +57 -0
  29. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/evaluate.rb +144 -0
  30. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/face.rb +79 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/found_faces.rb +131 -0
  32. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/frame.rb +97 -0
  33. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/frames.rb +66 -0
  34. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image.rb +89 -0
  35. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image_additional_info_item.rb +58 -0
  36. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image_ids.rb +88 -0
  37. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image_list.rb +80 -0
  38. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image_list_metadata.rb +57 -0
  39. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/image_url.rb +59 -0
  40. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/ipa.rb +69 -0
  41. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/job.rb +153 -0
  42. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/job_execution_report_details.rb +57 -0
  43. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/job_id.rb +47 -0
  44. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/job_list_result.rb +54 -0
  45. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/key_value_pair.rb +57 -0
  46. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/match.rb +98 -0
  47. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/match_response.rb +100 -0
  48. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/ocr.rb +131 -0
  49. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/phone.rb +69 -0
  50. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/pii.rb +115 -0
  51. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/refresh_index.rb +100 -0
  52. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/refresh_index_advanced_info_item.rb +58 -0
  53. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/review.rb +163 -0
  54. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/score.rb +48 -0
  55. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/screen.rb +165 -0
  56. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/status.rb +68 -0
  57. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/tag.rb +57 -0
  58. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/term_list.rb +80 -0
  59. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/term_list_metadata.rb +57 -0
  60. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/terms.rb +59 -0
  61. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/terms_data.rb +89 -0
  62. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/terms_in_list.rb +46 -0
  63. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/terms_paging.rb +79 -0
  64. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/transcript_moderation_body_item.rb +67 -0
  65. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/transcript_moderation_body_item_terms_item.rb +58 -0
  66. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/video_frame_body_item.rb +98 -0
  67. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/video_frame_body_item_metadata_item.rb +58 -0
  68. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/models/video_frame_body_item_reviewer_result_tags_item.rb +58 -0
  69. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/module_definition.rb +9 -0
  70. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb +1829 -0
  71. data/lib/1.0/generated/azure_cognitiveservices_contentmoderator/text_moderation.rb +294 -0
  72. data/lib/azure_cognitiveservices_contentmoderator.rb +6 -0
  73. data/lib/module_definition.rb +7 -0
  74. data/lib/profiles/latest/contentmoderator_latest_profile_client.rb +38 -0
  75. data/lib/profiles/latest/contentmoderator_module_definition.rb +8 -0
  76. data/lib/profiles/latest/modules/contentmoderator_profile_module.rb +307 -0
  77. data/lib/version.rb +7 -0
  78. metadata +196 -0
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::ContentModerator::V1_0
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ #
12
+ class VideoFrameBodyItemMetadataItem
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Your key parameter.
17
+ attr_accessor :key
18
+
19
+ # @return [String] Your value parameter.
20
+ attr_accessor :value
21
+
22
+
23
+ #
24
+ # Mapper for VideoFrameBodyItemMetadataItem class as Ruby Hash.
25
+ # This will be used for serialization/deserialization.
26
+ #
27
+ def self.mapper()
28
+ {
29
+ client_side_validation: true,
30
+ required: false,
31
+ serialized_name: 'videoFrameBodyItem_MetadataItem',
32
+ type: {
33
+ name: 'Composite',
34
+ class_name: 'VideoFrameBodyItemMetadataItem',
35
+ model_properties: {
36
+ key: {
37
+ client_side_validation: true,
38
+ required: false,
39
+ serialized_name: 'Key',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ value: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ serialized_name: 'Value',
48
+ type: {
49
+ name: 'String'
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::ContentModerator::V1_0
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ #
12
+ class VideoFrameBodyItemReviewerResultTagsItem
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Your key parameter.
17
+ attr_accessor :key
18
+
19
+ # @return [String] Your value parameter.
20
+ attr_accessor :value
21
+
22
+
23
+ #
24
+ # Mapper for VideoFrameBodyItemReviewerResultTagsItem class as Ruby Hash.
25
+ # This will be used for serialization/deserialization.
26
+ #
27
+ def self.mapper()
28
+ {
29
+ client_side_validation: true,
30
+ required: false,
31
+ serialized_name: 'videoFrameBodyItem_ReviewerResultTagsItem',
32
+ type: {
33
+ name: 'Composite',
34
+ class_name: 'VideoFrameBodyItemReviewerResultTagsItem',
35
+ model_properties: {
36
+ key: {
37
+ client_side_validation: true,
38
+ required: false,
39
+ serialized_name: 'Key',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ value: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ serialized_name: 'Value',
48
+ type: {
49
+ name: 'String'
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::CognitiveServices end
8
+ module Azure::CognitiveServices::ContentModerator end
9
+ module Azure::CognitiveServices::ContentModerator::V1_0 end
@@ -0,0 +1,1829 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::ContentModerator::V1_0
7
+ #
8
+ # You use the API to scan your content as it is generated. Content Moderator
9
+ # then processes your content and sends the results along with relevant
10
+ # information either back to your systems or to the built-in review tool. You
11
+ # can use this information to take decisions e.g. take it down, send to human
12
+ # judge, etc.
13
+ #
14
+ # When using the API, images need to have a minimum of 128 pixels and a
15
+ # maximum file size of 4MB.
16
+ # Text can be at most 1024 characters long.
17
+ # If the content passed to the text API or the image API exceeds the size
18
+ # limits, the API will return an error code that informs about the issue.
19
+ #
20
+ # This API is currently available in:
21
+ #
22
+ # * West US - westus.api.cognitive.microsoft.com
23
+ # * East US 2 - eastus2.api.cognitive.microsoft.com
24
+ # * West Central US - westcentralus.api.cognitive.microsoft.com
25
+ # * West Europe - westeurope.api.cognitive.microsoft.com
26
+ # * Southeast Asia - southeastasia.api.cognitive.microsoft.com .
27
+ #
28
+ class Reviews
29
+ include MsRestAzure
30
+
31
+ #
32
+ # Creates and initializes a new instance of the Reviews class.
33
+ # @param client service class for accessing basic functionality.
34
+ #
35
+ def initialize(client)
36
+ @client = client
37
+ end
38
+
39
+ # @return [ContentModeratorClient] reference to the ContentModeratorClient
40
+ attr_reader :client
41
+
42
+ #
43
+ # Returns review details for the review Id passed.
44
+ #
45
+ # @param team_name [String] Your Team Name.
46
+ # @param review_id [String] Id of the review.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [Review] operation results.
51
+ #
52
+ def get_review(team_name, review_id, custom_headers:nil)
53
+ response = get_review_async(team_name, review_id, custom_headers:custom_headers).value!
54
+ response.body unless response.nil?
55
+ end
56
+
57
+ #
58
+ # Returns review details for the review Id passed.
59
+ #
60
+ # @param team_name [String] Your Team Name.
61
+ # @param review_id [String] Id of the review.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def get_review_with_http_info(team_name, review_id, custom_headers:nil)
68
+ get_review_async(team_name, review_id, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Returns review details for the review Id passed.
73
+ #
74
+ # @param team_name [String] Your Team Name.
75
+ # @param review_id [String] Id of the review.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def get_review_async(team_name, review_id, custom_headers:nil)
82
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
83
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
84
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
85
+
86
+
87
+ request_headers = {}
88
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
89
+
90
+ # Set Headers
91
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
93
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}'
94
+
95
+ request_url = @base_url || @client.base_url
96
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
101
+ headers: request_headers.merge(custom_headers || {}),
102
+ base_url: request_url
103
+ }
104
+ promise = @client.make_request_async(:get, path_template, options)
105
+
106
+ promise = promise.then do |result|
107
+ http_response = result.response
108
+ status_code = http_response.status
109
+ response_content = http_response.body
110
+ unless status_code == 200
111
+ error_model = JSON.load(response_content)
112
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
113
+ end
114
+
115
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
116
+ # Deserialize Response
117
+ if status_code == 200
118
+ begin
119
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
120
+ result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Review.mapper()
121
+ result.body = @client.deserialize(result_mapper, parsed_response)
122
+ rescue Exception => e
123
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
124
+ end
125
+ end
126
+
127
+ result
128
+ end
129
+
130
+ promise.execute
131
+ end
132
+
133
+ #
134
+ # Get the Job Details for a Job Id.
135
+ #
136
+ # @param team_name [String] Your Team Name.
137
+ # @param job_id [String] Id of the job.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [Job] operation results.
142
+ #
143
+ def get_job_details(team_name, job_id, custom_headers:nil)
144
+ response = get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
145
+ response.body unless response.nil?
146
+ end
147
+
148
+ #
149
+ # Get the Job Details for a Job Id.
150
+ #
151
+ # @param team_name [String] Your Team Name.
152
+ # @param job_id [String] Id of the job.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def get_job_details_with_http_info(team_name, job_id, custom_headers:nil)
159
+ get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Get the Job Details for a Job Id.
164
+ #
165
+ # @param team_name [String] Your Team Name.
166
+ # @param job_id [String] Id of the job.
167
+ # @param [Hash{String => String}] A hash of custom headers that will be added
168
+ # to the HTTP request.
169
+ #
170
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
171
+ #
172
+ def get_job_details_async(team_name, job_id, custom_headers:nil)
173
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
174
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
175
+ fail ArgumentError, 'job_id is nil' if job_id.nil?
176
+
177
+
178
+ request_headers = {}
179
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
180
+
181
+ # Set Headers
182
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
183
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
184
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/jobs/{JobId}'
185
+
186
+ request_url = @base_url || @client.base_url
187
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
188
+
189
+ options = {
190
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
191
+ path_params: {'teamName' => team_name,'JobId' => job_id},
192
+ headers: request_headers.merge(custom_headers || {}),
193
+ base_url: request_url
194
+ }
195
+ promise = @client.make_request_async(:get, path_template, options)
196
+
197
+ promise = promise.then do |result|
198
+ http_response = result.response
199
+ status_code = http_response.status
200
+ response_content = http_response.body
201
+ unless status_code == 200
202
+ error_model = JSON.load(response_content)
203
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
204
+ end
205
+
206
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
207
+ # Deserialize Response
208
+ if status_code == 200
209
+ begin
210
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
211
+ result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Job.mapper()
212
+ result.body = @client.deserialize(result_mapper, parsed_response)
213
+ rescue Exception => e
214
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
215
+ end
216
+ end
217
+
218
+ result
219
+ end
220
+
221
+ promise.execute
222
+ end
223
+
224
+ #
225
+ # The reviews created would show up for Reviewers on your team. As Reviewers
226
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
227
+ # the specified CallBackEndpoint.
228
+ #
229
+ # <h3>CallBack Schemas </h3>
230
+ # <h4>Review Completion CallBack Sample</h4>
231
+ # <p>
232
+ # {<br/>
233
+ # "ReviewId": "<Review Id>",<br/>
234
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
235
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
236
+ # "CallBackType": "Review",<br/>
237
+ # "ContentId": "<The ContentId that was specified input>",<br/>
238
+ # "Metadata": {<br/>
239
+ # "adultscore": "0.xxx",<br/>
240
+ # "a": "False",<br/>
241
+ # "racyscore": "0.xxx",<br/>
242
+ # "r": "True"<br/>
243
+ # },<br/>
244
+ # "ReviewerResultTags": {<br/>
245
+ # "a": "False",<br/>
246
+ # "r": "True"<br/>
247
+ # }<br/>
248
+ # }<br/>
249
+ #
250
+ # </p>.
251
+ #
252
+ # @param url_content_type [String] The content type.
253
+ # @param team_name [String] Your team name.
254
+ # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
255
+ # reviews API
256
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
257
+ # review to.
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [Array] operation results.
262
+ #
263
+ def create_reviews(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
264
+ response = create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
265
+ response.body unless response.nil?
266
+ end
267
+
268
+ #
269
+ # The reviews created would show up for Reviewers on your team. As Reviewers
270
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
271
+ # the specified CallBackEndpoint.
272
+ #
273
+ # <h3>CallBack Schemas </h3>
274
+ # <h4>Review Completion CallBack Sample</h4>
275
+ # <p>
276
+ # {<br/>
277
+ # "ReviewId": "<Review Id>",<br/>
278
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
279
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
280
+ # "CallBackType": "Review",<br/>
281
+ # "ContentId": "<The ContentId that was specified input>",<br/>
282
+ # "Metadata": {<br/>
283
+ # "adultscore": "0.xxx",<br/>
284
+ # "a": "False",<br/>
285
+ # "racyscore": "0.xxx",<br/>
286
+ # "r": "True"<br/>
287
+ # },<br/>
288
+ # "ReviewerResultTags": {<br/>
289
+ # "a": "False",<br/>
290
+ # "r": "True"<br/>
291
+ # }<br/>
292
+ # }<br/>
293
+ #
294
+ # </p>.
295
+ #
296
+ # @param url_content_type [String] The content type.
297
+ # @param team_name [String] Your team name.
298
+ # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
299
+ # reviews API
300
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
301
+ # review to.
302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
303
+ # will be added to the HTTP request.
304
+ #
305
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
306
+ #
307
+ def create_reviews_with_http_info(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
308
+ create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
309
+ end
310
+
311
+ #
312
+ # The reviews created would show up for Reviewers on your team. As Reviewers
313
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
314
+ # the specified CallBackEndpoint.
315
+ #
316
+ # <h3>CallBack Schemas </h3>
317
+ # <h4>Review Completion CallBack Sample</h4>
318
+ # <p>
319
+ # {<br/>
320
+ # "ReviewId": "<Review Id>",<br/>
321
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
322
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
323
+ # "CallBackType": "Review",<br/>
324
+ # "ContentId": "<The ContentId that was specified input>",<br/>
325
+ # "Metadata": {<br/>
326
+ # "adultscore": "0.xxx",<br/>
327
+ # "a": "False",<br/>
328
+ # "racyscore": "0.xxx",<br/>
329
+ # "r": "True"<br/>
330
+ # },<br/>
331
+ # "ReviewerResultTags": {<br/>
332
+ # "a": "False",<br/>
333
+ # "r": "True"<br/>
334
+ # }<br/>
335
+ # }<br/>
336
+ #
337
+ # </p>.
338
+ #
339
+ # @param url_content_type [String] The content type.
340
+ # @param team_name [String] Your team name.
341
+ # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
342
+ # reviews API
343
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
344
+ # review to.
345
+ # @param [Hash{String => String}] A hash of custom headers that will be added
346
+ # to the HTTP request.
347
+ #
348
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
349
+ #
350
+ def create_reviews_async(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
351
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
352
+ fail ArgumentError, 'url_content_type is nil' if url_content_type.nil?
353
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
354
+ fail ArgumentError, 'create_review_body is nil' if create_review_body.nil?
355
+
356
+
357
+ request_headers = {}
358
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
359
+
360
+ # Set Headers
361
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
362
+ request_headers['UrlContentType'] = url_content_type unless url_content_type.nil?
363
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
364
+
365
+ # Serialize Request
366
+ request_mapper = {
367
+ client_side_validation: true,
368
+ required: true,
369
+ serialized_name: 'createReviewBody',
370
+ type: {
371
+ name: 'Sequence',
372
+ element: {
373
+ client_side_validation: true,
374
+ required: false,
375
+ serialized_name: 'CreateReviewBodyItemElementType',
376
+ type: {
377
+ name: 'Composite',
378
+ class_name: 'CreateReviewBodyItem'
379
+ }
380
+ }
381
+ }
382
+ }
383
+ request_content = @client.serialize(request_mapper, create_review_body)
384
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
385
+
386
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews'
387
+
388
+ request_url = @base_url || @client.base_url
389
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
390
+
391
+ options = {
392
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
393
+ path_params: {'teamName' => team_name},
394
+ query_params: {'subTeam' => sub_team},
395
+ body: request_content,
396
+ headers: request_headers.merge(custom_headers || {}),
397
+ base_url: request_url
398
+ }
399
+ promise = @client.make_request_async(:post, path_template, options)
400
+
401
+ promise = promise.then do |result|
402
+ http_response = result.response
403
+ status_code = http_response.status
404
+ response_content = http_response.body
405
+ unless status_code == 200
406
+ error_model = JSON.load(response_content)
407
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
408
+ end
409
+
410
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
411
+ # Deserialize Response
412
+ if status_code == 200
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = {
416
+ client_side_validation: true,
417
+ required: false,
418
+ serialized_name: 'parsed_response',
419
+ type: {
420
+ name: 'Sequence',
421
+ element: {
422
+ client_side_validation: true,
423
+ required: false,
424
+ serialized_name: 'StringElementType',
425
+ type: {
426
+ name: 'String'
427
+ }
428
+ }
429
+ }
430
+ }
431
+ result.body = @client.deserialize(result_mapper, parsed_response)
432
+ rescue Exception => e
433
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
434
+ end
435
+ end
436
+
437
+ result
438
+ end
439
+
440
+ promise.execute
441
+ end
442
+
443
+ #
444
+ # A job Id will be returned for the content posted on this endpoint.
445
+ #
446
+ # Once the content is evaluated against the Workflow provided the review will
447
+ # be created or ignored based on the workflow expression.
448
+ #
449
+ # <h3>CallBack Schemas </h3>
450
+ #
451
+ # <p>
452
+ # <h4>Job Completion CallBack Sample</h4><br/>
453
+ #
454
+ # {<br/>
455
+ # "JobId": "<Job Id>,<br/>
456
+ # "ReviewId": "<Review Id, if the Job resulted in a Review to be
457
+ # created>",<br/>
458
+ # "WorkFlowId": "default",<br/>
459
+ # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
460
+ # "ContentType": "Image",<br/>
461
+ # "ContentId": "<This is the ContentId that was specified on input>",<br/>
462
+ # "CallBackType": "Job",<br/>
463
+ # "Metadata": {<br/>
464
+ # "adultscore": "0.xxx",<br/>
465
+ # "a": "False",<br/>
466
+ # "racyscore": "0.xxx",<br/>
467
+ # "r": "True"<br/>
468
+ # }<br/>
469
+ # }<br/>
470
+ #
471
+ # </p>
472
+ # <p>
473
+ # <h4>Review Completion CallBack Sample</h4><br/>
474
+ #
475
+ # {
476
+ # "ReviewId": "<Review Id>",<br/>
477
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
478
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
479
+ # "CallBackType": "Review",<br/>
480
+ # "ContentId": "<The ContentId that was specified input>",<br/>
481
+ # "Metadata": {<br/>
482
+ # "adultscore": "0.xxx",
483
+ # "a": "False",<br/>
484
+ # "racyscore": "0.xxx",<br/>
485
+ # "r": "True"<br/>
486
+ # },<br/>
487
+ # "ReviewerResultTags": {<br/>
488
+ # "a": "False",<br/>
489
+ # "r": "True"<br/>
490
+ # }<br/>
491
+ # }<br/>
492
+ #
493
+ # </p>.
494
+ #
495
+ # @param team_name [String] Your team name.
496
+ # @param content_type [Enum] Image, Text or Video. Possible values include:
497
+ # 'Image', 'Text', 'Video'
498
+ # @param content_id [String] Id/Name to identify the content submitted.
499
+ # @param workflow_name [String] Workflow Name that you want to invoke.
500
+ # @param job_content_type [Enum] The content type. Possible values include:
501
+ # 'application/json', 'image/jpeg'
502
+ # @param content [Content] Content to evaluate.
503
+ # @param call_back_endpoint [String] Callback endpoint for posting the create
504
+ # job result.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [JobId] operation results.
509
+ #
510
+ def create_job(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
511
+ response = create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
512
+ response.body unless response.nil?
513
+ end
514
+
515
+ #
516
+ # A job Id will be returned for the content posted on this endpoint.
517
+ #
518
+ # Once the content is evaluated against the Workflow provided the review will
519
+ # be created or ignored based on the workflow expression.
520
+ #
521
+ # <h3>CallBack Schemas </h3>
522
+ #
523
+ # <p>
524
+ # <h4>Job Completion CallBack Sample</h4><br/>
525
+ #
526
+ # {<br/>
527
+ # "JobId": "<Job Id>,<br/>
528
+ # "ReviewId": "<Review Id, if the Job resulted in a Review to be
529
+ # created>",<br/>
530
+ # "WorkFlowId": "default",<br/>
531
+ # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
532
+ # "ContentType": "Image",<br/>
533
+ # "ContentId": "<This is the ContentId that was specified on input>",<br/>
534
+ # "CallBackType": "Job",<br/>
535
+ # "Metadata": {<br/>
536
+ # "adultscore": "0.xxx",<br/>
537
+ # "a": "False",<br/>
538
+ # "racyscore": "0.xxx",<br/>
539
+ # "r": "True"<br/>
540
+ # }<br/>
541
+ # }<br/>
542
+ #
543
+ # </p>
544
+ # <p>
545
+ # <h4>Review Completion CallBack Sample</h4><br/>
546
+ #
547
+ # {
548
+ # "ReviewId": "<Review Id>",<br/>
549
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
550
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
551
+ # "CallBackType": "Review",<br/>
552
+ # "ContentId": "<The ContentId that was specified input>",<br/>
553
+ # "Metadata": {<br/>
554
+ # "adultscore": "0.xxx",
555
+ # "a": "False",<br/>
556
+ # "racyscore": "0.xxx",<br/>
557
+ # "r": "True"<br/>
558
+ # },<br/>
559
+ # "ReviewerResultTags": {<br/>
560
+ # "a": "False",<br/>
561
+ # "r": "True"<br/>
562
+ # }<br/>
563
+ # }<br/>
564
+ #
565
+ # </p>.
566
+ #
567
+ # @param team_name [String] Your team name.
568
+ # @param content_type [Enum] Image, Text or Video. Possible values include:
569
+ # 'Image', 'Text', 'Video'
570
+ # @param content_id [String] Id/Name to identify the content submitted.
571
+ # @param workflow_name [String] Workflow Name that you want to invoke.
572
+ # @param job_content_type [Enum] The content type. Possible values include:
573
+ # 'application/json', 'image/jpeg'
574
+ # @param content [Content] Content to evaluate.
575
+ # @param call_back_endpoint [String] Callback endpoint for posting the create
576
+ # job result.
577
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
578
+ # will be added to the HTTP request.
579
+ #
580
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
581
+ #
582
+ def create_job_with_http_info(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
583
+ create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
584
+ end
585
+
586
+ #
587
+ # A job Id will be returned for the content posted on this endpoint.
588
+ #
589
+ # Once the content is evaluated against the Workflow provided the review will
590
+ # be created or ignored based on the workflow expression.
591
+ #
592
+ # <h3>CallBack Schemas </h3>
593
+ #
594
+ # <p>
595
+ # <h4>Job Completion CallBack Sample</h4><br/>
596
+ #
597
+ # {<br/>
598
+ # "JobId": "<Job Id>,<br/>
599
+ # "ReviewId": "<Review Id, if the Job resulted in a Review to be
600
+ # created>",<br/>
601
+ # "WorkFlowId": "default",<br/>
602
+ # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
603
+ # "ContentType": "Image",<br/>
604
+ # "ContentId": "<This is the ContentId that was specified on input>",<br/>
605
+ # "CallBackType": "Job",<br/>
606
+ # "Metadata": {<br/>
607
+ # "adultscore": "0.xxx",<br/>
608
+ # "a": "False",<br/>
609
+ # "racyscore": "0.xxx",<br/>
610
+ # "r": "True"<br/>
611
+ # }<br/>
612
+ # }<br/>
613
+ #
614
+ # </p>
615
+ # <p>
616
+ # <h4>Review Completion CallBack Sample</h4><br/>
617
+ #
618
+ # {
619
+ # "ReviewId": "<Review Id>",<br/>
620
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
621
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
622
+ # "CallBackType": "Review",<br/>
623
+ # "ContentId": "<The ContentId that was specified input>",<br/>
624
+ # "Metadata": {<br/>
625
+ # "adultscore": "0.xxx",
626
+ # "a": "False",<br/>
627
+ # "racyscore": "0.xxx",<br/>
628
+ # "r": "True"<br/>
629
+ # },<br/>
630
+ # "ReviewerResultTags": {<br/>
631
+ # "a": "False",<br/>
632
+ # "r": "True"<br/>
633
+ # }<br/>
634
+ # }<br/>
635
+ #
636
+ # </p>.
637
+ #
638
+ # @param team_name [String] Your team name.
639
+ # @param content_type [Enum] Image, Text or Video. Possible values include:
640
+ # 'Image', 'Text', 'Video'
641
+ # @param content_id [String] Id/Name to identify the content submitted.
642
+ # @param workflow_name [String] Workflow Name that you want to invoke.
643
+ # @param job_content_type [Enum] The content type. Possible values include:
644
+ # 'application/json', 'image/jpeg'
645
+ # @param content [Content] Content to evaluate.
646
+ # @param call_back_endpoint [String] Callback endpoint for posting the create
647
+ # job result.
648
+ # @param [Hash{String => String}] A hash of custom headers that will be added
649
+ # to the HTTP request.
650
+ #
651
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
652
+ #
653
+ def create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
654
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
655
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
656
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
657
+ fail ArgumentError, 'content_id is nil' if content_id.nil?
658
+ fail ArgumentError, 'workflow_name is nil' if workflow_name.nil?
659
+ fail ArgumentError, 'job_content_type is nil' if job_content_type.nil?
660
+ fail ArgumentError, 'content is nil' if content.nil?
661
+
662
+
663
+ request_headers = {}
664
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
665
+
666
+ # Set Headers
667
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
668
+ request_headers['Content-Type'] = job_content_type.to_s unless job_content_type.to_s.nil?
669
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
670
+
671
+ # Serialize Request
672
+ request_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Content.mapper()
673
+ request_content = @client.serialize(request_mapper, content)
674
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
675
+
676
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/jobs'
677
+
678
+ request_url = @base_url || @client.base_url
679
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
680
+
681
+ options = {
682
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
683
+ path_params: {'teamName' => team_name},
684
+ query_params: {'ContentType' => content_type,'ContentId' => content_id,'WorkflowName' => workflow_name,'CallBackEndpoint' => call_back_endpoint},
685
+ body: request_content,
686
+ headers: request_headers.merge(custom_headers || {}),
687
+ base_url: request_url
688
+ }
689
+ promise = @client.make_request_async(:post, path_template, options)
690
+
691
+ promise = promise.then do |result|
692
+ http_response = result.response
693
+ status_code = http_response.status
694
+ response_content = http_response.body
695
+ unless status_code == 200
696
+ error_model = JSON.load(response_content)
697
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
698
+ end
699
+
700
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
701
+ # Deserialize Response
702
+ if status_code == 200
703
+ begin
704
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
705
+ result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::JobId.mapper()
706
+ result.body = @client.deserialize(result_mapper, parsed_response)
707
+ rescue Exception => e
708
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
709
+ end
710
+ end
711
+
712
+ result
713
+ end
714
+
715
+ promise.execute
716
+ end
717
+
718
+ #
719
+ # The reviews created would show up for Reviewers on your team. As Reviewers
720
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
721
+ # the specified CallBackEndpoint.
722
+ #
723
+ # <h3>CallBack Schemas </h3>
724
+ # <h4>Review Completion CallBack Sample</h4>
725
+ # <p>
726
+ # {<br/>
727
+ # "ReviewId": "<Review Id>",<br/>
728
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
729
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
730
+ # "CallBackType": "Review",<br/>
731
+ # "ContentId": "<The ContentId that was specified input>",<br/>
732
+ # "Metadata": {<br/>
733
+ # "adultscore": "0.xxx",<br/>
734
+ # "a": "False",<br/>
735
+ # "racyscore": "0.xxx",<br/>
736
+ # "r": "True"<br/>
737
+ # },<br/>
738
+ # "ReviewerResultTags": {<br/>
739
+ # "a": "False",<br/>
740
+ # "r": "True"<br/>
741
+ # }<br/>
742
+ # }<br/>
743
+ #
744
+ # </p>.
745
+ #
746
+ # @param team_name [String] Your team name.
747
+ # @param review_id [String] Id of the review.
748
+ # @param timescale [Integer] Timescale of the video you are adding frames to.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ #
753
+ def add_video_frame(team_name, review_id, timescale:nil, custom_headers:nil)
754
+ response = add_video_frame_async(team_name, review_id, timescale:timescale, custom_headers:custom_headers).value!
755
+ nil
756
+ end
757
+
758
+ #
759
+ # The reviews created would show up for Reviewers on your team. As Reviewers
760
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
761
+ # the specified CallBackEndpoint.
762
+ #
763
+ # <h3>CallBack Schemas </h3>
764
+ # <h4>Review Completion CallBack Sample</h4>
765
+ # <p>
766
+ # {<br/>
767
+ # "ReviewId": "<Review Id>",<br/>
768
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
769
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
770
+ # "CallBackType": "Review",<br/>
771
+ # "ContentId": "<The ContentId that was specified input>",<br/>
772
+ # "Metadata": {<br/>
773
+ # "adultscore": "0.xxx",<br/>
774
+ # "a": "False",<br/>
775
+ # "racyscore": "0.xxx",<br/>
776
+ # "r": "True"<br/>
777
+ # },<br/>
778
+ # "ReviewerResultTags": {<br/>
779
+ # "a": "False",<br/>
780
+ # "r": "True"<br/>
781
+ # }<br/>
782
+ # }<br/>
783
+ #
784
+ # </p>.
785
+ #
786
+ # @param team_name [String] Your team name.
787
+ # @param review_id [String] Id of the review.
788
+ # @param timescale [Integer] Timescale of the video you are adding frames to.
789
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
790
+ # will be added to the HTTP request.
791
+ #
792
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
793
+ #
794
+ def add_video_frame_with_http_info(team_name, review_id, timescale:nil, custom_headers:nil)
795
+ add_video_frame_async(team_name, review_id, timescale:timescale, custom_headers:custom_headers).value!
796
+ end
797
+
798
+ #
799
+ # The reviews created would show up for Reviewers on your team. As Reviewers
800
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
801
+ # the specified CallBackEndpoint.
802
+ #
803
+ # <h3>CallBack Schemas </h3>
804
+ # <h4>Review Completion CallBack Sample</h4>
805
+ # <p>
806
+ # {<br/>
807
+ # "ReviewId": "<Review Id>",<br/>
808
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
809
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
810
+ # "CallBackType": "Review",<br/>
811
+ # "ContentId": "<The ContentId that was specified input>",<br/>
812
+ # "Metadata": {<br/>
813
+ # "adultscore": "0.xxx",<br/>
814
+ # "a": "False",<br/>
815
+ # "racyscore": "0.xxx",<br/>
816
+ # "r": "True"<br/>
817
+ # },<br/>
818
+ # "ReviewerResultTags": {<br/>
819
+ # "a": "False",<br/>
820
+ # "r": "True"<br/>
821
+ # }<br/>
822
+ # }<br/>
823
+ #
824
+ # </p>.
825
+ #
826
+ # @param team_name [String] Your team name.
827
+ # @param review_id [String] Id of the review.
828
+ # @param timescale [Integer] Timescale of the video you are adding frames to.
829
+ # @param [Hash{String => String}] A hash of custom headers that will be added
830
+ # to the HTTP request.
831
+ #
832
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
833
+ #
834
+ def add_video_frame_async(team_name, review_id, timescale:nil, custom_headers:nil)
835
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
836
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
837
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
838
+
839
+
840
+ request_headers = {}
841
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
842
+
843
+ # Set Headers
844
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
845
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
846
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'
847
+
848
+ request_url = @base_url || @client.base_url
849
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
850
+
851
+ options = {
852
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
853
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
854
+ query_params: {'timescale' => timescale},
855
+ headers: request_headers.merge(custom_headers || {}),
856
+ base_url: request_url
857
+ }
858
+ promise = @client.make_request_async(:post, path_template, options)
859
+
860
+ promise = promise.then do |result|
861
+ http_response = result.response
862
+ status_code = http_response.status
863
+ response_content = http_response.body
864
+ unless status_code == 200
865
+ error_model = JSON.load(response_content)
866
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
867
+ end
868
+
869
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
870
+
871
+ result
872
+ end
873
+
874
+ promise.execute
875
+ end
876
+
877
+ #
878
+ # The reviews created would show up for Reviewers on your team. As Reviewers
879
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
880
+ # the specified CallBackEndpoint.
881
+ #
882
+ # <h3>CallBack Schemas </h3>
883
+ # <h4>Review Completion CallBack Sample</h4>
884
+ # <p>
885
+ # {<br/>
886
+ # "ReviewId": "<Review Id>",<br/>
887
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
888
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
889
+ # "CallBackType": "Review",<br/>
890
+ # "ContentId": "<The ContentId that was specified input>",<br/>
891
+ # "Metadata": {<br/>
892
+ # "adultscore": "0.xxx",<br/>
893
+ # "a": "False",<br/>
894
+ # "racyscore": "0.xxx",<br/>
895
+ # "r": "True"<br/>
896
+ # },<br/>
897
+ # "ReviewerResultTags": {<br/>
898
+ # "a": "False",<br/>
899
+ # "r": "True"<br/>
900
+ # }<br/>
901
+ # }<br/>
902
+ #
903
+ # </p>.
904
+ #
905
+ # @param team_name [String] Your team name.
906
+ # @param review_id [String] Id of the review.
907
+ # @param start_seed [Integer] Time stamp of the frame from where you want to
908
+ # start fetching the frames.
909
+ # @param no_of_records [Integer] Number of frames to fetch.
910
+ # @param filter [String] Get frames filtered by tags.
911
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
912
+ # will be added to the HTTP request.
913
+ #
914
+ # @return [Frames] operation results.
915
+ #
916
+ def get_video_frames(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
917
+ response = get_video_frames_async(team_name, review_id, start_seed:start_seed, no_of_records:no_of_records, filter:filter, custom_headers:custom_headers).value!
918
+ response.body unless response.nil?
919
+ end
920
+
921
+ #
922
+ # The reviews created would show up for Reviewers on your team. As Reviewers
923
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
924
+ # the specified CallBackEndpoint.
925
+ #
926
+ # <h3>CallBack Schemas </h3>
927
+ # <h4>Review Completion CallBack Sample</h4>
928
+ # <p>
929
+ # {<br/>
930
+ # "ReviewId": "<Review Id>",<br/>
931
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
932
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
933
+ # "CallBackType": "Review",<br/>
934
+ # "ContentId": "<The ContentId that was specified input>",<br/>
935
+ # "Metadata": {<br/>
936
+ # "adultscore": "0.xxx",<br/>
937
+ # "a": "False",<br/>
938
+ # "racyscore": "0.xxx",<br/>
939
+ # "r": "True"<br/>
940
+ # },<br/>
941
+ # "ReviewerResultTags": {<br/>
942
+ # "a": "False",<br/>
943
+ # "r": "True"<br/>
944
+ # }<br/>
945
+ # }<br/>
946
+ #
947
+ # </p>.
948
+ #
949
+ # @param team_name [String] Your team name.
950
+ # @param review_id [String] Id of the review.
951
+ # @param start_seed [Integer] Time stamp of the frame from where you want to
952
+ # start fetching the frames.
953
+ # @param no_of_records [Integer] Number of frames to fetch.
954
+ # @param filter [String] Get frames filtered by tags.
955
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
956
+ # will be added to the HTTP request.
957
+ #
958
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
959
+ #
960
+ def get_video_frames_with_http_info(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
961
+ get_video_frames_async(team_name, review_id, start_seed:start_seed, no_of_records:no_of_records, filter:filter, custom_headers:custom_headers).value!
962
+ end
963
+
964
+ #
965
+ # The reviews created would show up for Reviewers on your team. As Reviewers
966
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
967
+ # the specified CallBackEndpoint.
968
+ #
969
+ # <h3>CallBack Schemas </h3>
970
+ # <h4>Review Completion CallBack Sample</h4>
971
+ # <p>
972
+ # {<br/>
973
+ # "ReviewId": "<Review Id>",<br/>
974
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
975
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
976
+ # "CallBackType": "Review",<br/>
977
+ # "ContentId": "<The ContentId that was specified input>",<br/>
978
+ # "Metadata": {<br/>
979
+ # "adultscore": "0.xxx",<br/>
980
+ # "a": "False",<br/>
981
+ # "racyscore": "0.xxx",<br/>
982
+ # "r": "True"<br/>
983
+ # },<br/>
984
+ # "ReviewerResultTags": {<br/>
985
+ # "a": "False",<br/>
986
+ # "r": "True"<br/>
987
+ # }<br/>
988
+ # }<br/>
989
+ #
990
+ # </p>.
991
+ #
992
+ # @param team_name [String] Your team name.
993
+ # @param review_id [String] Id of the review.
994
+ # @param start_seed [Integer] Time stamp of the frame from where you want to
995
+ # start fetching the frames.
996
+ # @param no_of_records [Integer] Number of frames to fetch.
997
+ # @param filter [String] Get frames filtered by tags.
998
+ # @param [Hash{String => String}] A hash of custom headers that will be added
999
+ # to the HTTP request.
1000
+ #
1001
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1002
+ #
1003
+ def get_video_frames_async(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
1004
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1005
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1006
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1007
+
1008
+
1009
+ request_headers = {}
1010
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1011
+
1012
+ # Set Headers
1013
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1014
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1015
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'
1016
+
1017
+ request_url = @base_url || @client.base_url
1018
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1019
+
1020
+ options = {
1021
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1022
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1023
+ query_params: {'startSeed' => start_seed,'noOfRecords' => no_of_records,'filter' => filter},
1024
+ headers: request_headers.merge(custom_headers || {}),
1025
+ base_url: request_url
1026
+ }
1027
+ promise = @client.make_request_async(:get, path_template, options)
1028
+
1029
+ promise = promise.then do |result|
1030
+ http_response = result.response
1031
+ status_code = http_response.status
1032
+ response_content = http_response.body
1033
+ unless status_code == 200
1034
+ error_model = JSON.load(response_content)
1035
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1036
+ end
1037
+
1038
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1039
+ # Deserialize Response
1040
+ if status_code == 200
1041
+ begin
1042
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1043
+ result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Frames.mapper()
1044
+ result.body = @client.deserialize(result_mapper, parsed_response)
1045
+ rescue Exception => e
1046
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1047
+ end
1048
+ end
1049
+
1050
+ result
1051
+ end
1052
+
1053
+ promise.execute
1054
+ end
1055
+
1056
+ #
1057
+ # Publish video review to make it available for review.
1058
+ #
1059
+ # @param team_name [String] Your team name.
1060
+ # @param review_id [String] Id of the review.
1061
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1062
+ # will be added to the HTTP request.
1063
+ #
1064
+ #
1065
+ def publish_video_review(team_name, review_id, custom_headers:nil)
1066
+ response = publish_video_review_async(team_name, review_id, custom_headers:custom_headers).value!
1067
+ nil
1068
+ end
1069
+
1070
+ #
1071
+ # Publish video review to make it available for review.
1072
+ #
1073
+ # @param team_name [String] Your team name.
1074
+ # @param review_id [String] Id of the review.
1075
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1076
+ # will be added to the HTTP request.
1077
+ #
1078
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1079
+ #
1080
+ def publish_video_review_with_http_info(team_name, review_id, custom_headers:nil)
1081
+ publish_video_review_async(team_name, review_id, custom_headers:custom_headers).value!
1082
+ end
1083
+
1084
+ #
1085
+ # Publish video review to make it available for review.
1086
+ #
1087
+ # @param team_name [String] Your team name.
1088
+ # @param review_id [String] Id of the review.
1089
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1090
+ # to the HTTP request.
1091
+ #
1092
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1093
+ #
1094
+ def publish_video_review_async(team_name, review_id, custom_headers:nil)
1095
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1096
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1097
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1098
+
1099
+
1100
+ request_headers = {}
1101
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1102
+
1103
+ # Set Headers
1104
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1105
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1106
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/publish'
1107
+
1108
+ request_url = @base_url || @client.base_url
1109
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1110
+
1111
+ options = {
1112
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1113
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1114
+ headers: request_headers.merge(custom_headers || {}),
1115
+ base_url: request_url
1116
+ }
1117
+ promise = @client.make_request_async(:post, path_template, options)
1118
+
1119
+ promise = promise.then do |result|
1120
+ http_response = result.response
1121
+ status_code = http_response.status
1122
+ response_content = http_response.body
1123
+ unless status_code == 204
1124
+ error_model = JSON.load(response_content)
1125
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1126
+ end
1127
+
1128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1129
+
1130
+ result
1131
+ end
1132
+
1133
+ promise.execute
1134
+ end
1135
+
1136
+ #
1137
+ # This API adds a transcript screen text result file for a video review.
1138
+ # Transcript screen text result file is a result of Screen Text API . In order
1139
+ # to generate transcript screen text result file , a transcript file has to be
1140
+ # screened for profanity using Screen Text API.
1141
+ #
1142
+ # @param content_type [String] The content type.
1143
+ # @param team_name [String] Your team name.
1144
+ # @param review_id [String] Id of the review.
1145
+ # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
1146
+ # for add video transcript moderation result API
1147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1148
+ # will be added to the HTTP request.
1149
+ #
1150
+ #
1151
+ def add_video_transcript_moderation_result(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
1152
+ response = add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:custom_headers).value!
1153
+ nil
1154
+ end
1155
+
1156
+ #
1157
+ # This API adds a transcript screen text result file for a video review.
1158
+ # Transcript screen text result file is a result of Screen Text API . In order
1159
+ # to generate transcript screen text result file , a transcript file has to be
1160
+ # screened for profanity using Screen Text API.
1161
+ #
1162
+ # @param content_type [String] The content type.
1163
+ # @param team_name [String] Your team name.
1164
+ # @param review_id [String] Id of the review.
1165
+ # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
1166
+ # for add video transcript moderation result API
1167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1168
+ # will be added to the HTTP request.
1169
+ #
1170
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1171
+ #
1172
+ def add_video_transcript_moderation_result_with_http_info(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
1173
+ add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:custom_headers).value!
1174
+ end
1175
+
1176
+ #
1177
+ # This API adds a transcript screen text result file for a video review.
1178
+ # Transcript screen text result file is a result of Screen Text API . In order
1179
+ # to generate transcript screen text result file , a transcript file has to be
1180
+ # screened for profanity using Screen Text API.
1181
+ #
1182
+ # @param content_type [String] The content type.
1183
+ # @param team_name [String] Your team name.
1184
+ # @param review_id [String] Id of the review.
1185
+ # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
1186
+ # for add video transcript moderation result API
1187
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1188
+ # to the HTTP request.
1189
+ #
1190
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1191
+ #
1192
+ def add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
1193
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1194
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
1195
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1196
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1197
+ fail ArgumentError, 'transcript_moderation_body is nil' if transcript_moderation_body.nil?
1198
+
1199
+
1200
+ request_headers = {}
1201
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1202
+
1203
+ # Set Headers
1204
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1205
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1206
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1207
+
1208
+ # Serialize Request
1209
+ request_mapper = {
1210
+ client_side_validation: true,
1211
+ required: true,
1212
+ serialized_name: 'transcriptModerationBody',
1213
+ type: {
1214
+ name: 'Sequence',
1215
+ element: {
1216
+ client_side_validation: true,
1217
+ required: false,
1218
+ serialized_name: 'TranscriptModerationBodyItemElementType',
1219
+ type: {
1220
+ name: 'Composite',
1221
+ class_name: 'TranscriptModerationBodyItem'
1222
+ }
1223
+ }
1224
+ }
1225
+ }
1226
+ request_content = @client.serialize(request_mapper, transcript_moderation_body)
1227
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1228
+
1229
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult'
1230
+
1231
+ request_url = @base_url || @client.base_url
1232
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1233
+
1234
+ options = {
1235
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1236
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1237
+ body: request_content,
1238
+ headers: request_headers.merge(custom_headers || {}),
1239
+ base_url: request_url
1240
+ }
1241
+ promise = @client.make_request_async(:put, path_template, options)
1242
+
1243
+ promise = promise.then do |result|
1244
+ http_response = result.response
1245
+ status_code = http_response.status
1246
+ response_content = http_response.body
1247
+ unless status_code == 204
1248
+ error_model = JSON.load(response_content)
1249
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1250
+ end
1251
+
1252
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1253
+
1254
+ result
1255
+ end
1256
+
1257
+ promise.execute
1258
+ end
1259
+
1260
+ #
1261
+ # This API adds a transcript file (text version of all the words spoken in a
1262
+ # video) to a video review. The file should be a valid WebVTT format.
1263
+ #
1264
+ # @param team_name [String] Your team name.
1265
+ # @param review_id [String] Id of the review.
1266
+ # @param vttfile Transcript file of the video.
1267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1268
+ # will be added to the HTTP request.
1269
+ #
1270
+ #
1271
+ def add_video_transcript(team_name, review_id, vttfile, custom_headers:nil)
1272
+ response = add_video_transcript_async(team_name, review_id, vttfile, custom_headers:custom_headers).value!
1273
+ nil
1274
+ end
1275
+
1276
+ #
1277
+ # This API adds a transcript file (text version of all the words spoken in a
1278
+ # video) to a video review. The file should be a valid WebVTT format.
1279
+ #
1280
+ # @param team_name [String] Your team name.
1281
+ # @param review_id [String] Id of the review.
1282
+ # @param vttfile Transcript file of the video.
1283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1284
+ # will be added to the HTTP request.
1285
+ #
1286
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1287
+ #
1288
+ def add_video_transcript_with_http_info(team_name, review_id, vttfile, custom_headers:nil)
1289
+ add_video_transcript_async(team_name, review_id, vttfile, custom_headers:custom_headers).value!
1290
+ end
1291
+
1292
+ #
1293
+ # This API adds a transcript file (text version of all the words spoken in a
1294
+ # video) to a video review. The file should be a valid WebVTT format.
1295
+ #
1296
+ # @param team_name [String] Your team name.
1297
+ # @param review_id [String] Id of the review.
1298
+ # @param vttfile Transcript file of the video.
1299
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1300
+ # to the HTTP request.
1301
+ #
1302
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1303
+ #
1304
+ def add_video_transcript_async(team_name, review_id, vttfile, custom_headers:nil)
1305
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1306
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1307
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1308
+ content_type = 'text/plain'
1309
+ fail ArgumentError, 'vttfile is nil' if vttfile.nil?
1310
+
1311
+
1312
+ request_headers = {}
1313
+ request_headers['Content-Type'] = 'text/plain'
1314
+
1315
+ # Set Headers
1316
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1317
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1318
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1319
+
1320
+ # Serialize Request
1321
+ request_mapper = {
1322
+ client_side_validation: true,
1323
+ required: true,
1324
+ serialized_name: 'VTT file',
1325
+ type: {
1326
+ name: 'Stream'
1327
+ }
1328
+ }
1329
+ request_content = @client.serialize(request_mapper, vttfile)
1330
+
1331
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript'
1332
+
1333
+ request_url = @base_url || @client.base_url
1334
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1335
+
1336
+ options = {
1337
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1338
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1339
+ body: request_content,
1340
+ headers: request_headers.merge(custom_headers || {}),
1341
+ base_url: request_url
1342
+ }
1343
+ promise = @client.make_request_async(:put, path_template, options)
1344
+
1345
+ promise = promise.then do |result|
1346
+ http_response = result.response
1347
+ status_code = http_response.status
1348
+ response_content = http_response.body
1349
+ unless status_code == 204
1350
+ error_model = JSON.load(response_content)
1351
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1352
+ end
1353
+
1354
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1355
+
1356
+ result
1357
+ end
1358
+
1359
+ promise.execute
1360
+ end
1361
+
1362
+ #
1363
+ # The reviews created would show up for Reviewers on your team. As Reviewers
1364
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
1365
+ # the specified CallBackEndpoint.
1366
+ #
1367
+ # <h3>CallBack Schemas </h3>
1368
+ # <h4>Review Completion CallBack Sample</h4>
1369
+ # <p>
1370
+ # {<br/>
1371
+ # "ReviewId": "<Review Id>",<br/>
1372
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
1373
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
1374
+ # "CallBackType": "Review",<br/>
1375
+ # "ContentId": "<The ContentId that was specified input>",<br/>
1376
+ # "Metadata": {<br/>
1377
+ # "adultscore": "0.xxx",<br/>
1378
+ # "a": "False",<br/>
1379
+ # "racyscore": "0.xxx",<br/>
1380
+ # "r": "True"<br/>
1381
+ # },<br/>
1382
+ # "ReviewerResultTags": {<br/>
1383
+ # "a": "False",<br/>
1384
+ # "r": "True"<br/>
1385
+ # }<br/>
1386
+ # }<br/>
1387
+ #
1388
+ # </p>.
1389
+ #
1390
+ # @param content_type [String] The content type.
1391
+ # @param team_name [String] Your team name.
1392
+ # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
1393
+ # create reviews API
1394
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
1395
+ # review to.
1396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1397
+ # will be added to the HTTP request.
1398
+ #
1399
+ # @return [Array] operation results.
1400
+ #
1401
+ def create_video_reviews(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
1402
+ response = create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:sub_team, custom_headers:custom_headers).value!
1403
+ response.body unless response.nil?
1404
+ end
1405
+
1406
+ #
1407
+ # The reviews created would show up for Reviewers on your team. As Reviewers
1408
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
1409
+ # the specified CallBackEndpoint.
1410
+ #
1411
+ # <h3>CallBack Schemas </h3>
1412
+ # <h4>Review Completion CallBack Sample</h4>
1413
+ # <p>
1414
+ # {<br/>
1415
+ # "ReviewId": "<Review Id>",<br/>
1416
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
1417
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
1418
+ # "CallBackType": "Review",<br/>
1419
+ # "ContentId": "<The ContentId that was specified input>",<br/>
1420
+ # "Metadata": {<br/>
1421
+ # "adultscore": "0.xxx",<br/>
1422
+ # "a": "False",<br/>
1423
+ # "racyscore": "0.xxx",<br/>
1424
+ # "r": "True"<br/>
1425
+ # },<br/>
1426
+ # "ReviewerResultTags": {<br/>
1427
+ # "a": "False",<br/>
1428
+ # "r": "True"<br/>
1429
+ # }<br/>
1430
+ # }<br/>
1431
+ #
1432
+ # </p>.
1433
+ #
1434
+ # @param content_type [String] The content type.
1435
+ # @param team_name [String] Your team name.
1436
+ # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
1437
+ # create reviews API
1438
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
1439
+ # review to.
1440
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1441
+ # will be added to the HTTP request.
1442
+ #
1443
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1444
+ #
1445
+ def create_video_reviews_with_http_info(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
1446
+ create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:sub_team, custom_headers:custom_headers).value!
1447
+ end
1448
+
1449
+ #
1450
+ # The reviews created would show up for Reviewers on your team. As Reviewers
1451
+ # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
1452
+ # the specified CallBackEndpoint.
1453
+ #
1454
+ # <h3>CallBack Schemas </h3>
1455
+ # <h4>Review Completion CallBack Sample</h4>
1456
+ # <p>
1457
+ # {<br/>
1458
+ # "ReviewId": "<Review Id>",<br/>
1459
+ # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
1460
+ # "ModifiedBy": "<Name of the Reviewer>",<br/>
1461
+ # "CallBackType": "Review",<br/>
1462
+ # "ContentId": "<The ContentId that was specified input>",<br/>
1463
+ # "Metadata": {<br/>
1464
+ # "adultscore": "0.xxx",<br/>
1465
+ # "a": "False",<br/>
1466
+ # "racyscore": "0.xxx",<br/>
1467
+ # "r": "True"<br/>
1468
+ # },<br/>
1469
+ # "ReviewerResultTags": {<br/>
1470
+ # "a": "False",<br/>
1471
+ # "r": "True"<br/>
1472
+ # }<br/>
1473
+ # }<br/>
1474
+ #
1475
+ # </p>.
1476
+ #
1477
+ # @param content_type [String] The content type.
1478
+ # @param team_name [String] Your team name.
1479
+ # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
1480
+ # create reviews API
1481
+ # @param sub_team [String] SubTeam of your team, you want to assign the created
1482
+ # review to.
1483
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1484
+ # to the HTTP request.
1485
+ #
1486
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1487
+ #
1488
+ def create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
1489
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1490
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
1491
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1492
+ fail ArgumentError, 'create_video_reviews_body is nil' if create_video_reviews_body.nil?
1493
+
1494
+
1495
+ request_headers = {}
1496
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1497
+
1498
+ # Set Headers
1499
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1500
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1501
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1502
+
1503
+ # Serialize Request
1504
+ request_mapper = {
1505
+ client_side_validation: true,
1506
+ required: true,
1507
+ serialized_name: 'CreateVideoReviewsBody',
1508
+ type: {
1509
+ name: 'Sequence',
1510
+ element: {
1511
+ client_side_validation: true,
1512
+ required: false,
1513
+ serialized_name: 'CreateVideoReviewsBodyItemElementType',
1514
+ type: {
1515
+ name: 'Composite',
1516
+ class_name: 'CreateVideoReviewsBodyItem'
1517
+ }
1518
+ }
1519
+ }
1520
+ }
1521
+ request_content = @client.serialize(request_mapper, create_video_reviews_body)
1522
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1523
+
1524
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews'
1525
+
1526
+ request_url = @base_url || @client.base_url
1527
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1528
+
1529
+ options = {
1530
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1531
+ path_params: {'teamName' => team_name},
1532
+ query_params: {'subTeam' => sub_team},
1533
+ body: request_content,
1534
+ headers: request_headers.merge(custom_headers || {}),
1535
+ base_url: request_url
1536
+ }
1537
+ promise = @client.make_request_async(:post, path_template, options)
1538
+
1539
+ promise = promise.then do |result|
1540
+ http_response = result.response
1541
+ status_code = http_response.status
1542
+ response_content = http_response.body
1543
+ unless status_code == 200
1544
+ error_model = JSON.load(response_content)
1545
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1546
+ end
1547
+
1548
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1549
+ # Deserialize Response
1550
+ if status_code == 200
1551
+ begin
1552
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1553
+ result_mapper = {
1554
+ client_side_validation: true,
1555
+ required: false,
1556
+ serialized_name: 'parsed_response',
1557
+ type: {
1558
+ name: 'Sequence',
1559
+ element: {
1560
+ client_side_validation: true,
1561
+ required: false,
1562
+ serialized_name: 'StringElementType',
1563
+ type: {
1564
+ name: 'String'
1565
+ }
1566
+ }
1567
+ }
1568
+ }
1569
+ result.body = @client.deserialize(result_mapper, parsed_response)
1570
+ rescue Exception => e
1571
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1572
+ end
1573
+ end
1574
+
1575
+ result
1576
+ end
1577
+
1578
+ promise.execute
1579
+ end
1580
+
1581
+ #
1582
+ # Use this method to add frames for a video review.Timescale: This parameter is
1583
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1584
+ # Timescale is provided in the output of the Content Moderator video media
1585
+ # processor on the Azure Media Services platform.Timescale in the Video
1586
+ # Moderation output is Ticks/Second.
1587
+ #
1588
+ # @param content_type [String] The content type.
1589
+ # @param team_name [String] Your team name.
1590
+ # @param review_id [String] Id of the review.
1591
+ # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
1592
+ # API
1593
+ # @param timescale [Integer] Timescale of the video.
1594
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1595
+ # will be added to the HTTP request.
1596
+ #
1597
+ #
1598
+ def add_video_frame_url(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
1599
+ response = add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:timescale, custom_headers:custom_headers).value!
1600
+ nil
1601
+ end
1602
+
1603
+ #
1604
+ # Use this method to add frames for a video review.Timescale: This parameter is
1605
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1606
+ # Timescale is provided in the output of the Content Moderator video media
1607
+ # processor on the Azure Media Services platform.Timescale in the Video
1608
+ # Moderation output is Ticks/Second.
1609
+ #
1610
+ # @param content_type [String] The content type.
1611
+ # @param team_name [String] Your team name.
1612
+ # @param review_id [String] Id of the review.
1613
+ # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
1614
+ # API
1615
+ # @param timescale [Integer] Timescale of the video.
1616
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1617
+ # will be added to the HTTP request.
1618
+ #
1619
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1620
+ #
1621
+ def add_video_frame_url_with_http_info(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
1622
+ add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:timescale, custom_headers:custom_headers).value!
1623
+ end
1624
+
1625
+ #
1626
+ # Use this method to add frames for a video review.Timescale: This parameter is
1627
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1628
+ # Timescale is provided in the output of the Content Moderator video media
1629
+ # processor on the Azure Media Services platform.Timescale in the Video
1630
+ # Moderation output is Ticks/Second.
1631
+ #
1632
+ # @param content_type [String] The content type.
1633
+ # @param team_name [String] Your team name.
1634
+ # @param review_id [String] Id of the review.
1635
+ # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
1636
+ # API
1637
+ # @param timescale [Integer] Timescale of the video.
1638
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1639
+ # to the HTTP request.
1640
+ #
1641
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1642
+ #
1643
+ def add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
1644
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1645
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
1646
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1647
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1648
+ fail ArgumentError, 'video_frame_body is nil' if video_frame_body.nil?
1649
+
1650
+
1651
+ request_headers = {}
1652
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1653
+
1654
+ # Set Headers
1655
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1656
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1657
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1658
+
1659
+ # Serialize Request
1660
+ request_mapper = {
1661
+ client_side_validation: true,
1662
+ required: true,
1663
+ serialized_name: 'videoFrameBody',
1664
+ type: {
1665
+ name: 'Sequence',
1666
+ element: {
1667
+ client_side_validation: true,
1668
+ required: false,
1669
+ serialized_name: 'VideoFrameBodyItemElementType',
1670
+ type: {
1671
+ name: 'Composite',
1672
+ class_name: 'VideoFrameBodyItem'
1673
+ }
1674
+ }
1675
+ }
1676
+ }
1677
+ request_content = @client.serialize(request_mapper, video_frame_body)
1678
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1679
+
1680
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'
1681
+
1682
+ request_url = @base_url || @client.base_url
1683
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1684
+
1685
+ options = {
1686
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1687
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1688
+ query_params: {'timescale' => timescale},
1689
+ body: request_content,
1690
+ headers: request_headers.merge(custom_headers || {}),
1691
+ base_url: request_url
1692
+ }
1693
+ promise = @client.make_request_async(:post, path_template, options)
1694
+
1695
+ promise = promise.then do |result|
1696
+ http_response = result.response
1697
+ status_code = http_response.status
1698
+ response_content = http_response.body
1699
+ unless status_code == 204
1700
+ error_model = JSON.load(response_content)
1701
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1702
+ end
1703
+
1704
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1705
+
1706
+ result
1707
+ end
1708
+
1709
+ promise.execute
1710
+ end
1711
+
1712
+ #
1713
+ # Use this method to add frames for a video review.Timescale: This parameter is
1714
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1715
+ # Timescale is provided in the output of the Content Moderator video media
1716
+ # processor on the Azure Media Services platform.Timescale in the Video
1717
+ # Moderation output is Ticks/Second.
1718
+ #
1719
+ # @param content_type [String] The content type.
1720
+ # @param team_name [String] Your team name.
1721
+ # @param review_id [String] Id of the review.
1722
+ # @param frame_image_zip Zip file containing frame images.
1723
+ # @param frame_metadata [String] Metadata of the frame.
1724
+ # @param timescale [Integer] Timescale of the video .
1725
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1726
+ # will be added to the HTTP request.
1727
+ #
1728
+ #
1729
+ def add_video_frame_stream(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
1730
+ response = add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:timescale, custom_headers:custom_headers).value!
1731
+ nil
1732
+ end
1733
+
1734
+ #
1735
+ # Use this method to add frames for a video review.Timescale: This parameter is
1736
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1737
+ # Timescale is provided in the output of the Content Moderator video media
1738
+ # processor on the Azure Media Services platform.Timescale in the Video
1739
+ # Moderation output is Ticks/Second.
1740
+ #
1741
+ # @param content_type [String] The content type.
1742
+ # @param team_name [String] Your team name.
1743
+ # @param review_id [String] Id of the review.
1744
+ # @param frame_image_zip Zip file containing frame images.
1745
+ # @param frame_metadata [String] Metadata of the frame.
1746
+ # @param timescale [Integer] Timescale of the video .
1747
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1748
+ # will be added to the HTTP request.
1749
+ #
1750
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1751
+ #
1752
+ def add_video_frame_stream_with_http_info(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
1753
+ add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:timescale, custom_headers:custom_headers).value!
1754
+ end
1755
+
1756
+ #
1757
+ # Use this method to add frames for a video review.Timescale: This parameter is
1758
+ # a factor which is used to convert the timestamp on a frame into milliseconds.
1759
+ # Timescale is provided in the output of the Content Moderator video media
1760
+ # processor on the Azure Media Services platform.Timescale in the Video
1761
+ # Moderation output is Ticks/Second.
1762
+ #
1763
+ # @param content_type [String] The content type.
1764
+ # @param team_name [String] Your team name.
1765
+ # @param review_id [String] Id of the review.
1766
+ # @param frame_image_zip Zip file containing frame images.
1767
+ # @param frame_metadata [String] Metadata of the frame.
1768
+ # @param timescale [Integer] Timescale of the video .
1769
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1770
+ # to the HTTP request.
1771
+ #
1772
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1773
+ #
1774
+ def add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
1775
+ fail ArgumentError, '@client.base_url is nil' if @client.base_url.nil?
1776
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
1777
+ fail ArgumentError, 'team_name is nil' if team_name.nil?
1778
+ fail ArgumentError, 'review_id is nil' if review_id.nil?
1779
+ fail ArgumentError, 'frame_image_zip is nil' if frame_image_zip.nil?
1780
+ fail ArgumentError, 'frame_metadata is nil' if frame_metadata.nil?
1781
+
1782
+
1783
+ request_headers = {}
1784
+ request_headers['Content-Type'] = 'multipart/form-data'
1785
+
1786
+ # Set Headers
1787
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1788
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1789
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1790
+
1791
+ # Set Form Data
1792
+ form_data = {}
1793
+ form_data['frameImageZip'] = frame_image_zip.to_s unless frame_image_zip.to_s.nil?
1794
+ form_data['frameMetadata'] = frame_metadata unless frame_metadata.nil?
1795
+
1796
+ path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'
1797
+
1798
+ request_url = @base_url || @client.base_url
1799
+ request_url = request_url.gsub('{baseUrl}', @client.base_url)
1800
+
1801
+ options = {
1802
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1803
+ path_params: {'teamName' => team_name,'reviewId' => review_id},
1804
+ query_params: {'timescale' => timescale},
1805
+ headers: request_headers.merge(custom_headers || {}),
1806
+ body: URI.encode_www_form(form_data),
1807
+ base_url: request_url
1808
+ }
1809
+ promise = @client.make_request_async(:post, path_template, options)
1810
+
1811
+ promise = promise.then do |result|
1812
+ http_response = result.response
1813
+ status_code = http_response.status
1814
+ response_content = http_response.body
1815
+ unless status_code == 204
1816
+ error_model = JSON.load(response_content)
1817
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1818
+ end
1819
+
1820
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1821
+
1822
+ result
1823
+ end
1824
+
1825
+ promise.execute
1826
+ end
1827
+
1828
+ end
1829
+ end