From f396e8ffde32bfbba61c74082900bba7c1665b3d Mon Sep 17 00:00:00 2001 From: yurii Date: Tue, 1 Aug 2023 11:21:39 +0200 Subject: [PATCH 1/3] Add displayOutput to InputRequest --- .../TerminalAPIKit/Models/Requests/InputRequest.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift b/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift index eaff2e1..6ac3068 100644 --- a/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift +++ b/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift @@ -23,15 +23,22 @@ public final class InputRequest: Request { /// Information related to an Input request. public let inputData: InputData + /// Information to display and the way to process the display. + public let displayOutput: DisplayOutput? + /// Initializes the InputRequest. /// /// - Parameter inputData: Information related to an Input request. - public init(inputData: InputData) { + /// - Parameter displayOutput: Information to display and the way to process the display. + + public init(inputData: InputData, displayOutput: DisplayOutput?) { self.inputData = inputData + self.displayOutput = displayOutput } internal enum CodingKeys: String, CodingKey { case inputData = "InputData" + case displayOutput = "DisplayOutput" } } From 89d3295096efc47048f1fc08f2dd9ff365ff0d6c Mon Sep 17 00:00:00 2001 From: yurii Date: Tue, 1 Aug 2023 11:40:44 +0200 Subject: [PATCH 2/3] Make defaultSelectedFlag in MenuEntry optional, as per docs --- Sources/TerminalAPIKit/Models/MenuEntry.swift | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Sources/TerminalAPIKit/Models/MenuEntry.swift b/Sources/TerminalAPIKit/Models/MenuEntry.swift index 03ed036..b102957 100644 --- a/Sources/TerminalAPIKit/Models/MenuEntry.swift +++ b/Sources/TerminalAPIKit/Models/MenuEntry.swift @@ -15,29 +15,38 @@ public final class MenuEntry: Codable { public let menuEntryTag: MenuEntryTag? /// Undocumented. - public let defaultSelectedFlag: Bool + public let defaultSelectedFlag: Bool? - /// Undocumented. + /// Format of the content to display or print. public let outputFormat: OutputFormat - /// Undocumented. + /// Reference of a predefined message to display or print. public let predefinedContent: PredefinedContent? - /// Undocumented. + /// Content of text message to display or print. + /// Mandatory, if OutputFormat is Text, not allowed otherwise. One instance of OutputText per shared format. public let outputText: [OutputText]? - /// Undocumented. + /// XHTML document body containing the message to display or print. + /// Mandatory, if OutputFormat is XHTML, not allowed otherwise. public let outputXHTML: Data? /// Initializes the MenuEntry. /// /// - Parameter menuEntryTag: Characteristics related to the selection of a menu entry /// - Parameter defaultSelectedFlag: Undocumented. - /// - Parameter outputFormat: Undocumented. - /// - Parameter predefinedContent: Undocumented. - /// - Parameter outputText: Undocumented. - /// - Parameter outputXHTML: Undocumented. - public init(menuEntryTag: MenuEntryTag? = nil, defaultSelectedFlag: Bool, outputFormat: OutputFormat, predefinedContent: PredefinedContent? = nil, outputText: [OutputText]? = nil, outputXHTML: Data? = nil) { + /// - Parameter outputFormat: Format of the content to display or print. + /// - Parameter predefinedContent: Reference of a predefined message to display or print. + /// - Parameter outputText: Content of text message to display or print. Mandatory, if `outputFormat` is `text`, not allowed otherwise. One instance of `OutputText` per shared format. + /// - Parameter outputXHTML: XHTML document body containing the message to display or print. Mandatory, if `outputFormat` is `xhtml`, not allowed otherwise. + public init( + menuEntryTag: MenuEntryTag? = nil, + defaultSelectedFlag: Bool? = nil, + outputFormat: OutputFormat, + predefinedContent: PredefinedContent? = nil, + outputText: [OutputText]?, + outputXHTML: Data? = nil + ) { self.menuEntryTag = menuEntryTag self.defaultSelectedFlag = defaultSelectedFlag self.outputFormat = outputFormat From 3bd036546375d177ac5076db95a736e7405e9ea7 Mon Sep 17 00:00:00 2001 From: yurii Date: Fri, 4 Aug 2023 12:05:27 +0200 Subject: [PATCH 3/3] Add default parameter for displayOutput --- Sources/TerminalAPIKit/Models/Requests/InputRequest.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift b/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift index 6ac3068..10905f1 100644 --- a/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift +++ b/Sources/TerminalAPIKit/Models/Requests/InputRequest.swift @@ -30,8 +30,7 @@ public final class InputRequest: Request { /// /// - Parameter inputData: Information related to an Input request. /// - Parameter displayOutput: Information to display and the way to process the display. - - public init(inputData: InputData, displayOutput: DisplayOutput?) { + public init(inputData: InputData, displayOutput: DisplayOutput? = nil) { self.inputData = inputData self.displayOutput = displayOutput }