diff --git a/.codegen.json b/.codegen.json index d6d0fd01a..77bbcdc02 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "4de40e1", "specHash": "8b85e74", "version": "5.11.0" } +{ "engineHash": "5e9332b", "specHash": "d028758", "version": "5.11.0" } diff --git a/docs/sdkgen/README.md b/docs/sdkgen/README.md index 5dd7a610b..5daeb624b 100644 --- a/docs/sdkgen/README.md +++ b/docs/sdkgen/README.md @@ -62,6 +62,7 @@ the SDK are available by topic: * [Metadatacascadepolicies](metadatacascadepolicies.md) * [Metadatataxonomies](metadatataxonomies.md) * [Metadatatemplates](metadatatemplates.md) +* [Notes](notes.md) * [Recentitems](recentitems.md) * [Retentionpolicies](retentionpolicies.md) * [Retentionpolicyassignments](retentionpolicyassignments.md) diff --git a/docs/sdkgen/notes.md b/docs/sdkgen/notes.md new file mode 100644 index 000000000..b129369ff --- /dev/null +++ b/docs/sdkgen/notes.md @@ -0,0 +1,31 @@ +# NotesManager + + +- [Convert content to Box Note](#convert-content-to-box-note) + +## Convert content to Box Note + +Creates a Box Note (`.boxnote` file) from supported source content. See the `content_format` field for supported formats. + +This operation is performed by calling function `createNoteConvertV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/post-notes-convert/). + +*Currently we don't have an example for calling `createNoteConvertV2026R0` in integration tests* + +### Arguments + +- requestBody `NotesConvertRequestBodyV2026R0` + - Request body of createNoteConvertV2026R0 method +- headers `CreateNoteConvertV2026R0Headers` + - Headers of createNoteConvertV2026R0 method + + +### Returns + +This function returns a value of type `NotesConvertResponseV2026R0`. + +The note was created successfully. + + diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index 4f50eb527..9988474df 100644 --- a/src/main/java/com/box/sdkgen/client/BoxClient.java +++ b/src/main/java/com/box/sdkgen/client/BoxClient.java @@ -16,7 +16,6 @@ import com.box.sdkgen.managers.collaborationallowlistexempttargets.CollaborationAllowlistExemptTargetsManager; import com.box.sdkgen.managers.collections.CollectionsManager; import com.box.sdkgen.managers.comments.CommentsManager; -import com.box.sdkgen.managers.convertmarkdowntoboxnote.ConvertMarkdownToBoxNoteManager; import com.box.sdkgen.managers.devicepinners.DevicePinnersManager; import com.box.sdkgen.managers.docgen.DocgenManager; import com.box.sdkgen.managers.docgentemplate.DocgenTemplateManager; @@ -52,6 +51,7 @@ import com.box.sdkgen.managers.metadatacascadepolicies.MetadataCascadePoliciesManager; import com.box.sdkgen.managers.metadatataxonomies.MetadataTaxonomiesManager; import com.box.sdkgen.managers.metadatatemplates.MetadataTemplatesManager; +import com.box.sdkgen.managers.notes.NotesManager; import com.box.sdkgen.managers.recentitems.RecentItemsManager; import com.box.sdkgen.managers.retentionpolicies.RetentionPoliciesManager; import com.box.sdkgen.managers.retentionpolicyassignments.RetentionPolicyAssignmentsManager; @@ -274,7 +274,7 @@ public class BoxClient { public final AutomateWorkflowsManager automateWorkflows; - public final ConvertMarkdownToBoxNoteManager convertMarkdownToBoxNote; + public final NotesManager notes; public BoxClient(Authentication auth) { this.auth = auth; @@ -629,11 +629,8 @@ public BoxClient(Authentication auth) { .auth(this.auth) .networkSession(this.networkSession) .build(); - this.convertMarkdownToBoxNote = - new ConvertMarkdownToBoxNoteManager.Builder() - .auth(this.auth) - .networkSession(this.networkSession) - .build(); + this.notes = + new NotesManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } protected BoxClient(Builder builder) { @@ -989,11 +986,8 @@ protected BoxClient(Builder builder) { .auth(this.auth) .networkSession(this.networkSession) .build(); - this.convertMarkdownToBoxNote = - new ConvertMarkdownToBoxNoteManager.Builder() - .auth(this.auth) - .networkSession(this.networkSession) - .build(); + this.notes = + new NotesManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } /** @@ -1453,8 +1447,8 @@ public AutomateWorkflowsManager getAutomateWorkflows() { return automateWorkflows; } - public ConvertMarkdownToBoxNoteManager getConvertMarkdownToBoxNote() { - return convertMarkdownToBoxNote; + public NotesManager getNotes() { + return notes; } public static class Builder { diff --git a/src/main/java/com/box/sdkgen/managers/notes/CreateNoteConvertV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/notes/CreateNoteConvertV2026R0Headers.java new file mode 100644 index 000000000..88f920c08 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/notes/CreateNoteConvertV2026R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.notes; + +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 CreateNoteConvertV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public CreateNoteConvertV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected CreateNoteConvertV2026R0Headers(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 CreateNoteConvertV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new CreateNoteConvertV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/notes/NotesManager.java b/src/main/java/com/box/sdkgen/managers/notes/NotesManager.java new file mode 100644 index 000000000..b9bbdd827 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/notes/NotesManager.java @@ -0,0 +1,112 @@ +package com.box.sdkgen.managers.notes; + +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.notesconvertrequestbodyv2026r0.NotesConvertRequestBodyV2026R0; +import com.box.sdkgen.schemas.v2026r0.notesconvertresponsev2026r0.NotesConvertResponseV2026R0; +import com.box.sdkgen.serialization.json.JsonManager; +import java.util.Map; + +public class NotesManager { + + public Authentication auth; + + public NetworkSession networkSession; + + public NotesManager() { + this.networkSession = new NetworkSession(); + } + + protected NotesManager(Builder builder) { + this.auth = builder.auth; + this.networkSession = builder.networkSession; + } + + /** + * Creates a Box Note (`.boxnote` file) from supported source content. See the `content_format` + * field for supported formats. + * + * @param requestBody Request body of createNoteConvertV2026R0 method + */ + public NotesConvertResponseV2026R0 createNoteConvertV2026R0( + NotesConvertRequestBodyV2026R0 requestBody) { + return createNoteConvertV2026R0(requestBody, new CreateNoteConvertV2026R0Headers()); + } + + /** + * Creates a Box Note (`.boxnote` file) from supported source content. See the `content_format` + * field for supported formats. + * + * @param requestBody Request body of createNoteConvertV2026R0 method + * @param headers Headers of createNoteConvertV2026R0 method + */ + public NotesConvertResponseV2026R0 createNoteConvertV2026R0( + NotesConvertRequestBodyV2026R0 requestBody, CreateNoteConvertV2026R0Headers 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/notes/convert"), + "POST") + .headers(headersMap) + .data(JsonManager.serialize(requestBody)) + .contentType("application/json") + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), NotesConvertResponseV2026R0.class); + } + + 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 NotesManager build() { + if (this.networkSession == null) { + this.networkSession = new NetworkSession(); + } + return new NotesManager(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/signrequest/SignRequestStatusField.java b/src/main/java/com/box/sdkgen/schemas/signrequest/SignRequestStatusField.java index 0e513ef86..e94b634b8 100644 --- a/src/main/java/com/box/sdkgen/schemas/signrequest/SignRequestStatusField.java +++ b/src/main/java/com/box/sdkgen/schemas/signrequest/SignRequestStatusField.java @@ -20,6 +20,7 @@ public enum SignRequestStatusField implements Valuable { SIGNED("signed"), CANCELLED("cancelled"), DECLINED("declined"), + ERROR("error"), ERROR_CONVERTING("error_converting"), ERROR_SENDING("error_sending"), EXPIRED("expired"),