Skip to content

Commit

Permalink
docs: add docs for hubs (box/box-openapi#426) (#121)
Browse files Browse the repository at this point in the history
Co-authored-by: Minh Nguyen Cong <[email protected]>
  • Loading branch information
box-sdk-build and congminh1254 authored May 22, 2024
1 parent d0a7adb commit 62670ce
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "fa753d5", "specHash": "6c3dd22", "version": "0.1.0" }
{ "engineHash": "52af7c9", "specHash": "cb70223", "version": "0.1.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public class LegalHoldPolicyAssignmentsManager {
/// /file_version_legal_holds` API can be used to fetch current and past versions
/// of files held within the legacy architecture.
///
/// This endpoint does not support returning any content that is on hold due to
/// a Custodian collaborating on a Hub.
///
/// The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
/// find a list of policy assignments for a given policy ID.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/Managers/Search/SearchForContentQueryParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public class SearchForContentQueryParams {

/// Limits the search results to any items for which the metadata matches the provided filter.
/// This parameter is a list that specifies exactly **one** metadata template used to filter the search results.
/// It is required unless the `query` parameter is provided.
/// The parameter is required unless the `query` parameter is provided.
public let mdfilters: [MetadataFilter]?

/// Defines the order in which search results are returned. This API
Expand Down Expand Up @@ -410,7 +410,7 @@ public class SearchForContentQueryParams {
/// * `all_items` - Searches for both trashed and non-trashed items.
/// - mdfilters: Limits the search results to any items for which the metadata matches the provided filter.
/// This parameter is a list that specifies exactly **one** metadata template used to filter the search results.
/// It is required unless the `query` parameter is provided.
/// The parameter is required unless the `query` parameter is provided.
/// - sort: Defines the order in which search results are returned. This API
/// defaults to returning items by relevance unless this parameter is
/// explicitly specified.
Expand Down
14 changes: 9 additions & 5 deletions Sources/Schemas/SignRequest/SignRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public class SignRequest: SignRequestBase {
public let id: String?

/// This URL is returned if `is_document_preparation_needed` is
/// set to `true` for Box Sign request. It is used to prepare a signature request
/// using the UI. The signature request is not sent until the preparation
/// set to `true` in the request. The parameter is used to prepare
/// the signature request
/// using the UI. The signature request is not
/// sent until the preparation
/// phase is complete.
public let prepareUrl: String?

Expand Down Expand Up @@ -68,15 +70,17 @@ public class SignRequest: SignRequestBase {
/// - externalId: This can be used to reference an ID in an external system that the sign request is related to.
/// - isPhoneVerificationRequiredToView: Forces signers to verify a text message prior to viewing the document. You must specify the phone number of signers to have this setting apply to them.
/// - templateId: When a signature request is created from a template this field will indicate the id of that template.
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned an `embed_url_external_id`
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`.
/// - type: object type
/// - sourceFiles: List of files to create a signing document from. This is currently limited to ten files. Only the ID and type fields are required for each file.
/// - signers: Array of signers for the signature request.
/// - signatureColor: Force a specific color for the signature (blue, black, or red).
/// - id: Box Sign request ID.
/// - prepareUrl: This URL is returned if `is_document_preparation_needed` is
/// set to `true` for Box Sign request. It is used to prepare a signature request
/// using the UI. The signature request is not sent until the preparation
/// set to `true` in the request. The parameter is used to prepare
/// the signature request
/// using the UI. The signature request is not
/// sent until the preparation
/// phase is complete.
/// - signingLog:
/// - status: Describes the status of the signature request.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Schemas/SignRequestBase/SignRequestBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class SignRequestBase: Codable {
/// When a signature request is created from a template this field will indicate the id of that template.
public let templateId: String?

/// Used as an optional system name to appear in the signature log next to the signers who have been assigned an `embed_url_external_id`
/// Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`.
public let externalSystemName: String?

/// Initializer for a SignRequestBase.
Expand All @@ -77,7 +77,7 @@ public class SignRequestBase: Codable {
/// - externalId: This can be used to reference an ID in an external system that the sign request is related to.
/// - isPhoneVerificationRequiredToView: Forces signers to verify a text message prior to viewing the document. You must specify the phone number of signers to have this setting apply to them.
/// - templateId: When a signature request is created from a template this field will indicate the id of that template.
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned an `embed_url_external_id`
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`.
public init(isDocumentPreparationNeeded: Bool? = nil, redirectUrl: String? = nil, declinedRedirectUrl: String? = nil, areTextSignaturesEnabled: Bool? = nil, emailSubject: String? = nil, emailMessage: String? = nil, areRemindersEnabled: Bool? = nil, name: String? = nil, prefillTags: [SignRequestPrefillTag]? = nil, daysValid: Int64? = nil, externalId: String? = nil, isPhoneVerificationRequiredToView: Bool? = nil, templateId: String? = nil, externalSystemName: String? = nil) {
self.isDocumentPreparationNeeded = isDocumentPreparationNeeded
self.redirectUrl = redirectUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class SignRequestCreateRequest: SignRequestBase {
/// - externalId: This can be used to reference an ID in an external system that the sign request is related to.
/// - isPhoneVerificationRequiredToView: Forces signers to verify a text message prior to viewing the document. You must specify the phone number of signers to have this setting apply to them.
/// - templateId: When a signature request is created from a template this field will indicate the id of that template.
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned an `embed_url_external_id`
/// - externalSystemName: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`.
/// - sourceFiles: List of files to create a signing document from. This is currently limited to ten files. Only the ID and type fields are required for each file.
/// - signatureColor: Force a specific color for the signature (blue, black, or red)
/// - parentFolder:
Expand Down
29 changes: 13 additions & 16 deletions Tests/Auth/AuthManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ class AuthManagerTests: XCTestCase {
public func testCcgAuthRevoke() async throws {
let ccgConfig: CCGConfig = CCGConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"), userId: Utils.getEnvironmentVariable(name: "USER_ID"))
let auth: BoxCCGAuth = BoxCCGAuth(config: ccgConfig)
try await auth.retrieveToken()
let tokenFromStorageBeforeRevoke: AccessToken? = try await auth.tokenStorage.get()
try await auth.revokeToken()
let tokenFromStorageAfterRevoke: AccessToken? = try await auth.tokenStorage.get()
let tokenFromStorageBeforeRevoke: AccessToken = try await auth.retrieveToken()
XCTAssertTrue(tokenFromStorageBeforeRevoke != nil)
XCTAssertTrue(tokenFromStorageAfterRevoke == nil)
try await auth.revokeToken()
let tokenFromStorageAfterRevoke: AccessToken = try await auth.retrieveToken()
XCTAssertTrue(tokenFromStorageBeforeRevoke.accessToken != tokenFromStorageAfterRevoke.accessToken)
}

public func getAccessToken() async throws -> AccessToken {
Expand All @@ -66,12 +65,10 @@ class AuthManagerTests: XCTestCase {
let developerTokenConfig: DeveloperTokenConfig = DeveloperTokenConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"))
let token: AccessToken = try await getAccessToken()
let auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token: token.accessToken!, config: developerTokenConfig)
try await auth.retrieveToken()
let tokenFromStorageBeforeRevoke: AccessToken? = try await auth.tokenStorage.get()
try await auth.revokeToken()
let tokenFromStorageAfterRevoke: AccessToken? = try await auth.tokenStorage.get()
let tokenFromStorageBeforeRevoke: AccessToken = try await auth.retrieveToken()
XCTAssertTrue(tokenFromStorageBeforeRevoke != nil)
XCTAssertTrue(tokenFromStorageAfterRevoke == nil)
try await auth.revokeToken()
await XCTAssertThrowsErrorAsync(try await auth.retrieveToken())
}

public func testDeveloperTokenAuthDownscope() async throws {
Expand Down Expand Up @@ -99,21 +96,21 @@ class AuthManagerTests: XCTestCase {
}

public func testOauthAuthRevoke() async throws {
let config: OAuthConfig = OAuthConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"))
let token: AccessToken = try await getAccessToken()
let tokenStorage: InMemoryTokenStorage = InMemoryTokenStorage(token: token)
let config: OAuthConfig = OAuthConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"), tokenStorage: tokenStorage)
let auth: BoxOAuth = BoxOAuth(config: config)
let client: BoxClient = BoxClient(auth: auth)
let token: AccessToken = try await getAccessToken()
try await auth.tokenStorage.store(token: token)
try await client.users.getUserMe()
try await auth.revokeToken()
await XCTAssertThrowsErrorAsync(try await client.users.getUserMe())
}

public func testOauthAuthDownscope() async throws {
let config: OAuthConfig = OAuthConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"))
let auth: BoxOAuth = BoxOAuth(config: config)
let token: AccessToken = try await getAccessToken()
try await auth.tokenStorage.store(token: token)
let tokenStorage: InMemoryTokenStorage = InMemoryTokenStorage(token: token)
let config: OAuthConfig = OAuthConfig(clientId: Utils.getEnvironmentVariable(name: "CLIENT_ID"), clientSecret: Utils.getEnvironmentVariable(name: "CLIENT_SECRET"), tokenStorage: tokenStorage)
let auth: BoxOAuth = BoxOAuth(config: config)
let parentClient: BoxClient = BoxClient(auth: auth)
let uploadedFiles: Files = try await parentClient.uploads.uploadFile(requestBody: UploadFileRequestBody(attributes: UploadFileRequestBodyAttributesField(name: Utils.getUUID(), parent: UploadFileRequestBodyAttributesParentField(id: "0")), file: Utils.generateByteStream(size: 1024 * 1024)))
let file: FileFull = uploadedFiles.entries![0]
Expand Down
3 changes: 3 additions & 0 deletions docs/LegalHoldPolicyAssignments.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ latest file version held in the newly developed architecture. The `GET
/file_version_legal_holds` API can be used to fetch current and past versions
of files held within the legacy architecture.

This endpoint does not support returning any content that is on hold due to
a Custodian collaborating on a Hub.

The `GET /legal_hold_policy_assignments?policy_id={id}` API can be used to
find a list of policy assignments for a given policy ID.

Expand Down
76 changes: 76 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Documentation

## High-level Documentation

General explanations of the available functionality and examples of how to use
the SDK are available by topic:

* [Ai](Ai.md)
* [Authorization](Authorization.md)
* [Avatars](Avatars.md)
* [Chunked uploads](ChunkedUploads.md)
* [Classifications](Classifications.md)
* [Collaboration allowlist entries](CollaborationAllowlistEntries.md)
* [Collaboration allowlist exempt targets](CollaborationAllowlistExemptTargets.md)
* [Collections](Collections.md)
* [Comments](Comments.md)
* [Device pinners](DevicePinners.md)
* [Downloads](Downloads.md)
* [Email aliases](EmailAliases.md)
* [Events](Events.md)
* [File classifications](FileClassifications.md)
* [File metadata](FileMetadata.md)
* [File requests](FileRequests.md)
* [File version legal holds](FileVersionLegalHolds.md)
* [File version retentions](FileVersionRetentions.md)
* [File versions](FileVersions.md)
* [File watermarks](FileWatermarks.md)
* [Files](Files.md)
* [Folder classifications](FolderClassifications.md)
* [Folder locks](FolderLocks.md)
* [Folder metadata](FolderMetadata.md)
* [Folder watermarks](FolderWatermarks.md)
* [Folders](Folders.md)
* [Groups](Groups.md)
* [Integration mappings](IntegrationMappings.md)
* [Invites](Invites.md)
* [Legal hold policies](LegalHoldPolicies.md)
* [Legal hold policy assignments](LegalHoldPolicyAssignments.md)
* [List collaborations](ListCollaborations.md)
* [Memberships](Memberships.md)
* [Metadata cascade policies](MetadataCascadePolicies.md)
* [Metadata templates](MetadataTemplates.md)
* [Recent items](RecentItems.md)
* [Retention policies](RetentionPolicies.md)
* [Retention policy assignments](RetentionPolicyAssignments.md)
* [Search](Search.md)
* [Session termination](SessionTermination.md)
* [Shared links files](SharedLinksFiles.md)
* [Shared links folders](SharedLinksFolders.md)
* [Shared links web links](SharedLinksWebLinks.md)
* [Shield information barrier reports](ShieldInformationBarrierReports.md)
* [Shield information barrier segment members](ShieldInformationBarrierSegmentMembers.md)
* [Shield information barrier segment restrictions](ShieldInformationBarrierSegmentRestrictions.md)
* [Shield information barrier segments](ShieldInformationBarrierSegments.md)
* [Shield information barriers](ShieldInformationBarriers.md)
* [Sign requests](SignRequests.md)
* [Sign templates](SignTemplates.md)
* [Skills](Skills.md)
* [Storage policies](StoragePolicies.md)
* [Storage policy assignments](StoragePolicyAssignments.md)
* [Task assignments](TaskAssignments.md)
* [Tasks](Tasks.md)
* [Terms of service user statuses](TermsOfServiceUserStatuses.md)
* [Terms of services](TermsOfServices.md)
* [Transfer](Transfer.md)
* [Trashed files](TrashedFiles.md)
* [Trashed folders](TrashedFolders.md)
* [Trashed items](TrashedItems.md)
* [Trashed web links](TrashedWebLinks.md)
* [Uploads](Uploads.md)
* [User collaborations](UserCollaborations.md)
* [Users](Users.md)
* [Web links](WebLinks.md)
* [Webhooks](Webhooks.md)
* [Workflows](Workflows.md)
* [Zip downloads](ZipDownloads.md)

0 comments on commit 62670ce

Please sign in to comment.