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 package admin
57
58 import (
59 "bytes"
60 "context"
61 "encoding/json"
62 "errors"
63 "fmt"
64 "io"
65 "net/http"
66 "net/url"
67 "strconv"
68 "strings"
69
70 googleapi "google.golang.org/api/googleapi"
71 internal "google.golang.org/api/internal"
72 gensupport "google.golang.org/api/internal/gensupport"
73 option "google.golang.org/api/option"
74 internaloption "google.golang.org/api/option/internaloption"
75 htransport "google.golang.org/api/transport/http"
76 )
77
78
79
80 var _ = bytes.NewBuffer
81 var _ = strconv.Itoa
82 var _ = fmt.Sprintf
83 var _ = json.NewDecoder
84 var _ = io.Copy
85 var _ = url.Parse
86 var _ = gensupport.MarshalJSON
87 var _ = googleapi.Version
88 var _ = errors.New
89 var _ = strings.Replace
90 var _ = context.Canceled
91 var _ = internaloption.WithDefaultEndpoint
92 var _ = internal.Version
93
94 const apiId = "admin:datatransfer_v1"
95 const apiName = "admin"
96 const apiVersion = "datatransfer_v1"
97 const basePath = "https://admin.googleapis.com/"
98 const basePathTemplate = "https://admin.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://admin.mtls.googleapis.com/"
100
101
102 const (
103
104 AdminDatatransferScope = "https://www.googleapis.com/auth/admin.datatransfer"
105
106
107 AdminDatatransferReadonlyScope = "https://www.googleapis.com/auth/admin.datatransfer.readonly"
108 )
109
110
111 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
112 scopesOption := internaloption.WithDefaultScopes(
113 "https://www.googleapis.com/auth/admin.datatransfer",
114 "https://www.googleapis.com/auth/admin.datatransfer.readonly",
115 )
116
117 opts = append([]option.ClientOption{scopesOption}, opts...)
118 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
119 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
120 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
121 opts = append(opts, internaloption.EnableNewAuthLibrary())
122 client, endpoint, err := htransport.NewClient(ctx, opts...)
123 if err != nil {
124 return nil, err
125 }
126 s, err := New(client)
127 if err != nil {
128 return nil, err
129 }
130 if endpoint != "" {
131 s.BasePath = endpoint
132 }
133 return s, nil
134 }
135
136
137
138
139
140
141 func New(client *http.Client) (*Service, error) {
142 if client == nil {
143 return nil, errors.New("client is nil")
144 }
145 s := &Service{client: client, BasePath: basePath}
146 s.Applications = NewApplicationsService(s)
147 s.Transfers = NewTransfersService(s)
148 return s, nil
149 }
150
151 type Service struct {
152 client *http.Client
153 BasePath string
154 UserAgent string
155
156 Applications *ApplicationsService
157
158 Transfers *TransfersService
159 }
160
161 func (s *Service) userAgent() string {
162 if s.UserAgent == "" {
163 return googleapi.UserAgent
164 }
165 return googleapi.UserAgent + " " + s.UserAgent
166 }
167
168 func NewApplicationsService(s *Service) *ApplicationsService {
169 rs := &ApplicationsService{s: s}
170 return rs
171 }
172
173 type ApplicationsService struct {
174 s *Service
175 }
176
177 func NewTransfersService(s *Service) *TransfersService {
178 rs := &TransfersService{s: s}
179 return rs
180 }
181
182 type TransfersService struct {
183 s *Service
184 }
185
186
187
188 type Application struct {
189
190 Etag string `json:"etag,omitempty"`
191
192
193 Id int64 `json:"id,omitempty,string"`
194
195 Kind string `json:"kind,omitempty"`
196
197 Name string `json:"name,omitempty"`
198
199
200
201 TransferParams []*ApplicationTransferParam `json:"transferParams,omitempty"`
202
203
204 googleapi.ServerResponse `json:"-"`
205
206
207
208
209
210 ForceSendFields []string `json:"-"`
211
212
213
214
215 NullFields []string `json:"-"`
216 }
217
218 func (s *Application) MarshalJSON() ([]byte, error) {
219 type NoMethod Application
220 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
221 }
222
223
224
225 type ApplicationDataTransfer struct {
226
227 ApplicationId int64 `json:"applicationId,omitempty,string"`
228
229
230
231
232
233 ApplicationTransferParams []*ApplicationTransferParam `json:"applicationTransferParams,omitempty"`
234
235
236 ApplicationTransferStatus string `json:"applicationTransferStatus,omitempty"`
237
238
239
240
241
242 ForceSendFields []string `json:"-"`
243
244
245
246
247 NullFields []string `json:"-"`
248 }
249
250 func (s *ApplicationDataTransfer) MarshalJSON() ([]byte, error) {
251 type NoMethod ApplicationDataTransfer
252 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
253 }
254
255
256 type ApplicationTransferParam struct {
257
258 Key string `json:"key,omitempty"`
259
260 Value []string `json:"value,omitempty"`
261
262
263
264
265
266 ForceSendFields []string `json:"-"`
267
268
269
270
271 NullFields []string `json:"-"`
272 }
273
274 func (s *ApplicationTransferParam) MarshalJSON() ([]byte, error) {
275 type NoMethod ApplicationTransferParam
276 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
277 }
278
279
280 type ApplicationsListResponse struct {
281
282
283 Applications []*Application `json:"applications,omitempty"`
284
285 Etag string `json:"etag,omitempty"`
286
287 Kind string `json:"kind,omitempty"`
288
289 NextPageToken string `json:"nextPageToken,omitempty"`
290
291
292 googleapi.ServerResponse `json:"-"`
293
294
295
296
297
298 ForceSendFields []string `json:"-"`
299
300
301
302
303 NullFields []string `json:"-"`
304 }
305
306 func (s *ApplicationsListResponse) MarshalJSON() ([]byte, error) {
307 type NoMethod ApplicationsListResponse
308 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
309 }
310
311
312
313 type DataTransfer struct {
314
315
316
317
318 ApplicationDataTransfers []*ApplicationDataTransfer `json:"applicationDataTransfers,omitempty"`
319
320 Etag string `json:"etag,omitempty"`
321
322 Id string `json:"id,omitempty"`
323
324 Kind string `json:"kind,omitempty"`
325
326 NewOwnerUserId string `json:"newOwnerUserId,omitempty"`
327
328 OldOwnerUserId string `json:"oldOwnerUserId,omitempty"`
329
330 OverallTransferStatusCode string `json:"overallTransferStatusCode,omitempty"`
331
332 RequestTime string `json:"requestTime,omitempty"`
333
334
335 googleapi.ServerResponse `json:"-"`
336
337
338
339
340
341 ForceSendFields []string `json:"-"`
342
343
344
345
346 NullFields []string `json:"-"`
347 }
348
349 func (s *DataTransfer) MarshalJSON() ([]byte, error) {
350 type NoMethod DataTransfer
351 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
352 }
353
354
355
356 type DataTransfersListResponse struct {
357
358 DataTransfers []*DataTransfer `json:"dataTransfers,omitempty"`
359
360 Etag string `json:"etag,omitempty"`
361
362 Kind string `json:"kind,omitempty"`
363
364 NextPageToken string `json:"nextPageToken,omitempty"`
365
366
367 googleapi.ServerResponse `json:"-"`
368
369
370
371
372
373 ForceSendFields []string `json:"-"`
374
375
376
377
378 NullFields []string `json:"-"`
379 }
380
381 func (s *DataTransfersListResponse) MarshalJSON() ([]byte, error) {
382 type NoMethod DataTransfersListResponse
383 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
384 }
385
386 type ApplicationsGetCall struct {
387 s *Service
388 applicationId int64
389 urlParams_ gensupport.URLParams
390 ifNoneMatch_ string
391 ctx_ context.Context
392 header_ http.Header
393 }
394
395
396
397
398
399 func (r *ApplicationsService) Get(applicationId int64) *ApplicationsGetCall {
400 c := &ApplicationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
401 c.applicationId = applicationId
402 return c
403 }
404
405
406
407
408 func (c *ApplicationsGetCall) Fields(s ...googleapi.Field) *ApplicationsGetCall {
409 c.urlParams_.Set("fields", googleapi.CombineFields(s))
410 return c
411 }
412
413
414
415
416 func (c *ApplicationsGetCall) IfNoneMatch(entityTag string) *ApplicationsGetCall {
417 c.ifNoneMatch_ = entityTag
418 return c
419 }
420
421
422 func (c *ApplicationsGetCall) Context(ctx context.Context) *ApplicationsGetCall {
423 c.ctx_ = ctx
424 return c
425 }
426
427
428
429 func (c *ApplicationsGetCall) Header() http.Header {
430 if c.header_ == nil {
431 c.header_ = make(http.Header)
432 }
433 return c.header_
434 }
435
436 func (c *ApplicationsGetCall) doRequest(alt string) (*http.Response, error) {
437 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
438 if c.ifNoneMatch_ != "" {
439 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
440 }
441 var body io.Reader = nil
442 c.urlParams_.Set("alt", alt)
443 c.urlParams_.Set("prettyPrint", "false")
444 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/datatransfer/v1/applications/{applicationId}")
445 urls += "?" + c.urlParams_.Encode()
446 req, err := http.NewRequest("GET", urls, body)
447 if err != nil {
448 return nil, err
449 }
450 req.Header = reqHeaders
451 googleapi.Expand(req.URL, map[string]string{
452 "applicationId": strconv.FormatInt(c.applicationId, 10),
453 })
454 return gensupport.SendRequest(c.ctx_, c.s.client, req)
455 }
456
457
458
459
460
461
462 func (c *ApplicationsGetCall) Do(opts ...googleapi.CallOption) (*Application, error) {
463 gensupport.SetOptions(c.urlParams_, opts...)
464 res, err := c.doRequest("json")
465 if res != nil && res.StatusCode == http.StatusNotModified {
466 if res.Body != nil {
467 res.Body.Close()
468 }
469 return nil, gensupport.WrapError(&googleapi.Error{
470 Code: res.StatusCode,
471 Header: res.Header,
472 })
473 }
474 if err != nil {
475 return nil, err
476 }
477 defer googleapi.CloseBody(res)
478 if err := googleapi.CheckResponse(res); err != nil {
479 return nil, gensupport.WrapError(err)
480 }
481 ret := &Application{
482 ServerResponse: googleapi.ServerResponse{
483 Header: res.Header,
484 HTTPStatusCode: res.StatusCode,
485 },
486 }
487 target := &ret
488 if err := gensupport.DecodeResponse(target, res); err != nil {
489 return nil, err
490 }
491 return ret, nil
492 }
493
494 type ApplicationsListCall struct {
495 s *Service
496 urlParams_ gensupport.URLParams
497 ifNoneMatch_ string
498 ctx_ context.Context
499 header_ http.Header
500 }
501
502
503 func (r *ApplicationsService) List() *ApplicationsListCall {
504 c := &ApplicationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
505 return c
506 }
507
508
509
510 func (c *ApplicationsListCall) CustomerId(customerId string) *ApplicationsListCall {
511 c.urlParams_.Set("customerId", customerId)
512 return c
513 }
514
515
516
517 func (c *ApplicationsListCall) MaxResults(maxResults int64) *ApplicationsListCall {
518 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
519 return c
520 }
521
522
523
524 func (c *ApplicationsListCall) PageToken(pageToken string) *ApplicationsListCall {
525 c.urlParams_.Set("pageToken", pageToken)
526 return c
527 }
528
529
530
531
532 func (c *ApplicationsListCall) Fields(s ...googleapi.Field) *ApplicationsListCall {
533 c.urlParams_.Set("fields", googleapi.CombineFields(s))
534 return c
535 }
536
537
538
539
540 func (c *ApplicationsListCall) IfNoneMatch(entityTag string) *ApplicationsListCall {
541 c.ifNoneMatch_ = entityTag
542 return c
543 }
544
545
546 func (c *ApplicationsListCall) Context(ctx context.Context) *ApplicationsListCall {
547 c.ctx_ = ctx
548 return c
549 }
550
551
552
553 func (c *ApplicationsListCall) Header() http.Header {
554 if c.header_ == nil {
555 c.header_ = make(http.Header)
556 }
557 return c.header_
558 }
559
560 func (c *ApplicationsListCall) doRequest(alt string) (*http.Response, error) {
561 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
562 if c.ifNoneMatch_ != "" {
563 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
564 }
565 var body io.Reader = nil
566 c.urlParams_.Set("alt", alt)
567 c.urlParams_.Set("prettyPrint", "false")
568 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/datatransfer/v1/applications")
569 urls += "?" + c.urlParams_.Encode()
570 req, err := http.NewRequest("GET", urls, body)
571 if err != nil {
572 return nil, err
573 }
574 req.Header = reqHeaders
575 return gensupport.SendRequest(c.ctx_, c.s.client, req)
576 }
577
578
579
580
581
582
583
584 func (c *ApplicationsListCall) Do(opts ...googleapi.CallOption) (*ApplicationsListResponse, error) {
585 gensupport.SetOptions(c.urlParams_, opts...)
586 res, err := c.doRequest("json")
587 if res != nil && res.StatusCode == http.StatusNotModified {
588 if res.Body != nil {
589 res.Body.Close()
590 }
591 return nil, gensupport.WrapError(&googleapi.Error{
592 Code: res.StatusCode,
593 Header: res.Header,
594 })
595 }
596 if err != nil {
597 return nil, err
598 }
599 defer googleapi.CloseBody(res)
600 if err := googleapi.CheckResponse(res); err != nil {
601 return nil, gensupport.WrapError(err)
602 }
603 ret := &ApplicationsListResponse{
604 ServerResponse: googleapi.ServerResponse{
605 Header: res.Header,
606 HTTPStatusCode: res.StatusCode,
607 },
608 }
609 target := &ret
610 if err := gensupport.DecodeResponse(target, res); err != nil {
611 return nil, err
612 }
613 return ret, nil
614 }
615
616
617
618
619 func (c *ApplicationsListCall) Pages(ctx context.Context, f func(*ApplicationsListResponse) error) error {
620 c.ctx_ = ctx
621 defer c.PageToken(c.urlParams_.Get("pageToken"))
622 for {
623 x, err := c.Do()
624 if err != nil {
625 return err
626 }
627 if err := f(x); err != nil {
628 return err
629 }
630 if x.NextPageToken == "" {
631 return nil
632 }
633 c.PageToken(x.NextPageToken)
634 }
635 }
636
637 type TransfersGetCall struct {
638 s *Service
639 dataTransferId string
640 urlParams_ gensupport.URLParams
641 ifNoneMatch_ string
642 ctx_ context.Context
643 header_ http.Header
644 }
645
646
647
648
649
650 func (r *TransfersService) Get(dataTransferId string) *TransfersGetCall {
651 c := &TransfersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
652 c.dataTransferId = dataTransferId
653 return c
654 }
655
656
657
658
659 func (c *TransfersGetCall) Fields(s ...googleapi.Field) *TransfersGetCall {
660 c.urlParams_.Set("fields", googleapi.CombineFields(s))
661 return c
662 }
663
664
665
666
667 func (c *TransfersGetCall) IfNoneMatch(entityTag string) *TransfersGetCall {
668 c.ifNoneMatch_ = entityTag
669 return c
670 }
671
672
673 func (c *TransfersGetCall) Context(ctx context.Context) *TransfersGetCall {
674 c.ctx_ = ctx
675 return c
676 }
677
678
679
680 func (c *TransfersGetCall) Header() http.Header {
681 if c.header_ == nil {
682 c.header_ = make(http.Header)
683 }
684 return c.header_
685 }
686
687 func (c *TransfersGetCall) doRequest(alt string) (*http.Response, error) {
688 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
689 if c.ifNoneMatch_ != "" {
690 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
691 }
692 var body io.Reader = nil
693 c.urlParams_.Set("alt", alt)
694 c.urlParams_.Set("prettyPrint", "false")
695 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/datatransfer/v1/transfers/{dataTransferId}")
696 urls += "?" + c.urlParams_.Encode()
697 req, err := http.NewRequest("GET", urls, body)
698 if err != nil {
699 return nil, err
700 }
701 req.Header = reqHeaders
702 googleapi.Expand(req.URL, map[string]string{
703 "dataTransferId": c.dataTransferId,
704 })
705 return gensupport.SendRequest(c.ctx_, c.s.client, req)
706 }
707
708
709
710
711
712
713 func (c *TransfersGetCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
714 gensupport.SetOptions(c.urlParams_, opts...)
715 res, err := c.doRequest("json")
716 if res != nil && res.StatusCode == http.StatusNotModified {
717 if res.Body != nil {
718 res.Body.Close()
719 }
720 return nil, gensupport.WrapError(&googleapi.Error{
721 Code: res.StatusCode,
722 Header: res.Header,
723 })
724 }
725 if err != nil {
726 return nil, err
727 }
728 defer googleapi.CloseBody(res)
729 if err := googleapi.CheckResponse(res); err != nil {
730 return nil, gensupport.WrapError(err)
731 }
732 ret := &DataTransfer{
733 ServerResponse: googleapi.ServerResponse{
734 Header: res.Header,
735 HTTPStatusCode: res.StatusCode,
736 },
737 }
738 target := &ret
739 if err := gensupport.DecodeResponse(target, res); err != nil {
740 return nil, err
741 }
742 return ret, nil
743 }
744
745 type TransfersInsertCall struct {
746 s *Service
747 datatransfer *DataTransfer
748 urlParams_ gensupport.URLParams
749 ctx_ context.Context
750 header_ http.Header
751 }
752
753
754
755
756 func (r *TransfersService) Insert(datatransfer *DataTransfer) *TransfersInsertCall {
757 c := &TransfersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
758 c.datatransfer = datatransfer
759 return c
760 }
761
762
763
764
765 func (c *TransfersInsertCall) Fields(s ...googleapi.Field) *TransfersInsertCall {
766 c.urlParams_.Set("fields", googleapi.CombineFields(s))
767 return c
768 }
769
770
771 func (c *TransfersInsertCall) Context(ctx context.Context) *TransfersInsertCall {
772 c.ctx_ = ctx
773 return c
774 }
775
776
777
778 func (c *TransfersInsertCall) Header() http.Header {
779 if c.header_ == nil {
780 c.header_ = make(http.Header)
781 }
782 return c.header_
783 }
784
785 func (c *TransfersInsertCall) doRequest(alt string) (*http.Response, error) {
786 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
787 var body io.Reader = nil
788 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datatransfer)
789 if err != nil {
790 return nil, err
791 }
792 c.urlParams_.Set("alt", alt)
793 c.urlParams_.Set("prettyPrint", "false")
794 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/datatransfer/v1/transfers")
795 urls += "?" + c.urlParams_.Encode()
796 req, err := http.NewRequest("POST", urls, body)
797 if err != nil {
798 return nil, err
799 }
800 req.Header = reqHeaders
801 return gensupport.SendRequest(c.ctx_, c.s.client, req)
802 }
803
804
805
806
807
808
809 func (c *TransfersInsertCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
810 gensupport.SetOptions(c.urlParams_, opts...)
811 res, err := c.doRequest("json")
812 if res != nil && res.StatusCode == http.StatusNotModified {
813 if res.Body != nil {
814 res.Body.Close()
815 }
816 return nil, gensupport.WrapError(&googleapi.Error{
817 Code: res.StatusCode,
818 Header: res.Header,
819 })
820 }
821 if err != nil {
822 return nil, err
823 }
824 defer googleapi.CloseBody(res)
825 if err := googleapi.CheckResponse(res); err != nil {
826 return nil, gensupport.WrapError(err)
827 }
828 ret := &DataTransfer{
829 ServerResponse: googleapi.ServerResponse{
830 Header: res.Header,
831 HTTPStatusCode: res.StatusCode,
832 },
833 }
834 target := &ret
835 if err := gensupport.DecodeResponse(target, res); err != nil {
836 return nil, err
837 }
838 return ret, nil
839 }
840
841 type TransfersListCall struct {
842 s *Service
843 urlParams_ gensupport.URLParams
844 ifNoneMatch_ string
845 ctx_ context.Context
846 header_ http.Header
847 }
848
849
850
851 func (r *TransfersService) List() *TransfersListCall {
852 c := &TransfersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
853 return c
854 }
855
856
857
858 func (c *TransfersListCall) CustomerId(customerId string) *TransfersListCall {
859 c.urlParams_.Set("customerId", customerId)
860 return c
861 }
862
863
864
865 func (c *TransfersListCall) MaxResults(maxResults int64) *TransfersListCall {
866 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
867 return c
868 }
869
870
871
872 func (c *TransfersListCall) NewOwnerUserId(newOwnerUserId string) *TransfersListCall {
873 c.urlParams_.Set("newOwnerUserId", newOwnerUserId)
874 return c
875 }
876
877
878
879 func (c *TransfersListCall) OldOwnerUserId(oldOwnerUserId string) *TransfersListCall {
880 c.urlParams_.Set("oldOwnerUserId", oldOwnerUserId)
881 return c
882 }
883
884
885
886 func (c *TransfersListCall) PageToken(pageToken string) *TransfersListCall {
887 c.urlParams_.Set("pageToken", pageToken)
888 return c
889 }
890
891
892 func (c *TransfersListCall) Status(status string) *TransfersListCall {
893 c.urlParams_.Set("status", status)
894 return c
895 }
896
897
898
899
900 func (c *TransfersListCall) Fields(s ...googleapi.Field) *TransfersListCall {
901 c.urlParams_.Set("fields", googleapi.CombineFields(s))
902 return c
903 }
904
905
906
907
908 func (c *TransfersListCall) IfNoneMatch(entityTag string) *TransfersListCall {
909 c.ifNoneMatch_ = entityTag
910 return c
911 }
912
913
914 func (c *TransfersListCall) Context(ctx context.Context) *TransfersListCall {
915 c.ctx_ = ctx
916 return c
917 }
918
919
920
921 func (c *TransfersListCall) Header() http.Header {
922 if c.header_ == nil {
923 c.header_ = make(http.Header)
924 }
925 return c.header_
926 }
927
928 func (c *TransfersListCall) doRequest(alt string) (*http.Response, error) {
929 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
930 if c.ifNoneMatch_ != "" {
931 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
932 }
933 var body io.Reader = nil
934 c.urlParams_.Set("alt", alt)
935 c.urlParams_.Set("prettyPrint", "false")
936 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/datatransfer/v1/transfers")
937 urls += "?" + c.urlParams_.Encode()
938 req, err := http.NewRequest("GET", urls, body)
939 if err != nil {
940 return nil, err
941 }
942 req.Header = reqHeaders
943 return gensupport.SendRequest(c.ctx_, c.s.client, req)
944 }
945
946
947
948
949
950
951
952 func (c *TransfersListCall) Do(opts ...googleapi.CallOption) (*DataTransfersListResponse, error) {
953 gensupport.SetOptions(c.urlParams_, opts...)
954 res, err := c.doRequest("json")
955 if res != nil && res.StatusCode == http.StatusNotModified {
956 if res.Body != nil {
957 res.Body.Close()
958 }
959 return nil, gensupport.WrapError(&googleapi.Error{
960 Code: res.StatusCode,
961 Header: res.Header,
962 })
963 }
964 if err != nil {
965 return nil, err
966 }
967 defer googleapi.CloseBody(res)
968 if err := googleapi.CheckResponse(res); err != nil {
969 return nil, gensupport.WrapError(err)
970 }
971 ret := &DataTransfersListResponse{
972 ServerResponse: googleapi.ServerResponse{
973 Header: res.Header,
974 HTTPStatusCode: res.StatusCode,
975 },
976 }
977 target := &ret
978 if err := gensupport.DecodeResponse(target, res); err != nil {
979 return nil, err
980 }
981 return ret, nil
982 }
983
984
985
986
987 func (c *TransfersListCall) Pages(ctx context.Context, f func(*DataTransfersListResponse) error) error {
988 c.ctx_ = ctx
989 defer c.PageToken(c.urlParams_.Get("pageToken"))
990 for {
991 x, err := c.Do()
992 if err != nil {
993 return err
994 }
995 if err := f(x); err != nil {
996 return err
997 }
998 if x.NextPageToken == "" {
999 return nil
1000 }
1001 c.PageToken(x.NextPageToken)
1002 }
1003 }
1004
View as plain text