Something went wrong. Try again.
karitham.dev website! atproto & fancy ssg + csr & blog articles karitham.dev
atproto gleam blog nix
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071//// Generated by codegen from lexicons/. Do not edit by hand.
import gleam/dynamic/decodeimport gleam/jsonimport gleam/listimport gleam/option.{type Option}import gen/internal
pub type ArtistView { ArtistView( artist_mb_id: Option(String), artist_name: String, )}
pub fn artist_view_fields(value: ArtistView) -> List(#(String, json.Json)) { list.flatten([ [#("artistName", json.string(value.artist_name))], internal.opt("artistMbId", value.artist_mb_id, json.string), ])}
pub fn encode_artist_view(value: ArtistView) -> json.Json { json.object(artist_view_fields(value))}
pub fn artist_view_decoder() -> decode.Decoder(ArtistView) { use artist_mb_id <- decode.optional_field("artistMbId", option.None, decode.optional(decode.string)) use artist_name <- decode.field("artistName", decode.string) decode.success(ArtistView(artist_mb_id:, artist_name:))}
pub const collection = "fm.teal.feed.play"
pub type FeedPlay { FeedPlay( artists: List(ArtistView), duration: Option(Int), origin_uri: Option(String), played_time: String, release_name: Option(String), track_name: String, )}
pub fn feed_play_fields(value: FeedPlay) -> List(#(String, json.Json)) { list.flatten([ [#("artists", fn(items) { json.array(items, encode_artist_view) }(value.artists)), #("playedTime", json.string(value.played_time)), #("trackName", json.string(value.track_name))], internal.opt("duration", value.duration, json.int), internal.opt("originUri", value.origin_uri, json.string), internal.opt("releaseName", value.release_name, json.string), ])}
pub fn encode_feed_play(value: FeedPlay) -> json.Json { json.object([ #("$type", json.string("fm.teal.feed.play")), ..feed_play_fields(value) ])}
pub fn feed_play_decoder() -> decode.Decoder(FeedPlay) { use artists <- decode.field("artists", decode.list(artist_view_decoder())) use duration <- decode.optional_field("duration", option.None, decode.optional(decode.int)) use origin_uri <- decode.optional_field("originUri", option.None, decode.optional(decode.string)) use played_time <- decode.field("playedTime", decode.string) use release_name <- decode.optional_field("releaseName", option.None, decode.optional(decode.string)) use track_name <- decode.field("trackName", decode.string) decode.success(FeedPlay(artists:, duration:, origin_uri:, played_time:, release_name:, track_name:))}