Skip to content
Closed
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": "4de40e1", "specHash": "8b85e74", "version": "10.12.0" }
{ "engineHash": "5e9332b", "specHash": "d028758", "version": "10.12.0" }
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 31 additions & 0 deletions docs/notes.md
Original file line number Diff line number Diff line change
@@ -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.


22 changes: 8 additions & 14 deletions src/main/java/com/box/sdkgen/client/BoxClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -1453,8 +1447,8 @@ public AutomateWorkflowsManager getAutomateWorkflows() {
return automateWorkflows;
}

public ConvertMarkdownToBoxNoteManager getConvertMarkdownToBoxNote() {
return convertMarkdownToBoxNote;
public NotesManager getNotes() {
return notes;
}

public static class Builder {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<BoxVersionHeaderV2026R0> boxVersion;

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

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

protected CreateNoteConvertV2026R0Headers(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 CreateNoteConvertV2026R0Headers build() {
if (this.boxVersion == null) {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(BoxVersionHeaderV2026R0._2026_0);
}
if (this.extraHeaders == null) {
this.extraHeaders = mapOf();
}
return new CreateNoteConvertV2026R0Headers(this);
}
}
}
112 changes: 112 additions & 0 deletions src/main/java/com/box/sdkgen/managers/notes/NotesManager.java
Original file line number Diff line number Diff line change
@@ -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<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/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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Loading