lib/spatio/model/email.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.Email do
  @moduledoc """
  A single email message. The `provider`/`accountId` provenance fields tell clients which connected mail account this row came from (Gmail, Outlook, etc.) so multi-account list responses can be merged sensibly client-side. 
  """

  @derive JSON.Encoder
  defstruct [
    :id,
    :threadId,
    :provider,
    :accountId,
    :subject,
    :from,
    :to,
    :cc,
    :bcc,
    :body,
    :html,
    :date,
    :labels,
    :isRead,
    :isStarred,
    :attachments,
    :snippet,
    :messageId,
    :inReplyTo,
    :references
  ]

  @type t :: %__MODULE__{
    :id => String.t,
    :threadId => String.t | nil,
    :provider => String.t | nil,
    :accountId => String.t | nil,
    :subject => String.t,
    :from => String.t,
    :to => [String.t],
    :cc => [String.t] | nil,
    :bcc => [String.t] | nil,
    :body => String.t,
    :html => boolean(),
    :date => DateTime.t,
    :labels => [String.t] | nil,
    :isRead => boolean(),
    :isStarred => boolean(),
    :attachments => [Spatio.Model.AttachmentMeta.t] | nil,
    :snippet => String.t | nil,
    :messageId => String.t | nil,
    :inReplyTo => String.t | nil,
    :references => [String.t] | nil
  }

  alias Spatio.Deserializer

  def decode(value) do
    value
     |> Deserializer.deserialize(:attachments, :list, Spatio.Model.AttachmentMeta)
  end
end