-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
CustomVisionTrainingClientExtensions.cs
4043 lines (3885 loc) · 201 KB
/
CustomVisionTrainingClientExtensions.cs
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
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training
{
using Microsoft.Rest;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Extension methods for CustomVisionTrainingClient.
/// </summary>
public static partial class CustomVisionTrainingClientExtensions
{
/// <summary>
/// Get a list of the available domains.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static IList<Domain> GetDomains(this ICustomVisionTrainingClient operations)
{
return operations.GetDomainsAsync().GetAwaiter().GetResult();
}
/// <summary>
/// Get a list of the available domains.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IList<Domain>> GetDomainsAsync(this ICustomVisionTrainingClient operations, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDomainsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get a list of the available domains.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<IList<Domain>> GetDomainsWithHttpMessages(this ICustomVisionTrainingClient operations, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetDomainsWithHttpMessagesAsync(customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get information about a specific domain.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='domainId'>
/// The id of the domain to get information about.
/// </param>
public static Domain GetDomain(this ICustomVisionTrainingClient operations, System.Guid domainId)
{
return operations.GetDomainAsync(domainId).GetAwaiter().GetResult();
}
/// <summary>
/// Get information about a specific domain.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='domainId'>
/// The id of the domain to get information about.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Domain> GetDomainAsync(this ICustomVisionTrainingClient operations, System.Guid domainId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDomainWithHttpMessagesAsync(domainId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get information about a specific domain.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='domainId'>
/// The id of the domain to get information about.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<Domain> GetDomainWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid domainId, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetDomainWithHttpMessagesAsync(domainId, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get your projects.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static IList<Project> GetProjects(this ICustomVisionTrainingClient operations)
{
return operations.GetProjectsAsync().GetAwaiter().GetResult();
}
/// <summary>
/// Get your projects.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IList<Project>> GetProjectsAsync(this ICustomVisionTrainingClient operations, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetProjectsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get your projects.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<IList<Project>> GetProjectsWithHttpMessages(this ICustomVisionTrainingClient operations, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetProjectsWithHttpMessagesAsync(customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Create a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='name'>
/// Name of the project.
/// </param>
/// <param name='description'>
/// The description of the project.
/// </param>
/// <param name='domainId'>
/// The id of the domain to use for this project. Defaults to General.
/// </param>
/// <param name='classificationType'>
/// The type of classifier to create for this project. Possible values include:
/// 'Multiclass', 'Multilabel'
/// </param>
/// <param name='targetExportPlatforms'>
/// List of platforms the trained model is intending exporting to.
/// </param>
public static Project CreateProject(this ICustomVisionTrainingClient operations, string name, string description = default(string), System.Guid? domainId = default(System.Guid?), string classificationType = default(string), IList<string> targetExportPlatforms = default(IList<string>))
{
return operations.CreateProjectAsync(name, description, domainId, classificationType, targetExportPlatforms).GetAwaiter().GetResult();
}
/// <summary>
/// Create a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='name'>
/// Name of the project.
/// </param>
/// <param name='description'>
/// The description of the project.
/// </param>
/// <param name='domainId'>
/// The id of the domain to use for this project. Defaults to General.
/// </param>
/// <param name='classificationType'>
/// The type of classifier to create for this project. Possible values include:
/// 'Multiclass', 'Multilabel'
/// </param>
/// <param name='targetExportPlatforms'>
/// List of platforms the trained model is intending exporting to.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Project> CreateProjectAsync(this ICustomVisionTrainingClient operations, string name, string description = default(string), System.Guid? domainId = default(System.Guid?), string classificationType = default(string), IList<string> targetExportPlatforms = default(IList<string>), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateProjectWithHttpMessagesAsync(name, description, domainId, classificationType, targetExportPlatforms, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Create a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='name'>
/// Name of the project.
/// </param>
/// <param name='description'>
/// The description of the project.
/// </param>
/// <param name='domainId'>
/// The id of the domain to use for this project. Defaults to General.
/// </param>
/// <param name='classificationType'>
/// The type of classifier to create for this project. Possible values include:
/// 'Multiclass', 'Multilabel'
/// </param>
/// <param name='targetExportPlatforms'>
/// List of platforms the trained model is intending exporting to.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<Project> CreateProjectWithHttpMessages(this ICustomVisionTrainingClient operations, string name, string description = default(string), System.Guid? domainId = default(System.Guid?), string classificationType = default(string), IList<string> targetExportPlatforms = default(IList<string>), Dictionary<string, List<string>> customHeaders = null)
{
return operations.CreateProjectWithHttpMessagesAsync(name, description, domainId, classificationType, targetExportPlatforms, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to get.
/// </param>
public static Project GetProject(this ICustomVisionTrainingClient operations, System.Guid projectId)
{
return operations.GetProjectAsync(projectId).GetAwaiter().GetResult();
}
/// <summary>
/// Get a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to get.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Project> GetProjectAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetProjectWithHttpMessagesAsync(projectId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to get.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<Project> GetProjectWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetProjectWithHttpMessagesAsync(projectId, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
public static void DeleteProject(this ICustomVisionTrainingClient operations, System.Guid projectId)
{
operations.DeleteProjectAsync(projectId).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteProjectAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteProjectWithHttpMessagesAsync(projectId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// Delete a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse DeleteProjectWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, Dictionary<string, List<string>> customHeaders = null)
{
return operations.DeleteProjectWithHttpMessagesAsync(projectId, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Update a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to update.
/// </param>
/// <param name='updatedProject'>
/// The updated project model.
/// </param>
public static Project UpdateProject(this ICustomVisionTrainingClient operations, System.Guid projectId, Project updatedProject)
{
return operations.UpdateProjectAsync(projectId, updatedProject).GetAwaiter().GetResult();
}
/// <summary>
/// Update a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to update.
/// </param>
/// <param name='updatedProject'>
/// The updated project model.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Project> UpdateProjectAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, Project updatedProject, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.UpdateProjectWithHttpMessagesAsync(projectId, updatedProject, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Update a specific project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The id of the project to update.
/// </param>
/// <param name='updatedProject'>
/// The updated project model.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<Project> UpdateProjectWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, Project updatedProject, Dictionary<string, List<string>> customHeaders = null)
{
return operations.UpdateProjectWithHttpMessagesAsync(projectId, updatedProject, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get artifact content from blob storage, based on artifact relative path in
/// the blob.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='path'>
/// The relative path for artifact.
/// </param>
public static Stream GetArtifact(this ICustomVisionTrainingClient operations, System.Guid projectId, string path)
{
return operations.GetArtifactAsync(projectId, path).GetAwaiter().GetResult();
}
/// <summary>
/// Get artifact content from blob storage, based on artifact relative path in
/// the blob.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='path'>
/// The relative path for artifact.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Stream> GetArtifactAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, string path, CancellationToken cancellationToken = default(CancellationToken))
{
var _result = await operations.GetArtifactWithHttpMessagesAsync(projectId, path, null, cancellationToken).ConfigureAwait(false);
_result.Request.Dispose();
return _result.Body;
}
/// <summary>
/// Get artifact content from blob storage, based on artifact relative path in
/// the blob.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='path'>
/// The relative path for artifact.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<Stream> GetArtifactWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, string path, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetArtifactWithHttpMessagesAsync(projectId, path, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Exports a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id of the project to export.
/// </param>
public static ProjectExport ExportProject(this ICustomVisionTrainingClient operations, System.Guid projectId)
{
return operations.ExportProjectAsync(projectId).GetAwaiter().GetResult();
}
/// <summary>
/// Exports a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id of the project to export.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ProjectExport> ExportProjectAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ExportProjectWithHttpMessagesAsync(projectId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Exports a project.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id of the project to export.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<ProjectExport> ExportProjectWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, Dictionary<string, List<string>> customHeaders = null)
{
return operations.ExportProjectWithHttpMessagesAsync(projectId, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get images for a given project iteration or workspace.
/// </summary>
/// <remarks>
/// This API supports batching and range selection. By default it will only
/// return first 50 images matching images.
/// Use the {take} and {skip} parameters to control how many images to return
/// in a given batch.
/// The filtering is on an and/or relationship. For example, if the provided
/// tag ids are for the "Dog" and
/// "Cat" tags, then only images tagged with Dog and/or Cat will be returned
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='iterationId'>
/// The iteration id. Defaults to workspace.
/// </param>
/// <param name='tagIds'>
/// A list of tags ids to filter the images. Defaults to all tagged images when
/// null. Limited to 20.
/// </param>
/// <param name='taggingStatus'>
/// The tagging status filter. It can be 'All', 'Tagged', or 'Untagged'.
/// Defaults to 'All'. Possible values include: 'All', 'Tagged', 'Untagged'
/// </param>
/// <param name='filter'>
/// An expression to filter the images against image metadata. Only images
/// where the expression evaluates to true are included in the response.
/// The expression supports eq (Equal), ne (Not equal), and (Logical and), or
/// (Logical or) operators.
/// Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
/// </param>
/// <param name='orderBy'>
/// The ordering. Defaults to newest. Possible values include: 'Newest',
/// 'Oldest'
/// </param>
/// <param name='take'>
/// Maximum number of images to return. Defaults to 50, limited to 256.
/// </param>
/// <param name='skip'>
/// Number of images to skip before beginning the image batch. Defaults to 0.
/// </param>
public static IList<Image> GetImages(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid? iterationId = default(System.Guid?), IList<System.Guid> tagIds = default(IList<System.Guid>), string taggingStatus = default(string), string filter = default(string), string orderBy = default(string), int? take = 50, int? skip = 0)
{
return operations.GetImagesAsync(projectId, iterationId, tagIds, taggingStatus, filter, orderBy, take, skip).GetAwaiter().GetResult();
}
/// <summary>
/// Get images for a given project iteration or workspace.
/// </summary>
/// <remarks>
/// This API supports batching and range selection. By default it will only
/// return first 50 images matching images.
/// Use the {take} and {skip} parameters to control how many images to return
/// in a given batch.
/// The filtering is on an and/or relationship. For example, if the provided
/// tag ids are for the "Dog" and
/// "Cat" tags, then only images tagged with Dog and/or Cat will be returned
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='iterationId'>
/// The iteration id. Defaults to workspace.
/// </param>
/// <param name='tagIds'>
/// A list of tags ids to filter the images. Defaults to all tagged images when
/// null. Limited to 20.
/// </param>
/// <param name='taggingStatus'>
/// The tagging status filter. It can be 'All', 'Tagged', or 'Untagged'.
/// Defaults to 'All'. Possible values include: 'All', 'Tagged', 'Untagged'
/// </param>
/// <param name='filter'>
/// An expression to filter the images against image metadata. Only images
/// where the expression evaluates to true are included in the response.
/// The expression supports eq (Equal), ne (Not equal), and (Logical and), or
/// (Logical or) operators.
/// Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
/// </param>
/// <param name='orderBy'>
/// The ordering. Defaults to newest. Possible values include: 'Newest',
/// 'Oldest'
/// </param>
/// <param name='take'>
/// Maximum number of images to return. Defaults to 50, limited to 256.
/// </param>
/// <param name='skip'>
/// Number of images to skip before beginning the image batch. Defaults to 0.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IList<Image>> GetImagesAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid? iterationId = default(System.Guid?), IList<System.Guid> tagIds = default(IList<System.Guid>), string taggingStatus = default(string), string filter = default(string), string orderBy = default(string), int? take = 50, int? skip = 0, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetImagesWithHttpMessagesAsync(projectId, iterationId, tagIds, taggingStatus, filter, orderBy, take, skip, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get images for a given project iteration or workspace.
/// </summary>
/// <remarks>
/// This API supports batching and range selection. By default it will only
/// return first 50 images matching images.
/// Use the {take} and {skip} parameters to control how many images to return
/// in a given batch.
/// The filtering is on an and/or relationship. For example, if the provided
/// tag ids are for the "Dog" and
/// "Cat" tags, then only images tagged with Dog and/or Cat will be returned
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='iterationId'>
/// The iteration id. Defaults to workspace.
/// </param>
/// <param name='tagIds'>
/// A list of tags ids to filter the images. Defaults to all tagged images when
/// null. Limited to 20.
/// </param>
/// <param name='taggingStatus'>
/// The tagging status filter. It can be 'All', 'Tagged', or 'Untagged'.
/// Defaults to 'All'. Possible values include: 'All', 'Tagged', 'Untagged'
/// </param>
/// <param name='filter'>
/// An expression to filter the images against image metadata. Only images
/// where the expression evaluates to true are included in the response.
/// The expression supports eq (Equal), ne (Not equal), and (Logical and), or
/// (Logical or) operators.
/// Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
/// </param>
/// <param name='orderBy'>
/// The ordering. Defaults to newest. Possible values include: 'Newest',
/// 'Oldest'
/// </param>
/// <param name='take'>
/// Maximum number of images to return. Defaults to 50, limited to 256.
/// </param>
/// <param name='skip'>
/// Number of images to skip before beginning the image batch. Defaults to 0.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<IList<Image>> GetImagesWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid? iterationId = default(System.Guid?), IList<System.Guid> tagIds = default(IList<System.Guid>), string taggingStatus = default(string), string filter = default(string), string orderBy = default(string), int? take = 50, int? skip = 0, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetImagesWithHttpMessagesAsync(projectId, iterationId, tagIds, taggingStatus, filter, orderBy, take, skip, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Add the provided images to the set of training images.
/// </summary>
/// <remarks>
/// This API accepts body content as multipart/form-data and
/// application/octet-stream. When using multipart
/// multiple image files can be sent at once, with a maximum of 64 files.
/// If all images are successful created, 200(OK) status code will be returned.
/// Otherwise, 207 (Multi-Status) status code will be returned and detail
/// status for each image will be listed in the response payload.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageData'>
/// Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports
/// images up to 6MB.
/// </param>
/// <param name='tagIds'>
/// The tags ids with which to tag each image. Limited to 20.
/// </param>
public static ImageCreateSummary CreateImagesFromData(this ICustomVisionTrainingClient operations, System.Guid projectId, Stream imageData, IList<System.Guid> tagIds = default(IList<System.Guid>))
{
return operations.CreateImagesFromDataAsync(projectId, imageData, tagIds).GetAwaiter().GetResult();
}
/// <summary>
/// Add the provided images to the set of training images.
/// </summary>
/// <remarks>
/// This API accepts body content as multipart/form-data and
/// application/octet-stream. When using multipart
/// multiple image files can be sent at once, with a maximum of 64 files.
/// If all images are successful created, 200(OK) status code will be returned.
/// Otherwise, 207 (Multi-Status) status code will be returned and detail
/// status for each image will be listed in the response payload.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageData'>
/// Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports
/// images up to 6MB.
/// </param>
/// <param name='tagIds'>
/// The tags ids with which to tag each image. Limited to 20.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ImageCreateSummary> CreateImagesFromDataAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, Stream imageData, IList<System.Guid> tagIds = default(IList<System.Guid>), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateImagesFromDataWithHttpMessagesAsync(projectId, imageData, tagIds, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Add the provided images to the set of training images.
/// </summary>
/// <remarks>
/// This API accepts body content as multipart/form-data and
/// application/octet-stream. When using multipart
/// multiple image files can be sent at once, with a maximum of 64 files.
/// If all images are successful created, 200(OK) status code will be returned.
/// Otherwise, 207 (Multi-Status) status code will be returned and detail
/// status for each image will be listed in the response payload.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageData'>
/// Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports
/// images up to 6MB.
/// </param>
/// <param name='tagIds'>
/// The tags ids with which to tag each image. Limited to 20.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<ImageCreateSummary> CreateImagesFromDataWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, Stream imageData, IList<System.Guid> tagIds = default(IList<System.Guid>), Dictionary<string, List<string>> customHeaders = null)
{
return operations.CreateImagesFromDataWithHttpMessagesAsync(projectId, imageData, tagIds, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Delete images from the set of training images.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageIds'>
/// Ids of the images to be deleted. Limited to 256 images per batch.
/// </param>
/// <param name='allImages'>
/// Flag to specify delete all images, specify this flag or a list of images.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
/// <param name='allIterations'>
/// Removes these images from all iterations, not just the current workspace.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
public static void DeleteImages(this ICustomVisionTrainingClient operations, System.Guid projectId, IList<System.Guid> imageIds = default(IList<System.Guid>), bool? allImages = default(bool?), bool? allIterations = default(bool?))
{
operations.DeleteImagesAsync(projectId, imageIds, allImages, allIterations).GetAwaiter().GetResult();
}
/// <summary>
/// Delete images from the set of training images.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageIds'>
/// Ids of the images to be deleted. Limited to 256 images per batch.
/// </param>
/// <param name='allImages'>
/// Flag to specify delete all images, specify this flag or a list of images.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
/// <param name='allIterations'>
/// Removes these images from all iterations, not just the current workspace.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteImagesAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, IList<System.Guid> imageIds = default(IList<System.Guid>), bool? allImages = default(bool?), bool? allIterations = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteImagesWithHttpMessagesAsync(projectId, imageIds, allImages, allIterations, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// Delete images from the set of training images.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageIds'>
/// Ids of the images to be deleted. Limited to 256 images per batch.
/// </param>
/// <param name='allImages'>
/// Flag to specify delete all images, specify this flag or a list of images.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
/// <param name='allIterations'>
/// Removes these images from all iterations, not just the current workspace.
/// Using this flag will return a 202 response to indicate the images are being
/// deleted.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse DeleteImagesWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, IList<System.Guid> imageIds = default(IList<System.Guid>), bool? allImages = default(bool?), bool? allIterations = default(bool?), Dictionary<string, List<string>> customHeaders = null)
{
return operations.DeleteImagesWithHttpMessagesAsync(projectId, imageIds, allImages, allIterations, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get region proposals for an image. Returns empty array if no proposals are
/// found.
/// </summary>
/// <remarks>
/// This API will get region proposals for an image along with confidences for
/// the region. It returns an empty array if no proposals are found.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageId'>
/// The image id.
/// </param>
public static ImageRegionProposal GetImageRegionProposals(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid imageId)
{
return operations.GetImageRegionProposalsAsync(projectId, imageId).GetAwaiter().GetResult();
}
/// <summary>
/// Get region proposals for an image. Returns empty array if no proposals are
/// found.
/// </summary>
/// <remarks>
/// This API will get region proposals for an image along with confidences for
/// the region. It returns an empty array if no proposals are found.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageId'>
/// The image id.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ImageRegionProposal> GetImageRegionProposalsAsync(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid imageId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetImageRegionProposalsWithHttpMessagesAsync(projectId, imageId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get region proposals for an image. Returns empty array if no proposals are
/// found.
/// </summary>
/// <remarks>
/// This API will get region proposals for an image along with confidences for
/// the region. It returns an empty array if no proposals are found.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='imageId'>
/// The image id.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
public static HttpOperationResponse<ImageRegionProposal> GetImageRegionProposalsWithHttpMessages(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid imageId, Dictionary<string, List<string>> customHeaders = null)
{
return operations.GetImageRegionProposalsWithHttpMessagesAsync(projectId, imageId, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
}
/// <summary>
/// Get the number of images.
/// </summary>
/// <remarks>
/// The filtering is on an and/or relationship. For example, if the provided
/// tag ids are for the "Dog" and
/// "Cat" tags, then only images tagged with Dog and/or Cat will be returned
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='iterationId'>
/// The iteration id. Defaults to workspace.
/// </param>
/// <param name='taggingStatus'>
/// The tagging status filter. It can be 'All', 'Tagged', or 'Untagged'.
/// Defaults to 'All'. Possible values include: 'All', 'Tagged', 'Untagged'
/// </param>
/// <param name='filter'>
/// An expression to filter the images against image metadata. Only images
/// where the expression evaluates to true are included in the response.
/// The expression supports eq (Equal), ne (Not equal), and (Logical and), or
/// (Logical or) operators.
/// Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
/// </param>
/// <param name='tagIds'>
/// A list of tags ids to filter the images to count. Defaults to all tags when
/// null.
/// </param>
public static int? GetImageCount(this ICustomVisionTrainingClient operations, System.Guid projectId, System.Guid? iterationId = default(System.Guid?), string taggingStatus = default(string), string filter = default(string), IList<System.Guid> tagIds = default(IList<System.Guid>))
{
return operations.GetImageCountAsync(projectId, iterationId, taggingStatus, filter, tagIds).GetAwaiter().GetResult();
}
/// <summary>
/// Get the number of images.
/// </summary>
/// <remarks>
/// The filtering is on an and/or relationship. For example, if the provided
/// tag ids are for the "Dog" and
/// "Cat" tags, then only images tagged with Dog and/or Cat will be returned
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='projectId'>
/// The project id.
/// </param>
/// <param name='iterationId'>
/// The iteration id. Defaults to workspace.
/// </param>
/// <param name='taggingStatus'>
/// The tagging status filter. It can be 'All', 'Tagged', or 'Untagged'.
/// Defaults to 'All'. Possible values include: 'All', 'Tagged', 'Untagged'
/// </param>