Class: HighLevel::Resources::Calendars

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/calendars.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#add_calendar_to_schedule(id:, calendar_id:, **_opts) ⇒ Object

Apply user availability schedule to a calendar

Associates a calendar with the given schedule by adding the calendarId to a schedule



427
428
429
430
431
432
433
# File 'lib/high_level/resources/calendars.rb', line 427

def add_calendar_to_schedule(id:, calendar_id:, **_opts)
  request(
    method: :put,
    path: "/calendars/schedules/#{id}/associations/#{calendar_id}",
    security: ["bearer"]
  )
end

#create_appointment(body:, **_opts) ⇒ Object

Create appointment



75
76
77
78
79
80
81
82
# File 'lib/high_level/resources/calendars.rb', line 75

def create_appointment(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/events/appointments",
    security: ["bearer"],
    body: body
  )
end

#create_appointment_note(appointment_id:, body:, **_opts) ⇒ Object

Create Note



222
223
224
225
226
227
228
229
# File 'lib/high_level/resources/calendars.rb', line 222

def create_appointment_note(appointment_id:, body:, **_opts)
  request(
    method: :post,
    path: "/calendars/appointments/#{appointment_id}/notes",
    security: ["bearer"],
    body: body
  )
end

#create_block_slot(body:, **_opts) ⇒ Object

Create Block Slot

Create block slot



130
131
132
133
134
135
136
137
# File 'lib/high_level/resources/calendars.rb', line 130

def create_block_slot(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/events/block-slots",
    security: ["bearer"],
    body: body
  )
end

#create_calendar(body:, **_opts) ⇒ Object

Create Calendar

Create calendar in a location.



461
462
463
464
465
466
467
468
# File 'lib/high_level/resources/calendars.rb', line 461

def create_calendar(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/",
    security: ["bearer"],
    body: body
  )
end

#create_calendar_group(body:, **_opts) ⇒ Object

Create Calendar Group



22
23
24
25
26
27
28
29
# File 'lib/high_level/resources/calendars.rb', line 22

def create_calendar_group(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/groups",
    security: ["bearer"],
    body: body
  )
end

#create_calendar_resource(resource_type:, body:, **_opts) ⇒ Object

Create Calendar Resource

Create calendar resource by resource type



299
300
301
302
303
304
305
306
# File 'lib/high_level/resources/calendars.rb', line 299

def create_calendar_resource(resource_type:, body:, **_opts)
  request(
    method: :post,
    path: "/calendars/resources/#{resource_type}",
    security: ["Location-Access"],
    body: body
  )
end

#create_event_notification(calendar_id:, body:, **_opts) ⇒ Object

Create notification

Create Calendar notifications, either one or multiple. All notification settings must be for single calendar only



323
324
325
326
327
328
329
330
# File 'lib/high_level/resources/calendars.rb', line 323

def create_event_notification(calendar_id:, body:, **_opts)
  request(
    method: :post,
    path: "/calendars/#{calendar_id}/notifications",
    security: ["bearer"],
    body: body
  )
end

#create_schedule(body:, **_opts) ⇒ Object

Create user availability schedule

Create new schedule with specified rules, timezone, location, user and calendar associations.



415
416
417
418
419
420
421
422
# File 'lib/high_level/resources/calendars.rb', line 415

def create_schedule(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/schedules",
    security: ["bearer"],
    body: body
  )
end

#delete_appointment_note(appointment_id:, **_opts) ⇒ Object

Delete Note



242
243
244
245
246
247
248
# File 'lib/high_level/resources/calendars.rb', line 242

def delete_appointment_note(appointment_id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/appointments/#{appointment_id}/notes/#{note_id}",
    security: ["bearer"]
  )
end

#delete_calendar(calendar_id:, **_opts) ⇒ Object

Delete Calendar

Delete calendar by ID



189
190
191
192
193
194
195
# File 'lib/high_level/resources/calendars.rb', line 189

def delete_calendar(calendar_id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/#{calendar_id}",
    security: ["bearer"]
  )
end

#delete_calendar_resource(resource_type:, id:, **_opts) ⇒ Object

Delete Calendar Resource

Delete calendar resource by ID



