Rclone API interface

Hi, I would like to incorporate rclones functionality into a larger project. Ideally this would be done by statically linking to rclones code base rather than making subprocess calls.

Can anyone provide advice on how to go about this?
Are there any foreseeable hurdles?

I think the functions provided in https://github.com/rclone/rclone/blob/master/fs/operations/operations.go are what I want to call directly. Is there a different interface in the code you would recommend calling against?

I have to admit I am very new to GoLang but am certainly not new to programming. I know various languages and have learned them all by jumping in head first.

Any advice is appreciated.
Thanks

1 Like

@ncw Thone is probably for you also :wink:

As for go - it should be very similar to java or C#. A high abstraction language in other words, and thus should be fairly quick to pick up for someone who knows how to code in general.

You can use the functions in operations - these are the high level functions wrapping the backend functionality.

Provided you don't mind using the rclone config file it is pretty easy. I don't guarantee stability of the internal rclone interfaces but in general they are pretty stable.

You can also run rclone rcd to run an rclone API server and use the rclone API - I try not to break the backwards compatibility of the API.

Thanks, I want to avoid having to manage subprocesses and awkward interprocess communication via a network interface.

What would be required to manage the rclone configuration? I haven't gotten to where that is accessed.
I need to be able to configure it without an external file.

For the backends you need to implement the
interface configmap.Mapper: https://github.com/rclone/rclone/blob/master/fs/config/configmap/configmap.go#L18

All the other internals should be configurable with the various options structures, the most important being fs.Config