fiberplane_models/providers/schema/fields/
file_field.rs1#[cfg(feature = "fp-bindgen")]
2use fp_bindgen::prelude::Serializable;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
9#[cfg_attr(
10 feature = "fp-bindgen",
11 derive(Serializable),
12 fp(rust_module = "fiberplane_models::providers")
13)]
14#[non_exhaustive]
15#[serde(rename_all = "camelCase")]
16pub struct FileField {
17 pub name: String,
20
21 pub label: String,
23
24 pub multiple: bool,
26
27 pub required: bool,
29}
30
31impl FileField {
32 pub fn new() -> Self {
34 Default::default()
35 }
36
37 pub fn multiple(self) -> Self {
39 Self {
40 multiple: true,
41 ..self
42 }
43 }
44
45 pub fn required(self) -> Self {
47 Self {
48 required: true,
49 ..self
50 }
51 }
52
53 pub fn with_label(self, label: &str) -> Self {
54 Self {
55 label: label.to_owned(),
56 ..self
57 }
58 }
59
60 pub fn with_name(self, name: &str) -> Self {
61 Self {
62 name: name.to_owned(),
63 ..self
64 }
65 }
66}