276
277
278
279
280
281
282
# File 'lib/high_level/resources/calendars.rb', line 276

def delete_calendar_resource(resource_type:, id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/resources/#{resource_type}/#{id}",
    security: ["Location-Access"]
  )
end

#delete_event(event_id:, body:, **_opts) ⇒ Object

Delete Event

Delete event by ID



200
201
202
203
204
205
206
207
# File 'lib/high_level/resources/calendars.rb', line 200

def delete_event(event_id:, body:, **_opts)
  request(
    method: :delete,
    path: "/calendars/events/#{event_id}",
    security: ["bearer"],
    body: body
  )
end

#delete_event_notification(calendar_id:, notification_id:, **_opts) ⇒ Object

Delete Notification

Delete notification



358
359
360
361
362
363
364
# File 'lib/high_level/resources/calendars.rb', line 358

def delete_event_notification(calendar_id:, notification_id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/#{calendar_id}/notifications/#{notification_id}",
    security: ["bearer"]
  )
end

#delete_group(group_id:, **_opts) ⇒ Object

Delete Group



56
57
58
59
60
61
62
# File 'lib/high_level/resources/calendars.rb', line 56

def delete_group(group_id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/groups/#{group_id}",
    security: ["bearer"]
  )
end

#delete_schedule(id:, **_opts) ⇒ Object

Delete user availability schedule

Permanently remove a schedule and all its associated rules. This action cannot be undone.



404
405
406
407
408
409
410
# File 'lib/high_level/resources/calendars.rb', line 404

def delete_schedule(id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/schedules/#{id}",
    security: ["bearer"]
  )
end

#disable_group(group_id:, body:, **_opts) ⇒ Object

Disable Group



65
66
67
68
69
70
71
72
# File 'lib/high_level/resources/calendars.rb', line 65

def disable_group(group_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/groups/#{group_id}/status",
    security: ["bearer"],
    body: body
  )
end

#edit_appointment(event_id:, body:, **_opts) ⇒ Object

Update Appointment

Update appointment



98
99
100
101
102
103
104
105
# File 'lib/high_level/resources/calendars.rb', line 98

def edit_appointment(event_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/events/appointments/#{event_id}",
    security: ["bearer"],
    body: body
  )
end

#edit_block_slot(event_id:, body:, **_opts) ⇒ Object

Update Block Slot

Update block slot by ID



142
143
144
145
146
147
148
149
# File 'lib/high_level/resources/calendars.rb', line 142

def edit_block_slot(event_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/events/block-slots/#{event_id}",
    security: ["bearer"],
    body: body
  )
end

#edit_group(group_id:, body:, **_opts) ⇒ Object

Update Group

Update Group by group ID



46
47
48
49
50
51
52
53
# File 'lib/high_level/resources/calendars.rb', line 46

def edit_group(group_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/groups/#{group_id}",
    security: ["bearer"],
    body: body
  )
end

#fetch_calendar_resources(resource_type:, location_id: nil, limit: nil, skip: nil, **_opts) ⇒ Object

List Calendar Resources

List calendar resources by resource type and location ID



287
288
289
290
291
292
293
294
# File 'lib/high_level/resources/calendars.rb', line 287

def fetch_calendar_resources(resource_type:, location_id: nil, limit: nil, skip: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/resources/#{resource_type}",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "limit" => limit, "skip" => skip }.compact
  )
end

#find_event_notification(calendar_id:, notification_id:, **_opts) ⇒ Object

Get notification

Find Event notification by notificationId



335
336
337
338
339
340
341
# File 'lib/high_level/resources/calendars.rb', line 335

def find_event_notification(calendar_id:, notification_id:, **_opts)
  request(
    method: :get,
    path: "/calendars/#{calendar_id}/notifications/#{notification_id}",
    security: ["bearer"]
  )
end

#get_all_schedules(location_id: nil, user_id: nil, calendar_id: nil, skip: nil, limit: nil, **_opts) ⇒ Object

List user availability schedule

Retrieve user availability schedules based on various filters including location, calendar, and user. Supports pagination.



369
370
371
372
373
374
375
376
# File 'lib/high_level/resources/calendars.rb', line 369

