Skip to content

Commit

Permalink
feat: define rpc Report(ReportRequest) returns (ReportResponse)
Browse files Browse the repository at this point in the history
Signed-off-by: Mo <[email protected]>
  • Loading branch information
kkweon committed Jun 27, 2021
1 parent 35e59aa commit dab82ec
Show file tree
Hide file tree
Showing 8 changed files with 494 additions and 43 deletions.
112 changes: 112 additions & 0 deletions client/lib/protos/pkg/pr12er/service.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import 'package:protobuf/protobuf.dart' as $pb;

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

import 'service.pbenum.dart';

export 'service.pbenum.dart';

class HelloRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'HelloRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pkg.pr12er'), createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'body')
Expand Down Expand Up @@ -271,3 +275,111 @@ class GetDetailRequest extends $pb.GeneratedMessage {
void clearPrId() => clearField(1);
}

class ReportRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ReportRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pkg.pr12er'), createEmptyInstance: create)
..e<ReportRequest_ReportType>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type', $pb.PbFieldType.OE, defaultOrMaker: ReportRequest_ReportType.REPORT_TYPE_UNSPECIFIED, valueOf: ReportRequest_ReportType.valueOf, enumValues: ReportRequest_ReportType.values)
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'body')
..hasRequiredFields = false
;

ReportRequest._() : super();
factory ReportRequest({
ReportRequest_ReportType? type,
$core.String? body,
}) {
final _result = create();
if (type != null) {
_result.type = type;
}
if (body != null) {
_result.body = body;
}
return _result;
}
factory ReportRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ReportRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ReportRequest clone() => ReportRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ReportRequest copyWith(void Function(ReportRequest) updates) => super.copyWith((message) => updates(message as ReportRequest)) as ReportRequest; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ReportRequest create() => ReportRequest._();
ReportRequest createEmptyInstance() => create();
static $pb.PbList<ReportRequest> createRepeated() => $pb.PbList<ReportRequest>();
@$core.pragma('dart2js:noInline')
static ReportRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ReportRequest>(create);
static ReportRequest? _defaultInstance;

@$pb.TagNumber(1)
ReportRequest_ReportType get type => $_getN(0);
@$pb.TagNumber(1)
set type(ReportRequest_ReportType v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasType() => $_has(0);
@$pb.TagNumber(1)
void clearType() => clearField(1);

@$pb.TagNumber(2)
$core.String get body => $_getSZ(1);
@$pb.TagNumber(2)
set body($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasBody() => $_has(1);
@$pb.TagNumber(2)
void clearBody() => clearField(2);
}

class ReportResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ReportResponse', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pkg.pr12er'), createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'issueUrl')
..hasRequiredFields = false
;

ReportResponse._() : super();
factory ReportResponse({
$core.String? issueUrl,
}) {
final _result = create();
if (issueUrl != null) {
_result.issueUrl = issueUrl;
}
return _result;
}
factory ReportResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ReportResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ReportResponse clone() => ReportResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ReportResponse copyWith(void Function(ReportResponse) updates) => super.copyWith((message) => updates(message as ReportResponse)) as ReportResponse; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ReportResponse create() => ReportResponse._();
ReportResponse createEmptyInstance() => create();
static $pb.PbList<ReportResponse> createRepeated() => $pb.PbList<ReportResponse>();
@$core.pragma('dart2js:noInline')
static ReportResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ReportResponse>(create);
static ReportResponse? _defaultInstance;

@$pb.TagNumber(1)
$core.String get issueUrl => $_getSZ(0);
@$pb.TagNumber(1)
set issueUrl($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasIssueUrl() => $_has(0);
@$pb.TagNumber(1)
void clearIssueUrl() => clearField(1);
}

21 changes: 21 additions & 0 deletions client/lib/protos/pkg/pr12er/service.pbenum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,24 @@
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

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

class ReportRequest_ReportType extends $pb.ProtobufEnum {
static const ReportRequest_ReportType REPORT_TYPE_UNSPECIFIED = ReportRequest_ReportType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'REPORT_TYPE_UNSPECIFIED');
static const ReportRequest_ReportType REPORT_TYPE_MISSING_PR_VIDEO = ReportRequest_ReportType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'REPORT_TYPE_MISSING_PR_VIDEO');
static const ReportRequest_ReportType REPORT_TYPE_BUG = ReportRequest_ReportType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'REPORT_TYPE_BUG');

static const $core.List<ReportRequest_ReportType> values = <ReportRequest_ReportType> [
REPORT_TYPE_UNSPECIFIED,
REPORT_TYPE_MISSING_PR_VIDEO,
REPORT_TYPE_BUG,
];

static final $core.Map<$core.int, ReportRequest_ReportType> _byValue = $pb.ProtobufEnum.initByValue(values);
static ReportRequest_ReportType? valueOf($core.int value) => _byValue[value];

