From 2f0627fd81f6c8802454a9acb7279c1f73ea5980 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 23 Oct 2023 11:33:22 -0700 Subject: [PATCH] also support '/api/v3/...' enpoints --- .../lib/src/common_server_api.dart | 58 ++++++++---- .../lib/src/common_server_api.g.dart | 90 +++++++++++++++++++ 2 files changed, 129 insertions(+), 19 deletions(-) diff --git a/pkgs/dart_services/lib/src/common_server_api.dart b/pkgs/dart_services/lib/src/common_server_api.dart index 801023299..a04468797 100644 --- a/pkgs/dart_services/lib/src/common_server_api.dart +++ b/pkgs/dart_services/lib/src/common_server_api.dart @@ -25,7 +25,9 @@ part 'common_server_api.g.dart'; const protobufContentType = 'application/x-protobuf'; const jsonContentType = 'application/json; charset=utf-8'; -const apiPrefix = '/api/dartservices/'; + +const oldApiPrefix = '/api/dartservices/'; +const newApiPrefix = '/api/'; const api2 = 'v2'; const api3 = 'v3'; @@ -36,7 +38,8 @@ class CommonServerApi { CommonServerApi(this._impl); - @Route.post('$apiPrefix/analyze') + @Route.post('$oldApiPrefix/analyze') + @Route.post('$newApiPrefix/analyze') Future analyze(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -74,7 +77,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/compile') + @Route.post('$oldApiPrefix/compile') + @Route.post('$newApiPrefix/compile') Future compile(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -100,7 +104,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/compileDDC') + @Route.post('$oldApiPrefix/compileDDC') + @Route.post('$newApiPrefix/compileDDC') Future compileDDC(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -130,7 +135,8 @@ class CommonServerApi { } @experimental - @Route.post('$apiPrefix/_flutterBuild') + @Route.post('$oldApiPrefix/_flutterBuild') + @Route.post('$newApiPrefix/_flutterBuild') Future flutterBuild(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -161,7 +167,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/complete') + @Route.post('$oldApiPrefix/complete') + @Route.post('$newApiPrefix/complete') Future complete(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -182,7 +189,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/fixes') + @Route.post('$oldApiPrefix/fixes') + @Route.post('$newApiPrefix/fixes') Future fixes(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -203,7 +211,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/assists') + @Route.post('$oldApiPrefix/assists') + @Route.post('$newApiPrefix/assists') Future assists(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -218,7 +227,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/format') + @Route.post('$oldApiPrefix/format') + @Route.post('$newApiPrefix/format') Future format(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -247,7 +257,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/document') + @Route.post('$oldApiPrefix/document') + @Route.post('$newApiPrefix/document') Future document(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -273,7 +284,8 @@ class CommonServerApi { } } - @Route.post('$apiPrefix/version') + @Route.post('$oldApiPrefix/version') + @Route.post('$newApiPrefix/version') Future versionPost(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -288,7 +300,8 @@ class CommonServerApi { } } - @Route.get('$apiPrefix/version') + @Route.get('$oldApiPrefix/version') + @Route.get('$newApiPrefix/version') Future versionGet(Request request, String apiVersion) async { if (apiVersion == api2) { return _processRequest( @@ -306,7 +319,8 @@ class CommonServerApi { } // Beginning of multi file map end points: - @Route.post('$apiPrefix/analyzeFiles') + @Route.post('$oldApiPrefix/analyzeFiles') + @Route.post('$newApiPrefix/analyzeFiles') Future analyzeFiles(Request request, String apiVersion) { return _processRequest( request, @@ -317,7 +331,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/compileFiles') + @Route.post('$oldApiPrefix/compileFiles') + @Route.post('$newApiPrefix/compileFiles') Future compileFiles(Request request, String apiVersion) { return _processRequest( request, @@ -328,7 +343,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/compileFilesDDC') + @Route.post('$oldApiPrefix/compileFilesDDC') + @Route.post('$newApiPrefix/compileFilesDDC') Future compileFilesDDC(Request request, String apiVersion) { return _processRequest( request, @@ -339,7 +355,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/completeFiles') + @Route.post('$oldApiPrefix/completeFiles') + @Route.post('$newApiPrefix/completeFiles') Future completeFiles(Request request, String apiVersion) { return _processRequest( request, @@ -350,7 +367,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/fixesFiles') + @Route.post('$oldApiPrefix/fixesFiles') + @Route.post('$newApiPrefix/fixesFiles') Future fixesFiles(Request request, String apiVersion) { return _processRequest( request, @@ -361,7 +379,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/assistsFiles') + @Route.post('$oldApiPrefix/assistsFiles') + @Route.post('$newApiPrefix/assistsFiles') Future assistsFiles(Request request, String apiVersion) { return _processRequest( request, @@ -372,7 +391,8 @@ class CommonServerApi { ); } - @Route.post('$apiPrefix/documentFiles') + @Route.post('$oldApiPrefix/documentFiles') + @Route.post('$newApiPrefix/documentFiles') Future documentFiles(Request request, String apiVersion) { return _processRequest( request, diff --git a/pkgs/dart_services/lib/src/common_server_api.g.dart b/pkgs/dart_services/lib/src/common_server_api.g.dart index d8ab9b746..89de3665a 100644 --- a/pkgs/dart_services/lib/src/common_server_api.g.dart +++ b/pkgs/dart_services/lib/src/common_server_api.g.dart @@ -13,90 +13,180 @@ Router _$CommonServerApiRouter(CommonServerApi service) { r'/api/dartservices//analyze', service.analyze, ); + router.add( + 'POST', + r'/api//analyze', + service.analyze, + ); router.add( 'POST', r'/api/dartservices//compile', service.compile, ); + router.add( + 'POST', + r'/api//compile', + service.compile, + ); router.add( 'POST', r'/api/dartservices//compileDDC', service.compileDDC, ); + router.add( + 'POST', + r'/api//compileDDC', + service.compileDDC, + ); router.add( 'POST', r'/api/dartservices//_flutterBuild', service.flutterBuild, ); + router.add( + 'POST', + r'/api//_flutterBuild', + service.flutterBuild, + ); router.add( 'POST', r'/api/dartservices//complete', service.complete, ); + router.add( + 'POST', + r'/api//complete', + service.complete, + ); router.add( 'POST', r'/api/dartservices//fixes', service.fixes, ); + router.add( + 'POST', + r'/api//fixes', + service.fixes, + ); router.add( 'POST', r'/api/dartservices//assists', service.assists, ); + router.add( + 'POST', + r'/api//assists', + service.assists, + ); router.add( 'POST', r'/api/dartservices//format', service.format, ); + router.add( + 'POST', + r'/api//format', + service.format, + ); router.add( 'POST', r'/api/dartservices//document', service.document, ); + router.add( + 'POST', + r'/api//document', + service.document, + ); router.add( 'POST', r'/api/dartservices//version', service.versionPost, ); + router.add( + 'POST', + r'/api//version', + service.versionPost, + ); router.add( 'GET', r'/api/dartservices//version', service.versionGet, ); + router.add( + 'GET', + r'/api//version', + service.versionGet, + ); router.add( 'POST', r'/api/dartservices//analyzeFiles', service.analyzeFiles, ); + router.add( + 'POST', + r'/api//analyzeFiles', + service.analyzeFiles, + ); router.add( 'POST', r'/api/dartservices//compileFiles', service.compileFiles, ); + router.add( + 'POST', + r'/api//compileFiles', + service.compileFiles, + ); router.add( 'POST', r'/api/dartservices//compileFilesDDC', service.compileFilesDDC, ); + router.add( + 'POST', + r'/api//compileFilesDDC', + service.compileFilesDDC, + ); router.add( 'POST', r'/api/dartservices//completeFiles', service.completeFiles, ); + router.add( + 'POST', + r'/api//completeFiles', + service.completeFiles, + ); router.add( 'POST', r'/api/dartservices//fixesFiles', service.fixesFiles, ); + router.add( + 'POST', + r'/api//fixesFiles', + service.fixesFiles, + ); router.add( 'POST', r'/api/dartservices//assistsFiles', service.assistsFiles, ); + router.add( + 'POST', + r'/api//assistsFiles', + service.assistsFiles, + ); router.add( 'POST', r'/api/dartservices//documentFiles', service.documentFiles, ); + router.add( + 'POST', + r'/api//documentFiles', + service.documentFiles, + ); return router; }