#next-cloud #api-client #api #cli #api-bindings #sockets #cli-interface

nextcloud-client-api

implementation of the socket API for the NextCloud client

1 unstable release

0.1.0 Sep 22, 2024

#4 in #next-cloud

Apache-2.0

45KB
923 lines

NextCloud Client API - crate

This rust crate provides a simple interface to interact with the NextCloud linux client.
The client has to be installed and setup on the target system for this crate to work.

Objective

The implementation aims to support most features published here: https://github.com/nextcloud/desktop/blob/master/src/gui/socketapi/socketapi.h
If there are things missing, please open an issue or provide a patch.

Contribution

Feel free to open issues for missing parts of the API. There is currently no roadmap, so integration of these might take time.
In addition patches can be provided or merge requests opened.


lib.rs:

This crate provides an API to the NextCloud linux client. It connects to the socket of the client to interact. The socket is located in the runtime directory, which is defined by the $XDG_RUNTIME_DIR environment variable. If this variable is not available, the creation will fail.

The API is based on the source code published here: https://github.com/nextcloud/desktop/blob/master/src/gui/socketapi/socketapi.h

Examples

use std::path::Path;
use nextcloud_client_api::Api;

let mut api = Api::new()
    .expect("failed to open API");
let version = api.version()
    .expect("failed to fetch version");
let file_status = api.retrieve_file_status(
        &Path::new("/Nextcloud/Documents/About-Storage-Share.pdf")
    ).expect("failed to retrieve file status");

Dependencies

~280–770KB
~18K SLoC