lib/mail_slurp_api/model/webhook_new_email_payload.ex

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

defmodule MailSlurpAPI.Model.WebhookNewEmailPayload do
  @moduledoc """
  NEW_EMAIL webhook payload. Sent to your webhook url endpoint via HTTP POST when an email is received by the inbox that your webhook is attached to. Use the email ID to fetch the full email body or attachments.
  """

  @derive [Poison.Encoder]
  defstruct [
    :"messageId",
    :"webhookId",
    :"eventName",
    :"webhookName",
    :"inboxId",
    :"domainId",
    :"emailId",
    :"createdAt",
    :"to",
    :"from",
    :"cc",
    :"bcc",
    :"subject",
    :"attachmentMetaDatas"
  ]

  @type t :: %__MODULE__{
    :"messageId" => String.t,
    :"webhookId" => String.t,
    :"eventName" => String.t,
    :"webhookName" => String.t | nil,
    :"inboxId" => String.t,
    :"domainId" => String.t | nil,
    :"emailId" => String.t,
    :"createdAt" => DateTime.t,
    :"to" => [String.t],
    :"from" => String.t,
    :"cc" => [String.t],
    :"bcc" => [String.t],
    :"subject" => String.t | nil,
    :"attachmentMetaDatas" => [AttachmentMetaData]
  }
end

defimpl Poison.Decoder, for: MailSlurpAPI.Model.WebhookNewEmailPayload do
  import MailSlurpAPI.Deserializer
  def decode(value, options) do
    value
    |> deserialize(:"attachmentMetaDatas", :list, MailSlurpAPI.Model.AttachmentMetaData, options)
  end
end