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.9.0" }
{ "engineHash": "18868e7", "specHash": "f899bf6", "version": "10.9.0" }
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ the SDK are available by topic:
* [Appitemassociations](appitemassociations.md)
* [Archives](archives.md)
* [Authorization](authorization.md)
* [Automateworkflows](automateworkflows.md)
* [Avatars](avatars.md)
* [Chunkeduploads](chunkeduploads.md)
* [Classifications](classifications.md)
Expand Down
61 changes: 61 additions & 0 deletions docs/automateworkflows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# AutomateWorkflowsManager


- [List Automate workflows defined as callable actions](#list-automate-workflows-defined-as-callable-actions)
- [Start Automate workflow](#start-automate-workflow)

## List Automate workflows defined as callable actions

Returns workflow actions from Automate for a folder, using the
`WORKFLOW` action category.

This operation is performed by calling function `getAutomateWorkflowsV2026R0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2026.0/get-automate-workflows/).

*Currently we don't have an example for calling `getAutomateWorkflowsV2026R0` in integration tests*

### Arguments

- queryParams `GetAutomateWorkflowsV2026R0QueryParams`
- Query parameters of getAutomateWorkflowsV2026R0 method
- headers `GetAutomateWorkflowsV2026R0Headers`
- Headers of getAutomateWorkflowsV2026R0 method


### Returns

This function returns a value of type `AutomateWorkflowsV2026R0`.

Returns workflow actions that can be manually started.


## Start Automate workflow

Starts an Automate workflow manually by using a workflow action ID and file IDs.

This operation is performed by calling function `createAutomateWorkflowStartV2026R0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2026.0/post-automate-workflows-id-start/).

*Currently we don't have an example for calling `createAutomateWorkflowStartV2026R0` in integration tests*

### Arguments

- workflowId `String`
- The ID of the workflow. Example: "12345"
- requestBody `AutomateWorkflowStartRequestV2026R0`
- Request body of createAutomateWorkflowStartV2026R0 method
- headers `CreateAutomateWorkflowStartV2026R0Headers`
- Headers of createAutomateWorkflowStartV2026R0 method


### Returns

This function returns a value of type `void`.

Starts the workflow.


17 changes: 17 additions & 0 deletions src/main/java/com/box/sdkgen/client/BoxClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.box.sdkgen.managers.appitemassociations.AppItemAssociationsManager;
import com.box.sdkgen.managers.archives.ArchivesManager;
import com.box.sdkgen.managers.authorization.AuthorizationManager;
import com.box.sdkgen.managers.automateworkflows.AutomateWorkflowsManager;
import com.box.sdkgen.managers.avatars.AvatarsManager;
import com.box.sdkgen.managers.chunkeduploads.ChunkedUploadsManager;
import com.box.sdkgen.managers.classifications.ClassificationsManager;
Expand Down Expand Up @@ -270,6 +271,8 @@ public class BoxClient {

public final ExternalUsersManager externalUsers;

public final AutomateWorkflowsManager automateWorkflows;

public BoxClient(Authentication auth) {
this.auth = auth;
this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build();
Expand Down Expand Up @@ -618,6 +621,11 @@ public BoxClient(Authentication auth) {
.auth(this.auth)
.networkSession(this.networkSession)
.build();
this.automateWorkflows =
new AutomateWorkflowsManager.Builder()
.auth(this.auth)
.networkSession(this.networkSession)
.build();
}

protected BoxClient(Builder builder) {
Expand Down Expand Up @@ -968,6 +976,11 @@ protected BoxClient(Builder builder) {
.auth(this.auth)
.networkSession(this.networkSession)
.build();
this.automateWorkflows =
new AutomateWorkflowsManager.Builder()
.auth(this.auth)
.networkSession(this.networkSession)
.build();
}

/**
Expand Down Expand Up @@ -1423,6 +1436,10 @@ public ExternalUsersManager getExternalUsers() {
return externalUsers;
}

public AutomateWorkflowsManager getAutomateWorkflows() {
return automateWorkflows;
}

public static class Builder {

protected final Authentication auth;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
package com.box.sdkgen.managers.automateworkflows;

import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
import static com.box.sdkgen.internal.utils.UtilsManager.entryOf;
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;

import com.box.sdkgen.networking.auth.Authentication;
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
import com.box.sdkgen.networking.network.NetworkSession;
import com.box.sdkgen.schemas.v2026r0.automateworkflowstartrequestv2026r0.AutomateWorkflowStartRequestV2026R0;
import com.box.sdkgen.schemas.v2026r0.automateworkflowsv2026r0.AutomateWorkflowsV2026R0;
import com.box.sdkgen.serialization.json.JsonManager;
import java.util.Map;

public class AutomateWorkflowsManager {

public Authentication auth;

public NetworkSession networkSession;

public AutomateWorkflowsManager() {
this.networkSession = new NetworkSession();
}

protected AutomateWorkflowsManager(Builder builder) {
this.auth = builder.auth;
this.networkSession = builder.networkSession;
}

/**
* Returns workflow actions from Automate for a folder, using the `WORKFLOW` action category.
*
* @param queryParams Query parameters of getAutomateWorkflowsV2026R0 method
*/
public AutomateWorkflowsV2026R0 getAutomateWorkflowsV2026R0(
GetAutomateWorkflowsV2026R0QueryParams queryParams) {
return getAutomateWorkflowsV2026R0(queryParams, new GetAutomateWorkflowsV2026R0Headers());
}

/**
* Returns workflow actions from Automate for a folder, using the `WORKFLOW` action category.
*
* @param queryParams Query parameters of getAutomateWorkflowsV2026R0 method
* @param headers Headers of getAutomateWorkflowsV2026R0 method
*/
public AutomateWorkflowsV2026R0 getAutomateWorkflowsV2026R0(
GetAutomateWorkflowsV2026R0QueryParams queryParams,
GetAutomateWorkflowsV2026R0Headers headers) {
Map<String, String> queryParamsMap =
prepareParams(
mapOf(
entryOf("folder_id", convertToString(queryParams.getFolderId())),
entryOf("limit", convertToString(queryParams.getLimit())),
entryOf("marker", convertToString(queryParams.getMarker()))));
Map<String, String> headersMap =
prepareParams(
mergeMaps(
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
headers.getExtraHeaders()));
FetchResponse response =
this.networkSession
.getNetworkClient()
.fetch(
new FetchOptions.Builder(
String.join(
"",
this.networkSession.getBaseUrls().getBaseUrl(),
"/2.0/automate_workflows"),
"GET")
.params(queryParamsMap)
.headers(headersMap)
.responseFormat(ResponseFormat.JSON)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
return JsonManager.deserialize(response.getData(), AutomateWorkflowsV2026R0.class);
}

/**
* Starts an Automate workflow manually by using a workflow action ID and file IDs.
*
* @param workflowId The ID of the workflow. Example: "12345"
* @param requestBody Request body of createAutomateWorkflowStartV2026R0 method
*/
public void createAutomateWorkflowStartV2026R0(
String workflowId, AutomateWorkflowStartRequestV2026R0 requestBody) {
createAutomateWorkflowStartV2026R0(
workflowId, requestBody, new CreateAutomateWorkflowStartV2026R0Headers());
}

/**
* Starts an Automate workflow manually by using a workflow action ID and file IDs.
*
* @param workflowId The ID of the workflow. Example: "12345"
* @param requestBody Request body of createAutomateWorkflowStartV2026R0 method
* @param headers Headers of createAutomateWorkflowStartV2026R0 method
*/
public void createAutomateWorkflowStartV2026R0(
String workflowId,
AutomateWorkflowStartRequestV2026R0 requestBody,
CreateAutomateWorkflowStartV2026R0Headers headers) {
Map<String, String> headersMap =
prepareParams(
mergeMaps(
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
headers.getExtraHeaders()));
FetchResponse response =
this.networkSession
.getNetworkClient()
.fetch(
new FetchOptions.Builder(
String.join(
"",
this.networkSession.getBaseUrls().getBaseUrl(),
"/2.0/automate_workflows/",
convertToString(workflowId),
"/start"),
"POST")
.headers(headersMap)
.data(JsonManager.serialize(requestBody))
.contentType("application/json")
.responseFormat(ResponseFormat.NO_CONTENT)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
}

public Authentication getAuth() {
return auth;
}

public NetworkSession getNetworkSession() {
return networkSession;
}

public static class Builder {

protected Authentication auth;

protected NetworkSession networkSession;

public Builder() {}

public Builder auth(Authentication auth) {
this.auth = auth;
return this;
}

public Builder networkSession(NetworkSession networkSession) {
this.networkSession = networkSession;
return this;
}

public AutomateWorkflowsManager build() {
if (this.networkSession == null) {
this.networkSession = new NetworkSession();
}
return new AutomateWorkflowsManager(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.box.sdkgen.managers.automateworkflows;

import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;

import com.box.sdkgen.parameters.v2026r0.boxversionheaderv2026r0.BoxVersionHeaderV2026R0;
import com.box.sdkgen.serialization.json.EnumWrapper;
import java.util.Map;

public class CreateAutomateWorkflowStartV2026R0Headers {

/** Version header. */
public EnumWrapper<BoxVersionHeaderV2026R0> boxVersion;

/** Extra headers that will be included in the HTTP request. */
public Map<String, String> extraHeaders;

public CreateAutomateWorkflowStartV2026R0Headers() {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(BoxVersionHeaderV2026R0._2026_0);
this.extraHeaders = mapOf();
}

protected CreateAutomateWorkflowStartV2026R0Headers(Builder builder) {
this.boxVersion = builder.boxVersion;
this.extraHeaders = builder.extraHeaders;
}

public EnumWrapper<BoxVersionHeaderV2026R0> getBoxVersion() {
return boxVersion;
}

public Map<String, String> getExtraHeaders() {
return extraHeaders;
}

public static class Builder {

protected EnumWrapper<BoxVersionHeaderV2026R0> boxVersion;

protected Map<String, String> extraHeaders;

public Builder() {}

public Builder boxVersion(BoxVersionHeaderV2026R0 boxVersion) {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(boxVersion);
return this;
}

public Builder boxVersion(EnumWrapper<BoxVersionHeaderV2026R0> boxVersion) {
this.boxVersion = boxVersion;
return this;
}

public Builder extraHeaders(Map<String, String> extraHeaders) {
this.extraHeaders = extraHeaders;
return this;
}

public CreateAutomateWorkflowStartV2026R0Headers build() {
if (this.boxVersion == null) {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(BoxVersionHeaderV2026R0._2026_0);
}
if (this.extraHeaders == null) {
this.extraHeaders = mapOf();
}
return new CreateAutomateWorkflowStartV2026R0Headers(this);
}
}
}
Loading
Loading