Current section
Files
Jump to
Current section
Files
src/gtfs_rt_nyct.erl
-module(gtfs_rt_nyct).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/gtfs_rt_nyct.gleam").
-export([feed_message_decoder/0]).
-export_type([feed_message/0, feed_header/0, nyct_header/0, trip_replacement_period/0, feed_entity/0, feed_entity_data/0, mercury_alert/0, trip_descriptor/0, nyct_trip_descriptor/0, stop_time_update/0, nyct_stop_time_update/0, stop_time_event/0, vehicle_stop_status/0, entity_selector/0, mercury_entity_selector/0, date/0, time_range/0, unix_time/0, translated_string/0, translation/0]).
-type feed_message() :: {feed_message, feed_header(), list(feed_entity())}.
-type feed_header() :: {feed_header, binary(), unix_time(), nyct_header()}.
-type nyct_header() :: {nyct_header, binary(), list(trip_replacement_period())}.
-type trip_replacement_period() :: {trip_replacement_period,
gleam@option:option(binary()),
unix_time()}.
-type feed_entity() :: {feed_entity, binary(), feed_entity_data()}.
-type feed_entity_data() :: {trip_update,
trip_descriptor(),
list(stop_time_update())} |
{vehicle_position,
trip_descriptor(),
gleam@option:option(integer()),
vehicle_stop_status(),
unix_time(),
binary()} |
{alert,
list(time_range()),
list(entity_selector()),
translated_string(),
gleam@option:option(translated_string()),
gleam@option:option(mercury_alert())}.
-type mercury_alert() :: {mercury_alert,
unix_time(),
unix_time(),
binary(),
list({entity_selector(), translated_string()}),
integer(),
gleam@option:option(translated_string()),
gleam@option:option(binary())}.
-type trip_descriptor() :: {trip_descriptor,
binary(),
gleam@option:option(date()),
binary(),
nyct_trip_descriptor()}.
-type nyct_trip_descriptor() :: {nyct_trip_descriptor,
gleam@option:option(binary()),
boolean()}.
-type stop_time_update() :: {stop_time_update,
gleam@option:option(stop_time_event()),
gleam@option:option(stop_time_event()),
binary(),
nyct_stop_time_update()}.
-type nyct_stop_time_update() :: {nyct_stop_time_update,
gleam@option:option(binary()),
gleam@option:option(binary())}.
-type stop_time_event() :: {stop_time_event, unix_time()}.
-type vehicle_stop_status() :: incoming | stopped | in_transit.
-type entity_selector() :: {entity_selector,
gleam@option:option(binary()),
gleam@option:option(binary()),
gleam@option:option(trip_descriptor()),
gleam@option:option(binary()),
gleam@option:option(mercury_entity_selector())}.
-type mercury_entity_selector() :: {mercury_entity_selector, binary()}.
-type date() :: {date, integer(), integer(), integer()}.
-type time_range() :: {time_range,
gleam@option:option(unix_time()),
gleam@option:option(unix_time())}.
-type unix_time() :: {unix_time, integer()}.
-type translated_string() :: {translated_string, list(translation())}.
-type translation() :: {translation, binary(), gleam@option:option(binary())}.
-file("src/gtfs_rt_nyct.gleam", 945).
-spec unix_time_decoder() -> gleam@dynamic@decode:decoder(unix_time()).
unix_time_decoder() ->
gleam@dynamic@decode:then(
protobin:decode_uint(),
fun(Seconds) -> _pipe = {unix_time, Seconds},
gleam@dynamic@decode:success(_pipe) end
).
-file("src/gtfs_rt_nyct.gleam", 739).
-spec stop_time_event_decoder() -> gleam@dynamic@decode:decoder(stop_time_event()).
stop_time_event_decoder() ->
gleam@dynamic@decode:field(
2,
unix_time_decoder(),
fun(Time) -> _pipe = {stop_time_event, Time},
gleam@dynamic@decode:success(_pipe) end
).
-file("src/gtfs_rt_nyct.gleam", 591).
-spec nyct_trip_descriptor_bin_decoder() -> gleam@dynamic@decode:decoder(nyct_trip_descriptor()).
nyct_trip_descriptor_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:optional_field(
1,
none,
begin
_pipe = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Train_id) ->
gleam@dynamic@decode:optional_field(
2,
false,
protobin:decode_bool(),
fun(Is_assigned) ->
_pipe@1 = {nyct_trip_descriptor,
Train_id,
Is_assigned},
gleam@dynamic@decode:success(_pipe@1)
end
)
end
)
end,
<<"NyctTripDescriptor"/utf8>>,
{nyct_trip_descriptor, none, false}
).
-file("src/gtfs_rt_nyct.gleam", 694).
-spec nyct_stop_time_bin_decoder() -> gleam@dynamic@decode:decoder(nyct_stop_time_update()).
nyct_stop_time_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:optional_field(
1,
none,
begin
_pipe = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Scheduled_track) ->
gleam@dynamic@decode:optional_field(
2,
none,
begin
_pipe@1 = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Actual_track) ->
_pipe@2 = {nyct_stop_time_update,
Scheduled_track,
Actual_track},
gleam@dynamic@decode:success(_pipe@2)
end
)
end
)
end,
<<"NyctStopTimeUpdate"/utf8>>,
{nyct_stop_time_update, none, none}
).
-file("src/gtfs_rt_nyct.gleam", 764).
-spec vehicle_stop_status_decoder() -> gleam@dynamic@decode:decoder(vehicle_stop_status()).
vehicle_stop_status_decoder() ->
gleam@dynamic@decode:then(
protobin:decode_uint(),
fun(Variant) -> case Variant of
0 ->
_pipe = incoming,
gleam@dynamic@decode:success(_pipe);
1 ->
_pipe@1 = stopped,
gleam@dynamic@decode:success(_pipe@1);
2 ->
_pipe@2 = in_transit,
gleam@dynamic@decode:success(_pipe@2);
_ ->
gleam@dynamic@decode:failure(
in_transit,
<<"VehicleStopStatus"/utf8>>
)
end end
).
-file("src/gtfs_rt_nyct.gleam", 860).
-spec mercury_entity_selector_bin_decoder() -> gleam@dynamic@decode:decoder(mercury_entity_selector()).
mercury_entity_selector_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Sort_order) ->
_pipe = {mercury_entity_selector, Sort_order},
gleam@dynamic@decode:success(_pipe)
end
)
end,
<<"MercuryEntitySelector"/utf8>>,
{mercury_entity_selector, <<""/utf8>>}
).
-file("src/gtfs_rt_nyct.gleam", 883).
-spec date_decoder() -> gleam@dynamic@decode:decoder(date()).
date_decoder() ->
gleam@dynamic@decode:then(
protobin:decode_string(),
fun(Date) ->
Date@1 = begin
gleam@result:'try'(
begin
_pipe = Date,
_pipe@1 = gleam@string:slice(_pipe, 0, 4),
gleam_stdlib:parse_int(_pipe@1)
end,
fun(Year) ->
gleam@result:'try'(
begin
_pipe@2 = Date,
_pipe@3 = gleam@string:slice(_pipe@2, 4, 2),
gleam_stdlib:parse_int(_pipe@3)
end,
fun(Month) ->
gleam@result:'try'(
begin
_pipe@4 = Date,
_pipe@5 = gleam@string:slice(
_pipe@4,
6,
2
),
gleam_stdlib:parse_int(_pipe@5)
end,
fun(Day) ->
_pipe@6 = {date, Year, Month, Day},
{ok, _pipe@6}
end
)
end
)
end
)
end,
case Date@1 of
{ok, Date@2} ->
gleam@dynamic@decode:success(Date@2);
{error, nil} ->
gleam@dynamic@decode:failure(
{date, 1970, 1, 1},
<<"Date"/utf8>>
)
end
end
).
-file("src/gtfs_rt_nyct.gleam", 525).
-spec trip_descriptor_decoder() -> gleam@dynamic@decode:decoder(trip_descriptor()).
trip_descriptor_decoder() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Trip_id) ->
gleam@dynamic@decode:optional_field(
3,
none,
begin
_pipe = date_decoder(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Start_date) ->
gleam@dynamic@decode:field(
5,
protobin:decode_string(),
fun(Route_id) ->
gleam@dynamic@decode:field(
1001,
nyct_trip_descriptor_bin_decoder(),
fun(Nyct) ->
gleam@dynamic@decode:success(
{trip_descriptor,
Trip_id,
Start_date,
Route_id,
Nyct}
)
end
)
end
)
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 537).
-spec trip_descriptor_bin_decoder() -> gleam@dynamic@decode:decoder(trip_descriptor()).
trip_descriptor_bin_decoder() ->
protobin:decode_protobuf(
fun trip_descriptor_decoder/0,
<<"TripDescriptor"/utf8>>,
{trip_descriptor,
<<""/utf8>>,
{some, {date, 1970, 1, 1}},
<<""/utf8>>,
{nyct_trip_descriptor, none, false}}
).
-file("src/gtfs_rt_nyct.gleam", 802).
-spec entity_selector_decoder() -> gleam@dynamic@decode:decoder(entity_selector()).
entity_selector_decoder() ->
gleam@dynamic@decode:optional_field(
1,
none,
begin
_pipe = protobin:decode_string(),
gleam@dynamic@decode:map(_pipe, fun(Field@0) -> {some, Field@0} end)
end,
fun(Agency_id) ->
gleam@dynamic@decode:optional_field(
2,
none,
begin
_pipe@1 = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Route_id) ->
gleam@dynamic@decode:optional_field(
4,
none,
begin
_pipe@2 = trip_descriptor_bin_decoder(),
gleam@dynamic@decode:map(
_pipe@2,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Trip) ->
gleam@dynamic@decode:optional_field(
5,
none,
begin
_pipe@3 = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe@3,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Stop_id) ->
gleam@dynamic@decode:optional_field(
1001,
none,
begin
_pipe@4 = mercury_entity_selector_bin_decoder(
),
gleam@dynamic@decode:map(
_pipe@4,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Mercury_entity_selector) ->
_pipe@5 = {entity_selector,
Agency_id,
Route_id,
Trip,
Stop_id,
Mercury_entity_selector},
gleam@dynamic@decode:success(
_pipe@5
)
end
)
end
)
end
)
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 839).
-spec entity_selector_bin_decoder() -> gleam@dynamic@decode:decoder(entity_selector()).
entity_selector_bin_decoder() ->
protobin:decode_protobuf(
fun entity_selector_decoder/0,
<<"EntitySelector"/utf8>>,
{entity_selector, none, none, none, none, none}
).
-file("src/gtfs_rt_nyct.gleam", 918).
-spec time_range_bin_decoder() -> gleam@dynamic@decode:decoder(time_range()).
time_range_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:optional_field(
1,
none,
begin
_pipe = unix_time_decoder(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Start) ->
gleam@dynamic@decode:optional_field(
2,
none,
begin
_pipe@1 = unix_time_decoder(),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(End) -> _pipe@2 = {time_range, Start, End},
gleam@dynamic@decode:success(_pipe@2) end
)
end
)
end,
<<"TimeRange"/utf8>>,
{time_range, none, none}
).
-file("src/gtfs_rt_nyct.gleam", 122).
-spec trip_replacement_period_decoder() -> gleam@dynamic@decode:decoder(trip_replacement_period()).
trip_replacement_period_decoder() ->
gleam@dynamic@decode:optional_field(
1,
none,
begin
_pipe = protobin:decode_string(),
gleam@dynamic@decode:map(_pipe, fun(Field@0) -> {some, Field@0} end)
end,
fun(Route_id) ->
gleam@dynamic@decode:field(
2,
begin
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
2,
unix_time_decoder(),
fun(Time) -> _pipe@1 = Time,
gleam@dynamic@decode:success(_pipe@1) end
)
end,
<<"ReplacementPeriod"/utf8>>,
{unix_time, 0}
)
end,
fun(Replacement_period) ->
gleam@dynamic@decode:success(
{trip_replacement_period, Route_id, Replacement_period}
)
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 141).
-spec trip_replacement_period_bin_decoder() -> gleam@dynamic@decode:decoder(trip_replacement_period()).
trip_replacement_period_bin_decoder() ->
protobin:decode_protobuf(
fun trip_replacement_period_decoder/0,
<<"TripReplacementPeriod"/utf8>>,
{trip_replacement_period, none, {unix_time, 0}}
).
-file("src/gtfs_rt_nyct.gleam", 85).
-spec nyct_header_bin_decoder() -> gleam@dynamic@decode:decoder(nyct_header()).
nyct_header_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Version) ->
gleam@dynamic@decode:optional_field(
2,
[],
gleam@dynamic@decode:list(
trip_replacement_period_bin_decoder()
),
fun(Trip_replacement_periods) ->
gleam@dynamic@decode:success(
{nyct_header, Version, Trip_replacement_periods}
)
end
)
end
)
end,
<<"NyctHeader"/utf8>>,
{nyct_header, <<"1.0"/utf8>>, []}
).
-file("src/gtfs_rt_nyct.gleam", 52).
-spec feed_header_decoder() -> gleam@dynamic@decode:decoder(feed_header()).
feed_header_decoder() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Gtfs_realtime_version) ->
gleam@dynamic@decode:field(
3,
unix_time_decoder(),
fun(Timestamp) ->
gleam@dynamic@decode:field(
1001,
nyct_header_bin_decoder(),
fun(Nyct) ->
gleam@dynamic@decode:success(
{feed_header,
Gtfs_realtime_version,
Timestamp,
Nyct}
)
end
)
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 59).
-spec feed_header_bin_decoder() -> gleam@dynamic@decode:decoder(feed_header()).
feed_header_bin_decoder() ->
protobin:decode_protobuf(
fun feed_header_decoder/0,
<<"FeedHeader"/utf8>>,
{feed_header,
<<"1.0"/utf8>>,
{unix_time, 0},
{nyct_header, <<"1.0"/utf8>>, []}}
).
-file("src/gtfs_rt_nyct.gleam", 339).
-spec vehicle_position_bin_decoder() -> gleam@dynamic@decode:decoder(feed_entity_data()).
vehicle_position_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
trip_descriptor_bin_decoder(),
fun(Trip) ->
gleam@dynamic@decode:optional_field(
3,
none,
begin
_pipe = protobin:decode_uint(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Current_stop_sequence) ->
gleam@dynamic@decode:optional_field(
4,
in_transit,
vehicle_stop_status_decoder(),
fun(Current_status) ->
gleam@dynamic@decode:field(
5,
unix_time_decoder(),
fun(Timestamp) ->
gleam@dynamic@decode:field(
7,
protobin:decode_string(),
fun(Stop_id) ->
_pipe@1 = {vehicle_position,
Trip,
Current_stop_sequence,
Current_status,
Timestamp,
Stop_id},
gleam@dynamic@decode:success(
_pipe@1
)
end
)
end
)
end
)
end
)
end
)
end,
<<"VehiclePosition"/utf8>>,
{vehicle_position,
{trip_descriptor,
<<""/utf8>>,
{some, {date, 1970, 1, 1}},
<<""/utf8>>,
{nyct_trip_descriptor, none, false}},
none,
in_transit,
{unix_time, 0},
<<""/utf8>>}
).
-file("src/gtfs_rt_nyct.gleam", 744).
-spec stop_time_event_bin_decoder() -> gleam@dynamic@decode:decoder(stop_time_event()).
stop_time_event_bin_decoder() ->
protobin:decode_protobuf(
fun stop_time_event_decoder/0,
<<"StopTimeEvent"/utf8>>,
{stop_time_event, {unix_time, 0}}
).
-file("src/gtfs_rt_nyct.gleam", 629).
-spec stop_time_update_decoder() -> gleam@dynamic@decode:decoder(stop_time_update()).
stop_time_update_decoder() ->
gleam@dynamic@decode:optional_field(
2,
none,
begin
_pipe = stop_time_event_bin_decoder(),
gleam@dynamic@decode:map(_pipe, fun(Field@0) -> {some, Field@0} end)
end,
fun(Arrival) ->
gleam@dynamic@decode:optional_field(
3,
none,
begin
_pipe@1 = stop_time_event_bin_decoder(),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Departure) ->
gleam@dynamic@decode:field(
4,
protobin:decode_string(),
fun(Stop_id) ->
gleam@dynamic@decode:field(
1001,
nyct_stop_time_bin_decoder(),
fun(Nyct) ->
gleam@dynamic@decode:success(
{stop_time_update,
Arrival,
Departure,
Stop_id,
Nyct}
)
end
)
end
)
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 645).
-spec stop_time_update_bin_decoder() -> gleam@dynamic@decode:decoder(stop_time_update()).
stop_time_update_bin_decoder() ->
protobin:decode_protobuf(
fun stop_time_update_decoder/0,
<<"StopTimeUpdate"/utf8>>,
{stop_time_update,
{some, {stop_time_event, {unix_time, 0}}},
{some, {stop_time_event, {unix_time, 0}}},
<<""/utf8>>,
{nyct_stop_time_update, none, none}}
).
-file("src/gtfs_rt_nyct.gleam", 323).
-spec trip_update_bin_decoder() -> gleam@dynamic@decode:decoder(feed_entity_data()).
trip_update_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
trip_descriptor_bin_decoder(),
fun(Trip) ->
gleam@dynamic@decode:optional_field(
2,
[],
gleam@dynamic@decode:list(
stop_time_update_bin_decoder()
),
fun(Stop_time_updates) ->
_pipe = {trip_update, Trip, Stop_time_updates},
gleam@dynamic@decode:success(_pipe)
end
)
end
)
end,
<<"TripUpdate"/utf8>>,
{trip_update,
{trip_descriptor,
<<""/utf8>>,
{some, {date, 1970, 1, 1}},
<<""/utf8>>,
{nyct_trip_descriptor, none, false}},
[]}
).
-file("src/gtfs_rt_nyct.gleam", 992).
-spec translation_bin_decoder() -> gleam@dynamic@decode:decoder(translation()).
translation_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Text) ->
gleam@dynamic@decode:optional_field(
2,
none,
begin
_pipe = protobin:decode_string(),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Language) ->
_pipe@1 = {translation, Text, Language},
gleam@dynamic@decode:success(_pipe@1)
end
)
end
)
end,
<<"Translation"/utf8>>,
{translation, <<""/utf8>>, none}
).
-file("src/gtfs_rt_nyct.gleam", 970).
-spec translated_string_bin_decoder() -> gleam@dynamic@decode:decoder(translated_string()).
translated_string_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
gleam@dynamic@decode:list(translation_bin_decoder()),
fun(Translations) -> _pipe = {translated_string, Translations},
gleam@dynamic@decode:success(_pipe) end
)
end,
<<"TranslatedString"/utf8>>,
{translated_string, []}
).
-file("src/gtfs_rt_nyct.gleam", 448).
-spec mercury_alert_bin_decoder() -> gleam@dynamic@decode:decoder(mercury_alert()).
mercury_alert_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
Station_alternative_bin_decoder = protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:field(
1,
entity_selector_bin_decoder(),
fun(Affected_entity) ->
gleam@dynamic@decode:field(
2,
translated_string_bin_decoder(),
fun(Notes) -> _pipe = {Affected_entity, Notes},
gleam@dynamic@decode:success(_pipe) end
)
end
)
end,
<<"StationAlternative"/utf8>>,
{{entity_selector, none, none, none, none, none},
{translated_string, []}}
),
gleam@dynamic@decode:field(
1,
unix_time_decoder(),
fun(Created_at) ->
gleam@dynamic@decode:field(
1,
unix_time_decoder(),
fun(Updated_at) ->
gleam@dynamic@decode:field(
3,
protobin:decode_string(),
fun(Alert_type) ->
gleam@dynamic@decode:optional_field(
4,
[],
gleam@dynamic@decode:list(
Station_alternative_bin_decoder
),
fun(Station_alternatives) ->
gleam@dynamic@decode:optional_field(
7,
3600,
protobin:decode_uint(),
fun(Display_before_active) ->
gleam@dynamic@decode:optional_field(
8,
none,
begin
_pipe@1 = translated_string_bin_decoder(
),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(
Human_readable_active_period
) ->
gleam@dynamic@decode:optional_field(
13,
none,
begin
_pipe@2 = protobin:decode_string(
),
gleam@dynamic@decode:map(
_pipe@2,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Clone_id) ->
_pipe@3 = {mercury_alert,
Created_at,
Updated_at,
Alert_type,
Station_alternatives,
Display_before_active,
Human_readable_active_period,
Clone_id},
gleam@dynamic@decode:success(
_pipe@3
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end,
<<"MercuryAlert"/utf8>>,
{mercury_alert,
{unix_time, 0},
{unix_time, 0},
<<""/utf8>>,
[],
0,
none,
none}
).
-file("src/gtfs_rt_nyct.gleam", 371).
-spec alert_bin_decoder() -> gleam@dynamic@decode:decoder(feed_entity_data()).
alert_bin_decoder() ->
protobin:decode_protobuf(
fun() ->
gleam@dynamic@decode:optional_field(
1,
[],
gleam@dynamic@decode:list(time_range_bin_decoder()),
fun(Active_periods) ->
gleam@dynamic@decode:optional_field(
5,
[],
gleam@dynamic@decode:list(entity_selector_bin_decoder()),
fun(Informed_entities) ->
gleam@dynamic@decode:field(
10,
translated_string_bin_decoder(),
fun(Header_text) ->
gleam@dynamic@decode:optional_field(
11,
none,
begin
_pipe = translated_string_bin_decoder(
),
gleam@dynamic@decode:map(
_pipe,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Description_text) ->
gleam@dynamic@decode:optional_field(
1001,
none,
begin
_pipe@1 = mercury_alert_bin_decoder(
),
gleam@dynamic@decode:map(
_pipe@1,
fun(Field@0) -> {some, Field@0} end
)
end,
fun(Mercury_alert) ->
_pipe@2 = {alert,
Active_periods,
Informed_entities,
Header_text,
Description_text,
Mercury_alert},
gleam@dynamic@decode:success(
_pipe@2
)
end
)
end
)
end
)
end
)
end
)
end,
<<"Alert"/utf8>>,
{alert, [], [], {translated_string, []}, none, none}
).
-file("src/gtfs_rt_nyct.gleam", 308).
-spec feed_entity_data_decoder() -> gleam@dynamic@decode:decoder(feed_entity_data()).
feed_entity_data_decoder() ->
Trip_update_decoder = gleam@dynamic@decode:field(
3,
trip_update_bin_decoder(),
fun gleam@dynamic@decode:success/1
),
Vehicle_position_decoder = gleam@dynamic@decode:field(
4,
vehicle_position_bin_decoder(),
fun gleam@dynamic@decode:success/1
),
Alert_decoder = gleam@dynamic@decode:field(
5,
alert_bin_decoder(),
fun gleam@dynamic@decode:success/1
),
gleam@dynamic@decode:one_of(
Trip_update_decoder,
[Vehicle_position_decoder, Alert_decoder]
).
-file("src/gtfs_rt_nyct.gleam", 169).
-spec feed_entity_decoder() -> gleam@dynamic@decode:decoder(feed_entity()).
feed_entity_decoder() ->
gleam@dynamic@decode:field(
1,
protobin:decode_string(),
fun(Id) ->
gleam@dynamic@decode:then(
feed_entity_data_decoder(),
fun(Data) ->
gleam@dynamic@decode:success({feed_entity, Id, Data})
end
)
end
).
-file("src/gtfs_rt_nyct.gleam", 175).
-spec feed_entity_bin_decoder() -> gleam@dynamic@decode:decoder(feed_entity()).
feed_entity_bin_decoder() ->
protobin:decode_protobuf(
fun feed_entity_decoder/0,
<<"FeedEntity"/utf8>>,
{feed_entity,
<<""/utf8>>,
{trip_update,
{trip_descriptor,
<<""/utf8>>,
{some, {date, 1970, 1, 1}},
<<""/utf8>>,
{nyct_trip_descriptor, none, false}},
[]}}
).
-file("src/gtfs_rt_nyct.gleam", 26).
-spec feed_message_decoder() -> gleam@dynamic@decode:decoder(feed_message()).
feed_message_decoder() ->
gleam@dynamic@decode:field(
1,
feed_header_bin_decoder(),
fun(Header) ->
gleam@dynamic@decode:field(
2,
gleam@dynamic@decode:list(feed_entity_bin_decoder()),
fun(Entity) ->
gleam@dynamic@decode:success({feed_message, Header, Entity})
end
)
end
).