Current section
Files
Jump to
Current section
Files
src/plunk@internal@contacts_def.erl
-module(plunk@internal@contacts_def).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-define(FILEPATH, "src/plunk/internal/contacts_def.gleam").
-export([get_contact_decoder/0, list_contacts_decoder/0, count_decoder/0, created_contact_decoder/0, deleted_contact_decoder/0, subscription_decoder/0]).
-export_type([event/0, action/0, trigger/0, email/0, extended_contact/0, contact/0, created_contact/0, count/0, subscription/0, deleted_contact/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-type event() :: {event,
binary(),
binary(),
binary(),
gleam@option:option(binary()),
gleam@option:option(binary()),
binary(),
binary()}.
-type action() :: {action,
binary(),
binary(),
boolean(),
integer(),
gleam@option:option(binary()),
gleam@option:option(binary()),
binary(),
binary()}.
-type trigger() :: {trigger,
binary(),
binary(),
binary(),
gleam@option:option(binary()),
binary(),
binary(),
gleam@option:option(event()),
gleam@option:option(action())}.
-type email() :: {email,
binary(),
binary(),
binary(),
binary(),
binary(),
binary(),
gleam@option:option(binary()),
gleam@option:option(binary()),
binary(),
binary(),
binary()}.
-type extended_contact() :: {extended_contact,
binary(),
binary(),
gleam@option:option(binary()),
binary(),
binary(),
list(trigger()),
list(email())}.
-type contact() :: {contact,
binary(),
binary(),
boolean(),
gleam@option:option(binary()),
binary(),
binary()}.
-type created_contact() :: {created_contact,
boolean(),
binary(),
binary(),
boolean(),
gleam@option:option(gleam@dynamic:dynamic_()),
binary(),
binary()}.
-type count() :: {count, integer()}.
-type subscription() :: {subscription, boolean(), binary(), boolean()}.
-type deleted_contact() :: {deleted_contact,
boolean(),
binary(),
binary(),
boolean(),
gleam@option:option(gleam@dynamic:dynamic_()),
binary(),
binary()}.
-file("src/plunk/internal/contacts_def.gleam", 115).
?DOC(false).
-spec action_decoder() -> gleam@dynamic@decode:decoder(action()).
action_decoder() ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"name"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Name) ->
gleam@dynamic@decode:field(
<<"runOnce"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_bool/1},
fun(Run_once) ->
gleam@dynamic@decode:field(
<<"delay"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Delay) ->
gleam@dynamic@decode:field(
<<"projectId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Project_id) ->
gleam@dynamic@decode:field(
<<"templateId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Template_id) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:success(
{action,
Id,
Name,
Run_once,
Delay,
Project_id,
Template_id,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 136).
?DOC(false).
-spec event_decoder() -> gleam@dynamic@decode:decoder(event()).
event_decoder() ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"name"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Name) ->
gleam@dynamic@decode:field(
<<"projectId"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Project_id) ->
gleam@dynamic@decode:field(
<<"templateId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Template_id) ->
gleam@dynamic@decode:field(
<<"campaignId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Campaign_id) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:success(
{event,
Id,
Name,
Project_id,
Template_id,
Campaign_id,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 155).
?DOC(false).
-spec trigger_decoder() -> gleam@dynamic@decode:decoder(trigger()).
trigger_decoder() ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"contactId"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Contact_id) ->
gleam@dynamic@decode:field(
<<"eventId"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Event_id) ->
gleam@dynamic@decode:field(
<<"actionId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Action_id) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:field(
<<"event"/utf8>>,
gleam@dynamic@decode:optional(
event_decoder()
),
fun(Event) ->
gleam@dynamic@decode:field(
<<"action"/utf8>>,
gleam@dynamic@decode:optional(
action_decoder(
)
),
fun(Action) ->
gleam@dynamic@decode:success(
{trigger,
Id,
Contact_id,
Event_id,
Action_id,
Created_at,
Updated_at,
Event,
Action}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 176).
?DOC(false).
-spec email_decoder() -> gleam@dynamic@decode:decoder(email()).
email_decoder() ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"messageId"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Message_id) ->
gleam@dynamic@decode:field(
<<"subject"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Subject) ->
gleam@dynamic@decode:field(
<<"body"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Body) ->
gleam@dynamic@decode:field(
<<"status"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Status) ->
gleam@dynamic@decode:field(
<<"projectId"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Project_id) ->
gleam@dynamic@decode:field(
<<"actionId"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Action_id) ->
gleam@dynamic@decode:optional_field(
<<"campaignId"/utf8>>,
none,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Campaign_id) ->
gleam@dynamic@decode:field(
<<"contactId"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(
Contact_id
) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(
Created_at
) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(
Updated_at
) ->
gleam@dynamic@decode:success(
{email,
Id,
Message_id,
Subject,
Body,
Status,
Project_id,
Action_id,
Campaign_id,
Contact_id,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 207).
?DOC(false).
-spec get_contact_decoder() -> gleam@dynamic@decode:decoder(extended_contact()).
get_contact_decoder() ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"email"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Email) ->
gleam@dynamic@decode:field(
<<"data"/utf8>>,
gleam@dynamic@decode:optional(
{decoder, fun gleam@dynamic@decode:decode_string/1}
),
fun(Data) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:field(
<<"triggers"/utf8>>,
gleam@dynamic@decode:list(
trigger_decoder()
),
fun(Triggers) ->
gleam@dynamic@decode:field(
<<"emails"/utf8>>,
gleam@dynamic@decode:list(
email_decoder()
),
fun(Emails) ->
gleam@dynamic@decode:success(
{extended_contact,
Id,
Email,
Data,
Created_at,
Updated_at,
Triggers,
Emails}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 226).
?DOC(false).
-spec list_contacts_decoder() -> gleam@dynamic@decode:decoder(list(contact())).
list_contacts_decoder() ->
gleam@dynamic@decode:list(
begin
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"email"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Email) ->
gleam@dynamic@decode:field(
<<"subscribed"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_bool/1},
fun(Subscribed) ->
gleam@dynamic@decode:field(
<<"data"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_string/1}
),
fun(Data) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:success(
{contact,
Id,
Email,
Subscribed,
Data,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 245).
?DOC(false).
-spec count_decoder() -> gleam@dynamic@decode:decoder(count()).
count_decoder() ->
gleam@dynamic@decode:field(
<<"count"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Count) -> gleam@dynamic@decode:success({count, Count}) end
).
-file("src/plunk/internal/contacts_def.gleam", 250).
?DOC(false).
-spec created_contact_decoder() -> gleam@dynamic@decode:decoder(created_contact()).
created_contact_decoder() ->
gleam@dynamic@decode:field(
<<"success"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_bool/1},
fun(Success) ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"email"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Email) ->
gleam@dynamic@decode:field(
<<"subscribed"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_bool/1},
fun(Subscribed) ->
gleam@dynamic@decode:field(
<<"data"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_dynamic/1}
),
fun(Data) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:success(
{created_contact,
Success,
Id,
Email,
Subscribed,
Data,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 269).
?DOC(false).
-spec deleted_contact_decoder() -> gleam@dynamic@decode:decoder(deleted_contact()).
deleted_contact_decoder() ->
gleam@dynamic@decode:field(
<<"success"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_bool/1},
fun(Success) ->
gleam@dynamic@decode:field(
<<"id"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Id) ->
gleam@dynamic@decode:field(
<<"email"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Email) ->
gleam@dynamic@decode:field(
<<"subscribed"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_bool/1},
fun(Subscribed) ->
gleam@dynamic@decode:field(
<<"data"/utf8>>,
gleam@dynamic@decode:optional(
{decoder,
fun gleam@dynamic@decode:decode_dynamic/1}
),
fun(Data) ->
gleam@dynamic@decode:field(
<<"createdAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Created_at) ->
gleam@dynamic@decode:field(
<<"updatedAt"/utf8>>,
{decoder,
fun gleam@dynamic@decode:decode_string/1},
fun(Updated_at) ->
gleam@dynamic@decode:success(
{deleted_contact,
Success,
Id,
Email,
Subscribed,
Data,
Created_at,
Updated_at}
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-file("src/plunk/internal/contacts_def.gleam", 288).
?DOC(false).
-spec subscription_decoder() -> gleam@dynamic@decode:decoder(subscription()).
subscription_decoder() ->
gleam@dynamic@decode:field(
<<"success"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_bool/1},
fun(Success) ->
gleam@dynamic@decode:field(
<<"contact"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Contact) ->
gleam@dynamic@decode:field(
<<"subscribed"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_bool/1},
fun(Subscribed) ->
gleam@dynamic@decode:success(
{subscription, Success, Contact, Subscribed}
)
end
)
end
)
end
).