22 lines
586 B
Dart
22 lines
586 B
Dart
import 'dart:io';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
import '../nextcloud_ocs.dart';
|
|
import 'file_sharing_api_params.dart';
|
|
|
|
class FileSharingApi {
|
|
Future<void> share(FileSharingApiParams query) async {
|
|
final endpoint = NextcloudOcs.uri(
|
|
'apps/files_sharing/api/v1/shares',
|
|
queryParameters: query.toJson(),
|
|
);
|
|
final response = await http.post(endpoint, headers: NextcloudOcs.headers());
|
|
if (response.statusCode != HttpStatus.ok) {
|
|
throw Exception(
|
|
'Api call failed with ${response.statusCode}: ${response.body}',
|
|
);
|
|
}
|
|
}
|
|
}
|