-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
3163 lines (2854 loc) · 114 KB
/
client.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
// --------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// --------------------------------------------------------------------------------------------
// Generated file, DO NOT EDIT
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// --------------------------------------------------------------------------------------------
package gallery
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
"net/url"
"strconv"
"github.com/artbegolli/go-ado/azuredevops"
"github.com/google/uuid"
)
var ResourceAreaId, _ = uuid.Parse("69d21c00-f135-441b-b5ce-3626378e0819")
type Client interface {
// [Preview API]
AddAssetForEditExtensionDraft(context.Context, AddAssetForEditExtensionDraftArgs) (*ExtensionDraftAsset, error)
// [Preview API]
AddAssetForNewExtensionDraft(context.Context, AddAssetForNewExtensionDraftArgs) (*ExtensionDraftAsset, error)
// [Preview API]
AssociateAzurePublisher(context.Context, AssociateAzurePublisherArgs) (*AzurePublisher, error)
// [Preview API]
CreateCategory(context.Context, CreateCategoryArgs) (*ExtensionCategory, error)
// [Preview API]
CreateDraftForEditExtension(context.Context, CreateDraftForEditExtensionArgs) (*ExtensionDraft, error)
// [Preview API]
CreateDraftForNewExtension(context.Context, CreateDraftForNewExtensionArgs) (*ExtensionDraft, error)
// [Preview API]
CreateExtension(context.Context, CreateExtensionArgs) (*PublishedExtension, error)
// [Preview API]
CreateExtensionWithPublisher(context.Context, CreateExtensionWithPublisherArgs) (*PublishedExtension, error)
// [Preview API]
CreatePublisher(context.Context, CreatePublisherArgs) (*Publisher, error)
// [Preview API] Creates a new question for an extension.
CreateQuestion(context.Context, CreateQuestionArgs) (*Question, error)
// [Preview API] Creates a new response for a given question for an extension.
CreateResponse(context.Context, CreateResponseArgs) (*Response, error)
// [Preview API] Creates a new review for an extension
CreateReview(context.Context, CreateReviewArgs) (*Review, error)
// [Preview API]
DeleteExtension(context.Context, DeleteExtensionArgs) error
// [Preview API]
DeleteExtensionById(context.Context, DeleteExtensionByIdArgs) error
// [Preview API]
DeletePublisher(context.Context, DeletePublisherArgs) error
// [Preview API] Delete publisher asset like logo
DeletePublisherAsset(context.Context, DeletePublisherAssetArgs) error
// [Preview API] Deletes an existing question and all its associated responses for an extension. (soft delete)
DeleteQuestion(context.Context, DeleteQuestionArgs) error
// [Preview API] Deletes a response for an extension. (soft delete)
DeleteResponse(context.Context, DeleteResponseArgs) error
// [Preview API] Deletes a review
DeleteReview(context.Context, DeleteReviewArgs) error
// [Preview API]
ExtensionValidator(context.Context, ExtensionValidatorArgs) error
// [Preview API]
GenerateKey(context.Context, GenerateKeyArgs) error
// [Preview API]
GetAcquisitionOptions(context.Context, GetAcquisitionOptionsArgs) (*AcquisitionOptions, error)
// [Preview API]
GetAsset(context.Context, GetAssetArgs) (io.ReadCloser, error)
// [Preview API]
GetAssetAuthenticated(context.Context, GetAssetAuthenticatedArgs) (io.ReadCloser, error)
// [Preview API]
GetAssetByName(context.Context, GetAssetByNameArgs) (io.ReadCloser, error)
// [Preview API]
GetAssetFromEditExtensionDraft(context.Context, GetAssetFromEditExtensionDraftArgs) (io.ReadCloser, error)
// [Preview API]
GetAssetFromNewExtensionDraft(context.Context, GetAssetFromNewExtensionDraftArgs) (io.ReadCloser, error)
// [Preview API]
GetAssetWithToken(context.Context, GetAssetWithTokenArgs) (io.ReadCloser, error)
// [Preview API]
GetCategories(context.Context, GetCategoriesArgs) (*[]string, error)
// [Preview API]
GetCategoryDetails(context.Context, GetCategoryDetailsArgs) (*CategoriesResult, error)
// [Preview API]
GetCategoryTree(context.Context, GetCategoryTreeArgs) (*ProductCategory, error)
// [Preview API]
GetCertificate(context.Context, GetCertificateArgs) (io.ReadCloser, error)
// [Preview API]
GetContentVerificationLog(context.Context, GetContentVerificationLogArgs) (io.ReadCloser, error)
// [Preview API]
GetExtension(context.Context, GetExtensionArgs) (*PublishedExtension, error)
// [Preview API]
GetExtensionById(context.Context, GetExtensionByIdArgs) (*PublishedExtension, error)
// [Preview API]
GetExtensionDailyStats(context.Context, GetExtensionDailyStatsArgs) (*ExtensionDailyStats, error)
// [Preview API] This route/location id only supports HTTP POST anonymously, so that the page view daily stat can be incremented from Marketplace client. Trying to call GET on this route should result in an exception. Without this explicit implementation, calling GET on this public route invokes the above GET implementation GetExtensionDailyStats.
GetExtensionDailyStatsAnonymous(context.Context, GetExtensionDailyStatsAnonymousArgs) (*ExtensionDailyStats, error)
// [Preview API] Get install/uninstall events of an extension. If both count and afterDate parameters are specified, count takes precedence.
GetExtensionEvents(context.Context, GetExtensionEventsArgs) (*ExtensionEvents, error)
// [Preview API] Returns extension reports
GetExtensionReports(context.Context, GetExtensionReportsArgs) (interface{}, error)
// [Preview API] Get all setting entries for the given user/all-users scope
GetGalleryUserSettings(context.Context, GetGalleryUserSettingsArgs) (*map[string]interface{}, error)
// [Preview API] This endpoint gets hit when you download a VSTS extension from the Web UI
GetPackage(context.Context, GetPackageArgs) (io.ReadCloser, error)
// [Preview API]
GetPublisher(context.Context, GetPublisherArgs) (*Publisher, error)
// [Preview API] Get publisher asset like logo as a stream
GetPublisherAsset(context.Context, GetPublisherAssetArgs) (io.ReadCloser, error)
// [Preview API] Returns a list of questions with their responses associated with an extension.
GetQuestions(context.Context, GetQuestionsArgs) (*QuestionsResult, error)
// [Preview API] Returns a list of reviews associated with an extension
GetReviews(context.Context, GetReviewsArgs) (*ReviewsResult, error)
// [Preview API] Returns a summary of the reviews
GetReviewsSummary(context.Context, GetReviewsSummaryArgs) (*ReviewSummary, error)
// [Preview API]
GetRootCategories(context.Context, GetRootCategoriesArgs) (*ProductCategoriesResult, error)
// [Preview API]
GetSigningKey(context.Context, GetSigningKeyArgs) (*string, error)
// [Preview API]
GetVerificationLog(context.Context, GetVerificationLogArgs) (io.ReadCloser, error)
// [Preview API] Increments a daily statistic associated with the extension
IncrementExtensionDailyStat(context.Context, IncrementExtensionDailyStatArgs) error
// [Preview API]
PerformEditExtensionDraftOperation(context.Context, PerformEditExtensionDraftOperationArgs) (*ExtensionDraft, error)
// [Preview API]
PerformNewExtensionDraftOperation(context.Context, PerformNewExtensionDraftOperationArgs) (*ExtensionDraft, error)
// [Preview API] API endpoint to publish extension install/uninstall events. This is meant to be invoked by EMS only for sending us data related to install/uninstall of an extension.
PublishExtensionEvents(context.Context, PublishExtensionEventsArgs) error
// [Preview API]
QueryAssociatedAzurePublisher(context.Context, QueryAssociatedAzurePublisherArgs) (*AzurePublisher, error)
// [Preview API]
QueryExtensions(context.Context, QueryExtensionsArgs) (*ExtensionQueryResult, error)
// [Preview API]
QueryPublishers(context.Context, QueryPublishersArgs) (*PublisherQueryResult, error)
// [Preview API] Flags a concern with an existing question for an extension.
ReportQuestion(context.Context, ReportQuestionArgs) (*Concern, error)
// [Preview API]
RequestAcquisition(context.Context, RequestAcquisitionArgs) (*ExtensionAcquisitionRequest, error)
// [Preview API] Send Notification
SendNotifications(context.Context, SendNotificationsArgs) error
// [Preview API] Set all setting entries for the given user/all-users scope
SetGalleryUserSettings(context.Context, SetGalleryUserSettingsArgs) error
// [Preview API]
ShareExtension(context.Context, ShareExtensionArgs) error
// [Preview API]
ShareExtensionById(context.Context, ShareExtensionByIdArgs) error
// [Preview API]
ShareExtensionWithHost(context.Context, ShareExtensionWithHostArgs) error
// [Preview API]
UnshareExtension(context.Context, UnshareExtensionArgs) error
// [Preview API]
UnshareExtensionById(context.Context, UnshareExtensionByIdArgs) error
// [Preview API]
UnshareExtensionWithHost(context.Context, UnshareExtensionWithHostArgs) error
// [Preview API] REST endpoint to update an extension.
UpdateExtension(context.Context, UpdateExtensionArgs) (*PublishedExtension, error)
// [Preview API]
UpdateExtensionById(context.Context, UpdateExtensionByIdArgs) (*PublishedExtension, error)
// [Preview API]
UpdateExtensionProperties(context.Context, UpdateExtensionPropertiesArgs) (*PublishedExtension, error)
// [Preview API]
UpdateExtensionStatistics(context.Context, UpdateExtensionStatisticsArgs) error
// [Preview API]
UpdatePayloadInDraftForEditExtension(context.Context, UpdatePayloadInDraftForEditExtensionArgs) (*ExtensionDraft, error)
// [Preview API]
UpdatePayloadInDraftForNewExtension(context.Context, UpdatePayloadInDraftForNewExtensionArgs) (*ExtensionDraft, error)
// [Preview API]
UpdatePublisher(context.Context, UpdatePublisherArgs) (*Publisher, error)
// [Preview API] Update publisher asset like logo. It accepts asset file as an octet stream and file name is passed in header values.
UpdatePublisherAsset(context.Context, UpdatePublisherAssetArgs) (*map[string]string, error)
// [Preview API] Endpoint to add/modify publisher membership. Currently Supports only addition/modification of 1 user at a time Works only for adding members of same tenant.
UpdatePublisherMembers(context.Context, UpdatePublisherMembersArgs) (*[]PublisherRoleAssignment, error)
// [Preview API] Updates an existing question for an extension.
UpdateQuestion(context.Context, UpdateQuestionArgs) (*Question, error)
// [Preview API] Updates an existing response for a given question for an extension.
UpdateResponse(context.Context, UpdateResponseArgs) (*Response, error)
// [Preview API] Updates or Flags a review
UpdateReview(context.Context, UpdateReviewArgs) (*ReviewPatch, error)
}
type ClientImpl struct {
Client azuredevops.Client
}
func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) {
client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId)
if err != nil {
return nil, err
}
return &ClientImpl{
Client: *client,
}, nil
}
// [Preview API]
func (client *ClientImpl) AddAssetForEditExtensionDraft(ctx context.Context, args AddAssetForEditExtensionDraftArgs) (*ExtensionDraftAsset, error) {
if args.UploadStream == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
if args.DraftId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DraftId"}
}
routeValues["draftId"] = (*args.DraftId).String()
if args.AssetType == nil || *args.AssetType == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.AssetType"}
}
routeValues["assetType"] = *args.AssetType
locationId, _ := uuid.Parse("f1db9c47-6619-4998-a7e5-d7f9f41a4617")
resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", routeValues, nil, args.UploadStream, "application/octet-stream", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue ExtensionDraftAsset
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the AddAssetForEditExtensionDraft function
type AddAssetForEditExtensionDraftArgs struct {
// (required) Stream to upload
UploadStream io.Reader
// (required)
PublisherName *string
// (required)
ExtensionName *string
// (required)
DraftId *uuid.UUID
// (required)
AssetType *string
}
// [Preview API]
func (client *ClientImpl) AddAssetForNewExtensionDraft(ctx context.Context, args AddAssetForNewExtensionDraftArgs) (*ExtensionDraftAsset, error) {
if args.UploadStream == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.DraftId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DraftId"}
}
routeValues["draftId"] = (*args.DraftId).String()
if args.AssetType == nil || *args.AssetType == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.AssetType"}
}
routeValues["assetType"] = *args.AssetType
locationId, _ := uuid.Parse("88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7")
resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", routeValues, nil, args.UploadStream, "application/octet-stream", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue ExtensionDraftAsset
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the AddAssetForNewExtensionDraft function
type AddAssetForNewExtensionDraftArgs struct {
// (required) Stream to upload
UploadStream io.Reader
// (required)
PublisherName *string
// (required)
DraftId *uuid.UUID
// (required)
AssetType *string
}
// [Preview API]
func (client *ClientImpl) AssociateAzurePublisher(ctx context.Context, args AssociateAzurePublisherArgs) (*AzurePublisher, error) {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
queryParams := url.Values{}
if args.AzurePublisherId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "azurePublisherId"}
}
queryParams.Add("azurePublisherId", *args.AzurePublisherId)
locationId, _ := uuid.Parse("efd202a6-9d87-4ebc-9229-d2b8ae2fdb6d")
resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue AzurePublisher
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the AssociateAzurePublisher function
type AssociateAzurePublisherArgs struct {
// (required)
PublisherName *string
// (required)
AzurePublisherId *string
}
// [Preview API]
func (client *ClientImpl) CreateCategory(ctx context.Context, args CreateCategoryArgs) (*ExtensionCategory, error) {
if args.Category == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Category"}
}
body, marshalErr := json.Marshal(*args.Category)
if marshalErr != nil {
return nil, marshalErr
}
locationId, _ := uuid.Parse("476531a3-7024-4516-a76a-ed64d3008ad6")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue ExtensionCategory
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateCategory function
type CreateCategoryArgs struct {
// (required)
Category *ExtensionCategory
}
// [Preview API]
func (client *ClientImpl) CreateDraftForEditExtension(ctx context.Context, args CreateDraftForEditExtensionArgs) (*ExtensionDraft, error) {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
locationId, _ := uuid.Parse("02b33873-4e61-496e-83a2-59d1df46b7d8")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue ExtensionDraft
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateDraftForEditExtension function
type CreateDraftForEditExtensionArgs struct {
// (required)
PublisherName *string
// (required)
ExtensionName *string
}
// [Preview API]
func (client *ClientImpl) CreateDraftForNewExtension(ctx context.Context, args CreateDraftForNewExtensionArgs) (*ExtensionDraft, error) {
if args.UploadStream == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
additionalHeaders := make(map[string]string)
if args.Product != nil {
additionalHeaders["X-Market-UploadFileProduct"] = *args.Product
}
if args.FileName != nil {
additionalHeaders["X-Market-UploadFileName"] = *args.FileName
}
locationId, _ := uuid.Parse("b3ab127d-ebb9-4d22-b611-4e09593c8d79")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, args.UploadStream, "application/octet-stream", "application/json", additionalHeaders)
if err != nil {
return nil, err
}
var responseValue ExtensionDraft
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateDraftForNewExtension function
type CreateDraftForNewExtensionArgs struct {
// (required) Stream to upload
UploadStream io.Reader
// (required)
PublisherName *string
// (required) Header to pass the product type of the payload file
Product *string
// (optional) Header to pass the filename of the uploaded data
FileName *string
}
// [Preview API]
func (client *ClientImpl) CreateExtension(ctx context.Context, args CreateExtensionArgs) (*PublishedExtension, error) {
if args.UploadStream == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"}
}
locationId, _ := uuid.Parse("a41192c8-9525-4b58-bc86-179fa549d80d")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", nil, nil, args.UploadStream, "application/octet-stream", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue PublishedExtension
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateExtension function
type CreateExtensionArgs struct {
// (required) Stream to upload
UploadStream io.Reader
}
// [Preview API]
func (client *ClientImpl) CreateExtensionWithPublisher(ctx context.Context, args CreateExtensionWithPublisherArgs) (*PublishedExtension, error) {
if args.UploadStream == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
locationId, _ := uuid.Parse("e11ea35a-16fe-4b80-ab11-c4cab88a0966")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.2", routeValues, nil, args.UploadStream, "application/octet-stream", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue PublishedExtension
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateExtensionWithPublisher function
type CreateExtensionWithPublisherArgs struct {
// (required) Stream to upload
UploadStream io.Reader
// (required)
PublisherName *string
}
// [Preview API]
func (client *ClientImpl) CreatePublisher(ctx context.Context, args CreatePublisherArgs) (*Publisher, error) {
if args.Publisher == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Publisher"}
}
body, marshalErr := json.Marshal(*args.Publisher)
if marshalErr != nil {
return nil, marshalErr
}
locationId, _ := uuid.Parse("4ddec66a-e4f6-4f5d-999e-9e77710d7ff4")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue Publisher
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreatePublisher function
type CreatePublisherArgs struct {
// (required)
Publisher *Publisher
}
// [Preview API] Creates a new question for an extension.
func (client *ClientImpl) CreateQuestion(ctx context.Context, args CreateQuestionArgs) (*Question, error) {
if args.Question == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Question"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
body, marshalErr := json.Marshal(*args.Question)
if marshalErr != nil {
return nil, marshalErr
}
locationId, _ := uuid.Parse("6d1d9741-eca8-4701-a3a5-235afc82dfa4")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue Question
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateQuestion function
type CreateQuestionArgs struct {
// (required) Question to be created for the extension.
Question *Question
// (required) Name of the publisher who published the extension.
PublisherName *string
// (required) Name of the extension.
ExtensionName *string
}
// [Preview API] Creates a new response for a given question for an extension.
func (client *ClientImpl) CreateResponse(ctx context.Context, args CreateResponseArgs) (*Response, error) {
if args.Response == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Response"}
}
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
if args.QuestionId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.QuestionId"}
}
routeValues["questionId"] = strconv.FormatUint(*args.QuestionId, 10)
body, marshalErr := json.Marshal(*args.Response)
if marshalErr != nil {
return nil, marshalErr
}
locationId, _ := uuid.Parse("7f8ae5e0-46b0-438f-b2e8-13e8513517bd")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue Response
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateResponse function
type CreateResponseArgs struct {
// (required) Response to be created for the extension.
Response *Response
// (required) Name of the publisher who published the extension.
PublisherName *string
// (required) Name of the extension.
ExtensionName *string
// (required) Identifier of the question for which response is to be created for the extension.
QuestionId *uint64
}
// [Preview API] Creates a new review for an extension
func (client *ClientImpl) CreateReview(ctx context.Context, args CreateReviewArgs) (*Review, error) {
if args.Review == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Review"}
}
routeValues := make(map[string]string)
if args.PubName == nil || *args.PubName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PubName"}
}
routeValues["pubName"] = *args.PubName
if args.ExtName == nil || *args.ExtName == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtName"}
}
routeValues["extName"] = *args.ExtName
body, marshalErr := json.Marshal(*args.Review)
if marshalErr != nil {
return nil, marshalErr
}
locationId, _ := uuid.Parse("e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3")
resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue Review
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the CreateReview function
type CreateReviewArgs struct {
// (required) Review to be created for the extension
Review *Review
// (required) Name of the publisher who published the extension
PubName *string
// (required) Name of the extension
ExtName *string
}
// [Preview API]
func (client *ClientImpl) DeleteExtension(ctx context.Context, args DeleteExtensionArgs) error {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
queryParams := url.Values{}
if args.Version != nil {
queryParams.Add("version", *args.Version)
}
locationId, _ := uuid.Parse("e11ea35a-16fe-4b80-ab11-c4cab88a0966")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeleteExtension function
type DeleteExtensionArgs struct {
// (required)
PublisherName *string
// (required)
ExtensionName *string
// (optional)
Version *string
}
// [Preview API]
func (client *ClientImpl) DeleteExtensionById(ctx context.Context, args DeleteExtensionByIdArgs) error {
routeValues := make(map[string]string)
if args.ExtensionId == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.ExtensionId"}
}
routeValues["extensionId"] = (*args.ExtensionId).String()
queryParams := url.Values{}
if args.Version != nil {
queryParams.Add("version", *args.Version)
}
locationId, _ := uuid.Parse("a41192c8-9525-4b58-bc86-179fa549d80d")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeleteExtensionById function
type DeleteExtensionByIdArgs struct {
// (required)
ExtensionId *uuid.UUID
// (optional)
Version *string
}
// [Preview API]
func (client *ClientImpl) DeletePublisher(ctx context.Context, args DeletePublisherArgs) error {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
locationId, _ := uuid.Parse("4ddec66a-e4f6-4f5d-999e-9e77710d7ff4")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeletePublisher function
type DeletePublisherArgs struct {
// (required)
PublisherName *string
}
// [Preview API] Delete publisher asset like logo
func (client *ClientImpl) DeletePublisherAsset(ctx context.Context, args DeletePublisherAssetArgs) error {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
queryParams := url.Values{}
if args.AssetType != nil {
queryParams.Add("assetType", *args.AssetType)
}
locationId, _ := uuid.Parse("21143299-34f9-4c62-8ca8-53da691192f9")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeletePublisherAsset function
type DeletePublisherAssetArgs struct {
// (required) Internal name of the publisher
PublisherName *string
// (optional) Type of asset. Default value is 'logo'.
AssetType *string
}
// [Preview API] Deletes an existing question and all its associated responses for an extension. (soft delete)
func (client *ClientImpl) DeleteQuestion(ctx context.Context, args DeleteQuestionArgs) error {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
if args.QuestionId == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.QuestionId"}
}
routeValues["questionId"] = strconv.FormatUint(*args.QuestionId, 10)
locationId, _ := uuid.Parse("6d1d9741-eca8-4701-a3a5-235afc82dfa4")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeleteQuestion function
type DeleteQuestionArgs struct {
// (required) Name of the publisher who published the extension.
PublisherName *string
// (required) Name of the extension.
ExtensionName *string
// (required) Identifier of the question to be deleted for the extension.
QuestionId *uint64
}
// [Preview API] Deletes a response for an extension. (soft delete)
func (client *ClientImpl) DeleteResponse(ctx context.Context, args DeleteResponseArgs) error {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PublisherName"}
}
routeValues["publisherName"] = *args.PublisherName
if args.ExtensionName == nil || *args.ExtensionName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtensionName"}
}
routeValues["extensionName"] = *args.ExtensionName
if args.QuestionId == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.QuestionId"}
}
routeValues["questionId"] = strconv.FormatUint(*args.QuestionId, 10)
if args.ResponseId == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.ResponseId"}
}
routeValues["responseId"] = strconv.FormatUint(*args.ResponseId, 10)
locationId, _ := uuid.Parse("7f8ae5e0-46b0-438f-b2e8-13e8513517bd")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeleteResponse function
type DeleteResponseArgs struct {
// (required) Name of the publisher who published the extension.
PublisherName *string
// (required) Name of the extension.
ExtensionName *string
// (required) Identifies the question whose response is to be deleted.
QuestionId *uint64
// (required) Identifies the response to be deleted.
ResponseId *uint64
}
// [Preview API] Deletes a review
func (client *ClientImpl) DeleteReview(ctx context.Context, args DeleteReviewArgs) error {
routeValues := make(map[string]string)
if args.PubName == nil || *args.PubName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.PubName"}
}
routeValues["pubName"] = *args.PubName
if args.ExtName == nil || *args.ExtName == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ExtName"}
}
routeValues["extName"] = *args.ExtName
if args.ReviewId == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.ReviewId"}
}
routeValues["reviewId"] = strconv.FormatUint(*args.ReviewId, 10)
locationId, _ := uuid.Parse("e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3")
_, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the DeleteReview function
type DeleteReviewArgs struct {
// (required) Name of the publisher who published the extension
PubName *string
// (required) Name of the extension
ExtName *string
// (required) Id of the review which needs to be updated
ReviewId *uint64
}
// [Preview API]
func (client *ClientImpl) ExtensionValidator(ctx context.Context, args ExtensionValidatorArgs) error {
if args.AzureRestApiRequestModel == nil {
return &azuredevops.ArgumentNilError{ArgumentName: "args.AzureRestApiRequestModel"}
}
body, marshalErr := json.Marshal(*args.AzureRestApiRequestModel)
if marshalErr != nil {
return marshalErr
}
locationId, _ := uuid.Parse("05e8a5e1-8c59-4c2c-8856-0ff087d1a844")
_, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", nil, nil, bytes.NewReader(body), "application/json", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the ExtensionValidator function
type ExtensionValidatorArgs struct {
// (required)
AzureRestApiRequestModel *AzureRestApiRequestModel
}
// [Preview API]
func (client *ClientImpl) GenerateKey(ctx context.Context, args GenerateKeyArgs) error {
routeValues := make(map[string]string)
if args.KeyType == nil || *args.KeyType == "" {
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.KeyType"}
}
routeValues["keyType"] = *args.KeyType
queryParams := url.Values{}
if args.ExpireCurrentSeconds != nil {
queryParams.Add("expireCurrentSeconds", strconv.Itoa(*args.ExpireCurrentSeconds))
}
locationId, _ := uuid.Parse("92ed5cf4-c38b-465a-9059-2f2fb7c624b5")
_, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return err
}
return nil
}
// Arguments for the GenerateKey function
type GenerateKeyArgs struct {
// (required)
KeyType *string
// (optional)
ExpireCurrentSeconds *int
}
// [Preview API]
func (client *ClientImpl) GetAcquisitionOptions(ctx context.Context, args GetAcquisitionOptionsArgs) (*AcquisitionOptions, error) {
routeValues := make(map[string]string)
if args.ItemId == nil || *args.ItemId == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ItemId"}
}
routeValues["itemId"] = *args.ItemId
queryParams := url.Values{}
if args.InstallationTarget == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "installationTarget"}
}
queryParams.Add("installationTarget", *args.InstallationTarget)
if args.TestCommerce != nil {
queryParams.Add("testCommerce", strconv.FormatBool(*args.TestCommerce))
}
if args.IsFreeOrTrialInstall != nil {
queryParams.Add("isFreeOrTrialInstall", strconv.FormatBool(*args.IsFreeOrTrialInstall))
}
locationId, _ := uuid.Parse("9d0a0105-075e-4760-aa15-8bcf54d1bd7d")
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue AcquisitionOptions
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the GetAcquisitionOptions function
type GetAcquisitionOptionsArgs struct {
// (required)
ItemId *string
// (required)
InstallationTarget *string
// (optional)
TestCommerce *bool
// (optional)
IsFreeOrTrialInstall *bool
}
// [Preview API]
func (client *ClientImpl) GetAsset(ctx context.Context, args GetAssetArgs) (io.ReadCloser, error) {
routeValues := make(map[string]string)
if args.ExtensionId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ExtensionId"}
}
routeValues["extensionId"] = (*args.ExtensionId).String()
if args.Version == nil || *args.Version == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Version"}
}
routeValues["version"] = *args.Version
if args.AssetType == nil || *args.AssetType == "" {
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.AssetType"}
}
routeValues["assetType"] = *args.AssetType
queryParams := url.Values{}
if args.AccountToken != nil {
queryParams.Add("accountToken", *args.AccountToken)
}
if args.AcceptDefault != nil {
queryParams.Add("acceptDefault", strconv.FormatBool(*args.AcceptDefault))
}
additionalHeaders := make(map[string]string)
if args.AccountTokenHeader != nil {
additionalHeaders["X-Market-AccountToken"] = *args.AccountTokenHeader
}
locationId, _ := uuid.Parse("5d545f3d-ef47-488b-8be3-f5ee1517856c")
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/octet-stream", additionalHeaders)
if err != nil {
return nil, err
}
return resp.Body, err
}
// Arguments for the GetAsset function
type GetAssetArgs struct {
// (required)
ExtensionId *uuid.UUID
// (required)
Version *string
// (required)
AssetType *string
// (optional)
AccountToken *string
// (optional)
AcceptDefault *bool
// (optional) Header to pass the account token
AccountTokenHeader *string
}
// [Preview API]
func (client *ClientImpl) GetAssetAuthenticated(ctx context.Context, args GetAssetAuthenticatedArgs) (io.ReadCloser, error) {
routeValues := make(map[string]string)
if args.PublisherName == nil || *args.PublisherName == "" {