1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
* Copyright (C) 2016 LINE Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* LINE Messaging API
*
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
* Generated by: https://openapi-generator.tech
*/
use crate::line_messaging_api::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FlexImage {
/// Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true)
#[serde(rename = "url")]
pub url: String,
/// The ratio of the width or height of this component within the parent box.
#[serde(rename = "flex", skip_serializing_if = "Option::is_none")]
pub flex: Option<i32>,
/// The minimum amount of space to include before this component in its parent container.
#[serde(rename = "margin", skip_serializing_if = "Option::is_none")]
pub margin: Option<String>,
/// Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative.
#[serde(rename = "position", skip_serializing_if = "Option::is_none")]
pub position: Option<Position>,
/// Offset.
#[serde(rename = "offsetTop", skip_serializing_if = "Option::is_none")]
pub offset_top: Option<String>,
/// Offset.
#[serde(rename = "offsetBottom", skip_serializing_if = "Option::is_none")]
pub offset_bottom: Option<String>,
/// Offset.
#[serde(rename = "offsetStart", skip_serializing_if = "Option::is_none")]
pub offset_start: Option<String>,
/// Offset.
#[serde(rename = "offsetEnd", skip_serializing_if = "Option::is_none")]
pub offset_end: Option<String>,
/// Alignment style in horizontal direction.
#[serde(rename = "align", skip_serializing_if = "Option::is_none")]
pub align: Option<Align>,
/// Alignment style in vertical direction.
#[serde(rename = "gravity", skip_serializing_if = "Option::is_none")]
pub gravity: Option<Gravity>,
/// The maximum image width. This is md by default.
#[serde(rename = "size", skip_serializing_if = "Option::is_none")]
pub size: Option<String>,
/// Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`.
#[serde(rename = "aspectRatio", skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match.
#[serde(rename = "aspectMode", skip_serializing_if = "Option::is_none")]
pub aspect_mode: Option<AspectMode>,
/// Background color of the image. Use a hexadecimal color code.
#[serde(rename = "backgroundColor", skip_serializing_if = "Option::is_none")]
pub background_color: Option<String>,
#[serde(rename = "action", skip_serializing_if = "Option::is_none")]
pub action: Option<Box<models::Action>>,
/// When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back.
#[serde(rename = "animated", skip_serializing_if = "Option::is_none")]
pub animated: Option<bool>,
}
impl FlexImage {
pub fn new(url: String) -> FlexImage {
FlexImage {
url,
flex: None,
margin: None,
position: None,
offset_top: None,
offset_bottom: None,
offset_start: None,
offset_end: None,
align: None,
gravity: None,
size: None,
aspect_ratio: None,
aspect_mode: None,
background_color: None,
action: None,
animated: None,
}
}
}
/// Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
pub enum Position {
#[serde(rename = "relative")]
Relative,
#[serde(rename = "absolute")]
Absolute,
}
impl Default for Position {
fn default() -> Position {
Self::Relative
}
}
/// Alignment style in horizontal direction.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
pub enum Align {
#[serde(rename = "start")]
Start,
#[serde(rename = "end")]
End,
#[serde(rename = "center")]
Center,
}
impl Default for Align {
fn default() -> Align {
Self::Start
}
}
/// Alignment style in vertical direction.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
pub enum Gravity {
#[serde(rename = "top")]
Top,
#[serde(rename = "bottom")]
Bottom,
#[serde(rename = "center")]
Center,
}
impl Default for Gravity {
fn default() -> Gravity {
Self::Top
}
}
/// The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
pub enum AspectMode {
#[serde(rename = "fit")]
Fit,
#[serde(rename = "cover")]
Cover,
}
impl Default for AspectMode {
fn default() -> AspectMode {
Self::Fit
}
}