mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-04 10:39:47 -06:00
[client] Update request end-points and params
This commit is contained in:
@@ -16,10 +16,13 @@ class ResourceBookmarkAddAction extends ResourceAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/my/bookmarks/add/$resourceId';
|
||||
String get endpoint => '/api/v1/my/bookmarks/add';
|
||||
|
||||
@override
|
||||
Map<String, String> get queryParamters => {'name': bookmarkName};
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'path': '$resourceId:',
|
||||
'name': bookmarkName,
|
||||
};
|
||||
|
||||
@override
|
||||
ResponseParser get parseResponse => (_, response) => parseJsonMapResponse(response, BookmarkResponse.fromResponse);
|
||||
|
||||
@@ -17,7 +17,12 @@ class ResourceBookmarkRemoveAction extends ResourceAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/my/bookmarks/remove/$resourceId';
|
||||
String get endpoint => '/api/v1/my/bookmarks/remove';
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'id': resourceId,
|
||||
};
|
||||
|
||||
@override
|
||||
ResponseParser get parseResponse => (_, response) => parseJsonMapResponse(response, BookmarkResponse.fromResponse);
|
||||
|
||||
@@ -14,12 +14,13 @@ class ResourceCopyAction extends ResourceCreateAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/copy/$srcId';
|
||||
String get endpoint => '/api/v1/fs/copy';
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'id': resourceId,
|
||||
'target': '$parent:$resourceName',
|
||||
'src': '$srcId:',
|
||||
'dest': '$parent:$resourceName',
|
||||
'conflict': conflictResolution,
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,12 @@ class ResourceDeleteAction extends ResourceAction with JsonApiAction {
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/delete/$resourceId';
|
||||
|
||||
@override
|
||||
Map<String, String> get queryParamters => permanent ? const {'permanent': 't'} : const {};
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'path': '$resourceId:',
|
||||
'permanent': permanent,
|
||||
};
|
||||
|
||||
@override
|
||||
List<LocalChange> get localChanges => permanent
|
||||
|
||||
@@ -14,12 +14,11 @@ class ResourceMkdirAction extends ResourceCreateAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/mkdir/$resourceId';
|
||||
String get endpoint => '/api/v1/fs/mkdir';
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'parent_id': parent,
|
||||
'name': resourceName,
|
||||
'path': '$parent:$resourceName',
|
||||
'conflict': conflictResolution,
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ class ResourceMoveAction extends ResourceBindAction with JsonApiAction {
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
// TODO: Do not send parent when only renaming
|
||||
'target': '$parent:$resourceName',
|
||||
'src': '$resourceId:',
|
||||
'dest': '$parent:$resourceName',
|
||||
'conflict': conflictResolution,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@ class ResourcePublinkCreateAction extends ResourceAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/publinks/$resourceId/create';
|
||||
String get endpoint => '/api/v1/publinks/create';
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'id': publinkId,
|
||||
'resourcePath': '$resourceId:',
|
||||
if (password.isNotEmpty) 'password': password,
|
||||
if (expires != null) 'expires': expires!.toIso8601String(),
|
||||
if (accessLimit != 0) 'access_limit': accessLimit,
|
||||
|
||||
@@ -14,15 +14,14 @@ class ResourceShareAction extends ResourceAction with JsonApiAction {
|
||||
String get method => 'POST';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/share/$resourceId';
|
||||
String get endpoint => '/api/v1/fs/share';
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? get requestBody {
|
||||
return {
|
||||
'username': username,
|
||||
'permission': permission,
|
||||
};
|
||||
}
|
||||
Map<String, dynamic>? get requestBody => {
|
||||
'path': '$resourceId:',
|
||||
'username': username,
|
||||
'permission': permission,
|
||||
};
|
||||
|
||||
@override
|
||||
List<LocalChange> get localChanges => [
|
||||
|
||||
@@ -18,7 +18,7 @@ class ResourceUploadAction extends ResourceCreateAction with FileUploadApiAction
|
||||
String get method => 'PUT';
|
||||
|
||||
@override
|
||||
String get endpoint => '/api/v1/fs/upload/$resourceId';
|
||||
String get endpoint => '/api/v1/fs/upload';
|
||||
|
||||
@override
|
||||
MultipartFile createFile(Uint8List data) {
|
||||
@@ -34,9 +34,10 @@ class ResourceUploadAction extends ResourceCreateAction with FileUploadApiAction
|
||||
|
||||
@override
|
||||
Map<String, String> get fields => {
|
||||
'parent_id': parent,
|
||||
'name': resourceName,
|
||||
'path': '$parent:$resourceName',
|
||||
'id': resourceId,
|
||||
'conflict': conflictResolution.toString(),
|
||||
'sha256': '', // TODO: compute and send
|
||||
};
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user