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

generate code from proto #35

Merged
merged 1 commit into from
May 31, 2019
Merged
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
7 changes: 6 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"-Ithird_party/protobuf/src",
"-Ithird_party/googleapis",
"google/protobuf/empty.proto",
"services/authentication_service.proto"
"models/tag.proto",
"models/password.proto",
"services/authentication_service.proto",
"services/accounts_service.proto",
"services/passwords_service.proto",
"services/tags_service.proto",
],
},
{
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
analyzer:
exclude:
- third_party
- common/generated_io
28 changes: 28 additions & 0 deletions common/generated_io/lib/generated_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ export 'package:generated_io/src/google/protobuf/empty.pb.dart';
export 'package:generated_io/src/google/protobuf/empty.pbenum.dart';
export 'package:generated_io/src/google/protobuf/empty.pbjson.dart';

// password model
export 'package:generated_io/src/models/password.pb.dart';
export 'package:generated_io/src/models/password.pbenum.dart';
export 'package:generated_io/src/models/password.pbjson.dart';

// tag model
export 'package:generated_io/src/models/tag.pb.dart';
export 'package:generated_io/src/models/tag.pbenum.dart';
export 'package:generated_io/src/models/tag.pbjson.dart';

// accounts service
export 'package:generated_io/src/services/accounts_service.pb.dart';
export 'package:generated_io/src/services/accounts_service.pbenum.dart';
export 'package:generated_io/src/services/accounts_service.pbgrpc.dart';
export 'package:generated_io/src/services/accounts_service.pbjson.dart';

// passwords service
export 'package:generated_io/src/services/passwords_service.pb.dart';
export 'package:generated_io/src/services/passwords_service.pbenum.dart';
export 'package:generated_io/src/services/passwords_service.pbgrpc.dart';
export 'package:generated_io/src/services/passwords_service.pbjson.dart';

// tags service
export 'package:generated_io/src/services/tags_service.pb.dart';
export 'package:generated_io/src/services/tags_service.pbenum.dart';
export 'package:generated_io/src/services/tags_service.pbgrpc.dart';
export 'package:generated_io/src/services/tags_service.pbjson.dart';

// authentication service
export 'package:generated_io/src/services/authentication_service.pb.dart';
export 'package:generated_io/src/services/authentication_service.pbenum.dart';
Expand Down
67 changes: 67 additions & 0 deletions common/generated_io/lib/src/models/password.pb.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
///
// Generated code. Do not modify.
// source: models/password.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, Map, override;

import 'package:protobuf/protobuf.dart' as $pb;

import 'tag.pb.dart' as $2;

class Password extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('Password', package: const $pb.PackageName('stashall'))
..aOS(1, 'id')
..aOS(2, 'login')
..aOS(3, 'encryptedPassword')
..pp<$2.Tag>(4, 'tags', $pb.PbFieldType.PM, $2.Tag.$checkItem, $2.Tag.create)
..aOS(5, 'description')
..aOS(6, 'url')
..hasRequiredFields = false
;

Password() : super();
Password.fromBuffer(List<int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r);
Password.fromJson(String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromJson(i, r);
Password clone() => new Password()..mergeFromMessage(this);
Password copyWith(void Function(Password) updates) => super.copyWith((message) => updates(message as Password));
$pb.BuilderInfo get info_ => _i;
static Password create() => new Password();
Password createEmptyInstance() => create();
static $pb.PbList<Password> createRepeated() => new $pb.PbList<Password>();
static Password getDefault() => _defaultInstance ??= create()..freeze();
static Password _defaultInstance;
static void $checkItem(Password v) {
if (v is! Password) $pb.checkItemFailed(v, _i.qualifiedMessageName);
}

String get id => $_getS(0, '');
set id(String v) { $_setString(0, v); }
bool hasId() => $_has(0);
void clearId() => clearField(1);

String get login => $_getS(1, '');
set login(String v) { $_setString(1, v); }
bool hasLogin() => $_has(1);
void clearLogin() => clearField(2);

String get encryptedPassword => $_getS(2, '');
set encryptedPassword(String v) { $_setString(2, v); }
bool hasEncryptedPassword() => $_has(2);
void clearEncryptedPassword() => clearField(3);

List<$2.Tag> get tags => $_getList(3);

String get description => $_getS(4, '');
set description(String v) { $_setString(4, v); }
bool hasDescription() => $_has(4);
void clearDescription() => clearField(5);

String get url => $_getS(5, '');
set url(String v) { $_setString(5, v); }
bool hasUrl() => $_has(5);
void clearUrl() => clearField(6);
}

6 changes: 6 additions & 0 deletions common/generated_io/lib/src/models/password.pbenum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///
// Generated code. Do not modify.
// source: models/password.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

18 changes: 18 additions & 0 deletions common/generated_io/lib/src/models/password.pbjson.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
///
// Generated code. Do not modify.
// source: models/password.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

const Password$json = const {
'1': 'Password',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'login', '3': 2, '4': 1, '5': 9, '10': 'login'},
const {'1': 'encryptedPassword', '3': 3, '4': 1, '5': 9, '10': 'encryptedPassword'},
const {'1': 'tags', '3': 4, '4': 3, '5': 11, '6': '.stashall.Tag', '10': 'tags'},
const {'1': 'description', '3': 5, '4': 1, '5': 9, '10': 'description'},
const {'1': 'url', '3': 6, '4': 1, '5': 9, '10': 'url'},
],
};

