Skip to content

Commit

Permalink
feat(transformers): determineIsType (box/box-codegen#148) (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Apr 4, 2024
1 parent c94dbf5 commit 57ccdac
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
@@ -1 +1 @@
{ "engineHash": "a8e8651", "specHash": "1698c95", "version": "0.5.2" }
{ "engineHash": "fd9728e", "specHash": "1698c95", "version": "0.5.2" }
2 changes: 1 addition & 1 deletion docs/search.md
Expand Up @@ -57,7 +57,7 @@ See the endpoint docs at

```ts
await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
mdfilters: [
{
filters: {
Expand Down
4 changes: 2 additions & 2 deletions src/test/auth.generated.test.ts
Expand Up @@ -83,7 +83,7 @@ test('test_jwt_auth', async function test_jwt_auth(): Promise<any> {
const enterpriseAuth: BoxJwtAuth = auth.withEnterpriseSubject(enterpriseId);
const enterpriseClient: BoxClient = new BoxClient({ auth: enterpriseAuth });
const newUser: UserFull = await enterpriseClient.users.getUserMe({
fields: ['enterprise' as ''],
fields: ['enterprise' as string],
} satisfies GetUserMeQueryParams);
if (!!(newUser.enterprise == void 0)) {
throw new Error('Assertion failed');
Expand Down Expand Up @@ -186,7 +186,7 @@ test('test_ccg_auth', async function test_ccg_auth(): Promise<any> {
const enterpriseAuth: BoxCcgAuth = auth.withEnterpriseSubject(enterpriseId);
const enterpriseClient: BoxClient = new BoxClient({ auth: enterpriseAuth });
const newUser: UserFull = await enterpriseClient.users.getUserMe({
fields: ['enterprise' as ''],
fields: ['enterprise' as string],
} satisfies GetUserMeQueryParams);
if (!!(newUser.enterprise == void 0)) {
throw new Error('Assertion failed');
Expand Down
4 changes: 2 additions & 2 deletions src/test/files.generated.test.ts
Expand Up @@ -86,7 +86,7 @@ test('testGetFileFullExtraFields', async function testGetFileFullExtraFields():
const fileStream: ByteStream = generateByteStream(1024 * 1024);
const uploadedFile: FileFull = await uploadFile(newFileName, fileStream);
const file: FileFull = await client.files.getFileById(uploadedFile.id, {
fields: ['is_externally_owned' as '', 'has_collaborations' as ''],
fields: ['is_externally_owned' as string, 'has_collaborations' as string],
} satisfies GetFileByIdQueryParams);
if (!(file.isExternallyOwned == false)) {
throw new Error('Assertion failed');
Expand All @@ -107,7 +107,7 @@ test('testCreateGetAndDeleteFile', async function testCreateGetAndDeleteFile():
await expect(async () => {
await client.files.getFileById(
uploadedFile.id,
{ fields: ['name' as ''] } satisfies GetFileByIdQueryParams,
{ fields: ['name' as string] } satisfies GetFileByIdQueryParams,
new GetFileByIdHeaders({ extraHeaders: { ['if-none-match']: file.etag } })
);
}).rejects.toThrow();
Expand Down
2 changes: 1 addition & 1 deletion src/test/folders.generated.test.ts
Expand Up @@ -45,7 +45,7 @@ test('test_get_folder_info', async function test_get_folder_info(): Promise<any>
});
test('test_get_folder_full_info_with_extra_fields', async function test_get_folder_full_info_with_extra_fields(): Promise<any> {
const rootFolder: FolderFull = await client.folders.getFolderById('0', {
fields: ['has_collaborations' as '', 'tags' as ''],
fields: ['has_collaborations' as string, 'tags' as string],
} satisfies GetFolderByIdQueryParams);
if (!(rootFolder.id == '0')) {
throw new Error('Assertion failed');
Expand Down
7 changes: 6 additions & 1 deletion src/test/groups.generated.test.ts
Expand Up @@ -39,7 +39,12 @@ test('test_create_get_delete_group', async function test_create_get_delete_group
throw new Error('Assertion failed');
}
const groupById: GroupFull = await client.groups.getGroupById(group.id, {
fields: ['id' as '', 'name' as '', 'description' as '', 'group_type' as ''],
fields: [
'id' as string,
'name' as string,
'description' as string,
'group_type' as string,
],
} satisfies GetGroupByIdQueryParams);
if (!(groupById.id == group.id)) {
throw new Error('Assertion failed');
Expand Down
2 changes: 1 addition & 1 deletion src/test/invites.generated.test.ts
Expand Up @@ -31,7 +31,7 @@ test('testInvites', async function testInvites(): Promise<any> {
const userId: string = getEnvVar('USER_ID');
const client: BoxClient = getDefaultClientWithUserSubject(userId);
const currentUser: UserFull = await client.users.getUserMe({
fields: ['enterprise' as ''],
fields: ['enterprise' as string],
} satisfies GetUserMeQueryParams);
const email: string = getEnvVar('BOX_EXTERNAL_USER_EMAIL');
const invitation: Invite = await client.invites.createInvite({
Expand Down
10 changes: 5 additions & 5 deletions src/test/search.generated.test.ts
Expand Up @@ -128,7 +128,7 @@ test('testCreateMetaDataQueryExecuteRead', async function testCreateMetaDataQuer
test('testGetSearch', async function testGetSearch(): Promise<any> {
const keyword: any = 'test';
const search: any = await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
query: keyword,
trashContent:
'non_trashed_only' as SearchForContentQueryParamsTrashContentField,
Expand All @@ -140,7 +140,7 @@ test('testGetSearch', async function testGetSearch(): Promise<any> {
throw new Error('Assertion failed');
}
const searchWithSharedLink: any = await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
query: keyword,
trashContent:
'non_trashed_only' as SearchForContentQueryParamsTrashContentField,
Expand Down Expand Up @@ -229,7 +229,7 @@ test('testMetadataFilters', async function testMetadataFilters(): Promise<any> {
}
);
const stringQuery: any = await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
mdfilters: [
{
filters: { ['stringField']: 'stringValue' },
Expand All @@ -242,7 +242,7 @@ test('testMetadataFilters', async function testMetadataFilters(): Promise<any> {
throw new Error('Assertion failed');
}
const enumQuery: any = await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
mdfilters: [
{
filters: { ['enumField']: 'enumValue2' },
Expand All @@ -255,7 +255,7 @@ test('testMetadataFilters', async function testMetadataFilters(): Promise<any> {
throw new Error('Assertion failed');
}
const multiSelectQuery: any = await client.search.searchForContent({
ancestorFolderIds: ['0' as ''],
ancestorFolderIds: ['0' as string],
mdfilters: [
{
filters: {
Expand Down

0 comments on commit 57ccdac

Please sign in to comment.