line_webhook/models/beacon_content.rs
1/*
2* Copyright (C) 2016 LINE Corp.
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17/*
18 * Webhook Type Definition
19 *
20 * Webhook event definition of the LINE Messaging API
21 *
22 * The version of the OpenAPI document: 1.0.2
23 *
24 * Generated by: https://openapi-generator.tech
25 */
26
27use crate::models;
28use serde::{Deserialize, Serialize};
29
30#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
31pub struct BeaconContent {
32 /// Hardware ID of the beacon that was detected
33 #[serde(rename = "hwid")]
34 pub hwid: String,
35 /// Type of beacon event.
36 #[serde(rename = "type")]
37 pub r#type: Type,
38 /// Device message of beacon that was detected.
39 #[serde(rename = "dm", skip_serializing_if = "Option::is_none")]
40 pub dm: Option<String>,
41}
42
43impl BeaconContent {
44 pub fn new(hwid: String, r#type: Type) -> BeaconContent {
45 BeaconContent {
46 hwid,
47 r#type,
48 dm: None,
49 }
50 }
51}
52/// Type of beacon event.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum Type {
55 #[serde(rename = "enter")]
56 Enter,
57 #[serde(rename = "banner")]
58 Banner,
59 #[serde(rename = "stay")]
60 Stay,
61}
62
63impl Default for Type {
64 fn default() -> Type {
65 Self::Enter
66 }
67}