lib/spatio/model/spatio_event.ex

# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule Spatio.Model.SpatioEvent do
  @moduledoc """
  A calendar event. Calendar uses snake_case JSON keys (different from Notes/Sheets/Slides/Tasks/Mail which use camelCase) — the surface predates the cross-platform convention. 
  """

  @derive JSON.Encoder
  defstruct [
    :id,
    :title,
    :description,
    :start_time,
    :end_time,
    :all_day,
    :location,
    :location_details,
    :organizer,
    :attendees,
    :recurrence_rule,
    :recurrence_id,
    :original_start,
    :status,
    :visibility,
    :busy,
    :reminders,
    :travel_time_minutes,
    :categories,
    :color,
    :user_id,
    :account_id,
    :provider,
    :provider_id,
    :provider_data,
    :created_at,
    :updated_at,
    :deleted_at,
    :synced_at,
    :conference_data,
    :attachments,
    :url,
    :etag,
    :sequence,
    :custom_data
  ]

  @type t :: %__MODULE__{
    :id => String.t,
    :title => String.t,
    :description => String.t | nil,
    :start_time => DateTime.t,
    :end_time => DateTime.t,
    :all_day => boolean(),
    :location => String.t | nil,
    :location_details => %{optional(String.t) => String.t} | nil,
    :organizer => String.t | nil,
    :attendees => [Spatio.Model.Attendee.t] | nil,
    :recurrence_rule => String.t | nil,
    :recurrence_id => String.t | nil,
    :original_start => DateTime.t | nil,
    :status => String.t,
    :visibility => String.t,
    :busy => boolean(),
    :reminders => [Spatio.Model.Reminder.t] | nil,
    :travel_time_minutes => integer() | nil,
    :categories => [String.t] | nil,
    :color => String.t | nil,
    :user_id => String.t | nil,
    :account_id => String.t,
    :provider => String.t | nil,
    :provider_id => String.t,
    :provider_data => %{optional(String.t) => any()} | nil,
    :created_at => DateTime.t,
    :updated_at => DateTime.t,
    :deleted_at => DateTime.t | nil,
    :synced_at => DateTime.t | nil,
    :conference_data => Spatio.Model.ConferenceData.t | nil,
    :attachments => [Spatio.Model.Attachment.t] | nil,
    :url => Uri | nil,
    :etag => String.t | nil,
    :sequence => integer() | nil,
    :custom_data => %{optional(String.t) => String.t} | nil
  }

  alias Spatio.Deserializer

  def decode(value) do
    value
     |> Deserializer.deserialize(:attendees, :list, Spatio.Model.Attendee)
     |> Deserializer.deserialize(:reminders, :list, Spatio.Model.Reminder)
     |> Deserializer.deserialize(:conference_data, :struct, Spatio.Model.ConferenceData)
     |> Deserializer.deserialize(:attachments, :list, Spatio.Model.Attachment)
     |> Deserializer.deserialize(:url, :struct, Spatio.Model.Uri)
  end
end