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, CatalogItemRow, CatalogItems};
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 CatalogItems(CatalogItems),
27 ContentBlock(ContentBlock),
28 EmailTemplate(EmailTemplate),
29 CustomAttributeRegistry(CustomAttributeRegistry),
30}
31
32#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, clap::ValueEnum)]
35#[clap(rename_all = "snake_case")]
36pub enum ResourceKind {
37 CatalogSchema,
38 CatalogItems,
39 ContentBlock,
40 EmailTemplate,
41 CustomAttribute,
42}
43
44impl ResourceKind {
45 pub fn as_str(&self) -> &'static str {
46 match self {
47 Self::CatalogSchema => "catalog_schema",
48 Self::CatalogItems => "catalog_items",
49 Self::ContentBlock => "content_block",
50 Self::EmailTemplate => "email_template",
51 Self::CustomAttribute => "custom_attribute",
52 }
53 }
54
55 pub fn all() -> &'static [Self] {
56 &[
57 Self::CatalogSchema,
58 Self::CatalogItems,
59 Self::ContentBlock,
60 Self::EmailTemplate,
61 Self::CustomAttribute,
62 ]
63 }
64}
65
66impl Resource {
67 pub fn kind(&self) -> ResourceKind {
68 match self {
69 Self::CatalogSchema(_) => ResourceKind::CatalogSchema,
70 Self::CatalogItems(_) => ResourceKind::CatalogItems,
71 Self::ContentBlock(_) => ResourceKind::ContentBlock,
72 Self::EmailTemplate(_) => ResourceKind::EmailTemplate,
73 Self::CustomAttributeRegistry(_) => ResourceKind::CustomAttribute,
74 }
75 }
76}