Start writing the web app
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
This commit was merged in pull request #5.
This commit is contained in:
14
lib/core/api/v1/accounts.dart
Normal file
14
lib/core/api/v1/accounts.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:protobuf/well_known_types/google/protobuf/empty.pb.dart';
|
||||
import 'package:softplayer_dart_proto/accounts/v1/accounts_v1.pbgrpc.dart';
|
||||
import 'package:softplayer_web/core/grpc/grpc_client.dart';
|
||||
|
||||
final accountsGrpcProvider = Provider<AccountsGrpcRepository>((ref) {
|
||||
return AccountsGrpcRepository(ref.watch(accountsServiceClientProvider));
|
||||
});
|
||||
|
||||
class AccountsGrpcRepository {
|
||||
AccountsGrpcRepository(this._client);
|
||||
final AccountsServiceClient _client;
|
||||
}
|
||||
35
lib/core/api/v1/public_accounts.dart
Normal file
35
lib/core/api/v1/public_accounts.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:softplayer_dart_proto/accounts/v1/accounts_v1.pbgrpc.dart';
|
||||
import 'package:softplayer_web/core/grpc/grpc_client.dart';
|
||||
|
||||
final publicAccountsGrpcProvider = Provider<PublicAccountsGrpcRepository>((
|
||||
ref,
|
||||
) {
|
||||
return PublicAccountsGrpcRepository(
|
||||
ref.watch(publicAccountsServiceClientProvider),
|
||||
);
|
||||
});
|
||||
|
||||
class PublicAccountsGrpcRepository {
|
||||
PublicAccountsGrpcRepository(this._client);
|
||||
final PublicAccountsServiceClient _client;
|
||||
|
||||
ResponseFuture<SignInResponse> signIn(SignInRequest req) {
|
||||
try {
|
||||
final response = _client.signIn(req);
|
||||
return response;
|
||||
} catch (error) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
ResponseFuture<SignUpResponse> signUp(SignUpRequest req) {
|
||||
try {
|
||||
final response = _client.signUp(req);
|
||||
return response;
|
||||
} catch (error) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
lib/core/api/v1/refresh_session.dart
Normal file
28
lib/core/api/v1/refresh_session.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:softplayer_dart_proto/accounts/v1/accounts_v1.pbgrpc.dart';
|
||||
import 'package:softplayer_web/core/grpc/grpc_client.dart';
|
||||
|
||||
final refreshSessionGrpcProvider = Provider<RefreshSessionGrpcRepository>((
|
||||
ref,
|
||||
) {
|
||||
return RefreshSessionGrpcRepository(
|
||||
ref.watch(refreshSessionServiceClientProvider),
|
||||
);
|
||||
});
|
||||
|
||||
class RefreshSessionGrpcRepository {
|
||||
final RefreshSessionServiceClient _client;
|
||||
RefreshSessionGrpcRepository(this._client);
|
||||
|
||||
ResponseFuture<RefreshSessionResponse> refreshSession(String refreshToken) {
|
||||
try {
|
||||
final response = _client.refreshSession(
|
||||
RefreshSessionRequest(refreshToken: refreshToken),
|
||||
);
|
||||
return response;
|
||||
} catch (error) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
lib/core/api/v1/test.dart
Normal file
22
lib/core/api/v1/test.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:softplayer_dart_proto/test/v1/test_v1.pbgrpc.dart';
|
||||
import 'package:softplayer_web/core/grpc/grpc_client.dart';
|
||||
|
||||
final testGrpcProvider = Provider<TestGrpcRepository>((ref) {
|
||||
return TestGrpcRepository(ref.watch(testServiceClientProvider));
|
||||
});
|
||||
|
||||
class TestGrpcRepository {
|
||||
TestGrpcRepository(this._client);
|
||||
final TestServiceClient _client;
|
||||
|
||||
ResponseFuture<PongResponse> pong() {
|
||||
try {
|
||||
final response = _client.pong(PongRequest());
|
||||
return response;
|
||||
} catch (error) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user