fastly_api/models/
default_settings.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8
9
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct DefaultSettings {
13    /// The type of filter to use while resizing an image.
14    #[serde(rename = "resize_filter", skip_serializing_if = "Option::is_none")]
15    pub resize_filter: Option<ResizeFilter>,
16    /// Controls whether or not to default to WebP output when the client supports it. This is equivalent to adding \"auto=webp\" to all image optimizer requests. 
17    #[serde(rename = "webp", skip_serializing_if = "Option::is_none")]
18    pub webp: Option<bool>,
19    /// The default quality to use with WebP output. This can be overridden with the second option in the \"quality\" URL parameter on specific image optimizer requests. 
20    #[serde(rename = "webp_quality", skip_serializing_if = "Option::is_none")]
21    pub webp_quality: Option<i32>,
22    /// The default type of JPEG output to use. This can be overridden with \"format=bjpeg\" and \"format=pjpeg\" on specific image optimizer requests. 
23    #[serde(rename = "jpeg_type", skip_serializing_if = "Option::is_none")]
24    pub jpeg_type: Option<JpegType>,
25    /// The default quality to use with JPEG output. This can be overridden with the \"quality\" parameter on specific image optimizer requests. 
26    #[serde(rename = "jpeg_quality", skip_serializing_if = "Option::is_none")]
27    pub jpeg_quality: Option<i32>,
28    /// Whether or not we should allow output images to render at sizes larger than input. 
29    #[serde(rename = "upscale", skip_serializing_if = "Option::is_none")]
30    pub upscale: Option<bool>,
31    /// Enables GIF to MP4 transformations on this service.
32    #[serde(rename = "allow_video", skip_serializing_if = "Option::is_none")]
33    pub allow_video: Option<bool>,
34}
35
36impl DefaultSettings {
37    pub fn new() -> DefaultSettings {
38        DefaultSettings {
39            resize_filter: None,
40            webp: None,
41            webp_quality: None,
42            jpeg_type: None,
43            jpeg_quality: None,
44            upscale: None,
45            allow_video: None,
46        }
47    }
48}
49
50/// The type of filter to use while resizing an image.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum ResizeFilter {
53    #[serde(rename = "lanczos3")]
54    Lanczos3,
55    #[serde(rename = "lanczos2")]
56    Lanczos2,
57    #[serde(rename = "bicubic")]
58    Bicubic,
59    #[serde(rename = "bilinear")]
60    Bilinear,
61    #[serde(rename = "nearest")]
62    Nearest,
63}
64
65impl Default for ResizeFilter {
66    fn default() -> ResizeFilter {
67        Self::Lanczos3
68    }
69}
70/// The default type of JPEG output to use. This can be overridden with \"format=bjpeg\" and \"format=pjpeg\" on specific image optimizer requests. 
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum JpegType {
73    #[serde(rename = "auto")]
74    Auto,
75    #[serde(rename = "baseline")]
76    Baseline,
77    #[serde(rename = "progressive")]
78    Progressive,
79}
80
81impl Default for JpegType {
82    fn default() -> JpegType {
83        Self::Auto
84    }
85}
86