From 6d979e422f7e5949fa385505ab77ef968987095c Mon Sep 17 00:00:00 2001 From: Stephen Cobbe Date: Tue, 10 Oct 2017 19:47:59 -0700 Subject: [PATCH] Spec update: - Move shared_link to end of parameter list for ListFolderArg. - Add mode to ListRevisionsArg. --- .../Shared/Generated/FileProperties.swift | 10 +- .../Generated/FilePropertiesRoutes.swift | 14 +- .../Shared/Generated/Files.swift | 113 ++++++- .../Shared/Generated/FilesRoutes.swift | 26 +- .../Shared/Generated/Sharing.swift | 125 ++++--- .../Shared/Generated/TeamLog.swift | 312 +++++++++++++----- .../Shared/Generated/TeamPolicies.swift | 51 +++ .../Shared/Generated/TeamRoutes.swift | 2 +- spec | 2 +- 9 files changed, 500 insertions(+), 155 deletions(-) diff --git a/Source/SwiftyDropbox/Shared/Generated/FileProperties.swift b/Source/SwiftyDropbox/Shared/Generated/FileProperties.swift index 67edc4c7f..dc7a27ea7 100644 --- a/Source/SwiftyDropbox/Shared/Generated/FileProperties.swift +++ b/Source/SwiftyDropbox/Shared/Generated/FileProperties.swift @@ -106,7 +106,7 @@ open class FileProperties { case other /// An unspecified error. case path(FileProperties.LookupError) - /// This folder cannot be tagged. Shared folders and team folders are not supported for team-owned tags. + /// This folder cannot be tagged. Tagging folders is not supported for team-owned templates. case unsupportedFolder public var description: String { @@ -175,7 +175,7 @@ open class FileProperties { case other /// An unspecified error. case path(FileProperties.LookupError) - /// This folder cannot be tagged. Shared folders and team folders are not supported for team-owned tags. + /// This folder cannot be tagged. Tagging folders is not supported for team-owned templates. case unsupportedFolder /// One or more of the supplied property field values is too large. case propertyFieldTooLarge @@ -260,7 +260,7 @@ open class FileProperties { case other /// An unspecified error. case path(FileProperties.LookupError) - /// This folder cannot be tagged. Shared folders and team folders are not supported for team-owned tags. + /// This folder cannot be tagged. Tagging folders is not supported for team-owned templates. case unsupportedFolder /// One or more of the supplied property field values is too large. case propertyFieldTooLarge @@ -1308,7 +1308,7 @@ open class FileProperties { case other /// An unspecified error. case path(FileProperties.LookupError) - /// This folder cannot be tagged. Shared folders and team folders are not supported for team-owned tags. + /// This folder cannot be tagged. Tagging folders is not supported for team-owned templates. case unsupportedFolder /// An unspecified error. case propertyGroupLookup(FileProperties.LookUpPropertiesError) @@ -1525,7 +1525,7 @@ open class FileProperties { case other /// An unspecified error. case path(FileProperties.LookupError) - /// This folder cannot be tagged. Shared folders and team folders are not supported for team-owned tags. + /// This folder cannot be tagged. Tagging folders is not supported for team-owned templates. case unsupportedFolder /// One or more of the supplied property field values is too large. case propertyFieldTooLarge diff --git a/Source/SwiftyDropbox/Shared/Generated/FilePropertiesRoutes.swift b/Source/SwiftyDropbox/Shared/Generated/FilePropertiesRoutes.swift index 6f70fe54b..e7719af95 100644 --- a/Source/SwiftyDropbox/Shared/Generated/FilePropertiesRoutes.swift +++ b/Source/SwiftyDropbox/Shared/Generated/FilePropertiesRoutes.swift @@ -40,7 +40,7 @@ open class FilePropertiesRoutes { return client.request(route, serverArgs: serverArgs) } - /// Remove the specified property group from the file. To remove specific property field key value pairs, see route + /// Remove the specified property group from the file. To remove specific property field key value pairs, see /// propertiesUpdate. To update a template, see templatesUpdateForUser or templatesUpdateForTeam. Templates can't be /// removed once created. /// @@ -85,7 +85,7 @@ open class FilePropertiesRoutes { return client.request(route, serverArgs: serverArgs) } - /// Add a template associated with a team. See route propertiesAdd to add properties to a file or folder. + /// Add a template associated with a team. See propertiesAdd to add properties to a file or folder. /// /// /// - returns: Through the response callback, the caller will receive a `FileProperties.AddTemplateResult` object @@ -96,7 +96,8 @@ open class FilePropertiesRoutes { return client.request(route, serverArgs: serverArgs) } - /// Add a template associated with a user. See route propertiesAdd to add properties to a file. + /// Add a template associated with a user. See propertiesAdd to add properties to a file. This endpoint can't be + /// called on a team member or admin's behalf. /// /// /// - returns: Through the response callback, the caller will receive a `FileProperties.AddTemplateResult` object @@ -120,7 +121,7 @@ open class FilePropertiesRoutes { return client.request(route, serverArgs: serverArgs) } - /// Get the schema for a specified template. + /// Get the schema for a specified template. This endpoint can't be called on a team member or admin's behalf. /// /// - parameter templateId: An identifier for template added by route See templatesAddForUser or /// templatesAddForTeam. @@ -143,7 +144,8 @@ open class FilePropertiesRoutes { return client.request(route) } - /// Get the template identifiers for a team. To get the schema of each template use templatesGetForUser. + /// Get the template identifiers for a team. To get the schema of each template use templatesGetForUser. This + /// endpoint can't be called on a team member or admin's behalf. /// /// /// - returns: Through the response callback, the caller will receive a `FileProperties.ListTemplateResult` object @@ -171,7 +173,7 @@ open class FilePropertiesRoutes { } /// Update a template associated with a user. This route can update the template name, the template description and - /// add optional properties to templates. + /// add optional properties to templates. This endpoint can't be called on a team member or admin's behalf. /// /// - parameter templateId: An identifier for template added by See templatesAddForUser or templatesAddForTeam. /// - parameter name: A display name for the template. template names can be up to 256 bytes. diff --git a/Source/SwiftyDropbox/Shared/Generated/Files.swift b/Source/SwiftyDropbox/Shared/Generated/Files.swift index 36f7d9089..da9051940 100644 --- a/Source/SwiftyDropbox/Shared/Generated/Files.swift +++ b/Source/SwiftyDropbox/Shared/Generated/Files.swift @@ -1805,7 +1805,11 @@ open class Files { /// The maximum number of results to return per request. Note: This is an approximate number and there can be /// slightly more entries returned in some cases. open let limit: UInt32? - public init(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil) { + /// A shared link to list the contents of. If the link is password-protected, the password must be provided. If + /// this field is present, path in ListFolderArg will be relative to root of the shared link. Only non-recursive + /// mode is supported for shared link. + open let sharedLink: Files.SharedLink? + public init(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil, sharedLink: Files.SharedLink? = nil) { stringValidator(pattern: "(/(.|[\\r\\n])*)?|id:.*|(ns:[0-9]+(/.*)?)")(path) self.path = path self.recursive = recursive @@ -1815,6 +1819,7 @@ open class Files { self.includeMountedFolders = includeMountedFolders nullableValidator(comparableValidator(minValue: 1, maxValue: 2000))(limit) self.limit = limit + self.sharedLink = sharedLink } open var description: String { return "\(SerializeUtil.prepareJSONForSerialization(ListFolderArgSerializer().serialize(self)))" @@ -1831,6 +1836,7 @@ open class Files { "include_has_explicit_shared_members": Serialization._BoolSerializer.serialize(value.includeHasExplicitSharedMembers), "include_mounted_folders": Serialization._BoolSerializer.serialize(value.includeMountedFolders), "limit": NullableSerializer(Serialization._UInt32Serializer).serialize(value.limit), + "shared_link": NullableSerializer(Files.SharedLinkSerializer()).serialize(value.sharedLink), ] return .dictionary(output) } @@ -1844,7 +1850,8 @@ open class Files { let includeHasExplicitSharedMembers = Serialization._BoolSerializer.deserialize(dict["include_has_explicit_shared_members"] ?? .number(0)) let includeMountedFolders = Serialization._BoolSerializer.deserialize(dict["include_mounted_folders"] ?? .number(1)) let limit = NullableSerializer(Serialization._UInt32Serializer).deserialize(dict["limit"] ?? .null) - return ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit) + let sharedLink = NullableSerializer(Files.SharedLinkSerializer()).deserialize(dict["shared_link"] ?? .null) + return ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit, sharedLink: sharedLink) default: fatalError("Type error deserializing") } @@ -2173,11 +2180,14 @@ open class Files { open class ListRevisionsArg: CustomStringConvertible { /// The path to the file you want to see the revisions of. open let path: String + /// Determines the behavior of the API in listing the revisions for a given file path or id. + open let mode: Files.ListRevisionsMode /// The maximum number of revision entries returned. open let limit: UInt64 - public init(path: String, limit: UInt64 = 10) { + public init(path: String, mode: Files.ListRevisionsMode = .path, limit: UInt64 = 10) { stringValidator(pattern: "/(.|[\\r\\n])*|id:.*|(ns:[0-9]+(/.*)?)")(path) self.path = path + self.mode = mode comparableValidator(minValue: 1, maxValue: 100)(limit) self.limit = limit } @@ -2190,6 +2200,7 @@ open class Files { open func serialize(_ value: ListRevisionsArg) -> JSON { let output = [ "path": Serialization._StringSerializer.serialize(value.path), + "mode": Files.ListRevisionsModeSerializer().serialize(value.mode), "limit": Serialization._UInt64Serializer.serialize(value.limit), ] return .dictionary(output) @@ -2198,8 +2209,9 @@ open class Files { switch json { case .dictionary(let dict): let path = Serialization._StringSerializer.deserialize(dict["path"] ?? .null) + let mode = Files.ListRevisionsModeSerializer().deserialize(dict["mode"] ?? Files.ListRevisionsModeSerializer().serialize(.path)) let limit = Serialization._UInt64Serializer.deserialize(dict["limit"] ?? .number(10)) - return ListRevisionsArg(path: path, limit: limit) + return ListRevisionsArg(path: path, mode: mode, limit: limit) default: fatalError("Type error deserializing") } @@ -2250,9 +2262,61 @@ open class Files { } } + /// The ListRevisionsMode union + public enum ListRevisionsMode: CustomStringConvertible { + /// Returns revisions with the same file path as identified by the latest file entry at the given file path or + /// id. + case path + /// Returns revisions with the same file id as identified by the latest file entry at the given file path or id. + case id + /// An unspecified error. + case other + + public var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(ListRevisionsModeSerializer().serialize(self)))" + } + } + open class ListRevisionsModeSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: ListRevisionsMode) -> JSON { + switch value { + case .path: + var d = [String: JSON]() + d[".tag"] = .str("path") + return .dictionary(d) + case .id: + var d = [String: JSON]() + d[".tag"] = .str("id") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + open func deserialize(_ json: JSON) -> ListRevisionsMode { + switch json { + case .dictionary(let d): + let tag = Serialization.getTag(d) + switch tag { + case "path": + return ListRevisionsMode.path + case "id": + return ListRevisionsMode.id + case "other": + return ListRevisionsMode.other + default: + return ListRevisionsMode.other + } + default: + fatalError("Failed to deserialize") + } + } + } + /// The ListRevisionsResult struct open class ListRevisionsResult: CustomStringConvertible { - /// If the file is deleted. + /// If the file identified by the latest revision in the response is either deleted or moved. open let isDeleted: Bool /// The time of deletion if the file was deleted. open let serverDeleted: Date? @@ -3883,6 +3947,43 @@ open class Files { } } + /// The SharedLink struct + open class SharedLink: CustomStringConvertible { + /// Shared link url. + open let url: String + /// Password for the shared link. + open let password: String? + public init(url: String, password: String? = nil) { + stringValidator()(url) + self.url = url + nullableValidator(stringValidator())(password) + self.password = password + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(SharedLinkSerializer().serialize(self)))" + } + } + open class SharedLinkSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: SharedLink) -> JSON { + let output = [ + "url": Serialization._StringSerializer.serialize(value.url), + "password": NullableSerializer(Serialization._StringSerializer).serialize(value.password), + ] + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> SharedLink { + switch json { + case .dictionary(let dict): + let url = Serialization._StringSerializer.deserialize(dict["url"] ?? .null) + let password = NullableSerializer(Serialization._StringSerializer).deserialize(dict["password"] ?? .null) + return SharedLink(url: url, password: password) + default: + fatalError("Type error deserializing") + } + } + } + /// The ThumbnailArg struct open class ThumbnailArg: CustomStringConvertible { /// The path to the image file you want to thumbnail. @@ -4883,7 +4984,7 @@ open class Files { case insufficientSpace /// Dropbox will not save the file or folder because of its name. case disallowedName - /// This endpoint cannot modify or delete team folders. + /// This endpoint cannot move or delete team folders. case teamFolder /// An unspecified error. case other diff --git a/Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift b/Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift index b235b9aa1..f5bcc03ce 100644 --- a/Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift +++ b/Source/SwiftyDropbox/Shared/Generated/FilesRoutes.swift @@ -428,12 +428,15 @@ open class FilesRoutes { /// includes app folder, shared folder and team folder. /// - parameter limit: The maximum number of results to return per request. Note: This is an approximate number and /// there can be slightly more entries returned in some cases. + /// - parameter sharedLink: A shared link to list the contents of. If the link is password-protected, the password + /// must be provided. If this field is present, path in ListFolderArg will be relative to root of the shared link. + /// Only non-recursive mode is supported for shared link. /// /// - returns: Through the response callback, the caller will receive a `Files.ListFolderResult` object on success /// or a `Files.ListFolderError` object on failure. - @discardableResult open func listFolder(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil) -> RpcRequest { + @discardableResult open func listFolder(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil, sharedLink: Files.SharedLink? = nil) -> RpcRequest { let route = Files.listFolder - let serverArgs = Files.ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit) + let serverArgs = Files.ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit, sharedLink: sharedLink) return client.request(route, serverArgs: serverArgs) } @@ -466,12 +469,15 @@ open class FilesRoutes { /// includes app folder, shared folder and team folder. /// - parameter limit: The maximum number of results to return per request. Note: This is an approximate number and /// there can be slightly more entries returned in some cases. + /// - parameter sharedLink: A shared link to list the contents of. If the link is password-protected, the password + /// must be provided. If this field is present, path in ListFolderArg will be relative to root of the shared link. + /// Only non-recursive mode is supported for shared link. /// /// - returns: Through the response callback, the caller will receive a `Files.ListFolderGetLatestCursorResult` /// object on success or a `Files.ListFolderError` object on failure. - @discardableResult open func listFolderGetLatestCursor(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil) -> RpcRequest { + @discardableResult open func listFolderGetLatestCursor(path: String, recursive: Bool = false, includeMediaInfo: Bool = false, includeDeleted: Bool = false, includeHasExplicitSharedMembers: Bool = false, includeMountedFolders: Bool = true, limit: UInt32? = nil, sharedLink: Files.SharedLink? = nil) -> RpcRequest { let route = Files.listFolderGetLatestCursor - let serverArgs = Files.ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit) + let serverArgs = Files.ListFolderArg(path: path, recursive: recursive, includeMediaInfo: includeMediaInfo, includeDeleted: includeDeleted, includeHasExplicitSharedMembers: includeHasExplicitSharedMembers, includeMountedFolders: includeMountedFolders, limit: limit, sharedLink: sharedLink) return client.request(route, serverArgs: serverArgs) } @@ -495,16 +501,22 @@ open class FilesRoutes { return client.request(route, serverArgs: serverArgs) } - /// Return revisions of a file. + /// Returns revisions for files based on a file path or a file id. The file path or file id is identified from the + /// latest file entry at the given file path or id. This end point allows your app to query either by file path or + /// file id by setting the mode parameter appropriately. In the path in ListRevisionsMode (default) mode, all + /// revisions at the same file path as the latest file entry are returned. If revisions with the same file id are + /// desired, then mode must be set to id in ListRevisionsMode. The id in ListRevisionsMode mode is useful to + /// retrieve revisions for a given file across moves or renames. /// /// - parameter path: The path to the file you want to see the revisions of. + /// - parameter mode: Determines the behavior of the API in listing the revisions for a given file path or id. /// - parameter limit: The maximum number of revision entries returned. /// /// - returns: Through the response callback, the caller will receive a `Files.ListRevisionsResult` object on /// success or a `Files.ListRevisionsError` object on failure. - @discardableResult open func listRevisions(path: String, limit: UInt64 = 10) -> RpcRequest { + @discardableResult open func listRevisions(path: String, mode: Files.ListRevisionsMode = .path, limit: UInt64 = 10) -> RpcRequest { let route = Files.listRevisions - let serverArgs = Files.ListRevisionsArg(path: path, limit: limit) + let serverArgs = Files.ListRevisionsArg(path: path, mode: mode, limit: limit) return client.request(route, serverArgs: serverArgs) } diff --git a/Source/SwiftyDropbox/Shared/Generated/Sharing.swift b/Source/SwiftyDropbox/Shared/Generated/Sharing.swift index 84742b94b..42298fe14 100644 --- a/Source/SwiftyDropbox/Shared/Generated/Sharing.swift +++ b/Source/SwiftyDropbox/Shared/Generated/Sharing.swift @@ -6289,7 +6289,7 @@ open class Sharing { /// listFileMembersContinue, and used as part of the results for listFileMembersBatch. open class SharedFileMembers: CustomStringConvertible { /// The list of user members of the shared file. - open let users: Array + open let users: Array /// The list of group members of the shared file. open let groups: Array /// The list of invited members of a file, but have not logged in and claimed this. @@ -6297,7 +6297,7 @@ open class Sharing { /// Present if there are additional shared file members that have not been returned yet. Pass the cursor into /// listFileMembersContinue to list additional members. open let cursor: String? - public init(users: Array, groups: Array, invitees: Array, cursor: String? = nil) { + public init(users: Array, groups: Array, invitees: Array, cursor: String? = nil) { self.users = users self.groups = groups self.invitees = invitees @@ -6312,7 +6312,7 @@ open class Sharing { public init() { } open func serialize(_ value: SharedFileMembers) -> JSON { let output = [ - "users": ArraySerializer(Sharing.UserMembershipInfoSerializer()).serialize(value.users), + "users": ArraySerializer(Sharing.UserFileMembershipInfoSerializer()).serialize(value.users), "groups": ArraySerializer(Sharing.GroupMembershipInfoSerializer()).serialize(value.groups), "invitees": ArraySerializer(Sharing.InviteeMembershipInfoSerializer()).serialize(value.invitees), "cursor": NullableSerializer(Serialization._StringSerializer).serialize(value.cursor), @@ -6322,7 +6322,7 @@ open class Sharing { open func deserialize(_ json: JSON) -> SharedFileMembers { switch json { case .dictionary(let dict): - let users = ArraySerializer(Sharing.UserMembershipInfoSerializer()).deserialize(dict["users"] ?? .null) + let users = ArraySerializer(Sharing.UserFileMembershipInfoSerializer()).deserialize(dict["users"] ?? .null) let groups = ArraySerializer(Sharing.GroupMembershipInfoSerializer()).deserialize(dict["groups"] ?? .null) let invitees = ArraySerializer(Sharing.InviteeMembershipInfoSerializer()).deserialize(dict["invitees"] ?? .null) let cursor = NullableSerializer(Serialization._StringSerializer).deserialize(dict["cursor"] ?? .null) @@ -7855,73 +7855,71 @@ open class Sharing { } } - /// Basic information about a user. Use usersAccount and usersAccountBatch to obtain more detailed information. - open class UserInfo: CustomStringConvertible { - /// The account ID of the user. - open let accountId: String - /// If the user is in the same team as current user. - open let sameTeam: Bool - /// The team member ID of the shared folder member. Only present if sameTeam is true. - open let teamMemberId: String? - public init(accountId: String, sameTeam: Bool, teamMemberId: String? = nil) { - stringValidator(minLength: 40, maxLength: 40)(accountId) - self.accountId = accountId - self.sameTeam = sameTeam - nullableValidator(stringValidator())(teamMemberId) - self.teamMemberId = teamMemberId + /// The information about a user member of the shared content. + open class UserMembershipInfo: Sharing.MembershipInfo { + /// The account information for the membership user. + open let user: Sharing.UserInfo + public init(accessType: Sharing.AccessLevel, user: Sharing.UserInfo, permissions: Array? = nil, initials: String? = nil, isInherited: Bool = false) { + self.user = user + super.init(accessType: accessType, permissions: permissions, initials: initials, isInherited: isInherited) } - open var description: String { - return "\(SerializeUtil.prepareJSONForSerialization(UserInfoSerializer().serialize(self)))" + open override var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(UserMembershipInfoSerializer().serialize(self)))" } } - open class UserInfoSerializer: JSONSerializer { + open class UserMembershipInfoSerializer: JSONSerializer { public init() { } - open func serialize(_ value: UserInfo) -> JSON { + open func serialize(_ value: UserMembershipInfo) -> JSON { let output = [ - "account_id": Serialization._StringSerializer.serialize(value.accountId), - "same_team": Serialization._BoolSerializer.serialize(value.sameTeam), - "team_member_id": NullableSerializer(Serialization._StringSerializer).serialize(value.teamMemberId), + "access_type": Sharing.AccessLevelSerializer().serialize(value.accessType), + "user": Sharing.UserInfoSerializer().serialize(value.user), + "permissions": NullableSerializer(ArraySerializer(Sharing.MemberPermissionSerializer())).serialize(value.permissions), + "initials": NullableSerializer(Serialization._StringSerializer).serialize(value.initials), + "is_inherited": Serialization._BoolSerializer.serialize(value.isInherited), ] return .dictionary(output) } - open func deserialize(_ json: JSON) -> UserInfo { + open func deserialize(_ json: JSON) -> UserMembershipInfo { switch json { case .dictionary(let dict): - let accountId = Serialization._StringSerializer.deserialize(dict["account_id"] ?? .null) - let sameTeam = Serialization._BoolSerializer.deserialize(dict["same_team"] ?? .null) - let teamMemberId = NullableSerializer(Serialization._StringSerializer).deserialize(dict["team_member_id"] ?? .null) - return UserInfo(accountId: accountId, sameTeam: sameTeam, teamMemberId: teamMemberId) + let accessType = Sharing.AccessLevelSerializer().deserialize(dict["access_type"] ?? .null) + let user = Sharing.UserInfoSerializer().deserialize(dict["user"] ?? .null) + let permissions = NullableSerializer(ArraySerializer(Sharing.MemberPermissionSerializer())).deserialize(dict["permissions"] ?? .null) + let initials = NullableSerializer(Serialization._StringSerializer).deserialize(dict["initials"] ?? .null) + let isInherited = Serialization._BoolSerializer.deserialize(dict["is_inherited"] ?? .number(0)) + return UserMembershipInfo(accessType: accessType, user: user, permissions: permissions, initials: initials, isInherited: isInherited) default: fatalError("Type error deserializing") } } } - /// The information about a user member of the shared content. - open class UserMembershipInfo: Sharing.MembershipInfo { - /// The account information for the membership user. - open let user: Sharing.UserInfo - public init(accessType: Sharing.AccessLevel, user: Sharing.UserInfo, permissions: Array? = nil, initials: String? = nil, isInherited: Bool = false) { - self.user = user - super.init(accessType: accessType, permissions: permissions, initials: initials, isInherited: isInherited) + /// The information about a user member of the shared content with an appended last seen timestamp. + open class UserFileMembershipInfo: Sharing.UserMembershipInfo { + /// The UTC timestamp of when the user has last seen the content, if they have. + open let timeLastSeen: Date? + public init(accessType: Sharing.AccessLevel, user: Sharing.UserInfo, permissions: Array? = nil, initials: String? = nil, isInherited: Bool = false, timeLastSeen: Date? = nil) { + self.timeLastSeen = timeLastSeen + super.init(accessType: accessType, user: user, permissions: permissions, initials: initials, isInherited: isInherited) } open override var description: String { - return "\(SerializeUtil.prepareJSONForSerialization(UserMembershipInfoSerializer().serialize(self)))" + return "\(SerializeUtil.prepareJSONForSerialization(UserFileMembershipInfoSerializer().serialize(self)))" } } - open class UserMembershipInfoSerializer: JSONSerializer { + open class UserFileMembershipInfoSerializer: JSONSerializer { public init() { } - open func serialize(_ value: UserMembershipInfo) -> JSON { + open func serialize(_ value: UserFileMembershipInfo) -> JSON { let output = [ "access_type": Sharing.AccessLevelSerializer().serialize(value.accessType), "user": Sharing.UserInfoSerializer().serialize(value.user), "permissions": NullableSerializer(ArraySerializer(Sharing.MemberPermissionSerializer())).serialize(value.permissions), "initials": NullableSerializer(Serialization._StringSerializer).serialize(value.initials), "is_inherited": Serialization._BoolSerializer.serialize(value.isInherited), + "time_last_seen": NullableSerializer(NSDateSerializer("%Y-%m-%dT%H:%M:%SZ")).serialize(value.timeLastSeen), ] return .dictionary(output) } - open func deserialize(_ json: JSON) -> UserMembershipInfo { + open func deserialize(_ json: JSON) -> UserFileMembershipInfo { switch json { case .dictionary(let dict): let accessType = Sharing.AccessLevelSerializer().deserialize(dict["access_type"] ?? .null) @@ -7929,7 +7927,50 @@ open class Sharing { let permissions = NullableSerializer(ArraySerializer(Sharing.MemberPermissionSerializer())).deserialize(dict["permissions"] ?? .null) let initials = NullableSerializer(Serialization._StringSerializer).deserialize(dict["initials"] ?? .null) let isInherited = Serialization._BoolSerializer.deserialize(dict["is_inherited"] ?? .number(0)) - return UserMembershipInfo(accessType: accessType, user: user, permissions: permissions, initials: initials, isInherited: isInherited) + let timeLastSeen = NullableSerializer(NSDateSerializer("%Y-%m-%dT%H:%M:%SZ")).deserialize(dict["time_last_seen"] ?? .null) + return UserFileMembershipInfo(accessType: accessType, user: user, permissions: permissions, initials: initials, isInherited: isInherited, timeLastSeen: timeLastSeen) + default: + fatalError("Type error deserializing") + } + } + } + + /// Basic information about a user. Use usersAccount and usersAccountBatch to obtain more detailed information. + open class UserInfo: CustomStringConvertible { + /// The account ID of the user. + open let accountId: String + /// If the user is in the same team as current user. + open let sameTeam: Bool + /// The team member ID of the shared folder member. Only present if sameTeam is true. + open let teamMemberId: String? + public init(accountId: String, sameTeam: Bool, teamMemberId: String? = nil) { + stringValidator(minLength: 40, maxLength: 40)(accountId) + self.accountId = accountId + self.sameTeam = sameTeam + nullableValidator(stringValidator())(teamMemberId) + self.teamMemberId = teamMemberId + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(UserInfoSerializer().serialize(self)))" + } + } + open class UserInfoSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: UserInfo) -> JSON { + let output = [ + "account_id": Serialization._StringSerializer.serialize(value.accountId), + "same_team": Serialization._BoolSerializer.serialize(value.sameTeam), + "team_member_id": NullableSerializer(Serialization._StringSerializer).serialize(value.teamMemberId), + ] + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> UserInfo { + switch json { + case .dictionary(let dict): + let accountId = Serialization._StringSerializer.deserialize(dict["account_id"] ?? .null) + let sameTeam = Serialization._BoolSerializer.deserialize(dict["same_team"] ?? .null) + let teamMemberId = NullableSerializer(Serialization._StringSerializer).deserialize(dict["team_member_id"] ?? .null) + return UserInfo(accountId: accountId, sameTeam: sameTeam, teamMemberId: teamMemberId) default: fatalError("Type error deserializing") } diff --git a/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift b/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift index 508951560..b7021279a 100644 --- a/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift +++ b/Source/SwiftyDropbox/Shared/Generated/TeamLog.swift @@ -2201,13 +2201,9 @@ open class TeamLog { open class DomainVerificationRemoveDomainDetails: CustomStringConvertible { /// Domain names. open let domainNames: Array - /// Domain name verification method. Might be missing due to historical data gap. - open let verificationMethod: String? - public init(domainNames: Array, verificationMethod: String? = nil) { + public init(domainNames: Array) { arrayValidator(itemValidator: stringValidator())(domainNames) self.domainNames = domainNames - nullableValidator(stringValidator())(verificationMethod) - self.verificationMethod = verificationMethod } open var description: String { return "\(SerializeUtil.prepareJSONForSerialization(DomainVerificationRemoveDomainDetailsSerializer().serialize(self)))" @@ -2218,7 +2214,6 @@ open class TeamLog { open func serialize(_ value: DomainVerificationRemoveDomainDetails) -> JSON { let output = [ "domain_names": ArraySerializer(Serialization._StringSerializer).serialize(value.domainNames), - "verification_method": NullableSerializer(Serialization._StringSerializer).serialize(value.verificationMethod), ] return .dictionary(output) } @@ -2226,8 +2221,7 @@ open class TeamLog { switch json { case .dictionary(let dict): let domainNames = ArraySerializer(Serialization._StringSerializer).deserialize(dict["domain_names"] ?? .null) - let verificationMethod = NullableSerializer(Serialization._StringSerializer).deserialize(dict["verification_method"] ?? .null) - return DomainVerificationRemoveDomainDetails(domainNames: domainNames, verificationMethod: verificationMethod) + return DomainVerificationRemoveDomainDetails(domainNames: domainNames) default: fatalError("Type error deserializing") } @@ -3166,6 +3160,8 @@ open class TeamLog { case shmodelVisibilityPublicDetails(TeamLog.ShmodelVisibilityPublicDetails) /// Made a file/folder visible only to team members with the link. case shmodelVisibilityTeamOnlyDetails(TeamLog.ShmodelVisibilityTeamOnlyDetails) + /// Added the X.509 certificate for SSO. + case ssoAddCertDetails(TeamLog.SsoAddCertDetails) /// Added sign-in URL for SSO. case ssoAddLoginUrlDetails(TeamLog.SsoAddLoginUrlDetails) /// Added sign-out URL for SSO. @@ -3178,6 +3174,8 @@ open class TeamLog { case ssoChangeLogoutUrlDetails(TeamLog.SsoChangeLogoutUrlDetails) /// Changed the SAML identity mode for SSO. case ssoChangeSamlIdentityModeDetails(TeamLog.SsoChangeSamlIdentityModeDetails) + /// Removed the X.509 certificate for SSO. + case ssoRemoveCertDetails(TeamLog.SsoRemoveCertDetails) /// Removed the sign-in URL for SSO. case ssoRemoveLoginUrlDetails(TeamLog.SsoRemoveLoginUrlDetails) /// Removed single sign-on logout URL. @@ -3252,6 +3250,8 @@ open class TeamLog { case networkControlChangePolicyDetails(TeamLog.NetworkControlChangePolicyDetails) /// Changed whether Dropbox Paper, when enabled, is deployed to all teams or to specific members of the team. case paperChangeDeploymentPolicyDetails(TeamLog.PaperChangeDeploymentPolicyDetails) + /// Changed whether non team members can view Paper documents using a link. + case paperChangeMemberLinkPolicyDetails(TeamLog.PaperChangeMemberLinkPolicyDetails) /// Changed whether team members can share Paper documents externally (i.e. outside the team), and if so, /// whether they should be accessible only by team members or anyone by default. case paperChangeMemberPolicyDetails(TeamLog.PaperChangeMemberPolicyDetails) @@ -3285,6 +3285,8 @@ open class TeamLog { case webSessionsChangeIdleLengthPolicyDetails(TeamLog.WebSessionsChangeIdleLengthPolicyDetails) /// Added a team logo to be displayed on shared link headers. case teamProfileAddLogoDetails(TeamLog.TeamProfileAddLogoDetails) + /// Changed the default language for the team. + case teamProfileChangeDefaultLanguageDetails(TeamLog.TeamProfileChangeDefaultLanguageDetails) /// Changed the team logo to be displayed on shared link headers. case teamProfileChangeLogoDetails(TeamLog.TeamProfileChangeLogoDetails) /// Changed the team name. @@ -4122,6 +4124,10 @@ open class TeamLog { var d = Serialization.getFields(TeamLog.ShmodelVisibilityTeamOnlyDetailsSerializer().serialize(arg)) d[".tag"] = .str("shmodel_visibility_team_only_details") return .dictionary(d) + case .ssoAddCertDetails(let arg): + var d = Serialization.getFields(TeamLog.SsoAddCertDetailsSerializer().serialize(arg)) + d[".tag"] = .str("sso_add_cert_details") + return .dictionary(d) case .ssoAddLoginUrlDetails(let arg): var d = Serialization.getFields(TeamLog.SsoAddLoginUrlDetailsSerializer().serialize(arg)) d[".tag"] = .str("sso_add_login_url_details") @@ -4146,6 +4152,10 @@ open class TeamLog { var d = Serialization.getFields(TeamLog.SsoChangeSamlIdentityModeDetailsSerializer().serialize(arg)) d[".tag"] = .str("sso_change_saml_identity_mode_details") return .dictionary(d) + case .ssoRemoveCertDetails(let arg): + var d = Serialization.getFields(TeamLog.SsoRemoveCertDetailsSerializer().serialize(arg)) + d[".tag"] = .str("sso_remove_cert_details") + return .dictionary(d) case .ssoRemoveLoginUrlDetails(let arg): var d = Serialization.getFields(TeamLog.SsoRemoveLoginUrlDetailsSerializer().serialize(arg)) d[".tag"] = .str("sso_remove_login_url_details") @@ -4282,6 +4292,10 @@ open class TeamLog { var d = Serialization.getFields(TeamLog.PaperChangeDeploymentPolicyDetailsSerializer().serialize(arg)) d[".tag"] = .str("paper_change_deployment_policy_details") return .dictionary(d) + case .paperChangeMemberLinkPolicyDetails(let arg): + var d = Serialization.getFields(TeamLog.PaperChangeMemberLinkPolicyDetailsSerializer().serialize(arg)) + d[".tag"] = .str("paper_change_member_link_policy_details") + return .dictionary(d) case .paperChangeMemberPolicyDetails(let arg): var d = Serialization.getFields(TeamLog.PaperChangeMemberPolicyDetailsSerializer().serialize(arg)) d[".tag"] = .str("paper_change_member_policy_details") @@ -4342,6 +4356,10 @@ open class TeamLog { var d = Serialization.getFields(TeamLog.TeamProfileAddLogoDetailsSerializer().serialize(arg)) d[".tag"] = .str("team_profile_add_logo_details") return .dictionary(d) + case .teamProfileChangeDefaultLanguageDetails(let arg): + var d = Serialization.getFields(TeamLog.TeamProfileChangeDefaultLanguageDetailsSerializer().serialize(arg)) + d[".tag"] = .str("team_profile_change_default_language_details") + return .dictionary(d) case .teamProfileChangeLogoDetails(let arg): var d = Serialization.getFields(TeamLog.TeamProfileChangeLogoDetailsSerializer().serialize(arg)) d[".tag"] = .str("team_profile_change_logo_details") @@ -5000,6 +5018,9 @@ open class TeamLog { case "shmodel_visibility_team_only_details": let v = TeamLog.ShmodelVisibilityTeamOnlyDetailsSerializer().deserialize(json) return EventDetails.shmodelVisibilityTeamOnlyDetails(v) + case "sso_add_cert_details": + let v = TeamLog.SsoAddCertDetailsSerializer().deserialize(json) + return EventDetails.ssoAddCertDetails(v) case "sso_add_login_url_details": let v = TeamLog.SsoAddLoginUrlDetailsSerializer().deserialize(json) return EventDetails.ssoAddLoginUrlDetails(v) @@ -5018,6 +5039,9 @@ open class TeamLog { case "sso_change_saml_identity_mode_details": let v = TeamLog.SsoChangeSamlIdentityModeDetailsSerializer().deserialize(json) return EventDetails.ssoChangeSamlIdentityModeDetails(v) + case "sso_remove_cert_details": + let v = TeamLog.SsoRemoveCertDetailsSerializer().deserialize(json) + return EventDetails.ssoRemoveCertDetails(v) case "sso_remove_login_url_details": let v = TeamLog.SsoRemoveLoginUrlDetailsSerializer().deserialize(json) return EventDetails.ssoRemoveLoginUrlDetails(v) @@ -5120,6 +5144,9 @@ open class TeamLog { case "paper_change_deployment_policy_details": let v = TeamLog.PaperChangeDeploymentPolicyDetailsSerializer().deserialize(json) return EventDetails.paperChangeDeploymentPolicyDetails(v) + case "paper_change_member_link_policy_details": + let v = TeamLog.PaperChangeMemberLinkPolicyDetailsSerializer().deserialize(json) + return EventDetails.paperChangeMemberLinkPolicyDetails(v) case "paper_change_member_policy_details": let v = TeamLog.PaperChangeMemberPolicyDetailsSerializer().deserialize(json) return EventDetails.paperChangeMemberPolicyDetails(v) @@ -5165,6 +5192,9 @@ open class TeamLog { case "team_profile_add_logo_details": let v = TeamLog.TeamProfileAddLogoDetailsSerializer().deserialize(json) return EventDetails.teamProfileAddLogoDetails(v) + case "team_profile_change_default_language_details": + let v = TeamLog.TeamProfileChangeDefaultLanguageDetailsSerializer().deserialize(json) + return EventDetails.teamProfileChangeDefaultLanguageDetails(v) case "team_profile_change_logo_details": let v = TeamLog.TeamProfileChangeLogoDetailsSerializer().deserialize(json) return EventDetails.teamProfileChangeLogoDetails(v) @@ -5651,6 +5681,8 @@ open class TeamLog { case shmodelVisibilityPublic /// Made a file/folder visible only to team members with the link. case shmodelVisibilityTeamOnly + /// Added the X.509 certificate for SSO. + case ssoAddCert /// Added sign-in URL for SSO. case ssoAddLoginUrl /// Added sign-out URL for SSO. @@ -5663,6 +5695,8 @@ open class TeamLog { case ssoChangeLogoutUrl /// Changed the SAML identity mode for SSO. case ssoChangeSamlIdentityMode + /// Removed the X.509 certificate for SSO. + case ssoRemoveCert /// Removed the sign-in URL for SSO. case ssoRemoveLoginUrl /// Removed single sign-on logout URL. @@ -5741,6 +5775,9 @@ open class TeamLog { case networkControlChangePolicy /// Changed whether Dropbox Paper, when enabled, is deployed to all teams or to specific members of the team. case paperChangeDeploymentPolicy + /// Changed whether non team members can view Paper documents using a link. This event is deprecated and will + /// not be logged going forward as the associated product functionality no longer exists. + case paperChangeMemberLinkPolicy /// Changed whether team members can share Paper documents externally (i.e. outside the team), and if so, /// whether they should be accessible only by team members or anyone by default. case paperChangeMemberPolicy @@ -5774,6 +5811,8 @@ open class TeamLog { case webSessionsChangeIdleLengthPolicy /// Added a team logo to be displayed on shared link headers. case teamProfileAddLogo + /// Changed the default language for the team. + case teamProfileChangeDefaultLanguage /// Changed the team logo to be displayed on shared link headers. case teamProfileChangeLogo /// Changed the team name. @@ -6609,6 +6648,10 @@ open class TeamLog { var d = [String: JSON]() d[".tag"] = .str("shmodel_visibility_team_only") return .dictionary(d) + case .ssoAddCert: + var d = [String: JSON]() + d[".tag"] = .str("sso_add_cert") + return .dictionary(d) case .ssoAddLoginUrl: var d = [String: JSON]() d[".tag"] = .str("sso_add_login_url") @@ -6633,6 +6676,10 @@ open class TeamLog { var d = [String: JSON]() d[".tag"] = .str("sso_change_saml_identity_mode") return .dictionary(d) + case .ssoRemoveCert: + var d = [String: JSON]() + d[".tag"] = .str("sso_remove_cert") + return .dictionary(d) case .ssoRemoveLoginUrl: var d = [String: JSON]() d[".tag"] = .str("sso_remove_login_url") @@ -6769,6 +6816,10 @@ open class TeamLog { var d = [String: JSON]() d[".tag"] = .str("paper_change_deployment_policy") return .dictionary(d) + case .paperChangeMemberLinkPolicy: + var d = [String: JSON]() + d[".tag"] = .str("paper_change_member_link_policy") + return .dictionary(d) case .paperChangeMemberPolicy: var d = [String: JSON]() d[".tag"] = .str("paper_change_member_policy") @@ -6829,6 +6880,10 @@ open class TeamLog { var d = [String: JSON]() d[".tag"] = .str("team_profile_add_logo") return .dictionary(d) + case .teamProfileChangeDefaultLanguage: + var d = [String: JSON]() + d[".tag"] = .str("team_profile_change_default_language") + return .dictionary(d) case .teamProfileChangeLogo: var d = [String: JSON]() d[".tag"] = .str("team_profile_change_logo") @@ -7282,6 +7337,8 @@ open class TeamLog { return EventType.shmodelVisibilityPublic case "shmodel_visibility_team_only": return EventType.shmodelVisibilityTeamOnly + case "sso_add_cert": + return EventType.ssoAddCert case "sso_add_login_url": return EventType.ssoAddLoginUrl case "sso_add_logout_url": @@ -7294,6 +7351,8 @@ open class TeamLog { return EventType.ssoChangeLogoutUrl case "sso_change_saml_identity_mode": return EventType.ssoChangeSamlIdentityMode + case "sso_remove_cert": + return EventType.ssoRemoveCert case "sso_remove_login_url": return EventType.ssoRemoveLoginUrl case "sso_remove_logout_url": @@ -7362,6 +7421,8 @@ open class TeamLog { return EventType.networkControlChangePolicy case "paper_change_deployment_policy": return EventType.paperChangeDeploymentPolicy + case "paper_change_member_link_policy": + return EventType.paperChangeMemberLinkPolicy case "paper_change_member_policy": return EventType.paperChangeMemberPolicy case "paper_change_policy": @@ -7392,6 +7453,8 @@ open class TeamLog { return EventType.webSessionsChangeIdleLengthPolicy case "team_profile_add_logo": return EventType.teamProfileAddLogo + case "team_profile_change_default_language": + return EventType.teamProfileChangeDefaultLanguage case "team_profile_change_logo": return EventType.teamProfileChangeLogo case "team_profile_change_name": @@ -9317,12 +9380,12 @@ open class TeamLog { /// Created a group. open class GroupCreateDetails: CustomStringConvertible { - /// Is admin managed group. Might be missing due to historical data gap. - open let isAdminManaged: Bool? + /// Is company managed group. Might be missing due to historical data gap. + open let isCompanyManaged: Bool? /// Group join policy. open let joinPolicy: TeamLog.GroupJoinPolicy - public init(joinPolicy: TeamLog.GroupJoinPolicy, isAdminManaged: Bool? = nil) { - self.isAdminManaged = isAdminManaged + public init(joinPolicy: TeamLog.GroupJoinPolicy, isCompanyManaged: Bool? = nil) { + self.isCompanyManaged = isCompanyManaged self.joinPolicy = joinPolicy } open var description: String { @@ -9334,7 +9397,7 @@ open class TeamLog { open func serialize(_ value: GroupCreateDetails) -> JSON { let output = [ "join_policy": TeamLog.GroupJoinPolicySerializer().serialize(value.joinPolicy), - "is_admin_managed": NullableSerializer(Serialization._BoolSerializer).serialize(value.isAdminManaged), + "is_company_managed": NullableSerializer(Serialization._BoolSerializer).serialize(value.isCompanyManaged), ] return .dictionary(output) } @@ -9342,8 +9405,8 @@ open class TeamLog { switch json { case .dictionary(let dict): let joinPolicy = TeamLog.GroupJoinPolicySerializer().deserialize(dict["join_policy"] ?? .null) - let isAdminManaged = NullableSerializer(Serialization._BoolSerializer).deserialize(dict["is_admin_managed"] ?? .null) - return GroupCreateDetails(joinPolicy: joinPolicy, isAdminManaged: isAdminManaged) + let isCompanyManaged = NullableSerializer(Serialization._BoolSerializer).deserialize(dict["is_company_managed"] ?? .null) + return GroupCreateDetails(joinPolicy: joinPolicy, isCompanyManaged: isCompanyManaged) default: fatalError("Type error deserializing") } @@ -9352,10 +9415,10 @@ open class TeamLog { /// Deleted a group. open class GroupDeleteDetails: CustomStringConvertible { - /// Is admin managed group. Might be missing due to historical data gap. - open let isAdminManaged: Bool? - public init(isAdminManaged: Bool? = nil) { - self.isAdminManaged = isAdminManaged + /// Is company managed group. Might be missing due to historical data gap. + open let isCompanyManaged: Bool? + public init(isCompanyManaged: Bool? = nil) { + self.isCompanyManaged = isCompanyManaged } open var description: String { return "\(SerializeUtil.prepareJSONForSerialization(GroupDeleteDetailsSerializer().serialize(self)))" @@ -9365,15 +9428,15 @@ open class TeamLog { public init() { } open func serialize(_ value: GroupDeleteDetails) -> JSON { let output = [ - "is_admin_managed": NullableSerializer(Serialization._BoolSerializer).serialize(value.isAdminManaged), + "is_company_managed": NullableSerializer(Serialization._BoolSerializer).serialize(value.isCompanyManaged), ] return .dictionary(output) } open func deserialize(_ json: JSON) -> GroupDeleteDetails { switch json { case .dictionary(let dict): - let isAdminManaged = NullableSerializer(Serialization._BoolSerializer).deserialize(dict["is_admin_managed"] ?? .null) - return GroupDeleteDetails(isAdminManaged: isAdminManaged) + let isCompanyManaged = NullableSerializer(Serialization._BoolSerializer).deserialize(dict["is_company_managed"] ?? .null) + return GroupDeleteDetails(isCompanyManaged: isCompanyManaged) default: fatalError("Type error deserializing") } @@ -11162,6 +11225,36 @@ open class TeamLog { } } + /// Changed whether non team members can view Paper documents using a link. + open class PaperChangeMemberLinkPolicyDetails: CustomStringConvertible { + /// New paper external link accessibility policy. + open let newValue: TeamLog.PaperMemberPolicy + public init(newValue: TeamLog.PaperMemberPolicy) { + self.newValue = newValue + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(PaperChangeMemberLinkPolicyDetailsSerializer().serialize(self)))" + } + } + open class PaperChangeMemberLinkPolicyDetailsSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: PaperChangeMemberLinkPolicyDetails) -> JSON { + let output = [ + "new_value": TeamLog.PaperMemberPolicySerializer().serialize(value.newValue), + ] + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> PaperChangeMemberLinkPolicyDetails { + switch json { + case .dictionary(let dict): + let newValue = TeamLog.PaperMemberPolicySerializer().deserialize(dict["new_value"] ?? .null) + return PaperChangeMemberLinkPolicyDetails(newValue: newValue) + default: + fatalError("Type error deserializing") + } + } + } + /// Changed whether team members can share Paper documents externally (i.e. outside the team), and if so, whether /// they should be accessible only by team members or anyone by default. open class PaperChangeMemberPolicyDetails: CustomStringConvertible { @@ -16288,6 +16381,36 @@ open class TeamLog { } } + /// Added the X.509 certificate for SSO. + open class SsoAddCertDetails: CustomStringConvertible { + /// SSO certificate details. + open let certificateDetails: TeamLog.Certificate + public init(certificateDetails: TeamLog.Certificate) { + self.certificateDetails = certificateDetails + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(SsoAddCertDetailsSerializer().serialize(self)))" + } + } + open class SsoAddCertDetailsSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: SsoAddCertDetails) -> JSON { + let output = [ + "certificate_details": TeamLog.CertificateSerializer().serialize(value.certificateDetails), + ] + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> SsoAddCertDetails { + switch json { + case .dictionary(let dict): + let certificateDetails = TeamLog.CertificateSerializer().deserialize(dict["certificate_details"] ?? .null) + return SsoAddCertDetails(certificateDetails: certificateDetails) + default: + fatalError("Type error deserializing") + } + } + } + /// Added sign-in URL for SSO. open class SsoAddLoginUrlDetails: CustomStringConvertible { /// New single sign-on login URL. @@ -16352,10 +16475,13 @@ open class TeamLog { /// Changed the X.509 certificate for SSO. open class SsoChangeCertDetails: CustomStringConvertible { - /// SSO certificate details. - open let certificateDetails: TeamLog.Certificate - public init(certificateDetails: TeamLog.Certificate) { - self.certificateDetails = certificateDetails + /// Previous SSO certificate details. + open let previousCertificateDetails: TeamLog.Certificate? + /// New SSO certificate details. + open let newCertificateDetails: TeamLog.Certificate + public init(newCertificateDetails: TeamLog.Certificate, previousCertificateDetails: TeamLog.Certificate? = nil) { + self.previousCertificateDetails = previousCertificateDetails + self.newCertificateDetails = newCertificateDetails } open var description: String { return "\(SerializeUtil.prepareJSONForSerialization(SsoChangeCertDetailsSerializer().serialize(self)))" @@ -16365,15 +16491,17 @@ open class TeamLog { public init() { } open func serialize(_ value: SsoChangeCertDetails) -> JSON { let output = [ - "certificate_details": TeamLog.CertificateSerializer().serialize(value.certificateDetails), + "new_certificate_details": TeamLog.CertificateSerializer().serialize(value.newCertificateDetails), + "previous_certificate_details": NullableSerializer(TeamLog.CertificateSerializer()).serialize(value.previousCertificateDetails), ] return .dictionary(output) } open func deserialize(_ json: JSON) -> SsoChangeCertDetails { switch json { case .dictionary(let dict): - let certificateDetails = TeamLog.CertificateSerializer().deserialize(dict["certificate_details"] ?? .null) - return SsoChangeCertDetails(certificateDetails: certificateDetails) + let newCertificateDetails = TeamLog.CertificateSerializer().deserialize(dict["new_certificate_details"] ?? .null) + let previousCertificateDetails = NullableSerializer(TeamLog.CertificateSerializer()).deserialize(dict["previous_certificate_details"] ?? .null) + return SsoChangeCertDetails(newCertificateDetails: newCertificateDetails, previousCertificateDetails: previousCertificateDetails) default: fatalError("Type error deserializing") } @@ -16556,6 +16684,30 @@ open class TeamLog { } } + /// Removed the X.509 certificate for SSO. + open class SsoRemoveCertDetails: CustomStringConvertible { + public init() { + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(SsoRemoveCertDetailsSerializer().serialize(self)))" + } + } + open class SsoRemoveCertDetailsSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: SsoRemoveCertDetails) -> JSON { + let output = [String: JSON]() + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> SsoRemoveCertDetails { + switch json { + case .dictionary(_): + return SsoRemoveCertDetails() + default: + fatalError("Type error deserializing") + } + } + } + /// Removed the sign-in URL for SSO. open class SsoRemoveLoginUrlDetails: CustomStringConvertible { /// Previous single sign-on login URL. @@ -17172,6 +17324,43 @@ open class TeamLog { } } + /// Changed the default language for the team. + open class TeamProfileChangeDefaultLanguageDetails: CustomStringConvertible { + /// New team's default language. + open let newValue: String + /// Previous team's default language. + open let previousValue: String + public init(newValue: String, previousValue: String) { + stringValidator(minLength: 2)(newValue) + self.newValue = newValue + stringValidator(minLength: 2)(previousValue) + self.previousValue = previousValue + } + open var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(TeamProfileChangeDefaultLanguageDetailsSerializer().serialize(self)))" + } + } + open class TeamProfileChangeDefaultLanguageDetailsSerializer: JSONSerializer { + public init() { } + open func serialize(_ value: TeamProfileChangeDefaultLanguageDetails) -> JSON { + let output = [ + "new_value": Serialization._StringSerializer.serialize(value.newValue), + "previous_value": Serialization._StringSerializer.serialize(value.previousValue), + ] + return .dictionary(output) + } + open func deserialize(_ json: JSON) -> TeamProfileChangeDefaultLanguageDetails { + switch json { + case .dictionary(let dict): + let newValue = Serialization._StringSerializer.deserialize(dict["new_value"] ?? .null) + let previousValue = Serialization._StringSerializer.deserialize(dict["previous_value"] ?? .null) + return TeamProfileChangeDefaultLanguageDetails(newValue: newValue, previousValue: previousValue) + default: + fatalError("Type error deserializing") + } + } + } + /// Changed the team logo to be displayed on shared link headers. open class TeamProfileChangeLogoDetails: CustomStringConvertible { public init() { @@ -17330,10 +17519,10 @@ open class TeamLog { /// Change two-step verification policy for the team. open class TfaChangePolicyDetails: CustomStringConvertible { /// New change policy. - open let newValue: TeamLog.TfaPolicy + open let newValue: TeamPolicies.TwoStepVerificationPolicy /// Previous change policy. Might be missing due to historical data gap. - open let previousValue: TeamLog.TfaPolicy? - public init(newValue: TeamLog.TfaPolicy, previousValue: TeamLog.TfaPolicy? = nil) { + open let previousValue: TeamPolicies.TwoStepVerificationPolicy? + public init(newValue: TeamPolicies.TwoStepVerificationPolicy, previousValue: TeamPolicies.TwoStepVerificationPolicy? = nil) { self.newValue = newValue self.previousValue = previousValue } @@ -17345,16 +17534,16 @@ open class TeamLog { public init() { } open func serialize(_ value: TfaChangePolicyDetails) -> JSON { let output = [ - "new_value": TeamLog.TfaPolicySerializer().serialize(value.newValue), - "previous_value": NullableSerializer(TeamLog.TfaPolicySerializer()).serialize(value.previousValue), + "new_value": TeamPolicies.TwoStepVerificationPolicySerializer().serialize(value.newValue), + "previous_value": NullableSerializer(TeamPolicies.TwoStepVerificationPolicySerializer()).serialize(value.previousValue), ] return .dictionary(output) } open func deserialize(_ json: JSON) -> TfaChangePolicyDetails { switch json { case .dictionary(let dict): - let newValue = TeamLog.TfaPolicySerializer().deserialize(dict["new_value"] ?? .null) - let previousValue = NullableSerializer(TeamLog.TfaPolicySerializer()).deserialize(dict["previous_value"] ?? .null) + let newValue = TeamPolicies.TwoStepVerificationPolicySerializer().deserialize(dict["new_value"] ?? .null) + let previousValue = NullableSerializer(TeamPolicies.TwoStepVerificationPolicySerializer()).deserialize(dict["previous_value"] ?? .null) return TfaChangePolicyDetails(newValue: newValue, previousValue: previousValue) default: fatalError("Type error deserializing") @@ -17470,57 +17659,6 @@ open class TeamLog { } } - /// Two factor authentication policy - public enum TfaPolicy: CustomStringConvertible { - /// An unspecified error. - case allowDisable - /// An unspecified error. - case stickyEnable - /// An unspecified error. - case other - - public var description: String { - return "\(SerializeUtil.prepareJSONForSerialization(TfaPolicySerializer().serialize(self)))" - } - } - open class TfaPolicySerializer: JSONSerializer { - public init() { } - open func serialize(_ value: TfaPolicy) -> JSON { - switch value { - case .allowDisable: - var d = [String: JSON]() - d[".tag"] = .str("allow_disable") - return .dictionary(d) - case .stickyEnable: - var d = [String: JSON]() - d[".tag"] = .str("sticky_enable") - return .dictionary(d) - case .other: - var d = [String: JSON]() - d[".tag"] = .str("other") - return .dictionary(d) - } - } - open func deserialize(_ json: JSON) -> TfaPolicy { - switch json { - case .dictionary(let d): - let tag = Serialization.getTag(d) - switch tag { - case "allow_disable": - return TfaPolicy.allowDisable - case "sticky_enable": - return TfaPolicy.stickyEnable - case "other": - return TfaPolicy.other - default: - return TfaPolicy.other - } - default: - fatalError("Failed to deserialize") - } - } - } - /// Removed the backup phone for two-step verification. open class TfaRemoveBackupPhoneDetails: CustomStringConvertible { public init() { diff --git a/Source/SwiftyDropbox/Shared/Generated/TeamPolicies.swift b/Source/SwiftyDropbox/Shared/Generated/TeamPolicies.swift index e4219bd1e..e5e47563c 100644 --- a/Source/SwiftyDropbox/Shared/Generated/TeamPolicies.swift +++ b/Source/SwiftyDropbox/Shared/Generated/TeamPolicies.swift @@ -646,4 +646,55 @@ open class TeamPolicies { } } + /// The TwoStepVerificationPolicy union + public enum TwoStepVerificationPolicy: CustomStringConvertible { + /// Enabled require two factor authorization. + case requireTfaEnable + /// Disabled require two factor authorization. + case requireTfaDisable + /// An unspecified error. + case other + + public var description: String { + return "\(SerializeUtil.prepareJSONForSerialization(TwoStepVerificationPolicySerializer().serialize(self)))" + } + } + open class TwoStepVerificationPolicySerializer: JSONSerializer { + public init() { } + open func serialize(_ value: TwoStepVerificationPolicy) -> JSON { + switch value { + case .requireTfaEnable: + var d = [String: JSON]() + d[".tag"] = .str("require_tfa_enable") + return .dictionary(d) + case .requireTfaDisable: + var d = [String: JSON]() + d[".tag"] = .str("require_tfa_disable") + return .dictionary(d) + case .other: + var d = [String: JSON]() + d[".tag"] = .str("other") + return .dictionary(d) + } + } + open func deserialize(_ json: JSON) -> TwoStepVerificationPolicy { + switch json { + case .dictionary(let d): + let tag = Serialization.getTag(d) + switch tag { + case "require_tfa_enable": + return TwoStepVerificationPolicy.requireTfaEnable + case "require_tfa_disable": + return TwoStepVerificationPolicy.requireTfaDisable + case "other": + return TwoStepVerificationPolicy.other + default: + return TwoStepVerificationPolicy.other + } + default: + fatalError("Failed to deserialize") + } + } + } + } diff --git a/Source/SwiftyDropbox/Shared/Generated/TeamRoutes.swift b/Source/SwiftyDropbox/Shared/Generated/TeamRoutes.swift index b3306c803..6c80ab0d1 100644 --- a/Source/SwiftyDropbox/Shared/Generated/TeamRoutes.swift +++ b/Source/SwiftyDropbox/Shared/Generated/TeamRoutes.swift @@ -749,7 +749,7 @@ open class TeamRoutes { return client.request(route, serverArgs: serverArgs) } - /// Creates a new, active, team folder. Permission : Team member file access. + /// Creates a new, active, team folder with no members. Permission : Team member file access. /// /// - parameter name: Name for the new team folder. /// diff --git a/spec b/spec index 52ee61988..318810d03 160000 --- a/spec +++ b/spec @@ -1 +1 @@ -Subproject commit 52ee61988f0bd92fbd75a41383567e5acaca96f6 +Subproject commit 318810d037acbbc1d6f20574adb308520870a38b