From 72531c2bba1ef7bb652e9e6d4922aadb3551705b Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Mon, 18 Mar 2024 11:21:04 -0700 Subject: [PATCH] fix: temporarily remove file activities endpoint (box/box-openapi#413) --- .codegen.json | 2 +- box_sdk_gen/managers/workflows.py | 39 +------ box_sdk_gen/schemas.py | 171 ++++++++++++++++++++++++++++++ docs/workflows.md | 4 +- 4 files changed, 179 insertions(+), 37 deletions(-) diff --git a/.codegen.json b/.codegen.json index 63bc973..cacbc12 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "3d3d072", "specHash": "578a2f2", "version": "0.6.1" } +{ "engineHash": "3d3d072", "specHash": "d50ab5f", "version": "0.6.1" } diff --git a/box_sdk_gen/managers/workflows.py b/box_sdk_gen/managers/workflows.py index fc25201..a694be5 100644 --- a/box_sdk_gen/managers/workflows.py +++ b/box_sdk_gen/managers/workflows.py @@ -18,6 +18,8 @@ from box_sdk_gen.schemas import ClientError +from box_sdk_gen.schemas import Outcome + from box_sdk_gen.networking.auth import Authentication from box_sdk_gen.networking.network import NetworkSession @@ -108,37 +110,6 @@ def __init__( self.id = id -class StartWorkflowOutcomesTypeField(str, Enum): - OUTCOME = 'outcome' - - -class StartWorkflowOutcomes(BaseObject): - _discriminator = 'type', {'outcome'} - - def __init__( - self, - *, - id: Optional[str] = None, - type: Optional[StartWorkflowOutcomesTypeField] = None, - parameter: Optional[str] = None, - **kwargs - ): - """ - :param id: The id of the outcome, defaults to None - :type id: Optional[str], optional - :param type: The type of the outcome object, defaults to None - :type type: Optional[StartWorkflowOutcomesTypeField], optional - :param parameter: This is a placeholder example for various objects that - can be passed in - refer to the guides section to find - out more information., defaults to None - :type parameter: Optional[str], optional - """ - super().__init__(**kwargs) - self.id = id - self.type = type - self.parameter = parameter - - class WorkflowsManager: def __init__( self, @@ -226,7 +197,7 @@ def start_workflow( folder: StartWorkflowFolder, *, type: Optional[StartWorkflowType] = None, - outcomes: Optional[List[StartWorkflowOutcomes]] = None, + outcomes: Optional[List[Outcome]] = None, extra_headers: Optional[Dict[str, Optional[str]]] = None ) -> None: """ @@ -249,8 +220,8 @@ def start_workflow( :type folder: StartWorkflowFolder :param type: The type of the parameters object, defaults to None :type type: Optional[StartWorkflowType], optional - :param outcomes: A list of outcomes required to be configured at start time., defaults to None - :type outcomes: Optional[List[StartWorkflowOutcomes]], optional + :param outcomes: A configurable outcome the workflow should complete., defaults to None + :type outcomes: Optional[List[Outcome]], optional :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None :type extra_headers: Optional[Dict[str, Optional[str]]], optional """ diff --git a/box_sdk_gen/schemas.py b/box_sdk_gen/schemas.py index 92fa475..684193b 100644 --- a/box_sdk_gen/schemas.py +++ b/box_sdk_gen/schemas.py @@ -10242,6 +10242,109 @@ def __init__( self.state = state +class CompletionRuleVariableTypeField(str, Enum): + VARIABLE = 'variable' + + +class CompletionRuleVariableVariableTypeField(str, Enum): + TASK_COMPLETION_RULE = 'task_completion_rule' + + +class CompletionRuleVariableVariableValueField(str, Enum): + ALL_ASSIGNEES = 'all_assignees' + ANY_ASSIGNEES = 'any_assignees' + + +class CompletionRuleVariable(BaseObject): + _discriminator = 'type', {'variable'} + + def __init__( + self, + type: CompletionRuleVariableTypeField, + variable_type: CompletionRuleVariableVariableTypeField, + variable_value: CompletionRuleVariableVariableValueField, + **kwargs + ): + """ + :param type: Completion + Rule object type. + + :type type: CompletionRuleVariableTypeField + :param variable_type: Variable type + for the Completion + Rule object. + + :type variable_type: CompletionRuleVariableVariableTypeField + :param variable_value: Variable + values for a completion + rule. + + :type variable_value: CompletionRuleVariableVariableValueField + """ + super().__init__(**kwargs) + self.type = type + self.variable_type = variable_type + self.variable_value = variable_value + + +class CollaboratorVariableTypeField(str, Enum): + VARIABLE = 'variable' + + +class CollaboratorVariableVariableTypeField(str, Enum): + USER_LIST = 'user_list' + + +class CollaboratorVariableVariableValueTypeField(str, Enum): + USER = 'user' + + +class CollaboratorVariableVariableValueField(BaseObject): + _discriminator = 'type', {'user'} + + def __init__( + self, type: CollaboratorVariableVariableValueTypeField, id: str, **kwargs + ): + """ + :param type: The object type. + :type type: CollaboratorVariableVariableValueTypeField + :param id: User's ID. + :type id: str + """ + super().__init__(**kwargs) + self.type = type + self.id = id + + +class CollaboratorVariable(BaseObject): + _discriminator = 'type', {'variable'} + + def __init__( + self, + type: CollaboratorVariableTypeField, + variable_type: CollaboratorVariableVariableTypeField, + variable_value: List[CollaboratorVariableVariableValueField], + **kwargs + ): + """ + :param type: Collaborator + object type. + + :type type: CollaboratorVariableTypeField + :param variable_type: Variable type + for the Collaborator + object. + + :type variable_type: CollaboratorVariableVariableTypeField + :param variable_value: A list of user IDs. + :type variable_value: List[CollaboratorVariableVariableValueField] + """ + super().__init__(**kwargs) + self.type = type + self.variable_type = variable_type + self.variable_value = variable_value + + class KeywordSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' @@ -10535,6 +10638,74 @@ def __init__( self.options = options +class RoleVariableTypeField(str, Enum): + VARIABLE = 'variable' + + +class RoleVariableVariableTypeField(str, Enum): + COLLABORATOR_ROLE = 'collaborator_role' + + +class RoleVariableVariableValueField(str, Enum): + EDITOR = 'editor' + VIEWER = 'viewer' + PREVIEWER = 'previewer' + UPLOADER = 'uploader' + PREVIEWER_UPLOADER = 'previewer uploader' + VIEWER_UPLOADER = 'viewer uploader' + CO_OWNER = 'co-owner' + + +class RoleVariable(BaseObject): + _discriminator = 'type', {'variable'} + + def __init__( + self, + type: RoleVariableTypeField, + variable_type: RoleVariableVariableTypeField, + variable_value: RoleVariableVariableValueField, + **kwargs + ): + """ + :param type: Role object type. + + :type type: RoleVariableTypeField + :param variable_type: The variable type used + by the object. + + :type variable_type: RoleVariableVariableTypeField + """ + super().__init__(**kwargs) + self.type = type + self.variable_type = variable_type + self.variable_value = variable_value + + +class Outcome(BaseObject): + def __init__( + self, + id: str, + *, + collaborators: Optional[CollaboratorVariable] = None, + completion_rule: Optional[CompletionRuleVariable] = None, + file_collaborator_role: Optional[RoleVariable] = None, + task_collaborators: Optional[CollaboratorVariable] = None, + role: Optional[RoleVariable] = None, + **kwargs + ): + """ + :param id: ID of a specific outcome + :type id: str + """ + super().__init__(**kwargs) + self.id = id + self.collaborators = collaborators + self.completion_rule = completion_rule + self.file_collaborator_role = file_collaborator_role + self.task_collaborators = task_collaborators + self.role = role + + class TimelineSkillCardTypeField(str, Enum): SKILL_CARD = 'skill_card' diff --git a/docs/workflows.md b/docs/workflows.md index 532e41e..dc87d4b 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -71,8 +71,8 @@ admin_client.workflows.start_workflow(workflow_to_run.id, StartWorkflowFlow(type - The array of files for which the workflow should start. All files must be in the workflow's configured folder. - folder `StartWorkflowFolder` - The folder object for which the workflow is configured. -- outcomes `Optional[List[StartWorkflowOutcomes]]` - - A list of outcomes required to be configured at start time. +- outcomes `Optional[List[Outcome]]` + - A configurable outcome the workflow should complete. - extra_headers `Optional[Dict[str, Optional[str]]]` - Extra headers that will be included in the HTTP request.