Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use base class on dart/flutter for ping #1023

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion templates/dart/lib/src/client_base.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ abstract class ClientBase implements Client {
ClientBase addHeader(String key, String value);

@override
Future<String> ping();
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(
HttpMethod.get,
path: apiPath,
responseType: ResponseType.plain,
);
return response.data;
}

@override
Future<Response> call(
Expand Down
8 changes: 0 additions & 8 deletions templates/dart/lib/src/client_browser.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ class ClientBrowser extends ClientBase with ClientMixin {
return this;
}

@override
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(HttpMethod.get, path: apiPath, responseType: ResponseType.plain);

return response.data;
}

@override
Future<String?> webAuth(Uri url) async {
final request = http.Request('GET', url);
Expand Down
8 changes: 0 additions & 8 deletions templates/dart/lib/src/client_io.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ class ClientIO extends ClientBase with ClientMixin {
return this;
}

@override
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(HttpMethod.get, path: apiPath, responseType: ResponseType.plain);

return response.data;
}

@override
Future<Response> chunkedUpload({
required String path,
Expand Down
10 changes: 9 additions & 1 deletion templates/flutter/lib/src/client_base.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ abstract class ClientBase implements Client {
ClientBase addHeader(String key, String value);

@override
Future<String> ping();
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(
HttpMethod.get,
path: apiPath,
responseType: ResponseType.plain,
);
return response.data;
}

@override
Future<Response> call(
Expand Down
8 changes: 0 additions & 8 deletions templates/flutter/lib/src/client_browser.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ class ClientBrowser extends ClientBase with ClientMixin {
return this;
}

@override
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(HttpMethod.get, path: apiPath, responseType: ResponseType.plain);

return response.data;
}

Future init() async {
final cookieFallback = web.window.localStorage['cookieFallback'];
if (cookieFallback != null) {
Expand Down
8 changes: 0 additions & 8 deletions templates/flutter/lib/src/client_io.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ class ClientIO extends ClientBase with ClientMixin {
return this;
}

@override
Future<String> ping() async {
final String apiPath = '/ping';
final response = await call(HttpMethod.get, path: apiPath, responseType: ResponseType.plain);

return response.data;
}

Future init() async {
if(_initProgress) return;
_initProgress = true;
Expand Down
Loading