createCalendarEvent method

Future<CreateCalendarEvent201Response?> createCalendarEvent(
  1. CreateEventRequest createEventRequest, {
  2. String? xWorkspaceID,
})

Create a calendar event.

Single-account create. account_id is required (no auto-resolve for write operations). Reminder array is mirrored into native tasks under the hood; conference data is auto-attached when conference_type is supplied.

Parameters:

  • CreateEventRequest createEventRequest (required):

  • String xWorkspaceID: Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.

Implementation

Future<CreateCalendarEvent201Response?> createCalendarEvent(CreateEventRequest createEventRequest, { String? xWorkspaceID, }) async {
  final response = await createCalendarEventWithHttpInfo(createEventRequest,  xWorkspaceID: xWorkspaceID, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CreateCalendarEvent201Response',) as CreateCalendarEvent201Response;

  }
  return null;
}