Skip to content

Commit a450f8c

Browse files
committed
feat: add hubs API beta endpoints (box/box-openapi#531)
1 parent 2d965d1 commit a450f8c

File tree

50 files changed

+2168
-1
lines changed

Some content is hidden

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

50 files changed

+2168
-1
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "8a2df34", "specHash": "4beed7d", "version": "1.10.0" }
1+
{ "engineHash": "8a2df34", "specHash": "bf48b24", "version": "1.10.0" }

Box.Sdk.Gen/Client/BoxClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ public class BoxClient : IBoxClient {
157157

158158
public IDocgenManager Docgen { get; }
159159

160+
public IHubsManager Hubs { get; }
161+
162+
public IHubCollaborationsManager HubCollaborations { get; }
163+
160164
public IShieldListsManager ShieldLists { get; }
161165

162166
public BoxClient(IAuthentication auth, NetworkSession? networkSession = default) {
@@ -236,6 +240,8 @@ public BoxClient(IAuthentication auth, NetworkSession? networkSession = default)
236240
AiStudio = new AiStudioManager(networkSession: this.NetworkSession) { Auth = this.Auth };
237241
DocgenTemplate = new DocgenTemplateManager(networkSession: this.NetworkSession) { Auth = this.Auth };
238242
Docgen = new DocgenManager(networkSession: this.NetworkSession) { Auth = this.Auth };
243+
Hubs = new HubsManager(networkSession: this.NetworkSession) { Auth = this.Auth };
244+
HubCollaborations = new HubCollaborationsManager(networkSession: this.NetworkSession) { Auth = this.Auth };
239245
ShieldLists = new ShieldListsManager(networkSession: this.NetworkSession) { Auth = this.Auth };
240246
}
241247
/// <summary>

Box.Sdk.Gen/Client/IBoxClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ public interface IBoxClient {
155155

156156
public IDocgenManager Docgen { get => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); }
157157

158+
public IHubsManager Hubs { get => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); }
159+
160+
public IHubCollaborationsManager HubCollaborations { get => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); }
161+
158162
public IShieldListsManager ShieldLists { get => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); }
159163

