encode<V> static method
V
encode<
V>( - FileLink instance,
- Encoder<V> encoder
)
Implementation
static V encode<V>(
FileLink instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
container.encodeDateTime(
'created',
instance.created,
);
container.encodeBool(
'expired',
instance.expired,
);
if (instance.expiresAt != null) {
container.encodeDateTime(
'expires_at',
instance.expiresAt!,
);
}
FileOrId.encode(
instance.file,
container.nestedSingleValueContainer('file').encoder,
);
container.encodeString(
'id',
instance.id,
);
container.encodeBool(
'livemode',
instance.livemode,
);
container.encodeMap(
'metadata',
(container) => instance.metadata.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
container.encodeString(
'object',
'file_link',
);
if (instance.url != null) {
container.encodeString(
'url',
instance.url!,
);
}
return container.value;
}