def get_all_schedules(location_id: nil, user_id: nil, calendar_id: nil, skip: nil, limit: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/schedules/search",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "calendarId" => calendar_id, "skip" => skip, "limit" => limit }.compact
  )
end

#get_appointment(event_id:, **_opts) ⇒ Object

Get Appointment

Get appointment by ID



87
88
89
90
91
92
93
# File 'lib/high_level/resources/calendars.rb', line 87

def get_appointment(event_id:, **_opts)
  request(
    method: :get,
    path: "/calendars/events/appointments/#{event_id}",
    security: ["bearer"]
  )
end

#get_appointment_notes(appointment_id:, limit: nil, offset: nil, **_opts) ⇒ Object

Get Notes

Get Appointment Notes



212
213
214
215
216
217
218
219
# File 'lib/high_level/resources/calendars.rb', line 212

def get_appointment_notes(appointment_id:, limit: nil, offset: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/appointments/#{appointment_id}/notes",
    security: ["bearer"],
    params: { "limit" => limit, "offset" => offset }.compact
  )
end

#get_blocked_slots(location_id: nil, user_id: nil, calendar_id: nil, group_id: nil, start_time: nil, end_time: nil, **_opts) ⇒ Object

Get Blocked Slots



118
119
120
121
122
123
124
125
# File 'lib/high_level/resources/calendars.rb', line 118

def get_blocked_slots(location_id: nil, user_id: nil, calendar_id: nil, group_id: nil, start_time: nil, end_time: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/blocked-slots",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "calendarId" => calendar_id, "groupId" => group_id, "startTime" => start_time, "endTime" => end_time }.compact
  )
end

#get_calendar(calendar_id:, **_opts) ⇒ Object

Get Calendar

Get calendar by ID



166
167
168
169
170
171
172
# File 'lib/high_level/resources/calendars.rb', line 166

def get_calendar(calendar_id:, **_opts)
  request(
    method: :get,
    path: "/calendars/#{calendar_id}",
    security: ["bearer"]
  )
end

#get_calendar_events(location_id: nil, user_id: nil, calendar_id: nil, group_id: nil, start_time: nil, end_time: nil, **_opts) ⇒ Object

Get Calendar Events



108
109
110
111
112
113
114
115
# File 'lib/high_level/resources/calendars.rb', line 108

def get_calendar_events(location_id: nil, user_id: nil, calendar_id: nil, group_id: nil, start_time: nil, end_time: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/events",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "calendarId" => calendar_id, "groupId" => group_id, "startTime" => start_time, "endTime" => end_time }.compact
  )
end

#get_calendar_resource(resource_type:, id:, **_opts) ⇒ Object

Get Calendar Resource

Get calendar resource by ID



253
254
255
256
257
258
259
# File 'lib/high_level/resources/calendars.rb', line 253

def get_calendar_resource(resource_type:, id:, **_opts)
  request(
    method: :get,
    path: "/calendars/resources/#{resource_type}/#{id}",
    security: ["Location-Access"]
  )
end

#get_calendars(location_id: nil, group_id: nil, show_drafted: nil, **_opts) ⇒ Object

Get Calendars

Get all calendars in a location.



449
450
451
452
453
454
455
456
# File 'lib/high_level/resources/calendars.rb', line 449

def get_calendars(location_id: nil, group_id: nil, show_drafted: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/",
    security: ["bearer"],
    params: { "locationId" => location_id, "groupId" => group_id, "showDrafted" => show_drafted }.compact
  )
end

#get_event_notification(calendar_id:, is_active: nil, deleted: nil, limit: nil, skip: nil, **_opts) ⇒ Object

Get notifications

Get calendar notifications based on query



311
312
313
314
315
316
317
318
# File 'lib/high_level/resources/calendars.rb', line 311

def get_event_notification(calendar_id:, is_active: nil, deleted: nil, limit: nil, skip: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/#{calendar_id}/notifications",
    security: ["bearer"],
    params: { "isActive" => is_active, "deleted" => deleted, "limit" => limit, "skip" => skip }.compact
  )
end

#get_groups(location_id: nil, **_opts) ⇒ Object

Get Groups

Get all calendar groups in a location.



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/calendars.rb', line 12

def get_groups(location_id: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/groups",
    security: ["bearer"],
    params: { "locationId" => location_id }.compact
  )
