From 1f9c13ed6ec864223898acd96a38615ba0332c48 Mon Sep 17 00:00:00 2001 From: "dropbox-sdk-updater[bot]" <306210582+dropbox-sdk-updater[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2026 12:09:11 +0000 Subject: [PATCH] Automated Spec Update 16dfea0418d5c2f61afd971e5b74bda26ca80eff Co-authored-by: dropbox-spec-updater[bot] <306253022+dropbox-spec-updater[bot]@users.noreply.github.com> b45a911a6c8bf71335b4a51798a21dabcee892ca Co-authored-by: dropbox-spec-updater[bot] <306253022+dropbox-spec-updater[bot]@users.noreply.github.com> c2df3ee5dccc76a21bfa5b4139bff050cea53de7 Co-authored-by: dropbox-spec-updater[bot] <306253022+dropbox-spec-updater[bot]@users.noreply.github.com> b6bb8e88b6cc5898dcc8eff66324908203d95eb4 Co-authored-by: dropbox-spec-updater[bot] <306253022+dropbox-spec-updater[bot]@users.noreply.github.com> --- .../Shared/Generated/Riviera.swift | 637 ++++++++++++++++ .../Generated/RivieraAppAuthRoutes.swift | 78 ++ .../Shared/Generated/RivieraRoutes.swift | 78 ++ .../Shared/Generated/TeamLog.swift | 424 +++++++++++ .../Shared/Generated/DBXRiviera.swift | 712 ++++++++++++++++++ .../Generated/DBXRivieraAppAuthRoutes.swift | 112 +++ .../Shared/Generated/DBXRivieraRoutes.swift | 358 +++++++++ .../Shared/Generated/DBXTeamLog.swift | 428 +++++++++++ spec | 2 +- stone | 2 +- 10 files changed, 2829 insertions(+), 2 deletions(-) diff --git a/Source/SwiftyDropbox/Shared/Generated/Riviera.swift b/Source/SwiftyDropbox/Shared/Generated/Riviera.swift index 0a24301b..4605c545 100644 --- a/Source/SwiftyDropbox/Shared/Generated/Riviera.swift +++ b/Source/SwiftyDropbox/Shared/Generated/Riviera.swift @@ -1279,6 +1279,341 @@ public class Riviera { } } + /// Arguments for the asynchronous `get_ocr_async` route. Exactly one of `file_id`, `path`, or `url` must be + /// supplied via `file_id_or_url` to identify the image or PDF whose text should be extracted via OCR (optical + /// character recognition). + public class GetOcrArgs: CustomStringConvertible, JSONRepresentable { + /// Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` variants. OCR is + /// supported for image files and PDFs, including scanned / non-text PDFs; see the route description for + /// the supported formats. Requests against unsupported formats return `unsupported_format_error`. NOTE: + /// for the `url` variant, only Dropbox shared links (www.dropbox.com) are supported. External + /// (non-Dropbox) URLs are not supported and return `unsupported_format_error`; import the file into + /// Dropbox and reference it by `file_id` or `path` instead. + public let fileIdOrUrl: Riviera.FileIdOrUrl? + public init(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) { + self.fileIdOrUrl = fileIdOrUrl + } + + func json() throws -> JSON { + try GetOcrArgsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetOcrArgsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetOcrArgs: \(error)" + } + } + } + + public class GetOcrArgsSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetOcrArgs) throws -> JSON { + let output = [ + "file_id_or_url": try NullableSerializer(Riviera.FileIdOrUrlSerializer()).serialize(value.fileIdOrUrl), + ] + return .dictionary(output) + } + + public func deserialize(_ json: JSON) throws -> GetOcrArgs { + switch json { + case .dictionary(let dict): + let fileIdOrUrl = try NullableSerializer(Riviera.FileIdOrUrlSerializer()).deserialize(dict["file_id_or_url"] ?? .null) + return GetOcrArgs(fileIdOrUrl: fileIdOrUrl) + default: + throw JSONSerializerError.deserializeError(type: GetOcrArgs.self, json: json) + } + } + } + + /// Result type for EventBus async check - must end in "CheckResult" + public enum GetOcrAsyncCheckResult: CustomStringConvertible, JSONRepresentable { + /// An unspecified error. + case inProgress + /// An unspecified error. + case complete(Riviera.GetOcrResult) + /// An unspecified error. + case failed(Riviera.OcrExtractionApiV2Error) + /// An unspecified error. + case other + + func json() throws -> JSON { + try GetOcrAsyncCheckResultSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetOcrAsyncCheckResultSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetOcrAsyncCheckResult: \(error)" + } + } + } + + public class GetOcrAsyncCheckResultSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetOcrAsyncCheckResult) throws -> JSON { + switch value { + case .inProgress: + var d = [String: JSON]() + d[".tag"] = .str("in_progress") + return .dictionary(d) + case .complete(let arg): + var d = try Serialization.getFields(Riviera.GetOcrResultSerializer().serialize(arg)) + d[".tag"] = .str("complete") + return .dictionary(d) + case .failed(let arg): + var d = try ["failed": Riviera.OcrExtractionApiV2ErrorSerializer().serialize(arg)] + d[".tag"] = .str("failed") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + + public func deserialize(_ json: JSON) throws -> GetOcrAsyncCheckResult { + switch json { + case .dictionary(let d): + let tag = try Serialization.getTag(d) + switch tag { + case "in_progress": + return GetOcrAsyncCheckResult.inProgress + case "complete": + let v = try Riviera.GetOcrResultSerializer().deserialize(json) + return GetOcrAsyncCheckResult.complete(v) + case "failed": + let v = try Riviera.OcrExtractionApiV2ErrorSerializer().deserialize(d["failed"] ?? .null) + return GetOcrAsyncCheckResult.failed(v) + case "other": + return GetOcrAsyncCheckResult.other + default: + return GetOcrAsyncCheckResult.other + } + default: + throw JSONSerializerError.deserializeError(type: GetOcrAsyncCheckResult.self, json: json) + } + } + } + + /// The GetOcrResult struct + public class GetOcrResult: CustomStringConvertible, JSONRepresentable { + /// The plain-text content extracted from the file via OCR. Words within a line are separated by a single space, + /// lines are newline-separated in reading order, and for multi-page PDFs pages are separated by a blank + /// line in page order. May be empty when no text is detected in the source. + public let text: String + /// The same content as hOCR: HTML that carries the position of every recognized word. Each page is a + /// `
` holding `

` elements with one `` per word, and each element carries + /// `data-x`, `data-y`, `data-width`, and `data-height` attributes in pixels relative to the upright + /// page (whose dimensions are on the `

