diff --git a/.codegen.json b/.codegen.json index d4c725d3c..9c5a11f97 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "18868e7", "specHash": "d0976fc", "version": "10.9.0" } +{ "engineHash": "18868e7", "specHash": "f899bf6", "version": "10.9.0" } diff --git a/docs/README.md b/docs/README.md index 1dc5612dc..627015873 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) diff --git a/docs/automateworkflows.md b/docs/automateworkflows.md new file mode 100644 index 000000000..f0ec61ecd --- /dev/null +++ b/docs/automateworkflows.md @@ -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. + + diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index e45762637..258a1d7ac 100644 --- a/src/main/java/com/box/sdkgen/client/BoxClient.java +++ b/src/main/java/com/box/sdkgen/client/BoxClient.java @@ -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; @@ -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(); @@ -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) { @@ -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(); } /** @@ -1423,6 +1436,10 @@ public ExternalUsersManager getExternalUsers() { return externalUsers; } + public AutomateWorkflowsManager getAutomateWorkflows() { + return automateWorkflows; + } + public static class Builder { protected final Authentication auth; diff --git a/src/main/java/com/box/sdkgen/managers/automateworkflows/AutomateWorkflowsManager.java b/src/main/java/com/box/sdkgen/managers/automateworkflows/AutomateWorkflowsManager.java new file mode 100644 index 000000000..1331d4147 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/automateworkflows/AutomateWorkflowsManager.java @@ -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 queryParamsMap = + prepareParams( + mapOf( + entryOf("folder_id", convertToString(queryParams.getFolderId())), + entryOf("limit", convertToString(queryParams.getLimit())), + entryOf("marker", convertToString(queryParams.getMarker())))); + Map 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 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); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/automateworkflows/CreateAutomateWorkflowStartV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/automateworkflows/CreateAutomateWorkflowStartV2026R0Headers.java new file mode 100644 index 000000000..3dc5812d4 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/automateworkflows/CreateAutomateWorkflowStartV2026R0Headers.java @@ -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 boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public CreateAutomateWorkflowStartV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected CreateAutomateWorkflowStartV2026R0Headers(Builder builder) { + this.boxVersion = builder.boxVersion; + this.extraHeaders = builder.extraHeaders; + } + + public EnumWrapper getBoxVersion() { + return boxVersion; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class Builder { + + protected EnumWrapper boxVersion; + + protected Map extraHeaders; + + public Builder() {} + + public Builder boxVersion(BoxVersionHeaderV2026R0 boxVersion) { + this.boxVersion = new EnumWrapper(boxVersion); + return this; + } + + public Builder boxVersion(EnumWrapper boxVersion) { + this.boxVersion = boxVersion; + return this; + } + + public Builder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public CreateAutomateWorkflowStartV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new CreateAutomateWorkflowStartV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0Headers.java new file mode 100644 index 000000000..ecd398657 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0Headers.java @@ -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 GetAutomateWorkflowsV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public GetAutomateWorkflowsV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected GetAutomateWorkflowsV2026R0Headers(Builder builder) { + this.boxVersion = builder.boxVersion; + this.extraHeaders = builder.extraHeaders; + } + + public EnumWrapper getBoxVersion() { + return boxVersion; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class Builder { + + protected EnumWrapper boxVersion; + + protected Map extraHeaders; + + public Builder() {} + + public Builder boxVersion(BoxVersionHeaderV2026R0 boxVersion) { + this.boxVersion = new EnumWrapper(boxVersion); + return this; + } + + public Builder boxVersion(EnumWrapper boxVersion) { + this.boxVersion = boxVersion; + return this; + } + + public Builder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public GetAutomateWorkflowsV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new GetAutomateWorkflowsV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0QueryParams.java b/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0QueryParams.java new file mode 100644 index 000000000..a8d9e0e71 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/automateworkflows/GetAutomateWorkflowsV2026R0QueryParams.java @@ -0,0 +1,73 @@ +package com.box.sdkgen.managers.automateworkflows; + +public class GetAutomateWorkflowsV2026R0QueryParams { + + /** + * 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`. + */ + public final String folderId; + + /** The maximum number of items to return per page. */ + public Long limit; + + /** + * Defines the position marker at which to begin returning results. This is used when paginating + * using marker-based pagination. + */ + public String marker; + + public GetAutomateWorkflowsV2026R0QueryParams(String folderId) { + this.folderId = folderId; + } + + protected GetAutomateWorkflowsV2026R0QueryParams(Builder builder) { + this.folderId = builder.folderId; + this.limit = builder.limit; + this.marker = builder.marker; + } + + public String getFolderId() { + return folderId; + } + + public Long getLimit() { + return limit; + } + + public String getMarker() { + return marker; + } + + public static class Builder { + + protected final String folderId; + + protected Long limit; + + protected String marker; + + public Builder(String folderId) { + this.folderId = folderId; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public Builder marker(String marker) { + this.marker = marker; + return this; + } + + public GetAutomateWorkflowsV2026R0QueryParams build() { + return new GetAutomateWorkflowsV2026R0QueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/parameters/v2026r0/boxversionheaderv2026r0/BoxVersionHeaderV2026R0.java b/src/main/java/com/box/sdkgen/parameters/v2026r0/boxversionheaderv2026r0/BoxVersionHeaderV2026R0.java new file mode 100644 index 000000000..dd9ff088e --- /dev/null +++ b/src/main/java/com/box/sdkgen/parameters/v2026r0/boxversionheaderv2026r0/BoxVersionHeaderV2026R0.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.parameters.v2026r0.boxversionheaderv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum BoxVersionHeaderV2026R0 implements Valuable { + _2026_0("2026.0"); + + private final String value; + + BoxVersionHeaderV2026R0(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class BoxVersionHeaderV2026R0Deserializer + extends JsonDeserializer> { + + public BoxVersionHeaderV2026R0Deserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(BoxVersionHeaderV2026R0.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class BoxVersionHeaderV2026R0Serializer + extends JsonSerializer> { + + public BoxVersionHeaderV2026R0Serializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0.java new file mode 100644 index 000000000..7aa4ee62d --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0.java @@ -0,0 +1,286 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowactionv2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.internal.utils.DateTimeUtils; +import com.box.sdkgen.schemas.v2026r0.automateworkflowreferencev2026r0.AutomateWorkflowReferenceV2026R0; +import com.box.sdkgen.schemas.v2026r0.userminiv2026r0.UserMiniV2026R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** An Automate action that can start a workflow. */ +@JsonFilter("nullablePropertyFilter") +public class AutomateWorkflowActionV2026R0 extends SerializableObject { + + /** The identifier for the Automate action. */ + protected final String id; + + /** The object type for this workflow action wrapper. */ + @JsonDeserialize( + using = + AutomateWorkflowActionV2026R0TypeField.AutomateWorkflowActionV2026R0TypeFieldDeserializer + .class) + @JsonSerialize( + using = + AutomateWorkflowActionV2026R0TypeField.AutomateWorkflowActionV2026R0TypeFieldSerializer + .class) + protected EnumWrapper type; + + /** The type that defines the behavior of this action. */ + @JsonDeserialize( + using = + AutomateWorkflowActionV2026R0ActionTypeField + .AutomateWorkflowActionV2026R0ActionTypeFieldDeserializer.class) + @JsonSerialize( + using = + AutomateWorkflowActionV2026R0ActionTypeField + .AutomateWorkflowActionV2026R0ActionTypeFieldSerializer.class) + @JsonProperty("action_type") + protected EnumWrapper actionType; + + /** A human-readable description of the workflow action. */ + protected String description; + + /** The date and time when the action was created. */ + @JsonProperty("created_at") + @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) + @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) + protected OffsetDateTime createdAt; + + /** The date and time when the action was last updated. */ + @JsonProperty("updated_at") + @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) + @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) + protected OffsetDateTime updatedAt; + + @JsonProperty("created_by") + protected UserMiniV2026R0 createdBy; + + @JsonProperty("updated_by") + protected UserMiniV2026R0 updatedBy; + + protected final AutomateWorkflowReferenceV2026R0 workflow; + + public AutomateWorkflowActionV2026R0( + @JsonProperty("id") String id, + @JsonProperty("workflow") AutomateWorkflowReferenceV2026R0 workflow) { + super(); + this.id = id; + this.workflow = workflow; + this.type = + new EnumWrapper( + AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION); + this.actionType = + new EnumWrapper( + AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW); + } + + protected AutomateWorkflowActionV2026R0(Builder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + this.actionType = builder.actionType; + this.description = builder.description; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.createdBy = builder.createdBy; + this.updatedBy = builder.updatedBy; + this.workflow = builder.workflow; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public EnumWrapper getType() { + return type; + } + + public EnumWrapper getActionType() { + return actionType; + } + + public String getDescription() { + return description; + } + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public UserMiniV2026R0 getCreatedBy() { + return createdBy; + } + + public UserMiniV2026R0 getUpdatedBy() { + return updatedBy; + } + + public AutomateWorkflowReferenceV2026R0 getWorkflow() { + return workflow; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomateWorkflowActionV2026R0 casted = (AutomateWorkflowActionV2026R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(actionType, casted.actionType) + && Objects.equals(description, casted.description) + && Objects.equals(createdAt, casted.createdAt) + && Objects.equals(updatedAt, casted.updatedAt) + && Objects.equals(createdBy, casted.createdBy) + && Objects.equals(updatedBy, casted.updatedBy) + && Objects.equals(workflow, casted.workflow); + } + + @Override + public int hashCode() { + return Objects.hash( + id, type, actionType, description, createdAt, updatedAt, createdBy, updatedBy, workflow); + } + + @Override + public String toString() { + return "AutomateWorkflowActionV2026R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "actionType='" + + actionType + + '\'' + + ", " + + "description='" + + description + + '\'' + + ", " + + "createdAt='" + + createdAt + + '\'' + + ", " + + "updatedAt='" + + updatedAt + + '\'' + + ", " + + "createdBy='" + + createdBy + + '\'' + + ", " + + "updatedBy='" + + updatedBy + + '\'' + + ", " + + "workflow='" + + workflow + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected EnumWrapper type; + + protected EnumWrapper actionType; + + protected String description; + + protected OffsetDateTime createdAt; + + protected OffsetDateTime updatedAt; + + protected UserMiniV2026R0 createdBy; + + protected UserMiniV2026R0 updatedBy; + + protected final AutomateWorkflowReferenceV2026R0 workflow; + + public Builder(String id, AutomateWorkflowReferenceV2026R0 workflow) { + super(); + this.id = id; + this.workflow = workflow; + } + + public Builder type(AutomateWorkflowActionV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder actionType(AutomateWorkflowActionV2026R0ActionTypeField actionType) { + this.actionType = new EnumWrapper(actionType); + return this; + } + + public Builder actionType( + EnumWrapper actionType) { + this.actionType = actionType; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder createdBy(UserMiniV2026R0 createdBy) { + this.createdBy = createdBy; + return this; + } + + public Builder updatedBy(UserMiniV2026R0 updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + public AutomateWorkflowActionV2026R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION); + } + if (this.actionType == null) { + this.actionType = + new EnumWrapper( + AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW); + } + return new AutomateWorkflowActionV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0ActionTypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0ActionTypeField.java new file mode 100644 index 000000000..9cc99cc08 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0ActionTypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowactionv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AutomateWorkflowActionV2026R0ActionTypeField implements Valuable { + RUN_WORKFLOW("run_workflow"); + + private final String value; + + AutomateWorkflowActionV2026R0ActionTypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class AutomateWorkflowActionV2026R0ActionTypeFieldDeserializer + extends JsonDeserializer> { + + public AutomateWorkflowActionV2026R0ActionTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AutomateWorkflowActionV2026R0ActionTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AutomateWorkflowActionV2026R0ActionTypeFieldSerializer + extends JsonSerializer> { + + public AutomateWorkflowActionV2026R0ActionTypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0TypeField.java new file mode 100644 index 000000000..09d089a71 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowactionv2026r0/AutomateWorkflowActionV2026R0TypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowactionv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AutomateWorkflowActionV2026R0TypeField implements Valuable { + WORKFLOW_ACTION("workflow_action"); + + private final String value; + + AutomateWorkflowActionV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class AutomateWorkflowActionV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public AutomateWorkflowActionV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AutomateWorkflowActionV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AutomateWorkflowActionV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public AutomateWorkflowActionV2026R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0.java new file mode 100644 index 000000000..4282c643e --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0.java @@ -0,0 +1,134 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowreferencev2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A reference to an Automate workflow. */ +@JsonFilter("nullablePropertyFilter") +public class AutomateWorkflowReferenceV2026R0 extends SerializableObject { + + /** The identifier for the Automate workflow instance. */ + protected final String id; + + /** The object type. */ + @JsonDeserialize( + using = + AutomateWorkflowReferenceV2026R0TypeField + .AutomateWorkflowReferenceV2026R0TypeFieldDeserializer.class) + @JsonSerialize( + using = + AutomateWorkflowReferenceV2026R0TypeField + .AutomateWorkflowReferenceV2026R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** The display name for the Automate workflow. */ + protected String name; + + public AutomateWorkflowReferenceV2026R0(@JsonProperty("id") String id) { + super(); + this.id = id; + this.type = + new EnumWrapper( + AutomateWorkflowReferenceV2026R0TypeField.WORKFLOW); + } + + protected AutomateWorkflowReferenceV2026R0(Builder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + this.name = builder.name; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public EnumWrapper getType() { + return type; + } + + public String getName() { + return name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomateWorkflowReferenceV2026R0 casted = (AutomateWorkflowReferenceV2026R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(name, casted.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, name); + } + + @Override + public String toString() { + return "AutomateWorkflowReferenceV2026R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "name='" + + name + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected EnumWrapper type; + + protected String name; + + public Builder(String id) { + super(); + this.id = id; + } + + public Builder type(AutomateWorkflowReferenceV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public AutomateWorkflowReferenceV2026R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + AutomateWorkflowReferenceV2026R0TypeField.WORKFLOW); + } + return new AutomateWorkflowReferenceV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0TypeField.java new file mode 100644 index 000000000..b58362544 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowreferencev2026r0/AutomateWorkflowReferenceV2026R0TypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowreferencev2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AutomateWorkflowReferenceV2026R0TypeField implements Valuable { + WORKFLOW("workflow"); + + private final String value; + + AutomateWorkflowReferenceV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class AutomateWorkflowReferenceV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public AutomateWorkflowReferenceV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AutomateWorkflowReferenceV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AutomateWorkflowReferenceV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public AutomateWorkflowReferenceV2026R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowstartrequestv2026r0/AutomateWorkflowStartRequestV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowstartrequestv2026r0/AutomateWorkflowStartRequestV2026R0.java new file mode 100644 index 000000000..ea5a8bd4f --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowstartrequestv2026r0/AutomateWorkflowStartRequestV2026R0.java @@ -0,0 +1,67 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowstartrequestv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** Request body to start an Automate workflow. */ +@JsonFilter("nullablePropertyFilter") +public class AutomateWorkflowStartRequestV2026R0 extends SerializableObject { + + /** The callable action ID used to trigger the selected workflow. */ + @JsonProperty("workflow_action_id") + protected final String workflowActionId; + + /** The files to process with the selected workflow. */ + @JsonProperty("file_ids") + protected final List fileIds; + + public AutomateWorkflowStartRequestV2026R0( + @JsonProperty("workflow_action_id") String workflowActionId, + @JsonProperty("file_ids") List fileIds) { + super(); + this.workflowActionId = workflowActionId; + this.fileIds = fileIds; + } + + public String getWorkflowActionId() { + return workflowActionId; + } + + public List getFileIds() { + return fileIds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomateWorkflowStartRequestV2026R0 casted = (AutomateWorkflowStartRequestV2026R0) o; + return Objects.equals(workflowActionId, casted.workflowActionId) + && Objects.equals(fileIds, casted.fileIds); + } + + @Override + public int hashCode() { + return Objects.hash(workflowActionId, fileIds); + } + + @Override + public String toString() { + return "AutomateWorkflowStartRequestV2026R0{" + + "workflowActionId='" + + workflowActionId + + '\'' + + ", " + + "fileIds='" + + fileIds + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowsv2026r0/AutomateWorkflowsV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowsv2026r0/AutomateWorkflowsV2026R0.java new file mode 100644 index 000000000..aef0d9c47 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/automateworkflowsv2026r0/AutomateWorkflowsV2026R0.java @@ -0,0 +1,118 @@ +package com.box.sdkgen.schemas.v2026r0.automateworkflowsv2026r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.automateworkflowactionv2026r0.AutomateWorkflowActionV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** A list of Automate workflow actions. */ +@JsonFilter("nullablePropertyFilter") +public class AutomateWorkflowsV2026R0 extends SerializableObject { + + /** Workflow actions available for manual start. */ + protected List entries; + + /** + * 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. + */ + protected Long limit; + + /** The marker for the start of the next page of results. */ + @JsonProperty("next_marker") + @Nullable + protected String nextMarker; + + public AutomateWorkflowsV2026R0() { + super(); + } + + protected AutomateWorkflowsV2026R0(Builder builder) { + super(); + this.entries = builder.entries; + this.limit = builder.limit; + this.nextMarker = builder.nextMarker; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public List getEntries() { + return entries; + } + + public Long getLimit() { + return limit; + } + + public String getNextMarker() { + return nextMarker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomateWorkflowsV2026R0 casted = (AutomateWorkflowsV2026R0) o; + return Objects.equals(entries, casted.entries) + && Objects.equals(limit, casted.limit) + && Objects.equals(nextMarker, casted.nextMarker); + } + + @Override + public int hashCode() { + return Objects.hash(entries, limit, nextMarker); + } + + @Override + public String toString() { + return "AutomateWorkflowsV2026R0{" + + "entries='" + + entries + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected List entries; + + protected Long limit; + + protected String nextMarker; + + public Builder entries(List entries) { + this.entries = entries; + return this; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public Builder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + this.markNullableFieldAsSet("next_marker"); + return this; + } + + public AutomateWorkflowsV2026R0 build() { + return new AutomateWorkflowsV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0.java new file mode 100644 index 000000000..1d708e58f --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0.java @@ -0,0 +1,218 @@ +package com.box.sdkgen.schemas.v2026r0.clienterrorv2026r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Map; +import java.util.Objects; + +/** A generic error. */ +@JsonFilter("nullablePropertyFilter") +public class ClientErrorV2026R0 extends SerializableObject { + + /** The value will always be `error`. */ + @JsonDeserialize( + using = ClientErrorV2026R0TypeField.ClientErrorV2026R0TypeFieldDeserializer.class) + @JsonSerialize(using = ClientErrorV2026R0TypeField.ClientErrorV2026R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** The HTTP status of the response. */ + protected Integer status; + + /** A Box-specific error code. */ + @JsonDeserialize( + using = ClientErrorV2026R0CodeField.ClientErrorV2026R0CodeFieldDeserializer.class) + @JsonSerialize(using = ClientErrorV2026R0CodeField.ClientErrorV2026R0CodeFieldSerializer.class) + protected EnumWrapper code; + + /** A short message describing the error. */ + protected String message; + + /** + * A free-form object that contains additional context about the error. The possible fields are + * defined on a per-endpoint basis. `message` is only one example. + */ + @JsonProperty("context_info") + @Nullable + protected Map contextInfo; + + /** A URL that links to more information about why this error occurred. */ + @JsonProperty("help_url") + protected String helpUrl; + + /** A unique identifier for this response, which can be used when contacting Box support. */ + @JsonProperty("request_id") + protected String requestId; + + public ClientErrorV2026R0() { + super(); + } + + protected ClientErrorV2026R0(Builder builder) { + super(); + this.type = builder.type; + this.status = builder.status; + this.code = builder.code; + this.message = builder.message; + this.contextInfo = builder.contextInfo; + this.helpUrl = builder.helpUrl; + this.requestId = builder.requestId; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + public Integer getStatus() { + return status; + } + + public EnumWrapper getCode() { + return code; + } + + public String getMessage() { + return message; + } + + public Map getContextInfo() { + return contextInfo; + } + + public String getHelpUrl() { + return helpUrl; + } + + public String getRequestId() { + return requestId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientErrorV2026R0 casted = (ClientErrorV2026R0) o; + return Objects.equals(type, casted.type) + && Objects.equals(status, casted.status) + && Objects.equals(code, casted.code) + && Objects.equals(message, casted.message) + && Objects.equals(contextInfo, casted.contextInfo) + && Objects.equals(helpUrl, casted.helpUrl) + && Objects.equals(requestId, casted.requestId); + } + + @Override + public int hashCode() { + return Objects.hash(type, status, code, message, contextInfo, helpUrl, requestId); + } + + @Override + public String toString() { + return "ClientErrorV2026R0{" + + "type='" + + type + + '\'' + + ", " + + "status='" + + status + + '\'' + + ", " + + "code='" + + code + + '\'' + + ", " + + "message='" + + message + + '\'' + + ", " + + "contextInfo='" + + contextInfo + + '\'' + + ", " + + "helpUrl='" + + helpUrl + + '\'' + + ", " + + "requestId='" + + requestId + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected EnumWrapper type; + + protected Integer status; + + protected EnumWrapper code; + + protected String message; + + protected Map contextInfo; + + protected String helpUrl; + + protected String requestId; + + public Builder type(ClientErrorV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder status(Integer status) { + this.status = status; + return this; + } + + public Builder code(ClientErrorV2026R0CodeField code) { + this.code = new EnumWrapper(code); + return this; + } + + public Builder code(EnumWrapper code) { + this.code = code; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder contextInfo(Map contextInfo) { + this.contextInfo = contextInfo; + this.markNullableFieldAsSet("context_info"); + return this; + } + + public Builder helpUrl(String helpUrl) { + this.helpUrl = helpUrl; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = requestId; + return this; + } + + public ClientErrorV2026R0 build() { + return new ClientErrorV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0CodeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0CodeField.java new file mode 100644 index 000000000..9dbaed6e6 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0CodeField.java @@ -0,0 +1,80 @@ +package com.box.sdkgen.schemas.v2026r0.clienterrorv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum ClientErrorV2026R0CodeField implements Valuable { + CREATED("created"), + ACCEPTED("accepted"), + NO_CONTENT("no_content"), + REDIRECT("redirect"), + NOT_MODIFIED("not_modified"), + BAD_REQUEST("bad_request"), + UNAUTHORIZED("unauthorized"), + FORBIDDEN("forbidden"), + NOT_FOUND("not_found"), + METHOD_NOT_ALLOWED("method_not_allowed"), + CONFLICT("conflict"), + PRECONDITION_FAILED("precondition_failed"), + TOO_MANY_REQUESTS("too_many_requests"), + INTERNAL_SERVER_ERROR("internal_server_error"), + UNAVAILABLE("unavailable"), + ITEM_NAME_INVALID("item_name_invalid"), + INSUFFICIENT_SCOPE("insufficient_scope"); + + private final String value; + + ClientErrorV2026R0CodeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class ClientErrorV2026R0CodeFieldDeserializer + extends JsonDeserializer> { + + public ClientErrorV2026R0CodeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(ClientErrorV2026R0CodeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class ClientErrorV2026R0CodeFieldSerializer + extends JsonSerializer> { + + public ClientErrorV2026R0CodeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0TypeField.java new file mode 100644 index 000000000..af50b2901 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/clienterrorv2026r0/ClientErrorV2026R0TypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.clienterrorv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum ClientErrorV2026R0TypeField implements Valuable { + ERROR("error"); + + private final String value; + + ClientErrorV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class ClientErrorV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public ClientErrorV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(ClientErrorV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class ClientErrorV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public ClientErrorV2026R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0.java new file mode 100644 index 000000000..da9c46662 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0.java @@ -0,0 +1,95 @@ +package com.box.sdkgen.schemas.v2026r0.userbasev2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A mini representation of a user, used when nested within another resource. */ +@JsonFilter("nullablePropertyFilter") +public class UserBaseV2026R0 extends SerializableObject { + + /** The unique identifier for this user. */ + protected final String id; + + /** The value will always be `user`. */ + @JsonDeserialize(using = UserBaseV2026R0TypeField.UserBaseV2026R0TypeFieldDeserializer.class) + @JsonSerialize(using = UserBaseV2026R0TypeField.UserBaseV2026R0TypeFieldSerializer.class) + protected EnumWrapper type; + + public UserBaseV2026R0(@JsonProperty("id") String id) { + super(); + this.id = id; + this.type = new EnumWrapper(UserBaseV2026R0TypeField.USER); + } + + protected UserBaseV2026R0(Builder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public EnumWrapper getType() { + return type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserBaseV2026R0 casted = (UserBaseV2026R0) o; + return Objects.equals(id, casted.id) && Objects.equals(type, casted.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + return "UserBaseV2026R0{" + "id='" + id + '\'' + ", " + "type='" + type + '\'' + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected EnumWrapper type; + + public Builder(String id) { + super(); + this.id = id; + } + + public Builder type(UserBaseV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public UserBaseV2026R0 build() { + if (this.type == null) { + this.type = new EnumWrapper(UserBaseV2026R0TypeField.USER); + } + return new UserBaseV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0TypeField.java new file mode 100644 index 000000000..b72792999 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/userbasev2026r0/UserBaseV2026R0TypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.userbasev2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum UserBaseV2026R0TypeField implements Valuable { + USER("user"); + + private final String value; + + UserBaseV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class UserBaseV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public UserBaseV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(UserBaseV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class UserBaseV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public UserBaseV2026R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/userminiv2026r0/UserMiniV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/userminiv2026r0/UserMiniV2026R0.java new file mode 100644 index 000000000..89f28428a --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/userminiv2026r0/UserMiniV2026R0.java @@ -0,0 +1,119 @@ +package com.box.sdkgen.schemas.v2026r0.userminiv2026r0; + +import com.box.sdkgen.schemas.v2026r0.userbasev2026r0.UserBaseV2026R0; +import com.box.sdkgen.schemas.v2026r0.userbasev2026r0.UserBaseV2026R0TypeField; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** A mini representation of a user, as can be returned when nested within other resources. */ +@JsonFilter("nullablePropertyFilter") +public class UserMiniV2026R0 extends UserBaseV2026R0 { + + /** The display name of this user. */ + protected String name; + + /** The primary email address of this user. */ + protected String login; + + public UserMiniV2026R0(@JsonProperty("id") String id) { + super(id); + } + + protected UserMiniV2026R0(Builder builder) { + super(builder); + this.name = builder.name; + this.login = builder.login; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getName() { + return name; + } + + public String getLogin() { + return login; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMiniV2026R0 casted = (UserMiniV2026R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(name, casted.name) + && Objects.equals(login, casted.login); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, name, login); + } + + @Override + public String toString() { + return "UserMiniV2026R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "name='" + + name + + '\'' + + ", " + + "login='" + + login + + '\'' + + "}"; + } + + public static class Builder extends UserBaseV2026R0.Builder { + + protected String name; + + protected String login; + + public Builder(String id) { + super(id); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder login(String login) { + this.login = login; + return this; + } + + @Override + public Builder type(UserBaseV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + @Override + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public UserMiniV2026R0 build() { + if (this.type == null) { + this.type = new EnumWrapper(UserBaseV2026R0TypeField.USER); + } + return new UserMiniV2026R0(this); + } + } +}