diff --git a/.codegen.json b/.codegen.json index de5fde3b..43223115 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "66f851a", "specHash": "6ca858e", "version": "0.4.0" } +{ "engineHash": "5b7aecf", "specHash": "b21666d", "version": "0.4.0" } diff --git a/BoxSdkGen.podspec b/BoxSdkGen.podspec index 3069d3cb..404c5b98 100644 --- a/BoxSdkGen.podspec +++ b/BoxSdkGen.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |spec| spec.version = '0.4.0' spec.summary = 'Official Box Swift Generated SDK' spec.homepage = 'https://github.com/box/box-swift-sdk-gen' - spec.license = 'Apache-2.0, http://www.apache.org/licenses/LICENSE-2.0' + spec.license = 'Apache License, Version 2.0' spec.author = { 'Box' => 'sdks@box.com' } spec.osx.deployment_target = '10.15' spec.ios.deployment_target = '13.0' diff --git a/BoxSdkGen.xcodeproj/project.pbxproj b/BoxSdkGen.xcodeproj/project.pbxproj index 0d944a15..35b3a737 100644 --- a/BoxSdkGen.xcodeproj/project.pbxproj +++ b/BoxSdkGen.xcodeproj/project.pbxproj @@ -172,6 +172,7 @@ 06ACCB5C2AF34CB1AE28910E /* FoldersManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D28B17A8E8150F014F5DB68 /* FoldersManager.swift */; }; 06B19DA0F997653A80AFC7FB /* Group.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24C1ADB8963A961E8C5917DF /* Group.swift */; }; 06D52DBC3E2BA0416B2605D4 /* FetchOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DF779ABB671F170A69E290 /* FetchOptions.swift */; }; + 06D6439133E98F472B02E9A4 /* FileFullOrFolderFull.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */; }; 06D8EFB8E2C28905631C0BD2 /* TermsOfServicesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC42BAA13143AA438A1313C /* TermsOfServicesManager.swift */; }; 06E1384698430F13D396C6C8 /* TermsOfServicesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC42BAA13143AA438A1313C /* TermsOfServicesManager.swift */; }; 06ECF92E677DBC60C97C977F /* AiAgentAskTypeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5F6B3CA8CA06EED8795C17 /* AiAgentAskTypeField.swift */; }; @@ -2955,6 +2956,7 @@ 6B665436C3E6BE8533F37922 /* UpdateShieldInformationBarrierStatusHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = CECEC7C474CD42FFBE28B23D /* UpdateShieldInformationBarrierStatusHeaders.swift */; }; 6B6B1D10A3E7F1E4C6AE0AC2 /* ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980B0EC6B7EAE7605493CEB6 /* ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentTypeField.swift */; }; 6B70F5B1E91961F72EF23C1C /* GetStoragePolicyAssignmentsQueryParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9B7643B78D80D6D73E0596C /* GetStoragePolicyAssignmentsQueryParams.swift */; }; + 6B8C3CBEA6254FEC0EBE9617 /* FileFullOrFolderFull.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */; }; 6BA0158D7205CE792C66502F /* CreateFolderHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F85F209B4F43490951B6926 /* CreateFolderHeaders.swift */; }; 6BA2BF05AFF3AFF0DCDB3308 /* WorkflowFlowsField.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2A93D775DB96903F44DE68 /* WorkflowFlowsField.swift */; }; 6BA84AAD3C50694CC3947959 /* GetSharedLinkForFileHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = D491C259199E4D68B36500A7 /* GetSharedLinkForFileHeaders.swift */; }; @@ -3813,6 +3815,7 @@ 897F0EBA8AFD67F248DDE448 /* UpdateFileWatermarkHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = C66D5D924F2550614874AE64 /* UpdateFileWatermarkHeaders.swift */; }; 898D6506A72720B236DF7A10 /* IntegrationMappingPartnerItemSlackTypeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 328A5DBD260E759962A08D8A /* IntegrationMappingPartnerItemSlackTypeField.swift */; }; 8991116DE98969AE54C3D904 /* CreateTermsOfServiceRequestBodyStatusField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7DA1ECBD15954228727168 /* CreateTermsOfServiceRequestBodyStatusField.swift */; }; + 899554EB29267383911373B4 /* FileFullOrFolderFull.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */; }; 89A092E3D83FFF626FFDB225 /* AiLlmEndpointParamsOpenAi.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECE64C8A5434783C308D4069 /* AiLlmEndpointParamsOpenAi.swift */; }; 89B18C386C619FA7AD4B1B0D /* CollaborationAllowlistEntries.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF79024082B759AD5BA50686 /* CollaborationAllowlistEntries.swift */; }; 89BDE851292549CBA90E9B5B /* CreateCollaborationWhitelistExemptTargetRequestBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9928C2AFB22831C29ECDD188 /* CreateCollaborationWhitelistExemptTargetRequestBody.swift */; }; @@ -6246,6 +6249,7 @@ E32352AD22ED9E68B0886E2B /* NetworkSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E3DD76EB5AC82E44D448DE6 /* NetworkSettings.swift */; }; E3317AAF4DAF6CFA40F5BA7D /* GetEventsWithLongPollingHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93731188D9EAE20D3C3959C /* GetEventsWithLongPollingHeaders.swift */; }; E33FB5AAD708831A476871B1 /* KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6056360BEB0DF533978E0287 /* KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.swift */; }; + E3488AE52C633D54CC2C4523 /* FileFullOrFolderFull.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */; }; E34D203BC68172FFFBC52040 /* TranscriptSkillCardEntriesField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96377B179DF272DF395CFB38 /* TranscriptSkillCardEntriesField.swift */; }; E34DE64ED9A05FCC020AF7AA /* GetGlobalMetadataTemplatesQueryParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC8F5E7CF39D27FD21C6FAE /* GetGlobalMetadataTemplatesQueryParams.swift */; }; E35579CC6100B920F02946F5 /* TaskAssignmentResolutionStateField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8575849F734C41B2B05888AA /* TaskAssignmentResolutionStateField.swift */; }; @@ -6374,6 +6378,7 @@ E86398447BBC244EFBCF2593 /* TemplateSigner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74B2B928926D996A84FA81E /* TemplateSigner.swift */; }; E8692F89927EB8A4F9385487 /* TranscriptSkillCardSkillField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68612D72BD9F662F706A10F1 /* TranscriptSkillCardSkillField.swift */; }; E86B0F2BD32B1F5C7EBA15E3 /* GetClassificationTemplateHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45AA6B6E3EF3094C9737DD74 /* GetClassificationTemplateHeaders.swift */; }; + E871F4BAED48D5D3575F2831 /* FileFullOrFolderFull.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */; }; E89D3FFFA8541B51B84A5DB7 /* GenericSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71603BB98A7A626BA0A4C272 /* GenericSource.swift */; }; E8A639EF80497045072F5A60 /* MetadataTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF99FAB7BBCC6A0DBF95656D /* MetadataTemplate.swift */; }; E8A8949448E239FCDCA20D54 /* GetLegalHoldPoliciesHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8C5890CE436F2C0AC057C2 /* GetLegalHoldPoliciesHeaders.swift */; }; @@ -8054,6 +8059,7 @@ B4C9A54C4E8EA680CE92BA8C /* GetFolderByIdHeaders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetFolderByIdHeaders.swift; sourceTree = ""; }; B4E2AFE72A96C0AF7BF6B6DC /* DeleteMetadataCascadePolicyByIdHeaders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteMetadataCascadePolicyByIdHeaders.swift; sourceTree = ""; }; B4EEA4E214F325F2FE8C37D3 /* UpdateMetadataTemplateRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateMetadataTemplateRequestBody.swift; sourceTree = ""; }; + B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileFullOrFolderFull.swift; sourceTree = ""; }; B5C7DCF306BD092A63400937 /* TimelineSkillCardInvocationField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineSkillCardInvocationField.swift; sourceTree = ""; }; B5D8E01BC252337559B79F89 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; B5F0E7FC1E77566597F0543D /* CopyFileRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyFileRequestBody.swift; sourceTree = ""; }; @@ -10896,6 +10902,14 @@ path = AiAgentAsk; sourceTree = ""; }; + ADC4DD0A9E10F7F59C0FAB69 /* FileFullOrFolderFull */ = { + isa = PBXGroup; + children = ( + B55A5FDAD334397C1DAFCD8A /* FileFullOrFolderFull.swift */, + ); + path = FileFullOrFolderFull; + sourceTree = ""; + }; AE48A2E70D54618C997BDACE /* Items */ = { isa = PBXGroup; children = ( @@ -12210,6 +12224,7 @@ 6950C680475F878865682F4F /* FileBaseOrFolderBaseOrWebLinkBase */, 72D78CCE0C313286748E2704 /* FileConflict */, 27D02AEE32C62EFF7A49BB05 /* FileFull */, + ADC4DD0A9E10F7F59C0FAB69 /* FileFullOrFolderFull */, 569835C52CFF9E54B335C8D0 /* FileFullOrFolderFullOrWebLink */, DD857B1FEE335526270C9DF2 /* FileFullOrFolderMiniOrWebLink */, E988FA8748F04848CF0A6BC3 /* FileMini */, @@ -13010,6 +13025,7 @@ 10F446F0C79936F19727819E /* FileFullLockField.swift in Sources */, DD8142CB60144C5F355062DC /* FileFullLockTypeField.swift in Sources */, 910A329EB7EC5D15B958C6AE /* FileFullMetadataField.swift in Sources */, + 899554EB29267383911373B4 /* FileFullOrFolderFull.swift in Sources */, C52CC9291BBE1248CAFD0FD5 /* FileFullOrFolderFullOrWebLink.swift in Sources */, 7A69485EF4D032EBB47BB2CB /* FileFullOrFolderMiniOrWebLink.swift in Sources */, 4B51A0A8E6D62C027E5C4378 /* FileFullPermissionsField.swift in Sources */, @@ -14421,6 +14437,7 @@ AAEA3004823BF7324F2C42A8 /* FileFullLockField.swift in Sources */, D0FBE3A11D89D4A97E6CF5B7 /* FileFullLockTypeField.swift in Sources */, 80C9C4B96BD4BF9CAF431FE1 /* FileFullMetadataField.swift in Sources */, + 6B8C3CBEA6254FEC0EBE9617 /* FileFullOrFolderFull.swift in Sources */, AE4CE959BCC58386D8C3E3D5 /* FileFullOrFolderFullOrWebLink.swift in Sources */, 20EA6A8A3410BAF52452DA31 /* FileFullOrFolderMiniOrWebLink.swift in Sources */, 884997DD3228444BB60D5BF9 /* FileFullPermissionsField.swift in Sources */, @@ -15832,6 +15849,7 @@ AD11E1DEC06BA86D52790429 /* FileFullLockField.swift in Sources */, A2DA055D4A5E7D36D142480C /* FileFullLockTypeField.swift in Sources */, A7592FA37897A6BAB149CBE4 /* FileFullMetadataField.swift in Sources */, + E3488AE52C633D54CC2C4523 /* FileFullOrFolderFull.swift in Sources */, 9C7FD8AFDE38AA1280A10D9A /* FileFullOrFolderFullOrWebLink.swift in Sources */, 2588B36B6F48A33AD80852CD /* FileFullOrFolderMiniOrWebLink.swift in Sources */, F82840EDEF41B7EF2983B2BD /* FileFullPermissionsField.swift in Sources */, @@ -17243,6 +17261,7 @@ B9202869EF03032B301C96D7 /* FileFullLockField.swift in Sources */, 984628A9ED3AFE9091170037 /* FileFullLockTypeField.swift in Sources */, 8A5CA62D4D8B4041941AE9BF /* FileFullMetadataField.swift in Sources */, + E871F4BAED48D5D3575F2831 /* FileFullOrFolderFull.swift in Sources */, 8551B226007BFC6BBD55295B /* FileFullOrFolderFullOrWebLink.swift in Sources */, 56F87AFB157CD9E667A218E3 /* FileFullOrFolderMiniOrWebLink.swift in Sources */, 9B0CFA2DE74A641127048811 /* FileFullPermissionsField.swift in Sources */, @@ -18654,6 +18673,7 @@ 8531E09B548C910D1A35A8E8 /* FileFullLockField.swift in Sources */, 603DDB772078D24FA213C4A6 /* FileFullLockTypeField.swift in Sources */, 5E044E0A3DF8BC19B5487555 /* FileFullMetadataField.swift in Sources */, + 06D6439133E98F472B02E9A4 /* FileFullOrFolderFull.swift in Sources */, 05DE6FB00B1E2E8918BA0BBC /* FileFullOrFolderFullOrWebLink.swift in Sources */, 8EE6C453EC6235A8FF38112C /* FileFullOrFolderMiniOrWebLink.swift in Sources */, 111DCFDC2D3F03FCF51A0DF4 /* FileFullPermissionsField.swift in Sources */, diff --git a/Sources/Managers/Events/EventsManager.swift b/Sources/Managers/Events/EventsManager.swift index 6e09bd26..bcdf2af2 100644 --- a/Sources/Managers/Events/EventsManager.swift +++ b/Sources/Managers/Events/EventsManager.swift @@ -10,28 +10,6 @@ public class EventsManager { self.networkSession = 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. - /// - /// - Parameters: - /// - queryParams: Query parameters of getEvents method - /// - headers: Headers of getEvents method - /// - Returns: The `Events`. - /// - Throws: The `GeneralError`. - public func getEvents(queryParams: GetEventsQueryParams = GetEventsQueryParams(), headers: GetEventsHeaders = GetEventsHeaders()) async throws -> Events { - let queryParamsMap: [String: String] = Utils.Dictionary.prepareParams(map: ["stream_type": Utils.Strings.toString(value: queryParams.streamType), "stream_position": Utils.Strings.toString(value: queryParams.streamPosition), "limit": Utils.Strings.toString(value: queryParams.limit), "event_type": Utils.Strings.toString(value: queryParams.eventType), "created_after": Utils.Strings.toString(value: queryParams.createdAfter), "created_before": Utils.Strings.toString(value: queryParams.createdBefore)]) - let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/events")", method: "GET", params: queryParamsMap, headers: headersMap, responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) - return try Events.deserialize(from: response.data) - } - /// Returns a list of real-time servers that can be used for long-polling updates /// to the [event stream](#get-events). /// @@ -76,4 +54,26 @@ public class EventsManager { return try RealtimeServers.deserialize(from: 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. + /// + /// - Parameters: + /// - queryParams: Query parameters of getEvents method + /// - headers: Headers of getEvents method + /// - Returns: The `Events`. + /// - Throws: The `GeneralError`. + public func getEvents(queryParams: GetEventsQueryParams = GetEventsQueryParams(), headers: GetEventsHeaders = GetEventsHeaders()) async throws -> Events { + let queryParamsMap: [String: String] = Utils.Dictionary.prepareParams(map: ["stream_type": Utils.Strings.toString(value: queryParams.streamType), "stream_position": Utils.Strings.toString(value: queryParams.streamPosition), "limit": Utils.Strings.toString(value: queryParams.limit), "event_type": Utils.Strings.toString(value: queryParams.eventType), "created_after": Utils.Strings.toString(value: queryParams.createdAfter), "created_before": Utils.Strings.toString(value: queryParams.createdBefore)]) + let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/events")", method: "GET", params: queryParamsMap, headers: headersMap, responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) + return try Events.deserialize(from: response.data) + } + } diff --git a/Sources/Managers/FileVersions/FileVersionsManager.swift b/Sources/Managers/FileVersions/FileVersionsManager.swift index ea971462..a00fef47 100644 --- a/Sources/Managers/FileVersions/FileVersionsManager.swift +++ b/Sources/Managers/FileVersions/FileVersionsManager.swift @@ -61,10 +61,9 @@ public class FileVersionsManager { return try FileVersionFull.deserialize(from: response.data) } - /// 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. /// /// - Parameters: /// - fileId: The unique identifier that represents a file. @@ -77,19 +76,17 @@ public class FileVersionsManager { /// Example: "12345" /// - fileVersionId: The ID of the file version /// Example: "1234" - /// - requestBody: Request body of updateFileVersionById method - /// - headers: Headers of updateFileVersionById method - /// - Returns: The `FileVersionFull`. + /// - headers: Headers of deleteFileVersionById method /// - Throws: The `GeneralError`. - public func updateFileVersionById(fileId: String, fileVersionId: String, requestBody: UpdateFileVersionByIdRequestBody = UpdateFileVersionByIdRequestBody(), headers: UpdateFileVersionByIdHeaders = UpdateFileVersionByIdHeaders()) async throws -> FileVersionFull { - let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/")\(fileId)\("/versions/")\(fileVersionId)", method: "PUT", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) - return try FileVersionFull.deserialize(from: response.data) + public func deleteFileVersionById(fileId: String, fileVersionId: String, headers: DeleteFileVersionByIdHeaders = DeleteFileVersionByIdHeaders()) async throws { + let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge(["if-match": Utils.Strings.toString(value: headers.ifMatch)], headers.extraHeaders)) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/")\(fileId)\("/versions/")\(fileVersionId)", method: "DELETE", headers: headersMap, responseFormat: nil, auth: self.auth, networkSession: self.networkSession)) } - /// 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. /// /// - Parameters: /// - fileId: The unique identifier that represents a file. @@ -102,11 +99,14 @@ public class FileVersionsManager { /// Example: "12345" /// - fileVersionId: The ID of the file version /// Example: "1234" - /// - headers: Headers of deleteFileVersionById method + /// - requestBody: Request body of updateFileVersionById method + /// - headers: Headers of updateFileVersionById method + /// - Returns: The `FileVersionFull`. /// - Throws: The `GeneralError`. - public func deleteFileVersionById(fileId: String, fileVersionId: String, headers: DeleteFileVersionByIdHeaders = DeleteFileVersionByIdHeaders()) async throws { - let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge(["if-match": Utils.Strings.toString(value: headers.ifMatch)], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/")\(fileId)\("/versions/")\(fileVersionId)", method: "DELETE", headers: headersMap, responseFormat: nil, auth: self.auth, networkSession: self.networkSession)) + public func updateFileVersionById(fileId: String, fileVersionId: String, requestBody: UpdateFileVersionByIdRequestBody = UpdateFileVersionByIdRequestBody(), headers: UpdateFileVersionByIdHeaders = UpdateFileVersionByIdHeaders()) async throws -> FileVersionFull { + let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/")\(fileId)\("/versions/")\(fileVersionId)", method: "PUT", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) + return try FileVersionFull.deserialize(from: response.data) } /// Promote a specific version of a file. diff --git a/Sources/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.swift b/Sources/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.swift index 92133c34..ea468090 100644 --- a/Sources/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.swift +++ b/Sources/Managers/ShieldInformationBarrierSegments/ShieldInformationBarrierSegmentsManager.swift @@ -24,32 +24,32 @@ public class ShieldInformationBarrierSegmentsManager { return try ShieldInformationBarrierSegment.deserialize(from: response.data) } - /// Updates the shield information barrier segment based on provided ID.. + /// Deletes the shield information barrier segment + /// based on provided ID. /// /// - Parameters: /// - shieldInformationBarrierSegmentId: The ID of the shield information barrier segment. /// Example: "3423" - /// - requestBody: Request body of updateShieldInformationBarrierSegmentById method - /// - headers: Headers of updateShieldInformationBarrierSegmentById method - /// - Returns: The `ShieldInformationBarrierSegment`. + /// - headers: Headers of deleteShieldInformationBarrierSegmentById method /// - Throws: The `GeneralError`. - public func updateShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: String, requestBody: UpdateShieldInformationBarrierSegmentByIdRequestBody = UpdateShieldInformationBarrierSegmentByIdRequestBody(), headers: UpdateShieldInformationBarrierSegmentByIdHeaders = UpdateShieldInformationBarrierSegmentByIdHeaders()) async throws -> ShieldInformationBarrierSegment { + public func deleteShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: String, headers: DeleteShieldInformationBarrierSegmentByIdHeaders = DeleteShieldInformationBarrierSegmentByIdHeaders()) async throws { let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/shield_information_barrier_segments/")\(shieldInformationBarrierSegmentId)", method: "PUT", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) - return try ShieldInformationBarrierSegment.deserialize(from: response.data) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/shield_information_barrier_segments/")\(shieldInformationBarrierSegmentId)", method: "DELETE", headers: headersMap, responseFormat: nil, auth: self.auth, networkSession: self.networkSession)) } - /// Deletes the shield information barrier segment - /// based on provided ID. + /// Updates the shield information barrier segment based on provided ID.. /// /// - Parameters: /// - shieldInformationBarrierSegmentId: The ID of the shield information barrier segment. /// Example: "3423" - /// - headers: Headers of deleteShieldInformationBarrierSegmentById method + /// - requestBody: Request body of updateShieldInformationBarrierSegmentById method + /// - headers: Headers of updateShieldInformationBarrierSegmentById method + /// - Returns: The `ShieldInformationBarrierSegment`. /// - Throws: The `GeneralError`. - public func deleteShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: String, headers: DeleteShieldInformationBarrierSegmentByIdHeaders = DeleteShieldInformationBarrierSegmentByIdHeaders()) async throws { + public func updateShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: String, requestBody: UpdateShieldInformationBarrierSegmentByIdRequestBody = UpdateShieldInformationBarrierSegmentByIdRequestBody(), headers: UpdateShieldInformationBarrierSegmentByIdHeaders = UpdateShieldInformationBarrierSegmentByIdHeaders()) async throws -> ShieldInformationBarrierSegment { let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/shield_information_barrier_segments/")\(shieldInformationBarrierSegmentId)", method: "DELETE", headers: headersMap, responseFormat: nil, auth: self.auth, networkSession: self.networkSession)) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/shield_information_barrier_segments/")\(shieldInformationBarrierSegmentId)", method: "PUT", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) + return try ShieldInformationBarrierSegment.deserialize(from: response.data) } /// Retrieves a list of shield information barrier segment objects diff --git a/Sources/Managers/Uploads/UploadsManager.swift b/Sources/Managers/Uploads/UploadsManager.swift index c0564782..94f56ee5 100644 --- a/Sources/Managers/Uploads/UploadsManager.swift +++ b/Sources/Managers/Uploads/UploadsManager.swift @@ -39,6 +39,20 @@ public class UploadsManager { return try Files.deserialize(from: response.data) } + /// Performs a check to verify that a file will be accepted by Box + /// before you upload the entire file. + /// + /// - Parameters: + /// - requestBody: Request body of preflightFileUploadCheck method + /// - headers: Headers of preflightFileUploadCheck method + /// - Returns: The `UploadUrl`. + /// - Throws: The `GeneralError`. + public func preflightFileUploadCheck(requestBody: PreflightFileUploadCheckRequestBody = PreflightFileUploadCheckRequestBody(), headers: PreflightFileUploadCheckHeaders = PreflightFileUploadCheckHeaders()) async throws -> UploadUrl { + let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) + let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/content")", method: "OPTIONS", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) + return try UploadUrl.deserialize(from: response.data) + } + /// Uploads a small file to Box. For file sizes over 50MB we recommend /// using the Chunk Upload APIs. /// @@ -60,18 +74,4 @@ public class UploadsManager { return try Files.deserialize(from: response.data) } - /// Performs a check to verify that a file will be accepted by Box - /// before you upload the entire file. - /// - /// - Parameters: - /// - requestBody: Request body of preflightFileUploadCheck method - /// - headers: Headers of preflightFileUploadCheck method - /// - Returns: The `UploadUrl`. - /// - Throws: The `GeneralError`. - public func preflightFileUploadCheck(requestBody: PreflightFileUploadCheckRequestBody = PreflightFileUploadCheckRequestBody(), headers: PreflightFileUploadCheckHeaders = PreflightFileUploadCheckHeaders()) async throws -> UploadUrl { - let headersMap: [String: String] = Utils.Dictionary.prepareParams(map: Utils.Dictionary.merge([:], headers.extraHeaders)) - let response: FetchResponse = try await NetworkClient.shared.fetch(options: FetchOptions(url: "\(self.networkSession.baseUrls.baseUrl)\("/2.0/files/content")", method: "OPTIONS", headers: headersMap, data: try requestBody.serialize(), contentType: "application/json", responseFormat: "json", auth: self.auth, networkSession: self.networkSession)) - return try UploadUrl.deserialize(from: response.data) - } - } diff --git a/Sources/Schemas/AiAgentBasicGenTool/AiAgentBasicGenTool.swift b/Sources/Schemas/AiAgentBasicGenTool/AiAgentBasicGenTool.swift index e57ff553..82c24f2d 100644 --- a/Sources/Schemas/AiAgentBasicGenTool/AiAgentBasicGenTool.swift +++ b/Sources/Schemas/AiAgentBasicGenTool/AiAgentBasicGenTool.swift @@ -13,7 +13,7 @@ public class AiAgentBasicGenTool: AiAgentLongTextToolTextGen { /// Initializer for a AiAgentBasicGenTool. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. /// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. diff --git a/Sources/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.swift b/Sources/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.swift index 42375cb1..f099eec4 100644 --- a/Sources/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.swift +++ b/Sources/Schemas/AiAgentBasicTextTool/AiAgentBasicTextTool.swift @@ -20,7 +20,7 @@ public class AiAgentBasicTextTool: AiAgentBasicTextToolBase { /// Initializer for a AiAgentBasicTextTool. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. /// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. diff --git a/Sources/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.swift b/Sources/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.swift index 0ae41e8b..562f02e3 100644 --- a/Sources/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.swift +++ b/Sources/Schemas/AiAgentBasicTextToolBase/AiAgentBasicTextToolBase.swift @@ -8,7 +8,7 @@ public class AiAgentBasicTextToolBase: Codable { case llmEndpointParams = "llm_endpoint_params" } - /// 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). public let model: String? /// The number of tokens for completion. @@ -20,7 +20,7 @@ public class AiAgentBasicTextToolBase: Codable { /// Initializer for a AiAgentBasicTextToolBase. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. public init(model: String? = nil, numTokensForCompletion: Int64? = nil, llmEndpointParams: AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? = nil) { diff --git a/Sources/Schemas/AiAgentBasicTextToolTextGen/AiAgentBasicTextToolTextGen.swift b/Sources/Schemas/AiAgentBasicTextToolTextGen/AiAgentBasicTextToolTextGen.swift index 5e2605cd..6b348a33 100644 --- a/Sources/Schemas/AiAgentBasicTextToolTextGen/AiAgentBasicTextToolTextGen.swift +++ b/Sources/Schemas/AiAgentBasicTextToolTextGen/AiAgentBasicTextToolTextGen.swift @@ -20,7 +20,7 @@ public class AiAgentBasicTextToolTextGen: AiAgentBasicTextToolBase { /// Initializer for a AiAgentBasicTextToolTextGen. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. /// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. diff --git a/Sources/Schemas/AiAgentLongTextTool/AiAgentLongTextTool.swift b/Sources/Schemas/AiAgentLongTextTool/AiAgentLongTextTool.swift index d2b192f4..13501b66 100644 --- a/Sources/Schemas/AiAgentLongTextTool/AiAgentLongTextTool.swift +++ b/Sources/Schemas/AiAgentLongTextTool/AiAgentLongTextTool.swift @@ -11,7 +11,7 @@ public class AiAgentLongTextTool: AiAgentBasicTextTool { /// Initializer for a AiAgentLongTextTool. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. /// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. diff --git a/Sources/Schemas/AiAgentLongTextToolTextGen/AiAgentLongTextToolTextGen.swift b/Sources/Schemas/AiAgentLongTextToolTextGen/AiAgentLongTextToolTextGen.swift index 12f29c26..5b250b75 100644 --- a/Sources/Schemas/AiAgentLongTextToolTextGen/AiAgentLongTextToolTextGen.swift +++ b/Sources/Schemas/AiAgentLongTextToolTextGen/AiAgentLongTextToolTextGen.swift @@ -11,7 +11,7 @@ public class AiAgentLongTextToolTextGen: AiAgentBasicTextToolTextGen { /// Initializer for a AiAgentLongTextToolTextGen. /// /// - Parameters: - /// - model: The model used for the AI Agent for basic text. + /// - model: The model used for the AI Agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models). /// - numTokensForCompletion: The number of tokens for completion. /// - llmEndpointParams: The parameters for the LLM endpoint specific to OpenAI / Google models. /// - systemMessage: System messages try to help the LLM "understand" its role and what it is supposed to do. diff --git a/Sources/Schemas/FileFull/FileFullMetadataField.swift b/Sources/Schemas/FileFull/FileFullMetadataField.swift index 4ea58e78..5ae80c5b 100644 --- a/Sources/Schemas/FileFull/FileFullMetadataField.swift +++ b/Sources/Schemas/FileFull/FileFullMetadataField.swift @@ -17,9 +17,9 @@ public class FileFullMetadataField: Codable { } - public let extraData: [String: [String: Metadata]]? + public let extraData: [String: [String: MetadataFull]]? - public init(extraData: [String: [String: Metadata]]? = nil) { + public init(extraData: [String: [String: MetadataFull]]? = nil) { self.extraData = extraData } @@ -31,9 +31,9 @@ public class FileFullMetadataField: Codable { let additionalKeys: [CodingKeys] = allKeys.filter({ (parent: CodingKeys) in !definedKeys.contains(where: { (child: CodingKeys) in child.stringValue == parent.stringValue }) }) if !additionalKeys.isEmpty { - var additionalProperties: [String: [String: Metadata]] = [:] + var additionalProperties: [String: [String: MetadataFull]] = [:] for key in additionalKeys { - if let value = try? container.decode([String: Metadata].self, forKey: key) { + if let value = try? container.decode([String: MetadataFull].self, forKey: key) { additionalProperties[key.stringValue] = value } diff --git a/Sources/Schemas/FileFullOrFolderFull/FileFullOrFolderFull.swift b/Sources/Schemas/FileFullOrFolderFull/FileFullOrFolderFull.swift new file mode 100644 index 00000000..563c6c68 --- /dev/null +++ b/Sources/Schemas/FileFullOrFolderFull/FileFullOrFolderFull.swift @@ -0,0 +1,48 @@ +import Foundation + +public enum FileFullOrFolderFull: Codable { + case fileFull(FileFull) + case folderFull(FolderFull) + + private enum DiscriminatorCodingKey: String, CodingKey { + case type + } + + public init(from decoder: Decoder) throws { + if let container = try? decoder.container(keyedBy: DiscriminatorCodingKey.self) { + if let discriminator_0 = try? container.decode(String.self, forKey: .type) { + switch discriminator_0 { + case "file": + if let content = try? FileFull(from: decoder) { + self = .fileFull(content) + return + } + + case "folder": + if let content = try? FolderFull(from: decoder) { + self = .folderFull(content) + return + } + + default: + throw DecodingError.typeMismatch(FileFullOrFolderFull.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type")) + + } + } + + } + + throw DecodingError.typeMismatch(FileFullOrFolderFull.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The type of the decoded object cannot be determined.")) + + } + + public func encode(to encoder: Encoder) throws { + switch self { + case .fileFull(let fileFull): + try fileFull.encode(to: encoder) + case .folderFull(let folderFull): + try folderFull.encode(to: encoder) + } + } + +} diff --git a/Sources/Schemas/FolderFull/FolderFullMetadataField.swift b/Sources/Schemas/FolderFull/FolderFullMetadataField.swift index 5ac834b9..dc522bf2 100644 --- a/Sources/Schemas/FolderFull/FolderFullMetadataField.swift +++ b/Sources/Schemas/FolderFull/FolderFullMetadataField.swift @@ -17,9 +17,9 @@ public class FolderFullMetadataField: Codable { } - public let extraData: [String: [String: Metadata]]? + public let extraData: [String: [String: MetadataFull]]? - public init(extraData: [String: [String: Metadata]]? = nil) { + public init(extraData: [String: [String: MetadataFull]]? = nil) { self.extraData = extraData } @@ -31,9 +31,9 @@ public class FolderFullMetadataField: Codable { let additionalKeys: [CodingKeys] = allKeys.filter({ (parent: CodingKeys) in !definedKeys.contains(where: { (child: CodingKeys) in child.stringValue == parent.stringValue }) }) if !additionalKeys.isEmpty { - var additionalProperties: [String: [String: Metadata]] = [:] + var additionalProperties: [String: [String: MetadataFull]] = [:] for key in additionalKeys { - if let value = try? container.decode([String: Metadata].self, forKey: key) { + if let value = try? container.decode([String: MetadataFull].self, forKey: key) { additionalProperties[key.stringValue] = value } diff --git a/Sources/Schemas/MetadataQueryResults/MetadataQueryResults.swift b/Sources/Schemas/MetadataQueryResults/MetadataQueryResults.swift index b1e418ca..6863d303 100644 --- a/Sources/Schemas/MetadataQueryResults/MetadataQueryResults.swift +++ b/Sources/Schemas/MetadataQueryResults/MetadataQueryResults.swift @@ -14,7 +14,7 @@ public class MetadataQueryResults: Codable { /// By default, this endpoint returns only the most basic info about the /// items. To get additional fields for each item, including any of the /// metadata, use the `fields` attribute in the query. - public let entries: [FileOrFolder]? + public let entries: [FileFullOrFolderFull]? /// The limit that was used for this search. This will be the same as the /// `limit` query parameter unless that value exceeded the maximum value @@ -37,7 +37,7 @@ public class MetadataQueryResults: Codable { /// `limit` query parameter unless that value exceeded the maximum value /// allowed. /// - nextMarker: The marker for the start of the next page of results. - public init(entries: [FileOrFolder]? = nil, limit: Int64? = nil, nextMarker: String? = nil) { + public init(entries: [FileFullOrFolderFull]? = nil, limit: Int64? = nil, nextMarker: String? = nil) { self.entries = entries self.limit = limit self.nextMarker = nextMarker @@ -45,7 +45,7 @@ public class MetadataQueryResults: Codable { required public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - entries = try container.decodeIfPresent([FileOrFolder].self, forKey: .entries) + entries = try container.decodeIfPresent([FileFullOrFolderFull].self, forKey: .entries) limit = try container.decodeIfPresent(Int64.self, forKey: .limit) nextMarker = try container.decodeIfPresent(String.self, forKey: .nextMarker) } diff --git a/docs/Events.md b/docs/Events.md index 3622a5de..e5a84187 100644 --- a/docs/Events.md +++ b/docs/Events.md @@ -1,48 +1,8 @@ # EventsManager -- [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/). - -*Currently we don't have an example for calling `getEvents` in integration tests* - -### Arguments - -- queryParams `GetEventsQueryParams` - - Query parameters of getEvents method -- headers `GetEventsHeaders` - - Headers of getEvents method - - -### 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 @@ -101,3 +61,43 @@ 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/). + +*Currently we don't have an example for calling `getEvents` in integration tests* + +### Arguments + +- queryParams `GetEventsQueryParams` + - Query parameters of getEvents method +- headers `GetEventsHeaders` + - Headers of getEvents method + + +### 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 55a91c75..79fe4261 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 @@ -80,19 +80,21 @@ 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/). -*Currently we don't have an example for calling `updateFileVersionById` in integration tests* + +``` +try await client.fileVersions.deleteFileVersionById(fileId: file.id, fileVersionId: fileVersion.id) +``` ### Arguments @@ -100,34 +102,31 @@ See the endpoint docs at - 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 ### Returns -This function returns a value of type `FileVersionFull`. - -Returns a restored file version object. +This function returns a value of type ``. +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/). - -``` -try await client.fileVersions.deleteFileVersionById(fileId: file.id, fileVersionId: fileVersion.id) -``` +*Currently we don't have an example for calling `updateFileVersionById` in integration tests* ### Arguments @@ -135,16 +134,17 @@ try await client.fileVersions.deleteFileVersionById(fileId: file.id, fileVersion - 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 ### Returns -This function returns a value of type ``. +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 75224d59..548312a3 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) @@ -36,65 +36,65 @@ 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/). - + ``` -try await client.shieldInformationBarrierSegments.updateShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: segmentId, requestBody: UpdateShieldInformationBarrierSegmentByIdRequestBody(description: updatedSegmentDescription)) +try await client.shieldInformationBarrierSegments.deleteShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: 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 ### Returns -This function returns a value of type `ShieldInformationBarrierSegment`. +This function returns a value of type ``. -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/). - + ``` -try await client.shieldInformationBarrierSegments.deleteShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: segment.id!) +try await client.shieldInformationBarrierSegments.updateShieldInformationBarrierSegmentById(shieldInformationBarrierSegmentId: segmentId, requestBody: 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 ### Returns -This function returns a value of type ``. +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