|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="CompressOptions.swift"> |
| 4 | + * Copyright (c) 2022 Aspose.Words for Cloud |
| 5 | + * </copyright> |
| 6 | + * <summary> |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in all |
| 15 | + * copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + * SOFTWARE. |
| 24 | + * </summary> |
| 25 | + * -------------------------------------------------------------------------------- |
| 26 | + */ |
| 27 | + |
| 28 | +import Foundation |
| 29 | + |
| 30 | +// Options of document compress. |
| 31 | +@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *) |
| 32 | +public class CompressOptions : Codable, WordsApiModel { |
| 33 | + // Field of imagesQuality. Options of document compress. |
| 34 | + private var _imagesQuality : Int? = nil; |
| 35 | + |
| 36 | + public var imagesQuality : Int? { |
| 37 | + get { |
| 38 | + return self._imagesQuality; |
| 39 | + } |
| 40 | + set { |
| 41 | + self._imagesQuality = newValue; |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + // Field of imagesReduceSizeFactor. Options of document compress. |
| 46 | + private var _imagesReduceSizeFactor : Int? = nil; |
| 47 | + |
| 48 | + public var imagesReduceSizeFactor : Int? { |
| 49 | + get { |
| 50 | + return self._imagesReduceSizeFactor; |
| 51 | + } |
| 52 | + set { |
| 53 | + self._imagesReduceSizeFactor = newValue; |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + private enum CodingKeys: String, CodingKey { |
| 58 | + case imagesQuality = "ImagesQuality"; |
| 59 | + case imagesReduceSizeFactor = "ImagesReduceSizeFactor"; |
| 60 | + case invalidCodingKey; |
| 61 | + } |
| 62 | + |
| 63 | + public init() { |
| 64 | + } |
| 65 | + |
| 66 | + public required init(from decoder: Decoder) throws { |
| 67 | + let container = try decoder.container(keyedBy: CodingKeys.self); |
| 68 | + self.imagesQuality = try container.decodeIfPresent(Int.self, forKey: .imagesQuality); |
| 69 | + self.imagesReduceSizeFactor = try container.decodeIfPresent(Int.self, forKey: .imagesReduceSizeFactor); |
| 70 | + } |
| 71 | + |
| 72 | + public func encode(to encoder: Encoder) throws { |
| 73 | + var container = encoder.container(keyedBy: CodingKeys.self); |
| 74 | + if (self.imagesQuality != nil) { |
| 75 | + try container.encode(self.imagesQuality, forKey: .imagesQuality); |
| 76 | + } |
| 77 | + if (self.imagesReduceSizeFactor != nil) { |
| 78 | + try container.encode(self.imagesReduceSizeFactor, forKey: .imagesReduceSizeFactor); |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + // Sets imagesQuality. Gets or sets the quality level of images from 0 to 100. Default value is 75. |
| 83 | + public func setImagesQuality(imagesQuality : Int?) -> CompressOptions { |
| 84 | + self.imagesQuality = imagesQuality; |
| 85 | + return self; |
| 86 | + } |
| 87 | + |
| 88 | + // Gets imagesQuality. Gets or sets the quality level of images from 0 to 100. Default value is 75. |
| 89 | + public func getImagesQuality() -> Int? { |
| 90 | + return self.imagesQuality; |
| 91 | + } |
| 92 | + |
| 93 | + |
| 94 | + // Sets imagesReduceSizeFactor. Gets or sets the resize factor of images. This value determines how many times the size of the images in the document will be reduced. The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size. |
| 95 | + public func setImagesReduceSizeFactor(imagesReduceSizeFactor : Int?) -> CompressOptions { |
| 96 | + self.imagesReduceSizeFactor = imagesReduceSizeFactor; |
| 97 | + return self; |
| 98 | + } |
| 99 | + |
| 100 | + // Gets imagesReduceSizeFactor. Gets or sets the resize factor of images. This value determines how many times the size of the images in the document will be reduced. The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size. |
| 101 | + public func getImagesReduceSizeFactor() -> Int? { |
| 102 | + return self.imagesReduceSizeFactor; |
| 103 | + } |
| 104 | +} |
0 commit comments