File tree Expand file tree Collapse file tree 15 files changed +264
-260
lines changed Expand file tree Collapse file tree 15 files changed +264
-260
lines changed Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+
3
+ abstract class ApiController {
4
+ /// Get details of the endpoints within this controller.
5
+ EndpointControllerInfo info ();
6
+
7
+ /// Placeholder endpoint function for not-yet-supported endpoints
8
+ Future <String > notImplemented () async {
9
+ return "THIS METHOD IS CURRENTLY NOT SUPPORTED" ;
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
5
import 'dart:convert' ;
4
6
5
- class Attachments {
7
+ class Attachments extends ApiController {
8
+
9
+ @override
10
+ EndpointControllerInfo info () {
11
+ return EndpointControllerInfo (label: 'Attachments' , endpoints: {
12
+ 'list' : list,
13
+ 'create' : create,
14
+ 'read' : read,
15
+ 'update' : update,
16
+ 'delete' : delete,
17
+ });
18
+ }
6
19
7
20
Future <String > list () async {
8
21
print ('Trying List' );
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
5
import 'dart:convert' ;
4
6
5
- class Books {
7
+ class Books extends ApiController {
8
+
9
+ @override
10
+ EndpointControllerInfo info () {
11
+ return EndpointControllerInfo (label: 'Books' , endpoints: {
12
+ 'list' : list,
13
+ 'create' : create,
14
+ 'read' : read,
15
+ 'update' : update,
16
+ 'delete' : delete,
17
+ 'export-html' : exportHtml,
18
+ 'export-pdf' : exportPdf,
19
+ 'export-plain-text' : exportPlain,
20
+ 'export-markdown' : exportMarkdown,
21
+ });
22
+ }
6
23
7
24
Future <String > list () async {
8
25
print ('Trying List' );
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
5
import 'dart:convert' ;
4
6
5
- class Chapters {
7
+ class Chapters extends ApiController {
8
+
9
+ @override
10
+ EndpointControllerInfo info () {
11
+ return EndpointControllerInfo (label: 'Chapters' , endpoints: {
12
+ 'list' : list,
13
+ 'create' : create,
14
+ 'read' : read,
15
+ 'update' : update,
16
+ 'delete' : delete,
17
+ 'export-html' : exportHtml,
18
+ 'export-pdf' : exportPdf,
19
+ 'export-plain-text' : exportPlain,
20
+ 'export-markdown' : exportMarkdown,
21
+ });
22
+ }
6
23
7
24
Future <String > list () async {
8
- String url = '$urlFull /api/image-gallery ' ;
25
+ String url = '$urlFull /api/chapters ' ;
9
26
var response = await http.get (Uri .parse (url), headers: headers);
10
27
11
28
return response.body;
@@ -109,4 +126,4 @@ class Chapters {
109
126
return response.body;
110
127
}
111
128
112
- }
129
+ }
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
- import 'dart:convert' ;
4
5
5
- class ContentPermissions {
6
+ class ContentPermissions extends ApiController {
7
+
8
+ @override
9
+ EndpointControllerInfo info () {
10
+ return EndpointControllerInfo (label: 'Content Permissions' , endpoints: {
11
+ 'read' : read,
12
+ 'update' : notImplemented,
13
+ });
14
+ }
6
15
7
16
Future <String > read () async {
8
17
String contentType = 'page' ;
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
- import 'dart:convert' ;
4
5
import 'dart:io' ;
5
6
6
- import 'package:http_parser/http_parser.dart' ;
7
-
8
- class image_gallery {
7
+ class ImageGallery extends ApiController {
8
+
9
+ @override
10
+ EndpointControllerInfo info () {
11
+ return EndpointControllerInfo (label: 'Image Gallery' , endpoints: {
12
+ 'list' : list,
13
+ 'create' : create,
14
+ 'read' : read,
15
+ 'update' : update,
16
+ 'delete' : delete,
17
+ });
18
+ }
9
19
10
20
Future <String > list () async {
11
21
String url = '$urlFull /api/image-gallery' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
5
import 'dart:convert' ;
4
6
5
- class Pages {
7
+ class Pages extends ApiController {
8
+
9
+ @override
10
+ EndpointControllerInfo info () {
11
+ return EndpointControllerInfo (label: 'Pages' , endpoints: {
12
+ 'list' : list,
13
+ 'create' : create,
14
+ 'read' : read,
15
+ 'update' : update,
16
+ 'delete' : delete,
17
+ 'export-html' : exportHtml,
18
+ 'export-pdf' : exportPdf,
19
+ 'export-plain-text' : exportPlain,
20
+ 'export-markdown' : exportMarkdown,
21
+ });
22
+ }
6
23
7
24
Future <String > list () async {
8
25
String url = '$urlFull /api/pages' ;
Original file line number Diff line number Diff line change
1
+ import '../service/endpoints.dart' ;
2
+ import 'api_controller.dart' ;
1
3
import 'server_info.dart' ;
2
4
import 'package:http/http.dart' as http;
3
- import 'dart:convert' ;
4
5
5
- class RecycleBin {
6
+ class RecycleBin extends ApiController {
7
+
8
+ @override
9
+ EndpointControllerInfo info () {
10
+ return EndpointControllerInfo (label: 'Recycle Bin' , endpoints: {
11
+ 'list' : list,
12
+ 'restore' : notImplemented,
13
+ 'destroy' : destroy,
14
+ });
15
+ }
6
16
7
17
Future <String > list () async {
8
18
print ('Trying List' );
@@ -12,15 +22,6 @@ class RecycleBin {
12
22
return response.body;
13
23
}
14
24
15
- Future <String > restore () async {
16
-
17
- String deletionID= '121' ;
18
-
19
- String url = '$urlFull /api/recycle-bin/$deletionID ' ;
20
- var response = await http.get (Uri .parse (url), headers: headers);
21
- return response.body;
22
- }
23
-
24
25
25
26
Future <String > destroy () async {
26
27
You can’t perform that action at this time.
0 commit comments