Skip to content

Commit e6924bb

Browse files
feat(boxsdkgen): Add GET enterprise configuration endpoint (box/box-openapi#559) (#1529)
1 parent 85be887 commit e6924bb

File tree

48 files changed

+6566
-2
lines changed

Some content is hidden

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

48 files changed

+6566
-2
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "dec2966", "specHash": "fa34496", "version": "5.0.0" }
1+
{ "engineHash": "b98d1dc", "specHash": "cf21406", "version": "5.0.0" }

docs/sdkgen/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ the SDK are available by topic:
2222
* [Docgentemplate](docgentemplate.md)
2323
* [Downloads](downloads.md)
2424
* [Emailaliases](emailaliases.md)
25+
* [Enterpriseconfigurations](enterpriseconfigurations.md)
2526
* [Events](events.md)
2627
* [Externalusers](externalusers.md)
2728
* [Fileclassifications](fileclassifications.md)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# EnterpriseConfigurationsManager
2+
3+
4+
- [Get enterprise configuration](#get-enterprise-configuration)
5+
6+
## Get enterprise configuration
7+
8+
Retrieves the configuration for an enterprise.
9+
10+
This operation is performed by calling function `getEnterpriseConfigurationByIdV2025R0`.
11+
12+
See the endpoint docs at
13+
[API Reference](https://developer.box.com/reference/v2025.0/get-enterprise-configurations-id/).
14+
15+
*Currently we don't have an example for calling `getEnterpriseConfigurationByIdV2025R0` in integration tests*
16+
17+
### Arguments
18+
19+
- enterpriseId `String`
20+
- The ID of the enterprise. Example: "3442311"
21+
- queryParams `GetEnterpriseConfigurationByIdV2025R0QueryParams`
22+
- Query parameters of getEnterpriseConfigurationByIdV2025R0 method
23+
- headers `GetEnterpriseConfigurationByIdV2025R0Headers`
24+
- Headers of getEnterpriseConfigurationByIdV2025R0 method
25+
26+
27+
### Returns
28+
29+
This function returns a value of type `EnterpriseConfigurationV2025R0`.
30+
31+
Returns the enterprise configuration.
32+
33+

src/main/java/com/box/sdkgen/client/BoxClient.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.box.sdkgen.managers.docgentemplate.DocgenTemplateManager;
2121
import com.box.sdkgen.managers.downloads.DownloadsManager;
2222
import com.box.sdkgen.managers.emailaliases.EmailAliasesManager;
23+
import com.box.sdkgen.managers.enterpriseconfigurations.EnterpriseConfigurationsManager;
2324
import com.box.sdkgen.managers.events.EventsManager;
2425
import com.box.sdkgen.managers.externalusers.ExternalUsersManager;
2526
import com.box.sdkgen.managers.fileclassifications.FileClassificationsManager;
@@ -248,6 +249,8 @@ public class BoxClient {
248249

249250
public final DocgenManager docgen;
250251

252+
public final EnterpriseConfigurationsManager enterpriseConfigurations;
253+
251254
public final HubsManager hubs;
252255

253256
public final HubCollaborationsManager hubCollaborations;
@@ -572,6 +575,11 @@ public BoxClient(Authentication auth) {
572575
.build();
573576
this.docgen =
574577
new DocgenManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
578+
this.enterpriseConfigurations =
579+
new EnterpriseConfigurationsManager.Builder()
580+
.auth(this.auth)
581+
.networkSession(this.networkSession)
582+
.build();
575583
this.hubs =
576584
new HubsManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
577585
this.hubCollaborations =
@@ -907,6 +915,11 @@ protected BoxClient(Builder builder) {
907915
.build();
908916
this.docgen =
909917
new DocgenManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
918+
this.enterpriseConfigurations =
919+
new EnterpriseConfigurationsManager.Builder()
920+
.auth(this.auth)
921+
.networkSession(this.networkSession)
922+
.build();
910923
this.hubs =
911924
new HubsManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
912925
this.hubCollaborations =
@@ -1336,6 +1349,10 @@ public DocgenManager getDocgen() {
13361349
return docgen;
13371350
}
13381351

1352+
public EnterpriseConfigurationsManager getEnterpriseConfigurations() {
1353+
return enterpriseConfigurations;
1354+
}
1355+
13391356
public HubsManager getHubs() {
13401357
return hubs;
13411358
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
package com.box.sdkgen.managers.enterpriseconfigurations;
2+
3+
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4+
import static com.box.sdkgen.internal.utils.UtilsManager.entryOf;
5+
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
6+
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
7+
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
8+
9+
import com.box.sdkgen.networking.auth.Authentication;
10+
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
11+
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
12+
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
13+
import com.box.sdkgen.networking.network.NetworkSession;
14+
import com.box.sdkgen.schemas.v2025r0.enterpriseconfigurationv2025r0.EnterpriseConfigurationV2025R0;
15+
import com.box.sdkgen.serialization.json.JsonManager;
16+
import java.util.Map;
17+
18+
public class EnterpriseConfigurationsManager {
19+
20+
public Authentication auth;
21+
22+
public NetworkSession networkSession;
23+
24+
public EnterpriseConfigurationsManager() {
25+
this.networkSession = new NetworkSession();
26+
}
27+
28+
protected EnterpriseConfigurationsManager(Builder builder) {
29+
this.auth = builder.auth;
30+
this.networkSession = builder.networkSession;
31+
}
32+
33+
/**
34+
* Retrieves the configuration for an enterprise.
35+
*
36+
* @param enterpriseId The ID of the enterprise. Example: "3442311"
37+
* @param queryParams Query parameters of getEnterpriseConfigurationByIdV2025R0 method
38+
*/
39+
public EnterpriseConfigurationV2025R0 getEnterpriseConfigurationByIdV2025R0(
40+
String enterpriseId, GetEnterpriseConfigurationByIdV2025R0QueryParams queryParams) {
41+
return getEnterpriseConfigurationByIdV2025R0(
42+
enterpriseId, queryParams, new GetEnterpriseConfigurationByIdV2025R0Headers());
43+
}
44+
45+
/**
46+
* Retrieves the configuration for an enterprise.
47+
*
48+
* @param enterpriseId The ID of the enterprise. Example: "3442311"
49+
* @param queryParams Query parameters of getEnterpriseConfigurationByIdV2025R0 method
50+
* @param headers Headers of getEnterpriseConfigurationByIdV2025R0 method
51+
*/
52+
public EnterpriseConfigurationV2025R0 getEnterpriseConfigurationByIdV2025R0(
53+
String enterpriseId,
54+
GetEnterpriseConfigurationByIdV2025R0QueryParams queryParams,
55+
GetEnterpriseConfigurationByIdV2025R0Headers headers) {
56+
Map<String, String> queryParamsMap =
57+
prepareParams(mapOf(entryOf("categories", convertToString(queryParams.getCategories()))));
58+
Map<String, String> headersMap =
59+
prepareParams(
60+
mergeMaps(
61+
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
62+
headers.getExtraHeaders()));
63+
FetchResponse response =
64+
this.networkSession
65+
.getNetworkClient()
66+
.fetch(
67+
new FetchOptions.Builder(
68+
String.join(
69+
"",
70+
this.networkSession.getBaseUrls().getBaseUrl(),
71+
"/2.0/enterprise_configurations/",
72+
convertToString(enterpriseId)),
73+
"GET")
74+
.params(queryParamsMap)
75+
.headers(headersMap)
76+
.responseFormat(ResponseFormat.JSON)
77+
.auth(this.auth)
78+
.networkSession(this.networkSession)
79+
.build());
80+
return JsonManager.deserialize(response.getData(), EnterpriseConfigurationV2025R0.class);
81+
}
82+
83+
public Authentication getAuth() {
84+
return auth;
85+
}
86+
87+
public NetworkSession getNetworkSession() {
88+
return networkSession;
89+
}
90+
91+
public static class Builder {
92+
93+
protected Authentication auth;
94+
95+
protected NetworkSession networkSession;
96+
97+
public Builder() {
98+
this.networkSession = new NetworkSession();
99+
}
100+
101+
public Builder auth(Authentication auth) {
102+
this.auth = auth;
103+
return this;
104+
}
105+
106+
public Builder networkSession(NetworkSession networkSession) {
107+
this.networkSession = networkSession;
108+
return this;
109+
}
110+
111+
public EnterpriseConfigurationsManager build() {
112+
return new EnterpriseConfigurationsManager(this);
113+
}
114+
}
115+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.box.sdkgen.managers.enterpriseconfigurations;
2+
3+
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
4+
5+
import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0;
6+
import com.box.sdkgen.serialization.json.EnumWrapper;
7+
import java.util.Map;
8+
9+
public class GetEnterpriseConfigurationByIdV2025R0Headers {
10+
11+
/** Version header. */
12+
public EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
13+
14+
/** Extra headers that will be included in the HTTP request. */
15+
public Map<String, String> extraHeaders;
16+
17+
public GetEnterpriseConfigurationByIdV2025R0Headers() {
18+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
19+
this.extraHeaders = mapOf();
20+
}
21+
22+
protected GetEnterpriseConfigurationByIdV2025R0Headers(Builder builder) {
23+
this.boxVersion = builder.boxVersion;
24+
this.extraHeaders = builder.extraHeaders;
25+
}
26+
27+
public EnumWrapper<BoxVersionHeaderV2025R0> getBoxVersion() {
28+
return boxVersion;
29+
}
30+
31+
public Map<String, String> getExtraHeaders() {
32+
return extraHeaders;
33+
}
34+
35+
public static class Builder {
36+
37+
protected EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
38+
39+
protected Map<String, String> extraHeaders;
40+
41+
public Builder() {
42+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
43+
this.extraHeaders = mapOf();
44+
}
45+
46+
public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) {
47+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(boxVersion);
48+
return this;
49+
}
50+
51+
public Builder boxVersion(EnumWrapper<BoxVersionHeaderV2025R0> boxVersion) {
52+
this.boxVersion = boxVersion;
53+
return this;
54+
}
55+
56+
public Builder extraHeaders(Map<String, String> extraHeaders) {
57+
this.extraHeaders = extraHeaders;
58+
return this;
59+
}
60+
61+
public GetEnterpriseConfigurationByIdV2025R0Headers build() {
62+
return new GetEnterpriseConfigurationByIdV2025R0Headers(this);
63+
}
64+
}
65+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.box.sdkgen.managers.enterpriseconfigurations;
2+
3+
public class GetEnterpriseConfigurationByIdV2025R0QueryParams {
4+
5+
/**
6+
* The comma-delimited list of the enterprise configuration categories. Allowed values:
7+
* `security`, `content_and_sharing`, `user_settings`, `shield`.
8+
*/
9+
public final String categories;
10+
11+
public GetEnterpriseConfigurationByIdV2025R0QueryParams(String categories) {
12+
this.categories = categories;
13+
}
14+
15+
public String getCategories() {
16+
return categories;
17+
}
18+
}

src/main/java/com/box/sdkgen/schemas/enterprisebase/EnterpriseBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
99
import java.util.Objects;
1010

11-
/** A mini representation of a enterprise, used when nested within another resource. */
11+
/** A representation of a enterprise, used when nested within another resource. */
1212
@JsonFilter("nullablePropertyFilter")
1313
public class EnterpriseBase extends SerializableObject {
1414

0 commit comments

Comments
 (0)