-
Notifications
You must be signed in to change notification settings - Fork 814
/
reviews.go
1207 lines (1082 loc) · 46.5 KB
/
reviews.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package contentmoderator
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"io"
"net/http"
)
// ReviewsClient is the you use the API to scan your content as it is generated. Content Moderator then processes your
// content and sends the results along with relevant information either back to your systems or to the built-in review
// tool. You can use this information to take decisions e.g. take it down, send to human judge, etc.
//
// When using the API, images need to have a minimum of 128 pixels and a maximum file size of 4MB.
// Text can be at most 1024 characters long.
// If the content passed to the text API or the image API exceeds the size limits, the API will return an error code
// that informs about the issue.
type ReviewsClient struct {
BaseClient
}
// NewReviewsClient creates an instance of the ReviewsClient client.
func NewReviewsClient(endpoint string) ReviewsClient {
return ReviewsClient{New(endpoint)}
}
// AddVideoFrame the reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results
// of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
//
// <h3>CallBack Schemas </h3>
// <h4>Review Completion CallBack Sample</h4>
// <p>
// {<br/>
// "ReviewId": "<Review Id>",<br/>
// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
// "ModifiedBy": "<Name of the Reviewer>",<br/>
// "CallBackType": "Review",<br/>
// "ContentId": "<The ContentId that was specified input>",<br/>
// "Metadata": {<br/>
// "adultscore": "0.xxx",<br/>
// "a": "False",<br/>
// "racyscore": "0.xxx",<br/>
// "r": "True"<br/>
// },<br/>
// "ReviewerResultTags": {<br/>
// "a": "False",<br/>
// "r": "True"<br/>
// }<br/>
// }<br/>
//
// </p>.
// Parameters:
// teamName - your team name.
// reviewID - id of the review.
// timescale - timescale of the video you are adding frames to.
func (client ReviewsClient) AddVideoFrame(ctx context.Context, teamName string, reviewID string, timescale *int32) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.AddVideoFrame")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
req, err := client.AddVideoFramePreparer(ctx, teamName, reviewID, timescale)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrame", nil, "Failure preparing request")
return
}
resp, err := client.AddVideoFrameSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrame", resp, "Failure sending request")
return
}
result, err = client.AddVideoFrameResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrame", resp, "Failure responding to request")
}
return
}
// AddVideoFramePreparer prepares the AddVideoFrame request.
func (client ReviewsClient) AddVideoFramePreparer(ctx context.Context, teamName string, reviewID string, timescale *int32) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{}
if timescale != nil {
queryParameters["timescale"] = autorest.Encode("query", *timescale)
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// AddVideoFrameSender sends the AddVideoFrame request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) AddVideoFrameSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// AddVideoFrameResponder handles the response to the AddVideoFrame request. The method always
// closes the http.Response Body.
func (client ReviewsClient) AddVideoFrameResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// AddVideoFrameStream use this method to add frames for a video review.Timescale: This parameter is a factor which is
// used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content
// Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is
// Ticks/Second.
// Parameters:
// contentType - the content type.
// teamName - your team name.
// reviewID - id of the review.
// frameImageZip - zip file containing frame images.
// frameMetadata - metadata of the frame.
// timescale - timescale of the video .
func (client ReviewsClient) AddVideoFrameStream(ctx context.Context, contentType string, teamName string, reviewID string, frameImageZip io.ReadCloser, frameMetadata string, timescale *int32) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.AddVideoFrameStream")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
req, err := client.AddVideoFrameStreamPreparer(ctx, contentType, teamName, reviewID, frameImageZip, frameMetadata, timescale)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameStream", nil, "Failure preparing request")
return
}
resp, err := client.AddVideoFrameStreamSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameStream", resp, "Failure sending request")
return
}
result, err = client.AddVideoFrameStreamResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameStream", resp, "Failure responding to request")
}
return
}
// AddVideoFrameStreamPreparer prepares the AddVideoFrameStream request.
func (client ReviewsClient) AddVideoFrameStreamPreparer(ctx context.Context, contentType string, teamName string, reviewID string, frameImageZip io.ReadCloser, frameMetadata string, timescale *int32) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{}
if timescale != nil {
queryParameters["timescale"] = autorest.Encode("query", *timescale)
}
formDataParameters := map[string]interface{}{
"frameImageZip": frameImageZip,
"frameMetadata": frameMetadata,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames", pathParameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithMultiPartFormData(formDataParameters),
autorest.WithHeader("Content-Type", autorest.String(contentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// AddVideoFrameStreamSender sends the AddVideoFrameStream request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) AddVideoFrameStreamSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// AddVideoFrameStreamResponder handles the response to the AddVideoFrameStream request. The method always
// closes the http.Response Body.
func (client ReviewsClient) AddVideoFrameStreamResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// AddVideoFrameURL use this method to add frames for a video review.Timescale: This parameter is a factor which is
// used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content
// Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is
// Ticks/Second.
// Parameters:
// contentType - the content type.
// teamName - your team name.
// reviewID - id of the review.
// videoFrameBody - body for add video frames API
// timescale - timescale of the video.
func (client ReviewsClient) AddVideoFrameURL(ctx context.Context, contentType string, teamName string, reviewID string, videoFrameBody []VideoFrameBodyItem, timescale *int32) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.AddVideoFrameURL")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: videoFrameBody,
Constraints: []validation.Constraint{{Target: "videoFrameBody", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewError("contentmoderator.ReviewsClient", "AddVideoFrameURL", err.Error())
}
req, err := client.AddVideoFrameURLPreparer(ctx, contentType, teamName, reviewID, videoFrameBody, timescale)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameURL", nil, "Failure preparing request")
return
}
resp, err := client.AddVideoFrameURLSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameURL", resp, "Failure sending request")
return
}
result, err = client.AddVideoFrameURLResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoFrameURL", resp, "Failure responding to request")
}
return
}
// AddVideoFrameURLPreparer prepares the AddVideoFrameURL request.
func (client ReviewsClient) AddVideoFrameURLPreparer(ctx context.Context, contentType string, teamName string, reviewID string, videoFrameBody []VideoFrameBodyItem, timescale *int32) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{}
if timescale != nil {
queryParameters["timescale"] = autorest.Encode("query", *timescale)
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames", pathParameters),
autorest.WithJSON(videoFrameBody),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("Content-Type", autorest.String(contentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// AddVideoFrameURLSender sends the AddVideoFrameURL request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) AddVideoFrameURLSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// AddVideoFrameURLResponder handles the response to the AddVideoFrameURL request. The method always
// closes the http.Response Body.
func (client ReviewsClient) AddVideoFrameURLResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// AddVideoTranscript this API adds a transcript file (text version of all the words spoken in a video) to a video
// review. The file should be a valid WebVTT format.
// Parameters:
// teamName - your team name.
// reviewID - id of the review.
// vttfile - transcript file of the video.
func (client ReviewsClient) AddVideoTranscript(ctx context.Context, teamName string, reviewID string, vttfile io.ReadCloser) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.AddVideoTranscript")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
req, err := client.AddVideoTranscriptPreparer(ctx, teamName, reviewID, vttfile)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscript", nil, "Failure preparing request")
return
}
resp, err := client.AddVideoTranscriptSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscript", resp, "Failure sending request")
return
}
result, err = client.AddVideoTranscriptResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscript", resp, "Failure responding to request")
}
return
}
// AddVideoTranscriptPreparer prepares the AddVideoTranscript request.
func (client ReviewsClient) AddVideoTranscriptPreparer(ctx context.Context, teamName string, reviewID string, vttfile io.ReadCloser) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("text/plain"),
autorest.AsPut(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript", pathParameters),
autorest.WithFile(vttfile),
autorest.WithHeader("Content-Type", "text/plain"))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// AddVideoTranscriptSender sends the AddVideoTranscript request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) AddVideoTranscriptSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// AddVideoTranscriptResponder handles the response to the AddVideoTranscript request. The method always
// closes the http.Response Body.
func (client ReviewsClient) AddVideoTranscriptResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// AddVideoTranscriptModerationResult this API adds a transcript screen text result file for a video review. Transcript
// screen text result file is a result of Screen Text API . In order to generate transcript screen text result file , a
// transcript file has to be screened for profanity using Screen Text API.
// Parameters:
// contentType - the content type.
// teamName - your team name.
// reviewID - id of the review.
// transcriptModerationBody - body for add video transcript moderation result API
func (client ReviewsClient) AddVideoTranscriptModerationResult(ctx context.Context, contentType string, teamName string, reviewID string, transcriptModerationBody []TranscriptModerationBodyItem) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.AddVideoTranscriptModerationResult")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: transcriptModerationBody,
Constraints: []validation.Constraint{{Target: "transcriptModerationBody", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewError("contentmoderator.ReviewsClient", "AddVideoTranscriptModerationResult", err.Error())
}
req, err := client.AddVideoTranscriptModerationResultPreparer(ctx, contentType, teamName, reviewID, transcriptModerationBody)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscriptModerationResult", nil, "Failure preparing request")
return
}
resp, err := client.AddVideoTranscriptModerationResultSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscriptModerationResult", resp, "Failure sending request")
return
}
result, err = client.AddVideoTranscriptModerationResultResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "AddVideoTranscriptModerationResult", resp, "Failure responding to request")
}
return
}
// AddVideoTranscriptModerationResultPreparer prepares the AddVideoTranscriptModerationResult request.
func (client ReviewsClient) AddVideoTranscriptModerationResultPreparer(ctx context.Context, contentType string, teamName string, reviewID string, transcriptModerationBody []TranscriptModerationBodyItem) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult", pathParameters),
autorest.WithJSON(transcriptModerationBody),
autorest.WithHeader("Content-Type", autorest.String(contentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// AddVideoTranscriptModerationResultSender sends the AddVideoTranscriptModerationResult request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) AddVideoTranscriptModerationResultSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// AddVideoTranscriptModerationResultResponder handles the response to the AddVideoTranscriptModerationResult request. The method always
// closes the http.Response Body.
func (client ReviewsClient) AddVideoTranscriptModerationResultResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// CreateJob a job Id will be returned for the content posted on this endpoint.
//
// Once the content is evaluated against the Workflow provided the review will be created or ignored based on the
// workflow expression.
//
// <h3>CallBack Schemas </h3>
//
// <p>
// <h4>Job Completion CallBack Sample</h4><br/>
//
// {<br/>
// "JobId": "<Job Id>,<br/>
// "ReviewId": "<Review Id, if the Job resulted in a Review to be created>",<br/>
// "WorkFlowId": "default",<br/>
// "Status": "<This will be one of Complete, InProgress, Error>",<br/>
// "ContentType": "Image",<br/>
// "ContentId": "<This is the ContentId that was specified on input>",<br/>
// "CallBackType": "Job",<br/>
// "Metadata": {<br/>
// "adultscore": "0.xxx",<br/>
// "a": "False",<br/>
// "racyscore": "0.xxx",<br/>
// "r": "True"<br/>
// }<br/>
// }<br/>
//
// </p>
// <p>
// <h4>Review Completion CallBack Sample</h4><br/>
//
// {
// "ReviewId": "<Review Id>",<br/>
// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
// "ModifiedBy": "<Name of the Reviewer>",<br/>
// "CallBackType": "Review",<br/>
// "ContentId": "<The ContentId that was specified input>",<br/>
// "Metadata": {<br/>
// "adultscore": "0.xxx",
// "a": "False",<br/>
// "racyscore": "0.xxx",<br/>
// "r": "True"<br/>
// },<br/>
// "ReviewerResultTags": {<br/>
// "a": "False",<br/>
// "r": "True"<br/>
// }<br/>
// }<br/>
//
// </p>.
// Parameters:
// teamName - your team name.
// contentType - image, Text or Video.
// contentID - id/Name to identify the content submitted.
// workflowName - workflow Name that you want to invoke.
// jobContentType - the content type.
// content - content to evaluate.
// callBackEndpoint - callback endpoint for posting the create job result.
func (client ReviewsClient) CreateJob(ctx context.Context, teamName string, contentType string, contentID string, workflowName string, jobContentType string, content Content, callBackEndpoint string) (result JobID, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.CreateJob")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: content,
Constraints: []validation.Constraint{{Target: "content.ContentValue", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewError("contentmoderator.ReviewsClient", "CreateJob", err.Error())
}
req, err := client.CreateJobPreparer(ctx, teamName, contentType, contentID, workflowName, jobContentType, content, callBackEndpoint)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateJob", nil, "Failure preparing request")
return
}
resp, err := client.CreateJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateJob", resp, "Failure sending request")
return
}
result, err = client.CreateJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateJob", resp, "Failure responding to request")
}
return
}
// CreateJobPreparer prepares the CreateJob request.
func (client ReviewsClient) CreateJobPreparer(ctx context.Context, teamName string, contentType string, contentID string, workflowName string, jobContentType string, content Content, callBackEndpoint string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{
"ContentId": autorest.Encode("query", contentID),
"ContentType": autorest.Encode("query", contentType),
"WorkflowName": autorest.Encode("query", workflowName),
}
if len(callBackEndpoint) > 0 {
queryParameters["CallBackEndpoint"] = autorest.Encode("query", callBackEndpoint)
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/jobs", pathParameters),
autorest.WithJSON(content),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("Content-Type", autorest.String(jobContentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateJobSender sends the CreateJob request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) CreateJobSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// CreateJobResponder handles the response to the CreateJob request. The method always
// closes the http.Response Body.
func (client ReviewsClient) CreateJobResponder(resp *http.Response) (result JobID, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateReviews the reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results
// of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
//
// <h3>CallBack Schemas </h3>
// <h4>Review Completion CallBack Sample</h4>
// <p>
// {<br/>
// "ReviewId": "<Review Id>",<br/>
// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
// "ModifiedBy": "<Name of the Reviewer>",<br/>
// "CallBackType": "Review",<br/>
// "ContentId": "<The ContentId that was specified input>",<br/>
// "Metadata": {<br/>
// "adultscore": "0.xxx",<br/>
// "a": "False",<br/>
// "racyscore": "0.xxx",<br/>
// "r": "True"<br/>
// },<br/>
// "ReviewerResultTags": {<br/>
// "a": "False",<br/>
// "r": "True"<br/>
// }<br/>
// }<br/>
//
// </p>.
// Parameters:
// URLContentType - the content type.
// teamName - your team name.
// createReviewBody - body for create reviews API
// subTeam - subTeam of your team, you want to assign the created review to.
func (client ReviewsClient) CreateReviews(ctx context.Context, URLContentType string, teamName string, createReviewBody []CreateReviewBodyItem, subTeam string) (result ListString, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.CreateReviews")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: createReviewBody,
Constraints: []validation.Constraint{{Target: "createReviewBody", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewError("contentmoderator.ReviewsClient", "CreateReviews", err.Error())
}
req, err := client.CreateReviewsPreparer(ctx, URLContentType, teamName, createReviewBody, subTeam)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateReviews", nil, "Failure preparing request")
return
}
resp, err := client.CreateReviewsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateReviews", resp, "Failure sending request")
return
}
result, err = client.CreateReviewsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateReviews", resp, "Failure responding to request")
}
return
}
// CreateReviewsPreparer prepares the CreateReviews request.
func (client ReviewsClient) CreateReviewsPreparer(ctx context.Context, URLContentType string, teamName string, createReviewBody []CreateReviewBodyItem, subTeam string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{}
if len(subTeam) > 0 {
queryParameters["subTeam"] = autorest.Encode("query", subTeam)
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews", pathParameters),
autorest.WithJSON(createReviewBody),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("UrlContentType", autorest.String(URLContentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateReviewsSender sends the CreateReviews request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) CreateReviewsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// CreateReviewsResponder handles the response to the CreateReviews request. The method always
// closes the http.Response Body.
func (client ReviewsClient) CreateReviewsResponder(resp *http.Response) (result ListString, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result.Value),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateVideoReviews the reviews created would show up for Reviewers on your team. As Reviewers complete reviewing,
// results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
//
// <h3>CallBack Schemas </h3>
// <h4>Review Completion CallBack Sample</h4>
// <p>
// {<br/>
// "ReviewId": "<Review Id>",<br/>
// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
// "ModifiedBy": "<Name of the Reviewer>",<br/>
// "CallBackType": "Review",<br/>
// "ContentId": "<The ContentId that was specified input>",<br/>
// "Metadata": {<br/>
// "adultscore": "0.xxx",<br/>
// "a": "False",<br/>
// "racyscore": "0.xxx",<br/>
// "r": "True"<br/>
// },<br/>
// "ReviewerResultTags": {<br/>
// "a": "False",<br/>
// "r": "True"<br/>
// }<br/>
// }<br/>
//
// </p>.
// Parameters:
// contentType - the content type.
// teamName - your team name.
// createVideoReviewsBody - body for create reviews API
// subTeam - subTeam of your team, you want to assign the created review to.
func (client ReviewsClient) CreateVideoReviews(ctx context.Context, contentType string, teamName string, createVideoReviewsBody []CreateVideoReviewsBodyItem, subTeam string) (result ListString, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.CreateVideoReviews")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: createVideoReviewsBody,
Constraints: []validation.Constraint{{Target: "createVideoReviewsBody", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewError("contentmoderator.ReviewsClient", "CreateVideoReviews", err.Error())
}
req, err := client.CreateVideoReviewsPreparer(ctx, contentType, teamName, createVideoReviewsBody, subTeam)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateVideoReviews", nil, "Failure preparing request")
return
}
resp, err := client.CreateVideoReviewsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateVideoReviews", resp, "Failure sending request")
return
}
result, err = client.CreateVideoReviewsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "CreateVideoReviews", resp, "Failure responding to request")
}
return
}
// CreateVideoReviewsPreparer prepares the CreateVideoReviews request.
func (client ReviewsClient) CreateVideoReviewsPreparer(ctx context.Context, contentType string, teamName string, createVideoReviewsBody []CreateVideoReviewsBodyItem, subTeam string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"teamName": autorest.Encode("path", teamName),
}
queryParameters := map[string]interface{}{}
if len(subTeam) > 0 {
queryParameters["subTeam"] = autorest.Encode("query", subTeam)
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPost(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews", pathParameters),
autorest.WithJSON(createVideoReviewsBody),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("Content-Type", autorest.String(contentType)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateVideoReviewsSender sends the CreateVideoReviews request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) CreateVideoReviewsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// CreateVideoReviewsResponder handles the response to the CreateVideoReviews request. The method always
// closes the http.Response Body.
func (client ReviewsClient) CreateVideoReviewsResponder(resp *http.Response) (result ListString, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result.Value),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetJobDetails get the Job Details for a Job Id.
// Parameters:
// teamName - your Team Name.
// jobID - id of the job.
func (client ReviewsClient) GetJobDetails(ctx context.Context, teamName string, jobID string) (result Job, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.GetJobDetails")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
req, err := client.GetJobDetailsPreparer(ctx, teamName, jobID)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetJobDetails", nil, "Failure preparing request")
return
}
resp, err := client.GetJobDetailsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetJobDetails", resp, "Failure sending request")
return
}
result, err = client.GetJobDetailsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetJobDetails", resp, "Failure responding to request")
}
return
}
// GetJobDetailsPreparer prepares the GetJobDetails request.
func (client ReviewsClient) GetJobDetailsPreparer(ctx context.Context, teamName string, jobID string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"JobId": autorest.Encode("path", jobID),
"teamName": autorest.Encode("path", teamName),
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/jobs/{JobId}", pathParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetJobDetailsSender sends the GetJobDetails request. The method will close the
// http.Response Body if it receives an error.
func (client ReviewsClient) GetJobDetailsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// GetJobDetailsResponder handles the response to the GetJobDetails request. The method always
// closes the http.Response Body.
func (client ReviewsClient) GetJobDetailsResponder(resp *http.Response) (result Job, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetReview returns review details for the review Id passed.
// Parameters:
// teamName - your Team Name.
// reviewID - id of the review.
func (client ReviewsClient) GetReview(ctx context.Context, teamName string, reviewID string) (result Review, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ReviewsClient.GetReview")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
req, err := client.GetReviewPreparer(ctx, teamName, reviewID)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetReview", nil, "Failure preparing request")
return
}
resp, err := client.GetReviewSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetReview", resp, "Failure sending request")
return
}
result, err = client.GetReviewResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "contentmoderator.ReviewsClient", "GetReview", resp, "Failure responding to request")
}
return
}
// GetReviewPreparer prepares the GetReview request.
func (client ReviewsClient) GetReviewPreparer(ctx context.Context, teamName string, reviewID string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"Endpoint": client.Endpoint,
}
pathParameters := map[string]interface{}{
"reviewId": autorest.Encode("path", reviewID),
"teamName": autorest.Encode("path", teamName),
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithCustomBaseURL("{Endpoint}", urlParameters),
autorest.WithPathParameters("/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}", pathParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))