const ReportRequest_ReportType._($core.int v, $core.String n) : super(v, n);
}

24 changes: 24 additions & 0 deletions client/lib/protos/pkg/pr12er/service.pbgrpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ class Pr12erServiceClient extends $grpc.Client {
($0.GetDetailRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.GetDetailResponse.fromBuffer(value));
static final _$report =
$grpc.ClientMethod<$0.ReportRequest, $0.ReportResponse>(
'/pkg.pr12er.Pr12erService/Report',
($0.ReportRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.ReportResponse.fromBuffer(value));

Pr12erServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
Expand All @@ -53,6 +58,11 @@ class Pr12erServiceClient extends $grpc.Client {
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$getDetail, request, options: options);
}

$grpc.ResponseFuture<$0.ReportResponse> report($0.ReportRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$report, request, options: options);
}
}

abstract class Pr12erServiceBase extends $grpc.Service {
Expand Down Expand Up @@ -80,6 +90,13 @@ abstract class Pr12erServiceBase extends $grpc.Service {
false,
($core.List<$core.int> value) => $0.GetDetailRequest.fromBuffer(value),
($0.GetDetailResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ReportRequest, $0.ReportResponse>(
'Report',
report_Pre,
false,
false,
($core.List<$core.int> value) => $0.ReportRequest.fromBuffer(value),
($0.ReportResponse value) => value.writeToBuffer()));
}

$async.Future<$0.HelloResponse> getHello_Pre(
Expand All @@ -97,10 +114,17 @@ abstract class Pr12erServiceBase extends $grpc.Service {
return getDetail(call, await request);
}

$async.Future<$0.ReportResponse> report_Pre(
$grpc.ServiceCall call, $async.Future<$0.ReportRequest> request) async {
return report(call, await request);
}

$async.Future<$0.HelloResponse> getHello(
$grpc.ServiceCall call, $0.HelloRequest request);
$async.Future<$0.GetVideosResponse> getVideos(
$grpc.ServiceCall call, $0.GetVideosRequest request);
$async.Future<$0.GetDetailResponse> getDetail(
$grpc.ServiceCall call, $0.GetDetailRequest request);
$async.Future<$0.ReportResponse> report(
$grpc.ServiceCall call, $0.ReportRequest request);
}
32 changes: 32 additions & 0 deletions client/lib/protos/pkg/pr12er/service.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,35 @@ const GetDetailRequest$json = const {

/// Descriptor for `GetDetailRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getDetailRequestDescriptor = $convert.base64Decode('ChBHZXREZXRhaWxSZXF1ZXN0EhMKBXByX2lkGAEgASgFUgRwcklk');
@$core.Deprecated('Use reportRequestDescriptor instead')
const ReportRequest$json = const {
'1': 'ReportRequest',
'2': const [
const {'1': 'type', '3': 1, '4': 1, '5': 14, '6': '.pkg.pr12er.ReportRequest.ReportType', '10': 'type'},
const {'1': 'body', '3': 2, '4': 1, '5': 9, '10': 'body'},
],
'4': const [ReportRequest_ReportType$json],
};

@$core.Deprecated('Use reportRequestDescriptor instead')
const ReportRequest_ReportType$json = const {
'1': 'ReportType',
'2': const [
const {'1': 'REPORT_TYPE_UNSPECIFIED', '2': 0},
const {'1': 'REPORT_TYPE_MISSING_PR_VIDEO', '2': 1},
const {'1': 'REPORT_TYPE_BUG', '2': 2},
],
};

/// Descriptor for `ReportRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List reportRequestDescriptor = $convert.base64Decode('Cg1SZXBvcnRSZXF1ZXN0EjgKBHR5cGUYASABKA4yJC5wa2cucHIxMmVyLlJlcG9ydFJlcXVlc3QuUmVwb3J0VHlwZVIEdHlwZRISCgRib2R5GAIgASgJUgRib2R5ImAKClJlcG9ydFR5cGUSGwoXUkVQT1JUX1RZUEVfVU5TUEVDSUZJRUQQABIgChxSRVBPUlRfVFlQRV9NSVNTSU5HX1BSX1ZJREVPEAESEwoPUkVQT1JUX1RZUEVfQlVHEAI=');
@$core.Deprecated('Use reportResponseDescriptor instead')
const ReportResponse$json = const {
'1': 'ReportResponse',
'2': const [
const {'1': 'issue_url', '3': 1, '4': 1, '5': 9, '10': 'issueUrl'},
],
};

/// Descriptor for `ReportResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List reportResponseDescriptor = $convert.base64Decode('Cg5SZXBvcnRSZXNwb25zZRIbCglpc3N1ZV91cmwYASABKAlSCGlzc3VlVXJs');
Loading

0 comments on commit dab82ec

Please sign in to comment.