Skip to content

Commit eb98236

Browse files
feat: Support common union fields and implicit union conversion (box/box-codegen#758) (#361)
1 parent 426763c commit eb98236

File tree

125 files changed

+4010
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4010
-495
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "fe48a56", "specHash": "8402463", "version": "0.7.0" }
1+
{ "engineHash": "ba4dd3b", "specHash": "8402463", "version": "0.7.0" }

docs/ai.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ See the endpoint docs at
1818

1919
<!-- sample post_ai_ask -->
2020
```
21-
client.getAi().createAiAsk(new AiAsk(AiAskModeField.SINGLE_ITEM_QA, "which direction sun rises", Arrays.asList(new AiItemAsk.Builder(fileToAsk.getId(), AiItemAskTypeField.FILE).content("Sun rises in the East").build())))
21+
client.getAi().createAiAsk(new AiAsk.Builder(AiAskModeField.SINGLE_ITEM_QA, "which direction sun rises", Arrays.asList(new AiItemAsk.Builder(fileToAsk.getId(), AiItemAskTypeField.FILE).content("Sun rises in the East").build())).aiAgent(aiAskAgentConfig).build())
2222
```
2323

2424
### Arguments
@@ -47,7 +47,7 @@ See the endpoint docs at
4747

4848
<!-- sample post_ai_text_gen -->
4949
```
50-
client.getAi().createAiTextGen(new AiTextGen.Builder("Parapharse the document.s", Arrays.asList(new AiTextGenItemsField.Builder(fileToAsk.getId()).type(AiTextGenItemsTypeField.FILE).content("The Earth goes around the sun. Sun rises in the East in the morning.").build())).dialogueHistory(Arrays.asList(new AiDialogueHistory.Builder().prompt("What does the earth go around?").answer("The sun").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build(), new AiDialogueHistory.Builder().prompt("On Earth, where does the sun rise?").answer("East").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build())).build())
50+
client.getAi().createAiTextGen(new AiTextGen.Builder("Parapharse the document.s", Arrays.asList(new AiTextGenItemsField.Builder(fileToAsk.getId()).type(AiTextGenItemsTypeField.FILE).content("The Earth goes around the sun. Sun rises in the East in the morning.").build())).dialogueHistory(Arrays.asList(new AiDialogueHistory.Builder().prompt("What does the earth go around?").answer("The sun").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build(), new AiDialogueHistory.Builder().prompt("On Earth, where does the sun rise?").answer("East").createdAt(dateTimeFromString("2021-01-01T00:00:00Z")).build())).aiAgent(aiTextGenAgentConfig).build())
5151
```
5252

5353
### Arguments
@@ -113,7 +113,7 @@ See the endpoint docs at
113113

114114
<!-- sample post_ai_extract -->
115115
```
116-
client.getAi().createAiExtract(new AiExtract("firstName, lastName, location, yearOfBirth, company", Arrays.asList(new AiItemBase(file.getId()))))
116+
client.getAi().createAiExtract(new AiExtract.Builder("firstName, lastName, location, yearOfBirth, company", Arrays.asList(new AiItemBase(file.getId()))).aiAgent(agentIgnoringOverridingEmbeddingsModel).build())
117117
```
118118

119119
### Arguments
@@ -146,7 +146,7 @@ See the endpoint docs at
146146

147147
<!-- sample post_ai_extract_structured -->
148148
```
149-
client.getAi().createAiExtractStructured(new AiExtractStructured.Builder(Arrays.asList(new AiItemBase(file.getId()))).fields(Arrays.asList(new AiExtractStructuredFieldsField.Builder("firstName").description("Person first name").displayName("First name").prompt("What is the your first name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("lastName").description("Person last name").displayName("Last name").prompt("What is the your last name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("dateOfBirth").description("Person date of birth").displayName("Birth date").prompt("What is the date of your birth?").type("date").build(), new AiExtractStructuredFieldsField.Builder("age").description("Person age").displayName("Age").prompt("How old are you?").type("float").build(), new AiExtractStructuredFieldsField.Builder("hobby").description("Person hobby").displayName("Hobby").prompt("What is your hobby?").type("multiSelect").options(Arrays.asList(new AiExtractStructuredFieldsOptionsField("guitar"), new AiExtractStructuredFieldsOptionsField("books"))).build())).build())
149+
client.getAi().createAiExtractStructured(new AiExtractStructured.Builder(Arrays.asList(new AiItemBase(file.getId()))).fields(Arrays.asList(new AiExtractStructuredFieldsField.Builder("firstName").description("Person first name").displayName("First name").prompt("What is the your first name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("lastName").description("Person last name").displayName("Last name").prompt("What is the your last name?").type("string").build(), new AiExtractStructuredFieldsField.Builder("dateOfBirth").description("Person date of birth").displayName("Birth date").prompt("What is the date of your birth?").type("date").build(), new AiExtractStructuredFieldsField.Builder("age").description("Person age").displayName("Age").prompt("How old are you?").type("float").build(), new AiExtractStructuredFieldsField.Builder("hobby").description("Person hobby").displayName("Hobby").prompt("What is your hobby?").type("multiSelect").options(Arrays.asList(new AiExtractStructuredFieldsOptionsField("guitar"), new AiExtractStructuredFieldsOptionsField("books"))).build())).aiAgent(agentIgnoringOverridingEmbeddingsModel).build())
150150
```
151151

