Skip to content

Commit 936edf7

Browse files
feat: add GET enterprise configuration endpoint (box/box-openapi#559) (#1179)
1 parent 6bbb8f2 commit 936edf7

File tree

49 files changed

+3775
-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.

49 files changed

+3775
-2
lines changed

.codegen.json

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

BoxSdkGen/BoxSdkGen.xcodeproj/project.pbxproj

Lines changed: 692 additions & 0 deletions
Large diffs are not rendered by default.

BoxSdkGen/Sources/Client/BoxClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public class BoxClient {
153153

154154
public let docgen: DocgenManager
155155

156+
public let enterpriseConfigurations: EnterpriseConfigurationsManager
157+
156158
public let hubs: HubsManager
157159

158160
public let hubCollaborations: HubCollaborationsManager
@@ -242,6 +244,7 @@ public class BoxClient {
242244
self.aiStudio = AiStudioManager(auth: self.auth, networkSession: self.networkSession)
243245
self.docgenTemplate = DocgenTemplateManager(auth: self.auth, networkSession: self.networkSession)
244246
self.docgen = DocgenManager(auth: self.auth, networkSession: self.networkSession)
247+
self.enterpriseConfigurations = EnterpriseConfigurationsManager(auth: self.auth, networkSession: self.networkSession)
245248
self.hubs = HubsManager(auth: self.auth, networkSession: self.networkSession)
246249
self.hubCollaborations = HubCollaborationsManager(auth: self.auth, networkSession: self.networkSession)
247250
self.hubItems = HubItemsManager(auth: self.auth, networkSession: self.networkSession)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Foundation
2+
3+
public class EnterpriseConfigurationsManager {
4+
public let auth: Authentication?
5+
6+
public let networkSession: NetworkSession
7+
8+
public init(auth: Authentication? = nil, networkSession: NetworkSession = NetworkSession()) {
9+
self.auth = auth
10+
self.networkSession = networkSession
11+
}
12+
13+
/// Retrieves the configuration for an enterprise.
14+
///
15+
/// - Parameters:
16+
/// - enterpriseId: The ID of the enterprise.
17+
/// Example: "3442311"
18+
/// - queryParams: Query parameters of getEnterpriseConfigurationByIdV2025R0 method
19+
/// - headers: Headers of getEnterpriseConfigurationByIdV2025R0 method
20+
/// - Returns: The `EnterpriseConfigurationV2025R0`.
21+
/// - Throws: The `GeneralError`.
22+
public func getEnterpriseConfigurationByIdV2025R0(enterpriseId: String, queryParams: GetEnterpriseConfigurationByIdV2025R0QueryParams, headers: GetEnterpriseConfigurationByIdV2025R0Headers = GetEnterpriseConfigurationByIdV2025R0Headers()) async throws -> EnterpriseConfigurationV2025R0 {
23+
let queryParamsMap: [String: String] = Utils.Dictionary.prepareParams(map: ["categories": Utils.Strings.toString(value: queryParams.categories)])
24+
let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge(["box-version": Utils.Strings.toString(value: headers.boxVersion)], headers.extraHeaders))
25+
let response: FetchResponse = try await self.networkSession.networkClient.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/enterprise_configurations/")\(enterpriseId)", method: "GET", params: queryParamsMap, headers: headersMap, responseFormat: ResponseFormat.json, auth: self.auth, networkSession: self.networkSession))
26+
return try EnterpriseConfigurationV2025R0.deserialize(from: response.data!)
27+
}
28+
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
3+
public class GetEnterpriseConfigurationByIdV2025R0Headers {
4+
/// Version header.
5+
public let boxVersion: BoxVersionHeaderV2025R0
6+
7+
/// Extra headers that will be included in the HTTP request.
8+
public let extraHeaders: [String: String?]?
9+
10+
/// Initializer for a GetEnterpriseConfigurationByIdV2025R0Headers.
11+
///
12+
/// - Parameters:
13+
/// - boxVersion: Version header.
14+
/// - extraHeaders: Extra headers that will be included in the HTTP request.
15+
public init(boxVersion: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._20250, extraHeaders: [String: String?]? = [:]) {
16+
self.boxVersion = boxVersion
17+
self.extraHeaders = extraHeaders
18+
}
19+
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Foundation
2+
3+
public class GetEnterpriseConfigurationByIdV2025R0QueryParams {
4+
/// The comma-delimited list of the enterprise configuration categories.
5+
/// Allowed values: `security`, `content_and_sharing`, `user_settings`, `shield`.
6+
public let categories: String
7+
8+
/// Initializer for a GetEnterpriseConfigurationByIdV2025R0QueryParams.
9+
///
10+
/// - Parameters:
11+
/// - categories: The comma-delimited list of the enterprise configuration categories.
12+
/// Allowed values: `security`, `content_and_sharing`, `user_settings`, `shield`.
13+
public init(categories: String) {
14+
self.categories = categories
15+
}
16+
17+
}

BoxSdkGen/Sources/Schemas/EnterpriseBase/EnterpriseBase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
/// A mini representation of a enterprise, used when
3+
/// A representation of a enterprise, used when
44
/// nested within another resource.
55
public class EnterpriseBase: Codable, RawJSONReadable {
66
private enum CodingKeys: String, CodingKey {
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import Foundation
2+
3+
/// The collaboration permissions.
4+
public class CollaborationPermissionsV2025R0: Codable, RawJSONReadable {
5+
private enum CodingKeys: String, CodingKey {
6+
case isCoOwnerRoleEnabled = "is_co_owner_role_enabled"
7+
case isEditorRoleEnabled = "is_editor_role_enabled"
8+
case isPreviewerRoleEnabled = "is_previewer_role_enabled"
9+
case isPreviewerUploaderRoleEnabled = "is_previewer_uploader_role_enabled"
10+
case isUploaderRoleEnabled = "is_uploader_role_enabled"
11+
case isViewerRoleEnabled = "is_viewer_role_enabled"
12+
case isViewerUploaderRoleEnabled = "is_viewer_uploader_role_enabled"
13+
}
14+
15+
/// Internal backing store for rawData. Used to store raw dictionary data associated with the instance.
16+
private var _rawData: [String: Any]?
17+
18+
/// Returns the raw dictionary data associated with the instance. This is a read-only property.
19+
public var rawData: [String: Any]? {
20+
return _rawData
21+
}
22+
23+
24+
/// The co-owner role is enabled for collaboration.
25+
public let isCoOwnerRoleEnabled: Bool?
26+
27+
/// The editor role is enabled for collaboration.
28+
public let isEditorRoleEnabled: Bool?
29+
30+
/// The previewer role is enabled for collaboration.
31+
public let isPreviewerRoleEnabled: Bool?
32+
33+
/// The previewer uploader role is enabled for collaboration.
34+
public let isPreviewerUploaderRoleEnabled: Bool?
35+
36+
/// The uploader role is enabled for collaboration.
37+
public let isUploaderRoleEnabled: Bool?
38+
39+
/// The viewer role is enabled for collaboration.
40+
public let isViewerRoleEnabled: Bool?
41+
42+
/// The viewer uploader role is enabled for collaboration.
43+
public let isViewerUploaderRoleEnabled: Bool?
44+
45+
/// Initializer for a CollaborationPermissionsV2025R0.
46+
///
47+
/// - Parameters:
48+
/// - isCoOwnerRoleEnabled: The co-owner role is enabled for collaboration.
49+
/// - isEditorRoleEnabled: The editor role is enabled for collaboration.
50+
/// - isPreviewerRoleEnabled: The previewer role is enabled for collaboration.
51+
/// - isPreviewerUploaderRoleEnabled: The previewer uploader role is enabled for collaboration.
52+
/// - isUploaderRoleEnabled: The uploader role is enabled for collaboration.
53+
/// - isViewerRoleEnabled: The viewer role is enabled for collaboration.
54+
/// - isViewerUploaderRoleEnabled: The viewer uploader role is enabled for collaboration.
55+
public init(isCoOwnerRoleEnabled: Bool? = nil, isEditorRoleEnabled: Bool? = nil, isPreviewerRoleEnabled: Bool? = nil, isPreviewerUploaderRoleEnabled: Bool? = nil, isUploaderRoleEnabled: Bool? = nil, isViewerRoleEnabled: Bool? = nil, isViewerUploaderRoleEnabled: Bool? = nil) {
56+
self.isCoOwnerRoleEnabled = isCoOwnerRoleEnabled
57+
self.isEditorRoleEnabled = isEditorRoleEnabled
58+
self.isPreviewerRoleEnabled = isPreviewerRoleEnabled
59+
self.isPreviewerUploaderRoleEnabled = isPreviewerUploaderRoleEnabled
60+
self.isUploaderRoleEnabled = isUploaderRoleEnabled
61+
self.isViewerRoleEnabled = isViewerRoleEnabled
62+
self.isViewerUploaderRoleEnabled = isViewerUploaderRoleEnabled
63+
}
64+
65+
required public init(from decoder: Decoder) throws {
66+
let container = try decoder.container(keyedBy: CodingKeys.self)
67+
isCoOwnerRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isCoOwnerRoleEnabled)
68+
isEditorRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isEditorRoleEnabled)
69+
isPreviewerRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isPreviewerRoleEnabled)
70+
isPreviewerUploaderRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isPreviewerUploaderRoleEnabled)
71+
isUploaderRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isUploaderRoleEnabled)
72+
isViewerRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isViewerRoleEnabled)
73+
isViewerUploaderRoleEnabled = try container.decodeIfPresent(Bool.self, forKey: .isViewerUploaderRoleEnabled)
74+
}
75+
76+
public func encode(to encoder: Encoder) throws {
77+
var container = encoder.container(keyedBy: CodingKeys.self)
78+
try container.encodeIfPresent(isCoOwnerRoleEnabled, forKey: .isCoOwnerRoleEnabled)
79+
try container.encodeIfPresent(isEditorRoleEnabled, forKey: .isEditorRoleEnabled)
80+
try container.encodeIfPresent(isPreviewerRoleEnabled, forKey: .isPreviewerRoleEnabled)
81+
try container.encodeIfPresent(isPreviewerUploaderRoleEnabled, forKey: .isPreviewerUploaderRoleEnabled)
82+
try container.encodeIfPresent(isUploaderRoleEnabled, forKey: .isUploaderRoleEnabled)
83+
try container.encodeIfPresent(isViewerRoleEnabled, forKey: .isViewerRoleEnabled)
84+
try container.encodeIfPresent(isViewerUploaderRoleEnabled, forKey: .isViewerUploaderRoleEnabled)
85+
}
86+
87+
/// Sets the raw JSON data.
88+
///
89+
/// - Parameters:
90+
/// - rawData: A dictionary containing the raw JSON data
91+
func setRawData(rawData: [String: Any]?) {
92+
self._rawData = rawData
93+
}
94+
95+
/// Gets the raw JSON data
96+
/// - Returns: The `[String: Any]?`.
97+
func getRawData() -> [String: Any]? {
98+
return self._rawData
99+
}
100+
101+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Foundation
2+
3+
/// The collaboration restriction.
4+
public enum CollaborationRestrictionV2025R0: CodableStringEnum {
5+
case internal_
6+
case external
7+
case customValue(String)
8+
9+
public init(rawValue value: String) {
10+
switch value.lowercased() {
11+
case "internal".lowercased():
12+
self = .internal_
13+
case "external".lowercased():
14+
self = .external
15+
default:
16+
self = .customValue(value)
17+
}
18+
}
19+
20+
public var rawValue: String {
21+
switch self {
22+
case .internal_:
23+
return "internal"
24+
case .external:
25+
return "external"
26+
case .customValue(let value):
27+
return value
28+
}
29+
}
30+
31+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import Foundation
2+
3+
/// A custom session duration group item.
4+
public class CustomSessionDurationGroupItemV2025R0: Codable, RawJSONReadable {
5+
private enum CodingKeys: String, CodingKey {
6+
case id
7+
case name
8+
}
9+
10+
/// Internal backing store for rawData. Used to store raw dictionary data associated with the instance.
11+
private var _rawData: [String: Any]?
12+
13+
/// Returns the raw dictionary data associated with the instance. This is a read-only property.
14+
public var rawData: [String: Any]? {
15+
return _rawData
16+
}
17+
18+
19+
/// Group ID (numerical).
20+
public let id: String?
21+
22+
/// Group Name.
23+
public let name: String?
24+
25+
/// Initializer for a CustomSessionDurationGroupItemV2025R0.
26+
///
27+
/// - Parameters:
28+
/// - id: Group ID (numerical).
29+
/// - name: Group Name.
30+
public init(id: String? = nil, name: String? = nil) {
31+
self.id = id
32+
self.name = name
33+
}
34+
35+
required public init(from decoder: Decoder) throws {
36+
let container = try decoder.container(keyedBy: CodingKeys.self)
37+
id = try container.decodeIfPresent(String.self, forKey: .id)
38+
name = try container.decodeIfPresent(String.self, forKey: .name)
39+
}
40+
41+
public func encode(to encoder: Encoder) throws {
42+
var container = encoder.container(keyedBy: CodingKeys.self)
43+
try container.encodeIfPresent(id, forKey: .id)
44+
try container.encodeIfPresent(name, forKey: .name)
45+
}
46+
47+
/// Sets the raw JSON data.
48+
///
49+
/// - Parameters:
50+
/// - rawData: A dictionary containing the raw JSON data
51+
func setRawData(rawData: [String: Any]?) {
52+
self._rawData = rawData
53+
}
54+
55+
/// Gets the raw JSON data
56+
/// - Returns: The `[String: Any]?`.
57+
func getRawData() -> [String: Any]? {
58+
return self._rawData
59+
}
60+
61+
}

0 commit comments

Comments
 (0)