Skip to content

feat: use getDiscriminatorsForUnion in generic serialization (box/box-codegen#448) #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2024
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": "bd1adff", "specHash": "b2f7568", "version": "0.5.1" }
{ "engineHash": "183c130", "specHash": "b2f7568", "version": "0.5.1" }
14 changes: 12 additions & 2 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ This operation is performed by calling function `getEvents`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-events/).

_Currently we don't have an example for calling `getEvents` in integration tests_
<!-- sample get_events -->

```ts
await client.events.getEvents({
streamType: 'changes' as GetEventsQueryParamsStreamTypeField,
} satisfies GetEventsQueryParams);
```

### Arguments

Expand Down Expand Up @@ -84,7 +90,11 @@ This operation is performed by calling function `getEventsWithLongPolling`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/options-events/).

_Currently we don't have an example for calling `getEventsWithLongPolling` in integration tests_
<!-- sample options_events -->

```ts
await client.events.getEventsWithLongPolling();
```

### Arguments

Expand Down
66 changes: 62 additions & 4 deletions docs/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ This operation is performed by calling function `getBoxSkillCardsOnFile`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-files-id-metadata-global-box-skills-cards/).

_Currently we don't have an example for calling `getBoxSkillCardsOnFile` in integration tests_
<!-- sample get_files_id_metadata_global_boxSkillsCards -->

```ts
await client.skills.getBoxSkillCardsOnFile(file.id);
```

### Arguments

Expand Down Expand Up @@ -44,7 +48,31 @@ This operation is performed by calling function `createBoxSkillCardsOnFile`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/post-files-id-metadata-global-box-skills-cards/).

_Currently we don't have an example for calling `createBoxSkillCardsOnFile` in integration tests_
<!-- sample post_files_id_metadata_global_boxSkillsCards -->

```ts
await client.skills.createBoxSkillCardsOnFile(file.id, {
cards: [
{
type: 'skill_card' as KeywordSkillCardTypeField,
skillCardType: 'keyword' as KeywordSkillCardSkillCardTypeField,
skillCardTitle: {
code: 'license-plates',
message: titleMessage,
} satisfies KeywordSkillCardSkillCardTitleField,
skill: {
id: skillId,
type: 'service' as KeywordSkillCardSkillTypeField,
} satisfies KeywordSkillCardSkillField,
invocation: {
id: invocationId,
type: 'skill_invocation' as KeywordSkillCardInvocationTypeField,
} satisfies KeywordSkillCardInvocationField,
entries: [{ text: 'DN86 BOX' } satisfies KeywordSkillCardEntriesField],
} satisfies KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard,
],
} satisfies CreateBoxSkillCardsOnFileRequestBody);
```

### Arguments

Expand Down Expand Up @@ -73,7 +101,33 @@ This operation is performed by calling function `updateBoxSkillCardsOnFile`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/put-files-id-metadata-global-box-skills-cards/).

_Currently we don't have an example for calling `updateBoxSkillCardsOnFile` in integration tests_
<!-- sample put_files_id_metadata_global_boxSkillsCards -->

```ts
await client.skills.updateBoxSkillCardsOnFile(file.id, [
{
op: 'replace' as UpdateBoxSkillCardsOnFileRequestBodyOpField,
path: '/cards/0',
value: {
type: 'skill_card' as KeywordSkillCardTypeField,
skillCardType: 'keyword' as KeywordSkillCardSkillCardTypeField,
skillCardTitle: {
code: 'license-plates',
message: updatedTitleMessage,
} satisfies KeywordSkillCardSkillCardTitleField,
skill: {
id: skillId,
type: 'service' as KeywordSkillCardSkillTypeField,
} satisfies KeywordSkillCardSkillField,
invocation: {
id: invocationId,
type: 'skill_invocation' as KeywordSkillCardInvocationTypeField,
} satisfies KeywordSkillCardInvocationField,
entries: [{ text: 'DN86 BOX' } satisfies KeywordSkillCardEntriesField],
} satisfies KeywordSkillCard,
} satisfies UpdateBoxSkillCardsOnFileRequestBody,
]);
```

### Arguments

Expand Down Expand Up @@ -102,7 +156,11 @@ This operation is performed by calling function `deleteBoxSkillCardsFromFile`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/delete-files-id-metadata-global-box-skills-cards/).

_Currently we don't have an example for calling `deleteBoxSkillCardsFromFile` in integration tests_
<!-- sample delete_files_id_metadata_global_boxSkillsCards -->

```ts
await client.skills.deleteBoxSkillCardsFromFile(file.id);
```

### Arguments

