forked from vapor-community/google-cloud-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalTestGen.swift
1833 lines (1716 loc) · 105 KB
/
CalTestGen.swift
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
// This is Generated Code
import Foundation
import AsyncHTTPClient
import NIO
import Core
import NIOFoundationCompat
import NIOHTTP1
import CodableWrappers
public enum GoogleCloudCalendarScope : GoogleCloudAPIScope {
public var value : String {
switch self {
case .CalendarReadonly: return "https://www.googleapis.com/auth/calendar.readonly"
case .CalendarSettingsReadonly: return "https://www.googleapis.com/auth/calendar.settings.readonly"
case .CalendarEventsReadonly: return "https://www.googleapis.com/auth/calendar.events.readonly"
case .Calendar: return "https://www.googleapis.com/auth/calendar"
case .CalendarEvents: return "https://www.googleapis.com/auth/calendar.events"
}
}
case CalendarReadonly // View your calendars
case CalendarSettingsReadonly // View your Calendar settings
case CalendarEventsReadonly // View events on all your calendars
case Calendar // See, edit, share, and permanently delete all the calendars you can access using Google Calendar
case CalendarEvents // View and edit events on all your calendars
}
public struct GoogleCloudCalendarConfiguration : GoogleCloudAPIConfiguration {
public var scope : [GoogleCloudAPIScope]
public var serviceAccount: String
public var project: String?
public var subscription: String?
public init(scope: [GoogleCloudCalendarScope], serviceAccount : String, project: String?, subscription: String?) {
self.scope = scope
self.serviceAccount = serviceAccount
self.project = project
self.subscription = subscription
}
}
public final class GoogleCloudCalendarRequest : GoogleCloudAPIRequest {
public var refreshableToken: OAuthRefreshable
public var project: String
public var httpClient: HTTPClient
public var responseDecoder: JSONDecoder = JSONDecoder()
public var currentToken: OAuthAccessToken?
public var tokenCreatedTime: Date?
private let eventLoop : EventLoop
init(httpClient: HTTPClient, eventLoop: EventLoop, oauth: OAuthRefreshable, project: String) {
self.refreshableToken = oauth
self.project = project
self.httpClient = httpClient
self.eventLoop = eventLoop
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
self.responseDecoder.dateDecodingStrategy = .formatted(dateFormatter)
}
public func send<GCM: GoogleCloudModel>(method: HTTPMethod, headers: HTTPHeaders = [:], path: String, query: String = "", body: HTTPClient.Body = .data(Data())) -> EventLoopFuture<GCM> {
return withToken { token in
return self._send(method: method, headers: headers, path: path, query: query, body: body, accessToken: token.accessToken).flatMap { response in
do {
if GCM.self is GoogleCloudDataResponse.Type {
let model = GoogleCloudDataResponse(data: response) as! GCM
return self.eventLoop.makeSucceededFuture(model)
} else {
let model = try self.responseDecoder.decode(GCM.self, from: response)
return self.eventLoop.makeSucceededFuture(model)
}
} catch {
return self.eventLoop.makeFailedFuture(error)
}
}
}
}
private func _send(method: HTTPMethod, headers: HTTPHeaders, path: String, query: String, body: HTTPClient.Body, accessToken: String) -> EventLoopFuture<Data> {
var _headers: HTTPHeaders = ["Authorization": "Bearer \(accessToken)",
"Content-Type": "application/json"]
headers.forEach { _headers.replaceOrAdd(name: $0.name, value: $0.value) }
do {
let request = try HTTPClient.Request(url: "\(path)?\(query)", method: method, headers: _headers, body: body)
return httpClient.execute(request: request, eventLoop: .delegate(on: self.eventLoop)).flatMap { response in
// If we get a 204 for example in the delete api call just return an empty body to decode.
// https://cloud.google.com/s/results/?q=If+successful%2C+this+method+returns+an+empty+response+body.&p=%2Fstorage%2Fdocs%2F
if response.status == .noContent {
return self.eventLoop.makeSucceededFuture("{}".data(using: .utf8)!)
}
guard var byteBuffer = response.body else {
fatalError("Response body from Google is missing! This should never happen.")
}
let responseData = byteBuffer.readData(length: byteBuffer.readableBytes)!
guard (200...299).contains(response.status.code) else {
let error: Error
if let jsonError = try? self.responseDecoder.decode(GoogleCloudAPIErrorMain.self, from: responseData) {
error = jsonError
} else {
let body = response.body?.getString(at: response.body?.readerIndex ?? 0, length: response.body?.readableBytes ?? 0) ?? ""
error = GoogleCloudAPIErrorMain(error: GoogleCloudAPIErrorBody(errors: [], code: Int(response.status.code), message: body))
}
return self.eventLoop.makeFailedFuture(error)
}
return self.eventLoop.makeSucceededFuture(responseData)
}
} catch {
return self.eventLoop.makeFailedFuture(error)
}
}
}
public final class GoogleCloudCalendarAclAPI : CalendarAclAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Deletes an access control rule.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter ruleId: ACL rule identifier.
public func delete(calendarId : String, ruleId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .DELETE, path: "\(endpoint)calendars/\(calendarId)/acl/\(ruleId)", query: queryParams)
}
/// Returns an access control rule.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter ruleId: ACL rule identifier.
public func get(calendarId : String, ruleId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)/acl/\(ruleId)", query: queryParams)
}
/// Creates an access control rule.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func insert(calendarId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/acl", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Returns the rules in the access control list for the calendar.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func list(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAcl> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)/acl", query: queryParams)
}
/// Updates an access control rule. This method supports patch semantics.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter ruleId: ACL rule identifier.
public func patch(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PATCH, path: "\(endpoint)calendars/\(calendarId)/acl/\(ruleId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Updates an access control rule.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter ruleId: ACL rule identifier.
public func update(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PUT, path: "\(endpoint)calendars/\(calendarId)/acl/\(ruleId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Watch for changes to ACL resources.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/acl/watch", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarAclAPIProtocol {
/// Deletes an access control rule.
func delete(calendarId : String, ruleId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
/// Returns an access control rule.
func get(calendarId : String, ruleId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule>
/// Creates an access control rule.
func insert(calendarId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule>
/// Returns the rules in the access control list for the calendar.
func list(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAcl>
/// Updates an access control rule. This method supports patch semantics.
func patch(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule>
/// Updates an access control rule.
func update(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarAclRule>
/// Watch for changes to ACL resources.
func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel>
}
extension CalendarAclAPIProtocol {
public func delete(calendarId : String, ruleId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
delete(calendarId: calendarId,ruleId: ruleId, queryParameters: queryParameters)
}
public func get(calendarId : String, ruleId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
get(calendarId: calendarId,ruleId: ruleId, queryParameters: queryParameters)
}
public func insert(calendarId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
insert(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func list(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarAcl> {
list(calendarId: calendarId, queryParameters: queryParameters)
}
public func patch(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
patch(calendarId: calendarId,ruleId: ruleId, body: body, queryParameters: queryParameters)
}
public func update(calendarId : String, ruleId : String, body : GoogleCloudCalendarAclRule, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarAclRule> {
update(calendarId: calendarId,ruleId: ruleId, body: body, queryParameters: queryParameters)
}
public func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarChannel> {
watch(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarCalendarListAPI : CalendarCalendarListAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Removes a calendar from the user's calendar list.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func delete(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .DELETE, path: "\(endpoint)users/me/calendarList/\(calendarId)", query: queryParams)
}
/// Returns a calendar from the user's calendar list.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func get(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)users/me/calendarList/\(calendarId)", query: queryParams)
}
/// Inserts an existing calendar into the user's calendar list.
public func insert(body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)users/me/calendarList", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Returns the calendars on the user's calendar list.
public func list( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarList> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)users/me/calendarList", query: queryParams)
}
/// Updates an existing calendar on the user's calendar list. This method supports patch semantics.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func patch(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PATCH, path: "\(endpoint)users/me/calendarList/\(calendarId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Updates an existing calendar on the user's calendar list.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func update(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PUT, path: "\(endpoint)users/me/calendarList/\(calendarId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Watch for changes to CalendarList resources.
public func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)users/me/calendarList/watch", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarCalendarListAPIProtocol {
/// Removes a calendar from the user's calendar list.
func delete(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
/// Returns a calendar from the user's calendar list.
func get(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry>
/// Inserts an existing calendar into the user's calendar list.
func insert(body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry>
/// Returns the calendars on the user's calendar list.
func list( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarList>
/// Updates an existing calendar on the user's calendar list. This method supports patch semantics.
func patch(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry>
/// Updates an existing calendar on the user's calendar list.
func update(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry>
/// Watch for changes to CalendarList resources.
func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel>
}
extension CalendarCalendarListAPIProtocol {
public func delete(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
delete(calendarId: calendarId, queryParameters: queryParameters)
}
public func get(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
get(calendarId: calendarId, queryParameters: queryParameters)
}
public func insert(body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
insert( body: body, queryParameters: queryParameters)
}
public func list( queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendarList> {
list( queryParameters: queryParameters)
}
public func patch(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
patch(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func update(calendarId : String, body : GoogleCloudCalendarCalendarListEntry, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendarListEntry> {
update(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarChannel> {
watch( body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarCalendarsAPI : CalendarCalendarsAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func clear(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/clear", query: queryParams)
}
/// Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func delete(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .DELETE, path: "\(endpoint)calendars/\(calendarId)", query: queryParams)
}
/// Returns metadata for a calendar.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func get(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)", query: queryParams)
}
/// Creates a secondary calendar.
public func insert(body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Updates metadata for a calendar. This method supports patch semantics.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func patch(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PATCH, path: "\(endpoint)calendars/\(calendarId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Updates metadata for a calendar.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func update(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PUT, path: "\(endpoint)calendars/\(calendarId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarCalendarsAPIProtocol {
/// Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
func clear(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
/// Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
func delete(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
/// Returns metadata for a calendar.
func get(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar>
/// Creates a secondary calendar.
func insert(body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar>
/// Updates metadata for a calendar. This method supports patch semantics.
func patch(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar>
/// Updates metadata for a calendar.
func update(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarCalendar>
}
extension CalendarCalendarsAPIProtocol {
public func clear(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
clear(calendarId: calendarId, queryParameters: queryParameters)
}
public func delete(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
delete(calendarId: calendarId, queryParameters: queryParameters)
}
public func get(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
get(calendarId: calendarId, queryParameters: queryParameters)
}
public func insert(body : GoogleCloudCalendarCalendar, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
insert( body: body, queryParameters: queryParameters)
}
public func patch(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
patch(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func update(calendarId : String, body : GoogleCloudCalendarCalendar, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarCalendar> {
update(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarChannelsAPI : CalendarChannelsAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Stop watching resources through this channel
public func stop(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)channels/stop", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarChannelsAPIProtocol {
/// Stop watching resources through this channel
func stop(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
}
extension CalendarChannelsAPIProtocol {
public func stop(body : GoogleCloudCalendarChannel, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
stop( body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarColorsAPI : CalendarColorsAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Returns the color definitions for calendars and events.
public func get( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarColors> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)colors", query: queryParams)
}
}
public protocol CalendarColorsAPIProtocol {
/// Returns the color definitions for calendars and events.
func get( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarColors>
}
extension CalendarColorsAPIProtocol {
public func get( queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarColors> {
get( queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarEventsAPI : CalendarEventsAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Deletes an event.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter eventId: Event identifier.
public func delete(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .DELETE, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)", query: queryParams)
}
/// Returns an event.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter eventId: Event identifier.
public func get(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)", query: queryParams)
}
/// Imports an event. This operation is used to add a private copy of an existing event to a calendar.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func `import`(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/events/import", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Creates an event.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func insert(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/events", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Returns instances of the specified recurring event.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter eventId: Recurring event identifier.
public func instances(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvents> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)/instances", query: queryParams)
}
/// Returns events on the specified calendar.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func list(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvents> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)calendars/\(calendarId)/events", query: queryParams)
}
/// Moves an event to another calendar, i.e. changes an event's organizer.
/// - Parameter calendarId: Calendar identifier of the source calendar where the event currently is on.
/// - Parameter eventId: Event identifier.
/// - Parameter destination: Calendar identifier of the target calendar where the event is to be moved to.
public func move(calendarId : String, eventId : String, destination : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)/move", query: queryParams)
}
/// Updates an event. This method supports patch semantics.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter eventId: Event identifier.
public func patch(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PATCH, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Creates an event based on a simple text string.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter text: The text describing the event to be created.
public func quickAdd(calendarId : String, text : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/events/quickAdd", query: queryParams)
}
/// Updates an event.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
/// - Parameter eventId: Event identifier.
public func update(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .PUT, path: "\(endpoint)calendars/\(calendarId)/events/\(eventId)", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
/// Watch for changes to Events resources.
/// - Parameter calendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.
public func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)calendars/\(calendarId)/events/watch", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarEventsAPIProtocol {
/// Deletes an event.
func delete(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse>
/// Returns an event.
func get(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Imports an event. This operation is used to add a private copy of an existing event to a calendar.
func `import`(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Creates an event.
func insert(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Returns instances of the specified recurring event.
func instances(calendarId : String, eventId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvents>
/// Returns events on the specified calendar.
func list(calendarId : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvents>
/// Moves an event to another calendar, i.e. changes an event's organizer.
func move(calendarId : String, eventId : String, destination : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Updates an event. This method supports patch semantics.
func patch(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Creates an event based on a simple text string.
func quickAdd(calendarId : String, text : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Updates an event.
func update(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarEvent>
/// Watch for changes to Events resources.
func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel>
}
extension CalendarEventsAPIProtocol {
public func delete(calendarId : String, eventId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEmptyResponse> {
delete(calendarId: calendarId,eventId: eventId, queryParameters: queryParameters)
}
public func get(calendarId : String, eventId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
get(calendarId: calendarId,eventId: eventId, queryParameters: queryParameters)
}
public func `import`(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
`import`(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func insert(calendarId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
insert(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
public func instances(calendarId : String, eventId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvents> {
instances(calendarId: calendarId,eventId: eventId, queryParameters: queryParameters)
}
public func list(calendarId : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvents> {
list(calendarId: calendarId, queryParameters: queryParameters)
}
public func move(calendarId : String, eventId : String, destination : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
move(calendarId: calendarId,eventId: eventId,destination: destination, queryParameters: queryParameters)
}
public func patch(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
patch(calendarId: calendarId,eventId: eventId, body: body, queryParameters: queryParameters)
}
public func quickAdd(calendarId : String, text : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
quickAdd(calendarId: calendarId,text: text, queryParameters: queryParameters)
}
public func update(calendarId : String, eventId : String, body : GoogleCloudCalendarEvent, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarEvent> {
update(calendarId: calendarId,eventId: eventId, body: body, queryParameters: queryParameters)
}
public func watch(calendarId : String, body : GoogleCloudCalendarChannel, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarChannel> {
watch(calendarId: calendarId, body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarFreebusyAPI : CalendarFreebusyAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Returns free/busy information for a set of calendars.
public func query(body : GoogleCloudCalendarFreeBusyRequest, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarFreeBusyResponse> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)freeBusy", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarFreebusyAPIProtocol {
/// Returns free/busy information for a set of calendars.
func query(body : GoogleCloudCalendarFreeBusyRequest, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarFreeBusyResponse>
}
extension CalendarFreebusyAPIProtocol {
public func query(body : GoogleCloudCalendarFreeBusyRequest, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarFreeBusyResponse> {
query( body: body, queryParameters: queryParameters)
}
}
public final class GoogleCloudCalendarSettingsAPI : CalendarSettingsAPIProtocol {
let endpoint = "https://www.googleapis.com/calendar/v3/"
let request : GoogleCloudCalendarRequest
init(request: GoogleCloudCalendarRequest) {
self.request = request
}
/// Returns a single user setting.
/// - Parameter setting: The id of the user setting.
public func get(setting : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarSetting> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)users/me/settings/\(setting)", query: queryParams)
}
/// Returns all user settings for the authenticated user.
public func list( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarSettings> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
return request.send(method: .GET, path: "\(endpoint)users/me/settings", query: queryParams)
}
/// Watch for changes to Settings resources.
public func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel> {
var queryParams = ""
if let queryParameters = queryParameters {
queryParams = queryParameters.queryParameters
}
do {
let data = try JSONEncoder().encode(body)
return request.send(method: .POST, path: "\(endpoint)users/me/settings/watch", query: queryParams, body: .data(data))
} catch {
return request.httpClient.eventLoopGroup.next().makeFailedFuture(error)
}
}
}
public protocol CalendarSettingsAPIProtocol {
/// Returns a single user setting.
func get(setting : String, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarSetting>
/// Returns all user settings for the authenticated user.
func list( queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarSettings>
/// Watch for changes to Settings resources.
func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]?) -> EventLoopFuture<GoogleCloudCalendarChannel>
}
extension CalendarSettingsAPIProtocol {
public func get(setting : String, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarSetting> {
get(setting: setting, queryParameters: queryParameters)
}
public func list( queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarSettings> {
list( queryParameters: queryParameters)
}
public func watch(body : GoogleCloudCalendarChannel, queryParameters: [String: String]? = nil) -> EventLoopFuture<GoogleCloudCalendarChannel> {
watch( body: body, queryParameters: queryParameters)
}
}
public struct GoogleCloudCalendarEmptyResponse : GoogleCloudModel {}
public struct GoogleCloudCalendarAcl : GoogleCloudModel {
/*ETag of the collection. */
public var etag: String?
/*List of rules on the access control list. */
public var items: [GoogleCloudCalendarAclRule]?
/*Type of the collection ("calendar#acl"). */
public var kind: String?
/*Token used to access the next page of this result. Omitted if no further results are available, in which case nextSyncToken is provided. */
public var nextPageToken: String?
/*Token used at a later point in time to retrieve only the entries that have changed since this result was returned. Omitted if further results are available, in which case nextPageToken is provided. */
public var nextSyncToken: String?
public init(etag:String?, items:[GoogleCloudCalendarAclRule]?, kind:String?, nextPageToken:String?, nextSyncToken:String?) {
self.etag = etag
self.items = items
self.kind = kind
self.nextPageToken = nextPageToken
self.nextSyncToken = nextSyncToken
}
}
public struct GoogleCloudCalendarAclRule : GoogleCloudModel {
/*ETag of the resource. */
public var etag: String?
/*Identifier of the ACL rule. */
public var id: String?
/*Type of the resource ("calendar#aclRule"). */
public var kind: String?
/*The role assigned to the scope. Possible values are:
- "none" - Provides no access.
- "freeBusyReader" - Provides read access to free/busy information.
- "reader" - Provides read access to the calendar. Private events will appear to users with reader access, but event details will be hidden.
- "writer" - Provides read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible.
- "owner" - Provides ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to see and manipulate ACLs. */
public var role: String?
/*The scope of the rule. */
public var scope: GoogleCloudCalendarAclRuleScope?
public init(etag:String?, id:String?, kind:String?, role:String?, scope:GoogleCloudCalendarAclRuleScope?) {
self.etag = etag
self.id = id
self.kind = kind
self.role = role
self.scope = scope
}
}
public struct GoogleCloudCalendarCalendar : GoogleCloudModel {
/*Conferencing properties for this calendar, for example what types of conferences are allowed. */
public var conferenceProperties: GoogleCloudCalendarConferenceProperties?
/*Description of the calendar. Optional. */
public var description: String?
/*ETag of the resource. */
public var etag: String?
/*Identifier of the calendar. To retrieve IDs call the calendarList.list() method. */
public var id: String?
/*Type of the resource ("calendar#calendar"). */
public var kind: String?
/*Geographic location of the calendar as free-form text. Optional. */
public var location: String?
/*Title of the calendar. */
public var summary: String?
/*The time zone of the calendar. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) Optional. */
public var timeZone: String?
public init(conferenceProperties:GoogleCloudCalendarConferenceProperties?, description:String?, etag:String?, id:String?, kind:String?, location:String?, summary:String?, timeZone:String?) {
self.conferenceProperties = conferenceProperties
self.description = description
self.etag = etag
self.id = id
self.kind = kind
self.location = location
self.summary = summary
self.timeZone = timeZone
}
}
public struct GoogleCloudCalendarCalendarList : GoogleCloudModel {
/*ETag of the collection. */
public var etag: String?
/*Calendars that are present on the user's calendar list. */
public var items: [GoogleCloudCalendarCalendarListEntry]?
/*Type of the collection ("calendar#calendarList"). */
public var kind: String?
/*Token used to access the next page of this result. Omitted if no further results are available, in which case nextSyncToken is provided. */
public var nextPageToken: String?
/*Token used at a later point in time to retrieve only the entries that have changed since this result was returned. Omitted if further results are available, in which case nextPageToken is provided. */