Skip to content
Merged
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": "18868e7", "specHash": "d0976fc", "version": "10.7.0" }
{ "engineHash": "18868e7", "specHash": "f899bf6", "version": "10.7.0" }
5 changes: 5 additions & 0 deletions box_sdk_gen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@

from box_sdk_gen.managers.external_users import ExternalUsersManager

from box_sdk_gen.managers.automate_workflows import AutomateWorkflowsManager

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession
Expand Down Expand Up @@ -464,6 +466,9 @@ def __init__(self, auth: Authentication, *, network_session: NetworkSession = No
self.external_users = ExternalUsersManager(
auth=self.auth, network_session=self.network_session
)
self.automate_workflows = AutomateWorkflowsManager(
auth=self.auth, network_session=self.network_session
)

def make_request(self, fetch_options: FetchOptions) -> FetchResponse:
"""
Expand Down
2 changes: 2 additions & 0 deletions box_sdk_gen/managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@
from box_sdk_gen.managers.archives import *

from box_sdk_gen.managers.external_users import *

from box_sdk_gen.managers.automate_workflows import *
175 changes: 175 additions & 0 deletions box_sdk_gen/managers/automate_workflows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
from typing import Optional

from typing import Dict

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json import deserialize

from typing import List

from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.schemas.v2026_r0.automate_workflows_v2026_r0 import (
AutomateWorkflowsV2026R0,
)

from box_sdk_gen.schemas.v2026_r0.client_error_v2026_r0 import ClientErrorV2026R0

from box_sdk_gen.parameters.v2026_r0.box_version_header_v2026_r0 import (
BoxVersionHeaderV2026R0,
)

from box_sdk_gen.schemas.v2026_r0.automate_workflow_start_request_v2026_r0 import (
AutomateWorkflowStartRequestV2026R0,
)

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession

from box_sdk_gen.networking.fetch_options import FetchOptions

from box_sdk_gen.networking.fetch_response import FetchResponse

from box_sdk_gen.internal.utils import prepare_params

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.internal.utils import ByteStream

from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.serialization.json import SerializedData


class AutomateWorkflowsManager:
def __init__(
self,
*,
auth: Optional[Authentication] = None,
network_session: NetworkSession = None
):
if network_session is None:
network_session = NetworkSession()
self.auth = auth
self.network_session = network_session

def get_automate_workflows_v2026_r0(
self,
folder_id: str,
*,
limit: Optional[int] = None,
marker: Optional[str] = None,
box_version: BoxVersionHeaderV2026R0 = BoxVersionHeaderV2026R0._2026_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> AutomateWorkflowsV2026R0:
"""
Returns workflow actions from Automate for a folder, using the

`WORKFLOW` action category.

:param folder_id: The unique identifier that represent a folder.

The ID for any folder can be determined
by visiting this folder in the web application
and copying the ID from the URL. For example,
for the URL `https://*.app.box.com/folder/123`
the `folder_id` is `123`.

The root folder of a Box account is
always represented by the ID `0`.
:type folder_id: str
:param limit: The maximum number of items to return per page., defaults to None
:type limit: Optional[int], optional
:param marker: Defines the position marker at which to begin returning results. This is
used when paginating using marker-based pagination., defaults to None
:type marker: Optional[str], optional
:param box_version: Version header., defaults to BoxVersionHeaderV2026R0._2026_0
:type box_version: BoxVersionHeaderV2026R0, 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
"""
if extra_headers is None:
extra_headers = {}
query_params_map: Dict[str, str] = prepare_params(
{
'folder_id': to_string(folder_id),
'limit': to_string(limit),
'marker': to_string(marker),
}
)
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
response: FetchResponse = self.network_session.network_client.fetch(
FetchOptions(
url=''.join(
[self.network_session.base_urls.base_url, '/2.0/automate_workflows']
),
method='GET',
params=query_params_map,
headers=headers_map,
response_format=ResponseFormat.JSON,
auth=self.auth,
network_session=self.network_session,
)
)
return deserialize(response.data, AutomateWorkflowsV2026R0)

def create_automate_workflow_start_v2026_r0(
self,
workflow_id: str,
workflow_action_id: str,
file_ids: List[str],
*,
box_version: BoxVersionHeaderV2026R0 = BoxVersionHeaderV2026R0._2026_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> None:
"""
Starts an Automate workflow manually by using a workflow action ID and file IDs.
:param workflow_id: The ID of the workflow.
Example: "12345"
:type workflow_id: str
:param workflow_action_id: The callable action ID used to trigger the selected workflow.
:type workflow_action_id: str
:param file_ids: The files to process with the selected workflow.
:type file_ids: List[str]
:param box_version: Version header., defaults to BoxVersionHeaderV2026R0._2026_0
:type box_version: BoxVersionHeaderV2026R0, 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
"""
if extra_headers is None:
extra_headers = {}
request_body: Dict = {
'workflow_action_id': workflow_action_id,
'file_ids': file_ids,
}
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
response: FetchResponse = self.network_session.network_client.fetch(
FetchOptions(
url=''.join(
[
self.network_session.base_urls.base_url,
'/2.0/automate_workflows/',
to_string(workflow_id),
'/start',
]
),
method='POST',
headers=headers_map,
data=serialize(request_body),
content_type='application/json',
response_format=ResponseFormat.NO_CONTENT,
auth=self.auth,
network_session=self.network_session,
)
)
return None
2 changes: 2 additions & 0 deletions box_sdk_gen/parameters/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from box_sdk_gen.parameters.v2025_r0 import *

from box_sdk_gen.parameters.v2026_r0 import *
1 change: 1 addition & 0 deletions box_sdk_gen/parameters/v2026_r0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from box_sdk_gen.parameters.v2026_r0.box_version_header_v2026_r0 import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum

from box_sdk_gen.box.errors import BoxSDKError


class BoxVersionHeaderV2026R0(str, Enum):
_2026_0 = '2026.0'
2 changes: 2 additions & 0 deletions box_sdk_gen/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,3 +591,5 @@
from box_sdk_gen.schemas.zip_download_status import *

from box_sdk_gen.schemas.v2025_r0 import *

from box_sdk_gen.schemas.v2026_r0 import *
13 changes: 13 additions & 0 deletions box_sdk_gen/schemas/v2026_r0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from box_sdk_gen.schemas.v2026_r0.automate_workflow_reference_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.automate_workflow_start_request_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.client_error_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.user_base_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.user_mini_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.automate_workflow_action_v2026_r0 import *

from box_sdk_gen.schemas.v2026_r0.automate_workflows_v2026_r0 import *
66 changes: 66 additions & 0 deletions box_sdk_gen/schemas/v2026_r0/automate_workflow_action_v2026_r0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from enum import Enum

from typing import Optional

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.schemas.v2026_r0.user_mini_v2026_r0 import UserMiniV2026R0

from box_sdk_gen.schemas.v2026_r0.automate_workflow_reference_v2026_r0 import (
AutomateWorkflowReferenceV2026R0,
)

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.internal.utils import DateTime


class AutomateWorkflowActionV2026R0TypeField(str, Enum):
WORKFLOW_ACTION = 'workflow_action'


class AutomateWorkflowActionV2026R0ActionTypeField(str, Enum):
RUN_WORKFLOW = 'run_workflow'


class AutomateWorkflowActionV2026R0(BaseObject):
_discriminator = 'type', {'workflow_action'}

def __init__(
self,
id: str,
workflow: AutomateWorkflowReferenceV2026R0,
*,
type: AutomateWorkflowActionV2026R0TypeField = AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION,
action_type: AutomateWorkflowActionV2026R0ActionTypeField = AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW,
description: Optional[str] = None,
created_at: Optional[DateTime] = None,
updated_at: Optional[DateTime] = None,
created_by: Optional[UserMiniV2026R0] = None,
updated_by: Optional[UserMiniV2026R0] = None,
**kwargs
):
"""
:param id: The identifier for the Automate action.
:type id: str
:param type: The object type for this workflow action wrapper., defaults to AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION
:type type: AutomateWorkflowActionV2026R0TypeField, optional
:param action_type: The type that defines the behavior of this action., defaults to AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW
:type action_type: AutomateWorkflowActionV2026R0ActionTypeField, optional
:param description: A human-readable description of the workflow action., defaults to None
:type description: Optional[str], optional
:param created_at: The date and time when the action was created., defaults to None
:type created_at: Optional[DateTime], optional
:param updated_at: The date and time when the action was last updated., defaults to None
:type updated_at: Optional[DateTime], optional
"""
super().__init__(**kwargs)
self.id = id
self.workflow = workflow
self.type = type
self.action_type = action_type
self.description = description
self.created_at = created_at
self.updated_at = updated_at
self.created_by = created_by
self.updated_by = updated_by
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from enum import Enum

from typing import Optional

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.box.errors import BoxSDKError


class AutomateWorkflowReferenceV2026R0TypeField(str, Enum):
WORKFLOW = 'workflow'


class AutomateWorkflowReferenceV2026R0(BaseObject):
_discriminator = 'type', {'workflow'}

def __init__(
self,
id: str,
*,
type: AutomateWorkflowReferenceV2026R0TypeField = AutomateWorkflowReferenceV2026R0TypeField.WORKFLOW,
name: Optional[str] = None,
**kwargs
):
"""
:param id: The identifier for the Automate workflow instance.
:type id: str
:param type: The object type., defaults to AutomateWorkflowReferenceV2026R0TypeField.WORKFLOW
:type type: AutomateWorkflowReferenceV2026R0TypeField, optional
:param name: The display name for the Automate workflow., defaults to None
:type name: Optional[str], optional
"""
super().__init__(**kwargs)
self.id = id
self.type = type
self.name = name
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import List

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.box.errors import BoxSDKError


class AutomateWorkflowStartRequestV2026R0(BaseObject):
def __init__(self, workflow_action_id: str, file_ids: List[str], **kwargs):
"""
:param workflow_action_id: The callable action ID used to trigger the selected workflow.
:type workflow_action_id: str
:param file_ids: The files to process with the selected workflow.
:type file_ids: List[str]
"""
super().__init__(**kwargs)
self.workflow_action_id = workflow_action_id
self.file_ids = file_ids
36 changes: 36 additions & 0 deletions box_sdk_gen/schemas/v2026_r0/automate_workflows_v2026_r0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import Optional

from typing import List

from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.schemas.v2026_r0.automate_workflow_action_v2026_r0 import (
AutomateWorkflowActionV2026R0,
)

from box_sdk_gen.box.errors import BoxSDKError


class AutomateWorkflowsV2026R0(BaseObject):
def __init__(
self,
*,
entries: Optional[List[AutomateWorkflowActionV2026R0]] = None,
limit: Optional[int] = None,
next_marker: Optional[str] = None,
**kwargs
):
"""
:param entries: Workflow actions available for manual start., defaults to None
:type entries: Optional[List[AutomateWorkflowActionV2026R0]], optional
:param limit: The limit that was used for these entries. This will be the same as the
`limit` query parameter unless that value exceeded the maximum value
allowed. The maximum value varies by API., defaults to None
:type limit: Optional[int], optional
:param next_marker: The marker for the start of the next page of results., defaults to None
:type next_marker: Optional[str], optional
"""
super().__init__(**kwargs)
self.entries = entries
self.limit = limit
self.next_marker = next_marker
Loading
Loading