From 0602e3f9fc74e9944e85ac67bad5e98a5e9b7dc4 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 6 Sep 2024 05:11:59 -0700 Subject: [PATCH 1/4] feat: Support versioning (box/box-codegen#558) --- .codegen.json | 2 +- Box.Sdk.Gen/Box.Sdk.Gen.csproj | 1 - Box.Sdk.Gen/Managers/Events/EventsManager.cs | 62 ++++++------- .../Managers/Events/GetEventsHeaders.cs | 4 +- .../Managers/Events/GetEventsQueryParams.cs | 4 +- .../Events/GetEventsWithLongPollingHeaders.cs | 4 +- Box.Sdk.Gen/Managers/Events/IEventsManager.cs | 48 +++++----- .../FileVersions/FileVersionsManager.cs | 44 ++++----- .../FileVersions/IFileVersionsManager.cs | 28 +++--- ...ShieldInformationBarrierSegmentsManager.cs | 20 ++-- ...ShieldInformationBarrierSegmentsManager.cs | 32 +++---- .../Managers/Uploads/IUploadsManager.cs | 30 +++--- .../Managers/Uploads/UploadsManager.cs | 42 ++++----- docs/Events.md | 92 +++++++++---------- docs/FileVersions.md | 58 ++++++------ docs/ShieldInformationBarrierSegments.md | 48 +++++----- docs/Uploads.md | 62 ++++++------- 17 files changed, 290 insertions(+), 291 deletions(-) diff --git a/.codegen.json b/.codegen.json index 4590b7f7..e65c475b 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "edc49a6", "specHash": "6ca858e", "version": "1.1.0" } +{ "engineHash": "52180cf", "specHash": "6ca858e", "version": "1.1.0" } diff --git a/Box.Sdk.Gen/Box.Sdk.Gen.csproj b/Box.Sdk.Gen/Box.Sdk.Gen.csproj index 0788bc81..aeda2beb 100644 --- a/Box.Sdk.Gen/Box.Sdk.Gen.csproj +++ b/Box.Sdk.Gen/Box.Sdk.Gen.csproj @@ -3,7 +3,6 @@ net6.0 1.1.0 - [Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies. Apache-2.0 enable true diff --git a/Box.Sdk.Gen/Managers/Events/EventsManager.cs b/Box.Sdk.Gen/Managers/Events/EventsManager.cs index b25a1b94..39664fd4 100644 --- a/Box.Sdk.Gen/Managers/Events/EventsManager.cs +++ b/Box.Sdk.Gen/Managers/Events/EventsManager.cs @@ -1,7 +1,7 @@ using Box.Sdk.Gen; -using System; -using System.Collections.ObjectModel; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System; using Box.Sdk.Gen.Internal; using Box.Sdk.Gen.Schemas; @@ -14,35 +14,6 @@ public class EventsManager : IEventsManager { public EventsManager(NetworkSession? networkSession = default) { NetworkSession = networkSession ?? new NetworkSession(); } - /// - /// Returns up to a year of past events for a given user - /// or for the entire enterprise. - /// - /// By default this returns events for the authenticated user. To retrieve events - /// for the entire enterprise, set the `stream_type` to `admin_logs_streaming` - /// for live monitoring of new events, or `admin_logs` for querying across - /// historical events. The user making the API call will - /// need to have admin privileges, and the application will need to have the - /// scope `manage enterprise properties` checked. - /// - /// - /// Query parameters of getEvents method - /// - /// - /// Headers of getEvents method - /// - /// - /// Token used for request cancellation. - /// - public async System.Threading.Tasks.Task GetEventsAsync(GetEventsQueryParams? queryParams = default, GetEventsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - queryParams = queryParams ?? new GetEventsQueryParams(); - headers = headers ?? new GetEventsHeaders(); - Dictionary queryParamsMap = Utils.PrepareParams(map: new Dictionary() { { "stream_type", StringUtils.ToStringRepresentation(queryParams.StreamType) }, { "stream_position", StringUtils.ToStringRepresentation(queryParams.StreamPosition) }, { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) }, { "event_type", StringUtils.ToStringRepresentation(queryParams.EventType) }, { "created_after", StringUtils.ToStringRepresentation(queryParams.CreatedAfter) }, { "created_before", StringUtils.ToStringRepresentation(queryParams.CreatedBefore) } }); - Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/events"), networkSession: this.NetworkSession) { Method = "GET", Parameters = queryParamsMap, Headers = headersMap, ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); - return SimpleJsonSerializer.Deserialize(response.Data); - } - /// /// Returns a list of real-time servers that can be used for long-polling updates /// to the [event stream](#get-events). @@ -91,5 +62,34 @@ public async System.Threading.Tasks.Task GetEventsWithLongPolli return SimpleJsonSerializer.Deserialize(response.Data); } + /// + /// Returns up to a year of past events for a given user + /// or for the entire enterprise. + /// + /// By default this returns events for the authenticated user. To retrieve events + /// for the entire enterprise, set the `stream_type` to `admin_logs_streaming` + /// for live monitoring of new events, or `admin_logs` for querying across + /// historical events. The user making the API call will + /// need to have admin privileges, and the application will need to have the + /// scope `manage enterprise properties` checked. + /// + /// + /// Query parameters of getEvents method + /// + /// + /// Headers of getEvents method + /// + /// + /// Token used for request cancellation. + /// + public async System.Threading.Tasks.Task GetEventsAsync(GetEventsQueryParams? queryParams = default, GetEventsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + queryParams = queryParams ?? new GetEventsQueryParams(); + headers = headers ?? new GetEventsHeaders(); + Dictionary queryParamsMap = Utils.PrepareParams(map: new Dictionary() { { "stream_type", StringUtils.ToStringRepresentation(queryParams.StreamType) }, { "stream_position", StringUtils.ToStringRepresentation(queryParams.StreamPosition) }, { "limit", StringUtils.ToStringRepresentation(queryParams.Limit) }, { "event_type", StringUtils.ToStringRepresentation(queryParams.EventType) }, { "created_after", StringUtils.ToStringRepresentation(queryParams.CreatedAfter) }, { "created_before", StringUtils.ToStringRepresentation(queryParams.CreatedBefore) } }); + Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/events"), networkSession: this.NetworkSession) { Method = "GET", Parameters = queryParamsMap, Headers = headersMap, ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + return SimpleJsonSerializer.Deserialize(response.Data); + } + } } \ No newline at end of file diff --git a/Box.Sdk.Gen/Managers/Events/GetEventsHeaders.cs b/Box.Sdk.Gen/Managers/Events/GetEventsHeaders.cs index ae4f81ff..b9aec343 100644 --- a/Box.Sdk.Gen/Managers/Events/GetEventsHeaders.cs +++ b/Box.Sdk.Gen/Managers/Events/GetEventsHeaders.cs @@ -1,7 +1,7 @@ using Box.Sdk.Gen; -using System; -using System.Collections.ObjectModel; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System; using Box.Sdk.Gen.Schemas; using Box.Sdk.Gen.Internal; diff --git a/Box.Sdk.Gen/Managers/Events/GetEventsQueryParams.cs b/Box.Sdk.Gen/Managers/Events/GetEventsQueryParams.cs index 2437d8cd..29358c1a 100644 --- a/Box.Sdk.Gen/Managers/Events/GetEventsQueryParams.cs +++ b/Box.Sdk.Gen/Managers/Events/GetEventsQueryParams.cs @@ -1,7 +1,7 @@ using Box.Sdk.Gen; -using System; -using System.Collections.ObjectModel; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System; using Box.Sdk.Gen.Schemas; using Box.Sdk.Gen.Internal; diff --git a/Box.Sdk.Gen/Managers/Events/GetEventsWithLongPollingHeaders.cs b/Box.Sdk.Gen/Managers/Events/GetEventsWithLongPollingHeaders.cs index 34b89dc0..1bdd4e6f 100644 --- a/Box.Sdk.Gen/Managers/Events/GetEventsWithLongPollingHeaders.cs +++ b/Box.Sdk.Gen/Managers/Events/GetEventsWithLongPollingHeaders.cs @@ -1,7 +1,7 @@ using Box.Sdk.Gen; -using System; -using System.Collections.ObjectModel; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System; using Box.Sdk.Gen.Schemas; using Box.Sdk.Gen.Internal; diff --git a/Box.Sdk.Gen/Managers/Events/IEventsManager.cs b/Box.Sdk.Gen/Managers/Events/IEventsManager.cs index fc0d3bc6..cc6680ae 100644 --- a/Box.Sdk.Gen/Managers/Events/IEventsManager.cs +++ b/Box.Sdk.Gen/Managers/Events/IEventsManager.cs @@ -1,34 +1,12 @@ using Box.Sdk.Gen; -using System; -using System.Collections.ObjectModel; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System; using Box.Sdk.Gen.Schemas; using Box.Sdk.Gen.Internal; namespace Box.Sdk.Gen.Managers { public interface IEventsManager { - /// - /// Returns up to a year of past events for a given user - /// or for the entire enterprise. - /// - /// By default this returns events for the authenticated user. To retrieve events - /// for the entire enterprise, set the `stream_type` to `admin_logs_streaming` - /// for live monitoring of new events, or `admin_logs` for querying across - /// historical events. The user making the API call will - /// need to have admin privileges, and the application will need to have the - /// scope `manage enterprise properties` checked. - /// - /// - /// Query parameters of getEvents method - /// - /// - /// Headers of getEvents method - /// - /// - /// Token used for request cancellation. - /// - public System.Threading.Tasks.Task GetEventsAsync(GetEventsQueryParams? queryParams = default, GetEventsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); - /// /// Returns a list of real-time servers that can be used for long-polling updates /// to the [event stream](#get-events). @@ -72,5 +50,27 @@ public interface IEventsManager { /// public System.Threading.Tasks.Task GetEventsWithLongPollingAsync(GetEventsWithLongPollingHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + /// + /// Returns up to a year of past events for a given user + /// or for the entire enterprise. + /// + /// By default this returns events for the authenticated user. To retrieve events + /// for the entire enterprise, set the `stream_type` to `admin_logs_streaming` + /// for live monitoring of new events, or `admin_logs` for querying across + /// historical events. The user making the API call will + /// need to have admin privileges, and the application will need to have the + /// scope `manage enterprise properties` checked. + /// + /// + /// Query parameters of getEvents method + /// + /// + /// Headers of getEvents method + /// + /// + /// Token used for request cancellation. + /// + public System.Threading.Tasks.Task GetEventsAsync(GetEventsQueryParams? queryParams = default, GetEventsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + } } \ No newline at end of file diff --git a/Box.Sdk.Gen/Managers/FileVersions/FileVersionsManager.cs b/Box.Sdk.Gen/Managers/FileVersions/FileVersionsManager.cs index 66ffcd6c..68952bcf 100644 --- a/Box.Sdk.Gen/Managers/FileVersions/FileVersionsManager.cs +++ b/Box.Sdk.Gen/Managers/FileVersions/FileVersionsManager.cs @@ -87,10 +87,9 @@ public async System.Threading.Tasks.Task GetFileVersionByIdAsyn } /// - /// Restores a specific version of a file after it was deleted. - /// Don't use this endpoint to restore Box Notes, - /// as it works with file formats such as PDF, DOC, - /// PPTX or similar. + /// Move a file version to the trash. + /// + /// Versions are only tracked for Box users with premium accounts. /// /// /// The unique identifier that represents a file. @@ -106,27 +105,23 @@ public async System.Threading.Tasks.Task GetFileVersionByIdAsyn /// The ID of the file version /// Example: "1234" /// - /// - /// Request body of updateFileVersionById method - /// /// - /// Headers of updateFileVersionById method + /// Headers of deleteFileVersionById method /// /// /// Token used for request cancellation. /// - public async System.Threading.Tasks.Task UpdateFileVersionByIdAsync(string fileId, string fileVersionId, UpdateFileVersionByIdRequestBody? requestBody = default, UpdateFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - requestBody = requestBody ?? new UpdateFileVersionByIdRequestBody(); - headers = headers ?? new UpdateFileVersionByIdHeaders(); - Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/versions/", StringUtils.ToStringRepresentation(fileVersionId)), networkSession: this.NetworkSession) { Method = "PUT", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); - return SimpleJsonSerializer.Deserialize(response.Data); + public async System.Threading.Tasks.Task DeleteFileVersionByIdAsync(string fileId, string fileVersionId, DeleteFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + headers = headers ?? new DeleteFileVersionByIdHeaders(); + Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { { "if-match", StringUtils.ToStringRepresentation(headers.IfMatch) } }, headers.ExtraHeaders)); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/versions/", StringUtils.ToStringRepresentation(fileVersionId)), networkSession: this.NetworkSession) { Method = "DELETE", Headers = headersMap, ResponseFormat = null, Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); } /// - /// Move a file version to the trash. - /// - /// Versions are only tracked for Box users with premium accounts. + /// Restores a specific version of a file after it was deleted. + /// Don't use this endpoint to restore Box Notes, + /// as it works with file formats such as PDF, DOC, + /// PPTX or similar. /// /// /// The unique identifier that represents a file. @@ -142,16 +137,21 @@ public async System.Threading.Tasks.Task UpdateFileVersionByIdA /// The ID of the file version /// Example: "1234" /// + /// + /// Request body of updateFileVersionById method + /// /// - /// Headers of deleteFileVersionById method + /// Headers of updateFileVersionById method /// /// /// Token used for request cancellation. /// - public async System.Threading.Tasks.Task DeleteFileVersionByIdAsync(string fileId, string fileVersionId, DeleteFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - headers = headers ?? new DeleteFileVersionByIdHeaders(); - Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { { "if-match", StringUtils.ToStringRepresentation(headers.IfMatch) } }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/versions/", StringUtils.ToStringRepresentation(fileVersionId)), networkSession: this.NetworkSession) { Method = "DELETE", Headers = headersMap, ResponseFormat = null, Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + public async System.Threading.Tasks.Task UpdateFileVersionByIdAsync(string fileId, string fileVersionId, UpdateFileVersionByIdRequestBody? requestBody = default, UpdateFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + requestBody = requestBody ?? new UpdateFileVersionByIdRequestBody(); + headers = headers ?? new UpdateFileVersionByIdHeaders(); + Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/versions/", StringUtils.ToStringRepresentation(fileVersionId)), networkSession: this.NetworkSession) { Method = "PUT", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + return SimpleJsonSerializer.Deserialize(response.Data); } /// diff --git a/Box.Sdk.Gen/Managers/FileVersions/IFileVersionsManager.cs b/Box.Sdk.Gen/Managers/FileVersions/IFileVersionsManager.cs index 5ab6f473..b639043d 100644 --- a/Box.Sdk.Gen/Managers/FileVersions/IFileVersionsManager.cs +++ b/Box.Sdk.Gen/Managers/FileVersions/IFileVersionsManager.cs @@ -66,10 +66,9 @@ public interface IFileVersionsManager { public System.Threading.Tasks.Task GetFileVersionByIdAsync(string fileId, string fileVersionId, GetFileVersionByIdQueryParams? queryParams = default, GetFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// - /// Restores a specific version of a file after it was deleted. - /// Don't use this endpoint to restore Box Notes, - /// as it works with file formats such as PDF, DOC, - /// PPTX or similar. + /// Move a file version to the trash. + /// + /// Versions are only tracked for Box users with premium accounts. /// /// /// The unique identifier that represents a file. @@ -85,21 +84,19 @@ public interface IFileVersionsManager { /// The ID of the file version /// Example: "1234" /// - /// - /// Request body of updateFileVersionById method - /// /// - /// Headers of updateFileVersionById method + /// Headers of deleteFileVersionById method /// /// /// Token used for request cancellation. /// - public System.Threading.Tasks.Task UpdateFileVersionByIdAsync(string fileId, string fileVersionId, UpdateFileVersionByIdRequestBody? requestBody = default, UpdateFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + public System.Threading.Tasks.Task DeleteFileVersionByIdAsync(string fileId, string fileVersionId, DeleteFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// - /// Move a file version to the trash. - /// - /// Versions are only tracked for Box users with premium accounts. + /// Restores a specific version of a file after it was deleted. + /// Don't use this endpoint to restore Box Notes, + /// as it works with file formats such as PDF, DOC, + /// PPTX or similar. /// /// /// The unique identifier that represents a file. @@ -115,13 +112,16 @@ public interface IFileVersionsManager { /// The ID of the file version /// Example: "1234" /// + /// + /// Request body of updateFileVersionById method + /// /// - /// Headers of deleteFileVersionById method + /// Headers of updateFileVersionById method /// /// /// Token used for request cancellation. /// - public System.Threading.Tasks.Task DeleteFileVersionByIdAsync(string fileId, string fileVersionId, DeleteFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + public System.Threading.Tasks.Task UpdateFileVersionByIdAsync(string fileId, string fileVersionId, UpdateFileVersionByIdRequestBody? requestBody = default, UpdateFileVersionByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// /// Promote a specific version of a file. diff --git a/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/IShieldInformationBarrierSegmentsManager.cs b/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/IShieldInformationBarrierSegmentsManager.cs index f2a9db5a..554984eb 100644 --- a/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/IShieldInformationBarrierSegmentsManager.cs +++ b/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/IShieldInformationBarrierSegmentsManager.cs @@ -23,38 +23,38 @@ public interface IShieldInformationBarrierSegmentsManager { public System.Threading.Tasks.Task GetShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, GetShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// - /// Updates the shield information barrier segment based on provided ID.. + /// Deletes the shield information barrier segment + /// based on provided ID. /// /// /// The ID of the shield information barrier segment. /// Example: "3423" /// - /// - /// Request body of updateShieldInformationBarrierSegmentById method - /// /// - /// Headers of updateShieldInformationBarrierSegmentById method + /// Headers of deleteShieldInformationBarrierSegmentById method /// /// /// Token used for request cancellation. /// - public System.Threading.Tasks.Task UpdateShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, UpdateShieldInformationBarrierSegmentByIdRequestBody? requestBody = default, UpdateShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + public System.Threading.Tasks.Task DeleteShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, DeleteShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// - /// Deletes the shield information barrier segment - /// based on provided ID. + /// Updates the shield information barrier segment based on provided ID.. /// /// /// The ID of the shield information barrier segment. /// Example: "3423" /// + /// + /// Request body of updateShieldInformationBarrierSegmentById method + /// /// - /// Headers of deleteShieldInformationBarrierSegmentById method + /// Headers of updateShieldInformationBarrierSegmentById method /// /// /// Token used for request cancellation. /// - public System.Threading.Tasks.Task DeleteShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, DeleteShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + public System.Threading.Tasks.Task UpdateShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, UpdateShieldInformationBarrierSegmentByIdRequestBody? requestBody = default, UpdateShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); /// /// Retrieves a list of shield information barrier segment objects diff --git a/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.cs b/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.cs index 4186e3aa..b27e6adc 100644 --- a/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.cs +++ b/Box.Sdk.Gen/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.cs @@ -35,47 +35,47 @@ public async System.Threading.Tasks.Task GetShi } /// - /// Updates the shield information barrier segment based on provided ID.. + /// Deletes the shield information barrier segment + /// based on provided ID. /// /// /// The ID of the shield information barrier segment. /// Example: "3423" /// - /// - /// Request body of updateShieldInformationBarrierSegmentById method - /// /// - /// Headers of updateShieldInformationBarrierSegmentById method + /// Headers of deleteShieldInformationBarrierSegmentById method /// /// /// Token used for request cancellation. /// - public async System.Threading.Tasks.Task UpdateShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, UpdateShieldInformationBarrierSegmentByIdRequestBody? requestBody = default, UpdateShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - requestBody = requestBody ?? new UpdateShieldInformationBarrierSegmentByIdRequestBody(); - headers = headers ?? new UpdateShieldInformationBarrierSegmentByIdHeaders(); + public async System.Threading.Tasks.Task DeleteShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, DeleteShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + headers = headers ?? new DeleteShieldInformationBarrierSegmentByIdHeaders(); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/shield_information_barrier_segments/", StringUtils.ToStringRepresentation(shieldInformationBarrierSegmentId)), networkSession: this.NetworkSession) { Method = "PUT", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); - return SimpleJsonSerializer.Deserialize(response.Data); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/shield_information_barrier_segments/", StringUtils.ToStringRepresentation(shieldInformationBarrierSegmentId)), networkSession: this.NetworkSession) { Method = "DELETE", Headers = headersMap, ResponseFormat = null, Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); } /// - /// Deletes the shield information barrier segment - /// based on provided ID. + /// Updates the shield information barrier segment based on provided ID.. /// /// /// The ID of the shield information barrier segment. /// Example: "3423" /// + /// + /// Request body of updateShieldInformationBarrierSegmentById method + /// /// - /// Headers of deleteShieldInformationBarrierSegmentById method + /// Headers of updateShieldInformationBarrierSegmentById method /// /// /// Token used for request cancellation. /// - public async System.Threading.Tasks.Task DeleteShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, DeleteShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - headers = headers ?? new DeleteShieldInformationBarrierSegmentByIdHeaders(); + public async System.Threading.Tasks.Task UpdateShieldInformationBarrierSegmentByIdAsync(string shieldInformationBarrierSegmentId, UpdateShieldInformationBarrierSegmentByIdRequestBody? requestBody = default, UpdateShieldInformationBarrierSegmentByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + requestBody = requestBody ?? new UpdateShieldInformationBarrierSegmentByIdRequestBody(); + headers = headers ?? new UpdateShieldInformationBarrierSegmentByIdHeaders(); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/shield_information_barrier_segments/", StringUtils.ToStringRepresentation(shieldInformationBarrierSegmentId)), networkSession: this.NetworkSession) { Method = "DELETE", Headers = headersMap, ResponseFormat = null, Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/shield_information_barrier_segments/", StringUtils.ToStringRepresentation(shieldInformationBarrierSegmentId)), networkSession: this.NetworkSession) { Method = "PUT", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + return SimpleJsonSerializer.Deserialize(response.Data); } /// diff --git a/Box.Sdk.Gen/Managers/Uploads/IUploadsManager.cs b/Box.Sdk.Gen/Managers/Uploads/IUploadsManager.cs index e5ada100..7acaa436 100644 --- a/Box.Sdk.Gen/Managers/Uploads/IUploadsManager.cs +++ b/Box.Sdk.Gen/Managers/Uploads/IUploadsManager.cs @@ -41,6 +41,21 @@ public interface IUploadsManager { /// public System.Threading.Tasks.Task UploadFileVersionAsync(string fileId, UploadFileVersionRequestBody requestBody, UploadFileVersionQueryParams? queryParams = default, UploadFileVersionHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + /// + /// Performs a check to verify that a file will be accepted by Box + /// before you upload the entire file. + /// + /// + /// Request body of preflightFileUploadCheck method + /// + /// + /// Headers of preflightFileUploadCheck method + /// + /// + /// Token used for request cancellation. + /// + public System.Threading.Tasks.Task PreflightFileUploadCheckAsync(PreflightFileUploadCheckRequestBody? requestBody = default, PreflightFileUploadCheckHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); + /// /// Uploads a small file to Box. For file sizes over 50MB we recommend /// using the Chunk Upload APIs. @@ -64,20 +79,5 @@ public interface IUploadsManager { /// public System.Threading.Tasks.Task UploadFileAsync(UploadFileRequestBody requestBody, UploadFileQueryParams? queryParams = default, UploadFileHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); - /// - /// Performs a check to verify that a file will be accepted by Box - /// before you upload the entire file. - /// - /// - /// Request body of preflightFileUploadCheck method - /// - /// - /// Headers of preflightFileUploadCheck method - /// - /// - /// Token used for request cancellation. - /// - public System.Threading.Tasks.Task PreflightFileUploadCheckAsync(PreflightFileUploadCheckRequestBody? requestBody = default, PreflightFileUploadCheckHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it."); - } } \ No newline at end of file diff --git a/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs b/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs index 62395534..11cb7737 100644 --- a/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs +++ b/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs @@ -55,6 +55,27 @@ public async System.Threading.Tasks.Task UploadFileVersionAsync(string fi return SimpleJsonSerializer.Deserialize(response.Data); } + /// + /// Performs a check to verify that a file will be accepted by Box + /// before you upload the entire file. + /// + /// + /// Request body of preflightFileUploadCheck method + /// + /// + /// Headers of preflightFileUploadCheck method + /// + /// + /// Token used for request cancellation. + /// + public async System.Threading.Tasks.Task PreflightFileUploadCheckAsync(PreflightFileUploadCheckRequestBody? requestBody = default, PreflightFileUploadCheckHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { + requestBody = requestBody ?? new PreflightFileUploadCheckRequestBody(); + headers = headers ?? new PreflightFileUploadCheckHeaders(); + Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/content"), networkSession: this.NetworkSession) { Method = "OPTIONS", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + return SimpleJsonSerializer.Deserialize(response.Data); + } + /// /// Uploads a small file to Box. For file sizes over 50MB we recommend /// using the Chunk Upload APIs. @@ -85,26 +106,5 @@ public async System.Threading.Tasks.Task UploadFileAsync(UploadFileReques return SimpleJsonSerializer.Deserialize(response.Data); } - /// - /// Performs a check to verify that a file will be accepted by Box - /// before you upload the entire file. - /// - /// - /// Request body of preflightFileUploadCheck method - /// - /// - /// Headers of preflightFileUploadCheck method - /// - /// - /// Token used for request cancellation. - /// - public async System.Threading.Tasks.Task PreflightFileUploadCheckAsync(PreflightFileUploadCheckRequestBody? requestBody = default, PreflightFileUploadCheckHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { - requestBody = requestBody ?? new PreflightFileUploadCheckRequestBody(); - headers = headers ?? new PreflightFileUploadCheckHeaders(); - Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/files/content"), networkSession: this.NetworkSession) { Method = "OPTIONS", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); - return SimpleJsonSerializer.Deserialize(response.Data); - } - } } \ No newline at end of file diff --git a/docs/Events.md b/docs/Events.md index c9e62782..1cfe2e95 100644 --- a/docs/Events.md +++ b/docs/Events.md @@ -1,53 +1,8 @@ # IEventsManager -- [List user and enterprise events](#list-user-and-enterprise-events) - [Get events long poll endpoint](#get-events-long-poll-endpoint) - -## List user and enterprise events - -Returns up to a year of past events for a given user -or for the entire enterprise. - -By default this returns events for the authenticated user. To retrieve events -for the entire enterprise, set the `stream_type` to `admin_logs_streaming` -for live monitoring of new events, or `admin_logs` for querying across -historical events. The user making the API call will -need to have admin privileges, and the application will need to have the -scope `manage enterprise properties` checked. - -This operation is performed by calling function `GetEvents`. - -See the endpoint docs at -[API Reference](https://developer.box.com/reference/get-events/). - - -``` -await client.Events.GetEventsAsync(queryParams: new GetEventsQueryParams() { StreamType = GetEventsQueryParamsStreamTypeField.AdminLogs, Limit = 1, CreatedAfter = createdAfterDate, CreatedBefore = createdBeforeDate }); -``` - -### Arguments - -- queryParams `GetEventsQueryParams` - - Query parameters of getEvents method -- headers `GetEventsHeaders` - - Headers of getEvents method -- cancellationToken `System.Threading.CancellationToken?` - - Token used for request cancellation. - - -### Returns - -This function returns a value of type `Events`. - -Returns a list of event objects. - -Events objects are returned in pages, with each page (chunk) -including a list of event objects. The response includes a -`chunk_size` parameter indicating how many events were returned in this -chunk, as well as the next `stream_position` that can be -queried. - +- [List user and enterprise events](#list-user-and-enterprise-events) ## Get events long poll endpoint @@ -111,3 +66,48 @@ Returns a paginated array of servers that can be used instead of the regular endpoints for long-polling events. +## List user and enterprise events + +Returns up to a year of past events for a given user +or for the entire enterprise. + +By default this returns events for the authenticated user. To retrieve events +for the entire enterprise, set the `stream_type` to `admin_logs_streaming` +for live monitoring of new events, or `admin_logs` for querying across +historical events. The user making the API call will +need to have admin privileges, and the application will need to have the +scope `manage enterprise properties` checked. + +This operation is performed by calling function `GetEvents`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/get-events/). + + +``` +await client.Events.GetEventsAsync(queryParams: new GetEventsQueryParams() { StreamType = GetEventsQueryParamsStreamTypeField.AdminLogs, Limit = 1, CreatedAfter = createdAfterDate, CreatedBefore = createdBeforeDate }); +``` + +### Arguments + +- queryParams `GetEventsQueryParams` + - Query parameters of getEvents method +- headers `GetEventsHeaders` + - Headers of getEvents method +- cancellationToken `System.Threading.CancellationToken?` + - Token used for request cancellation. + + +### Returns + +This function returns a value of type `Events`. + +Returns a list of event objects. + +Events objects are returned in pages, with each page (chunk) +including a list of event objects. The response includes a +`chunk_size` parameter indicating how many events were returned in this +chunk, as well as the next `stream_position` that can be +queried. + + diff --git a/docs/FileVersions.md b/docs/FileVersions.md index 352d2d88..259f7711 100644 --- a/docs/FileVersions.md +++ b/docs/FileVersions.md @@ -3,8 +3,8 @@ - [List all file versions](#list-all-file-versions) - [Get file version](#get-file-version) -- [Restore file version](#restore-file-version) - [Remove file version](#remove-file-version) +- [Restore file version](#restore-file-version) - [Promote file version](#promote-file-version) ## List all file versions @@ -84,21 +84,20 @@ Not all available fields are returned by default. Use the any specific fields. -## Restore file version +## Remove file version -Restores a specific version of a file after it was deleted. -Don't use this endpoint to restore Box Notes, -as it works with file formats such as PDF, DOC, -PPTX or similar. +Move a file version to the trash. -This operation is performed by calling function `UpdateFileVersionById`. +Versions are only tracked for Box users with premium accounts. + +This operation is performed by calling function `DeleteFileVersionById`. See the endpoint docs at -[API Reference](https://developer.box.com/reference/put-files-id-versions-id/). +[API Reference](https://developer.box.com/reference/delete-files-id-versions-id/). - + ``` -await client.FileVersions.UpdateFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id, requestBody: new UpdateFileVersionByIdRequestBody() { TrashedAt = null }); +await client.FileVersions.DeleteFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id); ``` ### Arguments @@ -107,35 +106,35 @@ await client.FileVersions.UpdateFileVersionByIdAsync(fileId: file.Id, fileVersio - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345" - fileVersionId `string` - The ID of the file version Example: "1234" -- requestBody `UpdateFileVersionByIdRequestBody` - - Request body of updateFileVersionById method -- headers `UpdateFileVersionByIdHeaders` - - Headers of updateFileVersionById method +- headers `DeleteFileVersionByIdHeaders` + - Headers of deleteFileVersionById method - cancellationToken `System.Threading.CancellationToken?` - Token used for request cancellation. ### Returns -This function returns a value of type `FileVersionFull`. - -Returns a restored file version object. +This function returns a value of type `null`. +Returns an empty response when the file has been successfully +deleted. -## Remove file version -Move a file version to the trash. +## Restore file version -Versions are only tracked for Box users with premium accounts. +Restores a specific version of a file after it was deleted. +Don't use this endpoint to restore Box Notes, +as it works with file formats such as PDF, DOC, +PPTX or similar. -This operation is performed by calling function `DeleteFileVersionById`. +This operation is performed by calling function `UpdateFileVersionById`. See the endpoint docs at -[API Reference](https://developer.box.com/reference/delete-files-id-versions-id/). +[API Reference](https://developer.box.com/reference/put-files-id-versions-id/). - + ``` -await client.FileVersions.DeleteFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id); +await client.FileVersions.UpdateFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id, requestBody: new UpdateFileVersionByIdRequestBody() { TrashedAt = null }); ``` ### Arguments @@ -144,18 +143,19 @@ await client.FileVersions.DeleteFileVersionByIdAsync(fileId: file.Id, fileVersio - The unique identifier that represents a file. The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` is `123`. Example: "12345" - fileVersionId `string` - The ID of the file version Example: "1234" -- headers `DeleteFileVersionByIdHeaders` - - Headers of deleteFileVersionById method +- requestBody `UpdateFileVersionByIdRequestBody` + - Request body of updateFileVersionById method +- headers `UpdateFileVersionByIdHeaders` + - Headers of updateFileVersionById method - cancellationToken `System.Threading.CancellationToken?` - Token used for request cancellation. ### Returns -This function returns a value of type `null`. +This function returns a value of type `FileVersionFull`. -Returns an empty response when the file has been successfully -deleted. +Returns a restored file version object. ## Promote file version diff --git a/docs/ShieldInformationBarrierSegments.md b/docs/ShieldInformationBarrierSegments.md index dd8bcf78..7456046d 100644 --- a/docs/ShieldInformationBarrierSegments.md +++ b/docs/ShieldInformationBarrierSegments.md @@ -2,8 +2,8 @@ - [Get shield information barrier segment with specified ID](#get-shield-information-barrier-segment-with-specified-id) -- [Update shield information barrier segment with specified ID](#update-shield-information-barrier-segment-with-specified-id) - [Delete shield information barrier segment](#delete-shield-information-barrier-segment) +- [Update shield information barrier segment with specified ID](#update-shield-information-barrier-segment-with-specified-id) - [List shield information barrier segments](#list-shield-information-barrier-segments) - [Create shield information barrier segment](#create-shield-information-barrier-segment) @@ -38,69 +38,69 @@ This function returns a value of type `ShieldInformationBarrierSegment`. Returns the shield information barrier segment object. -## Update shield information barrier segment with specified ID +## Delete shield information barrier segment -Updates the shield information barrier segment based on provided ID.. +Deletes the shield information barrier segment +based on provided ID. -This operation is performed by calling function `UpdateShieldInformationBarrierSegmentById`. +This operation is performed by calling function `DeleteShieldInformationBarrierSegmentById`. See the endpoint docs at -[API Reference](https://developer.box.com/reference/put-shield-information-barrier-segments-id/). +[API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segments-id/). - + ``` -await client.ShieldInformationBarrierSegments.UpdateShieldInformationBarrierSegmentByIdAsync(shieldInformationBarrierSegmentId: segmentId, requestBody: new UpdateShieldInformationBarrierSegmentByIdRequestBody() { Description = updatedSegmentDescription }); +await client.ShieldInformationBarrierSegments.DeleteShieldInformationBarrierSegmentByIdAsync(shieldInformationBarrierSegmentId: NullableUtils.Unwrap(segment.Id)); ``` ### Arguments - shieldInformationBarrierSegmentId `string` - The ID of the shield information barrier segment. Example: "3423" -- requestBody `UpdateShieldInformationBarrierSegmentByIdRequestBody` - - Request body of updateShieldInformationBarrierSegmentById method -- headers `UpdateShieldInformationBarrierSegmentByIdHeaders` - - Headers of updateShieldInformationBarrierSegmentById method +- headers `DeleteShieldInformationBarrierSegmentByIdHeaders` + - Headers of deleteShieldInformationBarrierSegmentById method - cancellationToken `System.Threading.CancellationToken?` - Token used for request cancellation. ### Returns -This function returns a value of type `ShieldInformationBarrierSegment`. +This function returns a value of type `null`. -Returns the updated shield information barrier segment object. +Empty body in response -## Delete shield information barrier segment +## Update shield information barrier segment with specified ID -Deletes the shield information barrier segment -based on provided ID. +Updates the shield information barrier segment based on provided ID.. -This operation is performed by calling function `DeleteShieldInformationBarrierSegmentById`. +This operation is performed by calling function `UpdateShieldInformationBarrierSegmentById`. See the endpoint docs at -[API Reference](https://developer.box.com/reference/delete-shield-information-barrier-segments-id/). +[API Reference](https://developer.box.com/reference/put-shield-information-barrier-segments-id/). - + ``` -await client.ShieldInformationBarrierSegments.DeleteShieldInformationBarrierSegmentByIdAsync(shieldInformationBarrierSegmentId: NullableUtils.Unwrap(segment.Id)); +await client.ShieldInformationBarrierSegments.UpdateShieldInformationBarrierSegmentByIdAsync(shieldInformationBarrierSegmentId: segmentId, requestBody: new UpdateShieldInformationBarrierSegmentByIdRequestBody() { Description = updatedSegmentDescription }); ``` ### Arguments - shieldInformationBarrierSegmentId `string` - The ID of the shield information barrier segment. Example: "3423" -- headers `DeleteShieldInformationBarrierSegmentByIdHeaders` - - Headers of deleteShieldInformationBarrierSegmentById method +- requestBody `UpdateShieldInformationBarrierSegmentByIdRequestBody` + - Request body of updateShieldInformationBarrierSegmentById method +- headers `UpdateShieldInformationBarrierSegmentByIdHeaders` + - Headers of updateShieldInformationBarrierSegmentById method - cancellationToken `System.Threading.CancellationToken?` - Token used for request cancellation. ### Returns -This function returns a value of type `null`. +This function returns a value of type `ShieldInformationBarrierSegment`. -Empty body in response +Returns the updated shield information barrier segment object. ## List shield information barrier segments diff --git a/docs/Uploads.md b/docs/Uploads.md index e2e0d1fb..f6fab6ab 100644 --- a/docs/Uploads.md +++ b/docs/Uploads.md @@ -2,8 +2,8 @@ - [Upload file version](#upload-file-version) -- [Upload file](#upload-file) - [Preflight check before upload](#preflight-check-before-upload) +- [Upload file](#upload-file) ## Upload file version @@ -46,6 +46,36 @@ This function returns a value of type `Files`. Returns the new file object in a list. +## Preflight check before upload + +Performs a check to verify that a file will be accepted by Box +before you upload the entire file. + +This operation is performed by calling function `PreflightFileUploadCheck`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/options-files-content/). + +*Currently we don't have an example for calling `PreflightFileUploadCheck` in integration tests* + +### Arguments + +- requestBody `PreflightFileUploadCheckRequestBody` + - Request body of preflightFileUploadCheck method +- headers `PreflightFileUploadCheckHeaders` + - Headers of preflightFileUploadCheck method +- cancellationToken `System.Threading.CancellationToken?` + - Token used for request cancellation. + + +### Returns + +This function returns a value of type `UploadUrl`. + +If the check passed, the response will include a session URL that +can be used to upload the file to. + + ## Upload file Uploads a small file to Box. For file sizes over 50MB we recommend @@ -85,33 +115,3 @@ This function returns a value of type `Files`. Returns the new file object in a list. -## Preflight check before upload - -Performs a check to verify that a file will be accepted by Box -before you upload the entire file. - -This operation is performed by calling function `PreflightFileUploadCheck`. - -See the endpoint docs at -[API Reference](https://developer.box.com/reference/options-files-content/). - -*Currently we don't have an example for calling `PreflightFileUploadCheck` in integration tests* - -### Arguments - -- requestBody `PreflightFileUploadCheckRequestBody` - - Request body of preflightFileUploadCheck method -- headers `PreflightFileUploadCheckHeaders` - - Headers of preflightFileUploadCheck method -- cancellationToken `System.Threading.CancellationToken?` - - Token used for request cancellation. - - -### Returns - -This function returns a value of type `UploadUrl`. - -If the check passed, the response will include a session URL that -can be used to upload the file to. - - From 5ac855cd29dbc22f512c624dcce35e4048dc24ba Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 6 Sep 2024 08:14:49 -0700 Subject: [PATCH 2/4] chore: Update .codegen.json with commit hash of codegen and openapi spec --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index e65c475b..8498eef7 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "52180cf", "specHash": "6ca858e", "version": "1.1.0" } +{ "engineHash": "5d1b305", "specHash": "6ca858e", "version": "1.1.0" } From 8fd2766a2ef02ce87fd8db0c6b2ff9fb38cc65e6 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Mon, 9 Sep 2024 06:08:47 -0700 Subject: [PATCH 3/4] fix: Fix the license name when building library (box/box-codegen#562) --- .codegen.json | 2 +- Box.Sdk.Gen/Box.Sdk.Gen.csproj | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 8498eef7..fba09a3c 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "5d1b305", "specHash": "6ca858e", "version": "1.1.0" } +{ "engineHash": "5b7aecf", "specHash": "6ca858e", "version": "1.1.0" } diff --git a/Box.Sdk.Gen/Box.Sdk.Gen.csproj b/Box.Sdk.Gen/Box.Sdk.Gen.csproj index aeda2beb..e8b831db 100644 --- a/Box.Sdk.Gen/Box.Sdk.Gen.csproj +++ b/Box.Sdk.Gen/Box.Sdk.Gen.csproj @@ -3,6 +3,7 @@ net6.0 1.1.0 + Official Box .Net Generated SDK Apache-2.0 enable true From fa723eaa84aaddd955f07b07fad51c1bf37166cd Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Mon, 9 Sep 2024 23:12:42 -0700 Subject: [PATCH 4/4] docs: update urls and AI models (box/box-openapi#454) --- .codegen.json | 2 +- Box.Sdk.Gen/Managers/ChunkedUploads/ChunkedUploadsManager.cs | 4 ++-- Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs | 4 ++-- .../AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.codegen.json b/.codegen.json index fba09a3c..effda484 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "5b7aecf", "specHash": "6ca858e", "version": "1.1.0" } +{ "engineHash": "5b7aecf", "specHash": "368fe5a", "version": "1.1.0" } diff --git a/Box.Sdk.Gen/Managers/ChunkedUploads/ChunkedUploadsManager.cs b/Box.Sdk.Gen/Managers/ChunkedUploads/ChunkedUploadsManager.cs index 2be8e5d1..0cfcc912 100644 --- a/Box.Sdk.Gen/Managers/ChunkedUploads/ChunkedUploadsManager.cs +++ b/Box.Sdk.Gen/Managers/ChunkedUploads/ChunkedUploadsManager.cs @@ -31,7 +31,7 @@ public ChunkedUploadsManager(NetworkSession? networkSession = default) { public async System.Threading.Tasks.Task CreateFileUploadSessionAsync(CreateFileUploadSessionRequestBody requestBody, CreateFileUploadSessionHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { headers = headers ?? new CreateFileUploadSessionHeaders(); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.UploadUrl, "/2.0/files/upload_sessions"), networkSession: this.NetworkSession) { Method = "POST", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat("https://upload.box.com/2.0/files/upload_sessions"), networkSession: this.NetworkSession) { Method = "POST", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); return SimpleJsonSerializer.Deserialize(response.Data); } @@ -60,7 +60,7 @@ public async System.Threading.Tasks.Task CreateFileUploadSessionA public async System.Threading.Tasks.Task CreateFileUploadSessionForExistingFileAsync(string fileId, CreateFileUploadSessionForExistingFileRequestBody requestBody, CreateFileUploadSessionForExistingFileHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) { headers = headers ?? new CreateFileUploadSessionForExistingFileHeaders(); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.UploadUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/upload_sessions"), networkSession: this.NetworkSession) { Method = "POST", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat("https://upload.box.com/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/upload_sessions"), networkSession: this.NetworkSession) { Method = "POST", Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), ContentType = "application/json", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); return SimpleJsonSerializer.Deserialize(response.Data); } diff --git a/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs b/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs index 11cb7737..78e3a8cc 100644 --- a/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs +++ b/Box.Sdk.Gen/Managers/Uploads/UploadsManager.cs @@ -51,7 +51,7 @@ public async System.Threading.Tasks.Task UploadFileVersionAsync(string fi headers = headers ?? new UploadFileVersionHeaders(); Dictionary queryParamsMap = Utils.PrepareParams(map: new Dictionary() { { "fields", StringUtils.ToStringRepresentation(queryParams.Fields) } }); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { { "if-match", StringUtils.ToStringRepresentation(headers.IfMatch) }, { "content-md5", StringUtils.ToStringRepresentation(headers.ContentMd5) } }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.UploadUrl, "/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/content"), networkSession: this.NetworkSession) { Method = "POST", Parameters = queryParamsMap, Headers = headersMap, MultipartData = Array.AsReadOnly(new [] {new MultipartItem(partName: "attributes") { Data = SimpleJsonSerializer.Serialize(requestBody.Attributes) },new MultipartItem(partName: "file") { FileStream = requestBody.File, FileName = requestBody.FileFileName, ContentType = requestBody.FileContentType }}), ContentType = "multipart/form-data", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat("https://upload.box.com/2.0/files/", StringUtils.ToStringRepresentation(fileId), "/content"), networkSession: this.NetworkSession) { Method = "POST", Parameters = queryParamsMap, Headers = headersMap, MultipartData = Array.AsReadOnly(new [] {new MultipartItem(partName: "attributes") { Data = SimpleJsonSerializer.Serialize(requestBody.Attributes) },new MultipartItem(partName: "file") { FileStream = requestBody.File, FileName = requestBody.FileFileName, ContentType = requestBody.FileContentType }}), ContentType = "multipart/form-data", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); return SimpleJsonSerializer.Deserialize(response.Data); } @@ -102,7 +102,7 @@ public async System.Threading.Tasks.Task UploadFileAsync(UploadFileReques headers = headers ?? new UploadFileHeaders(); Dictionary queryParamsMap = Utils.PrepareParams(map: new Dictionary() { { "fields", StringUtils.ToStringRepresentation(queryParams.Fields) } }); Dictionary headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary() { { "content-md5", StringUtils.ToStringRepresentation(headers.ContentMd5) } }, headers.ExtraHeaders)); - FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.UploadUrl, "/2.0/files/content"), networkSession: this.NetworkSession) { Method = "POST", Parameters = queryParamsMap, Headers = headersMap, MultipartData = Array.AsReadOnly(new [] {new MultipartItem(partName: "attributes") { Data = SimpleJsonSerializer.Serialize(requestBody.Attributes) },new MultipartItem(partName: "file") { FileStream = requestBody.File, FileName = requestBody.FileFileName, ContentType = requestBody.FileContentType }}), ContentType = "multipart/form-data", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); + FetchResponse response = await HttpClientAdapter.FetchAsync(new FetchOptions(url: string.Concat("https://upload.box.com/2.0/files/content"), networkSession: this.NetworkSession) { Method = "POST", Parameters = queryParamsMap, Headers = headersMap, MultipartData = Array.AsReadOnly(new [] {new MultipartItem(partName: "attributes") { Data = SimpleJsonSerializer.Serialize(requestBody.Attributes) },new MultipartItem(partName: "file") { FileStream = requestBody.File, FileName = requestBody.FileFileName, ContentType = requestBody.FileContentType }}), ContentType = "multipart/form-data", ResponseFormat = "json", Auth = this.Auth, CancellationToken = cancellationToken }).ConfigureAwait(false); return SimpleJsonSerializer.Deserialize(response.Data); } diff --git a/Box.Sdk.Gen/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.cs b/Box.Sdk.Gen/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.cs index 2e177f94..2667bf93 100644 --- a/Box.Sdk.Gen/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.cs +++ b/Box.Sdk.Gen/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.cs @@ -5,7 +5,7 @@ namespace Box.Sdk.Gen.Schemas { public class AiAgentBasicTextToolBase { /// - /// The model used for the AI Agent for basic text. + /// The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// [JsonPropertyName("model")] public string? Model { get; init; }