#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

#2032 in Network programming

Download history 97/week @ 2024-09-16 58/week @ 2024-09-23 10/week @ 2024-09-30 2/week @ 2024-10-07

167 downloads per month

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

~0.3–0.8MB
~18K SLoC