Browse Source

feat(nextcloud): Add basic usage instructions

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/1147/head
jld3103 1 year ago
parent
commit
489ffcb723
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 38
      packages/nextcloud/README.md

38
packages/nextcloud/README.md

@ -22,6 +22,44 @@ dependency_overrides:
``` ```
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. 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):
```dart
final client = NextcloudClient(
Uri.parse('http://localhost'),
loginName: 'admin',
password: 'admin',
);
```
Secondly there is Http Bearer auth which works with app passwords:
```dart
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](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2).
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](https://docs.nextcloud.com/server/latest/developer_manual/_static/openapi.html), 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](./example/example.dart).
## Development ## Development
Except for WebDAV all client code is generated using OpenAPI specifications which can be found in the `lib/src/api/` folder. Except for WebDAV all client code is generated using OpenAPI specifications which can be found in the `lib/src/api/` folder.

Loading…
Cancel
Save