https://github.com/claucambra/nextcloudcapabilitieskit
A library to easily parse Nextcloud server capabilities
https://github.com/claucambra/nextcloudcapabilitieskit
Last synced: 2 months ago
JSON representation
A library to easily parse Nextcloud server capabilities
- Host: GitHub
- URL: https://github.com/claucambra/nextcloudcapabilitieskit
- Owner: claucambra
- License: lgpl-3.0
- Created: 2024-03-19T15:53:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-10T03:54:06.000Z (3 months ago)
- Last Synced: 2025-02-14T04:11:41.279Z (3 months ago)
- Language: Swift
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NextcloudCapabilitiesKit
========================`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:
```swift
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.
License
-------`NextcloudCapabilitiesKit` is released under the LGPL V3 License. See the `LICENSE` file for more details.