No description
Find a file
Iva Horn 07a481be18 fix: Removed the strict concurrency swift setting from package manifest.
Our CI tolling was complaining about it: error: upcoming feature 'StrictConcurrency' is already enabled as of Swift version 6
2025-10-20 09:58:55 +02:00
.github/workflows fix: LGPL references. 2025-10-16 15:33:55 +02:00
LICENSES fix: Added missing Creative Commons license file. 2025-10-16 15:39:33 +02:00
Sources/NextcloudCapabilitiesKit fix: Sendable conformance. 2025-10-17 15:27:27 +02:00
Tests/NextcloudCapabilitiesKitTests fix(swiftformat): Enforced omission of trailing commas. 2025-10-20 09:41:50 +02:00
.gitignore fix: LGPL references. 2025-10-16 15:33:55 +02:00
.swift-version fix: Lowered Swift Version to 6.0 for compatibility. 2025-10-17 17:13:39 +02:00
.swiftformat fix(swiftformat): Enforced omission of trailing commas. 2025-10-20 09:41:50 +02:00
NextcloudCapabilitiesKit.png fix: Updated README. 2025-10-16 14:28:15 +02:00
NextcloudCapabilitiesKit.pxd fix: Updated README. 2025-10-16 14:28:15 +02:00
NextcloudCapabilitiesKit.svg fix: Updated README. 2025-10-16 14:28:15 +02:00
Package.swift fix: Removed the strict concurrency swift setting from package manifest. 2025-10-20 09:58:55 +02:00
README.md fix: Added missing license file. 2025-10-16 15:37:03 +02:00
REUSE.toml fix: Corrected license references to LGPL (GPL reference was my mistake previously) 2025-10-16 15:21:21 +02:00

Logo of NextcloudCapabilitiesKit

Nextcloud Capabilities Kit

NextcloudCapabilitiesKit is a Swift library tailored for parsing and handling capabilities information from a Nextcloud server. It provides a structured way to access detailed features available on the server, including core settings, file handling capabilities, notifications, theming, and more, directly through Swift data structures.

Features

  • Comprehensive Parsing: Understands and translates JSON capabilities data from Nextcloud into strongly typed Swift structures.
  • Support for Various Capabilities: Handles a wide range of Nextcloud server capabilities, such as core configurations, file sharing options, user statuses, theming, and more.
  • Ease of Integration: Designed to be easily integrated into any Swift application interacting with Nextcloud servers.

Installation

Swift Package Manager

NextcloudCapabilitiesKit can be integrated into your project using the Swift Package Manager.

Usage

To use NextcloudCapabilitiesKit in your project, you first need to fetch the capabilities JSON from your Nextcloud server, which is typically available at a known URL path relative to your Nextcloud domain. Once you have the JSON data, you can parse it as follows:

import NextcloudCapabilitiesKit
import NextcloutKit

// We are assuming the use of NextcloudKit to fetch capabilities data

let ncKit = NextcloudKit()
ncKit.setup(user: user, userId: user, password: password, urlBase: serverUrl)

let capabilitiesData: Data? = await withCheckedContinuation { continuation in
    ncKit.getCapabilities { account, data, error in
        guard error == .success else {
            Logger.ncBackend.error("Could not get \(self.backendId) capabilities: \(error)")
            continuation.resume(returning: nil)
            return
        }
        continuation.resume(returning: data)
    }
}

if let capabilities = Capabilities(data: jsonData) {
    // Access parsed capabilities
    if let core = capabilities.core {
        print("Nextcloud version: \(core.version)")
    }
    // Handle other capabilities similarly...
} else {
    print("Failed to parse Nextcloud capabilities.")
}

Contributing

Contributions to NextcloudCapabilitiesKit are welcome! Whether you're fixing bugs, adding new features, or improving documentation, please feel free to submit a pull request or open an issue.

Code Style

SwiftFormat was introduced into this project. Before submitting a pull request, please ensure that your code changes comply with the currently configured code style. You can run the following command in the root of the package repository clone:

swift package plugin --allow-writing-to-package-directory swiftformat --verbose --cache ignore

License

NextcloudCapabilitiesKit is released under the LGPL V3 License. See the LICENSE file for more details.