56 changes: 56 additions & 0 deletions common/generated_io/lib/src/models/tag.pb.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
///
// Generated code. Do not modify.
// source: models/tag.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, Map, override;

import 'package:protobuf/protobuf.dart' as $pb;

class Tag extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('Tag', package: const $pb.PackageName('stashall'))
..aOS(1, 'id')
..aOS(2, 'label')
..aOS(3, 'description')
..aOS(4, 'color')
..hasRequiredFields = false
;

Tag() : super();
Tag.fromBuffer(List<int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r);
Tag.fromJson(String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromJson(i, r);
Tag clone() => new Tag()..mergeFromMessage(this);
Tag copyWith(void Function(Tag) updates) => super.copyWith((message) => updates(message as Tag));
$pb.BuilderInfo get info_ => _i;
static Tag create() => new Tag();
Tag createEmptyInstance() => create();
static $pb.PbList<Tag> createRepeated() => new $pb.PbList<Tag>();
static Tag getDefault() => _defaultInstance ??= create()..freeze();
static Tag _defaultInstance;
static void $checkItem(Tag v) {
if (v is! Tag) $pb.checkItemFailed(v, _i.qualifiedMessageName);
}

String get id => $_getS(0, '');
set id(String v) { $_setString(0, v); }
bool hasId() => $_has(0);
void clearId() => clearField(1);

String get label => $_getS(1, '');
set label(String v) { $_setString(1, v); }
bool hasLabel() => $_has(1);
void clearLabel() => clearField(2);

String get description => $_getS(2, '');
set description(String v) { $_setString(2, v); }
bool hasDescription() => $_has(2);
void clearDescription() => clearField(3);

String get color => $_getS(3, '');
set color(String v) { $_setString(3, v); }
bool hasColor() => $_has(3);
void clearColor() => clearField(4);
}

6 changes: 6 additions & 0 deletions common/generated_io/lib/src/models/tag.pbenum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///
// Generated code. Do not modify.
// source: models/tag.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

16 changes: 16 additions & 0 deletions common/generated_io/lib/src/models/tag.pbjson.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
///
// Generated code. Do not modify.
// source: models/tag.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

const Tag$json = const {
'1': 'Tag',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'label', '3': 2, '4': 1, '5': 9, '10': 'label'},
const {'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
const {'1': 'color', '3': 4, '4': 1, '5': 9, '10': 'color'},
],
};

71 changes: 71 additions & 0 deletions common/generated_io/lib/src/services/accounts_service.pb.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
///
// Generated code. Do not modify.
// source: services/accounts_service.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, Map, override;

import 'package:protobuf/protobuf.dart' as $pb;

class CreateAccountRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('CreateAccountRequest', package: const $pb.PackageName('stashall'))
..aOS(1, 'email')
..aOS(2, 'password')
..hasRequiredFields = false
;

