diff --git a/.codegen.json b/.codegen.json index aa23fee4..7c40a2f9 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "5a07c4a", "specHash": "e95d6fa", "version": "0.3.0" } +{ "engineHash": "25c4224", "specHash": "137da0d", "version": "0.3.0" } diff --git a/Sources/Internal/Utils.swift b/Sources/Internal/Utils.swift index 1204e5f4..de32df00 100644 --- a/Sources/Internal/Utils.swift +++ b/Sources/Internal/Utils.swift @@ -294,8 +294,9 @@ public enum Utils { /// - Parameters: /// - stream: InputStream to iterate over /// - chunkSize: Size of chunk + /// - fileSize: Size of the file /// - Returns: The asynchronous sequence AsyncStream - public static func iterateChunks(stream: InputStream, chunkSize: Int64) -> AsyncStream { + public static func iterateChunks(stream: InputStream, chunkSize: Int64, fileSize: Int64) -> AsyncStream { return AsyncStream { continuation in _Concurrency.Task { stream.open() diff --git a/Sources/Managers/ChunkedUploads/ChunkedUploadsManager.swift b/Sources/Managers/ChunkedUploads/ChunkedUploadsManager.swift index 00a42eb1..d8c76550 100644 --- a/Sources/Managers/ChunkedUploads/ChunkedUploadsManager.swift +++ b/Sources/Managers/ChunkedUploads/ChunkedUploadsManager.swift @@ -159,7 +159,7 @@ public class ChunkedUploadsManager { assert(partSize * Int64(totalParts) >= fileSize) assert(uploadSession.numPartsProcessed == 0) let fileHash: Hash = Hash(algorithm: HashName.sha1) - let chunksIterator: AsyncStream = Utils.iterateChunks(stream: file, chunkSize: partSize) + let chunksIterator: AsyncStream = Utils.iterateChunks(stream: file, chunkSize: partSize, fileSize: fileSize) let results: PartAccumulator = try await Utils.reduceIterator(iterator: chunksIterator, reducer: self.reducer, initialValue: PartAccumulator(lastIndex: -1, parts: [], fileSize: fileSize, uploadSessionId: uploadSessionId, fileHash: fileHash)) let parts: [UploadPart] = results.parts let processedSessionParts: UploadParts = try await self.getFileUploadSessionParts(uploadSessionId: uploadSessionId) diff --git a/Sources/Schemas/UserCollaborations/UserCollaborations.swift b/Sources/Schemas/UserCollaborations/UserCollaborations.swift index 91e030ee..b94bbced 100644 --- a/Sources/Schemas/UserCollaborations/UserCollaborations.swift +++ b/Sources/Schemas/UserCollaborations/UserCollaborations.swift @@ -6,6 +6,7 @@ public class UserCollaborations: UserBase { private enum CodingKeys: String, CodingKey { case name case login + case isActive = "is_active" } /// The display name of this user. If the collaboration status is `pending`, an empty string is returned. @@ -14,6 +15,9 @@ public class UserCollaborations: UserBase { /// The primary email address of this user. If the collaboration status is `pending`, an empty string is returned. public let login: String? + /// If set to `false`, the user is either deactivated or deleted. + public let isActive: Bool? + /// Initializer for a UserCollaborations. /// /// - Parameters: @@ -21,9 +25,11 @@ public class UserCollaborations: UserBase { /// - type: `user` /// - name: The display name of this user. If the collaboration status is `pending`, an empty string is returned. /// - login: The primary email address of this user. If the collaboration status is `pending`, an empty string is returned. - public init(id: String, type: UserBaseTypeField = UserBaseTypeField.user, name: String? = nil, login: String? = nil) { + /// - isActive: If set to `false`, the user is either deactivated or deleted. + public init(id: String, type: UserBaseTypeField = UserBaseTypeField.user, name: String? = nil, login: String? = nil, isActive: Bool? = nil) { self.name = name self.login = login + self.isActive = isActive super.init(id: id, type: type) } @@ -32,6 +38,7 @@ public class UserCollaborations: UserBase { let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) login = try container.decodeIfPresent(String.self, forKey: .login) + isActive = try container.decodeIfPresent(Bool.self, forKey: .isActive) try super.init(from: decoder) } @@ -40,6 +47,7 @@ public class UserCollaborations: UserBase { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(name, forKey: .name) try container.encodeIfPresent(login, forKey: .login) + try container.encodeIfPresent(isActive, forKey: .isActive) try super.encode(to: encoder) }