`). Use this when you need word coordinates -- to + /// highlight matches over a page image, for example; use `text` when you just need the words. + public let hocr: String + public init(text: String = "", hocr: String = "") { + stringValidator()(text) + self.text = text + stringValidator()(hocr) + self.hocr = hocr + } + + func json() throws -> JSON { + try GetOcrResultSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetOcrResultSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetOcrResult: \(error)" + } + } + } + + public class GetOcrResultSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetOcrResult) throws -> JSON { + let output = [ + "text": try Serialization._StringSerializer.serialize(value.text), + "hocr": try Serialization._StringSerializer.serialize(value.hocr), + ] + return .dictionary(output) + } + + public func deserialize(_ json: JSON) throws -> GetOcrResult { + switch json { + case .dictionary(let dict): + let text = try Serialization._StringSerializer.deserialize(dict["text"] ?? .str("")) + let hocr = try Serialization._StringSerializer.deserialize(dict["hocr"] ?? .str("")) + return GetOcrResult(text: text, hocr: hocr) + default: + throw JSONSerializerError.deserializeError(type: GetOcrResult.self, json: json) + } + } + } + + /// Arguments for the asynchronous `get_text_async` route. Exactly one of `file_id`, `path`, or `url` must be + /// supplied via `file_id_or_url` to identify the document whose plain-text content should be extracted. + public class GetTextArgs: CustomStringConvertible, JSONRepresentable { + /// Identifier of the document to extract text from. Callers must set exactly one of the `FileIdOrUrl` variants. + /// Text extraction is supported for common document formats (Word, PowerPoint, Excel, PDF, RTF, and + /// Dropbox document types); see the route description for the supported formats. Requests against + /// unsupported formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox + /// shared links (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and + /// return `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or + /// `path` instead. + public let fileIdOrUrl: Riviera.FileIdOrUrl? + public init(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) { + self.fileIdOrUrl = fileIdOrUrl + } + + func json() throws -> JSON { + try GetTextArgsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetTextArgsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetTextArgs: \(error)" + } + } + } + + public class GetTextArgsSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetTextArgs) throws -> JSON { + let output = [ + "file_id_or_url": try NullableSerializer(Riviera.FileIdOrUrlSerializer()).serialize(value.fileIdOrUrl), + ] + return .dictionary(output) + } + + public func deserialize(_ json: JSON) throws -> GetTextArgs { + switch json { + case .dictionary(let dict): + let fileIdOrUrl = try NullableSerializer(Riviera.FileIdOrUrlSerializer()).deserialize(dict["file_id_or_url"] ?? .null) + return GetTextArgs(fileIdOrUrl: fileIdOrUrl) + default: + throw JSONSerializerError.deserializeError(type: GetTextArgs.self, json: json) + } + } + } + + /// Result type for EventBus async check - must end in "CheckResult" + public enum GetTextAsyncCheckResult: CustomStringConvertible, JSONRepresentable { + /// An unspecified error. + case inProgress + /// An unspecified error. + case complete(Riviera.GetTextResult) + /// An unspecified error. + case failed(Riviera.TextExtractionApiV2Error) + /// An unspecified error. + case other + + func json() throws -> JSON { + try GetTextAsyncCheckResultSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetTextAsyncCheckResultSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetTextAsyncCheckResult: \(error)" + } + } + } + + public class GetTextAsyncCheckResultSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetTextAsyncCheckResult) throws -> JSON { + switch value { + case .inProgress: + var d = [String: JSON]() + d[".tag"] = .str("in_progress") + return .dictionary(d) + case .complete(let arg): + var d = try Serialization.getFields(Riviera.GetTextResultSerializer().serialize(arg)) + d[".tag"] = .str("complete") + return .dictionary(d) + case .failed(let arg): + var d = try ["failed": Riviera.TextExtractionApiV2ErrorSerializer().serialize(arg)] + d[".tag"] = .str("failed") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + + public func deserialize(_ json: JSON) throws -> GetTextAsyncCheckResult { + switch json { + case .dictionary(let d): + let tag = try Serialization.getTag(d) + switch tag { + case "in_progress": + return GetTextAsyncCheckResult.inProgress + case "complete": + let v = try Riviera.GetTextResultSerializer().deserialize(json) + return GetTextAsyncCheckResult.complete(v) + case "failed": + let v = try Riviera.TextExtractionApiV2ErrorSerializer().deserialize(d["failed"] ?? .null) + return GetTextAsyncCheckResult.failed(v) + case "other": + return GetTextAsyncCheckResult.other + default: + return GetTextAsyncCheckResult.other + } + default: + throw JSONSerializerError.deserializeError(type: GetTextAsyncCheckResult.self, json: json) + } + } + } + + /// The GetTextResult struct + public class GetTextResult: CustomStringConvertible, JSONRepresentable { + /// The plain-text content extracted from the document. For multi-page documents the text is concatenated in + /// document order. May be empty when no text is detected in the source. + public let text: String + public init(text: String = "") { + stringValidator()(text) + self.text = text + } + + func json() throws -> JSON { + try GetTextResultSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try GetTextResultSerializer().serialize(self)))" + } catch { + return "Failed to generate description for GetTextResult: \(error)" + } + } + } + + public class GetTextResultSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: GetTextResult) throws -> JSON { + let output = [ + "text": try Serialization._StringSerializer.serialize(value.text), + ] + return .dictionary(output) + } + + public func deserialize(_ json: JSON) throws -> GetTextResult { + switch json { + case .dictionary(let dict): + let text = try Serialization._StringSerializer.deserialize(dict["text"] ?? .str("")) + return GetTextResult(text: text) + default: + throw JSONSerializerError.deserializeError(type: GetTextResult.self, json: json) + } + } + } + /// Arguments for the asynchronous `get_transcript_async` route. Exactly one of `file_id`, `path`, or `url` must be /// supplied via `file_id_or_url` to identify the audio or video asset to transcribe. public class GetTranscriptArgs: CustomStringConvertible, JSONRepresentable { @@ -1846,6 +2181,129 @@ public class Riviera { } } + /// Reason an OCR extraction job failed. Returned in the `failed` variant of `GetOcrAsyncCheckResult`. This is a + /// semantic error union: the HTTP status of the poll request itself is unaffected (a poll that surfaces a + /// failed job is still a normal successful poll response). Callers should branch on the variant. + public enum OcrExtractionApiV2Error: CustomStringConvertible, JSONRepresentable { + /// An unexpected, typically transient, server-side failure. The string is a human-readable message; retrying + /// with backoff may succeed. + case serverError(String) + /// The request could not be processed as supplied (a problem with the caller's input). The string is a + /// human-readable message; retrying the same request will not help. + case userError(String) + /// An unspecified error. + case unsupportedFormatError + /// An unspecified error. + case linkDownloadDisabledError + /// An unspecified error. + case sharedLinkPasswordProtected + /// An unspecified error. + case limitExceededError + /// An unspecified error. + case conversionFailureError + /// The referenced file does not exist or is not accessible. + case notFoundError + /// The target is a folder, not a file. + case isAFolderError + /// An unspecified error. + case other + + func json() throws -> JSON { + try OcrExtractionApiV2ErrorSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try OcrExtractionApiV2ErrorSerializer().serialize(self)))" + } catch { + return "Failed to generate description for OcrExtractionApiV2Error: \(error)" + } + } + } + + public class OcrExtractionApiV2ErrorSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: OcrExtractionApiV2Error) throws -> JSON { + switch value { + case .serverError(let arg): + var d = try ["server_error": Serialization._StringSerializer.serialize(arg)] + d[".tag"] = .str("server_error") + return .dictionary(d) + case .userError(let arg): + var d = try ["user_error": Serialization._StringSerializer.serialize(arg)] + d[".tag"] = .str("user_error") + return .dictionary(d) + case .unsupportedFormatError: + var d = [String: JSON]() + d[".tag"] = .str("unsupported_format_error") + return .dictionary(d) + case .linkDownloadDisabledError: + var d = [String: JSON]() + d[".tag"] = .str("link_download_disabled_error") + return .dictionary(d) + case .sharedLinkPasswordProtected: + var d = [String: JSON]() + d[".tag"] = .str("shared_link_password_protected") + return .dictionary(d) + case .limitExceededError: + var d = [String: JSON]() + d[".tag"] = .str("limit_exceeded_error") + return .dictionary(d) + case .conversionFailureError: + var d = [String: JSON]() + d[".tag"] = .str("conversion_failure_error") + return .dictionary(d) + case .notFoundError: + var d = [String: JSON]() + d[".tag"] = .str("not_found_error") + return .dictionary(d) + case .isAFolderError: + var d = [String: JSON]() + d[".tag"] = .str("is_a_folder_error") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + + public func deserialize(_ json: JSON) throws -> OcrExtractionApiV2Error { + switch json { + case .dictionary(let d): + let tag = try Serialization.getTag(d) + switch tag { + case "server_error": + let v = try Serialization._StringSerializer.deserialize(d["server_error"] ?? .null) + return OcrExtractionApiV2Error.serverError(v) + case "user_error": + let v = try Serialization._StringSerializer.deserialize(d["user_error"] ?? .null) + return OcrExtractionApiV2Error.userError(v) + case "unsupported_format_error": + return OcrExtractionApiV2Error.unsupportedFormatError + case "link_download_disabled_error": + return OcrExtractionApiV2Error.linkDownloadDisabledError + case "shared_link_password_protected": + return OcrExtractionApiV2Error.sharedLinkPasswordProtected + case "limit_exceeded_error": + return OcrExtractionApiV2Error.limitExceededError + case "conversion_failure_error": + return OcrExtractionApiV2Error.conversionFailureError + case "not_found_error": + return OcrExtractionApiV2Error.notFoundError + case "is_a_folder_error": + return OcrExtractionApiV2Error.isAFolderError + case "other": + return OcrExtractionApiV2Error.other + default: + return OcrExtractionApiV2Error.other + } + default: + throw JSONSerializerError.deserializeError(type: OcrExtractionApiV2Error.self, json: json) + } + } + } + /// The kind of MS Office document that produced an `ApiOfficeMetadata` result. public enum OfficeFileType: CustomStringConvertible, JSONRepresentable { /// An unspecified error. @@ -1923,6 +2381,129 @@ public class Riviera { } } + /// Reason a text extraction job failed. Returned in the `failed` variant of `GetTextAsyncCheckResult`. This is a + /// semantic error union: the HTTP status of the poll request itself is unaffected (a poll that surfaces a + /// failed job is still a normal successful poll response). Callers should branch on the variant. + public enum TextExtractionApiV2Error: CustomStringConvertible, JSONRepresentable { + /// An unexpected, typically transient, server-side failure. The string is a human-readable message; retrying + /// with backoff may succeed. + case serverError(String) + /// The request could not be processed as supplied (a problem with the caller's input). The string is a + /// human-readable message; retrying the same request will not help. + case userError(String) + /// An unspecified error. + case unsupportedFormatError + /// An unspecified error. + case linkDownloadDisabledError + /// An unspecified error. + case sharedLinkPasswordProtected + /// An unspecified error. + case limitExceededError + /// An unspecified error. + case conversionFailureError + /// The referenced file does not exist or is not accessible. + case notFoundError + /// The target is a folder, not a file. + case isAFolderError + /// An unspecified error. + case other + + func json() throws -> JSON { + try TextExtractionApiV2ErrorSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try TextExtractionApiV2ErrorSerializer().serialize(self)))" + } catch { + return "Failed to generate description for TextExtractionApiV2Error: \(error)" + } + } + } + + public class TextExtractionApiV2ErrorSerializer: JSONSerializer { + public init() {} + public func serialize(_ value: TextExtractionApiV2Error) throws -> JSON { + switch value { + case .serverError(let arg): + var d = try ["server_error": Serialization._StringSerializer.serialize(arg)] + d[".tag"] = .str("server_error") + return .dictionary(d) + case .userError(let arg): + var d = try ["user_error": Serialization._StringSerializer.serialize(arg)] + d[".tag"] = .str("user_error") + return .dictionary(d) + case .unsupportedFormatError: + var d = [String: JSON]() + d[".tag"] = .str("unsupported_format_error") + return .dictionary(d) + case .linkDownloadDisabledError: + var d = [String: JSON]() + d[".tag"] = .str("link_download_disabled_error") + return .dictionary(d) + case .sharedLinkPasswordProtected: + var d = [String: JSON]() + d[".tag"] = .str("shared_link_password_protected") + return .dictionary(d) + case .limitExceededError: + var d = [String: JSON]() + d[".tag"] = .str("limit_exceeded_error") + return .dictionary(d) + case .conversionFailureError: + var d = [String: JSON]() + d[".tag"] = .str("conversion_failure_error") + return .dictionary(d) + case .notFoundError: + var d = [String: JSON]() + d[".tag"] = .str("not_found_error") + return .dictionary(d) + case .isAFolderError: + var d = [String: JSON]() + d[".tag"] = .str("is_a_folder_error") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + + public func deserialize(_ json: JSON) throws -> TextExtractionApiV2Error { + switch json { + case .dictionary(let d): + let tag = try Serialization.getTag(d) + switch tag { + case "server_error": + let v = try Serialization._StringSerializer.deserialize(d["server_error"] ?? .null) + return TextExtractionApiV2Error.serverError(v) + case "user_error": + let v = try Serialization._StringSerializer.deserialize(d["user_error"] ?? .null) + return TextExtractionApiV2Error.userError(v) + case "unsupported_format_error": + return TextExtractionApiV2Error.unsupportedFormatError + case "link_download_disabled_error": + return TextExtractionApiV2Error.linkDownloadDisabledError + case "shared_link_password_protected": + return TextExtractionApiV2Error.sharedLinkPasswordProtected + case "limit_exceeded_error": + return TextExtractionApiV2Error.limitExceededError + case "conversion_failure_error": + return TextExtractionApiV2Error.conversionFailureError + case "not_found_error": + return TextExtractionApiV2Error.notFoundError + case "is_a_folder_error": + return TextExtractionApiV2Error.isAFolderError + case "other": + return TextExtractionApiV2Error.other + default: + return TextExtractionApiV2Error.other + } + default: + throw JSONSerializerError.deserializeError(type: TextExtractionApiV2Error.self, json: json) + } + } + } + /// The TimestampLevel union public enum TimestampLevel: CustomStringConvertible, JSONRepresentable { /// An unspecified error. @@ -2123,6 +2704,62 @@ public class Riviera { style: .rpc ) ) + static let getOcrAsync = Route( + name: "get_ocr_async", + version: 1, + namespace: "riviera", + deprecated: false, + argSerializer: Riviera.GetOcrArgsSerializer(), + responseSerializer: Async.LaunchResultBaseSerializer(), + errorSerializer: Serialization._VoidSerializer, + attributes: RouteAttributes( + auth: [.app, .user], + host: .api, + style: .rpc + ) + ) + static let getOcrAsyncCheck = Route( + name: "get_ocr_async/check", + version: 1, + namespace: "riviera", + deprecated: false, + argSerializer: Async.PollArgSerializer(), + responseSerializer: Riviera.GetOcrAsyncCheckResultSerializer(), + errorSerializer: Async.PollErrorSerializer(), + attributes: RouteAttributes( + auth: [.app, .user], + host: .api, + style: .rpc + ) + ) + static let getTextAsync = Route( + name: "get_text_async", + version: 1, + namespace: "riviera", + deprecated: false, + argSerializer: Riviera.GetTextArgsSerializer(), + responseSerializer: Async.LaunchResultBaseSerializer(), + errorSerializer: Serialization._VoidSerializer, + attributes: RouteAttributes( + auth: [.app, .user], + host: .api, + style: .rpc + ) + ) + static let getTextAsyncCheck = Route( + name: "get_text_async/check", + version: 1, + namespace: "riviera", + deprecated: false, + argSerializer: Async.PollArgSerializer(), + responseSerializer: Riviera.GetTextAsyncCheckResultSerializer(), + errorSerializer: Async.PollErrorSerializer(), + attributes: RouteAttributes( + auth: [.app, .user], + host: .api, + style: .rpc + ) + ) static let getTranscriptAsync = Route( name: "get_transcript_async", version: 1, diff --git a/Source/SwiftyDropbox/Shared/Generated/RivieraAppAuthRoutes.swift b/Source/SwiftyDropbox/Shared/Generated/RivieraAppAuthRoutes.swift index 5f9a16bc..52f1c30f 100644 --- a/Source/SwiftyDropbox/Shared/Generated/RivieraAppAuthRoutes.swift +++ b/Source/SwiftyDropbox/Shared/Generated/RivieraAppAuthRoutes.swift @@ -99,6 +99,84 @@ public class RivieraAppAuthRoutes: DropboxTransportClientOwning { return client.request(route, serverArgs: serverArgs) } + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` + /// variants. OCR is supported for image files and PDFs, including scanned / non-text PDFs; see the route + /// description for the supported formats. Requests against unsupported formats return + /// `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared links (www.dropbox.com) are + /// supported. External (non-Dropbox) URLs are not supported and return `unsupported_format_error`; import the + /// file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @discardableResult public func getOcrAsync(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) -> RpcRequest { + let route = Riviera.getOcrAsync + let serverArgs = Riviera.GetOcrArgs(fileIdOrUrl: fileIdOrUrl) + return client.request(route, serverArgs: serverArgs) + } + + /// Returns the status or result of specified get_ocr_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetOcrAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @discardableResult public func getOcrAsyncCheck(asyncJobId: String) -> RpcRequest { + let route = Riviera.getOcrAsyncCheck + let serverArgs = Async.PollArg(asyncJobId: asyncJobId) + return client.request(route, serverArgs: serverArgs) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the document to extract text from. Callers must set exactly one of the + /// `FileIdOrUrl` variants. Text extraction is supported for common document formats (Word, PowerPoint, Excel, + /// PDF, RTF, and Dropbox document types); see the route description for the supported formats. Requests against + /// unsupported formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared + /// links (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and return + /// `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @discardableResult public func getTextAsync(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) -> RpcRequest { + let route = Riviera.getTextAsync + let serverArgs = Riviera.GetTextArgs(fileIdOrUrl: fileIdOrUrl) + return client.request(route, serverArgs: serverArgs) + } + + /// Returns the status or result of specified get_text_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetTextAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @discardableResult public func getTextAsyncCheck(asyncJobId: String) -> RpcRequest { + let route = Riviera.getTextAsyncCheck + let serverArgs = Async.PollArg(asyncJobId: asyncJobId) + return client.request(route, serverArgs: serverArgs) + } + /// Asynchronous transcript generation for audio and video files. Supported audio formats: .aac, .aif, .aiff, .flac, /// .m4a, .m4r, .mp3, .oga, .ogg, .wav, .wma. Supported video formats: .3gp, .3gpp, .3gpp2, .asf, .avi, .dv, /// .flv, .m2t, .m2ts, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .mts, .mxf, .oggtheora, .ogv, .rm, .ts, .vob, .webm, diff --git a/Source/SwiftyDropbox/Shared/Generated/RivieraRoutes.swift b/Source/SwiftyDropbox/Shared/Generated/RivieraRoutes.swift index 086be160..a6005796 100644 --- a/Source/SwiftyDropbox/Shared/Generated/RivieraRoutes.swift +++ b/Source/SwiftyDropbox/Shared/Generated/RivieraRoutes.swift @@ -99,6 +99,84 @@ public class RivieraRoutes: DropboxTransportClientOwning { return client.request(route, serverArgs: serverArgs) } + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` + /// variants. OCR is supported for image files and PDFs, including scanned / non-text PDFs; see the route + /// description for the supported formats. Requests against unsupported formats return + /// `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared links (www.dropbox.com) are + /// supported. External (non-Dropbox) URLs are not supported and return `unsupported_format_error`; import the + /// file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @discardableResult public func getOcrAsync(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) -> RpcRequest { + let route = Riviera.getOcrAsync + let serverArgs = Riviera.GetOcrArgs(fileIdOrUrl: fileIdOrUrl) + return client.request(route, serverArgs: serverArgs) + } + + /// Returns the status or result of specified get_ocr_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetOcrAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @discardableResult public func getOcrAsyncCheck(asyncJobId: String) -> RpcRequest { + let route = Riviera.getOcrAsyncCheck + let serverArgs = Async.PollArg(asyncJobId: asyncJobId) + return client.request(route, serverArgs: serverArgs) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the document to extract text from. Callers must set exactly one of the + /// `FileIdOrUrl` variants. Text extraction is supported for common document formats (Word, PowerPoint, Excel, + /// PDF, RTF, and Dropbox document types); see the route description for the supported formats. Requests against + /// unsupported formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared + /// links (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and return + /// `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @discardableResult public func getTextAsync(fileIdOrUrl: Riviera.FileIdOrUrl? = nil) -> RpcRequest { + let route = Riviera.getTextAsync + let serverArgs = Riviera.GetTextArgs(fileIdOrUrl: fileIdOrUrl) + return client.request(route, serverArgs: serverArgs) + } + + /// Returns the status or result of specified get_text_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetTextAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @discardableResult public func getTextAsyncCheck(asyncJobId: String) -> RpcRequest { + let route = Riviera.getTextAsyncCheck + let serverArgs = Async.PollArg(asyncJobId: asyncJobId) + return client.request(route, serverArgs: serverArgs) + } + /// Asynchronous transcript generation for audio and video files. Supported audio formats: .aac, .aif, .aiff, .flac, /// .m4a, .m4r, .mp3, .oga, .ogg, .wav, .wma. Supported video formats: .3gp, .3gpp, .3gpp2, .asf, .avi, .dv, /// .flv, .m2t, .m2ts, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .mts, .mxf, .oggtheora, .ogv, .rm, .ts, .vob, .webm, diff --git a/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift b/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift index 2b0000bf..2d73cccb 100644 --- a/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift +++ b/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift @@ -16213,6 +16213,14 @@ public class TeamLog { /// An unspecified error. case protectInternalDomainsChangedDetails(TeamLog.ProtectInternalDomainsChangedDetails) /// An unspecified error. + case protectPolicyActivatedDetails(TeamLog.ProtectPolicyActivatedDetails) + /// An unspecified error. + case protectPolicyDeactivatedDetails(TeamLog.ProtectPolicyDeactivatedDetails) + /// An unspecified error. + case protectPolicyScheduledDetails(TeamLog.ProtectPolicyScheduledDetails) + /// An unspecified error. + case protectPolicyUpdatedDetails(TeamLog.ProtectPolicyUpdatedDetails) + /// An unspecified error. case classificationCreateReportDetails(TeamLog.ClassificationCreateReportDetails) /// An unspecified error. case classificationCreateReportFailDetails(TeamLog.ClassificationCreateReportFailDetails) @@ -18055,6 +18063,22 @@ public class TeamLog { var d = try Serialization.getFields(TeamLog.ProtectInternalDomainsChangedDetailsSerializer().serialize(arg)) d[".tag"] = .str("protect_internal_domains_changed_details") return .dictionary(d) + case .protectPolicyActivatedDetails(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyActivatedDetailsSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_activated_details") + return .dictionary(d) + case .protectPolicyDeactivatedDetails(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyDeactivatedDetailsSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_deactivated_details") + return .dictionary(d) + case .protectPolicyScheduledDetails(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyScheduledDetailsSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_scheduled_details") + return .dictionary(d) + case .protectPolicyUpdatedDetails(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyUpdatedDetailsSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_updated_details") + return .dictionary(d) case .classificationCreateReportDetails(let arg): var d = try Serialization.getFields(TeamLog.ClassificationCreateReportDetailsSerializer().serialize(arg)) d[".tag"] = .str("classification_create_report_details") @@ -20289,6 +20313,18 @@ public class TeamLog { case "protect_internal_domains_changed_details": let v = try TeamLog.ProtectInternalDomainsChangedDetailsSerializer().deserialize(json) return EventDetails.protectInternalDomainsChangedDetails(v) + case "protect_policy_activated_details": + let v = try TeamLog.ProtectPolicyActivatedDetailsSerializer().deserialize(json) + return EventDetails.protectPolicyActivatedDetails(v) + case "protect_policy_deactivated_details": + let v = try TeamLog.ProtectPolicyDeactivatedDetailsSerializer().deserialize(json) + return EventDetails.protectPolicyDeactivatedDetails(v) + case "protect_policy_scheduled_details": + let v = try TeamLog.ProtectPolicyScheduledDetailsSerializer().deserialize(json) + return EventDetails.protectPolicyScheduledDetails(v) + case "protect_policy_updated_details": + let v = try TeamLog.ProtectPolicyUpdatedDetailsSerializer().deserialize(json) + return EventDetails.protectPolicyUpdatedDetails(v) case "classification_create_report_details": let v = try TeamLog.ClassificationCreateReportDetailsSerializer().deserialize(json) return EventDetails.classificationCreateReportDetails(v) @@ -21898,6 +21934,14 @@ public class TeamLog { case protectActionStopSharing(TeamLog.ProtectActionStopSharingType) /// (protect) Modified Protect internal domains list case protectInternalDomainsChanged(TeamLog.ProtectInternalDomainsChangedType) + /// (protect) Activated a Dropbox Protect policy + case protectPolicyActivated(TeamLog.ProtectPolicyActivatedType) + /// (protect) Deactivated a Dropbox Protect policy + case protectPolicyDeactivated(TeamLog.ProtectPolicyDeactivatedType) + /// (protect) Scheduled a Dropbox Protect policy + case protectPolicyScheduled(TeamLog.ProtectPolicyScheduledType) + /// (protect) Updated a Dropbox Protect policy + case protectPolicyUpdated(TeamLog.ProtectPolicyUpdatedType) /// (reports) Created Classification report case classificationCreateReport(TeamLog.ClassificationCreateReportType) /// (reports) Couldn't create Classification report @@ -23748,6 +23792,22 @@ public class TeamLog { var d = try Serialization.getFields(TeamLog.ProtectInternalDomainsChangedTypeSerializer().serialize(arg)) d[".tag"] = .str("protect_internal_domains_changed") return .dictionary(d) + case .protectPolicyActivated(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyActivatedTypeSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_activated") + return .dictionary(d) + case .protectPolicyDeactivated(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyDeactivatedTypeSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_deactivated") + return .dictionary(d) + case .protectPolicyScheduled(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyScheduledTypeSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_scheduled") + return .dictionary(d) + case .protectPolicyUpdated(let arg): + var d = try Serialization.getFields(TeamLog.ProtectPolicyUpdatedTypeSerializer().serialize(arg)) + d[".tag"] = .str("protect_policy_updated") + return .dictionary(d) case .classificationCreateReport(let arg): var d = try Serialization.getFields(TeamLog.ClassificationCreateReportTypeSerializer().serialize(arg)) d[".tag"] = .str("classification_create_report") @@ -25978,6 +26038,18 @@ public class TeamLog { case "protect_internal_domains_changed": let v = try TeamLog.ProtectInternalDomainsChangedTypeSerializer().deserialize(json) return EventType.protectInternalDomainsChanged(v) + case "protect_policy_activated": + let v = try TeamLog.ProtectPolicyActivatedTypeSerializer().deserialize(json) + return EventType.protectPolicyActivated(v) + case "protect_policy_deactivated": + let v = try TeamLog.ProtectPolicyDeactivatedTypeSerializer().deserialize(json) + return EventType.protectPolicyDeactivated(v) + case "protect_policy_scheduled": + let v = try TeamLog.ProtectPolicyScheduledTypeSerializer().deserialize(json) + return EventType.protectPolicyScheduled(v) + case "protect_policy_updated": + let v = try TeamLog.ProtectPolicyUpdatedTypeSerializer().deserialize(json) + return EventType.protectPolicyUpdated(v) case "classification_create_report": let v = try TeamLog.ClassificationCreateReportTypeSerializer().deserialize(json) return EventType.classificationCreateReport(v) @@ -27584,6 +27656,14 @@ public class TeamLog { case protectActionStopSharing /// (protect) Modified Protect internal domains list case protectInternalDomainsChanged + /// (protect) Activated a Dropbox Protect policy + case protectPolicyActivated + /// (protect) Deactivated a Dropbox Protect policy + case protectPolicyDeactivated + /// (protect) Scheduled a Dropbox Protect policy + case protectPolicyScheduled + /// (protect) Updated a Dropbox Protect policy + case protectPolicyUpdated /// (reports) Created Classification report case classificationCreateReport /// (reports) Couldn't create Classification report @@ -29434,6 +29514,22 @@ public class TeamLog { var d = [String: JSON]() d[".tag"] = .str("protect_internal_domains_changed") return .dictionary(d) + case .protectPolicyActivated: + var d = [String: JSON]() + d[".tag"] = .str("protect_policy_activated") + return .dictionary(d) + case .protectPolicyDeactivated: + var d = [String: JSON]() + d[".tag"] = .str("protect_policy_deactivated") + return .dictionary(d) + case .protectPolicyScheduled: + var d = [String: JSON]() + d[".tag"] = .str("protect_policy_scheduled") + return .dictionary(d) + case .protectPolicyUpdated: + var d = [String: JSON]() + d[".tag"] = .str("protect_policy_updated") + return .dictionary(d) case .classificationCreateReport: var d = [String: JSON]() d[".tag"] = .str("classification_create_report") @@ -31379,6 +31475,14 @@ public class TeamLog { return EventTypeArg.protectActionStopSharing case "protect_internal_domains_changed": return EventTypeArg.protectInternalDomainsChanged + case "protect_policy_activated": + return EventTypeArg.protectPolicyActivated + case "protect_policy_deactivated": + return EventTypeArg.protectPolicyDeactivated + case "protect_policy_scheduled": + return EventTypeArg.protectPolicyScheduled + case "protect_policy_updated": + return EventTypeArg.protectPolicyUpdated case "classification_create_report": return EventTypeArg.classificationCreateReport case "classification_create_report_fail": @@ -57059,6 +57163,326 @@ public class TeamLog { } } + /// Activated a Dropbox Protect policy. + public class ProtectPolicyActivatedDetails: CustomStringConvertible, JSONRepresentable { + /// Policy ID. + public let policyId: String + public init(policyId: String) { + stringValidator()(policyId) + self.policyId = policyId + } + + func json() throws -> JSON { + try ProtectPolicyActivatedDetailsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyActivatedDetailsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyActivatedDetails: \(error)" + } + } + } + public class ProtectPolicyActivatedDetailsSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyActivatedDetails) throws -> JSON { + let output = [ + "policy_id": try Serialization._StringSerializer.serialize(value.policyId), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyActivatedDetails { + switch json { + case .dictionary(let dict): + let policyId = try Serialization._StringSerializer.deserialize(dict["policy_id"] ?? .null) + return ProtectPolicyActivatedDetails(policyId: policyId) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyActivatedDetails.self, json: json) + } + } + } + + /// The ProtectPolicyActivatedType struct + public class ProtectPolicyActivatedType: CustomStringConvertible, JSONRepresentable { + /// (no description) + public let description_: String + public init(description_: String) { + stringValidator()(description_) + self.description_ = description_ + } + + func json() throws -> JSON { + try ProtectPolicyActivatedTypeSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyActivatedTypeSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyActivatedType: \(error)" + } + } + } + public class ProtectPolicyActivatedTypeSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyActivatedType) throws -> JSON { + let output = [ + "description": try Serialization._StringSerializer.serialize(value.description_), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyActivatedType { + switch json { + case .dictionary(let dict): + let description_ = try Serialization._StringSerializer.deserialize(dict["description"] ?? .null) + return ProtectPolicyActivatedType(description_: description_) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyActivatedType.self, json: json) + } + } + } + + /// Deactivated a Dropbox Protect policy. + public class ProtectPolicyDeactivatedDetails: CustomStringConvertible, JSONRepresentable { + /// Policy ID. + public let policyId: String + public init(policyId: String) { + stringValidator()(policyId) + self.policyId = policyId + } + + func json() throws -> JSON { + try ProtectPolicyDeactivatedDetailsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyDeactivatedDetailsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyDeactivatedDetails: \(error)" + } + } + } + public class ProtectPolicyDeactivatedDetailsSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyDeactivatedDetails) throws -> JSON { + let output = [ + "policy_id": try Serialization._StringSerializer.serialize(value.policyId), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyDeactivatedDetails { + switch json { + case .dictionary(let dict): + let policyId = try Serialization._StringSerializer.deserialize(dict["policy_id"] ?? .null) + return ProtectPolicyDeactivatedDetails(policyId: policyId) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyDeactivatedDetails.self, json: json) + } + } + } + + /// The ProtectPolicyDeactivatedType struct + public class ProtectPolicyDeactivatedType: CustomStringConvertible, JSONRepresentable { + /// (no description) + public let description_: String + public init(description_: String) { + stringValidator()(description_) + self.description_ = description_ + } + + func json() throws -> JSON { + try ProtectPolicyDeactivatedTypeSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyDeactivatedTypeSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyDeactivatedType: \(error)" + } + } + } + public class ProtectPolicyDeactivatedTypeSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyDeactivatedType) throws -> JSON { + let output = [ + "description": try Serialization._StringSerializer.serialize(value.description_), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyDeactivatedType { + switch json { + case .dictionary(let dict): + let description_ = try Serialization._StringSerializer.deserialize(dict["description"] ?? .null) + return ProtectPolicyDeactivatedType(description_: description_) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyDeactivatedType.self, json: json) + } + } + } + + /// Scheduled a Dropbox Protect policy. + public class ProtectPolicyScheduledDetails: CustomStringConvertible, JSONRepresentable { + /// Policy ID. + public let policyId: String + public init(policyId: String) { + stringValidator()(policyId) + self.policyId = policyId + } + + func json() throws -> JSON { + try ProtectPolicyScheduledDetailsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyScheduledDetailsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyScheduledDetails: \(error)" + } + } + } + public class ProtectPolicyScheduledDetailsSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyScheduledDetails) throws -> JSON { + let output = [ + "policy_id": try Serialization._StringSerializer.serialize(value.policyId), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyScheduledDetails { + switch json { + case .dictionary(let dict): + let policyId = try Serialization._StringSerializer.deserialize(dict["policy_id"] ?? .null) + return ProtectPolicyScheduledDetails(policyId: policyId) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyScheduledDetails.self, json: json) + } + } + } + + /// The ProtectPolicyScheduledType struct + public class ProtectPolicyScheduledType: CustomStringConvertible, JSONRepresentable { + /// (no description) + public let description_: String + public init(description_: String) { + stringValidator()(description_) + self.description_ = description_ + } + + func json() throws -> JSON { + try ProtectPolicyScheduledTypeSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyScheduledTypeSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyScheduledType: \(error)" + } + } + } + public class ProtectPolicyScheduledTypeSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyScheduledType) throws -> JSON { + let output = [ + "description": try Serialization._StringSerializer.serialize(value.description_), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyScheduledType { + switch json { + case .dictionary(let dict): + let description_ = try Serialization._StringSerializer.deserialize(dict["description"] ?? .null) + return ProtectPolicyScheduledType(description_: description_) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyScheduledType.self, json: json) + } + } + } + + /// Updated a Dropbox Protect policy. + public class ProtectPolicyUpdatedDetails: CustomStringConvertible, JSONRepresentable { + /// Policy ID. + public let policyId: String + public init(policyId: String) { + stringValidator()(policyId) + self.policyId = policyId + } + + func json() throws -> JSON { + try ProtectPolicyUpdatedDetailsSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyUpdatedDetailsSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyUpdatedDetails: \(error)" + } + } + } + public class ProtectPolicyUpdatedDetailsSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyUpdatedDetails) throws -> JSON { + let output = [ + "policy_id": try Serialization._StringSerializer.serialize(value.policyId), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyUpdatedDetails { + switch json { + case .dictionary(let dict): + let policyId = try Serialization._StringSerializer.deserialize(dict["policy_id"] ?? .null) + return ProtectPolicyUpdatedDetails(policyId: policyId) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyUpdatedDetails.self, json: json) + } + } + } + + /// The ProtectPolicyUpdatedType struct + public class ProtectPolicyUpdatedType: CustomStringConvertible, JSONRepresentable { + /// (no description) + public let description_: String + public init(description_: String) { + stringValidator()(description_) + self.description_ = description_ + } + + func json() throws -> JSON { + try ProtectPolicyUpdatedTypeSerializer().serialize(self) + } + + public var description: String { + do { + return "\(SerializeUtil.prepareJSONForSerialization(try ProtectPolicyUpdatedTypeSerializer().serialize(self)))" + } catch { + return "Failed to generate description for ProtectPolicyUpdatedType: \(error)" + } + } + } + public class ProtectPolicyUpdatedTypeSerializer: JSONSerializer { + public init() { } + public func serialize(_ value: ProtectPolicyUpdatedType) throws -> JSON { + let output = [ + "description": try Serialization._StringSerializer.serialize(value.description_), + ] + return .dictionary(output) + } + public func deserialize(_ json: JSON) throws -> ProtectPolicyUpdatedType { + switch json { + case .dictionary(let dict): + let description_ = try Serialization._StringSerializer.deserialize(dict["description"] ?? .null) + return ProtectPolicyUpdatedType(description_: description_) + default: + throw JSONSerializerError.deserializeError(type: ProtectPolicyUpdatedType.self, json: json) + } + } + } + /// Quick action type. public enum QuickActionType: CustomStringConvertible, JSONRepresentable { /// An unspecified error. diff --git a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRiviera.swift b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRiviera.swift index ec275b1f..f7e1b79c 100644 --- a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRiviera.swift +++ b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRiviera.swift @@ -1067,6 +1067,314 @@ public class DBXRivieraGetMetadataResult: NSObject { public override var description: String { swift.description } } +/// Arguments for the asynchronous `get_ocr_async` route. Exactly one of `file_id`, `path`, or `url` must be +/// supplied via `file_id_or_url` to identify the image or PDF whose text should be extracted via OCR (optical +/// character recognition). +@objc +public class DBXRivieraGetOcrArgs: NSObject { + /// Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` variants. OCR is + /// supported for image files and PDFs, including scanned / non-text PDFs; see the route description for the + /// supported formats. Requests against unsupported formats return `unsupported_format_error`. NOTE: for the + /// `url` variant, only Dropbox shared links (www.dropbox.com) are supported. External (non-Dropbox) URLs + /// are not supported and return `unsupported_format_error`; import the file into Dropbox and reference it + /// by `file_id` or `path` instead. + @objc + public var fileIdOrUrl: DBXRivieraFileIdOrUrl? { guard let swift = swift.fileIdOrUrl else { return nil } + return DBXRivieraFileIdOrUrl(swift: swift) + } + + @objc + public init(fileIdOrUrl: DBXRivieraFileIdOrUrl?) { + self.swift = Riviera.GetOcrArgs(fileIdOrUrl: fileIdOrUrl?.swift) + } + + let swift: Riviera.GetOcrArgs + + public init(swift: Riviera.GetOcrArgs) { + self.swift = swift + } + + @objc + public override var description: String { swift.description } +} + +/// Result type for EventBus async check - must end in "CheckResult" +@objc +public class DBXRivieraGetOcrAsyncCheckResult: NSObject { + let swift: Riviera.GetOcrAsyncCheckResult + + public init(swift: Riviera.GetOcrAsyncCheckResult) { + self.swift = swift + } + + public static func factory(swift: Riviera.GetOcrAsyncCheckResult) -> DBXRivieraGetOcrAsyncCheckResult { + switch swift { + case .inProgress: + return DBXRivieraGetOcrAsyncCheckResultInProgress() + case .complete(let swiftArg): + let arg = DBXRivieraGetOcrResult(swift: swiftArg) + return DBXRivieraGetOcrAsyncCheckResultComplete(arg) + case .failed(let swiftArg): + let arg = DBXRivieraOcrExtractionApiV2Error(swift: swiftArg) + return DBXRivieraGetOcrAsyncCheckResultFailed(arg) + case .other: + return DBXRivieraGetOcrAsyncCheckResultOther() + } + } + + @objc + public override var description: String { swift.description } + + @objc + public var asInProgress: DBXRivieraGetOcrAsyncCheckResultInProgress? { + self as? DBXRivieraGetOcrAsyncCheckResultInProgress + } + + @objc + public var asComplete: DBXRivieraGetOcrAsyncCheckResultComplete? { + self as? DBXRivieraGetOcrAsyncCheckResultComplete + } + + @objc + public var asFailed: DBXRivieraGetOcrAsyncCheckResultFailed? { + self as? DBXRivieraGetOcrAsyncCheckResultFailed + } + + @objc + public var asOther: DBXRivieraGetOcrAsyncCheckResultOther? { + self as? DBXRivieraGetOcrAsyncCheckResultOther + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetOcrAsyncCheckResultInProgress: DBXRivieraGetOcrAsyncCheckResult { + @objc + public init() { + let swift = Riviera.GetOcrAsyncCheckResult.inProgress + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetOcrAsyncCheckResultComplete: DBXRivieraGetOcrAsyncCheckResult { + @objc + public var complete: DBXRivieraGetOcrResult + + @objc + public init(_ arg: DBXRivieraGetOcrResult) { + self.complete = arg + let swift = Riviera.GetOcrAsyncCheckResult.complete(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetOcrAsyncCheckResultFailed: DBXRivieraGetOcrAsyncCheckResult { + @objc + public var failed: DBXRivieraOcrExtractionApiV2Error + + @objc + public init(_ arg: DBXRivieraOcrExtractionApiV2Error) { + self.failed = arg + let swift = Riviera.GetOcrAsyncCheckResult.failed(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetOcrAsyncCheckResultOther: DBXRivieraGetOcrAsyncCheckResult { + @objc + public init() { + let swift = Riviera.GetOcrAsyncCheckResult.other + super.init(swift: swift) + } +} + +/// Objective-C compatible GetOcrResult struct +@objc +public class DBXRivieraGetOcrResult: NSObject { + /// The plain-text content extracted from the file via OCR. Words within a line are separated by a single space, + /// lines are newline-separated in reading order, and for multi-page PDFs pages are separated by a blank + /// line in page order. May be empty when no text is detected in the source. + @objc + public var text: String { swift.text } + /// The same content as hOCR: HTML that carries the position of every recognized word. Each page is a + /// `
` holding `