CreateAccountRequest() : super();
CreateAccountRequest.fromBuffer(List<int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r);
CreateAccountRequest.fromJson(String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromJson(i, r);
CreateAccountRequest clone() => new CreateAccountRequest()..mergeFromMessage(this);
CreateAccountRequest copyWith(void Function(CreateAccountRequest) updates) => super.copyWith((message) => updates(message as CreateAccountRequest));
$pb.BuilderInfo get info_ => _i;
static CreateAccountRequest create() => new CreateAccountRequest();
CreateAccountRequest createEmptyInstance() => create();
static $pb.PbList<CreateAccountRequest> createRepeated() => new $pb.PbList<CreateAccountRequest>();
static CreateAccountRequest getDefault() => _defaultInstance ??= create()..freeze();
static CreateAccountRequest _defaultInstance;
static void $checkItem(CreateAccountRequest v) {
if (v is! CreateAccountRequest) $pb.checkItemFailed(v, _i.qualifiedMessageName);
}

String get email => $_getS(0, '');
set email(String v) { $_setString(0, v); }
bool hasEmail() => $_has(0);
void clearEmail() => clearField(1);

String get password => $_getS(1, '');
set password(String v) { $_setString(1, v); }
bool hasPassword() => $_has(1);
void clearPassword() => clearField(2);
}

class MeResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('MeResponse', package: const $pb.PackageName('stashall'))
..aOS(1, 'email')
..hasRequiredFields = false
;

MeResponse() : super();
MeResponse.fromBuffer(List<int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromBuffer(i, r);
MeResponse.fromJson(String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) : super.fromJson(i, r);
MeResponse clone() => new MeResponse()..mergeFromMessage(this);
MeResponse copyWith(void Function(MeResponse) updates) => super.copyWith((message) => updates(message as MeResponse));
$pb.BuilderInfo get info_ => _i;
static MeResponse create() => new MeResponse();
MeResponse createEmptyInstance() => create();
static $pb.PbList<MeResponse> createRepeated() => new $pb.PbList<MeResponse>();
static MeResponse getDefault() => _defaultInstance ??= create()..freeze();
static MeResponse _defaultInstance;
static void $checkItem(MeResponse v) {
if (v is! MeResponse) $pb.checkItemFailed(v, _i.qualifiedMessageName);
}

String get email => $_getS(0, '');
set email(String v) { $_setString(0, v); }
bool hasEmail() => $_has(0);
void clearEmail() => clearField(1);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///
// Generated code. Do not modify.
// source: services/accounts_service.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

77 changes: 77 additions & 0 deletions common/generated_io/lib/src/services/accounts_service.pbgrpc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
///
// Generated code. Do not modify.
// source: services/accounts_service.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

import 'dart:async' as $async;

import 'package:grpc/grpc.dart';

import 'accounts_service.pb.dart';
import '../google/protobuf/empty.pb.dart' as $0;
export 'accounts_service.pb.dart';

class AccountsServiceClient extends Client {
static final _$createAccount =
new ClientMethod<CreateAccountRequest, $0.Empty>(
'/stashall.AccountsService/createAccount',
(CreateAccountRequest value) => value.writeToBuffer(),
(List<int> value) => new $0.Empty.fromBuffer(value));
static final _$me = new ClientMethod<$0.Empty, MeResponse>(
'/stashall.AccountsService/me',
($0.Empty value) => value.writeToBuffer(),
(List<int> value) => new MeResponse.fromBuffer(value));

AccountsServiceClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);

ResponseFuture<$0.Empty> createAccount(CreateAccountRequest request,
{CallOptions options}) {
final call = $createCall(
_$createAccount, new $async.Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
}

ResponseFuture<MeResponse> me($0.Empty request, {CallOptions options}) {
final call = $createCall(_$me, new $async.Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
}
}

abstract class AccountsServiceBase extends Service {
String get $name => 'stashall.AccountsService';

AccountsServiceBase() {
$addMethod(new ServiceMethod<CreateAccountRequest, $0.Empty>(
'createAccount',
createAccount_Pre,
false,
false,
(List<int> value) => new CreateAccountRequest.fromBuffer(value),
($0.Empty value) => value.writeToBuffer()));
$addMethod(new ServiceMethod<$0.Empty, MeResponse>(
'me',
me_Pre,
false,
false,
(List<int> value) => new $0.Empty.fromBuffer(value),
(MeResponse value) => value.writeToBuffer()));
}

$async.Future<$0.Empty> createAccount_Pre(
ServiceCall call, $async.Future request) async {
return createAccount(call, await request);
}

$async.Future<MeResponse> me_Pre(
ServiceCall call, $async.Future request) async {
return me(call, await request);
}

$async.Future<$0.Empty> createAccount(
ServiceCall call, CreateAccountRequest request);
$async.Future<MeResponse> me(ServiceCall call, $0.Empty request);
}
Loading