A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
jld3103 b131f5d172
chore(nextcloud): Remove unnecessary proxy helper class
1 year ago
..
bin fix(nextcloud): fix appid sorting 1 year ago
example feat(nextcloud): Add example 1 year ago
lib feat(dynamite): allow patterns and string lengths in objects 1 year ago
test chore(nextcloud): Remove unnecessary proxy helper class 1 year ago
LICENSE chore: Move license file 1 year ago
README.md feat(nextcloud): Add basic usage instructions 1 year ago
analysis_options.yaml chore(app,dynamite,dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,neon_lints,nextcloud,sort_box): use custom neon_lints package 1 year ago
build.yaml feat(dynamite): allow to configure the pageWidth for the dart formatter 1 year ago
pubspec.yaml Merge pull request #1179 from nextcloud/renovate/built_value 1 year ago
pubspec_overrides.yaml chore(app,dynamite,dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,neon_lints,nextcloud,sort_box): use custom neon_lints package 1 year ago

README.md

nextcloud

A Nextcloud API client written in Dart.

Installation

In the future this code will be available at https://pub.dev/packages/nextcloud, but for now you have to include it via git in your pubspec.yaml:

dependencies:
  nextcloud:
    git:
      url: https://github.com/nextcloud/neon
      path: packages/nextcloud
      ref: $COMMIT

dependency_overrides:
  dynamite_runtime:
    git:
      url: https://github.com/nextcloud/neon
      path: packages/dynamite/dynamite_runtime
      ref: $COMMIT

You can either remove the ref or use a commit hash. It's not recommended to remove it, because then the version will be updated very often.

Usage

Authentication

There are multiple ways to authenticate.
First there is HTTP Basic auth which works with the normal user credentials (e-mail and other identifiers also work):

final client = NextcloudClient(
    Uri.parse('http://localhost'),
    loginName: 'admin',
    password: 'admin',
);

Secondly there is Http Bearer auth which works with app passwords:

final client = NextcloudClient(
    Uri.parse('http://localhost'),
    loginName: 'admin',
    appPassword: 'xxxxx-xxxxx-xxxxx-xxxx-xxxxx',
);

Not all endpoints work with just HTTP Basic auth, so it is advised to use app passwords obtained either directly in the Web UI by the user or using the login flow.
Some endpoints do not need any authentication at all or provide extended information when the request is optionally authenticated.

Endpoints

It is not guaranteed that an API request will work unless the app is installed and enabled on the server (and has a supported version).

To get an easier overview of the available endpoints you can browse the server OpenAPI documentation, but be aware that the package might not be in sync with it.
Alternatively you can also go to https://pub.dev/documentation/nextcloud/latest (once the package has been republished at https://pub.dev/packages/nextcloud).

The endpoints are grouped by app and most apps also group their endpoints again. They can be accessed using getters on the NextcloudClient.

For an example checkout the example.

Development

Except for WebDAV all client code is generated using OpenAPI specifications which can be found in the lib/src/api/ folder.
These OpenAPI specifications are generated from the PHP source code.