Skip to main content

line_bot_sdk_webhook/models/
source.rs

1/*
2 * LINE Messaging API
3 *
4 * This document describes LINE Messaging API.
5 *
6 * The version of the OpenAPI document: 0.0.1
7 *
8 * Generated by: https://openapi-generator.tech
9 * Post-processed by: post-process-enums-v2.js
10 */
11
12use crate::models;
13use serde::{Deserialize, Serialize};
14
15/// Source enum using newtype pattern (wraps structs in Box)
16/// This is automatically generated from discriminated schemas
17#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum Source {
20    UserSource(Box<models::UserSource>),
21    GroupSource(Box<models::GroupSource>),
22    RoomSource(Box<models::RoomSource>),
23}
24
25impl Default for Source {
26    fn default() -> Self {
27        Self::UserSource(Box::new(Default::default()))
28    }
29}
30
31// Conversion methods from struct types to enum variants
32impl From<models::UserSource> for Source {
33    fn from(value: models::UserSource) -> Self {
34        Source::UserSource(Box::new(value))
35    }
36}
37
38impl From<models::GroupSource> for Source {
39    fn from(value: models::GroupSource) -> Self {
40        Source::GroupSource(Box::new(value))
41    }
42}
43
44impl From<models::RoomSource> for Source {
45    fn from(value: models::RoomSource) -> Self {
46        Source::RoomSource(Box::new(value))
47    }
48}