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": "5e9332b", "specHash": "d028758", "version": "4.10.0" }
{ "engineHash": "5a7add6", "specHash": "d028758", "version": "4.10.0" }
5 changes: 4 additions & 1 deletion docs/sdk-gen/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ 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*
<!-- sample post_notes_convert_v2026.0 -->
```ts
await downscopedClient.notes.createNoteConvertV2026R0({ content: markdownContent, contentFormat: "markdown" as NotesConvertRequestBodyV2026R0ContentFormatField, parent: new FolderReferenceV2026R0({ id: "0" }), name: noteName } satisfies NotesConvertRequestBodyV2026R0Input)
```

### Arguments

Expand Down
70 changes: 70 additions & 0 deletions tests/sdk-gen/notes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { serializeNotesConvertResponseV2026R0 } from '@/schemas/v2026R0/notesConvertResponseV2026R0';
import { deserializeNotesConvertResponseV2026R0 } from '@/schemas/v2026R0/notesConvertResponseV2026R0';
import { serializeNotesConvertRequestBodyV2026R0 } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { deserializeNotesConvertRequestBodyV2026R0 } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { serializeNotesConvertRequestBodyV2026R0ContentFormatField } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { deserializeNotesConvertRequestBodyV2026R0ContentFormatField } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { serializeFolderReferenceV2026R0 } from '@/schemas/v2026R0/folderReferenceV2026R0';
import { deserializeFolderReferenceV2026R0 } from '@/schemas/v2026R0/folderReferenceV2026R0';
import { serializeFileFull } from '@/schemas/fileFull';
import { deserializeFileFull } from '@/schemas/fileFull';
import { NotesConvertRequestBodyV2026R0Input } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { AccessToken } from '@/schemas/accessToken';
import { NotesConvertResponseV2026R0 } from '@/schemas/v2026R0/notesConvertResponseV2026R0';
import { NotesConvertRequestBodyV2026R0 } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { NotesConvertRequestBodyV2026R0ContentFormatField } from '@/schemas/v2026R0/notesConvertRequestBodyV2026R0';
import { FolderReferenceV2026R0 } from '@/schemas/v2026R0/folderReferenceV2026R0';
import { FileFull } from '@/schemas/fileFull';
import { getUuid } from '@/internal/utils';
import { getEnvVar } from '@/internal/utils';
import { BoxClient } from '@/client';
import { BoxDeveloperTokenAuth } from '@/box/developerTokenAuth';
import { getDefaultClientWithUserSubject } from './commons';
import { toString } from '@/internal/utils';
import { sdToJson } from '@/serialization/json';
import { SerializedData } from '@/serialization/json';
import { sdIsEmpty } from '@/serialization/json';
import { sdIsBoolean } from '@/serialization/json';
import { sdIsNumber } from '@/serialization/json';
import { sdIsString } from '@/serialization/json';
import { sdIsList } from '@/serialization/json';
import { sdIsMap } from '@/serialization/json';
export const client: BoxClient = getDefaultClientWithUserSubject(
getEnvVar('USER_ID')
);
test('testConvertMarkdownToBoxNote', async function testConvertMarkdownToBoxNote(): Promise<any> {
const noteName: string = getUuid();
const markdownContent: string = '# Heading\\n\\nSome text';
const downscopedToken: AccessToken = await client.auth.downscopeToken(
['item_upload'],
void 0,
void 0,
void 0
);
const downscopedClient: BoxClient = new BoxClient({
auth: new BoxDeveloperTokenAuth({ token: downscopedToken.accessToken! }),
});
const response: NotesConvertResponseV2026R0 =
await downscopedClient.notes.createNoteConvertV2026R0({
content: markdownContent,
contentFormat:
'markdown' as NotesConvertRequestBodyV2026R0ContentFormatField,
parent: new FolderReferenceV2026R0({ id: '0' }),
name: noteName,
} satisfies NotesConvertRequestBodyV2026R0Input);
if (!!(response.id == '')) {
throw new Error('Assertion failed');
}
if (!((toString(response.type) as string) == 'file')) {
throw new Error('Assertion failed');
}
const file: FileFull = await client.files.getFileById(response.id);
if (!(file.name == (''.concat(noteName, '.boxnote') as string))) {
throw new Error('Assertion failed');
}
if (!(file.parent!.id == '0')) {
throw new Error('Assertion failed');
}
await client.files.deleteFileById(response.id);
});
export {};
Loading