google-calendar-apimatic-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +168 -0
  4. data/bin/console +15 -0
  5. data/lib/calendar_api/api_helper.rb +10 -0
  6. data/lib/calendar_api/apis/base_api.rb +67 -0
  7. data/lib/calendar_api/apis/calendar_list_api.rb +63 -0
  8. data/lib/calendar_api/apis/channels_api.rb +42 -0
  9. data/lib/calendar_api/apis/events_api.rb +354 -0
  10. data/lib/calendar_api/apis/free_busy_api.rb +37 -0
  11. data/lib/calendar_api/apis/oauth_authorization_api.rb +87 -0
  12. data/lib/calendar_api/client.rb +103 -0
  13. data/lib/calendar_api/configuration.rb +177 -0
  14. data/lib/calendar_api/exceptions/api_exception.rb +21 -0
  15. data/lib/calendar_api/exceptions/error_response_error1_exception.rb +46 -0
  16. data/lib/calendar_api/exceptions/oauth_provider_exception.rb +64 -0
  17. data/lib/calendar_api/http/api_response.rb +19 -0
  18. data/lib/calendar_api/http/auth/oauth_2.rb +162 -0
  19. data/lib/calendar_api/http/http_call_back.rb +10 -0
  20. data/lib/calendar_api/http/http_method_enum.rb +10 -0
  21. data/lib/calendar_api/http/http_request.rb +10 -0
  22. data/lib/calendar_api/http/http_response.rb +10 -0
  23. data/lib/calendar_api/http/proxy_settings.rb +22 -0
  24. data/lib/calendar_api/logging/configuration/api_logging_configuration.rb +186 -0
  25. data/lib/calendar_api/logging/sdk_logger.rb +17 -0
  26. data/lib/calendar_api/models/attachment.rb +115 -0
  27. data/lib/calendar_api/models/attendee.rb +167 -0
  28. data/lib/calendar_api/models/auto_decline_mode.rb +40 -0
  29. data/lib/calendar_api/models/base_model.rb +110 -0
  30. data/lib/calendar_api/models/birthday_properties.rb +96 -0
  31. data/lib/calendar_api/models/birthday_type.rb +48 -0
  32. data/lib/calendar_api/models/calendar_access_role.rb +44 -0
  33. data/lib/calendar_api/models/calendar_list_entry.rb +278 -0
  34. data/lib/calendar_api/models/calendar_list_entry_conference_properties.rb +83 -0
  35. data/lib/calendar_api/models/calendar_list_entry_notification_settings.rb +85 -0
  36. data/lib/calendar_api/models/calendar_list_response.rb +129 -0
  37. data/lib/calendar_api/models/calendar_notification.rb +86 -0
  38. data/lib/calendar_api/models/calendar_notification_method.rb +27 -0
  39. data/lib/calendar_api/models/calendar_notification_type.rb +48 -0
  40. data/lib/calendar_api/models/channel.rb +129 -0
  41. data/lib/calendar_api/models/channel_params.rb +75 -0
  42. data/lib/calendar_api/models/channel_type.rb +36 -0
  43. data/lib/calendar_api/models/chat_status.rb +36 -0
  44. data/lib/calendar_api/models/conference_create_request.rb +99 -0
  45. data/lib/calendar_api/models/conference_create_request_status.rb +76 -0
  46. data/lib/calendar_api/models/conference_data.rb +137 -0
  47. data/lib/calendar_api/models/conference_data_version.rb +43 -0
  48. data/lib/calendar_api/models/conference_entry_point.rb +126 -0
  49. data/lib/calendar_api/models/conference_request_status_code.rb +40 -0
  50. data/lib/calendar_api/models/conference_solution.rb +95 -0
  51. data/lib/calendar_api/models/conference_solution_key.rb +74 -0
  52. data/lib/calendar_api/models/conference_solution_type.rb +40 -0
  53. data/lib/calendar_api/models/custom_location.rb +75 -0
  54. data/lib/calendar_api/models/entry_point_type.rb +44 -0
  55. data/lib/calendar_api/models/error_response.rb +75 -0
  56. data/lib/calendar_api/models/error_response_error.rb +104 -0
  57. data/lib/calendar_api/models/error_response_error_errors_items.rb +95 -0
  58. data/lib/calendar_api/models/event.rb +551 -0
  59. data/lib/calendar_api/models/event_date_time.rb +107 -0
  60. data/lib/calendar_api/models/event_list.rb +208 -0
  61. data/lib/calendar_api/models/event_order_by.rb +36 -0
  62. data/lib/calendar_api/models/event_reminders.rb +95 -0
  63. data/lib/calendar_api/models/event_source.rb +86 -0
  64. data/lib/calendar_api/models/event_status.rb +40 -0
  65. data/lib/calendar_api/models/event_transparency.rb +37 -0
  66. data/lib/calendar_api/models/event_type.rb +52 -0
  67. data/lib/calendar_api/models/event_visibility.rb +44 -0
  68. data/lib/calendar_api/models/extended_properties.rb +87 -0
  69. data/lib/calendar_api/models/focus_time_properties.rb +99 -0
  70. data/lib/calendar_api/models/free_busy_calendar.rb +103 -0
  71. data/lib/calendar_api/models/free_busy_error.rb +85 -0
  72. data/lib/calendar_api/models/free_busy_group.rb +94 -0
  73. data/lib/calendar_api/models/free_busy_request.rb +150 -0
  74. data/lib/calendar_api/models/free_busy_request_item.rb +72 -0
  75. data/lib/calendar_api/models/free_busy_response.rb +135 -0
  76. data/lib/calendar_api/models/oauth_provider_error.rb +62 -0
  77. data/lib/calendar_api/models/oauth_scope.rb +41 -0
  78. data/lib/calendar_api/models/oauth_token.rb +96 -0
  79. data/lib/calendar_api/models/office_location.rb +116 -0
  80. data/lib/calendar_api/models/out_of_office_properties.rb +88 -0
  81. data/lib/calendar_api/models/person.rb +106 -0
  82. data/lib/calendar_api/models/reminder.rb +83 -0
  83. data/lib/calendar_api/models/reminder_method.rb +36 -0
  84. data/lib/calendar_api/models/response_status.rb +44 -0
  85. data/lib/calendar_api/models/send_updates.rb +40 -0
  86. data/lib/calendar_api/models/stop_channel_request.rb +85 -0
  87. data/lib/calendar_api/models/time_period.rb +102 -0
  88. data/lib/calendar_api/models/watch_request.rb +113 -0
  89. data/lib/calendar_api/models/working_location_properties.rb +107 -0
  90. data/lib/calendar_api/models/working_location_type.rb +40 -0
  91. data/lib/calendar_api/utilities/date_time_helper.rb +11 -0
  92. data/lib/calendar_api/utilities/file_wrapper.rb +28 -0
  93. data/lib/calendar_api.rb +114 -0
  94. metadata +176 -0
