braze_sync/resource/
mod.rs1pub mod catalog;
10pub mod content_block;
11pub mod custom_attribute;
12pub mod email_template;
13
14pub use catalog::{Catalog, CatalogField, CatalogFieldType};
15pub use content_block::{ContentBlock, ContentBlockState};
16pub use custom_attribute::{CustomAttribute, CustomAttributeRegistry, CustomAttributeType};
17pub use email_template::EmailTemplate;
18
19#[derive(Debug, Clone, PartialEq)]
24pub enum Resource {
25 CatalogSchema(Catalog),
26 ContentBlock(ContentBlock),
27 EmailTemplate(EmailTemplate),
28 CustomAttributeRegistry(CustomAttributeRegistry),
29}
30
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, clap::ValueEnum)]
34#[clap(rename_all = "snake_case")]
35pub enum ResourceKind {
36 CatalogSchema,
37 ContentBlock,
38 EmailTemplate,
39 CustomAttribute,
40}
41
42impl ResourceKind {
43 pub fn as_str(&self) -> &'static str {
44 match self {
45 Self::CatalogSchema => "catalog_schema",
46 Self::ContentBlock => "content_block",
47 Self::EmailTemplate => "email_template",
48 Self::CustomAttribute => "custom_attribute",
49 }
50 }
51
52 pub fn all() -> &'static [Self] {
53 &[
54 Self::CatalogSchema,
55 Self::ContentBlock,
56 Self::EmailTemplate,
57 Self::CustomAttribute,
58 ]
59 }
60}
61
62impl Resource {
63 pub fn kind(&self) -> ResourceKind {
64 match self {
65 Self::CatalogSchema(_) => ResourceKind::CatalogSchema,
66 Self::ContentBlock(_) => ResourceKind::ContentBlock,
67 Self::EmailTemplate(_) => ResourceKind::EmailTemplate,
68 Self::CustomAttributeRegistry(_) => ResourceKind::CustomAttribute,
69 }
70 }
71}