Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix c# docs code samples (box/box-codegen#451) #55

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "bdc0ade", "specHash": "b2f7568", "version": "0.1.0" }
{ "engineHash": "ac30b07", "specHash": "d50ab5f", "version": "0.1.0" }
160 changes: 140 additions & 20 deletions BoxSdkGen.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Sources/Managers/Workflows/StartWorkflowRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class StartWorkflowRequestBody: Codable {
/// The type of the parameters object
public let type: StartWorkflowRequestBodyTypeField?

/// A list of outcomes required to be configured at start time.
public let outcomes: [StartWorkflowRequestBodyOutcomesField]?
/// A configurable outcome the workflow should complete.
public let outcomes: [Outcome]?

/// Initializer for a StartWorkflowRequestBody.
///
Expand All @@ -33,8 +33,8 @@ public class StartWorkflowRequestBody: Codable {
/// must be in the workflow's configured folder.
/// - folder: The folder object for which the workflow is configured.
/// - type: The type of the parameters object
/// - outcomes: A list of outcomes required to be configured at start time.
public init(flow: StartWorkflowRequestBodyFlowField, files: [StartWorkflowRequestBodyFilesField], folder: StartWorkflowRequestBodyFolderField, type: StartWorkflowRequestBodyTypeField? = nil, outcomes: [StartWorkflowRequestBodyOutcomesField]? = nil) {
/// - outcomes: A configurable outcome the workflow should complete.
public init(flow: StartWorkflowRequestBodyFlowField, files: [StartWorkflowRequestBodyFilesField], folder: StartWorkflowRequestBodyFolderField, type: StartWorkflowRequestBodyTypeField? = nil, outcomes: [Outcome]? = nil) {
self.flow = flow
self.files = files
self.folder = folder
Expand All @@ -48,7 +48,7 @@ public class StartWorkflowRequestBody: Codable {
files = try container.decode([StartWorkflowRequestBodyFilesField].self, forKey: .files)
folder = try container.decode(StartWorkflowRequestBodyFolderField.self, forKey: .folder)
type = try container.decodeIfPresent(StartWorkflowRequestBodyTypeField.self, forKey: .type)
outcomes = try container.decodeIfPresent([StartWorkflowRequestBodyOutcomesField].self, forKey: .outcomes)
outcomes = try container.decodeIfPresent([Outcome].self, forKey: .outcomes)
}

public func encode(to encoder: Encoder) throws {
Expand Down

This file was deleted.

This file was deleted.

60 changes: 60 additions & 0 deletions Sources/Schemas/CollaboratorVariable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import Foundation

/// A collaborator
/// object. Allows to
/// specify a list of user
/// ID's that are affected
/// by the workflow result.
public class CollaboratorVariable: Codable {
private enum CodingKeys: String, CodingKey {
case type
case variableType = "variable_type"
case variableValue = "variable_value"
}

/// Collaborator
/// object type.
///
public let type: CollaboratorVariableTypeField

/// Variable type
/// for the Collaborator
/// object.
///
public let variableType: CollaboratorVariableVariableTypeField

/// A list of user IDs.
public let variableValue: [CollaboratorVariableVariableValueField]

/// Initializer for a CollaboratorVariable.
///
/// - Parameters:
/// - type: Collaborator
/// object type.
///
/// - variableType: Variable type
/// for the Collaborator
/// object.
///
/// - variableValue: A list of user IDs.
public init(type: CollaboratorVariableTypeField, variableType: CollaboratorVariableVariableTypeField, variableValue: [CollaboratorVariableVariableValueField]) {
self.type = type
self.variableType = variableType
self.variableValue = variableValue
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
type = try container.decode(CollaboratorVariableTypeField.self, forKey: .type)
variableType = try container.decode(CollaboratorVariableVariableTypeField.self, forKey: .variableType)
variableValue = try container.decode([CollaboratorVariableVariableValueField].self, forKey: .variableValue)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(type, forKey: .type)
try container.encode(variableType, forKey: .variableType)
try container.encode(variableValue, forKey: .variableValue)
}

}
5 changes: 5 additions & 0 deletions Sources/Schemas/CollaboratorVariableTypeField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum CollaboratorVariableTypeField: String, CodableStringEnum {
case variable
}
5 changes: 5 additions & 0 deletions Sources/Schemas/CollaboratorVariableVariableTypeField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum CollaboratorVariableVariableTypeField: String, CodableStringEnum {
case userList = "user_list"
}
37 changes: 37 additions & 0 deletions Sources/Schemas/CollaboratorVariableVariableValueField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Foundation

public class CollaboratorVariableVariableValueField: Codable {
private enum CodingKeys: String, CodingKey {
case type
case id
}

/// The object type.
public let type: CollaboratorVariableVariableValueTypeField

/// User's ID.
public let id: String

/// Initializer for a CollaboratorVariableVariableValueField.
///
/// - Parameters:
/// - type: The object type.
/// - id: User's ID.
public init(type: CollaboratorVariableVariableValueTypeField, id: String) {
self.type = type
self.id = id
}

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

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum CollaboratorVariableVariableValueTypeField: String, CodableStringEnum {
case user
}
65 changes: 65 additions & 0 deletions Sources/Schemas/CompletionRuleVariable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import Foundation

/// A completion
/// rule object. Determines
/// if an action should be completed
/// by all or any assignees.
public class CompletionRuleVariable: Codable {
private enum CodingKeys: String, CodingKey {
case type
case variableType = "variable_type"
case variableValue = "variable_value"
}

/// Completion
/// Rule object type.
///
public let type: CompletionRuleVariableTypeField

/// Variable type
/// for the Completion
/// Rule object.
///
public let variableType: CompletionRuleVariableVariableTypeField

/// Variable
/// values for a completion
/// rule.
///
public let variableValue: CompletionRuleVariableVariableValueField

/// Initializer for a CompletionRuleVariable.
///
/// - Parameters:
/// - type: Completion
/// Rule object type.
///
/// - variableType: Variable type
/// for the Completion
/// Rule object.
///
/// - variableValue: Variable
/// values for a completion
/// rule.
///
public init(type: CompletionRuleVariableTypeField, variableType: CompletionRuleVariableVariableTypeField, variableValue: CompletionRuleVariableVariableValueField) {
self.type = type
self.variableType = variableType
self.variableValue = variableValue
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
type = try container.decode(CompletionRuleVariableTypeField.self, forKey: .type)
variableType = try container.decode(CompletionRuleVariableVariableTypeField.self, forKey: .variableType)
variableValue = try container.decode(CompletionRuleVariableVariableValueField.self, forKey: .variableValue)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(type, forKey: .type)
try container.encode(variableType, forKey: .variableType)
try container.encode(variableValue, forKey: .variableValue)
}

}
5 changes: 5 additions & 0 deletions Sources/Schemas/CompletionRuleVariableTypeField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum CompletionRuleVariableTypeField: String, CodableStringEnum {
case variable
}
5 changes: 5 additions & 0 deletions Sources/Schemas/CompletionRuleVariableVariableTypeField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public enum CompletionRuleVariableVariableTypeField: String, CodableStringEnum {
case taskCompletionRule = "task_completion_rule"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Foundation

public enum CompletionRuleVariableVariableValueField: String, CodableStringEnum {
case allAssignees = "all_assignees"
case anyAssignees = "any_assignees"
}
65 changes: 65 additions & 0 deletions Sources/Schemas/Outcome.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import Foundation

/// An instance of an outcome.
public class Outcome: Codable {
private enum CodingKeys: String, CodingKey {
case id
case collaborators
case completionRule = "completion_rule"
case fileCollaboratorRole = "file_collaborator_role"
case taskCollaborators = "task_collaborators"
case role
}

/// ID of a specific outcome
public let id: String

public let collaborators: CollaboratorVariable?

public let completionRule: CompletionRuleVariable?

public let fileCollaboratorRole: RoleVariable?

public let taskCollaborators: CollaboratorVariable?

public let role: RoleVariable?

/// Initializer for a Outcome.
///
/// - Parameters:
/// - id: ID of a specific outcome
/// - collaborators:
/// - completionRule:
/// - fileCollaboratorRole:
/// - taskCollaborators:
/// - role:
public init(id: String, collaborators: CollaboratorVariable? = nil, completionRule: CompletionRuleVariable? = nil, fileCollaboratorRole: RoleVariable? = nil, taskCollaborators: CollaboratorVariable? = nil, role: RoleVariable? = nil) {
self.id = id
self.collaborators = collaborators
self.completionRule = completionRule
self.fileCollaboratorRole = fileCollaboratorRole
self.taskCollaborators = taskCollaborators
self.role = role
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decode(String.self, forKey: .id)
collaborators = try container.decodeIfPresent(CollaboratorVariable.self, forKey: .collaborators)
completionRule = try container.decodeIfPresent(CompletionRuleVariable.self, forKey: .completionRule)
fileCollaboratorRole = try container.decodeIfPresent(RoleVariable.self, forKey: .fileCollaboratorRole)
taskCollaborators = try container.decodeIfPresent(CollaboratorVariable.self, forKey: .taskCollaborators)
role = try container.decodeIfPresent(RoleVariable.self, forKey: .role)
}

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

}
Loading
Loading