@@ -0,0 +1,354 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # EventsApi
8
+ class EventsApi < BaseApi
9
+ # Returns events on the specified calendar. Results are paginated and
10
+ # ordered by start time (when singleEvents is true) or by last modification
11
+ # time (default).
12
+ # @param [String] calendar_id Required parameter: Calendar identifier. To
13
+ # retrieve calendar IDs call the calendarList.list method. Use the keyword
14
+ # "primary" to access the primary calendar of the currently logged-in
15
+ # user.
16
+ # @param [Array[EventType]] event_types Optional parameter: Filter by event
17
+ # type. May be repeated to include multiple types.
18
+ # @param [String] i_cal_uid Optional parameter: Specifies an iCalendar UID
19
+ # to search for. Only one event with the given UID will be returned.
20
+ # @param [Integer] max_attendees Optional parameter: The maximum number of
21
+ # attendees to include in the response. If there are more attendees, only
22
+ # the participant is returned.
23
+ # @param [Integer] max_results Optional parameter: Maximum number of events
24
+ # returned on one result page. The number of events in the resulting page
25
+ # may be less than this value. Default is 250, maximum allowed is 2500.
26
+ # @param [EventOrderBy] order_by Optional parameter: The order of the events
27
+ # returned in the result. When using orderBy with startTime, singleEvents
28
+ # must be true.
29
+ # @param [String] page_token Optional parameter: Token specifying which
30
+ # result page to return.
31
+ # @param [String] private_extended_property Optional parameter: Extended
32
+ # property constraint specified as propertyName=value. Matches only private
33
+ # properties.
34
+ # @param [String] q Optional parameter: Free text search terms to find
35
+ # events matching these terms in the summary, description, location,
36
+ # attendee's displayName, and attendee's email.
37
+ # @param [String] shared_extended_property Optional parameter: Extended
38
+ # property constraint specified as propertyName=value. Matches only shared
39
+ # properties.
40
+ # @param [TrueClass | FalseClass] show_deleted Optional parameter: Whether
41
+ # to include deleted events (with status equals "cancelled") in the result.
42
+ # Default is false.
43
+ # @param [TrueClass | FalseClass] show_hidden_invitations Optional
44
+ # parameter: Whether to include hidden invitations in the result. Default is
45
+ # false.
46
+ # @param [TrueClass | FalseClass] single_events Optional parameter: Whether
47
+ # to expand recurring events into instances and only return single one-off
48
+ # events and instances of recurring events. Default is false.
49
+ # @param [String] sync_token Optional parameter: Token obtained from the
50
+ # nextSyncToken field returned on the last page of results from the previous
51
+ # list request. Makes the result contain only entries that have changed
52
+ # since then. Cannot be used together with iCalUID, orderBy,
53
+ # privateExtendedProperty, q, sharedExtendedProperty, timeMin, timeMax, or
54
+ # updatedMin.
55
+ # @param [DateTime] time_max Optional parameter: Upper bound (exclusive) for
56
+ # an event's start time to filter by. Must be an RFC3339 timestamp with
57
+ # mandatory time zone offset.
58
+ # @param [DateTime] time_min Optional parameter: Lower bound (exclusive) for
59
+ # an event's end time to filter by. Must be an RFC3339 timestamp with
60
+ # mandatory time zone offset.
61
+ # @param [String] time_zone Optional parameter: Time zone used in the
62
+ # response. Defaults to the time zone of the calendar.
63
+ # @param [DateTime] updated_min Optional parameter: Lower bound for an
64
+ # event's last modification time (RFC3339 timestamp) to filter by.
65
+ # @return [ApiResponse] Complete http response with raw body and status code.
66
+ def list_events(calendar_id,
67
+ event_types: nil,
68
+ i_cal_uid: nil,
69
+ max_attendees: nil,
70
+ max_results: 250,
71
+ order_by: nil,
72
+ page_token: nil,
73
+ private_extended_property: nil,
74
+ q: nil,
75
+ shared_extended_property: nil,
76
+ show_deleted: false,
77
+ show_hidden_invitations: false,
78
+ single_events: false,
79
+ sync_token: nil,
80
+ time_max: nil,
81
+ time_min: nil,
82
+ time_zone: nil,
83
+ updated_min: nil)
84
+ @api_call
85
+ .request(new_request_builder(HttpMethodEnum::GET,
86
+ '/calendars/{calendarId}/events',
87
+ Server::DEFAULT)
88
+ .template_param(new_parameter(calendar_id, key: 'calendarId')
89
+ .is_required(true)
90
+ .should_encode(true))
91
+ .query_param(new_parameter(event_types, key: 'eventTypes'))
92
+ .query_param(new_parameter(i_cal_uid, key: 'iCalUID'))
93
+ .query_param(new_parameter(max_attendees, key: 'maxAttendees'))
94
+ .query_param(new_parameter(max_results, key: 'maxResults'))
95
+ .query_param(new_parameter(order_by, key: 'orderBy'))
96
+ .query_param(new_parameter(page_token, key: 'pageToken'))
97
+ .query_param(new_parameter(private_extended_property, key: 'privateExtendedProperty'))
98
+ .query_param(new_parameter(q, key: 'q'))
99
+ .query_param(new_parameter(shared_extended_property, key: 'sharedExtendedProperty'))
100
+ .query_param(new_parameter(show_deleted, key: 'showDeleted'))
101
+ .query_param(new_parameter(show_hidden_invitations, key: 'showHiddenInvitations'))
102
+ .query_param(new_parameter(single_events, key: 'singleEvents'))
103
+ .query_param(new_parameter(sync_token, key: 'syncToken'))
104
+ .query_param(new_parameter(time_max, key: 'timeMax'))
105
+ .query_param(new_parameter(time_min, key: 'timeMin'))
106
+ .query_param(new_parameter(time_zone, key: 'timeZone'))
107
+ .query_param(new_parameter(updated_min, key: 'updatedMin'))
108
+ .header_param(new_parameter('application/json', key: 'accept'))
109
+ .auth(Single.new('oauth2')))
110
+ .response(new_response_handler
111
+ .deserializer(APIHelper.method(:custom_type_deserializer))
112
+ .deserialize_into(EventList.method(:from_hash))
113
+ .is_api_response(true)
114
+ .local_error('400',
115
+ 'Bad request — invalid parameters or request body.',
116
+ ErrorResponseError1Exception)
117
+ .local_error('401',
118
+ 'Authentication required or credentials are invalid.',
119
+ ErrorResponseError1Exception)
120
+ .local_error('403',
121
+ 'Insufficient permissions for the requested resource.',
122
+ ErrorResponseError1Exception)
123
+ .local_error('404',
124
+ 'The requested resource was not found.',
125
+ ErrorResponseError1Exception))
126
+ .execute
127
+ end
128
+
129
+ # Creates an event on the specified calendar.
130
+ # @param [String] calendar_id Required parameter: Calendar identifier. To
131
+ # retrieve calendar IDs call the calendarList.list method. Use the keyword
132
+ # "primary" to access the primary calendar of the currently logged-in
133
+ # user.
134
+ # @param [Event] body Required parameter: Request body for create an
135
+ # event.
136
+ # @param [ConferenceDataVersion] conference_data_version Optional parameter:
137
+ # Version number of conference data supported by the API client. Version 0
138
+ # assumes no conference data support. Version 1 enables support for copying
139
+ # of ConferenceData as well as creating new conferences using
140
+ # createRequest.
141
+ # @param [Integer] max_attendees Optional parameter: The maximum number of
142
+ # attendees to include in the response.
143
+ # @param [SendUpdates] send_updates Optional parameter: Whether to send
144
+ # notifications about the creation of the new event.
145
+ # @param [TrueClass | FalseClass] supports_attachments Optional parameter:
146
+ # Whether the API client performing the operation supports event
147
+ # attachments. Default is false.
148
+ # @return [ApiResponse] Complete http response with raw body and status code.
149
+ def create_event(calendar_id,
150
+ body,
151
+ conference_data_version: ConferenceDataVersion::ENUM_0,
152
+ max_attendees: nil,
153
+ send_updates: nil,
154
+ supports_attachments: false)
155
+ @api_call
156
+ .request(new_request_builder(HttpMethodEnum::POST,
157
+ '/calendars/{calendarId}/events',
158
+ Server::DEFAULT)
159
+ .template_param(new_parameter(calendar_id, key: 'calendarId')
160
+ .is_required(true)
161
+ .should_encode(true))
162
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
163
+ .body_param(new_parameter(body)
164
+ .is_required(true))
165
+ .query_param(new_parameter(conference_data_version, key: 'conferenceDataVersion'))
166
+ .query_param(new_parameter(max_attendees, key: 'maxAttendees'))
167
+ .query_param(new_parameter(send_updates, key: 'sendUpdates'))
168
+ .query_param(new_parameter(supports_attachments, key: 'supportsAttachments'))
169
+ .header_param(new_parameter('application/json', key: 'accept'))
170
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
171
+ .auth(Single.new('oauth2')))
172
+ .response(new_response_handler
173
+ .deserializer(APIHelper.method(:custom_type_deserializer))
174
+ .deserialize_into(Event.method(:from_hash))
175
+ .is_api_response(true)
176
+ .local_error('400',
177
+ 'Bad request — invalid parameters or request body.',
178
+ ErrorResponseError1Exception)
179
+ .local_error('401',
180
+ 'Authentication required or credentials are invalid.',
181
+ ErrorResponseError1Exception)
182
+ .local_error('403',
183
+ 'Insufficient permissions for the requested resource.',
184
+ ErrorResponseError1Exception)
185
+ .local_error('404',
186
+ 'The requested resource was not found.',
187
+ ErrorResponseError1Exception)
188
+ .local_error('409',
189
+ 'Conflict — an event with the given ID already exists.',
190
+ ErrorResponseError1Exception))
191
+ .execute
192
+ end
193
+
194
+ # Updates an event using patch semantics. Each patch request consumes three
195
+ # quota units. Only fields specified in the request body are modified;
196
+ # unspecified fields remain unchanged. Array fields, if specified, overwrite
197
+ # existing arrays entirely.
198
+ # @param [String] calendar_id Required parameter: Calendar identifier. To
199
+ # retrieve calendar IDs call the calendarList.list method. Use the keyword
200
+ # "primary" to access the primary calendar of the currently logged-in
201
+ # user.
202
+ # @param [String] event_id Required parameter: Event identifier.
203
+ # @param [Event] body Required parameter: Request body for update an
204
+ # event.
205
+ # @param [ConferenceDataVersion] conference_data_version Optional parameter:
206
+ # Version number of conference data supported by the API client.
207
+ # @param [Integer] max_attendees Optional parameter: The maximum number of
208
+ # attendees to include in the response.
209
+ # @param [SendUpdates] send_updates Optional parameter: Whether to send
210
+ # notifications about the event update.
211
+ # @param [TrueClass | FalseClass] supports_attachments Optional parameter:
212
+ # Whether the API client performing the operation supports event
213
+ # attachments.
214
+ # @return [ApiResponse] Complete http response with raw body and status code.
215
+ def patch_event(calendar_id,
216
+ event_id,
217
+ body,
218
+ conference_data_version: ConferenceDataVersion::ENUM_0,
219
+ max_attendees: nil,
220
+ send_updates: nil,
221
+ supports_attachments: false)
222
+ @api_call
223
+ .request(new_request_builder(HttpMethodEnum::PATCH,
224
+ '/calendars/{calendarId}/events/{eventId}',
225
+ Server::DEFAULT)
226
+ .template_param(new_parameter(calendar_id, key: 'calendarId')
227
+ .is_required(true)
228
+ .should_encode(true))
229
+ .template_param(new_parameter(event_id, key: 'eventId')
230
+ .is_required(true)
231
+ .should_encode(true))
232
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
233
+ .body_param(new_parameter(body)
234
+ .is_required(true))
235
+ .query_param(new_parameter(conference_data_version, key: 'conferenceDataVersion'))
236
+ .query_param(new_parameter(max_attendees, key: 'maxAttendees'))
237
+ .query_param(new_parameter(send_updates, key: 'sendUpdates'))
238
+ .query_param(new_parameter(supports_attachments, key: 'supportsAttachments'))
239
+ .header_param(new_parameter('application/json', key: 'accept'))
240
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
241
+ .auth(Single.new('oauth2')))
242
+ .response(new_response_handler
243
+ .deserializer(APIHelper.method(:custom_type_deserializer))
244
+ .deserialize_into(Event.method(:from_hash))
245
+ .is_api_response(true)
246
+ .local_error('400',
247
+ 'Bad request — invalid parameters or request body.',
248
+ ErrorResponseError1Exception)
249
+ .local_error('401',
250
+ 'Authentication required or credentials are invalid.',
251
+ ErrorResponseError1Exception)
252
+ .local_error('403',
253
+ 'Insufficient permissions for the requested resource.',
254
+ ErrorResponseError1Exception)
255
+ .local_error('404',
256
+ 'The requested resource was not found.',
257
+ ErrorResponseError1Exception))
258
+ .execute
259
+ end
260
+
261
+ # Deletes an event from the specified calendar.
262
+ # @param [String] calendar_id Required parameter: Calendar identifier. To
263
+ # retrieve calendar IDs call the calendarList.list method. Use the keyword
264
+ # "primary" to access the primary calendar of the currently logged-in
265
+ # user.
266
+ # @param [String] event_id Required parameter: Event identifier.
267
+ # @param [SendUpdates] send_updates Optional parameter: Guests who should
268
+ # receive notifications about the deletion of the event.
269
+ # @return [ApiResponse] Complete http response with raw body and status code.
270
+ def delete_event(calendar_id,
271
+ event_id,
272
+ send_updates: nil)
273
+ @api_call
274
+ .request(new_request_builder(HttpMethodEnum::DELETE,
275
+ '/calendars/{calendarId}/events/{eventId}',
276
+ Server::DEFAULT)
277
+ .template_param(new_parameter(calendar_id, key: 'calendarId')
278
+ .is_required(true)
279
+ .should_encode(true))
280
+ .template_param(new_parameter(event_id, key: 'eventId')
281
+ .is_required(true)
282
+ .should_encode(true))
283
+ .query_param(new_parameter(send_updates, key: 'sendUpdates'))
284
+ .auth(Single.new('oauth2')))
285
+ .response(new_response_handler
286
+ .is_response_void(true)
287
+ .is_api_response(true)
288
+ .local_error('400',
289
+ 'Bad request — invalid parameters or request body.',
290
+ ErrorResponseError1Exception)
291
+ .local_error('401',
292
+ 'Authentication required or credentials are invalid.',
293
+ ErrorResponseError1Exception)
294
+ .local_error('403',
295
+ 'Insufficient permissions for the requested resource.',
296
+ ErrorResponseError1Exception)
297
+ .local_error('404',
298
+ 'The requested resource was not found.',
299
+ ErrorResponseError1Exception)
300
+ .local_error('410',
301
+ 'Event has already been deleted.',
302
+ ErrorResponseError1Exception))
303
+ .execute
304
+ end
305
+
306
+ # Sets up a push notification channel to watch for changes to events on the
307
+ # specified calendar. When events change, a POST notification is sent to the
308
+ # specified address.
309
+ # @param [String] calendar_id Required parameter: Calendar identifier. To
310
+ # retrieve calendar IDs call the calendarList.list method. Use the keyword
311
+ # "primary" to access the primary calendar of the currently logged-in
312
+ # user.
313
+ # @param [WatchRequest] body Required parameter: Request body for watch for
314
+ # event changes.
315
+ # @param [Array[EventType]] event_types Optional parameter: Filters which
316
+ # event types to watch for changes.
317
+ # @return [ApiResponse] Complete http response with raw body and status code.
318
+ def watch_events(calendar_id,
319
+ body,
320
+ event_types: nil)
321
+ @api_call
322
+ .request(new_request_builder(HttpMethodEnum::POST,
323
+ '/calendars/{calendarId}/events/watch',
324
+ Server::DEFAULT)
325
+ .template_param(new_parameter(calendar_id, key: 'calendarId')
326
+ .is_required(true)
327
+ .should_encode(true))
328
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
329
+ .body_param(new_parameter(body)
330
+ .is_required(true))
331
+ .query_param(new_parameter(event_types, key: 'eventTypes'))
332
+ .header_param(new_parameter('application/json', key: 'accept'))
333
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
334
+ .auth(Single.new('oauth2')))
335
+ .response(new_response_handler
336
+ .deserializer(APIHelper.method(:custom_type_deserializer))
337
+ .deserialize_into(Channel.method(:from_hash))
338
+ .is_api_response(true)
339
+ .local_error('400',
340
+ 'Bad request — invalid parameters or request body.',
341
+ ErrorResponseError1Exception)
342
+ .local_error('401',
343
+ 'Authentication required or credentials are invalid.',
344
+ ErrorResponseError1Exception)
345
+ .local_error('403',
346
+ 'Insufficient permissions for the requested resource.',
347
+ ErrorResponseError1Exception)
348
+ .local_error('404',
349
+ 'The requested resource was not found.',
350
+ ErrorResponseError1Exception))
351
+ .execute
352
+ end
353
+ end
354
+ end
@@ -0,0 +1,37 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # FreeBusyApi
8
+ class FreeBusyApi < BaseApi
9
+ # Returns free/busy information for a set of calendars and groups.
10
+ # @param [FreeBusyRequest] body Required parameter: Request body for query
11
+ # free-busy information.
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def query_free_busy(body)
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/freeBusy',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
19
+ .body_param(new_parameter(body)
20
+ .is_required(true))
21
+ .header_param(new_parameter('application/json', key: 'accept'))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Single.new('oauth2')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(FreeBusyResponse.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('400',
29
+ 'Bad request — invalid parameters or request body.',
30
+ ErrorResponseError1Exception)
31
+ .local_error('401',
32
+ 'Authentication required or credentials are invalid.',
33
+ ErrorResponseError1Exception))
34
+ .execute
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,87 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # OauthAuthorizationApi
8
+ class OauthAuthorizationApi < BaseApi
9
+ # Create a new OAuth 2 token.
10
+ # @param [String] authorization Required parameter: Authorization header in
11
+ # Basic auth format
12
+ # @param [String] code Required parameter: Authorization Code
13
+ # @param [String] redirect_uri Required parameter: Redirect Uri
14
+ # @param [Hash] _field_parameters Additional optional form parameters are
15
+ # supported by this endpoint.
16
+ # @return [ApiResponse] Complete http response with raw body and status code.
17
+ def request_token(authorization,
18
+ code,
19
+ redirect_uri,
20
+ _field_parameters: nil)
21
+ @api_call
22
+ .request(new_request_builder(HttpMethodEnum::POST,
23
+ '/token',
24
+ Server::ACCESS_TOKEN_SERVER)
25
+ .form_param(new_parameter('authorization_code', key: 'grant_type'))
26
+ .header_param(new_parameter(authorization, key: 'Authorization')
27
+ .is_required(true))
28
+ .form_param(new_parameter(code, key: 'code')
29
+ .is_required(true))
30
+ .form_param(new_parameter(redirect_uri, key: 'redirect_uri')
31
+ .is_required(true))
32
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
33
+ .header_param(new_parameter('application/json', key: 'accept'))
34
+ .additional_form_params(_field_parameters))
35
+ .response(new_response_handler
36
+ .deserializer(APIHelper.method(:custom_type_deserializer))
37
+ .deserialize_into(OauthToken.method(:from_hash))
38
+ .is_api_response(true)
39
+ .local_error('400',
40
+ 'OAuth 2 provider returned an error.',
41
+ OauthProviderException)
42
+ .local_error('401',
43
+ 'OAuth 2 provider says client authentication failed.',
44
+ OauthProviderException))
45
+ .execute
46
+ end
47
+
48
+ # Obtain a new access token using a refresh token
49
+ # @param [String] authorization Required parameter: Authorization header in
50
+ # Basic auth format
51
+ # @param [String] refresh_token Required parameter: Refresh token
52
+ # @param [String] scope Optional parameter: Requested scopes as a
53
+ # space-delimited list.
54
+ # @param [Hash] _field_parameters Additional optional form parameters are
55
+ # supported by this endpoint.
56
+ # @return [ApiResponse] Complete http response with raw body and status code.
57
+ def refresh_token(authorization,
58
+ refresh_token,
59
+ scope: nil,
60
+ _field_parameters: nil)
61
+ @api_call
62
+ .request(new_request_builder(HttpMethodEnum::POST,
63
+ '/token',
64
+ Server::ACCESS_TOKEN_SERVER)
65
+ .form_param(new_parameter('refresh_token', key: 'grant_type'))
66
+ .header_param(new_parameter(authorization, key: 'Authorization')
67
+ .is_required(true))
68
+ .form_param(new_parameter(refresh_token, key: 'refresh_token')
69
+ .is_required(true))
70
+ .form_param(new_parameter(scope, key: 'scope'))
71
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
72
+ .header_param(new_parameter('application/json', key: 'accept'))
73
+ .additional_form_params(_field_parameters))
74
+ .response(new_response_handler
75
+ .deserializer(APIHelper.method(:custom_type_deserializer))
76
+ .deserialize_into(OauthToken.method(:from_hash))
77
+ .is_api_response(true)
78
+ .local_error('400',
79
+ 'OAuth 2 provider returned an error.',
80
+ OauthProviderException)
81
+ .local_error('401',
82
+ 'OAuth 2 provider says client authentication failed.',
83
+ OauthProviderException))
84
+ .execute
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,103 @@
1
+ # calendar_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CalendarApi
7
+ # calendar_api client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
15
+
16
+ # Returns the configured authentication oauth2 instance.
17
+ def oauth_2
18
+ @auth_managers['oauth2']
19
+ end
20
+
21
+ # Access to calendar_list controller.
22
+ # @return [CalendarListApi] Returns the controller instance.
23
+ def calendar_list
24
+ @calendar_list ||= CalendarListApi.new @global_configuration
25
+ end
26
+
27
+ # Access to events controller.
28
+ # @return [EventsApi] Returns the controller instance.
29
+ def events
30
+ @events ||= EventsApi.new @global_configuration
31
+ end
32
+
33
+ # Access to free_busy controller.
34
+ # @return [FreeBusyApi] Returns the controller instance.
35
+ def free_busy
36
+ @free_busy ||= FreeBusyApi.new @global_configuration
37
+ end
38
+
39
+ # Access to channels controller.
40
+ # @return [ChannelsApi] Returns the controller instance.
41
+ def channels
42
+ @channels ||= ChannelsApi.new @global_configuration
43
+ end
44
+
45
+ # Access to oauth_authorization controller.
46
+ # @return [OauthAuthorizationApi] Returns the controller instance.
47
+ def oauth_authorization
48
+ @oauth_authorization ||= OauthAuthorizationApi.new @global_configuration
49
+ end
50
+
51
+ def initialize(
52
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
53
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
54
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
55
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
56
+ logging_configuration: nil, environment: Environment::PRODUCTION,
57
+ authorization_code_auth_credentials: nil, config: nil
58
+ )
59
+ @config = if config.nil?
60
+ Configuration.new(
61
+ connection: connection, adapter: adapter, timeout: timeout,
62
+ max_retries: max_retries, retry_interval: retry_interval,
63
+ backoff_factor: backoff_factor,
64
+ retry_statuses: retry_statuses,
65
+ retry_methods: retry_methods, http_callback: http_callback,
66
+ proxy_settings: proxy_settings,
67
+ logging_configuration: logging_configuration,
68
+ environment: environment,
69
+ authorization_code_auth_credentials: authorization_code_auth_credentials
70
+ )
71
+ else
72
+ config
73
+ end
74
+ user_agent_params = BaseApi.user_agent_parameters
75
+
76
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
77
+ .base_uri_executor(@config.method(:get_base_uri))
78
+ .global_errors(BaseApi::GLOBAL_ERRORS)
79
+ .user_agent(BaseApi.user_agent,
80
+ agent_parameters: user_agent_params)
81
+
82
+ initialize_auth_managers(@global_configuration)
83
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
84
+ end
85
+
86
+ # Initializes the auth managers hash used for authenticating API calls.
87
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
88
+ def initialize_auth_managers(global_config)
89
+ @auth_managers = {}
90
+ http_client_config = global_config.client_configuration
91
+ %w[oauth2].each { |auth| @auth_managers[auth] = nil }
92
+ @auth_managers['oauth2'] = Oauth2.new(http_client_config.authorization_code_auth_credentials,
93
+ global_config)
94
+ end
95
+
96
+ # Creates a client directly from environment variables.
97
+ def self.from_env(**overrides)
98
+ default_config = Configuration.build_default_config_from_env
99
+ new_config = default_config.clone_with(**overrides)
100
+ new(config: new_config)
101
+ end
102
+ end
103
+ end