152152
### Arguments

docs/filemetadata.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ See the endpoint docs at
9090

9191
<!-- sample post_files_id_metadata_id_id -->
9292
```
93-
client.getFileMetadata().createFileMetadataById(file.getId(), CreateFileMetadataByIdScope.GLOBAL, "properties", mapOf(entryOf("abc", "xyz")))
93+
client.getFileMetadata().createFileMetadataById(file.getId(), CreateFileMetadataByIdScope.ENTERPRISE, templateKey, mapOf(entryOf("name", "John"), entryOf("age", 23), entryOf("birthDate", "2001-01-03T02:20:50.520Z"), entryOf("countryCode", "US"), entryOf("sports", Arrays.asList("basketball", "tennis"))))
9494
```
9595

9696
### Arguments
@@ -131,7 +131,10 @@ This operation is performed by calling function `updateFileMetadataById`.
131131
See the endpoint docs at
132132
[API Reference](https://developer.box.com/reference/put-files-id-metadata-id-id/).
133133

134-
*Currently we don't have an example for calling `updateFileMetadataById` in integration tests*
134+
<!-- sample put_files_id_metadata_id_id -->
135+
```
136+
client.getFileMetadata().updateFileMetadataById(file.getId(), UpdateFileMetadataByIdScope.ENTERPRISE, templateKey, Arrays.asList(new UpdateFileMetadataByIdRequestBody.Builder().op(UpdateFileMetadataByIdRequestBodyOpField.REPLACE).path("/name").value("Jack").build(), new UpdateFileMetadataByIdRequestBody.Builder().op(UpdateFileMetadataByIdRequestBodyOpField.REPLACE).path("/age").value(24L).build(), new UpdateFileMetadataByIdRequestBody.Builder().op(UpdateFileMetadataByIdRequestBodyOpField.REPLACE).path("/birthDate").value("2000-01-03T02:20:50.520Z").build(), new UpdateFileMetadataByIdRequestBody.Builder().op(UpdateFileMetadataByIdRequestBodyOpField.REPLACE).path("/countryCode").value("CA").build(), new UpdateFileMetadataByIdRequestBody.Builder().op(UpdateFileMetadataByIdRequestBodyOpField.REPLACE).path("/sports").value(Arrays.asList("football")).build()))
137+
```
135138

136139
### Arguments
137140

@@ -166,7 +169,7 @@ See the endpoint docs at
166169

167170
<!-- sample delete_files_id_metadata_id_id -->
168171
```
169-
client.getFileMetadata().deleteFileMetadataById(file.getId(), DeleteFileMetadataByIdScope.GLOBAL, "properties")
172+
client.getFileMetadata().deleteFileMetadataById(file.getId(), DeleteFileMetadataByIdScope.ENTERPRISE, templateKey)
170173
```
171174

172175
### Arguments

docs/foldermetadata.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ See the endpoint docs at
9595

9696
<!-- sample post_folders_id_metadata_id_id -->
9797
```
98-
client.getFolderMetadata().createFolderMetadataById(folder.getId(), CreateFolderMetadataByIdScope.GLOBAL, "properties", mapOf(entryOf("abc", "xyz")))
98+
client.getFolderMetadata().createFolderMetadataById(folder.getId(), CreateFolderMetadataByIdScope.ENTERPRISE, templateKey, mapOf(entryOf("name", "John"), entryOf("age", 23), entryOf("birthDate", "2001-01-03T02:20:50.520Z"), entryOf("countryCode", "US"), entryOf("sports", Arrays.asList("basketball", "tennis"))))
9999
```
100100

101101
### Arguments
@@ -136,7 +136,10 @@ This operation is performed by calling function `updateFolderMetadataById`.
136136
See the endpoint docs at
137137
[API Reference](https://developer.box.com/reference/put-folders-id-metadata-id-id/).
138138

139-
*Currently we don't have an example for calling `updateFolderMetadataById` in integration tests*
139+
<!-- sample put_folders_id_metadata_id_id -->
140+
```
141+
client.getFolderMetadata().updateFolderMetadataById(folder.getId(), UpdateFolderMetadataByIdScope.ENTERPRISE, templateKey, Arrays.asList(new UpdateFolderMetadataByIdRequestBody.Builder().op(UpdateFolderMetadataByIdRequestBodyOpField.REPLACE).path("/name").value("Jack").build(), new UpdateFolderMetadataByIdRequestBody.Builder().op(UpdateFolderMetadataByIdRequestBodyOpField.REPLACE).path("/age").value(24L).build(), new UpdateFolderMetadataByIdRequestBody.Builder().op(UpdateFolderMetadataByIdRequestBodyOpField.REPLACE).path("/birthDate").value("2000-01-03T02:20:50.520Z").build(), new UpdateFolderMetadataByIdRequestBody.Builder().op(UpdateFolderMetadataByIdRequestBodyOpField.REPLACE).path("/countryCode").value("CA").build(), new UpdateFolderMetadataByIdRequestBody.Builder().op(UpdateFolderMetadataByIdRequestBodyOpField.REPLACE).path("/sports").value(Arrays.asList("football")).build()))
142+
```
140143

141144
### Arguments
142145

@@ -171,7 +174,7 @@ See the endpoint docs at
171174

172175
<!-- sample delete_folders_id_metadata_id_id -->
173176
```
174-
client.getFolderMetadata().deleteFolderMetadataById(folder.getId(), DeleteFolderMetadataByIdScope.GLOBAL, "properties")
177+
client.getFolderMetadata().deleteFolderMetadataById(folder.getId(), DeleteFolderMetadataByIdScope.ENTERPRISE, templateKey)
175178
```
176179

177180
### Arguments

docs/search.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ This operation is performed by calling function `searchForContent`.
4848
See the endpoint docs at
4949
[API Reference](https://developer.box.com/reference/get-search/).
5050

51-
*Currently we don't have an example for calling `searchForContent` in integration tests*
51+
<!-- sample get_search -->
52+
```
53+
client.getSearch().searchForContent(new SearchForContentQueryParams.Builder().ancestorFolderIds(Arrays.asList("0")).mdfilters(Arrays.asList(new MetadataFilter.Builder().scope(MetadataFilterScopeField.ENTERPRISE).templateKey(templateKey).filters(searchFilters).build())).build())
54+
```
5255

5356
### Arguments
5457

docs/shieldlists.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ This operation is performed by calling function `getShieldListsV2025R0`.
1616
See the endpoint docs at
1717
[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists/).
1818

19-
*Currently we don't have an example for calling `getShieldListsV2025R0` in integration tests*
19+
<!-- sample get_shield_lists_v2025.0 -->
20+
```
21+
client.getShieldLists().getShieldListsV2025R0()
22+
```
2023

2124
### Arguments
2225

@@ -40,7 +43,10 @@ This operation is performed by calling function `createShieldListV2025R0`.
4043
See the endpoint docs at
4144
[API Reference](https://developer.box.com/reference/v2025.0/post-shield-lists/).
4245

43-
*Currently we don't have an example for calling `createShieldListV2025R0` in integration tests*
46+
<!-- sample post_shield_lists_v2025.0 -->
47+
```
48+
client.getShieldLists().createShieldListV2025R0(new ShieldListsCreateV2025R0.Builder(shieldListCountryName, new ShieldListContentCountryV2025R0.Builder(Arrays.asList("US", "PL")).type(ShieldListContentCountryV2025R0TypeField.COUNTRY).build()).description("A list of things that are shielded").build())
49+
```
4450

4551
### Arguments
4652

@@ -66,7 +72,10 @@ This operation is performed by calling function `getShieldListByIdV2025R0`.
6672
See the endpoint docs at
6773
[API Reference](https://developer.box.com/reference/v2025.0/get-shield-lists-id/).
6874

69-
*Currently we don't have an example for calling `getShieldListByIdV2025R0` in integration tests*
75+
<!-- sample get_shield_lists_id_v2025.0 -->
76+
```
77+
client.getShieldLists().getShieldListByIdV2025R0(shieldListCountry.getId())
78+
```
7079

7180
### Arguments
7281

@@ -92,7 +101,10 @@ This operation is performed by calling function `deleteShieldListByIdV2025R0`.
92101
See the endpoint docs at
93102
[API Reference](https://developer.box.com/reference/v2025.0/delete-shield-lists-id/).
94103

95-
*Currently we don't have an example for calling `deleteShieldListByIdV2025R0` in integration tests*
104+
<!-- sample delete_shield_lists_id_v2025.0 -->
105+
```
106+
client.getShieldLists().deleteShieldListByIdV2025R0(shieldListCountry.getId())
107+
```
96108

97109
### Arguments
98110

@@ -118,7 +130,10 @@ This operation is performed by calling function `updateShieldListByIdV2025R0`.
118130
See the endpoint docs at
119131
[API Reference](https://developer.box.com/reference/v2025.0/put-shield-lists-id/).
120132

121-
*Currently we don't have an example for calling `updateShieldListByIdV2025R0` in integration tests*
133+
<!-- sample put_shield_lists_id_v2025.0 -->
134+
```
135+
client.getShieldLists().updateShieldListByIdV2025R0(shieldListCountry.getId(), new ShieldListsUpdateV2025R0.Builder(shieldListCountryName, new ShieldListContentCountryV2025R0.Builder(Arrays.asList("US")).type(ShieldListContentCountryV2025R0TypeField.COUNTRY).build()).description("Updated description").build())
136+
```
122137

123138
### Arguments
124139

docs/skills.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ This operation is performed by calling function `getBoxSkillCardsOnFile`.
1616
See the endpoint docs at
1717
[API Reference](https://developer.box.com/reference/get-files-id-metadata-global-boxSkillsCards/).
1818

19-
*Currently we don't have an example for calling `getBoxSkillCardsOnFile` in integration tests*
19+
<!-- sample get_files_id_metadata_global_boxSkillsCards -->
20+
```
21+
client.getSkills().getBoxSkillCardsOnFile(file.getId())
22+
```
2023

2124
### Arguments
2225

@@ -45,7 +48,10 @@ This operation is performed by calling function `createBoxSkillCardsOnFile`.
4548
See the endpoint docs at
4649
[API Reference](https://developer.box.com/reference/post-files-id-metadata-global-boxSkillsCards/).
4750

48-
*Currently we don't have an example for calling `createBoxSkillCardsOnFile` in integration tests*
51+
<!-- sample post_files_id_metadata_global_boxSkillsCards -->
52+
```
53+
client.getSkills().createBoxSkillCardsOnFile(file.getId(), new CreateBoxSkillCardsOnFileRequestBody(cardsToCreate))
54+
```
4955

5056
### Arguments
5157

@@ -74,7 +80,10 @@ This operation is performed by calling function `updateBoxSkillCardsOnFile`.
7480
See the endpoint docs at
7581
[API Reference](https://developer.box.com/reference/put-files-id-metadata-global-boxSkillsCards/).
7682

77-
*Currently we don't have an example for calling `updateBoxSkillCardsOnFile` in integration tests*
83+
<!-- sample put_files_id_metadata_global_boxSkillsCards -->
84+
```
85+
client.getSkills().updateBoxSkillCardsOnFile(file.getId(), Arrays.asList(new UpdateBoxSkillCardsOnFileRequestBody.Builder().op(UpdateBoxSkillCardsOnFileRequestBodyOpField.REPLACE).path("/cards/0").value(cardToUpdate).build()))
86+
```
7887

7988
### Arguments
8089

@@ -103,7 +112,10 @@ This operation is performed by calling function `deleteBoxSkillCardsFromFile`.
103112
See the endpoint docs at
104113
[API Reference](https://developer.box.com/reference/delete-files-id-metadata-global-boxSkillsCards/).
105114

106-
*Currently we don't have an example for calling `deleteBoxSkillCardsFromFile` in integration tests*
115+
<!-- sample delete_files_id_metadata_global_boxSkillsCards -->
116+
```
117+
client.getSkills().deleteBoxSkillCardsFromFile(file.getId())
118+
```
107119

108120
### Arguments
109121

src/main/java/com/box/sdkgen/managers/ai/GetAiAgentDefaultConfigQueryParams.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public class GetAiAgentDefaultConfigQueryParams {
1010

1111
public String model;
1212

13+
public GetAiAgentDefaultConfigQueryParams(GetAiAgentDefaultConfigQueryParamsModeField mode) {
14+
this.mode = new EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField>(mode);
15+
}
16+
1317
public GetAiAgentDefaultConfigQueryParams(
1418
EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField> mode) {
1519
this.mode = mode;
1620
}
1721

18-
public GetAiAgentDefaultConfigQueryParams(GetAiAgentDefaultConfigQueryParamsModeField mode) {
19-
this.mode = new EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField>(mode);
20-
}
21-
2222
protected GetAiAgentDefaultConfigQueryParams(Builder builder) {
2323
this.mode = builder.mode;
2424
this.language = builder.language;
@@ -45,14 +45,14 @@ public static class Builder {
4545

4646
protected String model;
4747

48-
public Builder(EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField> mode) {
49-
this.mode = mode;
50-
}
51-
5248
public Builder(GetAiAgentDefaultConfigQueryParamsModeField mode) {
5349
this.mode = new EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField>(mode);
5450
}
5551

52+
public Builder(EnumWrapper<GetAiAgentDefaultConfigQueryParamsModeField> mode) {
53+
this.mode = mode;
54+
}
55+
5656
public Builder language(String language) {
5757
this.language = language;
5858
return this;

src/main/java/com/box/sdkgen/managers/authorization/AuthorizeUserQueryParams.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public class AuthorizeUserQueryParams {
1515
public String scope;
1616

1717
public AuthorizeUserQueryParams(
18-
EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) {
19-
this.responseType = responseType;
18+
AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) {
19+
this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType);
2020
this.clientId = clientId;
2121
}
2222

2323
public AuthorizeUserQueryParams(
24-
AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) {
25-
this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType);
24+
EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) {
25+
this.responseType = responseType;
2626
this.clientId = clientId;
2727
}
2828

@@ -66,14 +66,14 @@ public static class Builder {
6666

6767
protected String scope;
6868

69-
public Builder(
70-
EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) {
71-
this.responseType = responseType;
69+
public Builder(AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) {
70+
this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType);
7271
this.clientId = clientId;
7372
}
7473

75-
public Builder(AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) {
76-
this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType);
74+
public Builder(
75+
EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) {
76+
this.responseType = responseType;
7777
this.clientId = clientId;
7878
}
7979

src/main/java/com/box/sdkgen/managers/collaborationallowlistentries/CreateCollaborationWhitelistEntryRequestBody.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ public class CreateCollaborationWhitelistEntryRequestBody extends SerializableOb
2424
protected final EnumWrapper<CreateCollaborationWhitelistEntryRequestBodyDirectionField> direction;
2525

2626
public CreateCollaborationWhitelistEntryRequestBody(
27-
@JsonProperty("domain") String domain,
28-
@JsonProperty("direction")
29-
EnumWrapper<CreateCollaborationWhitelistEntryRequestBodyDirectionField> direction) {
27+
String domain, CreateCollaborationWhitelistEntryRequestBodyDirectionField direction) {
3028
super();
3129
this.domain = domain;
32-
this.direction = direction;
30+
this.direction =
31+
new EnumWrapper<CreateCollaborationWhitelistEntryRequestBodyDirectionField>(direction);
3332
}
3433

3534
public CreateCollaborationWhitelistEntryRequestBody(
36-
String domain, CreateCollaborationWhitelistEntryRequestBodyDirectionField direction) {
35+
@JsonProperty("domain") String domain,
36+
@JsonProperty("direction")
37+
EnumWrapper<CreateCollaborationWhitelistEntryRequestBodyDirectionField> direction) {
3738
super();
3839
this.domain = domain;
39-
this.direction =
40-
new EnumWrapper<CreateCollaborationWhitelistEntryRequestBodyDirectionField>(direction);
40+
this.direction = direction;
4141
}
4242

4343
public String getDomain() {

0 commit comments

Comments
 (0)