160164
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class CreateHubCollaborationV2025R0Headers {
10+
/// <summary>
11+
/// Version header.
12+
/// </summary>
13+
public StringEnum<BoxVersionHeaderV2025R0> BoxVersion { get; }
14+
15+
/// <summary>
16+
/// Extra headers that will be included in the HTTP request.
17+
/// </summary>
18+
public Dictionary<string, string?> ExtraHeaders { get; }
19+
20+
public CreateHubCollaborationV2025R0Headers(BoxVersionHeaderV2025R0 boxVersion = BoxVersionHeaderV2025R0._20250, Dictionary<string, string?>? extraHeaders = default) {
21+
BoxVersion = boxVersion;
22+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class DeleteHubCollaborationByIdV2025R0Headers {
10+
/// <summary>
11+
/// Version header.
12+
/// </summary>
13+
public StringEnum<BoxVersionHeaderV2025R0> BoxVersion { get; }
14+
15+
/// <summary>
16+
/// Extra headers that will be included in the HTTP request.
17+
/// </summary>
18+
public Dictionary<string, string?> ExtraHeaders { get; }
19+
20+
public DeleteHubCollaborationByIdV2025R0Headers(BoxVersionHeaderV2025R0 boxVersion = BoxVersionHeaderV2025R0._20250, Dictionary<string, string?>? extraHeaders = default) {
21+
BoxVersion = boxVersion;
22+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class GetHubCollaborationByIdV2025R0Headers {
10+
/// <summary>
11+
/// Version header.
12+
/// </summary>
13+
public StringEnum<BoxVersionHeaderV2025R0> BoxVersion { get; }
14+
15+
/// <summary>
16+
/// Extra headers that will be included in the HTTP request.
17+
/// </summary>
18+
public Dictionary<string, string?> ExtraHeaders { get; }
19+
20+
public GetHubCollaborationByIdV2025R0Headers(BoxVersionHeaderV2025R0 boxVersion = BoxVersionHeaderV2025R0._20250, Dictionary<string, string?>? extraHeaders = default) {
21+
BoxVersion = boxVersion;
22+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class GetHubCollaborationsV2025R0Headers {
10+
/// <summary>
11+
/// Version header.
12+
/// </summary>
13+
public StringEnum<BoxVersionHeaderV2025R0> BoxVersion { get; }
14+
15+
/// <summary>
16+
/// Extra headers that will be included in the HTTP request.
17+
/// </summary>
18+
public Dictionary<string, string?> ExtraHeaders { get; }
19+
20+
public GetHubCollaborationsV2025R0Headers(BoxVersionHeaderV2025R0 boxVersion = BoxVersionHeaderV2025R0._20250, Dictionary<string, string?>? extraHeaders = default) {
21+
BoxVersion = boxVersion;
22+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
23+
}
24+
}
25+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class GetHubCollaborationsV2025R0QueryParams {
10+
/// <summary>
11+
/// The unique identifier that represent a hub.
12+
///
13+
/// The ID for any hub can be determined
14+
/// by visiting this hub in the web application
15+
/// and copying the ID from the URL. For example,
16+
/// for the URL `https://*.app.box.com/hubs/123`
17+
/// the `hub_id` is `123`.
18+
/// </summary>
19+
public string HubId { get; }
20+
21+
/// <summary>
22+
/// Defines the position marker at which to begin returning results. This is
23+
/// used when paginating using marker-based pagination.
24+
///
25+
/// This requires `usemarker` to be set to `true`.
26+
/// </summary>
27+
public string? Marker { get; init; }
28+
29+
/// <summary>
30+
/// The maximum number of items to return per page.
31+
/// </summary>
32+
public long? Limit { get; init; }
33+
34+
public GetHubCollaborationsV2025R0QueryParams(string hubId) {
35+
HubId = hubId;
36+
}
37+
}
38+
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using Box.Sdk.Gen.Internal;
5+
using Box.Sdk.Gen.Schemas;
6+
using Box.Sdk.Gen.Parameters;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class HubCollaborationsManager : IHubCollaborationsManager {
10+
public IAuthentication? Auth { get; init; }
11+
12+
public NetworkSession NetworkSession { get; }
13+
14+
public HubCollaborationsManager(NetworkSession? networkSession = default) {
15+
NetworkSession = networkSession ?? new NetworkSession();
16+
}
17+
/// <summary>
18+
/// Retrieves all collaborations for a hub.
19+
/// </summary>
20+
/// <param name="queryParams">
21+
/// Query parameters of getHubCollaborationsV2025R0 method
22+
/// </param>
23+
/// <param name="headers">
24+
/// Headers of getHubCollaborationsV2025R0 method
25+
/// </param>
26+
/// <param name="cancellationToken">
27+
/// Token used for request cancellation.
28+
/// </param>
29+
public async System.Threading.Tasks.Task<HubCollaborationsV2025R0> GetHubCollaborationsV2025R0Async(GetHubCollaborationsV2025R0QueryParams queryParams, GetHubCollaborationsV2025R0Headers? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
30+
headers = headers ?? new GetHubCollaborationsV2025R0Headers();
31+
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "hub_id", StringUtils.ToStringRepresentation(queryParams.HubId) }, { "marker", StringUtils.ToStringRepresentation(queryParams.Marker) }, { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) } });
32+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { { "box-version", StringUtils.ToStringRepresentation(headers.BoxVersion) } }, headers.ExtraHeaders));
33+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/hub_collaborations"), method: "GET", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Parameters = queryParamsMap, Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
34+
return SimpleJsonSerializer.Deserialize<HubCollaborationsV2025R0>(NullableUtils.Unwrap(response.Data));
35+
}
36+
37+
/// <summary>
38+
/// Adds a collaboration for a single user or a single group to a hub.
39+
///
40+
/// Collaborations can be created using email address, user IDs, or group IDs.
41+
/// </summary>
42+
/// <param name="requestBody">
43+
/// Request body of createHubCollaborationV2025R0 method
44+
/// </param>
45+
/// <param name="headers">
46+
/// Headers of createHubCollaborationV2025R0 method
47+
/// </param>
48+
/// <param name="cancellationToken">
49+
/// Token used for request cancellation.
50+
/// </param>
51+
public async System.Threading.Tasks.Task<HubCollaborationV2025R0> CreateHubCollaborationV2025R0Async(HubCollaborationCreateRequestV2025R0 requestBody, CreateHubCollaborationV2025R0Headers? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
52+
headers = headers ?? new CreateHubCollaborationV2025R0Headers();
53+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { { "box-version", StringUtils.ToStringRepresentation(headers.BoxVersion) } }, headers.ExtraHeaders));
54+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/hub_collaborations"), method: "POST", contentType: "application/json", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
55+
return SimpleJsonSerializer.Deserialize<HubCollaborationV2025R0>(NullableUtils.Unwrap(response.Data));
56+
}
57+
58+
/// <summary>
59+
/// Retrieves details for a hub collaboration by collaboration ID.
60+
/// </summary>
61+
/// <param name="hubCollaborationId">
62+
/// The ID of the hub collaboration.
63+
/// Example: "1234"
64+
/// </param>
65+
/// <param name="headers">
66+
/// Headers of getHubCollaborationByIdV2025R0 method
67+
/// </param>
68+
/// <param name="cancellationToken">
69+
/// Token used for request cancellation.
70+
/// </param>
71+
public async System.Threading.Tasks.Task<HubCollaborationV2025R0> GetHubCollaborationByIdV2025R0Async(string hubCollaborationId, GetHubCollaborationByIdV2025R0Headers? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
72+
headers = headers ?? new GetHubCollaborationByIdV2025R0Headers();
73+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { { "box-version", StringUtils.ToStringRepresentation(headers.BoxVersion) } }, headers.ExtraHeaders));
74+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/hub_collaborations/", StringUtils.ToStringRepresentation(hubCollaborationId)), method: "GET", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
75+
return SimpleJsonSerializer.Deserialize<HubCollaborationV2025R0>(NullableUtils.Unwrap(response.Data));
76+
}
77+
78+
/// <summary>
79+
/// Updates a hub collaboration.
80+
/// Can be used to change the hub role.
81+
/// </summary>
82+
/// <param name="hubCollaborationId">
83+
/// The ID of the hub collaboration.
84+
/// Example: "1234"
85+
/// </param>
86+
/// <param name="requestBody">
87+
/// Request body of updateHubCollaborationByIdV2025R0 method
88+
/// </param>
89+
/// <param name="headers">
90+
/// Headers of updateHubCollaborationByIdV2025R0 method
91+
/// </param>
92+
/// <param name="cancellationToken">
93+
/// Token used for request cancellation.
94+
/// </param>
95+
public async System.Threading.Tasks.Task<HubCollaborationV2025R0> UpdateHubCollaborationByIdV2025R0Async(string hubCollaborationId, HubCollaborationUpdateRequestV2025R0 requestBody, UpdateHubCollaborationByIdV2025R0Headers? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
96+
headers = headers ?? new UpdateHubCollaborationByIdV2025R0Headers();
97+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { { "box-version", StringUtils.ToStringRepresentation(headers.BoxVersion) } }, headers.ExtraHeaders));
98+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/hub_collaborations/", StringUtils.ToStringRepresentation(hubCollaborationId)), method: "PUT", contentType: "application/json", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
99+
return SimpleJsonSerializer.Deserialize<HubCollaborationV2025R0>(NullableUtils.Unwrap(response.Data));
100+
}
101+
102+
/// <summary>
103+
/// Deletes a single hub collaboration.
104+
/// </summary>
105+
/// <param name="hubCollaborationId">
106+
/// The ID of the hub collaboration.
107+
/// Example: "1234"
108+
/// </param>
109+
/// <param name="headers">
110+
/// Headers of deleteHubCollaborationByIdV2025R0 method
111+
/// </param>
112+
/// <param name="cancellationToken">
113+
/// Token used for request cancellation.
114+
/// </param>
115+
public async System.Threading.Tasks.Task DeleteHubCollaborationByIdV2025R0Async(string hubCollaborationId, DeleteHubCollaborationByIdV2025R0Headers? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
116+
headers = headers ?? new DeleteHubCollaborationByIdV2025R0Headers();
117+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { { "box-version", StringUtils.ToStringRepresentation(headers.BoxVersion) } }, headers.ExtraHeaders));
118+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/hub_collaborations/", StringUtils.ToStringRepresentation(hubCollaborationId)), method: "DELETE", responseFormat: Box.Sdk.Gen.ResponseFormat.NoContent) { Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
119+
}
120+
121+
}
122+
}

0 commit comments

Comments
 (0)