Expand Down
10 changes: 3 additions & 7 deletions src/box/jwtAuth.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ export class BoxJwtAuth implements Authentication {
return await this.tokenStorage.clear();
}
}
export function serializeJwtConfigAppSettingsAppAuth(
val: JwtConfigAppSettingsAppAuth
): SerializedData {
export function serializeJwtConfigAppSettingsAppAuth(val: any): SerializedData {
return {
['publicKeyID']: val.publicKeyId,
['privateKey']: val.privateKey,
Expand All @@ -290,9 +288,7 @@ export function deserializeJwtConfigAppSettingsAppAuth(
passphrase: passphrase,
} satisfies JwtConfigAppSettingsAppAuth;
}
export function serializeJwtConfigAppSettings(
val: JwtConfigAppSettings
): SerializedData {
export function serializeJwtConfigAppSettings(val: any): SerializedData {
return {
['clientID']: val.clientId,
['clientSecret']: val.clientSecret,
Expand All @@ -312,7 +308,7 @@ export function deserializeJwtConfigAppSettings(
appAuth: appAuth,
} satisfies JwtConfigAppSettings;
}
export function serializeJwtConfigFile(val: JwtConfigFile): SerializedData {
export function serializeJwtConfigFile(val: any): SerializedData {
return {
['enterpriseID']: val.enterpriseId == void 0 ? void 0 : val.enterpriseId,
['userID']: val.userId == void 0 ? void 0 : val.userId,
Expand Down
2 changes: 1 addition & 1 deletion src/managers/authorization.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class AuthorizationManager {
}
}
export function serializeAuthorizeUserQueryParamsResponseTypeField(
val: AuthorizeUserQueryParamsResponseTypeField
val: any
): SerializedData {
return val;
}
Expand Down
6 changes: 3 additions & 3 deletions src/managers/chunkedUploads.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export class ChunkedUploadsManager {
}
}
export function serializeCreateFileUploadSessionRequestBody(
val: CreateFileUploadSessionRequestBody
val: any
): SerializedData {
return {
['folder_id']: val.folderId,
Expand All @@ -540,7 +540,7 @@ export function deserializeCreateFileUploadSessionRequestBody(
} satisfies CreateFileUploadSessionRequestBody;
}
export function serializeCreateFileUploadSessionForExistingFileRequestBody(
val: CreateFileUploadSessionForExistingFileRequestBody
val: any
): SerializedData {
return {
['file_size']: val.fileSize,
Expand All @@ -559,7 +559,7 @@ export function deserializeCreateFileUploadSessionForExistingFileRequestBody(
} satisfies CreateFileUploadSessionForExistingFileRequestBody;
}
export function serializeCreateFileUploadSessionCommitRequestBody(
val: CreateFileUploadSessionCommitRequestBody
val: any
): SerializedData {
return {
['parts']: val.parts.map(function (item: UploadPart): any {
Expand Down
46 changes: 23 additions & 23 deletions src/managers/classifications.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class ClassificationsManager {
}
}
export function serializeAddClassificationRequestBodyOpField(
val: AddClassificationRequestBodyOpField
val: any
): SerializedData {
return val;
}
Expand All @@ -292,7 +292,7 @@ export function deserializeAddClassificationRequestBodyOpField(
});
}
export function serializeAddClassificationRequestBodyFieldKeyField(
val: AddClassificationRequestBodyFieldKeyField
val: any
): SerializedData {
return val;
}
Expand All @@ -313,7 +313,7 @@ export function deserializeAddClassificationRequestBodyFieldKeyField(
});
}
export function serializeAddClassificationRequestBodyDataStaticConfigClassificationField(
val: AddClassificationRequestBodyDataStaticConfigClassificationField
val: any
): SerializedData {
return {
['classificationDefinition']:
Expand All @@ -338,7 +338,7 @@ export function deserializeAddClassificationRequestBodyDataStaticConfigClassific
} satisfies AddClassificationRequestBodyDataStaticConfigClassificationField;
}
export function serializeAddClassificationRequestBodyDataStaticConfigField(
val: AddClassificationRequestBodyDataStaticConfigField
val: any
): SerializedData {
return {
['classification']:
Expand All @@ -365,7 +365,7 @@ export function deserializeAddClassificationRequestBodyDataStaticConfigField(
} satisfies AddClassificationRequestBodyDataStaticConfigField;
}
export function serializeAddClassificationRequestBodyDataField(
val: AddClassificationRequestBodyDataField
val: any
): SerializedData {
return {
['key']: val.key,
Expand Down Expand Up @@ -395,7 +395,7 @@ export function deserializeAddClassificationRequestBodyDataField(
} satisfies AddClassificationRequestBodyDataField;
}
export function serializeAddClassificationRequestBody(
val: AddClassificationRequestBody
val: any
): SerializedData {
return {
['op']: serializeAddClassificationRequestBodyOpField(val.op),
Expand All @@ -421,7 +421,7 @@ export function deserializeAddClassificationRequestBody(
} satisfies AddClassificationRequestBody;
}
export function serializeUpdateClassificationRequestBodyOpField(
val: UpdateClassificationRequestBodyOpField
val: any
): SerializedData {
return val;
}
Expand All @@ -442,7 +442,7 @@ export function deserializeUpdateClassificationRequestBodyOpField(
});
}
export function serializeUpdateClassificationRequestBodyFieldKeyField(
val: UpdateClassificationRequestBodyFieldKeyField
val: any
): SerializedData {
return val;
}
Expand All @@ -463,7 +463,7 @@ export function deserializeUpdateClassificationRequestBodyFieldKeyField(
});
}
export function serializeUpdateClassificationRequestBodyDataStaticConfigClassificationField(
val: UpdateClassificationRequestBodyDataStaticConfigClassificationField
val: any
): SerializedData {
return {
['classificationDefinition']:
Expand All @@ -488,7 +488,7 @@ export function deserializeUpdateClassificationRequestBodyDataStaticConfigClassi
} satisfies UpdateClassificationRequestBodyDataStaticConfigClassificationField;
}
export function serializeUpdateClassificationRequestBodyDataStaticConfigField(
val: UpdateClassificationRequestBodyDataStaticConfigField
val: any
): SerializedData {
return {
['classification']:
Expand All @@ -515,7 +515,7 @@ export function deserializeUpdateClassificationRequestBodyDataStaticConfigField(
} satisfies UpdateClassificationRequestBodyDataStaticConfigField;
}
export function serializeUpdateClassificationRequestBodyDataField(
val: UpdateClassificationRequestBodyDataField
val: any
): SerializedData {
return {
['key']: val.key,
Expand Down Expand Up @@ -545,7 +545,7 @@ export function deserializeUpdateClassificationRequestBodyDataField(
} satisfies UpdateClassificationRequestBodyDataField;
}
export function serializeUpdateClassificationRequestBody(
val: UpdateClassificationRequestBody
val: any
): SerializedData {
return {
['op']: serializeUpdateClassificationRequestBodyOpField(val.op),
Expand Down Expand Up @@ -574,7 +574,7 @@ export function deserializeUpdateClassificationRequestBody(
} satisfies UpdateClassificationRequestBody;
}
export function serializeCreateClassificationTemplateRequestBodyScopeField(
val: CreateClassificationTemplateRequestBodyScopeField
val: any
): SerializedData {
return val;
}
Expand All @@ -595,7 +595,7 @@ export function deserializeCreateClassificationTemplateRequestBodyScopeField(
});
}
export function serializeCreateClassificationTemplateRequestBodyTemplateKeyField(
val: CreateClassificationTemplateRequestBodyTemplateKeyField
val: any
): SerializedData {
return val;
}
Expand All @@ -616,7 +616,7 @@ export function deserializeCreateClassificationTemplateRequestBodyTemplateKeyFie
});
}
export function serializeCreateClassificationTemplateRequestBodyDisplayNameField(
val: CreateClassificationTemplateRequestBodyDisplayNameField
val: any
): SerializedData {
return val;
}
Expand All @@ -637,7 +637,7 @@ export function deserializeCreateClassificationTemplateRequestBodyDisplayNameFie
});
}
export function serializeCreateClassificationTemplateRequestBodyFieldsTypeField(
val: CreateClassificationTemplateRequestBodyFieldsTypeField
val: any
): SerializedData {
return val;
}
Expand All @@ -658,7 +658,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsTypeFiel
});
}
export function serializeCreateClassificationTemplateRequestBodyFieldsKeyField(
val: CreateClassificationTemplateRequestBodyFieldsKeyField
val: any
): SerializedData {
return val;
}
Expand All @@ -679,7 +679,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsKeyField
});
}
export function serializeCreateClassificationTemplateRequestBodyFieldsDisplayNameField(
val: CreateClassificationTemplateRequestBodyFieldsDisplayNameField
val: any
): SerializedData {
return val;
}
Expand All @@ -700,7 +700,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsDisplayN
});
}
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField(
val: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField
val: any
): SerializedData {
return {
['classificationDefinition']:
Expand All @@ -725,7 +725,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsS
} satisfies CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigClassificationField;
}
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField(
val: CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField
val: any
): SerializedData {
return {
['classification']:
Expand All @@ -752,7 +752,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsS
} satisfies CreateClassificationTemplateRequestBodyFieldsOptionsStaticConfigField;
}
export function serializeCreateClassificationTemplateRequestBodyFieldsOptionsField(
val: CreateClassificationTemplateRequestBodyFieldsOptionsField
val: any
): SerializedData {
return {
['key']: val.key,
Expand Down Expand Up @@ -782,7 +782,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsOptionsF
} satisfies CreateClassificationTemplateRequestBodyFieldsOptionsField;
}
export function serializeCreateClassificationTemplateRequestBodyFieldsField(
val: CreateClassificationTemplateRequestBodyFieldsField
val: any
): SerializedData {
return {
['type']: serializeCreateClassificationTemplateRequestBodyFieldsTypeField(
Expand Down Expand Up @@ -835,7 +835,7 @@ export function deserializeCreateClassificationTemplateRequestBodyFieldsField(
} satisfies CreateClassificationTemplateRequestBodyFieldsField;
}
export function serializeCreateClassificationTemplateRequestBody(
val: CreateClassificationTemplateRequestBody
val: any
): SerializedData {
return {
['scope']: serializeCreateClassificationTemplateRequestBodyScopeField(
Expand Down
Loading