Skip to content

Commit

Permalink
feat: Support optional userId parameter for updating files, folders…
Browse files Browse the repository at this point in the history
… and web links (box/box-openapi#488) (#308)
  • Loading branch information
box-sdk-build authored Dec 9, 2024
1 parent b614a6f commit 8bd13d0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "a839036", "specHash": "d7dfe68", "version": "0.5.0" }
{ "engineHash": "5604447", "specHash": "c9d7bb5", "version": "0.5.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,35 @@ import Foundation
public class UpdateFileByIdRequestBodyParentField: Codable {
private enum CodingKeys: String, CodingKey {
case id
case userId = "user_id"
}

/// The ID of parent item
public let id: String?

/// The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public let userId: String?

/// Initializer for a UpdateFileByIdRequestBodyParentField.
///
/// - Parameters:
/// - id: The ID of parent item
public init(id: String? = nil) {
/// - userId: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public init(id: String? = nil, userId: String? = nil) {
self.id = id
self.userId = userId
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id)
userId = try container.decodeIfPresent(String.self, forKey: .userId)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(userId, forKey: .userId)
}

}
5 changes: 1 addition & 4 deletions Sources/Managers/Folders/UpdateFolderByIdRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class UpdateFolderByIdRequestBody: Codable {
/// of the folder can invite new collaborators to the folder.
public let canNonOwnersInvite: Bool?

/// The parent folder for this folder. Use this to move
/// the folder or to restore it out of the trash.
public let parent: UpdateFolderByIdRequestBodyParentField?

public let sharedLink: UpdateFolderByIdRequestBodySharedLinkField?
Expand Down Expand Up @@ -88,8 +86,7 @@ public class UpdateFolderByIdRequestBody: Codable {
/// (discontinued) and is not used by Box Drive.
/// - canNonOwnersInvite: Specifies if users who are not the owner
/// of the folder can invite new collaborators to the folder.
/// - parent: The parent folder for this folder. Use this to move
/// the folder or to restore it out of the trash.
/// - parent:
/// - sharedLink:
/// - folderUploadEmail:
/// - tags: The tags for this item. These tags are shown in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,35 @@ import Foundation
public class UpdateFolderByIdRequestBodyParentField: Codable {
private enum CodingKeys: String, CodingKey {
case id
case userId = "user_id"
}

/// The ID of the new parent folder
/// The ID of parent item
public let id: String?

/// The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public let userId: String?

/// Initializer for a UpdateFolderByIdRequestBodyParentField.
///
/// - Parameters:
/// - id: The ID of the new parent folder
public init(id: String? = nil) {
/// - id: The ID of parent item
/// - userId: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public init(id: String? = nil, userId: String? = nil) {
self.id = id
self.userId = userId
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id)
userId = try container.decodeIfPresent(String.self, forKey: .userId)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(userId, forKey: .userId)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,35 @@ import Foundation
public class UpdateWebLinkByIdRequestBodyParentField: Codable {
private enum CodingKeys: String, CodingKey {
case id
case userId = "user_id"
}

/// The ID of parent item
public let id: String?

/// The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public let userId: String?

/// Initializer for a UpdateWebLinkByIdRequestBodyParentField.
///
/// - Parameters:
/// - id: The ID of parent item
public init(id: String? = nil) {
/// - userId: The input for `user_id` is optional. Moving to non-root folder is not allowed when `user_id` is present. Parent folder id should be zero when `user_id` is provided.
public init(id: String? = nil, userId: String? = nil) {
self.id = id
self.userId = userId
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id)
userId = try container.decodeIfPresent(String.self, forKey: .userId)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(userId, forKey: .userId)
}

}

0 comments on commit 8bd13d0

Please sign in to comment.