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