` elements with one `` per word, and each element carries + /// `data-x`, `data-y`, `data-width`, and `data-height` attributes in pixels relative to the upright page + /// (whose dimensions are on the `

`). Use this when you need word coordinates -- to highlight + /// matches over a page image, for example; use `text` when you just need the words. + @objc + public var hocr: String { swift.hocr } + + @objc + public init(text: String, hocr: String) { + self.swift = Riviera.GetOcrResult(text: text, hocr: hocr) + } + + let swift: Riviera.GetOcrResult + + public init(swift: Riviera.GetOcrResult) { + self.swift = swift + } + + @objc + public override var description: String { swift.description } +} + +/// Arguments for the asynchronous `get_text_async` route. Exactly one of `file_id`, `path`, or `url` must be +/// supplied via `file_id_or_url` to identify the document whose plain-text content should be extracted. +@objc +public class DBXRivieraGetTextArgs: NSObject { + /// Identifier of the document to extract text from. Callers must set exactly one of the `FileIdOrUrl` variants. + /// Text extraction is supported for common document formats (Word, PowerPoint, Excel, PDF, RTF, and Dropbox + /// document types); see the route description for the supported formats. Requests against unsupported + /// formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared links + /// (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and return + /// `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or `path` + /// instead. + @objc + public var fileIdOrUrl: DBXRivieraFileIdOrUrl? { guard let swift = swift.fileIdOrUrl else { return nil } + return DBXRivieraFileIdOrUrl(swift: swift) + } + + @objc + public init(fileIdOrUrl: DBXRivieraFileIdOrUrl?) { + self.swift = Riviera.GetTextArgs(fileIdOrUrl: fileIdOrUrl?.swift) + } + + let swift: Riviera.GetTextArgs + + public init(swift: Riviera.GetTextArgs) { + self.swift = swift + } + + @objc + public override var description: String { swift.description } +} + +/// Result type for EventBus async check - must end in "CheckResult" +@objc +public class DBXRivieraGetTextAsyncCheckResult: NSObject { + let swift: Riviera.GetTextAsyncCheckResult + + public init(swift: Riviera.GetTextAsyncCheckResult) { + self.swift = swift + } + + public static func factory(swift: Riviera.GetTextAsyncCheckResult) -> DBXRivieraGetTextAsyncCheckResult { + switch swift { + case .inProgress: + return DBXRivieraGetTextAsyncCheckResultInProgress() + case .complete(let swiftArg): + let arg = DBXRivieraGetTextResult(swift: swiftArg) + return DBXRivieraGetTextAsyncCheckResultComplete(arg) + case .failed(let swiftArg): + let arg = DBXRivieraTextExtractionApiV2Error(swift: swiftArg) + return DBXRivieraGetTextAsyncCheckResultFailed(arg) + case .other: + return DBXRivieraGetTextAsyncCheckResultOther() + } + } + + @objc + public override var description: String { swift.description } + + @objc + public var asInProgress: DBXRivieraGetTextAsyncCheckResultInProgress? { + self as? DBXRivieraGetTextAsyncCheckResultInProgress + } + + @objc + public var asComplete: DBXRivieraGetTextAsyncCheckResultComplete? { + self as? DBXRivieraGetTextAsyncCheckResultComplete + } + + @objc + public var asFailed: DBXRivieraGetTextAsyncCheckResultFailed? { + self as? DBXRivieraGetTextAsyncCheckResultFailed + } + + @objc + public var asOther: DBXRivieraGetTextAsyncCheckResultOther? { + self as? DBXRivieraGetTextAsyncCheckResultOther + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetTextAsyncCheckResultInProgress: DBXRivieraGetTextAsyncCheckResult { + @objc + public init() { + let swift = Riviera.GetTextAsyncCheckResult.inProgress + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetTextAsyncCheckResultComplete: DBXRivieraGetTextAsyncCheckResult { + @objc + public var complete: DBXRivieraGetTextResult + + @objc + public init(_ arg: DBXRivieraGetTextResult) { + self.complete = arg + let swift = Riviera.GetTextAsyncCheckResult.complete(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetTextAsyncCheckResultFailed: DBXRivieraGetTextAsyncCheckResult { + @objc + public var failed: DBXRivieraTextExtractionApiV2Error + + @objc + public init(_ arg: DBXRivieraTextExtractionApiV2Error) { + self.failed = arg + let swift = Riviera.GetTextAsyncCheckResult.failed(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraGetTextAsyncCheckResultOther: DBXRivieraGetTextAsyncCheckResult { + @objc + public init() { + let swift = Riviera.GetTextAsyncCheckResult.other + super.init(swift: swift) + } +} + +/// Objective-C compatible GetTextResult struct +@objc +public class DBXRivieraGetTextResult: NSObject { + /// The plain-text content extracted from the document. For multi-page documents the text is concatenated in + /// document order. May be empty when no text is detected in the source. + @objc + public var text: String { swift.text } + + @objc + public init(text: String) { + self.swift = Riviera.GetTextResult(text: text) + } + + let swift: Riviera.GetTextResult + + public init(swift: Riviera.GetTextResult) { + self.swift = swift + } + + @objc + public override var description: String { swift.description } +} + /// Arguments for the asynchronous `get_transcript_async` route. Exactly one of `file_id`, `path`, or `url` must be /// supplied via `file_id_or_url` to identify the audio or video asset to transcribe. @objc @@ -1782,6 +2090,208 @@ public class DBXRivieraMetadataTypeOther: DBXRivieraMetadataType { } } +/// Reason an OCR extraction job failed. Returned in the `failed` variant of `GetOcrAsyncCheckResult`. This is a +/// semantic error union: the HTTP status of the poll request itself is unaffected (a poll that surfaces a failed +/// job is still a normal successful poll response). Callers should branch on the variant. +@objc +public class DBXRivieraOcrExtractionApiV2Error: NSObject { + let swift: Riviera.OcrExtractionApiV2Error + + public init(swift: Riviera.OcrExtractionApiV2Error) { + self.swift = swift + } + + public static func factory(swift: Riviera.OcrExtractionApiV2Error) -> DBXRivieraOcrExtractionApiV2Error { + switch swift { + case .serverError(let swiftArg): + let arg = swiftArg + return DBXRivieraOcrExtractionApiV2ErrorServerError(arg) + case .userError(let swiftArg): + let arg = swiftArg + return DBXRivieraOcrExtractionApiV2ErrorUserError(arg) + case .unsupportedFormatError: + return DBXRivieraOcrExtractionApiV2ErrorUnsupportedFormatError() + case .linkDownloadDisabledError: + return DBXRivieraOcrExtractionApiV2ErrorLinkDownloadDisabledError() + case .sharedLinkPasswordProtected: + return DBXRivieraOcrExtractionApiV2ErrorSharedLinkPasswordProtected() + case .limitExceededError: + return DBXRivieraOcrExtractionApiV2ErrorLimitExceededError() + case .conversionFailureError: + return DBXRivieraOcrExtractionApiV2ErrorConversionFailureError() + case .notFoundError: + return DBXRivieraOcrExtractionApiV2ErrorNotFoundError() + case .isAFolderError: + return DBXRivieraOcrExtractionApiV2ErrorIsAFolderError() + case .other: + return DBXRivieraOcrExtractionApiV2ErrorOther() + } + } + + @objc + public override var description: String { swift.description } + + @objc + public var asServerError: DBXRivieraOcrExtractionApiV2ErrorServerError? { + self as? DBXRivieraOcrExtractionApiV2ErrorServerError + } + + @objc + public var asUserError: DBXRivieraOcrExtractionApiV2ErrorUserError? { + self as? DBXRivieraOcrExtractionApiV2ErrorUserError + } + + @objc + public var asUnsupportedFormatError: DBXRivieraOcrExtractionApiV2ErrorUnsupportedFormatError? { + self as? DBXRivieraOcrExtractionApiV2ErrorUnsupportedFormatError + } + + @objc + public var asLinkDownloadDisabledError: DBXRivieraOcrExtractionApiV2ErrorLinkDownloadDisabledError? { + self as? DBXRivieraOcrExtractionApiV2ErrorLinkDownloadDisabledError + } + + @objc + public var asSharedLinkPasswordProtected: DBXRivieraOcrExtractionApiV2ErrorSharedLinkPasswordProtected? { + self as? DBXRivieraOcrExtractionApiV2ErrorSharedLinkPasswordProtected + } + + @objc + public var asLimitExceededError: DBXRivieraOcrExtractionApiV2ErrorLimitExceededError? { + self as? DBXRivieraOcrExtractionApiV2ErrorLimitExceededError + } + + @objc + public var asConversionFailureError: DBXRivieraOcrExtractionApiV2ErrorConversionFailureError? { + self as? DBXRivieraOcrExtractionApiV2ErrorConversionFailureError + } + + @objc + public var asNotFoundError: DBXRivieraOcrExtractionApiV2ErrorNotFoundError? { + self as? DBXRivieraOcrExtractionApiV2ErrorNotFoundError + } + + @objc + public var asIsAFolderError: DBXRivieraOcrExtractionApiV2ErrorIsAFolderError? { + self as? DBXRivieraOcrExtractionApiV2ErrorIsAFolderError + } + + @objc + public var asOther: DBXRivieraOcrExtractionApiV2ErrorOther? { + self as? DBXRivieraOcrExtractionApiV2ErrorOther + } +} + +/// An unexpected, typically transient, server-side failure. The string is a human-readable message; retrying +/// with backoff may succeed. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorServerError: DBXRivieraOcrExtractionApiV2Error { + @objc + public var serverError: String + + @objc + public init(_ arg: String) { + self.serverError = arg + let swift = Riviera.OcrExtractionApiV2Error.serverError(arg) + super.init(swift: swift) + } +} + +/// The request could not be processed as supplied (a problem with the caller's input). The string is a +/// human-readable message; retrying the same request will not help. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorUserError: DBXRivieraOcrExtractionApiV2Error { + @objc + public var userError: String + + @objc + public init(_ arg: String) { + self.userError = arg + let swift = Riviera.OcrExtractionApiV2Error.userError(arg) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorUnsupportedFormatError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.unsupportedFormatError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorLinkDownloadDisabledError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.linkDownloadDisabledError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorSharedLinkPasswordProtected: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.sharedLinkPasswordProtected + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorLimitExceededError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.limitExceededError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorConversionFailureError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.conversionFailureError + super.init(swift: swift) + } +} + +/// The referenced file does not exist or is not accessible. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorNotFoundError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.notFoundError + super.init(swift: swift) + } +} + +/// The target is a folder, not a file. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorIsAFolderError: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.isAFolderError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraOcrExtractionApiV2ErrorOther: DBXRivieraOcrExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.OcrExtractionApiV2Error.other + super.init(swift: swift) + } +} + /// The kind of MS Office document that produced an `ApiOfficeMetadata` result. @objc public class DBXRivieraOfficeFileType: NSObject { @@ -1885,6 +2395,208 @@ public class DBXRivieraOfficeFileTypeOther: DBXRivieraOfficeFileType { } } +/// Reason a text extraction job failed. Returned in the `failed` variant of `GetTextAsyncCheckResult`. This is a +/// semantic error union: the HTTP status of the poll request itself is unaffected (a poll that surfaces a failed +/// job is still a normal successful poll response). Callers should branch on the variant. +@objc +public class DBXRivieraTextExtractionApiV2Error: NSObject { + let swift: Riviera.TextExtractionApiV2Error + + public init(swift: Riviera.TextExtractionApiV2Error) { + self.swift = swift + } + + public static func factory(swift: Riviera.TextExtractionApiV2Error) -> DBXRivieraTextExtractionApiV2Error { + switch swift { + case .serverError(let swiftArg): + let arg = swiftArg + return DBXRivieraTextExtractionApiV2ErrorServerError(arg) + case .userError(let swiftArg): + let arg = swiftArg + return DBXRivieraTextExtractionApiV2ErrorUserError(arg) + case .unsupportedFormatError: + return DBXRivieraTextExtractionApiV2ErrorUnsupportedFormatError() + case .linkDownloadDisabledError: + return DBXRivieraTextExtractionApiV2ErrorLinkDownloadDisabledError() + case .sharedLinkPasswordProtected: + return DBXRivieraTextExtractionApiV2ErrorSharedLinkPasswordProtected() + case .limitExceededError: + return DBXRivieraTextExtractionApiV2ErrorLimitExceededError() + case .conversionFailureError: + return DBXRivieraTextExtractionApiV2ErrorConversionFailureError() + case .notFoundError: + return DBXRivieraTextExtractionApiV2ErrorNotFoundError() + case .isAFolderError: + return DBXRivieraTextExtractionApiV2ErrorIsAFolderError() + case .other: + return DBXRivieraTextExtractionApiV2ErrorOther() + } + } + + @objc + public override var description: String { swift.description } + + @objc + public var asServerError: DBXRivieraTextExtractionApiV2ErrorServerError? { + self as? DBXRivieraTextExtractionApiV2ErrorServerError + } + + @objc + public var asUserError: DBXRivieraTextExtractionApiV2ErrorUserError? { + self as? DBXRivieraTextExtractionApiV2ErrorUserError + } + + @objc + public var asUnsupportedFormatError: DBXRivieraTextExtractionApiV2ErrorUnsupportedFormatError? { + self as? DBXRivieraTextExtractionApiV2ErrorUnsupportedFormatError + } + + @objc + public var asLinkDownloadDisabledError: DBXRivieraTextExtractionApiV2ErrorLinkDownloadDisabledError? { + self as? DBXRivieraTextExtractionApiV2ErrorLinkDownloadDisabledError + } + + @objc + public var asSharedLinkPasswordProtected: DBXRivieraTextExtractionApiV2ErrorSharedLinkPasswordProtected? { + self as? DBXRivieraTextExtractionApiV2ErrorSharedLinkPasswordProtected + } + + @objc + public var asLimitExceededError: DBXRivieraTextExtractionApiV2ErrorLimitExceededError? { + self as? DBXRivieraTextExtractionApiV2ErrorLimitExceededError + } + + @objc + public var asConversionFailureError: DBXRivieraTextExtractionApiV2ErrorConversionFailureError? { + self as? DBXRivieraTextExtractionApiV2ErrorConversionFailureError + } + + @objc + public var asNotFoundError: DBXRivieraTextExtractionApiV2ErrorNotFoundError? { + self as? DBXRivieraTextExtractionApiV2ErrorNotFoundError + } + + @objc + public var asIsAFolderError: DBXRivieraTextExtractionApiV2ErrorIsAFolderError? { + self as? DBXRivieraTextExtractionApiV2ErrorIsAFolderError + } + + @objc + public var asOther: DBXRivieraTextExtractionApiV2ErrorOther? { + self as? DBXRivieraTextExtractionApiV2ErrorOther + } +} + +/// An unexpected, typically transient, server-side failure. The string is a human-readable message; retrying +/// with backoff may succeed. +@objc +public class DBXRivieraTextExtractionApiV2ErrorServerError: DBXRivieraTextExtractionApiV2Error { + @objc + public var serverError: String + + @objc + public init(_ arg: String) { + self.serverError = arg + let swift = Riviera.TextExtractionApiV2Error.serverError(arg) + super.init(swift: swift) + } +} + +/// The request could not be processed as supplied (a problem with the caller's input). The string is a +/// human-readable message; retrying the same request will not help. +@objc +public class DBXRivieraTextExtractionApiV2ErrorUserError: DBXRivieraTextExtractionApiV2Error { + @objc + public var userError: String + + @objc + public init(_ arg: String) { + self.userError = arg + let swift = Riviera.TextExtractionApiV2Error.userError(arg) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorUnsupportedFormatError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.unsupportedFormatError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorLinkDownloadDisabledError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.linkDownloadDisabledError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorSharedLinkPasswordProtected: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.sharedLinkPasswordProtected + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorLimitExceededError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.limitExceededError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorConversionFailureError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.conversionFailureError + super.init(swift: swift) + } +} + +/// The referenced file does not exist or is not accessible. +@objc +public class DBXRivieraTextExtractionApiV2ErrorNotFoundError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.notFoundError + super.init(swift: swift) + } +} + +/// The target is a folder, not a file. +@objc +public class DBXRivieraTextExtractionApiV2ErrorIsAFolderError: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.isAFolderError + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXRivieraTextExtractionApiV2ErrorOther: DBXRivieraTextExtractionApiV2Error { + @objc + public init() { + let swift = Riviera.TextExtractionApiV2Error.other + super.init(swift: swift) + } +} + /// Objective-C compatible TimestampLevel union @objc public class DBXRivieraTimestampLevel: NSObject { diff --git a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraAppAuthRoutes.swift b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraAppAuthRoutes.swift index d2c78481..f87ac9fb 100644 --- a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraAppAuthRoutes.swift +++ b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraAppAuthRoutes.swift @@ -128,6 +128,118 @@ public class DBXRivieraAppAuthRoutes: NSObject { return DBXRivieraGetMetadataAsyncCheckRpcRequest(swift: swift) } + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` + /// variants. OCR is supported for image files and PDFs, including scanned / non-text PDFs; see the route + /// description for the supported formats. Requests against unsupported formats return + /// `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared links (www.dropbox.com) are + /// supported. External (non-Dropbox) URLs are not supported and return `unsupported_format_error`; import the + /// file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getOcrAsync(fileIdOrUrl: DBXRivieraFileIdOrUrl?) -> DBXRivieraGetOcrAsyncRpcRequest { + let swift = swift.getOcrAsync(fileIdOrUrl: fileIdOrUrl?.swift) + return DBXRivieraGetOcrAsyncRpcRequest(swift: swift) + } + + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getOcrAsync() -> DBXRivieraGetOcrAsyncRpcRequest { + let swift = swift.getOcrAsync() + return DBXRivieraGetOcrAsyncRpcRequest(swift: swift) + } + + /// Returns the status or result of specified get_ocr_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetOcrAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @objc + @discardableResult public func getOcrAsyncCheck(asyncJobId: String) -> DBXRivieraGetOcrAsyncCheckRpcRequest { + let swift = swift.getOcrAsyncCheck(asyncJobId: asyncJobId) + return DBXRivieraGetOcrAsyncCheckRpcRequest(swift: swift) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the document to extract text from. Callers must set exactly one of the + /// `FileIdOrUrl` variants. Text extraction is supported for common document formats (Word, PowerPoint, Excel, + /// PDF, RTF, and Dropbox document types); see the route description for the supported formats. Requests against + /// unsupported formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared + /// links (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and return + /// `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getTextAsync(fileIdOrUrl: DBXRivieraFileIdOrUrl?) -> DBXRivieraGetTextAsyncRpcRequest { + let swift = swift.getTextAsync(fileIdOrUrl: fileIdOrUrl?.swift) + return DBXRivieraGetTextAsyncRpcRequest(swift: swift) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getTextAsync() -> DBXRivieraGetTextAsyncRpcRequest { + let swift = swift.getTextAsync() + return DBXRivieraGetTextAsyncRpcRequest(swift: swift) + } + + /// Returns the status or result of specified get_text_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetTextAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @objc + @discardableResult public func getTextAsyncCheck(asyncJobId: String) -> DBXRivieraGetTextAsyncCheckRpcRequest { + let swift = swift.getTextAsyncCheck(asyncJobId: asyncJobId) + return DBXRivieraGetTextAsyncCheckRpcRequest(swift: swift) + } + /// Asynchronous transcript generation for audio and video files. Supported audio formats: .aac, .aif, .aiff, .flac, /// .m4a, .m4r, .mp3, .oga, .ogg, .wav, .wma. Supported video formats: .3gp, .3gpp, .3gpp2, .asf, .avi, .dv, /// .flv, .m2t, .m2ts, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .mts, .mxf, .oggtheora, .ogv, .rm, .ts, .vob, .webm, diff --git a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraRoutes.swift b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraRoutes.swift index 93a5c9d7..ec86e28e 100644 --- a/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraRoutes.swift +++ b/Source/SwiftyDropboxObjC/Shared/Generated/DBXRivieraRoutes.swift @@ -128,6 +128,118 @@ public class DBXRivieraRoutes: NSObject { return DBXRivieraGetMetadataAsyncCheckRpcRequest(swift: swift) } + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the file to run OCR on. Callers must set exactly one of the `FileIdOrUrl` + /// variants. OCR is supported for image files and PDFs, including scanned / non-text PDFs; see the route + /// description for the supported formats. Requests against unsupported formats return + /// `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared links (www.dropbox.com) are + /// supported. External (non-Dropbox) URLs are not supported and return `unsupported_format_error`; import the + /// file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getOcrAsync(fileIdOrUrl: DBXRivieraFileIdOrUrl?) -> DBXRivieraGetOcrAsyncRpcRequest { + let swift = swift.getOcrAsync(fileIdOrUrl: fileIdOrUrl?.swift) + return DBXRivieraGetOcrAsyncRpcRequest(swift: swift) + } + + /// Asynchronous OCR (optical character recognition) text extraction for images and PDFs, including scanned / + /// non-text PDFs. Supported formats: - Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp. + /// - PDF format: .pdf. Unsupported formats return an `unsupported_format_error`. For the `url` variant only + /// Dropbox shared links are supported; external URLs return `unsupported_format_error`. Text-based PDFs already + /// carry a text layer, so OCR is not run against them and the result is empty; use `get_text_async` to read the + /// embedded text layer of such a PDF. The result carries the extracted words as plain text, plus the same + /// content as hOCR with per-word coordinates. + /// + /// - scope: files.content.read + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getOcrAsync() -> DBXRivieraGetOcrAsyncRpcRequest { + let swift = swift.getOcrAsync() + return DBXRivieraGetOcrAsyncRpcRequest(swift: swift) + } + + /// Returns the status or result of specified get_ocr_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetOcrAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @objc + @discardableResult public func getOcrAsyncCheck(asyncJobId: String) -> DBXRivieraGetOcrAsyncCheckRpcRequest { + let swift = swift.getOcrAsyncCheck(asyncJobId: asyncJobId) + return DBXRivieraGetOcrAsyncCheckRpcRequest(swift: swift) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - parameter fileIdOrUrl: Identifier of the document to extract text from. Callers must set exactly one of the + /// `FileIdOrUrl` variants. Text extraction is supported for common document formats (Word, PowerPoint, Excel, + /// PDF, RTF, and Dropbox document types); see the route description for the supported formats. Requests against + /// unsupported formats return `unsupported_format_error`. NOTE: for the `url` variant, only Dropbox shared + /// links (www.dropbox.com) are supported. External (non-Dropbox) URLs are not supported and return + /// `unsupported_format_error`; import the file into Dropbox and reference it by `file_id` or `path` instead. + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getTextAsync(fileIdOrUrl: DBXRivieraFileIdOrUrl?) -> DBXRivieraGetTextAsyncRpcRequest { + let swift = swift.getTextAsync(fileIdOrUrl: fileIdOrUrl?.swift) + return DBXRivieraGetTextAsyncRpcRequest(swift: swift) + } + + /// Asynchronous plain-text extraction from documents. Supported formats include: - Word processing: .doc, .docx, + /// .docm, .rtf. - Presentations: .ppt, .pptx, .pptm. - Spreadsheets: .xls, .xlsx, .xlsm. - PDF: .pdf. - Dropbox + /// document types: .paper, .papert, .binder, .gdoc, .gsheet, .gslides. - Plain text / subtitles: .txt, .vtt. + /// Unsupported formats return an `unsupported_format_error`. For the `url` variant only Dropbox shared links + /// are supported; external URLs return `unsupported_format_error`. + /// + /// - scope: files.content.read + /// + /// - returns: Through the response callback, the caller will receive a `Async.LaunchResultBase` object on success + /// or a `Void` object on failure. + @objc + @discardableResult public func getTextAsync() -> DBXRivieraGetTextAsyncRpcRequest { + let swift = swift.getTextAsync() + return DBXRivieraGetTextAsyncRpcRequest(swift: swift) + } + + /// Returns the status or result of specified get_text_async task. + /// + /// - scope: files.content.read + /// + /// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method + /// that launched the job. + /// + /// - returns: Through the response callback, the caller will receive a `Riviera.GetTextAsyncCheckResult` object on + /// success or a `Async.PollError` object on failure. + @objc + @discardableResult public func getTextAsyncCheck(asyncJobId: String) -> DBXRivieraGetTextAsyncCheckRpcRequest { + let swift = swift.getTextAsyncCheck(asyncJobId: asyncJobId) + return DBXRivieraGetTextAsyncCheckRpcRequest(swift: swift) + } + /// Asynchronous transcript generation for audio and video files. Supported audio formats: .aac, .aif, .aiff, .flac, /// .m4a, .m4r, .mp3, .oga, .ogg, .wav, .wma. Supported video formats: .3gp, .3gpp, .3gpp2, .asf, .avi, .dv, /// .flv, .m2t, .m2ts, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .mts, .mxf, .oggtheora, .ogv, .rm, .ts, .vob, .webm, @@ -446,6 +558,252 @@ public class DBXRivieraGetMetadataAsyncCheckRpcRequest: NSObject, DBXRequest { } } +@objc +public class DBXRivieraGetOcrAsyncRpcRequest: NSObject, DBXRequest { + var swift: RpcRequest + + init(swift: RpcRequest) { + self.swift = swift + } + + @objc + @discardableResult public func response( + completionHandler: @escaping (DBXAsyncLaunchResultBase?, DBXCallError?) -> Void + ) -> Self { + response(queue: nil, completionHandler: completionHandler) + } + + @objc + @discardableResult public func response( + queue: DispatchQueue?, + completionHandler: @escaping (DBXAsyncLaunchResultBase?, DBXCallError?) -> Void + ) -> Self { + swift.response(queue: queue) { result, error in + var objc: DBXAsyncLaunchResultBase? = nil + if let swift = result { + objc = DBXAsyncLaunchResultBase.factory(swift: swift) + } + completionHandler(objc, error?.objc) + } + return self + } + + @objc + public var clientPersistedString: String? { swift.clientPersistedString } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public var earliestBeginDate: Date? { swift.earliestBeginDate } + + @objc + public func persistingString(string: String?) -> Self { + swift.persistingString(string: string) + return self + } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public func settingEarliestBeginDate(date: Date?) -> Self { + swift.settingEarliestBeginDate(date: date) + return self + } + + @objc + public func cancel() { + swift.cancel() + } +} + +@objc +public class DBXRivieraGetOcrAsyncCheckRpcRequest: NSObject, DBXRequest { + var swift: RpcRequest + + init(swift: RpcRequest) { + self.swift = swift + } + + @objc + @discardableResult public func response( + completionHandler: @escaping (DBXRivieraGetOcrAsyncCheckResult?, DBXAsyncPollError?, DBXCallError?) -> Void + ) -> Self { + response(queue: nil, completionHandler: completionHandler) + } + + @objc + @discardableResult public func response( + queue: DispatchQueue?, + completionHandler: @escaping (DBXRivieraGetOcrAsyncCheckResult?, DBXAsyncPollError?, DBXCallError?) -> Void + ) -> Self { + swift.response(queue: queue) { result, error in + var routeError: DBXAsyncPollError? + var callError: DBXCallError? + switch error { + case .routeError(let box, _, _, _): + routeError = DBXAsyncPollError(swift: box.unboxed) + callError = nil + default: + routeError = nil + callError = error?.objc + } + + var objc: DBXRivieraGetOcrAsyncCheckResult? = nil + if let swift = result { + objc = DBXRivieraGetOcrAsyncCheckResult.factory(swift: swift) + } + completionHandler(objc, routeError, callError) + } + return self + } + + @objc + public var clientPersistedString: String? { swift.clientPersistedString } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public var earliestBeginDate: Date? { swift.earliestBeginDate } + + @objc + public func persistingString(string: String?) -> Self { + swift.persistingString(string: string) + return self + } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public func settingEarliestBeginDate(date: Date?) -> Self { + swift.settingEarliestBeginDate(date: date) + return self + } + + @objc + public func cancel() { + swift.cancel() + } +} + +@objc +public class DBXRivieraGetTextAsyncRpcRequest: NSObject, DBXRequest { + var swift: RpcRequest + + init(swift: RpcRequest) { + self.swift = swift + } + + @objc + @discardableResult public func response( + completionHandler: @escaping (DBXAsyncLaunchResultBase?, DBXCallError?) -> Void + ) -> Self { + response(queue: nil, completionHandler: completionHandler) + } + + @objc + @discardableResult public func response( + queue: DispatchQueue?, + completionHandler: @escaping (DBXAsyncLaunchResultBase?, DBXCallError?) -> Void + ) -> Self { + swift.response(queue: queue) { result, error in + var objc: DBXAsyncLaunchResultBase? = nil + if let swift = result { + objc = DBXAsyncLaunchResultBase.factory(swift: swift) + } + completionHandler(objc, error?.objc) + } + return self + } + + @objc + public var clientPersistedString: String? { swift.clientPersistedString } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public var earliestBeginDate: Date? { swift.earliestBeginDate } + + @objc + public func persistingString(string: String?) -> Self { + swift.persistingString(string: string) + return self + } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public func settingEarliestBeginDate(date: Date?) -> Self { + swift.settingEarliestBeginDate(date: date) + return self + } + + @objc + public func cancel() { + swift.cancel() + } +} + +@objc +public class DBXRivieraGetTextAsyncCheckRpcRequest: NSObject, DBXRequest { + var swift: RpcRequest + + init(swift: RpcRequest) { + self.swift = swift + } + + @objc + @discardableResult public func response( + completionHandler: @escaping (DBXRivieraGetTextAsyncCheckResult?, DBXAsyncPollError?, DBXCallError?) -> Void + ) -> Self { + response(queue: nil, completionHandler: completionHandler) + } + + @objc + @discardableResult public func response( + queue: DispatchQueue?, + completionHandler: @escaping (DBXRivieraGetTextAsyncCheckResult?, DBXAsyncPollError?, DBXCallError?) -> Void + ) -> Self { + swift.response(queue: queue) { result, error in + var routeError: DBXAsyncPollError? + var callError: DBXCallError? + switch error { + case .routeError(let box, _, _, _): + routeError = DBXAsyncPollError(swift: box.unboxed) + callError = nil + default: + routeError = nil + callError = error?.objc + } + + var objc: DBXRivieraGetTextAsyncCheckResult? = nil + if let swift = result { + objc = DBXRivieraGetTextAsyncCheckResult.factory(swift: swift) + } + completionHandler(objc, routeError, callError) + } + return self + } + + @objc + public var clientPersistedString: String? { swift.clientPersistedString } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public var earliestBeginDate: Date? { swift.earliestBeginDate } + + @objc + public func persistingString(string: String?) -> Self { + swift.persistingString(string: string) + return self + } + + @available(iOS 13.0, macOS 10.13, *) + @objc + public func settingEarliestBeginDate(date: Date?) -> Self { + swift.settingEarliestBeginDate(date: date) + return self + } + + @objc + public func cancel() { + swift.cancel() + } +} + @objc public class DBXRivieraGetTranscriptAsyncRpcRequest: NSObject, DBXRequest { var swift: RpcRequest diff --git a/Source/SwiftyDropboxObjC/Shared/Generated/DBXTeamLog.swift b/Source/SwiftyDropboxObjC/Shared/Generated/DBXTeamLog.swift index ad1423c7..bdd857fe 100644 --- a/Source/SwiftyDropboxObjC/Shared/Generated/DBXTeamLog.swift +++ b/Source/SwiftyDropboxObjC/Shared/Generated/DBXTeamLog.swift @@ -12591,6 +12591,18 @@ public class DBXTeamLogEventDetails: NSObject { case .protectInternalDomainsChangedDetails(let swiftArg): let arg = DBXTeamLogProtectInternalDomainsChangedDetails(swift: swiftArg) return DBXTeamLogEventDetailsProtectInternalDomainsChangedDetails(arg) + case .protectPolicyActivatedDetails(let swiftArg): + let arg = DBXTeamLogProtectPolicyActivatedDetails(swift: swiftArg) + return DBXTeamLogEventDetailsProtectPolicyActivatedDetails(arg) + case .protectPolicyDeactivatedDetails(let swiftArg): + let arg = DBXTeamLogProtectPolicyDeactivatedDetails(swift: swiftArg) + return DBXTeamLogEventDetailsProtectPolicyDeactivatedDetails(arg) + case .protectPolicyScheduledDetails(let swiftArg): + let arg = DBXTeamLogProtectPolicyScheduledDetails(swift: swiftArg) + return DBXTeamLogEventDetailsProtectPolicyScheduledDetails(arg) + case .protectPolicyUpdatedDetails(let swiftArg): + let arg = DBXTeamLogProtectPolicyUpdatedDetails(swift: swiftArg) + return DBXTeamLogEventDetailsProtectPolicyUpdatedDetails(arg) case .classificationCreateReportDetails(let swiftArg): let arg = DBXTeamLogClassificationCreateReportDetails(swift: swiftArg) return DBXTeamLogEventDetailsClassificationCreateReportDetails(arg) @@ -15050,6 +15062,26 @@ public class DBXTeamLogEventDetails: NSObject { return self as? DBXTeamLogEventDetailsProtectInternalDomainsChangedDetails } + @objc + public var asProtectPolicyActivatedDetails: DBXTeamLogEventDetailsProtectPolicyActivatedDetails? { + return self as? DBXTeamLogEventDetailsProtectPolicyActivatedDetails + } + + @objc + public var asProtectPolicyDeactivatedDetails: DBXTeamLogEventDetailsProtectPolicyDeactivatedDetails? { + return self as? DBXTeamLogEventDetailsProtectPolicyDeactivatedDetails + } + + @objc + public var asProtectPolicyScheduledDetails: DBXTeamLogEventDetailsProtectPolicyScheduledDetails? { + return self as? DBXTeamLogEventDetailsProtectPolicyScheduledDetails + } + + @objc + public var asProtectPolicyUpdatedDetails: DBXTeamLogEventDetailsProtectPolicyUpdatedDetails? { + return self as? DBXTeamLogEventDetailsProtectPolicyUpdatedDetails + } + @objc public var asClassificationCreateReportDetails: DBXTeamLogEventDetailsClassificationCreateReportDetails? { return self as? DBXTeamLogEventDetailsClassificationCreateReportDetails @@ -20756,6 +20788,62 @@ public class DBXTeamLogEventDetailsProtectInternalDomainsChangedDetails: DBXTeam } } +/// An unspecified error. +@objc +public class DBXTeamLogEventDetailsProtectPolicyActivatedDetails: DBXTeamLogEventDetails { + @objc + public var protectPolicyActivatedDetails: DBXTeamLogProtectPolicyActivatedDetails + + @objc + public init(_ arg: DBXTeamLogProtectPolicyActivatedDetails) { + protectPolicyActivatedDetails = arg + let swift = TeamLog.EventDetails.protectPolicyActivatedDetails(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXTeamLogEventDetailsProtectPolicyDeactivatedDetails: DBXTeamLogEventDetails { + @objc + public var protectPolicyDeactivatedDetails: DBXTeamLogProtectPolicyDeactivatedDetails + + @objc + public init(_ arg: DBXTeamLogProtectPolicyDeactivatedDetails) { + protectPolicyDeactivatedDetails = arg + let swift = TeamLog.EventDetails.protectPolicyDeactivatedDetails(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXTeamLogEventDetailsProtectPolicyScheduledDetails: DBXTeamLogEventDetails { + @objc + public var protectPolicyScheduledDetails: DBXTeamLogProtectPolicyScheduledDetails + + @objc + public init(_ arg: DBXTeamLogProtectPolicyScheduledDetails) { + protectPolicyScheduledDetails = arg + let swift = TeamLog.EventDetails.protectPolicyScheduledDetails(arg.swift) + super.init(swift: swift) + } +} + +/// An unspecified error. +@objc +public class DBXTeamLogEventDetailsProtectPolicyUpdatedDetails: DBXTeamLogEventDetails { + @objc + public var protectPolicyUpdatedDetails: DBXTeamLogProtectPolicyUpdatedDetails + + @objc + public init(_ arg: DBXTeamLogProtectPolicyUpdatedDetails) { + protectPolicyUpdatedDetails = arg + let swift = TeamLog.EventDetails.protectPolicyUpdatedDetails(arg.swift) + super.init(swift: swift) + } +} + /// An unspecified error. @objc public class DBXTeamLogEventDetailsClassificationCreateReportDetails: DBXTeamLogEventDetails { @@ -26420,6 +26508,18 @@ public class DBXTeamLogEventType: NSObject { case .protectInternalDomainsChanged(let swiftArg): let arg = DBXTeamLogProtectInternalDomainsChangedType(swift: swiftArg) return DBXTeamLogEventTypeProtectInternalDomainsChanged(arg) + case .protectPolicyActivated(let swiftArg): + let arg = DBXTeamLogProtectPolicyActivatedType(swift: swiftArg) + return DBXTeamLogEventTypeProtectPolicyActivated(arg) + case .protectPolicyDeactivated(let swiftArg): + let arg = DBXTeamLogProtectPolicyDeactivatedType(swift: swiftArg) + return DBXTeamLogEventTypeProtectPolicyDeactivated(arg) + case .protectPolicyScheduled(let swiftArg): + let arg = DBXTeamLogProtectPolicyScheduledType(swift: swiftArg) + return DBXTeamLogEventTypeProtectPolicyScheduled(arg) + case .protectPolicyUpdated(let swiftArg): + let arg = DBXTeamLogProtectPolicyUpdatedType(swift: swiftArg) + return DBXTeamLogEventTypeProtectPolicyUpdated(arg) case .classificationCreateReport(let swiftArg): let arg = DBXTeamLogClassificationCreateReportType(swift: swiftArg) return DBXTeamLogEventTypeClassificationCreateReport(arg) @@ -28876,6 +28976,26 @@ public class DBXTeamLogEventType: NSObject { return self as? DBXTeamLogEventTypeProtectInternalDomainsChanged } + @objc + public var asProtectPolicyActivated: DBXTeamLogEventTypeProtectPolicyActivated? { + return self as? DBXTeamLogEventTypeProtectPolicyActivated + } + + @objc + public var asProtectPolicyDeactivated: DBXTeamLogEventTypeProtectPolicyDeactivated? { + return self as? DBXTeamLogEventTypeProtectPolicyDeactivated + } + + @objc + public var asProtectPolicyScheduled: DBXTeamLogEventTypeProtectPolicyScheduled? { + return self as? DBXTeamLogEventTypeProtectPolicyScheduled + } + + @objc + public var asProtectPolicyUpdated: DBXTeamLogEventTypeProtectPolicyUpdated? { + return self as? DBXTeamLogEventTypeProtectPolicyUpdated + } + @objc public var asClassificationCreateReport: DBXTeamLogEventTypeClassificationCreateReport? { return self as? DBXTeamLogEventTypeClassificationCreateReport @@ -34577,6 +34697,62 @@ public class DBXTeamLogEventTypeProtectInternalDomainsChanged: DBXTeamLogEventTy } } +/// (protect) Activated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeProtectPolicyActivated: DBXTeamLogEventType { + @objc + public var protectPolicyActivated: DBXTeamLogProtectPolicyActivatedType + + @objc + public init(_ arg: DBXTeamLogProtectPolicyActivatedType) { + protectPolicyActivated = arg + let swift = TeamLog.EventType.protectPolicyActivated(arg.swift) + super.init(swift: swift) + } +} + +/// (protect) Deactivated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeProtectPolicyDeactivated: DBXTeamLogEventType { + @objc + public var protectPolicyDeactivated: DBXTeamLogProtectPolicyDeactivatedType + + @objc + public init(_ arg: DBXTeamLogProtectPolicyDeactivatedType) { + protectPolicyDeactivated = arg + let swift = TeamLog.EventType.protectPolicyDeactivated(arg.swift) + super.init(swift: swift) + } +} + +/// (protect) Scheduled a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeProtectPolicyScheduled: DBXTeamLogEventType { + @objc + public var protectPolicyScheduled: DBXTeamLogProtectPolicyScheduledType + + @objc + public init(_ arg: DBXTeamLogProtectPolicyScheduledType) { + protectPolicyScheduled = arg + let swift = TeamLog.EventType.protectPolicyScheduled(arg.swift) + super.init(swift: swift) + } +} + +/// (protect) Updated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeProtectPolicyUpdated: DBXTeamLogEventType { + @objc + public var protectPolicyUpdated: DBXTeamLogProtectPolicyUpdatedType + + @objc + public init(_ arg: DBXTeamLogProtectPolicyUpdatedType) { + protectPolicyUpdated = arg + let swift = TeamLog.EventType.protectPolicyUpdated(arg.swift) + super.init(swift: swift) + } +} + /// (reports) Created Classification report @objc public class DBXTeamLogEventTypeClassificationCreateReport: DBXTeamLogEventType { @@ -39951,6 +40127,14 @@ public class DBXTeamLogEventTypeArg: NSObject { return DBXTeamLogEventTypeArgProtectActionStopSharing() case .protectInternalDomainsChanged: return DBXTeamLogEventTypeArgProtectInternalDomainsChanged() + case .protectPolicyActivated: + return DBXTeamLogEventTypeArgProtectPolicyActivated() + case .protectPolicyDeactivated: + return DBXTeamLogEventTypeArgProtectPolicyDeactivated() + case .protectPolicyScheduled: + return DBXTeamLogEventTypeArgProtectPolicyScheduled() + case .protectPolicyUpdated: + return DBXTeamLogEventTypeArgProtectPolicyUpdated() case .classificationCreateReport: return DBXTeamLogEventTypeArgClassificationCreateReport() case .classificationCreateReportFail: @@ -42066,6 +42250,26 @@ public class DBXTeamLogEventTypeArg: NSObject { return self as? DBXTeamLogEventTypeArgProtectInternalDomainsChanged } + @objc + public var asProtectPolicyActivated: DBXTeamLogEventTypeArgProtectPolicyActivated? { + return self as? DBXTeamLogEventTypeArgProtectPolicyActivated + } + + @objc + public var asProtectPolicyDeactivated: DBXTeamLogEventTypeArgProtectPolicyDeactivated? { + return self as? DBXTeamLogEventTypeArgProtectPolicyDeactivated + } + + @objc + public var asProtectPolicyScheduled: DBXTeamLogEventTypeArgProtectPolicyScheduled? { + return self as? DBXTeamLogEventTypeArgProtectPolicyScheduled + } + + @objc + public var asProtectPolicyUpdated: DBXTeamLogEventTypeArgProtectPolicyUpdated? { + return self as? DBXTeamLogEventTypeArgProtectPolicyUpdated + } + @objc public var asClassificationCreateReport: DBXTeamLogEventTypeArgClassificationCreateReport? { return self as? DBXTeamLogEventTypeArgClassificationCreateReport @@ -46627,6 +46831,46 @@ public class DBXTeamLogEventTypeArgProtectInternalDomainsChanged: DBXTeamLogEven } } +/// (protect) Activated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeArgProtectPolicyActivated: DBXTeamLogEventTypeArg { + @objc + public init() { + let swift = TeamLog.EventTypeArg.protectPolicyActivated + super.init(swift: swift) + } +} + +/// (protect) Deactivated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeArgProtectPolicyDeactivated: DBXTeamLogEventTypeArg { + @objc + public init() { + let swift = TeamLog.EventTypeArg.protectPolicyDeactivated + super.init(swift: swift) + } +} + +/// (protect) Scheduled a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeArgProtectPolicyScheduled: DBXTeamLogEventTypeArg { + @objc + public init() { + let swift = TeamLog.EventTypeArg.protectPolicyScheduled + super.init(swift: swift) + } +} + +/// (protect) Updated a Dropbox Protect policy +@objc +public class DBXTeamLogEventTypeArgProtectPolicyUpdated: DBXTeamLogEventTypeArg { + @objc + public init() { + let swift = TeamLog.EventTypeArg.protectPolicyUpdated + super.init(swift: swift) + } +} + /// (reports) Created Classification report @objc public class DBXTeamLogEventTypeArgClassificationCreateReport: DBXTeamLogEventTypeArg { @@ -66984,6 +67228,190 @@ public class DBXTeamLogProtectInternalDomainsChangedType: NSObject { public override var description: String { swift.description } } +/// Activated a Dropbox Protect policy. +@objc +public class DBXTeamLogProtectPolicyActivatedDetails: NSObject { + /// Policy ID. + @objc + public var policyId: String { swift.policyId } + + @objc + public init(policyId: String) { + self.swift = TeamLog.ProtectPolicyActivatedDetails(policyId: policyId) + } + + let swift: TeamLog.ProtectPolicyActivatedDetails + + public init(swift: TeamLog.ProtectPolicyActivatedDetails) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Objective-C compatible ProtectPolicyActivatedType struct +@objc +public class DBXTeamLogProtectPolicyActivatedType: NSObject { + /// (no description) + @objc + public var description_: String { swift.description_ } + + @objc + public init(description_: String) { + self.swift = TeamLog.ProtectPolicyActivatedType(description_: description_) + } + + let swift: TeamLog.ProtectPolicyActivatedType + + public init(swift: TeamLog.ProtectPolicyActivatedType) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Deactivated a Dropbox Protect policy. +@objc +public class DBXTeamLogProtectPolicyDeactivatedDetails: NSObject { + /// Policy ID. + @objc + public var policyId: String { swift.policyId } + + @objc + public init(policyId: String) { + self.swift = TeamLog.ProtectPolicyDeactivatedDetails(policyId: policyId) + } + + let swift: TeamLog.ProtectPolicyDeactivatedDetails + + public init(swift: TeamLog.ProtectPolicyDeactivatedDetails) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Objective-C compatible ProtectPolicyDeactivatedType struct +@objc +public class DBXTeamLogProtectPolicyDeactivatedType: NSObject { + /// (no description) + @objc + public var description_: String { swift.description_ } + + @objc + public init(description_: String) { + self.swift = TeamLog.ProtectPolicyDeactivatedType(description_: description_) + } + + let swift: TeamLog.ProtectPolicyDeactivatedType + + public init(swift: TeamLog.ProtectPolicyDeactivatedType) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Scheduled a Dropbox Protect policy. +@objc +public class DBXTeamLogProtectPolicyScheduledDetails: NSObject { + /// Policy ID. + @objc + public var policyId: String { swift.policyId } + + @objc + public init(policyId: String) { + self.swift = TeamLog.ProtectPolicyScheduledDetails(policyId: policyId) + } + + let swift: TeamLog.ProtectPolicyScheduledDetails + + public init(swift: TeamLog.ProtectPolicyScheduledDetails) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Objective-C compatible ProtectPolicyScheduledType struct +@objc +public class DBXTeamLogProtectPolicyScheduledType: NSObject { + /// (no description) + @objc + public var description_: String { swift.description_ } + + @objc + public init(description_: String) { + self.swift = TeamLog.ProtectPolicyScheduledType(description_: description_) + } + + let swift: TeamLog.ProtectPolicyScheduledType + + public init(swift: TeamLog.ProtectPolicyScheduledType) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Updated a Dropbox Protect policy. +@objc +public class DBXTeamLogProtectPolicyUpdatedDetails: NSObject { + /// Policy ID. + @objc + public var policyId: String { swift.policyId } + + @objc + public init(policyId: String) { + self.swift = TeamLog.ProtectPolicyUpdatedDetails(policyId: policyId) + } + + let swift: TeamLog.ProtectPolicyUpdatedDetails + + public init(swift: TeamLog.ProtectPolicyUpdatedDetails) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + +/// Objective-C compatible ProtectPolicyUpdatedType struct +@objc +public class DBXTeamLogProtectPolicyUpdatedType: NSObject { + /// (no description) + @objc + public var description_: String { swift.description_ } + + @objc + public init(description_: String) { + self.swift = TeamLog.ProtectPolicyUpdatedType(description_: description_) + } + + let swift: TeamLog.ProtectPolicyUpdatedType + + public init(swift: TeamLog.ProtectPolicyUpdatedType) { + self.swift = swift + } + + + @objc + public override var description: String { swift.description } +} + /// Quick action type. @objc public class DBXTeamLogQuickActionType: NSObject { diff --git a/spec b/spec index f1b5fa6f..16dfea04 160000 --- a/spec +++ b/spec @@ -1 +1 @@ -Subproject commit f1b5fa6f96526401bfee0a90171bd5bd19678062 +Subproject commit 16dfea0418d5c2f61afd971e5b74bda26ca80eff diff --git a/stone b/stone index f32aedf7..947f3cad 160000 --- a/stone +++ b/stone @@ -1 +1 @@ -Subproject commit f32aedf70f3152ae91ae0b6226f0906312ba29ea +Subproject commit 947f3cad339d62faafb86278e92556f9b65c6081