Skip to content

Commit

Permalink
add first task and generate authentication service
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleak committed May 15, 2019
1 parent a305f07 commit acadc52
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 16 deletions.
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "generate code from protos",
"type": "shell",
"command": "protoc",
"args": [
"--dart_out=grpc:common/generated_io/lib/src",
"-Iprotos",
"-Ithird_party/protobuf/src",
"-Ithird_party/googleapis",
"google/protobuf/empty.proto",
"services/authentication_service.proto"
],
}
]
}
16 changes: 0 additions & 16 deletions app/README.md

This file was deleted.

11 changes: 11 additions & 0 deletions common/generated_io/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Files and directories created by pub
.dart_tool/
.packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock

# Conventional directory for build outputs
build/

# Directory created by dartdoc
doc/api/
14 changes: 14 additions & 0 deletions common/generated_io/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml

# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types

analyzer:
# exclude:
# - path/to/excluded/files/**
10 changes: 10 additions & 0 deletions common/generated_io/lib/generated_io.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// from third party
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';

// authentication service
export 'package:generated_io/src/services/authentication_service.pb.dart';
export 'package:generated_io/src/services/authentication_service.pbenum.dart';
export 'package:generated_io/src/services/authentication_service.pbgrpc.dart';
export 'package:generated_io/src/services/authentication_service.pbjson.dart';
32 changes: 32 additions & 0 deletions common/generated_io/lib/src/google/protobuf/empty.pb.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
///
// Generated code. Do not modify.
// source: google/protobuf/empty.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 Empty extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('Empty', package: const $pb.PackageName('google.protobuf'))
..hasRequiredFields = false
;

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

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

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

const Empty$json = const {
'1': 'Empty',
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
///
// Generated code. Do not modify.
// source: services/authentication_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 SigninRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = new $pb.BuilderInfo('SigninRequest', package: const $pb.PackageName('stashall'))
..aOS(1, 'email')
..aOS(2, 'password')
..hasRequiredFields = false
;

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

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

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

import 'dart:async' as $async;

import 'package:grpc/grpc.dart';

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

class AuthenticationServiceClient extends Client {
static final _$signin = new ClientMethod<SigninRequest, $0.Empty>(
'/stashall.AuthenticationService/signin',
(SigninRequest value) => value.writeToBuffer(),
(List<int> value) => new $0.Empty.fromBuffer(value));

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

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

abstract class AuthenticationServiceBase extends Service {
String get $name => 'stashall.AuthenticationService';

AuthenticationServiceBase() {
$addMethod(new ServiceMethod<SigninRequest, $0.Empty>(
'signin',
signin_Pre,
false,
false,
(List<int> value) => new SigninRequest.fromBuffer(value),
($0.Empty value) => value.writeToBuffer()));
}

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

$async.Future<$0.Empty> signin(ServiceCall call, SigninRequest request);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
///
// Generated code. Do not modify.
// source: services/authentication_service.proto
///
// ignore_for_file: non_constant_identifier_names,library_prefixes,unused_import

const SigninRequest$json = const {
'1': 'SigninRequest',
'2': const [
const {'1': 'email', '3': 1, '4': 1, '5': 9, '10': 'email'},
const {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'},
],
};

16 changes: 16 additions & 0 deletions common/generated_io/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: generated_io
description: A sample command-line application.
# version: 1.0.0
# homepage: https://www.example.com
# author: kevin <[email protected]>

environment:
sdk: '>=2.1.0 <3.0.0'

dependencies:
grpc: ^1.0.2
protobuf: ^0.13.11

dev_dependencies:
pedantic: ^1.0.0
test: ^1.0.0
File renamed without changes.
File renamed without changes.

0 comments on commit acadc52

Please sign in to comment.