end

#get_schedule_by_id(id:, **_opts) ⇒ Object

Get user availability schedule

Retrieve a specific schedule by its unique identifier. Returns detailed information including rules, timezone, and associated calendars/users.



381
382
383
384
385
386
387
# File 'lib/high_level/resources/calendars.rb', line 381

def get_schedule_by_id(id:, **_opts)
  request(
    method: :get,
    path: "/calendars/schedules/#{id}",
    security: ["bearer"]
  )
end

#get_slots(calendar_id:, start_date: nil, end_date: nil, timezone: nil, user_id: nil, user_ids: nil, **_opts) ⇒ Object

Get Free Slots

Get free slots for a calendar between a date range. Optionally a consumer can also request free slots in a particular timezone and also for a particular user.



154
155
156
157
158
159
160
161
# File 'lib/high_level/resources/calendars.rb', line 154

def get_slots(calendar_id:, start_date: nil, end_date: nil, timezone: nil, user_id: nil, user_ids: nil, **_opts)
  request(
    method: :get,
    path: "/calendars/#{calendar_id}/free-slots",
    security: ["bearer"],
    params: { "startDate" => start_date, "endDate" => end_date, "timezone" => timezone, "userId" => user_id, "userIds" => user_ids }.compact
  )
end

#remove_calendar_from_schedule(id:, calendar_id:, **_opts) ⇒ Object

Remove user availability schedule from a calendar

Removes the association between a team calendar and the given schedule by removing the calendarId from the schedule



438
439
440
441
442
443
444
# File 'lib/high_level/resources/calendars.rb', line 438

def remove_calendar_from_schedule(id:, calendar_id:, **_opts)
  request(
    method: :delete,
    path: "/calendars/schedules/#{id}/associations/#{calendar_id}",
    security: ["bearer"]
  )
end

#update_appointment_note(appointment_id:, body:, **_opts) ⇒ Object

Update Note



232
233
234
235
236
237
238
239
# File 'lib/high_level/resources/calendars.rb', line 232

def update_appointment_note(appointment_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/appointments/#{appointment_id}/notes/#{note_id}",
    security: ["bearer"],
    body: body
  )
end

#update_calendar(calendar_id:, body:, **_opts) ⇒ Object

Update Calendar

Update calendar by ID.



177
178
179
180
181
182
183
184
# File 'lib/high_level/resources/calendars.rb', line 177

def update_calendar(calendar_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/#{calendar_id}",
    security: ["bearer"],
    body: body
  )
end

#update_calendar_resource(resource_type:, id:, body:, **_opts) ⇒ Object

Update Calendar Resource

Update calendar resource by ID



264
265
266
267
268
269
270
271
# File 'lib/high_level/resources/calendars.rb', line 264

def update_calendar_resource(resource_type:, id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/resources/#{resource_type}/#{id}",
    security: ["Location-Access"],
    body: body
  )
end

#update_event_notification(calendar_id:, notification_id:, body:, **_opts) ⇒ Object

Update notification

Update Event notification by id



346
347
348
349
350
351
352
353
# File 'lib/high_level/resources/calendars.rb', line 346

def update_event_notification(calendar_id:, notification_id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/#{calendar_id}/notifications/#{notification_id}",
    security: ["bearer"],
    body: body
  )
end

#update_schedule(id:, body:, **_opts) ⇒ Object

Update user availability schedule

Modify an existing schedule by updating its rules, timezone, and name All fields are optional - only provided fields will be updated.



392
393
394
395
396
397
398
399
# File 'lib/high_level/resources/calendars.rb', line 392

def update_schedule(id:, body:, **_opts)
  request(
    method: :put,
    path: "/calendars/schedules/#{id}",
    security: ["bearer"],
    body: body
  )
end

#validate_groups_slug(body:, **_opts) ⇒ Object

Validate group slug

Validate if group slug is available or not.



34
35
36
37
38
39
40
41
# File 'lib/high_level/resources/calendars.rb', line 34

def validate_groups_slug(body:, **_opts)
  request(
    method: :post,
    path: "/calendars/groups/validate-slug",
    security: ["bearer"],
    body: body
  )
end