├── CHANGELOG.md ├── renovate.json ├── README.md ├── .gitignore ├── .github ├── cla-check.yaml └── workflows │ └── ci.yaml ├── protos ├── ratings_features_common.proto ├── ratings_features_app.proto ├── ratings_features_chart.proto └── ratings_features_user.proto ├── lib ├── src │ ├── generated │ │ ├── ratings_features_app.pbenum.dart │ │ ├── google │ │ │ └── protobuf │ │ │ │ ├── empty.pbenum.dart │ │ │ │ ├── timestamp.pbenum.dart │ │ │ │ ├── empty.pbjson.dart │ │ │ │ ├── timestamp.pbjson.dart │ │ │ │ ├── empty.pb.dart │ │ │ │ └── timestamp.pb.dart │ │ ├── ratings_features_user.pbenum.dart │ │ ├── ratings_features_chart.pbenum.dart │ │ ├── ratings_features_app.pbjson.dart │ │ ├── ratings_features_common.pbenum.dart │ │ ├── ratings_features_common.pbjson.dart │ │ ├── ratings_features_app.pbgrpc.dart │ │ ├── ratings_features_chart.pbgrpc.dart │ │ ├── ratings_features_chart.pbjson.dart │ │ ├── ratings_features_common.pb.dart │ │ ├── ratings_features_user.pbjson.dart │ │ ├── ratings_features_app.pb.dart │ │ ├── ratings_features_user.pbgrpc.dart │ │ ├── ratings_features_chart.pb.dart │ │ └── ratings_features_user.pb.dart │ ├── user.dart │ ├── chart.dart │ ├── ratings.dart │ ├── chart.freezed.dart │ └── user.freezed.dart └── app_center_ratings_client.dart ├── pubspec.yaml ├── analysis_options.yaml ├── test ├── ratings_client_test.dart └── ratings_client_test.mocks.dart └── LICENSE /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>canonical/ubuntu-flutter-plugins" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository has been depricated and this client moved into the [app-center repo](https://github.com/ubuntu/app-center/tree/main/packages/app_center_ratings_client) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | .packages 5 | .vscode/ 6 | build/ 7 | coverage/ 8 | doc/ 9 | pubspec.lock 10 | -------------------------------------------------------------------------------- /.github/cla-check.yaml: -------------------------------------------------------------------------------- 1 | name: CLA 2 | on: [pull_request_target] 3 | 4 | jobs: 5 | check: 6 | if: contains(fromJson('["weblate", "renovate[bot]"]'), github.event.pull_request.user.login) == false 7 | runs-on: ubuntu-20.04 8 | steps: 9 | - name: Check if CLA signed 10 | uses: canonical/has-signed-canonical-cla@v1 11 | -------------------------------------------------------------------------------- /protos/ratings_features_common.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package ratings.features.common; 4 | 5 | message Rating { 6 | string snap_id = 1; 7 | uint64 total_votes = 2; 8 | RatingsBand ratings_band = 3; 9 | } 10 | 11 | enum RatingsBand { 12 | VERY_GOOD = 0; 13 | GOOD = 1; 14 | NEUTRAL = 2; 15 | POOR = 3; 16 | VERY_POOR = 4; 17 | INSUFFICIENT_VOTES = 5; 18 | } 19 | -------------------------------------------------------------------------------- /protos/ratings_features_app.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package ratings.features.app; 4 | 5 | import "ratings_features_common.proto"; 6 | 7 | service App { 8 | rpc GetRating (GetRatingRequest) returns (GetRatingResponse) {} 9 | } 10 | 11 | message GetRatingRequest { 12 | string snap_id = 1; 13 | } 14 | 15 | message GetRatingResponse { 16 | ratings.features.common.Rating rating = 1; 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_app.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_app.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/empty.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/empty.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_user.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_user.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/timestamp.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/timestamp.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: app_center_ratings_client 2 | description: Dart client for App Center Rating service 3 | homepage: https://github.com/canonical/app_center_ratings_client.dart 4 | repository: https://github.com/canonical/app_center_ratings_client.dart 5 | version: 1.0.0 6 | 7 | environment: 8 | sdk: ^3.0.6 9 | 10 | dependencies: 11 | fixnum: ^1.1.0 12 | freezed: ^2.4.1 13 | freezed_annotation: ^2.4.1 14 | grpc: ^3.1.0 15 | meta: ^1.7.0 16 | protobuf: ^3.0.0 17 | protoc_plugin: ^21.0.1 18 | 19 | 20 | 21 | dev_dependencies: 22 | build_runner: ^2.4.5 23 | lints: ^3.0.0 24 | mockito: ^5.4.2 25 | test: ^1.21.0 26 | -------------------------------------------------------------------------------- /protos/ratings_features_chart.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package ratings.features.chart; 4 | 5 | import "ratings_features_common.proto"; 6 | 7 | service Chart { 8 | rpc GetChart (GetChartRequest) returns (GetChartResponse) {} 9 | } 10 | 11 | message GetChartRequest { 12 | Timeframe timeframe = 1; 13 | } 14 | 15 | message GetChartResponse { 16 | Timeframe timeframe = 1; 17 | repeated ChartData ordered_chart_data = 2; 18 | } 19 | 20 | message ChartData { 21 | float raw_rating = 1; 22 | ratings.features.common.Rating rating = 2; 23 | } 24 | 25 | enum Timeframe { 26 | TIMEFRAME_UNSPECIFIED = 0; 27 | TIMEFRAME_WEEK = 1; 28 | TIMEFRAME_MONTH = 2; 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/user.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | import 'generated/ratings_features_user.pb.dart' as pb; 4 | 5 | part 'user.freezed.dart'; 6 | 7 | @freezed 8 | class Vote with _$Vote { 9 | const factory Vote({ 10 | required String snapId, 11 | required int snapRevision, 12 | required bool voteUp, 13 | required DateTime dateTime, 14 | }) = _Vote; 15 | } 16 | 17 | extension VoteFromDTO on pb.Vote { 18 | Vote fromDTO() { 19 | return Vote( 20 | snapId: this.snapId, 21 | snapRevision: this.snapRevision, 22 | voteUp: this.voteUp, 23 | dateTime: this.timestamp.toDateTime(), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/empty.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/empty.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use emptyDescriptor instead') 17 | const Empty$json = { 18 | '1': 'Empty', 19 | }; 20 | 21 | /// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`. 22 | final $typed_data.Uint8List emptyDescriptor = 23 | $convert.base64Decode('CgVFbXB0eQ=='); 24 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | workflow_dispatch: 9 | 10 | jobs: 11 | analyze: 12 | runs-on: ubuntu-22.04 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: subosito/flutter-action@v2 16 | - run: flutter pub get 17 | - run: flutter analyze 18 | 19 | format: 20 | runs-on: ubuntu-22.04 21 | steps: 22 | - uses: actions/checkout@v4 23 | - uses: subosito/flutter-action@v2 24 | - run: flutter pub get 25 | - run: dart format --set-exit-if-changed . 26 | 27 | pub: 28 | runs-on: ubuntu-22.04 29 | steps: 30 | - uses: actions/checkout@v4 31 | - uses: subosito/flutter-action@v2 32 | - run: flutter pub get 33 | - run: flutter pub publish --dry-run 34 | 35 | test: 36 | runs-on: ubuntu-22.04 37 | steps: 38 | - uses: actions/checkout@v4 39 | - uses: subosito/flutter-action@v2 40 | - run: flutter test 41 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/timestamp.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/timestamp.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use timestampDescriptor instead') 17 | const Timestamp$json = { 18 | '1': 'Timestamp', 19 | '2': [ 20 | {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, 21 | {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, 22 | ], 23 | }; 24 | 25 | /// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`. 26 | final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode( 27 | 'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm' 28 | 'Fub3M='); 29 | -------------------------------------------------------------------------------- /protos/ratings_features_user.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package ratings.features.user; 4 | 5 | import "google/protobuf/empty.proto"; 6 | import "google/protobuf/timestamp.proto"; 7 | 8 | service User { 9 | rpc Authenticate (AuthenticateRequest) returns (AuthenticateResponse) {} 10 | 11 | rpc Delete (google.protobuf.Empty) returns (google.protobuf.Empty) {} 12 | rpc Vote (VoteRequest) returns (google.protobuf.Empty) {} 13 | rpc ListMyVotes (ListMyVotesRequest) returns (ListMyVotesResponse) {} 14 | rpc GetSnapVotes(GetSnapVotesRequest) returns (GetSnapVotesResponse) {} 15 | } 16 | 17 | message AuthenticateRequest { 18 | string id = 1; 19 | } 20 | 21 | message AuthenticateResponse { 22 | string token = 1; 23 | } 24 | 25 | message ListMyVotesRequest { 26 | string snap_id_filter = 1; 27 | } 28 | 29 | message ListMyVotesResponse { 30 | repeated Vote votes = 1; 31 | } 32 | 33 | message GetSnapVotesRequest { 34 | string snap_id = 1; 35 | } 36 | 37 | message GetSnapVotesResponse { 38 | repeated Vote votes = 1; 39 | } 40 | 41 | message Vote { 42 | string snap_id = 1; 43 | int32 snap_revision = 2; 44 | bool vote_up = 3; 45 | google.protobuf.Timestamp timestamp = 4; 46 | } 47 | 48 | message VoteRequest { 49 | string snap_id = 1; 50 | int32 snap_revision = 2; 51 | bool vote_up = 3; 52 | } 53 | -------------------------------------------------------------------------------- /lib/src/chart.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | import 'generated/ratings_features_chart.pb.dart' as pb; 4 | import 'ratings.dart' as common; 5 | 6 | part 'chart.freezed.dart'; 7 | 8 | @freezed 9 | class ChartData with _$ChartData { 10 | const factory ChartData({ 11 | required double rawRating, 12 | required common.Rating rating, 13 | }) = _ChartData; 14 | } 15 | 16 | enum Timeframe { 17 | unspecified, 18 | week, 19 | month, 20 | } 21 | 22 | extension ChartDataFromDTO on pb.ChartData { 23 | ChartData fromDTO() { 24 | return ChartData( 25 | rating: this.rating.fromDTO(), 26 | rawRating: this.rawRating, 27 | ); 28 | } 29 | } 30 | 31 | extension TimeframeFromDTO on pb.Timeframe { 32 | Timeframe fromDTO() { 33 | return switch (this) { 34 | pb.Timeframe.TIMEFRAME_UNSPECIFIED => Timeframe.unspecified, 35 | pb.Timeframe.TIMEFRAME_WEEK => Timeframe.week, 36 | pb.Timeframe.TIMEFRAME_MONTH => Timeframe.month, 37 | _ => Timeframe.unspecified, 38 | }; 39 | } 40 | } 41 | 42 | extension TimeframeToDTO on Timeframe { 43 | pb.Timeframe toDTO() { 44 | return switch (this) { 45 | Timeframe.unspecified => pb.Timeframe.TIMEFRAME_UNSPECIFIED, 46 | Timeframe.week => pb.Timeframe.TIMEFRAME_WEEK, 47 | Timeframe.month => pb.Timeframe.TIMEFRAME_MONTH, 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | exclude: 3 | - "**/*.freezed.dart" 4 | - "**/*.g.dart" 5 | - "**/*.mocks.dart" 6 | - "**/l10n/*.dart" 7 | - "lib/src/generated/**" 8 | errors: 9 | invalid_annotation_target: ignore 10 | 11 | language: 12 | strict-casts: false 13 | 14 | linter: 15 | rules: 16 | always_declare_return_types: true 17 | avoid_catches_without_on_clauses: true 18 | avoid_equals_and_hash_code_on_mutable_classes: true 19 | avoid_types_on_closure_parameters: true 20 | cancel_subscriptions: true 21 | depend_on_referenced_packages: true 22 | directives_ordering: true 23 | eol_at_end_of_file: true 24 | omit_local_variable_types: true 25 | prefer_asserts_in_initializer_lists: true 26 | prefer_const_constructors: true 27 | prefer_final_in_for_each: true 28 | prefer_final_locals: true 29 | prefer_relative_imports: true 30 | prefer_null_aware_method_calls: true 31 | prefer_null_aware_operators: true 32 | prefer_single_quotes: true 33 | sized_box_shrink_expand: true 34 | sized_box_for_whitespace: true 35 | sort_unnamed_constructors_first: true 36 | sort_pub_dependencies: true 37 | type_annotate_public_apis: true 38 | unawaited_futures: true 39 | unnecessary_lambdas: true 40 | unnecessary_late: true 41 | unnecessary_parenthesis: true 42 | use_decorated_box: true 43 | use_named_constants: true 44 | use_super_parameters: true 45 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_chart.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_chart.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | class Timeframe extends $pb.ProtobufEnum { 17 | static const Timeframe TIMEFRAME_UNSPECIFIED = 18 | Timeframe._(0, _omitEnumNames ? '' : 'TIMEFRAME_UNSPECIFIED'); 19 | static const Timeframe TIMEFRAME_WEEK = 20 | Timeframe._(1, _omitEnumNames ? '' : 'TIMEFRAME_WEEK'); 21 | static const Timeframe TIMEFRAME_MONTH = 22 | Timeframe._(2, _omitEnumNames ? '' : 'TIMEFRAME_MONTH'); 23 | 24 | static const $core.List values = [ 25 | TIMEFRAME_UNSPECIFIED, 26 | TIMEFRAME_WEEK, 27 | TIMEFRAME_MONTH, 28 | ]; 29 | 30 | static final $core.Map<$core.int, Timeframe> _byValue = 31 | $pb.ProtobufEnum.initByValue(values); 32 | static Timeframe? valueOf($core.int value) => _byValue[value]; 33 | 34 | const Timeframe._($core.int v, $core.String n) : super(v, n); 35 | } 36 | 37 | const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); 38 | -------------------------------------------------------------------------------- /lib/src/ratings.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | import 'generated/ratings_features_common.pb.dart' as pb; 4 | 5 | @immutable 6 | class Rating { 7 | final String snapId; 8 | final int totalVotes; 9 | final RatingsBand ratingsBand; 10 | 11 | const Rating({ 12 | required this.snapId, 13 | required this.totalVotes, 14 | required this.ratingsBand, 15 | }); 16 | 17 | @override 18 | bool operator ==(Object other) { 19 | if (identical(this, other)) return true; 20 | 21 | return other is Rating && 22 | other.snapId == snapId && 23 | other.totalVotes == totalVotes && 24 | other.ratingsBand == ratingsBand; 25 | } 26 | 27 | @override 28 | int get hashCode => 29 | snapId.hashCode ^ totalVotes.hashCode ^ ratingsBand.hashCode; 30 | } 31 | 32 | enum RatingsBand { 33 | veryGood, 34 | good, 35 | neutral, 36 | poor, 37 | veryPoor, 38 | insufficientVotes, 39 | } 40 | 41 | extension RatingFromDTO on pb.Rating { 42 | Rating fromDTO() { 43 | return Rating( 44 | snapId: this.snapId, 45 | totalVotes: this.totalVotes.toInt(), 46 | ratingsBand: this.ratingsBand.fromDTO(), 47 | ); 48 | } 49 | } 50 | 51 | extension RatingsBandFromDTO on pb.RatingsBand { 52 | RatingsBand fromDTO() { 53 | return switch (this) { 54 | pb.RatingsBand.VERY_GOOD => RatingsBand.veryGood, 55 | pb.RatingsBand.GOOD => RatingsBand.good, 56 | pb.RatingsBand.NEUTRAL => RatingsBand.neutral, 57 | pb.RatingsBand.POOR => RatingsBand.poor, 58 | pb.RatingsBand.VERY_POOR => RatingsBand.veryPoor, 59 | _ => RatingsBand.insufficientVotes, 60 | }; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_app.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_app.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use getRatingRequestDescriptor instead') 17 | const GetRatingRequest$json = { 18 | '1': 'GetRatingRequest', 19 | '2': [ 20 | {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, 21 | ], 22 | }; 23 | 24 | /// Descriptor for `GetRatingRequest`. Decode as a `google.protobuf.DescriptorProto`. 25 | final $typed_data.Uint8List getRatingRequestDescriptor = $convert.base64Decode( 26 | 'ChBHZXRSYXRpbmdSZXF1ZXN0EhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZA=='); 27 | 28 | @$core.Deprecated('Use getRatingResponseDescriptor instead') 29 | const GetRatingResponse$json = { 30 | '1': 'GetRatingResponse', 31 | '2': [ 32 | { 33 | '1': 'rating', 34 | '3': 1, 35 | '4': 1, 36 | '5': 11, 37 | '6': '.ratings.features.common.Rating', 38 | '10': 'rating' 39 | }, 40 | ], 41 | }; 42 | 43 | /// Descriptor for `GetRatingResponse`. Decode as a `google.protobuf.DescriptorProto`. 44 | final $typed_data.Uint8List getRatingResponseDescriptor = $convert.base64Decode( 45 | 'ChFHZXRSYXRpbmdSZXNwb25zZRI3CgZyYXRpbmcYASABKAsyHy5yYXRpbmdzLmZlYXR1cmVzLm' 46 | 'NvbW1vbi5SYXRpbmdSBnJhdGluZw=='); 47 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_common.pbenum.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_common.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | class RatingsBand extends $pb.ProtobufEnum { 17 | static const RatingsBand VERY_GOOD = 18 | RatingsBand._(0, _omitEnumNames ? '' : 'VERY_GOOD'); 19 | static const RatingsBand GOOD = 20 | RatingsBand._(1, _omitEnumNames ? '' : 'GOOD'); 21 | static const RatingsBand NEUTRAL = 22 | RatingsBand._(2, _omitEnumNames ? '' : 'NEUTRAL'); 23 | static const RatingsBand POOR = 24 | RatingsBand._(3, _omitEnumNames ? '' : 'POOR'); 25 | static const RatingsBand VERY_POOR = 26 | RatingsBand._(4, _omitEnumNames ? '' : 'VERY_POOR'); 27 | static const RatingsBand INSUFFICIENT_VOTES = 28 | RatingsBand._(5, _omitEnumNames ? '' : 'INSUFFICIENT_VOTES'); 29 | 30 | static const $core.List values = [ 31 | VERY_GOOD, 32 | GOOD, 33 | NEUTRAL, 34 | POOR, 35 | VERY_POOR, 36 | INSUFFICIENT_VOTES, 37 | ]; 38 | 39 | static final $core.Map<$core.int, RatingsBand> _byValue = 40 | $pb.ProtobufEnum.initByValue(values); 41 | static RatingsBand? valueOf($core.int value) => _byValue[value]; 42 | 43 | const RatingsBand._($core.int v, $core.String n) : super(v, n); 44 | } 45 | 46 | const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); 47 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_common.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_common.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use ratingsBandDescriptor instead') 17 | const RatingsBand$json = { 18 | '1': 'RatingsBand', 19 | '2': [ 20 | {'1': 'VERY_GOOD', '2': 0}, 21 | {'1': 'GOOD', '2': 1}, 22 | {'1': 'NEUTRAL', '2': 2}, 23 | {'1': 'POOR', '2': 3}, 24 | {'1': 'VERY_POOR', '2': 4}, 25 | {'1': 'INSUFFICIENT_VOTES', '2': 5}, 26 | ], 27 | }; 28 | 29 | /// Descriptor for `RatingsBand`. Decode as a `google.protobuf.EnumDescriptorProto`. 30 | final $typed_data.Uint8List ratingsBandDescriptor = $convert.base64Decode( 31 | 'CgtSYXRpbmdzQmFuZBINCglWRVJZX0dPT0QQABIICgRHT09EEAESCwoHTkVVVFJBTBACEggKBF' 32 | 'BPT1IQAxINCglWRVJZX1BPT1IQBBIWChJJTlNVRkZJQ0lFTlRfVk9URVMQBQ=='); 33 | 34 | @$core.Deprecated('Use ratingDescriptor instead') 35 | const Rating$json = { 36 | '1': 'Rating', 37 | '2': [ 38 | {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, 39 | {'1': 'total_votes', '3': 2, '4': 1, '5': 4, '10': 'totalVotes'}, 40 | { 41 | '1': 'ratings_band', 42 | '3': 3, 43 | '4': 1, 44 | '5': 14, 45 | '6': '.ratings.features.common.RatingsBand', 46 | '10': 'ratingsBand' 47 | }, 48 | ], 49 | }; 50 | 51 | /// Descriptor for `Rating`. Decode as a `google.protobuf.DescriptorProto`. 52 | final $typed_data.Uint8List ratingDescriptor = $convert.base64Decode( 53 | 'CgZSYXRpbmcSFwoHc25hcF9pZBgBIAEoCVIGc25hcElkEh8KC3RvdGFsX3ZvdGVzGAIgASgEUg' 54 | 'p0b3RhbFZvdGVzEkcKDHJhdGluZ3NfYmFuZBgDIAEoDjIkLnJhdGluZ3MuZmVhdHVyZXMuY29t' 55 | 'bW9uLlJhdGluZ3NCYW5kUgtyYXRpbmdzQmFuZA=='); 56 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_app.pbgrpc.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_app.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:async' as $async; 13 | import 'dart:core' as $core; 14 | 15 | import 'package:grpc/service_api.dart' as $grpc; 16 | import 'package:protobuf/protobuf.dart' as $pb; 17 | 18 | import 'ratings_features_app.pb.dart' as $0; 19 | 20 | export 'ratings_features_app.pb.dart'; 21 | 22 | @$pb.GrpcServiceName('ratings.features.app.App') 23 | class AppClient extends $grpc.Client { 24 | static final _$getRating = 25 | $grpc.ClientMethod<$0.GetRatingRequest, $0.GetRatingResponse>( 26 | '/ratings.features.app.App/GetRating', 27 | ($0.GetRatingRequest value) => value.writeToBuffer(), 28 | ($core.List<$core.int> value) => 29 | $0.GetRatingResponse.fromBuffer(value)); 30 | 31 | AppClient($grpc.ClientChannel channel, 32 | {$grpc.CallOptions? options, 33 | $core.Iterable<$grpc.ClientInterceptor>? interceptors}) 34 | : super(channel, options: options, interceptors: interceptors); 35 | 36 | $grpc.ResponseFuture<$0.GetRatingResponse> getRating( 37 | $0.GetRatingRequest request, 38 | {$grpc.CallOptions? options}) { 39 | return $createUnaryCall(_$getRating, request, options: options); 40 | } 41 | } 42 | 43 | @$pb.GrpcServiceName('ratings.features.app.App') 44 | abstract class AppServiceBase extends $grpc.Service { 45 | $core.String get $name => 'ratings.features.app.App'; 46 | 47 | AppServiceBase() { 48 | $addMethod($grpc.ServiceMethod<$0.GetRatingRequest, $0.GetRatingResponse>( 49 | 'GetRating', 50 | getRating_Pre, 51 | false, 52 | false, 53 | ($core.List<$core.int> value) => $0.GetRatingRequest.fromBuffer(value), 54 | ($0.GetRatingResponse value) => value.writeToBuffer())); 55 | } 56 | 57 | $async.Future<$0.GetRatingResponse> getRating_Pre($grpc.ServiceCall call, 58 | $async.Future<$0.GetRatingRequest> request) async { 59 | return getRating(call, await request); 60 | } 61 | 62 | $async.Future<$0.GetRatingResponse> getRating( 63 | $grpc.ServiceCall call, $0.GetRatingRequest request); 64 | } 65 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_chart.pbgrpc.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_chart.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:async' as $async; 13 | import 'dart:core' as $core; 14 | 15 | import 'package:grpc/service_api.dart' as $grpc; 16 | import 'package:protobuf/protobuf.dart' as $pb; 17 | 18 | import 'ratings_features_chart.pb.dart' as $0; 19 | 20 | export 'ratings_features_chart.pb.dart'; 21 | 22 | @$pb.GrpcServiceName('ratings.features.chart.Chart') 23 | class ChartClient extends $grpc.Client { 24 | static final _$getChart = 25 | $grpc.ClientMethod<$0.GetChartRequest, $0.GetChartResponse>( 26 | '/ratings.features.chart.Chart/GetChart', 27 | ($0.GetChartRequest value) => value.writeToBuffer(), 28 | ($core.List<$core.int> value) => 29 | $0.GetChartResponse.fromBuffer(value)); 30 | 31 | ChartClient($grpc.ClientChannel channel, 32 | {$grpc.CallOptions? options, 33 | $core.Iterable<$grpc.ClientInterceptor>? interceptors}) 34 | : super(channel, options: options, interceptors: interceptors); 35 | 36 | $grpc.ResponseFuture<$0.GetChartResponse> getChart($0.GetChartRequest request, 37 | {$grpc.CallOptions? options}) { 38 | return $createUnaryCall(_$getChart, request, options: options); 39 | } 40 | } 41 | 42 | @$pb.GrpcServiceName('ratings.features.chart.Chart') 43 | abstract class ChartServiceBase extends $grpc.Service { 44 | $core.String get $name => 'ratings.features.chart.Chart'; 45 | 46 | ChartServiceBase() { 47 | $addMethod($grpc.ServiceMethod<$0.GetChartRequest, $0.GetChartResponse>( 48 | 'GetChart', 49 | getChart_Pre, 50 | false, 51 | false, 52 | ($core.List<$core.int> value) => $0.GetChartRequest.fromBuffer(value), 53 | ($0.GetChartResponse value) => value.writeToBuffer())); 54 | } 55 | 56 | $async.Future<$0.GetChartResponse> getChart_Pre( 57 | $grpc.ServiceCall call, $async.Future<$0.GetChartRequest> request) async { 58 | return getChart(call, await request); 59 | } 60 | 61 | $async.Future<$0.GetChartResponse> getChart( 62 | $grpc.ServiceCall call, $0.GetChartRequest request); 63 | } 64 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/empty.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/empty.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | /// A generic empty message that you can re-use to avoid defining duplicated 17 | /// empty messages in your APIs. A typical example is to use it as the request 18 | /// or the response type of an API method. For instance: 19 | /// 20 | /// service Foo { 21 | /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 22 | /// } 23 | /// 24 | /// The JSON representation for `Empty` is empty JSON object `{}`. 25 | class Empty extends $pb.GeneratedMessage { 26 | factory Empty() => create(); 27 | Empty._() : super(); 28 | factory Empty.fromBuffer($core.List<$core.int> i, 29 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 30 | create()..mergeFromBuffer(i, r); 31 | factory Empty.fromJson($core.String i, 32 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 33 | create()..mergeFromJson(i, r); 34 | 35 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 36 | _omitMessageNames ? '' : 'Empty', 37 | package: 38 | const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), 39 | createEmptyInstance: create) 40 | ..hasRequiredFields = false; 41 | 42 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 43 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 44 | 'Will be removed in next major version') 45 | Empty clone() => Empty()..mergeFromMessage(this); 46 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 47 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 48 | 'Will be removed in next major version') 49 | Empty copyWith(void Function(Empty) updates) => 50 | super.copyWith((message) => updates(message as Empty)) as Empty; 51 | 52 | $pb.BuilderInfo get info_ => _i; 53 | 54 | @$core.pragma('dart2js:noInline') 55 | static Empty create() => Empty._(); 56 | Empty createEmptyInstance() => create(); 57 | static $pb.PbList createRepeated() => $pb.PbList(); 58 | @$core.pragma('dart2js:noInline') 59 | static Empty getDefault() => 60 | _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 61 | static Empty? _defaultInstance; 62 | } 63 | 64 | const _omitMessageNames = 65 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 66 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_chart.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_chart.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use timeframeDescriptor instead') 17 | const Timeframe$json = { 18 | '1': 'Timeframe', 19 | '2': [ 20 | {'1': 'TIMEFRAME_UNSPECIFIED', '2': 0}, 21 | {'1': 'TIMEFRAME_WEEK', '2': 1}, 22 | {'1': 'TIMEFRAME_MONTH', '2': 2}, 23 | ], 24 | }; 25 | 26 | /// Descriptor for `Timeframe`. Decode as a `google.protobuf.EnumDescriptorProto`. 27 | final $typed_data.Uint8List timeframeDescriptor = $convert.base64Decode( 28 | 'CglUaW1lZnJhbWUSGQoVVElNRUZSQU1FX1VOU1BFQ0lGSUVEEAASEgoOVElNRUZSQU1FX1dFRU' 29 | 'sQARITCg9USU1FRlJBTUVfTU9OVEgQAg=='); 30 | 31 | @$core.Deprecated('Use getChartRequestDescriptor instead') 32 | const GetChartRequest$json = { 33 | '1': 'GetChartRequest', 34 | '2': [ 35 | { 36 | '1': 'timeframe', 37 | '3': 1, 38 | '4': 1, 39 | '5': 14, 40 | '6': '.ratings.features.chart.Timeframe', 41 | '10': 'timeframe' 42 | }, 43 | ], 44 | }; 45 | 46 | /// Descriptor for `GetChartRequest`. Decode as a `google.protobuf.DescriptorProto`. 47 | final $typed_data.Uint8List getChartRequestDescriptor = $convert.base64Decode( 48 | 'Cg9HZXRDaGFydFJlcXVlc3QSPwoJdGltZWZyYW1lGAEgASgOMiEucmF0aW5ncy5mZWF0dXJlcy' 49 | '5jaGFydC5UaW1lZnJhbWVSCXRpbWVmcmFtZQ=='); 50 | 51 | @$core.Deprecated('Use getChartResponseDescriptor instead') 52 | const GetChartResponse$json = { 53 | '1': 'GetChartResponse', 54 | '2': [ 55 | { 56 | '1': 'timeframe', 57 | '3': 1, 58 | '4': 1, 59 | '5': 14, 60 | '6': '.ratings.features.chart.Timeframe', 61 | '10': 'timeframe' 62 | }, 63 | { 64 | '1': 'ordered_chart_data', 65 | '3': 2, 66 | '4': 3, 67 | '5': 11, 68 | '6': '.ratings.features.chart.ChartData', 69 | '10': 'orderedChartData' 70 | }, 71 | ], 72 | }; 73 | 74 | /// Descriptor for `GetChartResponse`. Decode as a `google.protobuf.DescriptorProto`. 75 | final $typed_data.Uint8List getChartResponseDescriptor = $convert.base64Decode( 76 | 'ChBHZXRDaGFydFJlc3BvbnNlEj8KCXRpbWVmcmFtZRgBIAEoDjIhLnJhdGluZ3MuZmVhdHVyZX' 77 | 'MuY2hhcnQuVGltZWZyYW1lUgl0aW1lZnJhbWUSTwoSb3JkZXJlZF9jaGFydF9kYXRhGAIgAygL' 78 | 'MiEucmF0aW5ncy5mZWF0dXJlcy5jaGFydC5DaGFydERhdGFSEG9yZGVyZWRDaGFydERhdGE='); 79 | 80 | @$core.Deprecated('Use chartDataDescriptor instead') 81 | const ChartData$json = { 82 | '1': 'ChartData', 83 | '2': [ 84 | {'1': 'raw_rating', '3': 1, '4': 1, '5': 2, '10': 'rawRating'}, 85 | { 86 | '1': 'rating', 87 | '3': 2, 88 | '4': 1, 89 | '5': 11, 90 | '6': '.ratings.features.common.Rating', 91 | '10': 'rating' 92 | }, 93 | ], 94 | }; 95 | 96 | /// Descriptor for `ChartData`. Decode as a `google.protobuf.DescriptorProto`. 97 | final $typed_data.Uint8List chartDataDescriptor = $convert.base64Decode( 98 | 'CglDaGFydERhdGESHQoKcmF3X3JhdGluZxgBIAEoAlIJcmF3UmF0aW5nEjcKBnJhdGluZxgCIA' 99 | 'EoCzIfLnJhdGluZ3MuZmVhdHVyZXMuY29tbW9uLlJhdGluZ1IGcmF0aW5n'); 100 | -------------------------------------------------------------------------------- /lib/app_center_ratings_client.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:grpc/grpc.dart'; 4 | import 'package:meta/meta.dart'; 5 | 6 | import 'src/chart.dart'; 7 | import 'src/generated/google/protobuf/empty.pb.dart'; 8 | import 'src/generated/ratings_features_app.pbgrpc.dart' as appPb; 9 | import 'src/generated/ratings_features_chart.pbgrpc.dart' as chartPb; 10 | import 'src/generated/ratings_features_user.pbgrpc.dart' as userPb; 11 | import 'src/ratings.dart'; 12 | import 'src/user.dart'; 13 | 14 | class RatingsClient { 15 | late appPb.AppClient _appClient; 16 | late userPb.UserClient _userClient; 17 | late chartPb.ChartClient _chartClient; 18 | 19 | RatingsClient(String serverUrl, int port) { 20 | final channel = ClientChannel( 21 | serverUrl, 22 | port: port, 23 | options: const ChannelOptions( 24 | credentials: ChannelCredentials.insecure(), 25 | ), 26 | ); 27 | _appClient = appPb.AppClient(channel); 28 | _userClient = userPb.UserClient(channel); 29 | _chartClient = chartPb.ChartClient(channel); 30 | } 31 | 32 | // Additional constructor for testing 33 | @visibleForTesting 34 | RatingsClient.withClients( 35 | this._appClient, 36 | this._userClient, 37 | this._chartClient, 38 | ); 39 | 40 | Future authenticate(String id) async { 41 | final request = userPb.AuthenticateRequest(id: id); 42 | final grpcResponse = await _userClient.authenticate(request); 43 | return grpcResponse.token; 44 | } 45 | 46 | Future delete(String token) async { 47 | final request = Empty(); 48 | final callOptions = 49 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 50 | await _userClient.delete(request, options: callOptions); 51 | } 52 | 53 | Future> getChart(Timeframe timeframe, String token) async { 54 | final request = chartPb.GetChartRequest(timeframe: timeframe.toDTO()); 55 | final callOptions = 56 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 57 | final grpcResponse = 58 | await _chartClient.getChart(request, options: callOptions); 59 | return grpcResponse.orderedChartData.map((data) => data.fromDTO()).toList(); 60 | } 61 | 62 | Future getRating( 63 | String snapId, 64 | String token, 65 | ) async { 66 | final request = appPb.GetRatingRequest(snapId: snapId); 67 | final callOptions = 68 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 69 | final grpcResponse = await _appClient.getRating( 70 | request, 71 | options: callOptions, 72 | ); 73 | return grpcResponse.rating.fromDTO(); 74 | } 75 | 76 | Future> getSnapVotes(String snap_id, String token) async { 77 | final request = userPb.GetSnapVotesRequest(snapId: snap_id); 78 | final callOptions = 79 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 80 | final grpcResponse = await _userClient.getSnapVotes( 81 | request, 82 | options: callOptions, 83 | ); 84 | return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); 85 | } 86 | 87 | Future> listMyVotes(String snapIdFilter, String token) async { 88 | final request = userPb.ListMyVotesRequest(snapIdFilter: snapIdFilter); 89 | final callOptions = 90 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 91 | final grpcResponse = await _userClient.listMyVotes( 92 | request, 93 | options: callOptions, 94 | ); 95 | return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); 96 | } 97 | 98 | Future vote( 99 | String snapId, int snapRevision, bool voteUp, String token) async { 100 | final request = userPb.VoteRequest( 101 | snapId: snapId, 102 | snapRevision: snapRevision, 103 | voteUp: voteUp, 104 | ); 105 | final callOptions = 106 | CallOptions(metadata: {'authorization': 'Bearer $token'}); 107 | await _userClient.vote(request, options: callOptions); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_common.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_common.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:fixnum/fixnum.dart' as $fixnum; 15 | import 'package:protobuf/protobuf.dart' as $pb; 16 | 17 | import 'ratings_features_common.pbenum.dart'; 18 | 19 | export 'ratings_features_common.pbenum.dart'; 20 | 21 | class Rating extends $pb.GeneratedMessage { 22 | factory Rating({ 23 | $core.String? snapId, 24 | $fixnum.Int64? totalVotes, 25 | RatingsBand? ratingsBand, 26 | }) { 27 | final $result = create(); 28 | if (snapId != null) { 29 | $result.snapId = snapId; 30 | } 31 | if (totalVotes != null) { 32 | $result.totalVotes = totalVotes; 33 | } 34 | if (ratingsBand != null) { 35 | $result.ratingsBand = ratingsBand; 36 | } 37 | return $result; 38 | } 39 | Rating._() : super(); 40 | factory Rating.fromBuffer($core.List<$core.int> i, 41 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 42 | create()..mergeFromBuffer(i, r); 43 | factory Rating.fromJson($core.String i, 44 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 45 | create()..mergeFromJson(i, r); 46 | 47 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 48 | _omitMessageNames ? '' : 'Rating', 49 | package: const $pb.PackageName( 50 | _omitMessageNames ? '' : 'ratings.features.common'), 51 | createEmptyInstance: create) 52 | ..aOS(1, _omitFieldNames ? '' : 'snapId') 53 | ..a<$fixnum.Int64>( 54 | 2, _omitFieldNames ? '' : 'totalVotes', $pb.PbFieldType.OU6, 55 | defaultOrMaker: $fixnum.Int64.ZERO) 56 | ..e( 57 | 3, _omitFieldNames ? '' : 'ratingsBand', $pb.PbFieldType.OE, 58 | defaultOrMaker: RatingsBand.VERY_GOOD, 59 | valueOf: RatingsBand.valueOf, 60 | enumValues: RatingsBand.values) 61 | ..hasRequiredFields = false; 62 | 63 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 64 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 65 | 'Will be removed in next major version') 66 | Rating clone() => Rating()..mergeFromMessage(this); 67 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 68 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 69 | 'Will be removed in next major version') 70 | Rating copyWith(void Function(Rating) updates) => 71 | super.copyWith((message) => updates(message as Rating)) as Rating; 72 | 73 | $pb.BuilderInfo get info_ => _i; 74 | 75 | @$core.pragma('dart2js:noInline') 76 | static Rating create() => Rating._(); 77 | Rating createEmptyInstance() => create(); 78 | static $pb.PbList createRepeated() => $pb.PbList(); 79 | @$core.pragma('dart2js:noInline') 80 | static Rating getDefault() => 81 | _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 82 | static Rating? _defaultInstance; 83 | 84 | @$pb.TagNumber(1) 85 | $core.String get snapId => $_getSZ(0); 86 | @$pb.TagNumber(1) 87 | set snapId($core.String v) { 88 | $_setString(0, v); 89 | } 90 | 91 | @$pb.TagNumber(1) 92 | $core.bool hasSnapId() => $_has(0); 93 | @$pb.TagNumber(1) 94 | void clearSnapId() => clearField(1); 95 | 96 | @$pb.TagNumber(2) 97 | $fixnum.Int64 get totalVotes => $_getI64(1); 98 | @$pb.TagNumber(2) 99 | set totalVotes($fixnum.Int64 v) { 100 | $_setInt64(1, v); 101 | } 102 | 103 | @$pb.TagNumber(2) 104 | $core.bool hasTotalVotes() => $_has(1); 105 | @$pb.TagNumber(2) 106 | void clearTotalVotes() => clearField(2); 107 | 108 | @$pb.TagNumber(3) 109 | RatingsBand get ratingsBand => $_getN(2); 110 | @$pb.TagNumber(3) 111 | set ratingsBand(RatingsBand v) { 112 | setField(3, v); 113 | } 114 | 115 | @$pb.TagNumber(3) 116 | $core.bool hasRatingsBand() => $_has(2); 117 | @$pb.TagNumber(3) 118 | void clearRatingsBand() => clearField(3); 119 | } 120 | 121 | const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); 122 | const _omitMessageNames = 123 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 124 | -------------------------------------------------------------------------------- /lib/src/chart.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark 5 | 6 | part of 'chart.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$ChartData { 19 | double get rawRating => throw _privateConstructorUsedError; 20 | common.Rating get rating => throw _privateConstructorUsedError; 21 | 22 | @JsonKey(ignore: true) 23 | $ChartDataCopyWith get copyWith => 24 | throw _privateConstructorUsedError; 25 | } 26 | 27 | /// @nodoc 28 | abstract class $ChartDataCopyWith<$Res> { 29 | factory $ChartDataCopyWith(ChartData value, $Res Function(ChartData) then) = 30 | _$ChartDataCopyWithImpl<$Res, ChartData>; 31 | @useResult 32 | $Res call({double rawRating, common.Rating rating}); 33 | } 34 | 35 | /// @nodoc 36 | class _$ChartDataCopyWithImpl<$Res, $Val extends ChartData> 37 | implements $ChartDataCopyWith<$Res> { 38 | _$ChartDataCopyWithImpl(this._value, this._then); 39 | 40 | // ignore: unused_field 41 | final $Val _value; 42 | // ignore: unused_field 43 | final $Res Function($Val) _then; 44 | 45 | @pragma('vm:prefer-inline') 46 | @override 47 | $Res call({ 48 | Object? rawRating = null, 49 | Object? rating = null, 50 | }) { 51 | return _then(_value.copyWith( 52 | rawRating: null == rawRating 53 | ? _value.rawRating 54 | : rawRating // ignore: cast_nullable_to_non_nullable 55 | as double, 56 | rating: null == rating 57 | ? _value.rating 58 | : rating // ignore: cast_nullable_to_non_nullable 59 | as common.Rating, 60 | ) as $Val); 61 | } 62 | } 63 | 64 | /// @nodoc 65 | abstract class _$$ChartDataImplCopyWith<$Res> 66 | implements $ChartDataCopyWith<$Res> { 67 | factory _$$ChartDataImplCopyWith( 68 | _$ChartDataImpl value, $Res Function(_$ChartDataImpl) then) = 69 | __$$ChartDataImplCopyWithImpl<$Res>; 70 | @override 71 | @useResult 72 | $Res call({double rawRating, common.Rating rating}); 73 | } 74 | 75 | /// @nodoc 76 | class __$$ChartDataImplCopyWithImpl<$Res> 77 | extends _$ChartDataCopyWithImpl<$Res, _$ChartDataImpl> 78 | implements _$$ChartDataImplCopyWith<$Res> { 79 | __$$ChartDataImplCopyWithImpl( 80 | _$ChartDataImpl _value, $Res Function(_$ChartDataImpl) _then) 81 | : super(_value, _then); 82 | 83 | @pragma('vm:prefer-inline') 84 | @override 85 | $Res call({ 86 | Object? rawRating = null, 87 | Object? rating = null, 88 | }) { 89 | return _then(_$ChartDataImpl( 90 | rawRating: null == rawRating 91 | ? _value.rawRating 92 | : rawRating // ignore: cast_nullable_to_non_nullable 93 | as double, 94 | rating: null == rating 95 | ? _value.rating 96 | : rating // ignore: cast_nullable_to_non_nullable 97 | as common.Rating, 98 | )); 99 | } 100 | } 101 | 102 | /// @nodoc 103 | 104 | class _$ChartDataImpl implements _ChartData { 105 | const _$ChartDataImpl({required this.rawRating, required this.rating}); 106 | 107 | @override 108 | final double rawRating; 109 | @override 110 | final common.Rating rating; 111 | 112 | @override 113 | String toString() { 114 | return 'ChartData(rawRating: $rawRating, rating: $rating)'; 115 | } 116 | 117 | @override 118 | bool operator ==(dynamic other) { 119 | return identical(this, other) || 120 | (other.runtimeType == runtimeType && 121 | other is _$ChartDataImpl && 122 | (identical(other.rawRating, rawRating) || 123 | other.rawRating == rawRating) && 124 | (identical(other.rating, rating) || other.rating == rating)); 125 | } 126 | 127 | @override 128 | int get hashCode => Object.hash(runtimeType, rawRating, rating); 129 | 130 | @JsonKey(ignore: true) 131 | @override 132 | @pragma('vm:prefer-inline') 133 | _$$ChartDataImplCopyWith<_$ChartDataImpl> get copyWith => 134 | __$$ChartDataImplCopyWithImpl<_$ChartDataImpl>(this, _$identity); 135 | } 136 | 137 | abstract class _ChartData implements ChartData { 138 | const factory _ChartData( 139 | {required final double rawRating, 140 | required final common.Rating rating}) = _$ChartDataImpl; 141 | 142 | @override 143 | double get rawRating; 144 | @override 145 | common.Rating get rating; 146 | @override 147 | @JsonKey(ignore: true) 148 | _$$ChartDataImplCopyWith<_$ChartDataImpl> get copyWith => 149 | throw _privateConstructorUsedError; 150 | } 151 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_user.pbjson.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_user.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:convert' as $convert; 13 | import 'dart:core' as $core; 14 | import 'dart:typed_data' as $typed_data; 15 | 16 | @$core.Deprecated('Use authenticateRequestDescriptor instead') 17 | const AuthenticateRequest$json = { 18 | '1': 'AuthenticateRequest', 19 | '2': [ 20 | {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, 21 | ], 22 | }; 23 | 24 | /// Descriptor for `AuthenticateRequest`. Decode as a `google.protobuf.DescriptorProto`. 25 | final $typed_data.Uint8List authenticateRequestDescriptor = $convert 26 | .base64Decode('ChNBdXRoZW50aWNhdGVSZXF1ZXN0Eg4KAmlkGAEgASgJUgJpZA=='); 27 | 28 | @$core.Deprecated('Use authenticateResponseDescriptor instead') 29 | const AuthenticateResponse$json = { 30 | '1': 'AuthenticateResponse', 31 | '2': [ 32 | {'1': 'token', '3': 1, '4': 1, '5': 9, '10': 'token'}, 33 | ], 34 | }; 35 | 36 | /// Descriptor for `AuthenticateResponse`. Decode as a `google.protobuf.DescriptorProto`. 37 | final $typed_data.Uint8List authenticateResponseDescriptor = 38 | $convert.base64Decode( 39 | 'ChRBdXRoZW50aWNhdGVSZXNwb25zZRIUCgV0b2tlbhgBIAEoCVIFdG9rZW4='); 40 | 41 | @$core.Deprecated('Use listMyVotesRequestDescriptor instead') 42 | const ListMyVotesRequest$json = { 43 | '1': 'ListMyVotesRequest', 44 | '2': [ 45 | {'1': 'snap_id_filter', '3': 1, '4': 1, '5': 9, '10': 'snapIdFilter'}, 46 | ], 47 | }; 48 | 49 | /// Descriptor for `ListMyVotesRequest`. Decode as a `google.protobuf.DescriptorProto`. 50 | final $typed_data.Uint8List listMyVotesRequestDescriptor = $convert.base64Decode( 51 | 'ChJMaXN0TXlWb3Rlc1JlcXVlc3QSJAoOc25hcF9pZF9maWx0ZXIYASABKAlSDHNuYXBJZEZpbH' 52 | 'Rlcg=='); 53 | 54 | @$core.Deprecated('Use listMyVotesResponseDescriptor instead') 55 | const ListMyVotesResponse$json = { 56 | '1': 'ListMyVotesResponse', 57 | '2': [ 58 | { 59 | '1': 'votes', 60 | '3': 1, 61 | '4': 3, 62 | '5': 11, 63 | '6': '.ratings.features.user.Vote', 64 | '10': 'votes' 65 | }, 66 | ], 67 | }; 68 | 69 | /// Descriptor for `ListMyVotesResponse`. Decode as a `google.protobuf.DescriptorProto`. 70 | final $typed_data.Uint8List listMyVotesResponseDescriptor = $convert.base64Decode( 71 | 'ChNMaXN0TXlWb3Rlc1Jlc3BvbnNlEjEKBXZvdGVzGAEgAygLMhsucmF0aW5ncy5mZWF0dXJlcy' 72 | '51c2VyLlZvdGVSBXZvdGVz'); 73 | 74 | @$core.Deprecated('Use getSnapVotesRequestDescriptor instead') 75 | const GetSnapVotesRequest$json = { 76 | '1': 'GetSnapVotesRequest', 77 | '2': [ 78 | {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, 79 | ], 80 | }; 81 | 82 | /// Descriptor for `GetSnapVotesRequest`. Decode as a `google.protobuf.DescriptorProto`. 83 | final $typed_data.Uint8List getSnapVotesRequestDescriptor = 84 | $convert.base64Decode( 85 | 'ChNHZXRTbmFwVm90ZXNSZXF1ZXN0EhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZA=='); 86 | 87 | @$core.Deprecated('Use getSnapVotesResponseDescriptor instead') 88 | const GetSnapVotesResponse$json = { 89 | '1': 'GetSnapVotesResponse', 90 | '2': [ 91 | { 92 | '1': 'votes', 93 | '3': 1, 94 | '4': 3, 95 | '5': 11, 96 | '6': '.ratings.features.user.Vote', 97 | '10': 'votes' 98 | }, 99 | ], 100 | }; 101 | 102 | /// Descriptor for `GetSnapVotesResponse`. Decode as a `google.protobuf.DescriptorProto`. 103 | final $typed_data.Uint8List getSnapVotesResponseDescriptor = $convert.base64Decode( 104 | 'ChRHZXRTbmFwVm90ZXNSZXNwb25zZRIxCgV2b3RlcxgBIAMoCzIbLnJhdGluZ3MuZmVhdHVyZX' 105 | 'MudXNlci5Wb3RlUgV2b3Rlcw=='); 106 | 107 | @$core.Deprecated('Use voteDescriptor instead') 108 | const Vote$json = { 109 | '1': 'Vote', 110 | '2': [ 111 | {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, 112 | {'1': 'snap_revision', '3': 2, '4': 1, '5': 5, '10': 'snapRevision'}, 113 | {'1': 'vote_up', '3': 3, '4': 1, '5': 8, '10': 'voteUp'}, 114 | { 115 | '1': 'timestamp', 116 | '3': 4, 117 | '4': 1, 118 | '5': 11, 119 | '6': '.google.protobuf.Timestamp', 120 | '10': 'timestamp' 121 | }, 122 | ], 123 | }; 124 | 125 | /// Descriptor for `Vote`. Decode as a `google.protobuf.DescriptorProto`. 126 | final $typed_data.Uint8List voteDescriptor = $convert.base64Decode( 127 | 'CgRWb3RlEhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZBIjCg1zbmFwX3JldmlzaW9uGAIgASgFUg' 128 | 'xzbmFwUmV2aXNpb24SFwoHdm90ZV91cBgDIAEoCFIGdm90ZVVwEjgKCXRpbWVzdGFtcBgEIAEo' 129 | 'CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCXRpbWVzdGFtcA=='); 130 | 131 | @$core.Deprecated('Use voteRequestDescriptor instead') 132 | const VoteRequest$json = { 133 | '1': 'VoteRequest', 134 | '2': [ 135 | {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, 136 | {'1': 'snap_revision', '3': 2, '4': 1, '5': 5, '10': 'snapRevision'}, 137 | {'1': 'vote_up', '3': 3, '4': 1, '5': 8, '10': 'voteUp'}, 138 | ], 139 | }; 140 | 141 | /// Descriptor for `VoteRequest`. Decode as a `google.protobuf.DescriptorProto`. 142 | final $typed_data.Uint8List voteRequestDescriptor = $convert.base64Decode( 143 | 'CgtWb3RlUmVxdWVzdBIXCgdzbmFwX2lkGAEgASgJUgZzbmFwSWQSIwoNc25hcF9yZXZpc2lvbh' 144 | 'gCIAEoBVIMc25hcFJldmlzaW9uEhcKB3ZvdGVfdXAYAyABKAhSBnZvdGVVcA=='); 145 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_app.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_app.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | import 'ratings_features_common.pb.dart' as $1; 17 | 18 | class GetRatingRequest extends $pb.GeneratedMessage { 19 | factory GetRatingRequest({ 20 | $core.String? snapId, 21 | }) { 22 | final $result = create(); 23 | if (snapId != null) { 24 | $result.snapId = snapId; 25 | } 26 | return $result; 27 | } 28 | GetRatingRequest._() : super(); 29 | factory GetRatingRequest.fromBuffer($core.List<$core.int> i, 30 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 31 | create()..mergeFromBuffer(i, r); 32 | factory GetRatingRequest.fromJson($core.String i, 33 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 34 | create()..mergeFromJson(i, r); 35 | 36 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 37 | _omitMessageNames ? '' : 'GetRatingRequest', 38 | package: const $pb.PackageName( 39 | _omitMessageNames ? '' : 'ratings.features.app'), 40 | createEmptyInstance: create) 41 | ..aOS(1, _omitFieldNames ? '' : 'snapId') 42 | ..hasRequiredFields = false; 43 | 44 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 45 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 46 | 'Will be removed in next major version') 47 | GetRatingRequest clone() => GetRatingRequest()..mergeFromMessage(this); 48 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 49 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 50 | 'Will be removed in next major version') 51 | GetRatingRequest copyWith(void Function(GetRatingRequest) updates) => 52 | super.copyWith((message) => updates(message as GetRatingRequest)) 53 | as GetRatingRequest; 54 | 55 | $pb.BuilderInfo get info_ => _i; 56 | 57 | @$core.pragma('dart2js:noInline') 58 | static GetRatingRequest create() => GetRatingRequest._(); 59 | GetRatingRequest createEmptyInstance() => create(); 60 | static $pb.PbList createRepeated() => 61 | $pb.PbList(); 62 | @$core.pragma('dart2js:noInline') 63 | static GetRatingRequest getDefault() => _defaultInstance ??= 64 | $pb.GeneratedMessage.$_defaultFor(create); 65 | static GetRatingRequest? _defaultInstance; 66 | 67 | @$pb.TagNumber(1) 68 | $core.String get snapId => $_getSZ(0); 69 | @$pb.TagNumber(1) 70 | set snapId($core.String v) { 71 | $_setString(0, v); 72 | } 73 | 74 | @$pb.TagNumber(1) 75 | $core.bool hasSnapId() => $_has(0); 76 | @$pb.TagNumber(1) 77 | void clearSnapId() => clearField(1); 78 | } 79 | 80 | class GetRatingResponse extends $pb.GeneratedMessage { 81 | factory GetRatingResponse({ 82 | $1.Rating? rating, 83 | }) { 84 | final $result = create(); 85 | if (rating != null) { 86 | $result.rating = rating; 87 | } 88 | return $result; 89 | } 90 | GetRatingResponse._() : super(); 91 | factory GetRatingResponse.fromBuffer($core.List<$core.int> i, 92 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 93 | create()..mergeFromBuffer(i, r); 94 | factory GetRatingResponse.fromJson($core.String i, 95 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 96 | create()..mergeFromJson(i, r); 97 | 98 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 99 | _omitMessageNames ? '' : 'GetRatingResponse', 100 | package: const $pb.PackageName( 101 | _omitMessageNames ? '' : 'ratings.features.app'), 102 | createEmptyInstance: create) 103 | ..aOM<$1.Rating>(1, _omitFieldNames ? '' : 'rating', 104 | subBuilder: $1.Rating.create) 105 | ..hasRequiredFields = false; 106 | 107 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 108 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 109 | 'Will be removed in next major version') 110 | GetRatingResponse clone() => GetRatingResponse()..mergeFromMessage(this); 111 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 112 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 113 | 'Will be removed in next major version') 114 | GetRatingResponse copyWith(void Function(GetRatingResponse) updates) => 115 | super.copyWith((message) => updates(message as GetRatingResponse)) 116 | as GetRatingResponse; 117 | 118 | $pb.BuilderInfo get info_ => _i; 119 | 120 | @$core.pragma('dart2js:noInline') 121 | static GetRatingResponse create() => GetRatingResponse._(); 122 | GetRatingResponse createEmptyInstance() => create(); 123 | static $pb.PbList createRepeated() => 124 | $pb.PbList(); 125 | @$core.pragma('dart2js:noInline') 126 | static GetRatingResponse getDefault() => _defaultInstance ??= 127 | $pb.GeneratedMessage.$_defaultFor(create); 128 | static GetRatingResponse? _defaultInstance; 129 | 130 | @$pb.TagNumber(1) 131 | $1.Rating get rating => $_getN(0); 132 | @$pb.TagNumber(1) 133 | set rating($1.Rating v) { 134 | setField(1, v); 135 | } 136 | 137 | @$pb.TagNumber(1) 138 | $core.bool hasRating() => $_has(0); 139 | @$pb.TagNumber(1) 140 | void clearRating() => clearField(1); 141 | @$pb.TagNumber(1) 142 | $1.Rating ensureRating() => $_ensure(0); 143 | } 144 | 145 | const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); 146 | const _omitMessageNames = 147 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 148 | -------------------------------------------------------------------------------- /lib/src/user.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark 5 | 6 | part of 'user.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$Vote { 19 | String get snapId => throw _privateConstructorUsedError; 20 | int get snapRevision => throw _privateConstructorUsedError; 21 | bool get voteUp => throw _privateConstructorUsedError; 22 | DateTime get dateTime => throw _privateConstructorUsedError; 23 | 24 | @JsonKey(ignore: true) 25 | $VoteCopyWith get copyWith => throw _privateConstructorUsedError; 26 | } 27 | 28 | /// @nodoc 29 | abstract class $VoteCopyWith<$Res> { 30 | factory $VoteCopyWith(Vote value, $Res Function(Vote) then) = 31 | _$VoteCopyWithImpl<$Res, Vote>; 32 | @useResult 33 | $Res call({String snapId, int snapRevision, bool voteUp, DateTime dateTime}); 34 | } 35 | 36 | /// @nodoc 37 | class _$VoteCopyWithImpl<$Res, $Val extends Vote> 38 | implements $VoteCopyWith<$Res> { 39 | _$VoteCopyWithImpl(this._value, this._then); 40 | 41 | // ignore: unused_field 42 | final $Val _value; 43 | // ignore: unused_field 44 | final $Res Function($Val) _then; 45 | 46 | @pragma('vm:prefer-inline') 47 | @override 48 | $Res call({ 49 | Object? snapId = null, 50 | Object? snapRevision = null, 51 | Object? voteUp = null, 52 | Object? dateTime = null, 53 | }) { 54 | return _then(_value.copyWith( 55 | snapId: null == snapId 56 | ? _value.snapId 57 | : snapId // ignore: cast_nullable_to_non_nullable 58 | as String, 59 | snapRevision: null == snapRevision 60 | ? _value.snapRevision 61 | : snapRevision // ignore: cast_nullable_to_non_nullable 62 | as int, 63 | voteUp: null == voteUp 64 | ? _value.voteUp 65 | : voteUp // ignore: cast_nullable_to_non_nullable 66 | as bool, 67 | dateTime: null == dateTime 68 | ? _value.dateTime 69 | : dateTime // ignore: cast_nullable_to_non_nullable 70 | as DateTime, 71 | ) as $Val); 72 | } 73 | } 74 | 75 | /// @nodoc 76 | abstract class _$$VoteImplCopyWith<$Res> implements $VoteCopyWith<$Res> { 77 | factory _$$VoteImplCopyWith( 78 | _$VoteImpl value, $Res Function(_$VoteImpl) then) = 79 | __$$VoteImplCopyWithImpl<$Res>; 80 | @override 81 | @useResult 82 | $Res call({String snapId, int snapRevision, bool voteUp, DateTime dateTime}); 83 | } 84 | 85 | /// @nodoc 86 | class __$$VoteImplCopyWithImpl<$Res> 87 | extends _$VoteCopyWithImpl<$Res, _$VoteImpl> 88 | implements _$$VoteImplCopyWith<$Res> { 89 | __$$VoteImplCopyWithImpl(_$VoteImpl _value, $Res Function(_$VoteImpl) _then) 90 | : super(_value, _then); 91 | 92 | @pragma('vm:prefer-inline') 93 | @override 94 | $Res call({ 95 | Object? snapId = null, 96 | Object? snapRevision = null, 97 | Object? voteUp = null, 98 | Object? dateTime = null, 99 | }) { 100 | return _then(_$VoteImpl( 101 | snapId: null == snapId 102 | ? _value.snapId 103 | : snapId // ignore: cast_nullable_to_non_nullable 104 | as String, 105 | snapRevision: null == snapRevision 106 | ? _value.snapRevision 107 | : snapRevision // ignore: cast_nullable_to_non_nullable 108 | as int, 109 | voteUp: null == voteUp 110 | ? _value.voteUp 111 | : voteUp // ignore: cast_nullable_to_non_nullable 112 | as bool, 113 | dateTime: null == dateTime 114 | ? _value.dateTime 115 | : dateTime // ignore: cast_nullable_to_non_nullable 116 | as DateTime, 117 | )); 118 | } 119 | } 120 | 121 | /// @nodoc 122 | 123 | class _$VoteImpl implements _Vote { 124 | const _$VoteImpl( 125 | {required this.snapId, 126 | required this.snapRevision, 127 | required this.voteUp, 128 | required this.dateTime}); 129 | 130 | @override 131 | final String snapId; 132 | @override 133 | final int snapRevision; 134 | @override 135 | final bool voteUp; 136 | @override 137 | final DateTime dateTime; 138 | 139 | @override 140 | String toString() { 141 | return 'Vote(snapId: $snapId, snapRevision: $snapRevision, voteUp: $voteUp, dateTime: $dateTime)'; 142 | } 143 | 144 | @override 145 | bool operator ==(dynamic other) { 146 | return identical(this, other) || 147 | (other.runtimeType == runtimeType && 148 | other is _$VoteImpl && 149 | (identical(other.snapId, snapId) || other.snapId == snapId) && 150 | (identical(other.snapRevision, snapRevision) || 151 | other.snapRevision == snapRevision) && 152 | (identical(other.voteUp, voteUp) || other.voteUp == voteUp) && 153 | (identical(other.dateTime, dateTime) || 154 | other.dateTime == dateTime)); 155 | } 156 | 157 | @override 158 | int get hashCode => 159 | Object.hash(runtimeType, snapId, snapRevision, voteUp, dateTime); 160 | 161 | @JsonKey(ignore: true) 162 | @override 163 | @pragma('vm:prefer-inline') 164 | _$$VoteImplCopyWith<_$VoteImpl> get copyWith => 165 | __$$VoteImplCopyWithImpl<_$VoteImpl>(this, _$identity); 166 | } 167 | 168 | abstract class _Vote implements Vote { 169 | const factory _Vote( 170 | {required final String snapId, 171 | required final int snapRevision, 172 | required final bool voteUp, 173 | required final DateTime dateTime}) = _$VoteImpl; 174 | 175 | @override 176 | String get snapId; 177 | @override 178 | int get snapRevision; 179 | @override 180 | bool get voteUp; 181 | @override 182 | DateTime get dateTime; 183 | @override 184 | @JsonKey(ignore: true) 185 | _$$VoteImplCopyWith<_$VoteImpl> get copyWith => 186 | throw _privateConstructorUsedError; 187 | } 188 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_user.pbgrpc.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_user.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:async' as $async; 13 | import 'dart:core' as $core; 14 | 15 | import 'package:grpc/service_api.dart' as $grpc; 16 | import 'package:protobuf/protobuf.dart' as $pb; 17 | 18 | import 'google/protobuf/empty.pb.dart' as $1; 19 | import 'ratings_features_user.pb.dart' as $0; 20 | 21 | export 'ratings_features_user.pb.dart'; 22 | 23 | @$pb.GrpcServiceName('ratings.features.user.User') 24 | class UserClient extends $grpc.Client { 25 | static final _$authenticate = 26 | $grpc.ClientMethod<$0.AuthenticateRequest, $0.AuthenticateResponse>( 27 | '/ratings.features.user.User/Authenticate', 28 | ($0.AuthenticateRequest value) => value.writeToBuffer(), 29 | ($core.List<$core.int> value) => 30 | $0.AuthenticateResponse.fromBuffer(value)); 31 | static final _$delete = $grpc.ClientMethod<$1.Empty, $1.Empty>( 32 | '/ratings.features.user.User/Delete', 33 | ($1.Empty value) => value.writeToBuffer(), 34 | ($core.List<$core.int> value) => $1.Empty.fromBuffer(value)); 35 | static final _$vote = $grpc.ClientMethod<$0.VoteRequest, $1.Empty>( 36 | '/ratings.features.user.User/Vote', 37 | ($0.VoteRequest value) => value.writeToBuffer(), 38 | ($core.List<$core.int> value) => $1.Empty.fromBuffer(value)); 39 | static final _$listMyVotes = 40 | $grpc.ClientMethod<$0.ListMyVotesRequest, $0.ListMyVotesResponse>( 41 | '/ratings.features.user.User/ListMyVotes', 42 | ($0.ListMyVotesRequest value) => value.writeToBuffer(), 43 | ($core.List<$core.int> value) => 44 | $0.ListMyVotesResponse.fromBuffer(value)); 45 | static final _$getSnapVotes = 46 | $grpc.ClientMethod<$0.GetSnapVotesRequest, $0.GetSnapVotesResponse>( 47 | '/ratings.features.user.User/GetSnapVotes', 48 | ($0.GetSnapVotesRequest value) => value.writeToBuffer(), 49 | ($core.List<$core.int> value) => 50 | $0.GetSnapVotesResponse.fromBuffer(value)); 51 | 52 | UserClient($grpc.ClientChannel channel, 53 | {$grpc.CallOptions? options, 54 | $core.Iterable<$grpc.ClientInterceptor>? interceptors}) 55 | : super(channel, options: options, interceptors: interceptors); 56 | 57 | $grpc.ResponseFuture<$0.AuthenticateResponse> authenticate( 58 | $0.AuthenticateRequest request, 59 | {$grpc.CallOptions? options}) { 60 | return $createUnaryCall(_$authenticate, request, options: options); 61 | } 62 | 63 | $grpc.ResponseFuture<$1.Empty> delete($1.Empty request, 64 | {$grpc.CallOptions? options}) { 65 | return $createUnaryCall(_$delete, request, options: options); 66 | } 67 | 68 | $grpc.ResponseFuture<$1.Empty> vote($0.VoteRequest request, 69 | {$grpc.CallOptions? options}) { 70 | return $createUnaryCall(_$vote, request, options: options); 71 | } 72 | 73 | $grpc.ResponseFuture<$0.ListMyVotesResponse> listMyVotes( 74 | $0.ListMyVotesRequest request, 75 | {$grpc.CallOptions? options}) { 76 | return $createUnaryCall(_$listMyVotes, request, options: options); 77 | } 78 | 79 | $grpc.ResponseFuture<$0.GetSnapVotesResponse> getSnapVotes( 80 | $0.GetSnapVotesRequest request, 81 | {$grpc.CallOptions? options}) { 82 | return $createUnaryCall(_$getSnapVotes, request, options: options); 83 | } 84 | } 85 | 86 | @$pb.GrpcServiceName('ratings.features.user.User') 87 | abstract class UserServiceBase extends $grpc.Service { 88 | $core.String get $name => 'ratings.features.user.User'; 89 | 90 | UserServiceBase() { 91 | $addMethod( 92 | $grpc.ServiceMethod<$0.AuthenticateRequest, $0.AuthenticateResponse>( 93 | 'Authenticate', 94 | authenticate_Pre, 95 | false, 96 | false, 97 | ($core.List<$core.int> value) => 98 | $0.AuthenticateRequest.fromBuffer(value), 99 | ($0.AuthenticateResponse value) => value.writeToBuffer())); 100 | $addMethod($grpc.ServiceMethod<$1.Empty, $1.Empty>( 101 | 'Delete', 102 | delete_Pre, 103 | false, 104 | false, 105 | ($core.List<$core.int> value) => $1.Empty.fromBuffer(value), 106 | ($1.Empty value) => value.writeToBuffer())); 107 | $addMethod($grpc.ServiceMethod<$0.VoteRequest, $1.Empty>( 108 | 'Vote', 109 | vote_Pre, 110 | false, 111 | false, 112 | ($core.List<$core.int> value) => $0.VoteRequest.fromBuffer(value), 113 | ($1.Empty value) => value.writeToBuffer())); 114 | $addMethod( 115 | $grpc.ServiceMethod<$0.ListMyVotesRequest, $0.ListMyVotesResponse>( 116 | 'ListMyVotes', 117 | listMyVotes_Pre, 118 | false, 119 | false, 120 | ($core.List<$core.int> value) => 121 | $0.ListMyVotesRequest.fromBuffer(value), 122 | ($0.ListMyVotesResponse value) => value.writeToBuffer())); 123 | $addMethod( 124 | $grpc.ServiceMethod<$0.GetSnapVotesRequest, $0.GetSnapVotesResponse>( 125 | 'GetSnapVotes', 126 | getSnapVotes_Pre, 127 | false, 128 | false, 129 | ($core.List<$core.int> value) => 130 | $0.GetSnapVotesRequest.fromBuffer(value), 131 | ($0.GetSnapVotesResponse value) => value.writeToBuffer())); 132 | } 133 | 134 | $async.Future<$0.AuthenticateResponse> authenticate_Pre( 135 | $grpc.ServiceCall call, 136 | $async.Future<$0.AuthenticateRequest> request) async { 137 | return authenticate(call, await request); 138 | } 139 | 140 | $async.Future<$1.Empty> delete_Pre( 141 | $grpc.ServiceCall call, $async.Future<$1.Empty> request) async { 142 | return delete(call, await request); 143 | } 144 | 145 | $async.Future<$1.Empty> vote_Pre( 146 | $grpc.ServiceCall call, $async.Future<$0.VoteRequest> request) async { 147 | return vote(call, await request); 148 | } 149 | 150 | $async.Future<$0.ListMyVotesResponse> listMyVotes_Pre($grpc.ServiceCall call, 151 | $async.Future<$0.ListMyVotesRequest> request) async { 152 | return listMyVotes(call, await request); 153 | } 154 | 155 | $async.Future<$0.GetSnapVotesResponse> getSnapVotes_Pre( 156 | $grpc.ServiceCall call, 157 | $async.Future<$0.GetSnapVotesRequest> request) async { 158 | return getSnapVotes(call, await request); 159 | } 160 | 161 | $async.Future<$0.AuthenticateResponse> authenticate( 162 | $grpc.ServiceCall call, $0.AuthenticateRequest request); 163 | $async.Future<$1.Empty> delete($grpc.ServiceCall call, $1.Empty request); 164 | $async.Future<$1.Empty> vote($grpc.ServiceCall call, $0.VoteRequest request); 165 | $async.Future<$0.ListMyVotesResponse> listMyVotes( 166 | $grpc.ServiceCall call, $0.ListMyVotesRequest request); 167 | $async.Future<$0.GetSnapVotesResponse> getSnapVotes( 168 | $grpc.ServiceCall call, $0.GetSnapVotesRequest request); 169 | } 170 | -------------------------------------------------------------------------------- /lib/src/generated/google/protobuf/timestamp.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/timestamp.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:fixnum/fixnum.dart' as $fixnum; 15 | import 'package:protobuf/protobuf.dart' as $pb; 16 | import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; 17 | 18 | /// A Timestamp represents a point in time independent of any time zone or local 19 | /// calendar, encoded as a count of seconds and fractions of seconds at 20 | /// nanosecond resolution. The count is relative to an epoch at UTC midnight on 21 | /// January 1, 1970, in the proleptic Gregorian calendar which extends the 22 | /// Gregorian calendar backwards to year one. 23 | /// 24 | /// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap 25 | /// second table is needed for interpretation, using a [24-hour linear 26 | /// smear](https://developers.google.com/time/smear). 27 | /// 28 | /// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By 29 | /// restricting to that range, we ensure that we can convert to and from [RFC 30 | /// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. 31 | /// 32 | /// # Examples 33 | /// 34 | /// Example 1: Compute Timestamp from POSIX `time()`. 35 | /// 36 | /// Timestamp timestamp; 37 | /// timestamp.set_seconds(time(NULL)); 38 | /// timestamp.set_nanos(0); 39 | /// 40 | /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. 41 | /// 42 | /// struct timeval tv; 43 | /// gettimeofday(&tv, NULL); 44 | /// 45 | /// Timestamp timestamp; 46 | /// timestamp.set_seconds(tv.tv_sec); 47 | /// timestamp.set_nanos(tv.tv_usec * 1000); 48 | /// 49 | /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 50 | /// 51 | /// FILETIME ft; 52 | /// GetSystemTimeAsFileTime(&ft); 53 | /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 54 | /// 55 | /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 56 | /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 57 | /// Timestamp timestamp; 58 | /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 59 | /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 60 | /// 61 | /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 62 | /// 63 | /// long millis = System.currentTimeMillis(); 64 | /// 65 | /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 66 | /// .setNanos((int) ((millis % 1000) * 1000000)).build(); 67 | /// 68 | /// 69 | /// Example 5: Compute Timestamp from Java `Instant.now()`. 70 | /// 71 | /// Instant now = Instant.now(); 72 | /// 73 | /// Timestamp timestamp = 74 | /// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) 75 | /// .setNanos(now.getNano()).build(); 76 | /// 77 | /// 78 | /// Example 6: Compute Timestamp from current time in Python. 79 | /// 80 | /// timestamp = Timestamp() 81 | /// timestamp.GetCurrentTime() 82 | /// 83 | /// # JSON Mapping 84 | /// 85 | /// In JSON format, the Timestamp type is encoded as a string in the 86 | /// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the 87 | /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" 88 | /// where {year} is always expressed using four digits while {month}, {day}, 89 | /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional 90 | /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), 91 | /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone 92 | /// is required. A proto3 JSON serializer should always use UTC (as indicated by 93 | /// "Z") when printing the Timestamp type and a proto3 JSON parser should be 94 | /// able to accept both UTC and other timezones (as indicated by an offset). 95 | /// 96 | /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 97 | /// 01:30 UTC on January 15, 2017. 98 | /// 99 | /// In JavaScript, one can convert a Date object to this format using the 100 | /// standard 101 | /// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) 102 | /// method. In Python, a standard `datetime.datetime` object can be converted 103 | /// to this format using 104 | /// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with 105 | /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use 106 | /// the Joda Time's [`ISODateTimeFormat.dateTime()`]( 107 | /// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D 108 | /// ) to obtain a formatter capable of generating timestamps in this format. 109 | class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { 110 | factory Timestamp({ 111 | $fixnum.Int64? seconds, 112 | $core.int? nanos, 113 | }) { 114 | final $result = create(); 115 | if (seconds != null) { 116 | $result.seconds = seconds; 117 | } 118 | if (nanos != null) { 119 | $result.nanos = nanos; 120 | } 121 | return $result; 122 | } 123 | Timestamp._() : super(); 124 | factory Timestamp.fromBuffer($core.List<$core.int> i, 125 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 126 | create()..mergeFromBuffer(i, r); 127 | factory Timestamp.fromJson($core.String i, 128 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 129 | create()..mergeFromJson(i, r); 130 | 131 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 132 | _omitMessageNames ? '' : 'Timestamp', 133 | package: 134 | const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), 135 | createEmptyInstance: create, 136 | toProto3Json: $mixin.TimestampMixin.toProto3JsonHelper, 137 | fromProto3Json: $mixin.TimestampMixin.fromProto3JsonHelper) 138 | ..aInt64(1, _omitFieldNames ? '' : 'seconds') 139 | ..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3) 140 | ..hasRequiredFields = false; 141 | 142 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 143 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 144 | 'Will be removed in next major version') 145 | Timestamp clone() => Timestamp()..mergeFromMessage(this); 146 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 147 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 148 | 'Will be removed in next major version') 149 | Timestamp copyWith(void Function(Timestamp) updates) => 150 | super.copyWith((message) => updates(message as Timestamp)) as Timestamp; 151 | 152 | $pb.BuilderInfo get info_ => _i; 153 | 154 | @$core.pragma('dart2js:noInline') 155 | static Timestamp create() => Timestamp._(); 156 | Timestamp createEmptyInstance() => create(); 157 | static $pb.PbList createRepeated() => $pb.PbList(); 158 | @$core.pragma('dart2js:noInline') 159 | static Timestamp getDefault() => 160 | _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 161 | static Timestamp? _defaultInstance; 162 | 163 | /// Represents seconds of UTC time since Unix epoch 164 | /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 165 | /// 9999-12-31T23:59:59Z inclusive. 166 | @$pb.TagNumber(1) 167 | $fixnum.Int64 get seconds => $_getI64(0); 168 | @$pb.TagNumber(1) 169 | set seconds($fixnum.Int64 v) { 170 | $_setInt64(0, v); 171 | } 172 | 173 | @$pb.TagNumber(1) 174 | $core.bool hasSeconds() => $_has(0); 175 | @$pb.TagNumber(1) 176 | void clearSeconds() => clearField(1); 177 | 178 | /// Non-negative fractions of a second at nanosecond resolution. Negative 179 | /// second values with fractions must still have non-negative nanos values 180 | /// that count forward in time. Must be from 0 to 999,999,999 181 | /// inclusive. 182 | @$pb.TagNumber(2) 183 | $core.int get nanos => $_getIZ(1); 184 | @$pb.TagNumber(2) 185 | set nanos($core.int v) { 186 | $_setSignedInt32(1, v); 187 | } 188 | 189 | @$pb.TagNumber(2) 190 | $core.bool hasNanos() => $_has(1); 191 | @$pb.TagNumber(2) 192 | void clearNanos() => clearField(2); 193 | 194 | /// Creates a new instance from [dateTime]. 195 | /// 196 | /// Time zone information will not be preserved. 197 | static Timestamp fromDateTime($core.DateTime dateTime) { 198 | final result = create(); 199 | $mixin.TimestampMixin.setFromDateTime(result, dateTime); 200 | return result; 201 | } 202 | } 203 | 204 | const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); 205 | const _omitMessageNames = 206 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 207 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_chart.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_chart.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | import 'ratings_features_chart.pbenum.dart'; 17 | import 'ratings_features_common.pb.dart' as $1; 18 | 19 | export 'ratings_features_chart.pbenum.dart'; 20 | 21 | class GetChartRequest extends $pb.GeneratedMessage { 22 | factory GetChartRequest({ 23 | Timeframe? timeframe, 24 | }) { 25 | final $result = create(); 26 | if (timeframe != null) { 27 | $result.timeframe = timeframe; 28 | } 29 | return $result; 30 | } 31 | GetChartRequest._() : super(); 32 | factory GetChartRequest.fromBuffer($core.List<$core.int> i, 33 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 34 | create()..mergeFromBuffer(i, r); 35 | factory GetChartRequest.fromJson($core.String i, 36 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 37 | create()..mergeFromJson(i, r); 38 | 39 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 40 | _omitMessageNames ? '' : 'GetChartRequest', 41 | package: const $pb.PackageName( 42 | _omitMessageNames ? '' : 'ratings.features.chart'), 43 | createEmptyInstance: create) 44 | ..e(1, _omitFieldNames ? '' : 'timeframe', $pb.PbFieldType.OE, 45 | defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, 46 | valueOf: Timeframe.valueOf, 47 | enumValues: Timeframe.values) 48 | ..hasRequiredFields = false; 49 | 50 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 51 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 52 | 'Will be removed in next major version') 53 | GetChartRequest clone() => GetChartRequest()..mergeFromMessage(this); 54 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 55 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 56 | 'Will be removed in next major version') 57 | GetChartRequest copyWith(void Function(GetChartRequest) updates) => 58 | super.copyWith((message) => updates(message as GetChartRequest)) 59 | as GetChartRequest; 60 | 61 | $pb.BuilderInfo get info_ => _i; 62 | 63 | @$core.pragma('dart2js:noInline') 64 | static GetChartRequest create() => GetChartRequest._(); 65 | GetChartRequest createEmptyInstance() => create(); 66 | static $pb.PbList createRepeated() => 67 | $pb.PbList(); 68 | @$core.pragma('dart2js:noInline') 69 | static GetChartRequest getDefault() => _defaultInstance ??= 70 | $pb.GeneratedMessage.$_defaultFor(create); 71 | static GetChartRequest? _defaultInstance; 72 | 73 | @$pb.TagNumber(1) 74 | Timeframe get timeframe => $_getN(0); 75 | @$pb.TagNumber(1) 76 | set timeframe(Timeframe v) { 77 | setField(1, v); 78 | } 79 | 80 | @$pb.TagNumber(1) 81 | $core.bool hasTimeframe() => $_has(0); 82 | @$pb.TagNumber(1) 83 | void clearTimeframe() => clearField(1); 84 | } 85 | 86 | class GetChartResponse extends $pb.GeneratedMessage { 87 | factory GetChartResponse({ 88 | Timeframe? timeframe, 89 | $core.Iterable? orderedChartData, 90 | }) { 91 | final $result = create(); 92 | if (timeframe != null) { 93 | $result.timeframe = timeframe; 94 | } 95 | if (orderedChartData != null) { 96 | $result.orderedChartData.addAll(orderedChartData); 97 | } 98 | return $result; 99 | } 100 | GetChartResponse._() : super(); 101 | factory GetChartResponse.fromBuffer($core.List<$core.int> i, 102 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 103 | create()..mergeFromBuffer(i, r); 104 | factory GetChartResponse.fromJson($core.String i, 105 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 106 | create()..mergeFromJson(i, r); 107 | 108 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 109 | _omitMessageNames ? '' : 'GetChartResponse', 110 | package: const $pb.PackageName( 111 | _omitMessageNames ? '' : 'ratings.features.chart'), 112 | createEmptyInstance: create) 113 | ..e(1, _omitFieldNames ? '' : 'timeframe', $pb.PbFieldType.OE, 114 | defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, 115 | valueOf: Timeframe.valueOf, 116 | enumValues: Timeframe.values) 117 | ..pc( 118 | 2, _omitFieldNames ? '' : 'orderedChartData', $pb.PbFieldType.PM, 119 | subBuilder: ChartData.create) 120 | ..hasRequiredFields = false; 121 | 122 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 123 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 124 | 'Will be removed in next major version') 125 | GetChartResponse clone() => GetChartResponse()..mergeFromMessage(this); 126 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 127 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 128 | 'Will be removed in next major version') 129 | GetChartResponse copyWith(void Function(GetChartResponse) updates) => 130 | super.copyWith((message) => updates(message as GetChartResponse)) 131 | as GetChartResponse; 132 | 133 | $pb.BuilderInfo get info_ => _i; 134 | 135 | @$core.pragma('dart2js:noInline') 136 | static GetChartResponse create() => GetChartResponse._(); 137 | GetChartResponse createEmptyInstance() => create(); 138 | static $pb.PbList createRepeated() => 139 | $pb.PbList(); 140 | @$core.pragma('dart2js:noInline') 141 | static GetChartResponse getDefault() => _defaultInstance ??= 142 | $pb.GeneratedMessage.$_defaultFor(create); 143 | static GetChartResponse? _defaultInstance; 144 | 145 | @$pb.TagNumber(1) 146 | Timeframe get timeframe => $_getN(0); 147 | @$pb.TagNumber(1) 148 | set timeframe(Timeframe v) { 149 | setField(1, v); 150 | } 151 | 152 | @$pb.TagNumber(1) 153 | $core.bool hasTimeframe() => $_has(0); 154 | @$pb.TagNumber(1) 155 | void clearTimeframe() => clearField(1); 156 | 157 | @$pb.TagNumber(2) 158 | $core.List get orderedChartData => $_getList(1); 159 | } 160 | 161 | class ChartData extends $pb.GeneratedMessage { 162 | factory ChartData({ 163 | $core.double? rawRating, 164 | $1.Rating? rating, 165 | }) { 166 | final $result = create(); 167 | if (rawRating != null) { 168 | $result.rawRating = rawRating; 169 | } 170 | if (rating != null) { 171 | $result.rating = rating; 172 | } 173 | return $result; 174 | } 175 | ChartData._() : super(); 176 | factory ChartData.fromBuffer($core.List<$core.int> i, 177 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 178 | create()..mergeFromBuffer(i, r); 179 | factory ChartData.fromJson($core.String i, 180 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 181 | create()..mergeFromJson(i, r); 182 | 183 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 184 | _omitMessageNames ? '' : 'ChartData', 185 | package: const $pb.PackageName( 186 | _omitMessageNames ? '' : 'ratings.features.chart'), 187 | createEmptyInstance: create) 188 | ..a<$core.double>(1, _omitFieldNames ? '' : 'rawRating', $pb.PbFieldType.OF) 189 | ..aOM<$1.Rating>(2, _omitFieldNames ? '' : 'rating', 190 | subBuilder: $1.Rating.create) 191 | ..hasRequiredFields = false; 192 | 193 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 194 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 195 | 'Will be removed in next major version') 196 | ChartData clone() => ChartData()..mergeFromMessage(this); 197 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 198 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 199 | 'Will be removed in next major version') 200 | ChartData copyWith(void Function(ChartData) updates) => 201 | super.copyWith((message) => updates(message as ChartData)) as ChartData; 202 | 203 | $pb.BuilderInfo get info_ => _i; 204 | 205 | @$core.pragma('dart2js:noInline') 206 | static ChartData create() => ChartData._(); 207 | ChartData createEmptyInstance() => create(); 208 | static $pb.PbList createRepeated() => $pb.PbList(); 209 | @$core.pragma('dart2js:noInline') 210 | static ChartData getDefault() => 211 | _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 212 | static ChartData? _defaultInstance; 213 | 214 | @$pb.TagNumber(1) 215 | $core.double get rawRating => $_getN(0); 216 | @$pb.TagNumber(1) 217 | set rawRating($core.double v) { 218 | $_setFloat(0, v); 219 | } 220 | 221 | @$pb.TagNumber(1) 222 | $core.bool hasRawRating() => $_has(0); 223 | @$pb.TagNumber(1) 224 | void clearRawRating() => clearField(1); 225 | 226 | @$pb.TagNumber(2) 227 | $1.Rating get rating => $_getN(1); 228 | @$pb.TagNumber(2) 229 | set rating($1.Rating v) { 230 | setField(2, v); 231 | } 232 | 233 | @$pb.TagNumber(2) 234 | $core.bool hasRating() => $_has(1); 235 | @$pb.TagNumber(2) 236 | void clearRating() => clearField(2); 237 | @$pb.TagNumber(2) 238 | $1.Rating ensureRating() => $_ensure(1); 239 | } 240 | 241 | const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); 242 | const _omitMessageNames = 243 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 244 | -------------------------------------------------------------------------------- /test/ratings_client_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:app_center_ratings_client/app_center_ratings_client.dart'; 4 | import 'package:app_center_ratings_client/src/chart.dart' as chart; 5 | import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart'; 6 | import 'package:app_center_ratings_client/src/generated/google/protobuf/timestamp.pb.dart'; 7 | import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart' 8 | as pb; 9 | import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pbgrpc.dart'; 10 | import 'package:app_center_ratings_client/src/generated/ratings_features_common.pb.dart'; 11 | import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart'; 12 | import 'package:app_center_ratings_client/src/ratings.dart' as ratings; 13 | import 'package:app_center_ratings_client/src/user.dart' as user; 14 | import 'package:fixnum/fixnum.dart'; 15 | import 'package:grpc/grpc.dart'; 16 | import 'package:mockito/annotations.dart'; 17 | import 'package:mockito/mockito.dart'; 18 | import 'package:test/test.dart'; 19 | 20 | import 'ratings_client_test.mocks.dart'; 21 | 22 | @GenerateMocks([pb.AppClient, UserClient, ChartClient]) 23 | void main() { 24 | final mockAppClient = MockAppClient(); 25 | final mockUserClient = MockUserClient(); 26 | final mockChartClient = MockChartClient(); 27 | final ratingsClient = 28 | RatingsClient.withClients(mockAppClient, mockUserClient, mockChartClient); 29 | 30 | test('get chart', () async { 31 | final snapId = 'foobar'; 32 | final token = 'bar'; 33 | final timeframe = chart.Timeframe.month; 34 | final pbChartList = [ 35 | ChartData( 36 | rawRating: 3, 37 | rating: Rating( 38 | snapId: snapId, 39 | totalVotes: Int64(105), 40 | ratingsBand: RatingsBand.NEUTRAL, 41 | )) 42 | ]; 43 | 44 | final expectedResponse = [ 45 | chart.ChartData( 46 | rawRating: 3, 47 | rating: ratings.Rating( 48 | snapId: snapId, 49 | totalVotes: 105, 50 | ratingsBand: ratings.RatingsBand.neutral, 51 | )) 52 | ]; 53 | final mockResponse = GetChartResponse( 54 | timeframe: Timeframe.TIMEFRAME_MONTH, 55 | orderedChartData: pbChartList, 56 | ); 57 | final request = GetChartRequest(timeframe: Timeframe.TIMEFRAME_MONTH); 58 | when(mockChartClient.getChart( 59 | request, 60 | options: anyNamed('options'), 61 | )).thenAnswer((_) => MockResponseFuture(mockResponse)); 62 | final response = await ratingsClient.getChart(timeframe, token); 63 | expect( 64 | response, 65 | equals(expectedResponse), 66 | ); 67 | final capturedArgs = verify(mockChartClient.getChart( 68 | request, 69 | options: captureAnyNamed('options'), 70 | )).captured; 71 | final capturedOptions = capturedArgs.single as CallOptions; 72 | expect( 73 | capturedOptions.metadata, 74 | containsPair( 75 | 'authorization', 76 | 'Bearer $token', 77 | ), 78 | ); 79 | }); 80 | 81 | test('get rating', () async { 82 | final snapId = 'foo'; 83 | final token = 'bar'; 84 | final pbRating = Rating( 85 | snapId: snapId, 86 | totalVotes: Int64(105), 87 | ratingsBand: RatingsBand.NEUTRAL, 88 | ); 89 | final expectedResponse = ratings.Rating( 90 | snapId: snapId, 91 | totalVotes: 105, 92 | ratingsBand: ratings.RatingsBand.neutral, 93 | ); 94 | final mockResponse = pb.GetRatingResponse(rating: pbRating); 95 | final request = pb.GetRatingRequest(snapId: snapId); 96 | when(mockAppClient.getRating( 97 | request, 98 | options: anyNamed('options'), 99 | )).thenAnswer( 100 | (_) => MockResponseFuture(mockResponse)); 101 | final response = await ratingsClient.getRating( 102 | snapId, 103 | token, 104 | ); 105 | expect( 106 | response, 107 | equals(expectedResponse), 108 | ); 109 | final capturedArgs = verify(mockAppClient.getRating( 110 | request, 111 | options: captureAnyNamed('options'), 112 | )).captured; 113 | final capturedOptions = capturedArgs.single as CallOptions; 114 | expect( 115 | capturedOptions.metadata, 116 | containsPair( 117 | 'authorization', 118 | 'Bearer $token', 119 | ), 120 | ); 121 | }); 122 | 123 | test('authenticate user', () async { 124 | final id = 'foo'; 125 | final token = 'bar'; 126 | final mockResponse = AuthenticateResponse(token: token); 127 | final request = AuthenticateRequest(id: id); 128 | when(mockUserClient.authenticate(request)).thenAnswer( 129 | (_) => MockResponseFuture(mockResponse)); 130 | final response = await ratingsClient.authenticate(id); 131 | verify(mockUserClient.authenticate(request)).captured; 132 | expect( 133 | response, 134 | equals(token), 135 | ); 136 | }); 137 | 138 | test('list user votes', () async { 139 | final snapIdFilter = 'foo'; 140 | final token = 'bar'; 141 | final time = DateTime.now().toUtc(); 142 | final mockVotes = [ 143 | Vote( 144 | snapId: 'foo1', 145 | snapRevision: 1, 146 | voteUp: true, 147 | timestamp: Timestamp.fromDateTime(time)), 148 | Vote( 149 | snapId: 'foo2', 150 | snapRevision: 2, 151 | voteUp: false, 152 | timestamp: Timestamp.fromDateTime(time)), 153 | ]; 154 | final expectedResponse = [ 155 | user.Vote( 156 | snapId: 'foo1', 157 | snapRevision: 1, 158 | voteUp: true, 159 | dateTime: time, 160 | ), 161 | user.Vote( 162 | snapId: 'foo2', 163 | snapRevision: 2, 164 | voteUp: false, 165 | dateTime: time, 166 | ), 167 | ]; 168 | final mockResponse = ListMyVotesResponse(votes: mockVotes); 169 | final request = ListMyVotesRequest(snapIdFilter: snapIdFilter); 170 | 171 | when(mockUserClient.listMyVotes( 172 | request, 173 | options: anyNamed('options'), 174 | )).thenAnswer((_) => MockResponseFuture(mockResponse)); 175 | final response = await ratingsClient.listMyVotes( 176 | snapIdFilter, 177 | token, 178 | ); 179 | expect(response, equals(expectedResponse)); 180 | 181 | final capturedArgs = verify(mockUserClient.listMyVotes(request, 182 | options: captureAnyNamed('options'))) 183 | .captured; 184 | final capturedOptions = capturedArgs.single as CallOptions; 185 | expect( 186 | capturedOptions.metadata, 187 | containsPair( 188 | 'authorization', 189 | 'Bearer $token', 190 | ), 191 | ); 192 | }); 193 | 194 | test('user votes', () async { 195 | final snapId = 'foo'; 196 | final snapRevision = 1; 197 | final voteUp = true; 198 | final token = 'bar'; 199 | final request = VoteRequest( 200 | snapId: snapId, 201 | snapRevision: snapRevision, 202 | voteUp: voteUp, 203 | ); 204 | 205 | when(mockUserClient.vote( 206 | request, 207 | options: anyNamed('options'), 208 | )).thenAnswer((_) => MockResponseFuture(Empty())); 209 | await ratingsClient.vote( 210 | snapId, 211 | snapRevision, 212 | voteUp, 213 | token, 214 | ); 215 | final capturedArgs = verify(mockUserClient.vote( 216 | request, 217 | options: captureAnyNamed('options'), 218 | )).captured; 219 | final capturedOptions = capturedArgs.single as CallOptions; 220 | expect( 221 | capturedOptions.metadata, 222 | containsPair( 223 | 'authorization', 224 | 'Bearer $token', 225 | )); 226 | }); 227 | 228 | test('user votes by snap id', () async { 229 | final snapId = 'foo'; 230 | final token = 'bar'; 231 | final time = DateTime.now().toUtc(); 232 | final mockVotes = [ 233 | Vote( 234 | snapId: snapId, 235 | snapRevision: 1, 236 | voteUp: true, 237 | timestamp: Timestamp.fromDateTime(time)), 238 | Vote( 239 | snapId: snapId, 240 | snapRevision: 2, 241 | voteUp: false, 242 | timestamp: Timestamp.fromDateTime(time)), 243 | ]; 244 | final expectedResponse = [ 245 | user.Vote( 246 | snapId: snapId, 247 | snapRevision: 1, 248 | voteUp: true, 249 | dateTime: time, 250 | ), 251 | user.Vote( 252 | snapId: snapId, 253 | snapRevision: 2, 254 | voteUp: false, 255 | dateTime: time, 256 | ), 257 | ]; 258 | final mockResponse = GetSnapVotesResponse(votes: mockVotes); 259 | final request = GetSnapVotesRequest(snapId: snapId); 260 | 261 | when(mockUserClient.getSnapVotes( 262 | request, 263 | options: anyNamed('options'), 264 | )).thenAnswer( 265 | (_) => MockResponseFuture(mockResponse)); 266 | final response = await ratingsClient.getSnapVotes( 267 | snapId, 268 | token, 269 | ); 270 | expect(response, equals(expectedResponse)); 271 | 272 | final capturedArgs = verify(mockUserClient.getSnapVotes(request, 273 | options: captureAnyNamed('options'))) 274 | .captured; 275 | final capturedOptions = capturedArgs.single as CallOptions; 276 | expect( 277 | capturedOptions.metadata, 278 | containsPair( 279 | 'authorization', 280 | 'Bearer $token', 281 | ), 282 | ); 283 | }); 284 | 285 | test('delete user', () async { 286 | final token = 'bar'; 287 | final request = Empty(); 288 | 289 | when(mockUserClient.delete( 290 | request, 291 | options: anyNamed('options'), 292 | )).thenAnswer((_) => MockResponseFuture(Empty())); 293 | await ratingsClient.delete(token); 294 | 295 | final capturedArgs = verify( 296 | mockUserClient.delete(request, options: captureAnyNamed('options'))) 297 | .captured; 298 | final capturedOptions = capturedArgs.single as CallOptions; 299 | expect( 300 | capturedOptions.metadata, 301 | containsPair( 302 | 'authorization', 303 | 'Bearer $token', 304 | ), 305 | ); 306 | }); 307 | } 308 | 309 | class MockResponseFuture extends Mock implements ResponseFuture { 310 | final T value; 311 | 312 | MockResponseFuture(this.value); 313 | 314 | @override 315 | Future then(FutureOr Function(T) onValue, {Function? onError}) => 316 | Future.value(value).then( 317 | onValue, 318 | onError: onError, 319 | ); 320 | } 321 | -------------------------------------------------------------------------------- /test/ratings_client_test.mocks.dart: -------------------------------------------------------------------------------- 1 | // Mocks generated by Mockito 5.4.2 from annotations 2 | // in app_center_ratings_client/test/ratings_client_test.dart. 3 | // Do not manually edit this file. 4 | 5 | // ignore_for_file: no_leading_underscores_for_library_prefixes 6 | import 'dart:async' as _i6; 7 | 8 | import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart' 9 | as _i9; 10 | import 'package:app_center_ratings_client/src/generated/ratings_features_app.pb.dart' 11 | as _i5; 12 | import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart' 13 | as _i4; 14 | import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pb.dart' 15 | as _i11; 16 | import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pbgrpc.dart' 17 | as _i10; 18 | import 'package:app_center_ratings_client/src/generated/ratings_features_user.pb.dart' 19 | as _i8; 20 | import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart' 21 | as _i7; 22 | import 'package:grpc/service_api.dart' as _i2; 23 | import 'package:grpc/src/client/call.dart' as _i3; 24 | import 'package:mockito/mockito.dart' as _i1; 25 | 26 | // ignore_for_file: type=lint 27 | // ignore_for_file: avoid_redundant_argument_values 28 | // ignore_for_file: avoid_setters_without_getters 29 | // ignore_for_file: comment_references 30 | // ignore_for_file: implementation_imports 31 | // ignore_for_file: invalid_use_of_visible_for_testing_member 32 | // ignore_for_file: prefer_const_constructors 33 | // ignore_for_file: unnecessary_parenthesis 34 | // ignore_for_file: camel_case_types 35 | // ignore_for_file: subtype_of_sealed_class 36 | 37 | class _FakeResponseFuture_0 extends _i1.SmartFake 38 | implements _i2.ResponseFuture { 39 | _FakeResponseFuture_0( 40 | Object parent, 41 | Invocation parentInvocation, 42 | ) : super( 43 | parent, 44 | parentInvocation, 45 | ); 46 | } 47 | 48 | class _FakeClientCall_1 extends _i1.SmartFake 49 | implements _i3.ClientCall { 50 | _FakeClientCall_1( 51 | Object parent, 52 | Invocation parentInvocation, 53 | ) : super( 54 | parent, 55 | parentInvocation, 56 | ); 57 | } 58 | 59 | class _FakeResponseStream_2 extends _i1.SmartFake 60 | implements _i2.ResponseStream { 61 | _FakeResponseStream_2( 62 | Object parent, 63 | Invocation parentInvocation, 64 | ) : super( 65 | parent, 66 | parentInvocation, 67 | ); 68 | } 69 | 70 | /// A class which mocks [AppClient]. 71 | /// 72 | /// See the documentation for Mockito's code generation for more information. 73 | class MockAppClient extends _i1.Mock implements _i4.AppClient { 74 | MockAppClient() { 75 | _i1.throwOnMissingStub(this); 76 | } 77 | 78 | @override 79 | _i2.ResponseFuture<_i5.GetRatingResponse> getRating( 80 | _i5.GetRatingRequest? request, { 81 | _i2.CallOptions? options, 82 | }) => 83 | (super.noSuchMethod( 84 | Invocation.method( 85 | #getRating, 86 | [request], 87 | {#options: options}, 88 | ), 89 | returnValue: _FakeResponseFuture_0<_i5.GetRatingResponse>( 90 | this, 91 | Invocation.method( 92 | #getRating, 93 | [request], 94 | {#options: options}, 95 | ), 96 | ), 97 | ) as _i2.ResponseFuture<_i5.GetRatingResponse>); 98 | 99 | @override 100 | _i3.ClientCall $createCall( 101 | _i2.ClientMethod? method, 102 | _i6.Stream? requests, { 103 | _i2.CallOptions? options, 104 | }) => 105 | (super.noSuchMethod( 106 | Invocation.method( 107 | #$createCall, 108 | [ 109 | method, 110 | requests, 111 | ], 112 | {#options: options}, 113 | ), 114 | returnValue: _FakeClientCall_1( 115 | this, 116 | Invocation.method( 117 | #$createCall, 118 | [ 119 | method, 120 | requests, 121 | ], 122 | {#options: options}, 123 | ), 124 | ), 125 | ) as _i3.ClientCall); 126 | 127 | @override 128 | _i2.ResponseFuture $createUnaryCall( 129 | _i2.ClientMethod? method, 130 | Q? request, { 131 | _i2.CallOptions? options, 132 | }) => 133 | (super.noSuchMethod( 134 | Invocation.method( 135 | #$createUnaryCall, 136 | [ 137 | method, 138 | request, 139 | ], 140 | {#options: options}, 141 | ), 142 | returnValue: _FakeResponseFuture_0( 143 | this, 144 | Invocation.method( 145 | #$createUnaryCall, 146 | [ 147 | method, 148 | request, 149 | ], 150 | {#options: options}, 151 | ), 152 | ), 153 | ) as _i2.ResponseFuture); 154 | 155 | @override 156 | _i2.ResponseStream $createStreamingCall( 157 | _i2.ClientMethod? method, 158 | _i6.Stream? requests, { 159 | _i2.CallOptions? options, 160 | }) => 161 | (super.noSuchMethod( 162 | Invocation.method( 163 | #$createStreamingCall, 164 | [ 165 | method, 166 | requests, 167 | ], 168 | {#options: options}, 169 | ), 170 | returnValue: _FakeResponseStream_2( 171 | this, 172 | Invocation.method( 173 | #$createStreamingCall, 174 | [ 175 | method, 176 | requests, 177 | ], 178 | {#options: options}, 179 | ), 180 | ), 181 | ) as _i2.ResponseStream); 182 | } 183 | 184 | /// A class which mocks [UserClient]. 185 | /// 186 | /// See the documentation for Mockito's code generation for more information. 187 | class MockUserClient extends _i1.Mock implements _i7.UserClient { 188 | MockUserClient() { 189 | _i1.throwOnMissingStub(this); 190 | } 191 | 192 | @override 193 | _i2.ResponseFuture<_i8.AuthenticateResponse> authenticate( 194 | _i8.AuthenticateRequest? request, { 195 | _i2.CallOptions? options, 196 | }) => 197 | (super.noSuchMethod( 198 | Invocation.method( 199 | #authenticate, 200 | [request], 201 | {#options: options}, 202 | ), 203 | returnValue: _FakeResponseFuture_0<_i8.AuthenticateResponse>( 204 | this, 205 | Invocation.method( 206 | #authenticate, 207 | [request], 208 | {#options: options}, 209 | ), 210 | ), 211 | ) as _i2.ResponseFuture<_i8.AuthenticateResponse>); 212 | 213 | @override 214 | _i2.ResponseFuture<_i9.Empty> delete( 215 | _i9.Empty? request, { 216 | _i2.CallOptions? options, 217 | }) => 218 | (super.noSuchMethod( 219 | Invocation.method( 220 | #delete, 221 | [request], 222 | {#options: options}, 223 | ), 224 | returnValue: _FakeResponseFuture_0<_i9.Empty>( 225 | this, 226 | Invocation.method( 227 | #delete, 228 | [request], 229 | {#options: options}, 230 | ), 231 | ), 232 | ) as _i2.ResponseFuture<_i9.Empty>); 233 | 234 | @override 235 | _i2.ResponseFuture<_i9.Empty> vote( 236 | _i8.VoteRequest? request, { 237 | _i2.CallOptions? options, 238 | }) => 239 | (super.noSuchMethod( 240 | Invocation.method( 241 | #vote, 242 | [request], 243 | {#options: options}, 244 | ), 245 | returnValue: _FakeResponseFuture_0<_i9.Empty>( 246 | this, 247 | Invocation.method( 248 | #vote, 249 | [request], 250 | {#options: options}, 251 | ), 252 | ), 253 | ) as _i2.ResponseFuture<_i9.Empty>); 254 | 255 | @override 256 | _i2.ResponseFuture<_i8.ListMyVotesResponse> listMyVotes( 257 | _i8.ListMyVotesRequest? request, { 258 | _i2.CallOptions? options, 259 | }) => 260 | (super.noSuchMethod( 261 | Invocation.method( 262 | #listMyVotes, 263 | [request], 264 | {#options: options}, 265 | ), 266 | returnValue: _FakeResponseFuture_0<_i8.ListMyVotesResponse>( 267 | this, 268 | Invocation.method( 269 | #listMyVotes, 270 | [request], 271 | {#options: options}, 272 | ), 273 | ), 274 | ) as _i2.ResponseFuture<_i8.ListMyVotesResponse>); 275 | 276 | @override 277 | _i2.ResponseFuture<_i8.GetSnapVotesResponse> getSnapVotes( 278 | _i8.GetSnapVotesRequest? request, { 279 | _i2.CallOptions? options, 280 | }) => 281 | (super.noSuchMethod( 282 | Invocation.method( 283 | #getSnapVotes, 284 | [request], 285 | {#options: options}, 286 | ), 287 | returnValue: _FakeResponseFuture_0<_i8.GetSnapVotesResponse>( 288 | this, 289 | Invocation.method( 290 | #getSnapVotes, 291 | [request], 292 | {#options: options}, 293 | ), 294 | ), 295 | ) as _i2.ResponseFuture<_i8.GetSnapVotesResponse>); 296 | 297 | @override 298 | _i3.ClientCall $createCall( 299 | _i2.ClientMethod? method, 300 | _i6.Stream? requests, { 301 | _i2.CallOptions? options, 302 | }) => 303 | (super.noSuchMethod( 304 | Invocation.method( 305 | #$createCall, 306 | [ 307 | method, 308 | requests, 309 | ], 310 | {#options: options}, 311 | ), 312 | returnValue: _FakeClientCall_1( 313 | this, 314 | Invocation.method( 315 | #$createCall, 316 | [ 317 | method, 318 | requests, 319 | ], 320 | {#options: options}, 321 | ), 322 | ), 323 | ) as _i3.ClientCall); 324 | 325 | @override 326 | _i2.ResponseFuture $createUnaryCall( 327 | _i2.ClientMethod? method, 328 | Q? request, { 329 | _i2.CallOptions? options, 330 | }) => 331 | (super.noSuchMethod( 332 | Invocation.method( 333 | #$createUnaryCall, 334 | [ 335 | method, 336 | request, 337 | ], 338 | {#options: options}, 339 | ), 340 | returnValue: _FakeResponseFuture_0( 341 | this, 342 | Invocation.method( 343 | #$createUnaryCall, 344 | [ 345 | method, 346 | request, 347 | ], 348 | {#options: options}, 349 | ), 350 | ), 351 | ) as _i2.ResponseFuture); 352 | 353 | @override 354 | _i2.ResponseStream $createStreamingCall( 355 | _i2.ClientMethod? method, 356 | _i6.Stream? requests, { 357 | _i2.CallOptions? options, 358 | }) => 359 | (super.noSuchMethod( 360 | Invocation.method( 361 | #$createStreamingCall, 362 | [ 363 | method, 364 | requests, 365 | ], 366 | {#options: options}, 367 | ), 368 | returnValue: _FakeResponseStream_2( 369 | this, 370 | Invocation.method( 371 | #$createStreamingCall, 372 | [ 373 | method, 374 | requests, 375 | ], 376 | {#options: options}, 377 | ), 378 | ), 379 | ) as _i2.ResponseStream); 380 | } 381 | 382 | /// A class which mocks [ChartClient]. 383 | /// 384 | /// See the documentation for Mockito's code generation for more information. 385 | class MockChartClient extends _i1.Mock implements _i10.ChartClient { 386 | MockChartClient() { 387 | _i1.throwOnMissingStub(this); 388 | } 389 | 390 | @override 391 | _i2.ResponseFuture<_i11.GetChartResponse> getChart( 392 | _i11.GetChartRequest? request, { 393 | _i2.CallOptions? options, 394 | }) => 395 | (super.noSuchMethod( 396 | Invocation.method( 397 | #getChart, 398 | [request], 399 | {#options: options}, 400 | ), 401 | returnValue: _FakeResponseFuture_0<_i11.GetChartResponse>( 402 | this, 403 | Invocation.method( 404 | #getChart, 405 | [request], 406 | {#options: options}, 407 | ), 408 | ), 409 | ) as _i2.ResponseFuture<_i11.GetChartResponse>); 410 | 411 | @override 412 | _i3.ClientCall $createCall( 413 | _i2.ClientMethod? method, 414 | _i6.Stream? requests, { 415 | _i2.CallOptions? options, 416 | }) => 417 | (super.noSuchMethod( 418 | Invocation.method( 419 | #$createCall, 420 | [ 421 | method, 422 | requests, 423 | ], 424 | {#options: options}, 425 | ), 426 | returnValue: _FakeClientCall_1( 427 | this, 428 | Invocation.method( 429 | #$createCall, 430 | [ 431 | method, 432 | requests, 433 | ], 434 | {#options: options}, 435 | ), 436 | ), 437 | ) as _i3.ClientCall); 438 | 439 | @override 440 | _i2.ResponseFuture $createUnaryCall( 441 | _i2.ClientMethod? method, 442 | Q? request, { 443 | _i2.CallOptions? options, 444 | }) => 445 | (super.noSuchMethod( 446 | Invocation.method( 447 | #$createUnaryCall, 448 | [ 449 | method, 450 | request, 451 | ], 452 | {#options: options}, 453 | ), 454 | returnValue: _FakeResponseFuture_0( 455 | this, 456 | Invocation.method( 457 | #$createUnaryCall, 458 | [ 459 | method, 460 | request, 461 | ], 462 | {#options: options}, 463 | ), 464 | ), 465 | ) as _i2.ResponseFuture); 466 | 467 | @override 468 | _i2.ResponseStream $createStreamingCall( 469 | _i2.ClientMethod? method, 470 | _i6.Stream? requests, { 471 | _i2.CallOptions? options, 472 | }) => 473 | (super.noSuchMethod( 474 | Invocation.method( 475 | #$createStreamingCall, 476 | [ 477 | method, 478 | requests, 479 | ], 480 | {#options: options}, 481 | ), 482 | returnValue: _FakeResponseStream_2( 483 | this, 484 | Invocation.method( 485 | #$createStreamingCall, 486 | [ 487 | method, 488 | requests, 489 | ], 490 | {#options: options}, 491 | ), 492 | ), 493 | ) as _i2.ResponseStream); 494 | } 495 | -------------------------------------------------------------------------------- /lib/src/generated/ratings_features_user.pb.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated code. Do not modify. 3 | // source: ratings_features_user.proto 4 | // 5 | // @dart = 2.12 6 | 7 | // ignore_for_file: annotate_overrides, camel_case_types, comment_references 8 | // ignore_for_file: constant_identifier_names, library_prefixes 9 | // ignore_for_file: non_constant_identifier_names, prefer_final_fields 10 | // ignore_for_file: unnecessary_import, unnecessary_this, unused_import 11 | 12 | import 'dart:core' as $core; 13 | 14 | import 'package:protobuf/protobuf.dart' as $pb; 15 | 16 | import 'google/protobuf/timestamp.pb.dart' as $2; 17 | 18 | class AuthenticateRequest extends $pb.GeneratedMessage { 19 | factory AuthenticateRequest({ 20 | $core.String? id, 21 | }) { 22 | final $result = create(); 23 | if (id != null) { 24 | $result.id = id; 25 | } 26 | return $result; 27 | } 28 | AuthenticateRequest._() : super(); 29 | factory AuthenticateRequest.fromBuffer($core.List<$core.int> i, 30 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 31 | create()..mergeFromBuffer(i, r); 32 | factory AuthenticateRequest.fromJson($core.String i, 33 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 34 | create()..mergeFromJson(i, r); 35 | 36 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 37 | _omitMessageNames ? '' : 'AuthenticateRequest', 38 | package: const $pb.PackageName( 39 | _omitMessageNames ? '' : 'ratings.features.user'), 40 | createEmptyInstance: create) 41 | ..aOS(1, _omitFieldNames ? '' : 'id') 42 | ..hasRequiredFields = false; 43 | 44 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 45 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 46 | 'Will be removed in next major version') 47 | AuthenticateRequest clone() => AuthenticateRequest()..mergeFromMessage(this); 48 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 49 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 50 | 'Will be removed in next major version') 51 | AuthenticateRequest copyWith(void Function(AuthenticateRequest) updates) => 52 | super.copyWith((message) => updates(message as AuthenticateRequest)) 53 | as AuthenticateRequest; 54 | 55 | $pb.BuilderInfo get info_ => _i; 56 | 57 | @$core.pragma('dart2js:noInline') 58 | static AuthenticateRequest create() => AuthenticateRequest._(); 59 | AuthenticateRequest createEmptyInstance() => create(); 60 | static $pb.PbList createRepeated() => 61 | $pb.PbList(); 62 | @$core.pragma('dart2js:noInline') 63 | static AuthenticateRequest getDefault() => _defaultInstance ??= 64 | $pb.GeneratedMessage.$_defaultFor(create); 65 | static AuthenticateRequest? _defaultInstance; 66 | 67 | @$pb.TagNumber(1) 68 | $core.String get id => $_getSZ(0); 69 | @$pb.TagNumber(1) 70 | set id($core.String v) { 71 | $_setString(0, v); 72 | } 73 | 74 | @$pb.TagNumber(1) 75 | $core.bool hasId() => $_has(0); 76 | @$pb.TagNumber(1) 77 | void clearId() => clearField(1); 78 | } 79 | 80 | class AuthenticateResponse extends $pb.GeneratedMessage { 81 | factory AuthenticateResponse({ 82 | $core.String? token, 83 | }) { 84 | final $result = create(); 85 | if (token != null) { 86 | $result.token = token; 87 | } 88 | return $result; 89 | } 90 | AuthenticateResponse._() : super(); 91 | factory AuthenticateResponse.fromBuffer($core.List<$core.int> i, 92 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 93 | create()..mergeFromBuffer(i, r); 94 | factory AuthenticateResponse.fromJson($core.String i, 95 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 96 | create()..mergeFromJson(i, r); 97 | 98 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 99 | _omitMessageNames ? '' : 'AuthenticateResponse', 100 | package: const $pb.PackageName( 101 | _omitMessageNames ? '' : 'ratings.features.user'), 102 | createEmptyInstance: create) 103 | ..aOS(1, _omitFieldNames ? '' : 'token') 104 | ..hasRequiredFields = false; 105 | 106 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 107 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 108 | 'Will be removed in next major version') 109 | AuthenticateResponse clone() => 110 | AuthenticateResponse()..mergeFromMessage(this); 111 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 112 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 113 | 'Will be removed in next major version') 114 | AuthenticateResponse copyWith(void Function(AuthenticateResponse) updates) => 115 | super.copyWith((message) => updates(message as AuthenticateResponse)) 116 | as AuthenticateResponse; 117 | 118 | $pb.BuilderInfo get info_ => _i; 119 | 120 | @$core.pragma('dart2js:noInline') 121 | static AuthenticateResponse create() => AuthenticateResponse._(); 122 | AuthenticateResponse createEmptyInstance() => create(); 123 | static $pb.PbList createRepeated() => 124 | $pb.PbList(); 125 | @$core.pragma('dart2js:noInline') 126 | static AuthenticateResponse getDefault() => _defaultInstance ??= 127 | $pb.GeneratedMessage.$_defaultFor(create); 128 | static AuthenticateResponse? _defaultInstance; 129 | 130 | @$pb.TagNumber(1) 131 | $core.String get token => $_getSZ(0); 132 | @$pb.TagNumber(1) 133 | set token($core.String v) { 134 | $_setString(0, v); 135 | } 136 | 137 | @$pb.TagNumber(1) 138 | $core.bool hasToken() => $_has(0); 139 | @$pb.TagNumber(1) 140 | void clearToken() => clearField(1); 141 | } 142 | 143 | class ListMyVotesRequest extends $pb.GeneratedMessage { 144 | factory ListMyVotesRequest({ 145 | $core.String? snapIdFilter, 146 | }) { 147 | final $result = create(); 148 | if (snapIdFilter != null) { 149 | $result.snapIdFilter = snapIdFilter; 150 | } 151 | return $result; 152 | } 153 | ListMyVotesRequest._() : super(); 154 | factory ListMyVotesRequest.fromBuffer($core.List<$core.int> i, 155 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 156 | create()..mergeFromBuffer(i, r); 157 | factory ListMyVotesRequest.fromJson($core.String i, 158 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 159 | create()..mergeFromJson(i, r); 160 | 161 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 162 | _omitMessageNames ? '' : 'ListMyVotesRequest', 163 | package: const $pb.PackageName( 164 | _omitMessageNames ? '' : 'ratings.features.user'), 165 | createEmptyInstance: create) 166 | ..aOS(1, _omitFieldNames ? '' : 'snapIdFilter') 167 | ..hasRequiredFields = false; 168 | 169 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 170 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 171 | 'Will be removed in next major version') 172 | ListMyVotesRequest clone() => ListMyVotesRequest()..mergeFromMessage(this); 173 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 174 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 175 | 'Will be removed in next major version') 176 | ListMyVotesRequest copyWith(void Function(ListMyVotesRequest) updates) => 177 | super.copyWith((message) => updates(message as ListMyVotesRequest)) 178 | as ListMyVotesRequest; 179 | 180 | $pb.BuilderInfo get info_ => _i; 181 | 182 | @$core.pragma('dart2js:noInline') 183 | static ListMyVotesRequest create() => ListMyVotesRequest._(); 184 | ListMyVotesRequest createEmptyInstance() => create(); 185 | static $pb.PbList createRepeated() => 186 | $pb.PbList(); 187 | @$core.pragma('dart2js:noInline') 188 | static ListMyVotesRequest getDefault() => _defaultInstance ??= 189 | $pb.GeneratedMessage.$_defaultFor(create); 190 | static ListMyVotesRequest? _defaultInstance; 191 | 192 | @$pb.TagNumber(1) 193 | $core.String get snapIdFilter => $_getSZ(0); 194 | @$pb.TagNumber(1) 195 | set snapIdFilter($core.String v) { 196 | $_setString(0, v); 197 | } 198 | 199 | @$pb.TagNumber(1) 200 | $core.bool hasSnapIdFilter() => $_has(0); 201 | @$pb.TagNumber(1) 202 | void clearSnapIdFilter() => clearField(1); 203 | } 204 | 205 | class ListMyVotesResponse extends $pb.GeneratedMessage { 206 | factory ListMyVotesResponse({ 207 | $core.Iterable? votes, 208 | }) { 209 | final $result = create(); 210 | if (votes != null) { 211 | $result.votes.addAll(votes); 212 | } 213 | return $result; 214 | } 215 | ListMyVotesResponse._() : super(); 216 | factory ListMyVotesResponse.fromBuffer($core.List<$core.int> i, 217 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 218 | create()..mergeFromBuffer(i, r); 219 | factory ListMyVotesResponse.fromJson($core.String i, 220 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 221 | create()..mergeFromJson(i, r); 222 | 223 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 224 | _omitMessageNames ? '' : 'ListMyVotesResponse', 225 | package: const $pb.PackageName( 226 | _omitMessageNames ? '' : 'ratings.features.user'), 227 | createEmptyInstance: create) 228 | ..pc(1, _omitFieldNames ? '' : 'votes', $pb.PbFieldType.PM, 229 | subBuilder: Vote.create) 230 | ..hasRequiredFields = false; 231 | 232 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 233 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 234 | 'Will be removed in next major version') 235 | ListMyVotesResponse clone() => ListMyVotesResponse()..mergeFromMessage(this); 236 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 237 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 238 | 'Will be removed in next major version') 239 | ListMyVotesResponse copyWith(void Function(ListMyVotesResponse) updates) => 240 | super.copyWith((message) => updates(message as ListMyVotesResponse)) 241 | as ListMyVotesResponse; 242 | 243 | $pb.BuilderInfo get info_ => _i; 244 | 245 | @$core.pragma('dart2js:noInline') 246 | static ListMyVotesResponse create() => ListMyVotesResponse._(); 247 | ListMyVotesResponse createEmptyInstance() => create(); 248 | static $pb.PbList createRepeated() => 249 | $pb.PbList(); 250 | @$core.pragma('dart2js:noInline') 251 | static ListMyVotesResponse getDefault() => _defaultInstance ??= 252 | $pb.GeneratedMessage.$_defaultFor(create); 253 | static ListMyVotesResponse? _defaultInstance; 254 | 255 | @$pb.TagNumber(1) 256 | $core.List get votes => $_getList(0); 257 | } 258 | 259 | class GetSnapVotesRequest extends $pb.GeneratedMessage { 260 | factory GetSnapVotesRequest({ 261 | $core.String? snapId, 262 | }) { 263 | final $result = create(); 264 | if (snapId != null) { 265 | $result.snapId = snapId; 266 | } 267 | return $result; 268 | } 269 | GetSnapVotesRequest._() : super(); 270 | factory GetSnapVotesRequest.fromBuffer($core.List<$core.int> i, 271 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 272 | create()..mergeFromBuffer(i, r); 273 | factory GetSnapVotesRequest.fromJson($core.String i, 274 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 275 | create()..mergeFromJson(i, r); 276 | 277 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 278 | _omitMessageNames ? '' : 'GetSnapVotesRequest', 279 | package: const $pb.PackageName( 280 | _omitMessageNames ? '' : 'ratings.features.user'), 281 | createEmptyInstance: create) 282 | ..aOS(1, _omitFieldNames ? '' : 'snapId') 283 | ..hasRequiredFields = false; 284 | 285 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 286 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 287 | 'Will be removed in next major version') 288 | GetSnapVotesRequest clone() => GetSnapVotesRequest()..mergeFromMessage(this); 289 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 290 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 291 | 'Will be removed in next major version') 292 | GetSnapVotesRequest copyWith(void Function(GetSnapVotesRequest) updates) => 293 | super.copyWith((message) => updates(message as GetSnapVotesRequest)) 294 | as GetSnapVotesRequest; 295 | 296 | $pb.BuilderInfo get info_ => _i; 297 | 298 | @$core.pragma('dart2js:noInline') 299 | static GetSnapVotesRequest create() => GetSnapVotesRequest._(); 300 | GetSnapVotesRequest createEmptyInstance() => create(); 301 | static $pb.PbList createRepeated() => 302 | $pb.PbList(); 303 | @$core.pragma('dart2js:noInline') 304 | static GetSnapVotesRequest getDefault() => _defaultInstance ??= 305 | $pb.GeneratedMessage.$_defaultFor(create); 306 | static GetSnapVotesRequest? _defaultInstance; 307 | 308 | @$pb.TagNumber(1) 309 | $core.String get snapId => $_getSZ(0); 310 | @$pb.TagNumber(1) 311 | set snapId($core.String v) { 312 | $_setString(0, v); 313 | } 314 | 315 | @$pb.TagNumber(1) 316 | $core.bool hasSnapId() => $_has(0); 317 | @$pb.TagNumber(1) 318 | void clearSnapId() => clearField(1); 319 | } 320 | 321 | class GetSnapVotesResponse extends $pb.GeneratedMessage { 322 | factory GetSnapVotesResponse({ 323 | $core.Iterable? votes, 324 | }) { 325 | final $result = create(); 326 | if (votes != null) { 327 | $result.votes.addAll(votes); 328 | } 329 | return $result; 330 | } 331 | GetSnapVotesResponse._() : super(); 332 | factory GetSnapVotesResponse.fromBuffer($core.List<$core.int> i, 333 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 334 | create()..mergeFromBuffer(i, r); 335 | factory GetSnapVotesResponse.fromJson($core.String i, 336 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 337 | create()..mergeFromJson(i, r); 338 | 339 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 340 | _omitMessageNames ? '' : 'GetSnapVotesResponse', 341 | package: const $pb.PackageName( 342 | _omitMessageNames ? '' : 'ratings.features.user'), 343 | createEmptyInstance: create) 344 | ..pc(1, _omitFieldNames ? '' : 'votes', $pb.PbFieldType.PM, 345 | subBuilder: Vote.create) 346 | ..hasRequiredFields = false; 347 | 348 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 349 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 350 | 'Will be removed in next major version') 351 | GetSnapVotesResponse clone() => 352 | GetSnapVotesResponse()..mergeFromMessage(this); 353 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 354 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 355 | 'Will be removed in next major version') 356 | GetSnapVotesResponse copyWith(void Function(GetSnapVotesResponse) updates) => 357 | super.copyWith((message) => updates(message as GetSnapVotesResponse)) 358 | as GetSnapVotesResponse; 359 | 360 | $pb.BuilderInfo get info_ => _i; 361 | 362 | @$core.pragma('dart2js:noInline') 363 | static GetSnapVotesResponse create() => GetSnapVotesResponse._(); 364 | GetSnapVotesResponse createEmptyInstance() => create(); 365 | static $pb.PbList createRepeated() => 366 | $pb.PbList(); 367 | @$core.pragma('dart2js:noInline') 368 | static GetSnapVotesResponse getDefault() => _defaultInstance ??= 369 | $pb.GeneratedMessage.$_defaultFor(create); 370 | static GetSnapVotesResponse? _defaultInstance; 371 | 372 | @$pb.TagNumber(1) 373 | $core.List get votes => $_getList(0); 374 | } 375 | 376 | class Vote extends $pb.GeneratedMessage { 377 | factory Vote({ 378 | $core.String? snapId, 379 | $core.int? snapRevision, 380 | $core.bool? voteUp, 381 | $2.Timestamp? timestamp, 382 | }) { 383 | final $result = create(); 384 | if (snapId != null) { 385 | $result.snapId = snapId; 386 | } 387 | if (snapRevision != null) { 388 | $result.snapRevision = snapRevision; 389 | } 390 | if (voteUp != null) { 391 | $result.voteUp = voteUp; 392 | } 393 | if (timestamp != null) { 394 | $result.timestamp = timestamp; 395 | } 396 | return $result; 397 | } 398 | Vote._() : super(); 399 | factory Vote.fromBuffer($core.List<$core.int> i, 400 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 401 | create()..mergeFromBuffer(i, r); 402 | factory Vote.fromJson($core.String i, 403 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 404 | create()..mergeFromJson(i, r); 405 | 406 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 407 | _omitMessageNames ? '' : 'Vote', 408 | package: const $pb.PackageName( 409 | _omitMessageNames ? '' : 'ratings.features.user'), 410 | createEmptyInstance: create) 411 | ..aOS(1, _omitFieldNames ? '' : 'snapId') 412 | ..a<$core.int>(2, _omitFieldNames ? '' : 'snapRevision', $pb.PbFieldType.O3) 413 | ..aOB(3, _omitFieldNames ? '' : 'voteUp') 414 | ..aOM<$2.Timestamp>(4, _omitFieldNames ? '' : 'timestamp', 415 | subBuilder: $2.Timestamp.create) 416 | ..hasRequiredFields = false; 417 | 418 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 419 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 420 | 'Will be removed in next major version') 421 | Vote clone() => Vote()..mergeFromMessage(this); 422 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 423 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 424 | 'Will be removed in next major version') 425 | Vote copyWith(void Function(Vote) updates) => 426 | super.copyWith((message) => updates(message as Vote)) as Vote; 427 | 428 | $pb.BuilderInfo get info_ => _i; 429 | 430 | @$core.pragma('dart2js:noInline') 431 | static Vote create() => Vote._(); 432 | Vote createEmptyInstance() => create(); 433 | static $pb.PbList createRepeated() => $pb.PbList(); 434 | @$core.pragma('dart2js:noInline') 435 | static Vote getDefault() => 436 | _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 437 | static Vote? _defaultInstance; 438 | 439 | @$pb.TagNumber(1) 440 | $core.String get snapId => $_getSZ(0); 441 | @$pb.TagNumber(1) 442 | set snapId($core.String v) { 443 | $_setString(0, v); 444 | } 445 | 446 | @$pb.TagNumber(1) 447 | $core.bool hasSnapId() => $_has(0); 448 | @$pb.TagNumber(1) 449 | void clearSnapId() => clearField(1); 450 | 451 | @$pb.TagNumber(2) 452 | $core.int get snapRevision => $_getIZ(1); 453 | @$pb.TagNumber(2) 454 | set snapRevision($core.int v) { 455 | $_setSignedInt32(1, v); 456 | } 457 | 458 | @$pb.TagNumber(2) 459 | $core.bool hasSnapRevision() => $_has(1); 460 | @$pb.TagNumber(2) 461 | void clearSnapRevision() => clearField(2); 462 | 463 | @$pb.TagNumber(3) 464 | $core.bool get voteUp => $_getBF(2); 465 | @$pb.TagNumber(3) 466 | set voteUp($core.bool v) { 467 | $_setBool(2, v); 468 | } 469 | 470 | @$pb.TagNumber(3) 471 | $core.bool hasVoteUp() => $_has(2); 472 | @$pb.TagNumber(3) 473 | void clearVoteUp() => clearField(3); 474 | 475 | @$pb.TagNumber(4) 476 | $2.Timestamp get timestamp => $_getN(3); 477 | @$pb.TagNumber(4) 478 | set timestamp($2.Timestamp v) { 479 | setField(4, v); 480 | } 481 | 482 | @$pb.TagNumber(4) 483 | $core.bool hasTimestamp() => $_has(3); 484 | @$pb.TagNumber(4) 485 | void clearTimestamp() => clearField(4); 486 | @$pb.TagNumber(4) 487 | $2.Timestamp ensureTimestamp() => $_ensure(3); 488 | } 489 | 490 | class VoteRequest extends $pb.GeneratedMessage { 491 | factory VoteRequest({ 492 | $core.String? snapId, 493 | $core.int? snapRevision, 494 | $core.bool? voteUp, 495 | }) { 496 | final $result = create(); 497 | if (snapId != null) { 498 | $result.snapId = snapId; 499 | } 500 | if (snapRevision != null) { 501 | $result.snapRevision = snapRevision; 502 | } 503 | if (voteUp != null) { 504 | $result.voteUp = voteUp; 505 | } 506 | return $result; 507 | } 508 | VoteRequest._() : super(); 509 | factory VoteRequest.fromBuffer($core.List<$core.int> i, 510 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 511 | create()..mergeFromBuffer(i, r); 512 | factory VoteRequest.fromJson($core.String i, 513 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 514 | create()..mergeFromJson(i, r); 515 | 516 | static final $pb.BuilderInfo _i = $pb.BuilderInfo( 517 | _omitMessageNames ? '' : 'VoteRequest', 518 | package: const $pb.PackageName( 519 | _omitMessageNames ? '' : 'ratings.features.user'), 520 | createEmptyInstance: create) 521 | ..aOS(1, _omitFieldNames ? '' : 'snapId') 522 | ..a<$core.int>(2, _omitFieldNames ? '' : 'snapRevision', $pb.PbFieldType.O3) 523 | ..aOB(3, _omitFieldNames ? '' : 'voteUp') 524 | ..hasRequiredFields = false; 525 | 526 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 527 | 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 528 | 'Will be removed in next major version') 529 | VoteRequest clone() => VoteRequest()..mergeFromMessage(this); 530 | @$core.Deprecated('Using this can add significant overhead to your binary. ' 531 | 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 532 | 'Will be removed in next major version') 533 | VoteRequest copyWith(void Function(VoteRequest) updates) => 534 | super.copyWith((message) => updates(message as VoteRequest)) 535 | as VoteRequest; 536 | 537 | $pb.BuilderInfo get info_ => _i; 538 | 539 | @$core.pragma('dart2js:noInline') 540 | static VoteRequest create() => VoteRequest._(); 541 | VoteRequest createEmptyInstance() => create(); 542 | static $pb.PbList createRepeated() => $pb.PbList(); 543 | @$core.pragma('dart2js:noInline') 544 | static VoteRequest getDefault() => _defaultInstance ??= 545 | $pb.GeneratedMessage.$_defaultFor(create); 546 | static VoteRequest? _defaultInstance; 547 | 548 | @$pb.TagNumber(1) 549 | $core.String get snapId => $_getSZ(0); 550 | @$pb.TagNumber(1) 551 | set snapId($core.String v) { 552 | $_setString(0, v); 553 | } 554 | 555 | @$pb.TagNumber(1) 556 | $core.bool hasSnapId() => $_has(0); 557 | @$pb.TagNumber(1) 558 | void clearSnapId() => clearField(1); 559 | 560 | @$pb.TagNumber(2) 561 | $core.int get snapRevision => $_getIZ(1); 562 | @$pb.TagNumber(2) 563 | set snapRevision($core.int v) { 564 | $_setSignedInt32(1, v); 565 | } 566 | 567 | @$pb.TagNumber(2) 568 | $core.bool hasSnapRevision() => $_has(1); 569 | @$pb.TagNumber(2) 570 | void clearSnapRevision() => clearField(2); 571 | 572 | @$pb.TagNumber(3) 573 | $core.bool get voteUp => $_getBF(2); 574 | @$pb.TagNumber(3) 575 | set voteUp($core.bool v) { 576 | $_setBool(2, v); 577 | } 578 | 579 | @$pb.TagNumber(3) 580 | $core.bool hasVoteUp() => $_has(2); 581 | @$pb.TagNumber(3) 582 | void clearVoteUp() => clearField(3); 583 | } 584 | 585 | const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); 586 | const _omitMessageNames = 587 | $core.bool.fromEnvironment('protobuf.omit_message_names'); 588 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------