Compare commits

...

123 Commits

Author SHA1 Message Date
dependabot[bot] c2581f952e
Bump build_test from 2.2.3 to 3.2.1 (#797) 2025-06-30 06:19:03 +00:00
Devon Carew c737e3d87e
simplify hierarchy of ResponseFuture (#791)
* simplify hierarchy of ResponseFuture

* dartfmt

* update changelog

---------

Co-authored-by: Moritz <mosum@google.com>
2025-06-24 18:59:04 +02:00
Devon Carew 79f277e7b9
export additional generated protobuf symbols (#792)
* export additional generated protobuf symbols

* update changelog

* bump to a new minor version (4.2.0)
2025-06-24 18:51:21 +02:00
Devon Carew 4e35b1689d
update deps; simplify analysis options (#790)
* update deps; simplify analysis options

* update package version

* require dart 3.8; upgrade other deps

* dartfmt

---------

Co-authored-by: Moritz <mosum@google.com>
2025-06-20 17:27:49 +02:00
Devon Carew aebb65cbf2
Update publish.yaml (#789)
* Update publish.yaml

* cargo cult config from dart-lang/core

* skip coverage check; update file headers
2025-06-11 14:36:18 +02:00
Slava Egorov a6b94850a1
Fix CallOptions.mergeWith (#786)
It should have symmetric behavior.

Given `WebCallOptions a` and `CallOptions b` both `a.mergeWith(b)` and `b.mergeFrom(a)`
should return WebCallOptions.
2025-05-26 13:11:00 +02:00
Thomas Hareau d297a29cb7
Add server interceptor acting as a middleware (#762)
* Add server interceptor acting as a middleware

* Remove unused import

* Add changelog entry

* Inline variable

* Bump version

* Fix infinite recursion
2025-05-23 09:01:42 +02:00
Kevin Moore 5ba3745779
Allow the latest pkg:googleapis_auth (#775)
Closes https://github.com/grpc/grpc-dart/pull/772
2025-04-01 13:05:09 -07:00
dependabot[bot] aa915bf15b
Bump dart-lang/setup-dart from 1.7.0 to 1.7.1 (#761)
Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](e630b99d28...e51d8e571e)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-31 14:45:14 -07:00
Slava Egorov 9a0b4642ef
Allow 4.0.0 version for protobuf dependency and prepare to release 4.0.3 (#774)
Fixes https://github.com/grpc/grpc-dart/issues/768
2025-03-31 15:42:24 +02:00
Moritz f077328341
Fix web and prepare to publish 4.0.2 2025-03-31 10:22:25 +02:00
Aran Donohue ebc838b66d
fix: update grpc_web_server.dart envoy config to support newer envoy version (#760)
Co-authored-by: Moritz <mosum@google.com>
2025-02-21 14:18:14 +01:00
Aran Donohue 6dfb4b43f3
fix: Updates the grpc-web example to avoid dart:html (#748)
* update: Migrate off legacy JS/HTML apis

* update: use dart.library.js_interop in place of dart.library.html

* update: dart format xhr_transport.dart and update dart sdk to v3.4.0 in workflows

* update: use if instead of switch case in xhr_transport.dart

* update: upgrade web package to v1.1.0

* refactor: use Uint8List for sending data over XHR rather than Int8List

* refactor: eta-reduction of call to request.setRequestHeader

* Convert grpc-web example to package:web

---------

Co-authored-by: minoic <minoic2020@gmail.com>
Co-authored-by: Moritz <mosum@google.com>
2025-02-21 14:11:03 +01:00
Aran Donohue 5ba28e3a1c
fix: Use package:web to get HttpStatus (#749)
* Use package:web to get HttpStatus

* docs: add CHANGELOG.md entry

---------

Co-authored-by: Moritz <mosum@google.com>
2025-02-21 10:29:12 +01:00
Aran Donohue 840661415d
Fix: Migrate off legacy JS/HTML APIs (#750)
* update: Migrate off legacy JS/HTML apis

* update: use dart.library.js_interop in place of dart.library.html

* update: dart format xhr_transport.dart and update dart sdk to v3.4.0 in workflows

* update: use if instead of switch case in xhr_transport.dart

* update: upgrade web package to v1.1.0

* refactor: use Uint8List for sending data over XHR rather than Int8List

* refactor: eta-reduction of call to request.setRequestHeader

* Update client_xhr_transport_test to avoid dart:html, updating xhr_transport to support testability

* fixup tests

---------

Co-authored-by: minoic <minoic2020@gmail.com>
Co-authored-by: Moritz <mosum@google.com>
2025-02-18 10:13:50 +01:00
Devon Carew 7f9042f79e
various analysis updates (#755)
* various analysis updates

* misc updates

* remove unintentional dartdoc comment

* Update CONTRIBUTING.md

Co-authored-by: Moritz <moritz@suemmermann.de>

* add ignore comments for use of deprecated apis

---------

Co-authored-by: Moritz <moritz@suemmermann.de>
2025-01-30 08:41:34 +01:00
dependabot[bot] 9a9c01752c
Bump vm_service from 14.3.1 to 15.0.0 (#751)
Bumps [vm_service](https://github.com/dart-lang/sdk/tree/main/pkg) from 14.3.1 to 15.0.0.
- [Changelog](https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/dart-lang/sdk/commits/HEAD/pkg)

---
updated-dependencies:
- dependency-name: vm_service
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Moritz <mosum@google.com>
2024-12-17 09:58:22 +01:00
Moritz 3e94fecd14
Update health.yaml (#753)
* Update health.yaml

* Upgrade example

* Fixes

* try different syntax

* without endings

* test new wf

* new version

* Works, use main now

* Add changelog
2024-12-17 09:53:02 +01:00
dependabot[bot] 6676c20df2
Bump dart-lang/setup-dart from 1.6.5 to 1.7.0 (#746) 2024-12-16 13:37:35 +00:00
dependabot[bot] f61b9a3b37
Bump actions/checkout from 4.2.0 to 4.2.2 (#744) 2024-11-04 10:45:05 +00:00
dependabot[bot] c0630106a9
Bump actions/checkout from 4.1.7 to 4.2.0 (#741) 2024-10-01 08:51:16 +00:00
Moritz 04ba68eb91
Rev package:lints (#740)
* Rev package:lints

* Add changelog

* Run CI on 3.5.0

* Test with 3.2.0

* Update .github/workflows/dart.yml

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>

* Update .github/workflows/dart.yml

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>

---------

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
2024-10-01 10:46:38 +02:00
Kevin Moore f8bbdce629
ignore unreachable_switch_default in weird switch case (#737) 2024-09-24 12:07:42 -07:00
steffenhaak 071ebc5f31
fix: keep alive timeout finishes transport instead of connection shutdown (#722)
* fix: keep alive timeout finishes transport instead of shutting down channel

* Update keepalive_test.dart

* Update CHANGELOG.md

---------

Co-authored-by: Moritz <mosum@google.com>
2024-09-06 17:13:11 +02:00
Moritz 81776333d9
Small fixes (#732)
* Small fixes

* Revert changes on file

* Add changelog

* Small fixes in keepalive test

* Add delay

* Fix symbol visibilty

* Add try catch for debugging

* Fail

* fail

* Use for loop
2024-09-06 15:09:54 +02:00
Lasse R.H. Nielsen 38ca626e0a
Use `Map.of` instead of `Map.from` in grpc client. (#724)
* Use `Map.of` instead of `Map.from` in grpc client.

`Map.of` creates a new map with the same keys, values and *type*
as the original map, when used without type arguments or context type,
where `Map.from` creates a `Map<dynamic, dynamic>`.
(This code failed on an attempt to make `Map.unmodifiable` be more
strictly typed, like `Map.of` instead of `Map.from`, showing that
an intermediate map had type `Map<dynamic, dynamic>` unnecessarily).

Same for using `List.of` instead of `List.from`.

The new code should be (microscopically) more efficient and type safe,
and is forwards-compatible with a stronger type on `Map.unmodifiable`.

(The code can be optimized more. For example
`List.of(list1)..addAll(list2)` can be just `list1 + list2` or
`[...list1, ...list2]`, both of which may know the total number
of elements when doing the initial list allocation.
This is a minimal change to allow the type changes for `.unmodifiable`
to get past this very initial blocker in internal tests.)

* Add changelog and minor version increment.

And my save removes trailing spaces.
2024-09-02 16:58:43 +02:00
c-lucera-pvotal 4f6fe9b111
fix: fix headers not completing when call is terminated (#728)
Fixes #727
2024-08-28 08:18:15 +02:00
Kevin Moore c18e185bb0
Fix status badge (#726) 2024-07-24 14:24:57 -07:00
Galen Warren b999b64502
feat: fix hang that occurs when hot restarting (#718) 2024-07-17 14:11:29 +02:00
dependabot[bot] bf8bbde34c
Bump dart-lang/setup-dart from 1.6.4 to 1.6.5 (#720) 2024-07-01 11:56:47 +00:00
dependabot[bot] 4aa4c8cb8d
Bump actions/checkout from 4.1.6 to 4.1.7 (#719) 2024-07-01 11:52:08 +00:00
Kevin Moore dee1b2b43b Update pubspec.yaml 2024-05-30 00:27:50 +00:00
Kevin Moore 52023d404e code fixes 2024-05-30 00:27:50 +00:00
dependabot[bot] ebb7368fa4 Bump lints from 3.0.0 to 4.0.0
Bumps [lints](https://github.com/dart-lang/lints) from 3.0.0 to 4.0.0.
- [Release notes](https://github.com/dart-lang/lints/releases)
- [Changelog](https://github.com/dart-lang/lints/blob/main/CHANGELOG.md)
- [Commits](https://github.com/dart-lang/lints/compare/v3.0.0...v4.0.0)

---
updated-dependencies:
- dependency-name: lints
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-30 00:27:50 +00:00
dependabot[bot] 4e65d4b795 ---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-22 06:54:01 +00:00
dependabot[bot] 14954537f6 Bump dart-lang/setup-dart from 1.6.2 to 1.6.4
Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.2 to 1.6.4.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](fedb1266e9...f0ead981b4)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 11:05:02 +00:00
Sarah Zakarias 6586b74969
Add `topics` to `pubspec.yaml` (#712) 2024-05-21 12:30:20 +02:00
Moritz 9f65399e28
Move `codec.dart` to former place (#713) 2024-05-17 14:53:33 +02:00
Moritz 0d02e4386f
Remove dependency on `package:archive` (#707)
* Remove dependency on package:archive

* Test compression on vm only

* Add licenses

* Fix analyze issues

* Fix codec web

* Fix licenses

* Add changelog
2024-05-06 15:25:06 +02:00
Moritz 078fd23bca
Remove generated `StatusCode` (#703)
* Remove generated `StatusCode`

* Rev version for breaking change

* Upgrade min sdk version

* Fix issues
2024-04-25 13:45:40 +02:00
Ruben Garcia bdbe5f5003
Fix issue 669 (#693)
* Fix issue 669

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix dart format issue.
Fix prefer single quote issue.

* Update pubspec and changelog to avoid merge check
publish / validate
validate packages

* Add test for GRPC Compression Flag

* Fix dart analyze issues.

* Fix latest dart analyze issue (uninizialized variable)
2024-04-22 16:09:18 +02:00
Moritz bb8b6e5950
Make protobuf generated imports absolute (#696)
* Make protobuf generated imports absolute

* Stop test for now
2024-04-19 11:05:59 +02:00
Moritz b05fafe77c
Add Health workflow (#699)
* Add Health workflow

* Remove license check
2024-04-15 13:43:26 +02:00
Abdul Momin aece2a4e3f
Typo Correction in README.md (#695)
Corrected typo "RPs" to "RPCs". To avoid confusion.
2024-04-15 09:53:00 +02:00
dependabot[bot] 4a043fa236 Bump dart-lang/setup-dart from 1.6.0 to 1.6.2
Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.0 to 1.6.2.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](b64355ae6c...fedb1266e9)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 08:16:55 +00:00
dependabot[bot] e54366e1e4
Bump vm_service from 13.0.0 to 14.0.0 (#684)
Bumps [vm_service](https://github.com/dart-lang/sdk/tree/main/pkg) from 13.0.0 to 14.0.0.
- [Changelog](https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/dart-lang/sdk/commits/HEAD/pkg)

---
updated-dependencies:
- dependency-name: vm_service
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-02 13:35:32 +01:00
dependabot[bot] d1e6c8ce11
Bump vm_service from 12.0.0 to 13.0.0 (#678) 2023-11-24 13:12:19 +00:00
dependabot[bot] f6ca15b599
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#680) 2023-11-24 13:04:03 +00:00
dependabot[bot] 9781c57262
Bump actions/checkout from 4.1.0 to 4.1.1 (#679)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 11:39:10 -07:00
dependabot[bot] b7f9115b98
Bump lints from 2.1.1 to 3.0.0 (#675) 2023-10-23 08:44:11 +00:00
dependabot[bot] e24550ae32
Bump vm_service from 11.10.0 to 12.0.0 (#673) 2023-10-19 14:37:48 +00:00
dependabot[bot] 6a92a47115
Bump actions/checkout from 3.6.0 to 4.1.0 (#671) 2023-10-02 08:57:55 +00:00
dependabot[bot] 5e2fb6a30a
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#672) 2023-10-02 08:47:03 +00:00
Moritz c1fa94951a
Fix regression on fetching the remote address of a closed socket. (#664)
* Fix regression on fetching the remote address of a closed socket

* Changes as per review

* Add changelog entry

* Rev version for publish
2023-09-08 17:41:32 +02:00
dependabot[bot] dae290cc5a
Bump actions/checkout from 3.5.3 to 3.6.0 (#663) 2023-09-06 14:39:35 +00:00
Moritz cba40da0d8
Fix imports in `http2_connection.dart` (#662)
* Fix imports in `http2_connection.dart`

* Export `Proxy`

* dart fix

* Add documentation comment

* Add licenses
2023-08-24 11:50:01 +02:00
Moritz 3f05c37367
Remove canceled streams (#661)
* Remove canceled streams

* Inline variabel

* Add changelog

* Add test

* Add description to test

* More messages for less flakiness
2023-08-24 10:42:21 +02:00
Moritz 4ccd8a0e3d
Add proxy functionality (#657)
* Add proxy to options

* Add proxy connect

* Works now

* Uncomment proxy line

* Revert change

* Doesn't work

* Works

* Fix bug

* Add secure test

* Refine test

* Add changelog

* Changes as per review
2023-08-23 10:07:15 +02:00
Kevin Moore a6322db468
Regenerate protobuf types with new protobuf version (#658) 2023-08-16 05:33:31 -07:00
dependabot[bot] 9dadc31cba
Bump protobuf from 2.1.0 to 3.0.0 in /interop (#648)
Bumps [protobuf](https://github.com/google/protobuf.dart) from 2.1.0 to 3.0.0.
- [Release notes](https://github.com/google/protobuf.dart/releases)
- [Commits](https://github.com/google/protobuf.dart/compare/protobuf-v2.1.0...protobuf-v3.0.0)

---
updated-dependencies:
- dependency-name: protobuf
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-13 13:55:08 +02:00
Moritz 1c18e38252
Forward error (#640)
* Forward error

* Add changelog

* Switch version
2023-07-13 13:30:58 +02:00
Moritz c7e07a09a5
Fix interop tests (#651)
* Fix interop tests

* Keepalive cleanups

* Prepare for publish
2023-07-13 12:05:59 +02:00
dependabot[bot] 8886dfd24b
Bump actions/checkout from 3.5.2 to 3.5.3 (#649)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e5e7e5ab8...c85c95e3d7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 18:30:30 -07:00
Moritz b7df4c8290
Deflake keepalive tests (#645)
* Deflake keepalive tests

* Add timer

* Increase wait timer

* Only send ping on open connection

* Switch server keepalive to fakeasync

* Tiny refactor

* Add changelog entry
2023-06-22 10:30:53 -04:00
Moritz 517cde91a6
Make `GrpcError` non-final to allow implementations. (#647) 2023-06-22 09:20:18 -04:00
Moritz 36c19af11a
Add permissions to run publish CI (#646)
* Add permissions to run publish CI

* Switch to pull-requests: write

* add id-token: write
2023-06-21 18:33:03 -04:00
Moritz 03f07e9535
Keepalive (#634)
* Keepalive tests run!

* Renaming

* Some refactorings

* Find a place where to handle the keepalive manager

* Fix bug

* Make KeepAliveManager independent of transport

* Fix call sites in client

* Add server keepalive handler

* Wire through onDataReceived

* Add ServerKeepAliveManager test

* Refactorings

* Tests kind of run now

* Add shutdown test

* Remove unneeded override

* Remove unneeded mocks

* Send correct error codes and cleanup

* Small changes

* Rename

* Add documentation

* Add test for !_enforcesMaxBadPings

* Refactor tests

* Switch to http2 master branch

* Renaming

* Null shutdownTimer

* Refactor to event-state model

* Smaller refactorings

* Works now

* Switch tests to isA

* Shifting things around

* Split into server and client

* Format

* rename

* Tweaks

* Switch order of optional parameters to make change non-breaking

* Add some leeway to the durations in tests

* Make keepalive tests vm only

* Switch back to onEvent in state

* Switch to published http2
2023-06-21 11:14:43 -04:00
Moritz aae487d12f
Make constructors of `GrpcError` const (#638)
* Make constructors of `GrpcError` const

* Update CHANGELOG.md

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>

* Update pubspec.yaml

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>

---------

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
2023-06-21 10:48:55 -04:00
Moritz 870ac192fa
Switch interop tests to Dart 3 (#644) 2023-06-20 16:09:38 -04:00
Kevin Moore 754289be88
Release v3.2.2 (#643) 2023-06-20 04:58:55 -07:00
Aran Donohue a8cc164cee
Make ResponseStream a regular class (#642) 2023-06-20 04:32:24 -07:00
Kevin Moore d9553ca73f
support latest pkg:protobuf (#641) 2023-06-16 22:47:03 -07:00
SeongUk Cho 1f8d992da7
Bump http version from 0.13.0 to 1.0.0 (#629) 2023-06-17 07:18:18 +10:00
Moritz ceb879d769
Update Github CI workflows (#639) 2023-06-13 15:45:32 +02:00
Moritz 3894d5abc1
Prepare release of `3.2.0` (#637)
* Prepare release of `3.2.0`

* Add newline

* Do not change API outside of major version rev

* Change `main` to `master` in workflow

* yml -> yaml
2023-06-13 12:48:11 +02:00
Moritz f420b77a22
Switch to Dart 3 (#633)
* Switch to Dart 3

* Trying to get the new version to run

* Fix test

* Switch CI to Dart 3

* Adapt CI

* Do not run vmservice on chrome

* Typo

* Add skip to not fail on `dart test`

* Add changelog entry

* Changes as per review
2023-06-07 10:24:33 +02:00
Kevin Moore 244dea0361
Regenerate code with latest formatter (#630) 2023-05-31 00:00:51 +02:00
dependabot[bot] 201aaa2f99
Bump actions/checkout from 3.5.0 to 3.5.2 (#626)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 3.5.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8f4b7f8486...8e5e7e5ab8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 14:45:56 -07:00
Nate Bosch 14824dd5d8
Export the Code protobuf (#625) 2023-04-27 10:02:10 +02:00
Nate Bosch 7be6275f03
Check for closed StreamController in more places (#623) 2023-04-21 21:34:00 +02:00
Nate Bosch a1a8e92e38
Add a ChannelShutdownHandler callback (#620)
Add a way to react to the channel shutdown or termination with an
optional callback.

This is not necessarily the API which I would recommend, but this is the
APi that was already inappropriately shipped and in use internally.
2023-04-21 12:01:54 -07:00
Nate Bosch e8893cd08a
Extend StreamView over DelegatingStream (#619)
The `StreamView` class from the SDK provides all the worthwhile behavior
of `DelegatingStream` and the latter may soon be deprecated.
2023-04-19 09:55:56 -07:00
dependabot[bot] 20bad4c410
Bump actions/checkout from 3.3.0 to 3.5.0 (#615)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](ac59398561...8f4b7f8486)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 10:04:30 -07:00
dependabot[bot] d8adea21fb
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#616)
Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](a57a6c04cf...d6a63dab33)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 09:56:51 -07:00
dependabot[bot] eb833d3f1c
Bump dart-lang/setup-dart from 1.3.0 to 1.4.0 (#608)
Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](6a218f2413...a57a6c04cf)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 22:34:40 -08:00
dependabot[bot] b757b80769
Bump actions/checkout from 3.2.0 to 3.3.0 (#603)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](755da8c3cf...ac59398561)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
2023-02-03 13:49:32 -08:00
Brett Morgan 3f223823ea
Add `pub` updates to `dependabot` (#602) 2023-02-01 19:21:57 +11:00
Kevin Moore 375d1f3e75
examples/grpc-web: support latest build_web_compilers (#601) 2023-01-30 13:49:28 -08:00
nghialv d4d0f80d02
Fix wrong command in readme of example (#600) 2023-01-20 10:36:57 +01:00
dependabot[bot] 867d1173fa
Bump actions/checkout from 3.1.0 to 3.2.0 (#598)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](93ea575cb5...755da8c3cf)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-18 14:46:13 -08:00
Vyacheslav Egorov 26deabdfd2
Revert "Remove or skip callbacks on old connections" (#593) 2022-12-13 21:40:09 +01:00
Ben Getsug d0e3a4c706
Expose client IP address to server (#590) 2022-12-13 09:12:28 +01:00
Jakob Borg 4dc6e2b252
Remove or skip callbacks on old connections (#522)
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
Fixes https://github.com/grpc/grpc-dart/issues/521
2022-12-12 10:43:16 +01:00
MattyBoy 60311a7492
Added ability to set connectTimeout of socket (#575) 2022-12-12 09:54:23 +01:00
Ben Getsug 6c0829ed8b
Custom Error Handling for Server (#588)
Closes https://github.com/grpc/grpc-dart/issues/51
2022-12-01 11:29:57 +01:00
Kevin Moore dbf5421eb6
Cleanup: update to and use latest pkg:lints with associated fixes (#587)
Bump min Dart SDK for grpc to 2.17
Regenerate all code
Fix generate scripts
Add dependabot
2022-10-31 11:47:31 -07:00
Vyacheslav Egorov 19ba902d7e
Add false_secrets to pubspec.yaml (#586) 2022-10-27 15:02:22 +02:00
Vyacheslav Egorov e97711aece
Prepare 3.1.0 release (#585) 2022-10-27 13:55:39 +02:00
Vyacheslav Egorov 27a235976a
Change default authority for UDS connections. (#577)
We were using path to the UDS socket itself, which is incorrect `:authority` value. 

This was tripping checks in some HTTP2 protocol implementations.

Instead default `:authority` to `localhost`, which in line with other gRPC implementations.

Fixes #576
2022-09-08 14:41:34 +02:00
Rui Craveiro b8f872a3dc
Send trailers included on GrpcError object (#538) 2022-08-23 12:40:03 +02:00
Cobinja af965f15f7
Expose onConnectionStateChanged for channels (#565)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2022-08-15 15:03:51 +02:00
Alexander Aprelev 94b71a3e1c
Ensure server's security context is used for the server. (#547) 2022-04-27 13:03:08 +02:00
Brett Morgan 7e2c2665cf
Migrate examples to Dart null safety (#536) 2022-01-04 10:05:22 +10:00
Kevin Moore 151fa904b4
Remove unnecessary imports and superfluous type checks (#525) 2021-10-05 08:39:00 -07:00
Kevin Moore 276fd5a70f
Fix web build by using build_runner directly (#523) 2021-09-13 10:51:20 -07:00
Vyacheslav Egorov 7cced9282a
Fix compilation with DDC (#516)
b272632450 exposed client certificate through 
`X509Certificate? get clientCertificate;` getter on `ServiceCall` class. This broke 
compilation of `grpc_web` code using DDC, but not dart2js. Turns out that dart2js is 
happy to compile any code using `dart:io` (though the result will not run if you try
to use any of those APIs), but DDC rejects such code eagerly. `package:test` runs 
tests through `dart2js` so DDC breakage was not really caught by CI. 

Unfortunately this discrepancy between DDC and dart2js puts us in some really weird 
spot: most of our tests are platform independent, but most of those tests also 
pull in `dart:io` through transitive dependencies.

This commit is the most minimal change we could make to allow the code compile both 
on the Web and natively. 

A proper fix should be to go through tests one-by-one and make sure that those that
need to run on the Web don't import `dart:io`, but we don't have time to do that 
right now. 

This commit also adds a smoke test to the CI to verify that `grpc_web` example 
builds with DDC.
2021-08-16 14:52:36 +02:00
Vyacheslav Egorov c2fb47c8a4
Prepare to release 3.0.1 (#514) 2021-08-10 12:03:14 +02:00
Kenneth Gulbrandsøy acd2e93a25
Add custom trailers to GrpcError (#493) 2021-08-10 11:53:09 +02:00
Vyacheslav Egorov 4775078b8c
Fix interop tests (#513) 2021-08-10 11:15:39 +02:00
Vyacheslav Egorov e9ad5ab16b
Fix CI
* Reformat code with dev build of dartfmt

* Download envoy package manually
2021-08-10 11:04:11 +02:00
Alexander Bosak c982597fae
useTestCA argument checking fix (#495) 2021-07-01 14:06:25 +02:00
Alexander 6d9bb1057a
Fix interop/bin/server.dart after NNBD migration (#494) 2021-06-30 14:24:45 +02:00
Bálint Böde f5508d9801
Fix a typo on the inner invoker parameters (#492) 2021-06-29 23:56:12 +02:00
Tyler Gaw f23070ee85
grpc_or_grpcweb.dart: exporting shared types #486 (#487) 2021-06-13 08:24:28 +02:00
Piotr Morgwai Kotarbinski d4504dacf1
GrpcOrGrpcWeb: provide more flexible constructors (#484) (#485) 2021-06-08 11:14:57 +02:00
Piotr Morgwai Kotarbinski 7c8fca7195
GrpcOrGrpcWeb: remove checking if ports are different (#482) (#483)
* GrpcOrGrpcWeb: remove checking if ports are different (#482)

Using the same port is a standard for AspNetCore gRPC server.

* improve source docs
2021-06-03 12:56:02 +02:00
Piotr Morgwai Kotarbinski e88b84a993
Add GrpcOrGrpcWebClientChannel (#457) (#479) 2021-06-02 12:25:23 +02:00
EPNW b272632450
Make clientCertificate available in ServiceCall (#472)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-05-11 13:35:36 +02:00
Vyacheslav Egorov 2f5ef8c663
Fix directives_ordering lint (#473) 2021-05-03 17:00:44 +02:00
Kevin Moore 9a4493f934
Update dependencies (#471) 2021-04-22 14:28:30 -07:00
Daniel Brauner 6c16fceb2a
Be more resilient to broken deployments (#460)
Require 200 HTTP status and a supported Content-Type
header to be present in a response.

When handling malformed responses make effort
to translate HTTP statuses into gRPC statuses as
gRPC protocol specification recommends.

Fixes #421
Fixes #458 

Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-22 17:22:32 +01:00
Kevin Moore fb0c27a78a
Require latest googleapis_auth to avoid deprecated API usage (#455) 2021-03-08 14:32:55 -08:00
Kevin Moore ee0e7ec351
Avoid completing multiplet times for one error (#454)
Also:
* updated SDK constraint to stable
* Use latest Dart action install
* Test on oldest supported SDK
2021-03-08 09:55:59 -08:00
209 changed files with 11991 additions and 5954 deletions

40
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,40 @@
# Set update schedule for GitHub Actions
# See https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/example/googleapis"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/example/grpc-web"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/example/helloworld"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/example/metadata"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/example/route_guide"
schedule:
interval: "weekly"
- package-ecosystem: "pub"
directory: "/interop"
schedule:
interval: "weekly"

View File

@ -16,17 +16,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [dev, beta]
sdk: [stable, dev]
steps:
- uses: actions/checkout@v2
- uses: cedx/setup-dart@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
release-channel: ${{ matrix.sdk }}
sdk: ${{ matrix.sdk }}
- name: Report version
run: dart --version
- name: Install dependencies
run: dart pub get
- name: Check formatting
- name: Check formatting (using dev dartfmt release)
if: ${{ matrix.sdk == 'stable' }}
run: dart format --output=none --set-exit-if-changed .
- name: Analyze code (introp and examples)
run: |
@ -39,6 +40,15 @@ jobs:
shell: bash
- name: Analyze code
run: dart analyze --fatal-infos .
- name: Check that grpc-web sample builds with DDC
if: ${{ matrix.sdk == 'dev' }}
# build_runner build --no-release to force compilation with DDC.
run: |
pushd example/grpc-web
rm -rf build
dart pub run build_runner build --no-release -o web:build
test -f ./build/main.dart.js
popd
# Run tests on a matrix consisting of three dimensions:
# 1. OS: mac, windows, linux
@ -50,7 +60,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [dev, beta]
sdk: [stable, dev]
platform: [vm, chrome]
exclude:
# We only run Chrome tests on Linux. No need to run them
@ -60,22 +70,21 @@ jobs:
- os: macos-latest
platform: chrome
steps:
- uses: actions/checkout@v2
- uses: cedx/setup-dart@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
release-channel: ${{ matrix.sdk }}
sdk: ${{ matrix.sdk }}
- name: Report version
run: dart --version
- name: Install envoy
if: ${{ matrix.platform == 'chrome' }}
run: |
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -sL 'https://getenvoy.io/gpg' | sudo apt-key add -
apt-key fingerprint 6FF974DB | grep "5270 CEAC 57F6 3EBD 9EA9 005D 0253 D0B2 6FF9 74DB"
sudo add-apt-repository "deb [arch=amd64] https://dl.bintray.com/tetrate/getenvoy-deb $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y getenvoy-envoy
ENVOY_VERSION="1.19.0"
wget https://archive.tetratelabs.io/envoy/download/v${ENVOY_VERSION}/envoy-v${ENVOY_VERSION}-linux-amd64.tar.xz
tar -xf envoy-v${ENVOY_VERSION}-linux-amd64.tar.xz
chmod +x envoy-v${ENVOY_VERSION}-linux-amd64/bin/envoy
sudo mv envoy-v${ENVOY_VERSION}-linux-amd64/bin/envoy /usr/bin/envoy
rm -rf envoy-v${ENVOY_VERSION}-linux-amd64.tar.xz envoy-v${ENVOY_VERSION}-linux-amd64
env:
MATRIX_OS: ${{ matrix.os }}
shell: bash
@ -83,3 +92,6 @@ jobs:
run: dart pub get
- name: Run tests
run: dart test --platform ${{ matrix.platform }}
- name: Run vmservice test
if: ${{ matrix.platform != 'chrome' }}
run: dart run --enable-vm-service --timeline-streams=Dart test/timeline_test.dart

14
.github/workflows/health.yaml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Health
on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
health:
uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
with:
checks: "changelog,do-not-submit,breaking,leaking"
permissions:
pull-requests: write

18
.github/workflows/post_summaries.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Comment on the pull request
on:
# Trigger this workflow after the given workflows completes.
# This workflow will have permissions to do things like create comments on the
# PR, even if the original workflow couldn't.
workflow_run:
workflows:
- Health
- Publish
types:
- completed
jobs:
upload:
uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main
permissions:
pull-requests: write

18
.github/workflows/publish.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
# A CI configuration to auto-publish pub packages.
name: Publish
on:
pull_request:
branches: [ master ]
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
jobs:
publish:
uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
with:
write-comments: false
permissions:
id-token: write
pull-requests: write

View File

@ -1,3 +1,120 @@
## 4.2.0-wip
- Require Dart 3.8.
- Export a protobuf generated symbol (`Any`)
- Dart format all files for the new 3.8 formatter.
- Require package:googleapis_auth
- Require package:http 1.4.0
- Require package:lints 6.0.0
- Require package:protobuf 4.1.0
- Simplify hierarchy of `ResponseFuture` (no longer have a private class in the
type hierarchy)
## 4.1.0
* Add a `serverInterceptors` argument to `ConnectionServer`. These interceptors
are acting as middleware, wrapping a `ServiceMethod` invocation.
* Make sure that `CallOptions.mergeWith` is symmetric: given `WebCallOptions`
it should return `WebCallOptions`.
## 4.0.4
* Allow the latest `package:googleapis_auth`.
## 4.0.3
* Widen `package:protobuf` constraint to allow version 4.0.0.
## 4.0.2
* Internal optimization to client code.
* Small fixes, such as ports in testing and enabling `timeline_test.dart`.
* When the keep alive manager runs into a timeout, it will finish the transport
instead of closing the connection, as defined in the gRPC spec.
* Upgrade to `package:lints` version 5.0.0 and Dart SDK version 3.5.0.
* Upgrade `example/grpc-web` code.
* Update xhr transport to migrate off legacy JS/HTML apis.
* Use `package:web` to get `HttpStatus`.
* Fix `package:web` deprecations.
## 4.0.1
* Fix header and trailing not completing if the call is terminated. Fixes [#727](https://github.com/grpc/grpc-dart/issues/727)
## 4.0.0
* Set compressed flag correctly for grpc-encoding = identity. Fixes [#669](https://github.com/grpc/grpc-dart/issues/669) (https://github.com/grpc/grpc-dart/pull/693)
* Remove generated status codes.
* Remove dependency on `package:archive`.
* Move `codec.dart`.
* Work around hang during Flutter hot restart by adding default case handler in _GrpcWebConversionSink.add.
## 3.2.4
* Forward internal `GrpcError` on when throwing while sending a request.
* Add support for proxies, see [#33](https://github.com/grpc/grpc-dart/issues/33).
* Remove canceled `ServerHandler`s from tracking list.
* Fix regression on fetching the remote address of a closed socket.
## 3.2.3
* Add const constructor to `GrpcError` fixing #606.
* Make `GrpcError` non-final to allow implementations.
* Only send keepalive pings on open connections.
* Fix interop tests.
## 3.2.2
* Remove `base` qualifier on `ResponseStream`.
* Add support for clients to send KEEPALIVE pings.
## 3.2.1
* `package:http` now supports more versions: `>=0.13.0 <2.0.0`.
* `package:protobuf` new supports more versions: `>=2.0.0 <4.0.0`.
## 3.2.0
* `ChannelOptions` now exposes `connectTimeout`, which is used on the
socket connect. This is used to specify the maximum allowed time to wait
for a connection to be established. If `connectTime` is longer than the system
level timeout duration, a timeout may occur sooner than specified in
`connectTimeout`. On timeout, a `SocketException` is thrown.
* Require Dart 2.17 or greater.
* Fix issue [#51](https://github.com/grpc/grpc-dart/issues/51), add support for custom error handling.
* Expose client IP address to server
* Add a `channelShutdownHandler` argument to `ClientChannel` and the subclasses.
This callback can be used to react to channel shutdown or termination.
* Export the `Code` protobuf enum from the `grpc.dart` library.
* Require Dart 3.0.0 or greater.
## 3.1.0
* Expose a stream for connection state changes on ClientChannel to address
[#428](https://github.com/grpc/grpc-dart/issues/428).
This allows users to react to state changes in the connection.
* Fix [#576](https://github.com/grpc/grpc-dart/issues/576): set default
`:authority` value for UDS connections to `localhost` instead of using
UDS path. Using path triggers checks in HTTP2 servers which
attempt to validate `:authority` value.
## 3.0.2
* Fix compilation on the Web with DDC.
## 3.0.1
* Require `package:googleapis_auth` `^1.1.0`
* Fix issues [#421](https://github.com/grpc/grpc-dart/issues/421) and
[#458](https://github.com/grpc/grpc-dart/issues/458). Validate
responses according to gRPC/gRPC-Web protocol specifications: require
200 HTTP status and a supported `Content-Type` header to be present, as well
as `grpc-status: 0` header. When handling malformed responses make effort
to translate HTTP statuses into gRPC statuses.
* Add GrpcOrGrpcWebClientChannel which uses gRPC on all platforms except web,
on which it uses gRPC-web.
* `GrpcError` now exposes response trailers via `GrpcError.trailers`.
## 3.0.0
* Migrate library and tests to null safety.

View File

@ -25,7 +25,7 @@ it should raise analysis issues as you edit; alternatively validate from the
Terminal:
```
dartanalyzer lib test
dart analyze
```
All analysis warnings and errors must be fixed; hints should be considered.
@ -33,8 +33,7 @@ All analysis warnings and errors must be fixed; hints should be considered.
## Running tests
```
pub get
pub run test
dart test
```
gRPC-web tests require [`envoy`](
@ -69,4 +68,4 @@ early on.
so.
## Updating protobuf definitions
Sometimes we might need to update the generated dart files from the protos included in `lib/src/protos`. To do this, run the script `tool/regenerate.sh` from the project root and it will update the generated dart files in `lib/src/geneerated`.
Sometimes we might need to update the generated dart files from the protos included in `lib/src/protos`. To do this, run the script `tool/regenerate.sh` from the project root and it will update the generated dart files in `lib/src/generated`.

View File

@ -1,14 +1,13 @@
The [Dart](https://www.dart.dev/) implementation of
[gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.
[![CI status](https://github.com/grpc/grpc-dart/workflows/Dart/badge.svg)](https://github.com/grpc/grpc-dart/actions?query=workflow%3A%22Dart%22+branch%3Amaster)
[![Dart](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml/badge.svg)](https://github.com/grpc/grpc-dart/actions/workflows/dart.yml)
[![pub package](https://img.shields.io/pub/v/grpc.svg)](https://pub.dev/packages/grpc)
The [Dart](https://www.dart.dev/) implementation of
[gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.
## Learn more
- [Quick Start](https://grpc.io/docs/languages/dart/quickstart) - get an app running in minutes
- [Examples](example)
- [Examples](https://github.com/grpc/grpc-dart/tree/master/example)
- [API reference](https://grpc.io/docs/languages/dart/api)
For complete documentation, see [Dart gRPC](https://grpc.io/docs/languages/dart).

View File

@ -1,56 +1,21 @@
# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
include: package:lints/recommended.yaml
analyzer:
errors:
# These should be fixed or ignored in the proto generator.
implementation_imports: ignore
no_leading_underscores_for_local_identifiers: ignore
unintended_html_in_doc_comment: ignore
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_empty_else
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_relative_lib_imports
- avoid_return_types_on_setters
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- camel_case_extensions
- cancel_subscriptions
- close_sinks
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- hash_and_equals
- iterable_contains_unrelated_type
- library_names
- library_prefixes
- list_remove_unrelated_type
- no_duplicate_case_values
- null_closures
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- recursive_getters
- slash_for_doc_comments
- strict_top_level_inference
- test_types_in_equals
- type_init_formals
- unnecessary_const
- unnecessary_new
- unnecessary_null_in_if_null_operators
- unnecessary_this
- unrelated_type_equality_checks
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps

View File

@ -1,7 +1,7 @@
Four code examples are available:
1. [helloworld](https://github.com/grpc/grpc-dart/tree/master/example/helloworld):
A demonstration of using the Dart gRPC library to perform unary RPs.
A demonstration of using the Dart gRPC library to perform unary RPCs.
1. [googleapis](https://github.com/grpc/grpc-dart/tree/master/example/googleapis):
A demonstration of using the Dart gRPC library to communicate with Google APIs.

View File

@ -19,13 +19,13 @@ To run the example, assuming you are in the root of the googleapis folder, i.e.,
.../example/googleapis/, first get the dependencies by running:
```sh
$ pub get
$ dart pub get
```
Then, to run the logging client sample:
```sh
$ pub run googleapis:logging
$ dart run bin/logging.dart
```
# Regenerate the stubs

View File

@ -1,5 +1 @@
include: ../../analysis_options.yaml
linter:
rules:
directives_ordering: false

View File

@ -16,18 +16,19 @@
import 'dart:async';
import 'dart:io';
import 'package:grpc/grpc.dart';
import 'package:googleapis/src/generated/google/api/monitored_resource.pb.dart';
import 'package:googleapis/src/generated/google/logging/type/log_severity.pb.dart';
import 'package:googleapis/src/generated/google/logging/v2/log_entry.pb.dart';
import 'package:googleapis/src/generated/google/logging/v2/logging.pbgrpc.dart';
import 'package:grpc/grpc.dart';
Future<void> main() async {
final serviceAccountFile = File('logging-service-account.json');
if (!serviceAccountFile.existsSync()) {
print('File logging-service-account.json not found. Please follow the '
'steps in README.md to create it.');
print(
'File logging-service-account.json not found. Please follow the '
'steps in README.md to create it.',
);
exit(-1);
}
@ -37,19 +38,25 @@ Future<void> main() async {
];
final authenticator = ServiceAccountAuthenticator(
serviceAccountFile.readAsStringSync(), scopes);
serviceAccountFile.readAsStringSync(),
scopes,
);
final projectId = authenticator.projectId;
final channel = ClientChannel('logging.googleapis.com');
final logging =
LoggingServiceV2Client(channel, options: authenticator.toCallOptions);
final logging = LoggingServiceV2Client(
channel,
options: authenticator.toCallOptions,
);
final request = WriteLogEntriesRequest()
..entries.add(LogEntry()
..logName = 'projects/$projectId/logs/example'
..severity = LogSeverity.INFO
..resource = (MonitoredResource()..type = 'global')
..textPayload = 'This is a log entry!');
..entries.add(
LogEntry()
..logName = 'projects/$projectId/logs/example'
..severity = LogSeverity.INFO
..resource = (MonitoredResource()..type = 'global')
..textPayload = 'This is a log entry!',
);
await logging.writeLogEntries(request);
await channel.shutdown();

View File

@ -1,9 +1,13 @@
///
//
// Generated code. Do not modify.
// source: google/api/label.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
@ -13,58 +17,46 @@ import 'label.pbenum.dart';
export 'label.pbenum.dart';
/// A description of a label.
class LabelDescriptor extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'LabelDescriptor',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.api'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'key')
..e<LabelDescriptor_ValueType>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'valueType',
$pb.PbFieldType.OE,
defaultOrMaker: LabelDescriptor_ValueType.STRING,
valueOf: LabelDescriptor_ValueType.valueOf,
enumValues: LabelDescriptor_ValueType.values)
..aOS(
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'description')
..hasRequiredFields = false;
LabelDescriptor._() : super();
factory LabelDescriptor({
$core.String key,
LabelDescriptor_ValueType valueType,
$core.String description,
$core.String? key,
LabelDescriptor_ValueType? valueType,
$core.String? description,
}) {
final _result = create();
final result = create();
if (key != null) {
_result.key = key;
result.key = key;
}
if (valueType != null) {
_result.valueType = valueType;
result.valueType = valueType;
}
if (description != null) {
_result.description = description;
result.description = description;
}
return _result;
return result;
}
LabelDescriptor._() : super();
factory LabelDescriptor.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LabelDescriptor.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'LabelDescriptor',
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'key')
..e<LabelDescriptor_ValueType>(
2, _omitFieldNames ? '' : 'valueType', $pb.PbFieldType.OE,
defaultOrMaker: LabelDescriptor_ValueType.STRING,
valueOf: LabelDescriptor_ValueType.valueOf,
enumValues: LabelDescriptor_ValueType.values)
..aOS(3, _omitFieldNames ? '' : 'description')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -73,9 +65,11 @@ class LabelDescriptor extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
LabelDescriptor copyWith(void Function(LabelDescriptor) updates) =>
super.copyWith((message) =>
updates(message as LabelDescriptor)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as LabelDescriptor))
as LabelDescriptor;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static LabelDescriptor create() => LabelDescriptor._();
LabelDescriptor createEmptyInstance() => create();
@ -84,8 +78,9 @@ class LabelDescriptor extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static LabelDescriptor getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
static LabelDescriptor _defaultInstance;
static LabelDescriptor? _defaultInstance;
/// The label key.
@$pb.TagNumber(1)
$core.String get key => $_getSZ(0);
@$pb.TagNumber(1)
@ -98,6 +93,7 @@ class LabelDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearKey() => clearField(1);
/// The type of data that can be assigned to the label.
@$pb.TagNumber(2)
LabelDescriptor_ValueType get valueType => $_getN(1);
@$pb.TagNumber(2)
@ -110,6 +106,7 @@ class LabelDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearValueType() => clearField(2);
/// A human-readable description for the label.
@$pb.TagNumber(3)
$core.String get description => $_getSZ(2);
@$pb.TagNumber(3)
@ -122,3 +119,7 @@ class LabelDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearDescription() => clearField(3);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,30 +1,26 @@
///
//
// Generated code. Do not modify.
// source: google/api/label.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// Value types that can be used as label values.
class LabelDescriptor_ValueType extends $pb.ProtobufEnum {
static const LabelDescriptor_ValueType STRING = LabelDescriptor_ValueType._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'STRING');
static const LabelDescriptor_ValueType BOOL = LabelDescriptor_ValueType._(
1,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'BOOL');
static const LabelDescriptor_ValueType INT64 = LabelDescriptor_ValueType._(
2,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'INT64');
static const LabelDescriptor_ValueType STRING =
LabelDescriptor_ValueType._(0, _omitEnumNames ? '' : 'STRING');
static const LabelDescriptor_ValueType BOOL =
LabelDescriptor_ValueType._(1, _omitEnumNames ? '' : 'BOOL');
static const LabelDescriptor_ValueType INT64 =
LabelDescriptor_ValueType._(2, _omitEnumNames ? '' : 'INT64');
static const $core.List<LabelDescriptor_ValueType> values =
<LabelDescriptor_ValueType>[
@ -35,7 +31,9 @@ class LabelDescriptor_ValueType extends $pb.ProtobufEnum {
static final $core.Map<$core.int, LabelDescriptor_ValueType> _byValue =
$pb.ProtobufEnum.initByValue(values);
static LabelDescriptor_ValueType valueOf($core.int value) => _byValue[value];
static LabelDescriptor_ValueType? valueOf($core.int value) => _byValue[value];
const LabelDescriptor_ValueType._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,15 +1,24 @@
///
//
// Generated code. Do not modify.
// source: google/api/label.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const LabelDescriptor$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use labelDescriptorDescriptor instead')
const LabelDescriptor$json = {
'1': 'LabelDescriptor',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{
'1': 'value_type',
'3': 2,
'4': 1,
@ -17,16 +26,24 @@ const LabelDescriptor$json = const {
'6': '.google.api.LabelDescriptor.ValueType',
'10': 'valueType'
},
const {'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
{'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
],
'4': const [LabelDescriptor_ValueType$json],
'4': [LabelDescriptor_ValueType$json],
};
const LabelDescriptor_ValueType$json = const {
@$core.Deprecated('Use labelDescriptorDescriptor instead')
const LabelDescriptor_ValueType$json = {
'1': 'ValueType',
'2': const [
const {'1': 'STRING', '2': 0},
const {'1': 'BOOL', '2': 1},
const {'1': 'INT64', '2': 2},
'2': [
{'1': 'STRING', '2': 0},
{'1': 'BOOL', '2': 1},
{'1': 'INT64', '2': 2},
],
};
/// Descriptor for `LabelDescriptor`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List labelDescriptorDescriptor = $convert.base64Decode(
'Cg9MYWJlbERlc2NyaXB0b3ISEAoDa2V5GAEgASgJUgNrZXkSRAoKdmFsdWVfdHlwZRgCIAEoDj'
'IlLmdvb2dsZS5hcGkuTGFiZWxEZXNjcmlwdG9yLlZhbHVlVHlwZVIJdmFsdWVUeXBlEiAKC2Rl'
'c2NyaXB0aW9uGAMgASgJUgtkZXNjcmlwdGlvbiIsCglWYWx1ZVR5cGUSCgoGU1RSSU5HEAASCA'
'oEQk9PTBABEgkKBUlOVDY0EAI=');

View File

@ -1,9 +1,13 @@
///
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;

View File

@ -1,52 +1,36 @@
///
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// The launch stage as defined by [Google Cloud Platform
/// Launch Stages](https://cloud.google.com/terms/launch-stages).
class LaunchStage extends $pb.ProtobufEnum {
static const LaunchStage LAUNCH_STAGE_UNSPECIFIED = LaunchStage._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'LAUNCH_STAGE_UNSPECIFIED');
static const LaunchStage UNIMPLEMENTED = LaunchStage._(
6,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'UNIMPLEMENTED');
static const LaunchStage PRELAUNCH = LaunchStage._(
7,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'PRELAUNCH');
static const LaunchStage EARLY_ACCESS = LaunchStage._(
1,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'EARLY_ACCESS');
static const LaunchStage ALPHA = LaunchStage._(
2,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'ALPHA');
static const LaunchStage BETA = LaunchStage._(
3,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'BETA');
static const LaunchStage GA = LaunchStage._(4,
const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GA');
static const LaunchStage DEPRECATED = LaunchStage._(
5,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'DEPRECATED');
static const LaunchStage LAUNCH_STAGE_UNSPECIFIED =
LaunchStage._(0, _omitEnumNames ? '' : 'LAUNCH_STAGE_UNSPECIFIED');
static const LaunchStage UNIMPLEMENTED =
LaunchStage._(6, _omitEnumNames ? '' : 'UNIMPLEMENTED');
static const LaunchStage PRELAUNCH =
LaunchStage._(7, _omitEnumNames ? '' : 'PRELAUNCH');
static const LaunchStage EARLY_ACCESS =
LaunchStage._(1, _omitEnumNames ? '' : 'EARLY_ACCESS');
static const LaunchStage ALPHA =
LaunchStage._(2, _omitEnumNames ? '' : 'ALPHA');
static const LaunchStage BETA =
LaunchStage._(3, _omitEnumNames ? '' : 'BETA');
static const LaunchStage GA = LaunchStage._(4, _omitEnumNames ? '' : 'GA');
static const LaunchStage DEPRECATED =
LaunchStage._(5, _omitEnumNames ? '' : 'DEPRECATED');
static const $core.List<LaunchStage> values = <LaunchStage>[
LAUNCH_STAGE_UNSPECIFIED,
@ -61,7 +45,9 @@ class LaunchStage extends $pb.ProtobufEnum {
static final $core.Map<$core.int, LaunchStage> _byValue =
$pb.ProtobufEnum.initByValue(values);
static LaunchStage valueOf($core.int value) => _byValue[value];
static LaunchStage? valueOf($core.int value) => _byValue[value];
const LaunchStage._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,20 +1,35 @@
///
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const LaunchStage$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use launchStageDescriptor instead')
const LaunchStage$json = {
'1': 'LaunchStage',
'2': const [
const {'1': 'LAUNCH_STAGE_UNSPECIFIED', '2': 0},
const {'1': 'UNIMPLEMENTED', '2': 6},
const {'1': 'PRELAUNCH', '2': 7},
const {'1': 'EARLY_ACCESS', '2': 1},
const {'1': 'ALPHA', '2': 2},
const {'1': 'BETA', '2': 3},
const {'1': 'GA', '2': 4},
const {'1': 'DEPRECATED', '2': 5},
'2': [
{'1': 'LAUNCH_STAGE_UNSPECIFIED', '2': 0},
{'1': 'UNIMPLEMENTED', '2': 6},
{'1': 'PRELAUNCH', '2': 7},
{'1': 'EARLY_ACCESS', '2': 1},
{'1': 'ALPHA', '2': 2},
{'1': 'BETA', '2': 3},
{'1': 'GA', '2': 4},
{'1': 'DEPRECATED', '2': 5},
],
};
/// Descriptor for `LaunchStage`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List launchStageDescriptor = $convert.base64Decode(
'CgtMYXVuY2hTdGFnZRIcChhMQVVOQ0hfU1RBR0VfVU5TUEVDSUZJRUQQABIRCg1VTklNUExFTU'
'VOVEVEEAYSDQoJUFJFTEFVTkNIEAcSEAoMRUFSTFlfQUNDRVNTEAESCQoFQUxQSEEQAhIICgRC'
'RVRBEAMSBgoCR0EQBBIOCgpERVBSRUNBVEVEEAU=');

View File

@ -1,87 +1,88 @@
///
//
// Generated code. Do not modify.
// source: google/api/monitored_resource.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'label.pb.dart' as $0;
import '../protobuf/struct.pb.dart' as $1;
import 'label.pb.dart' as $0;
import 'launch_stage.pbenum.dart' as $2;
/// An object that describes the schema of a
/// [MonitoredResource][google.api.MonitoredResource] object using a type name
/// and a set of labels. For example, the monitored resource descriptor for
/// Google Compute Engine VM instances has a type of
/// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
/// `"zone"` to identify particular VM instances.
///
/// Different APIs can support different monitored resource types. APIs generally
/// provide a `list` method that returns the monitored resource descriptors used
/// by the API.
class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'MonitoredResourceDescriptor',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.api'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'type')
..aOS(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'displayName')
..aOS(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'description')
..pc<$0.LabelDescriptor>(
4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'labels', $pb.PbFieldType.PM,
subBuilder: $0.LabelDescriptor.create)
..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..e<$2.LaunchStage>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'launchStage', $pb.PbFieldType.OE, defaultOrMaker: $2.LaunchStage.LAUNCH_STAGE_UNSPECIFIED, valueOf: $2.LaunchStage.valueOf, enumValues: $2.LaunchStage.values)
..hasRequiredFields = false;
MonitoredResourceDescriptor._() : super();
factory MonitoredResourceDescriptor({
$core.String type,
$core.String displayName,
$core.String description,
$core.Iterable<$0.LabelDescriptor> labels,
$core.String name,
$2.LaunchStage launchStage,
$core.String? type,
$core.String? displayName,
$core.String? description,
$core.Iterable<$0.LabelDescriptor>? labels,
$core.String? name,
$2.LaunchStage? launchStage,
}) {
final _result = create();
final result = create();
if (type != null) {
_result.type = type;
result.type = type;
}
if (displayName != null) {
_result.displayName = displayName;
result.displayName = displayName;
}
if (description != null) {
_result.description = description;
result.description = description;
}
if (labels != null) {
_result.labels.addAll(labels);
result.labels.addAll(labels);
}
if (name != null) {
_result.name = name;
result.name = name;
}
if (launchStage != null) {
_result.launchStage = launchStage;
result.launchStage = launchStage;
}
return _result;
return result;
}
MonitoredResourceDescriptor._() : super();
factory MonitoredResourceDescriptor.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory MonitoredResourceDescriptor.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'MonitoredResourceDescriptor',
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'type')
..aOS(2, _omitFieldNames ? '' : 'displayName')
..aOS(3, _omitFieldNames ? '' : 'description')
..pc<$0.LabelDescriptor>(
4, _omitFieldNames ? '' : 'labels', $pb.PbFieldType.PM,
subBuilder: $0.LabelDescriptor.create)
..aOS(5, _omitFieldNames ? '' : 'name')
..e<$2.LaunchStage>(
7, _omitFieldNames ? '' : 'launchStage', $pb.PbFieldType.OE,
defaultOrMaker: $2.LaunchStage.LAUNCH_STAGE_UNSPECIFIED,
valueOf: $2.LaunchStage.valueOf,
enumValues: $2.LaunchStage.values)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -92,9 +93,12 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
'Will be removed in next major version')
MonitoredResourceDescriptor copyWith(
void Function(MonitoredResourceDescriptor) updates) =>
super.copyWith((message) => updates(message
as MonitoredResourceDescriptor)); // ignore: deprecated_member_use
super.copyWith(
(message) => updates(message as MonitoredResourceDescriptor))
as MonitoredResourceDescriptor;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MonitoredResourceDescriptor create() =>
MonitoredResourceDescriptor._();
@ -104,8 +108,14 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static MonitoredResourceDescriptor getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceDescriptor>(create);
static MonitoredResourceDescriptor _defaultInstance;
static MonitoredResourceDescriptor? _defaultInstance;
/// Required. The monitored resource type. For example, the type
/// `"cloudsql_database"` represents databases in Google Cloud SQL.
/// For a list of types, see [Monitoring resource
/// types](https://cloud.google.com/monitoring/api/resources)
/// and [Logging resource
/// types](https://cloud.google.com/logging/docs/api/v2/resource-list).
@$pb.TagNumber(1)
$core.String get type => $_getSZ(0);
@$pb.TagNumber(1)
@ -118,6 +128,10 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearType() => clearField(1);
/// Optional. A concise name for the monitored resource type that might be
/// displayed in user interfaces. It should be a Title Cased Noun Phrase,
/// without any article or other determiners. For example,
/// `"Google Cloud SQL Database"`.
@$pb.TagNumber(2)
$core.String get displayName => $_getSZ(1);
@$pb.TagNumber(2)
@ -130,6 +144,8 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearDisplayName() => clearField(2);
/// Optional. A detailed description of the monitored resource type that might
/// be used in documentation.
@$pb.TagNumber(3)
$core.String get description => $_getSZ(2);
@$pb.TagNumber(3)
@ -142,9 +158,18 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearDescription() => clearField(3);
/// Required. A set of labels used to describe instances of this monitored
/// resource type. For example, an individual Google Cloud SQL database is
/// identified by values for the labels `"database_id"` and `"zone"`.
@$pb.TagNumber(4)
$core.List<$0.LabelDescriptor> get labels => $_getList(3);
/// Optional. The resource name of the monitored resource descriptor:
/// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
/// {type} is the value of the `type` field in this object and
/// {project_id} is a project ID that provides API-specific context for
/// accessing the type. APIs that do not use project information can use the
/// resource name format `"monitoredResourceDescriptors/{type}"`.
@$pb.TagNumber(5)
$core.String get name => $_getSZ(4);
@$pb.TagNumber(5)
@ -157,6 +182,7 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
@$pb.TagNumber(5)
void clearName() => clearField(5);
/// Optional. The launch stage of the monitored resource definition.
@$pb.TagNumber(7)
$2.LaunchStage get launchStage => $_getN(5);
@$pb.TagNumber(7)
@ -170,52 +196,56 @@ class MonitoredResourceDescriptor extends $pb.GeneratedMessage {
void clearLaunchStage() => clearField(7);
}
/// An object representing a resource that can be used for monitoring, logging,
/// billing, or other purposes. Examples include virtual machine instances,
/// databases, and storage devices such as disks. The `type` field identifies a
/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object
/// that describes the resource's schema. Information in the `labels` field
/// identifies the actual resource and its attributes according to the schema.
/// For example, a particular Compute Engine VM instance could be represented by
/// the following object, because the
/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for
/// `"gce_instance"` has labels
/// `"project_id"`, `"instance_id"` and `"zone"`:
///
/// { "type": "gce_instance",
/// "labels": { "project_id": "my-project",
/// "instance_id": "12345678901234",
/// "zone": "us-central1-a" }}
class MonitoredResource extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'MonitoredResource',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.api'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'type')
..m<$core.String, $core.String>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'labels',
entryClassName: 'MonitoredResource.LabelsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OS,
packageName: const $pb.PackageName('google.api'))
..hasRequiredFields = false;
MonitoredResource._() : super();
factory MonitoredResource({
$core.String type,
$core.Map<$core.String, $core.String> labels,
$core.String? type,
$core.Map<$core.String, $core.String>? labels,
}) {
final _result = create();
final result = create();
if (type != null) {
_result.type = type;
result.type = type;
}
if (labels != null) {
_result.labels.addAll(labels);
result.labels.addAll(labels);
}
return _result;
return result;
}
MonitoredResource._() : super();
factory MonitoredResource.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory MonitoredResource.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'MonitoredResource',
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'type')
..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'labels',
entryClassName: 'MonitoredResource.LabelsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OS,
packageName: const $pb.PackageName('google.api'))
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -224,9 +254,11 @@ class MonitoredResource extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MonitoredResource copyWith(void Function(MonitoredResource) updates) =>
super.copyWith((message) => updates(
message as MonitoredResource)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as MonitoredResource))
as MonitoredResource;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MonitoredResource create() => MonitoredResource._();
MonitoredResource createEmptyInstance() => create();
@ -235,8 +267,15 @@ class MonitoredResource extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static MonitoredResource getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResource>(create);
static MonitoredResource _defaultInstance;
static MonitoredResource? _defaultInstance;
/// Required. The monitored resource type. This field must match
/// the `type` field of a
/// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
/// object. For example, the type of a Compute Engine VM instance is
/// `gce_instance`. Some descriptors include the service name in the type; for
/// example, the type of a Datastream stream is
/// `datastream.googleapis.com/Stream`.
@$pb.TagNumber(1)
$core.String get type => $_getSZ(0);
@$pb.TagNumber(1)
@ -249,54 +288,54 @@ class MonitoredResource extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearType() => clearField(1);
/// Required. Values for all of the labels listed in the associated monitored
/// resource descriptor. For example, Compute Engine VM instances use the
/// labels `"project_id"`, `"instance_id"`, and `"zone"`.
@$pb.TagNumber(2)
$core.Map<$core.String, $core.String> get labels => $_getMap(1);
}
/// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource]
/// object. [MonitoredResource][google.api.MonitoredResource] objects contain the
/// minimum set of information to uniquely identify a monitored resource
/// instance. There is some other useful auxiliary metadata. Monitoring and
/// Logging use an ingestion pipeline to extract metadata for cloud resources of
/// all types, and store the metadata in this message.
class MonitoredResourceMetadata extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'MonitoredResourceMetadata',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.api'),
createEmptyInstance: create)
..aOM<$1.Struct>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'systemLabels',
subBuilder: $1.Struct.create)
..m<$core.String, $core.String>(
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userLabels',
entryClassName: 'MonitoredResourceMetadata.UserLabelsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OS,
packageName: const $pb.PackageName('google.api'))
..hasRequiredFields = false;
MonitoredResourceMetadata._() : super();
factory MonitoredResourceMetadata({
$1.Struct systemLabels,
$core.Map<$core.String, $core.String> userLabels,
$1.Struct? systemLabels,
$core.Map<$core.String, $core.String>? userLabels,
}) {
final _result = create();
final result = create();
if (systemLabels != null) {
_result.systemLabels = systemLabels;
result.systemLabels = systemLabels;
}
if (userLabels != null) {
_result.userLabels.addAll(userLabels);
result.userLabels.addAll(userLabels);
}
return _result;
return result;
}
MonitoredResourceMetadata._() : super();
factory MonitoredResourceMetadata.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory MonitoredResourceMetadata.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'MonitoredResourceMetadata',
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.api'),
createEmptyInstance: create)
..aOM<$1.Struct>(1, _omitFieldNames ? '' : 'systemLabels',
subBuilder: $1.Struct.create)
..m<$core.String, $core.String>(2, _omitFieldNames ? '' : 'userLabels',
entryClassName: 'MonitoredResourceMetadata.UserLabelsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OS,
packageName: const $pb.PackageName('google.api'))
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -307,9 +346,11 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
'Will be removed in next major version')
MonitoredResourceMetadata copyWith(
void Function(MonitoredResourceMetadata) updates) =>
super.copyWith((message) => updates(message
as MonitoredResourceMetadata)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as MonitoredResourceMetadata))
as MonitoredResourceMetadata;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MonitoredResourceMetadata create() => MonitoredResourceMetadata._();
MonitoredResourceMetadata createEmptyInstance() => create();
@ -318,8 +359,18 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static MonitoredResourceMetadata getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceMetadata>(create);
static MonitoredResourceMetadata _defaultInstance;
static MonitoredResourceMetadata? _defaultInstance;
/// Output only. Values for predefined system metadata labels.
/// System labels are a kind of metadata extracted by Google, including
/// "machine_image", "vpc", "subnet_id",
/// "security_group", "name", etc.
/// System label values can be only strings, Boolean values, or a list of
/// strings. For example:
///
/// { "name": "my-test-instance",
/// "security_group": ["a", "b", "c"],
/// "spot_instance": false }
@$pb.TagNumber(1)
$1.Struct get systemLabels => $_getN(0);
@$pb.TagNumber(1)
@ -334,6 +385,11 @@ class MonitoredResourceMetadata extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
$1.Struct ensureSystemLabels() => $_ensure(0);
/// Output only. A map of user-defined metadata labels.
@$pb.TagNumber(2)
$core.Map<$core.String, $core.String> get userLabels => $_getMap(1);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/api/monitored_resource.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,18 +1,27 @@
///
//
// Generated code. Do not modify.
// source: google/api/monitored_resource.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const MonitoredResourceDescriptor$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use monitoredResourceDescriptorDescriptor instead')
const MonitoredResourceDescriptor$json = {
'1': 'MonitoredResourceDescriptor',
'2': const [
const {'1': 'name', '3': 5, '4': 1, '5': 9, '10': 'name'},
const {'1': 'type', '3': 1, '4': 1, '5': 9, '10': 'type'},
const {'1': 'display_name', '3': 2, '4': 1, '5': 9, '10': 'displayName'},
const {'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
const {
'2': [
{'1': 'name', '3': 5, '4': 1, '5': 9, '10': 'name'},
{'1': 'type', '3': 1, '4': 1, '5': 9, '10': 'type'},
{'1': 'display_name', '3': 2, '4': 1, '5': 9, '10': 'displayName'},
{'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
{
'1': 'labels',
'3': 4,
'4': 3,
@ -20,7 +29,7 @@ const MonitoredResourceDescriptor$json = const {
'6': '.google.api.LabelDescriptor',
'10': 'labels'
},
const {
{
'1': 'launch_stage',
'3': 7,
'4': 1,
@ -31,11 +40,20 @@ const MonitoredResourceDescriptor$json = const {
],
};
const MonitoredResource$json = const {
/// Descriptor for `MonitoredResourceDescriptor`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List monitoredResourceDescriptorDescriptor = $convert.base64Decode(
'ChtNb25pdG9yZWRSZXNvdXJjZURlc2NyaXB0b3ISEgoEbmFtZRgFIAEoCVIEbmFtZRISCgR0eX'
'BlGAEgASgJUgR0eXBlEiEKDGRpc3BsYXlfbmFtZRgCIAEoCVILZGlzcGxheU5hbWUSIAoLZGVz'
'Y3JpcHRpb24YAyABKAlSC2Rlc2NyaXB0aW9uEjMKBmxhYmVscxgEIAMoCzIbLmdvb2dsZS5hcG'
'kuTGFiZWxEZXNjcmlwdG9yUgZsYWJlbHMSOgoMbGF1bmNoX3N0YWdlGAcgASgOMhcuZ29vZ2xl'
'LmFwaS5MYXVuY2hTdGFnZVILbGF1bmNoU3RhZ2U=');
@$core.Deprecated('Use monitoredResourceDescriptor instead')
const MonitoredResource$json = {
'1': 'MonitoredResource',
'2': const [
const {'1': 'type', '3': 1, '4': 1, '5': 9, '10': 'type'},
const {
'2': [
{'1': 'type', '3': 1, '4': 1, '5': 9, '10': 'type'},
{
'1': 'labels',
'3': 2,
'4': 3,
@ -44,22 +62,30 @@ const MonitoredResource$json = const {
'10': 'labels'
},
],
'3': const [MonitoredResource_LabelsEntry$json],
'3': [MonitoredResource_LabelsEntry$json],
};
const MonitoredResource_LabelsEntry$json = const {
@$core.Deprecated('Use monitoredResourceDescriptor instead')
const MonitoredResource_LabelsEntry$json = {
'1': 'LabelsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
],
'7': const {'7': true},
'7': {'7': true},
};
const MonitoredResourceMetadata$json = const {
/// Descriptor for `MonitoredResource`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List monitoredResourceDescriptor = $convert.base64Decode(
'ChFNb25pdG9yZWRSZXNvdXJjZRISCgR0eXBlGAEgASgJUgR0eXBlEkEKBmxhYmVscxgCIAMoCz'
'IpLmdvb2dsZS5hcGkuTW9uaXRvcmVkUmVzb3VyY2UuTGFiZWxzRW50cnlSBmxhYmVscxo5CgtM'
'YWJlbHNFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YWx1ZRgCIAEoCVIFdmFsdWU6AjgB');
@$core.Deprecated('Use monitoredResourceMetadataDescriptor instead')
const MonitoredResourceMetadata$json = {
'1': 'MonitoredResourceMetadata',
'2': const [
const {
'2': [
{
'1': 'system_labels',
'3': 1,
'4': 1,
@ -67,7 +93,7 @@ const MonitoredResourceMetadata$json = const {
'6': '.google.protobuf.Struct',
'10': 'systemLabels'
},
const {
{
'1': 'user_labels',
'3': 2,
'4': 3,
@ -76,14 +102,23 @@ const MonitoredResourceMetadata$json = const {
'10': 'userLabels'
},
],
'3': const [MonitoredResourceMetadata_UserLabelsEntry$json],
'3': [MonitoredResourceMetadata_UserLabelsEntry$json],
};
const MonitoredResourceMetadata_UserLabelsEntry$json = const {
@$core.Deprecated('Use monitoredResourceMetadataDescriptor instead')
const MonitoredResourceMetadata_UserLabelsEntry$json = {
'1': 'UserLabelsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
],
'7': const {'7': true},
'7': {'7': true},
};
/// Descriptor for `MonitoredResourceMetadata`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List monitoredResourceMetadataDescriptor = $convert.base64Decode(
'ChlNb25pdG9yZWRSZXNvdXJjZU1ldGFkYXRhEjwKDXN5c3RlbV9sYWJlbHMYASABKAsyFy5nb2'
'9nbGUucHJvdG9idWYuU3RydWN0UgxzeXN0ZW1MYWJlbHMSVgoLdXNlcl9sYWJlbHMYAiADKAsy'
'NS5nb29nbGUuYXBpLk1vbml0b3JlZFJlc291cmNlTWV0YWRhdGEuVXNlckxhYmVsc0VudHJ5Ug'
'p1c2VyTGFiZWxzGj0KD1VzZXJMYWJlbHNFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YWx1'
'ZRgCIAEoCVIFdmFsdWU6AjgB');

View File

@ -1,9 +1,13 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/http_request.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
@ -12,120 +16,106 @@ import 'package:protobuf/protobuf.dart' as $pb;
import '../../protobuf/duration.pb.dart' as $0;
/// A common proto for logging HTTP requests. Only contains semantics
/// defined by the HTTP specification. Product-specific logging
/// information MUST be defined in a separate message.
class HttpRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'HttpRequest',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.logging.type'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'requestMethod')
..aOS(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'requestUrl')
..aInt64(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'requestSize')
..a<$core.int>(
4,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'status',
$pb.PbFieldType.O3)
..aInt64(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'responseSize')
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userAgent')
..aOS(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'remoteIp')
..aOS(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'referer')
..aOB(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cacheHit')
..aOB(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cacheValidatedWithOriginServer')
..aOB(11, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cacheLookup')
..aInt64(12, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cacheFillBytes')
..aOS(13, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'serverIp')
..aOM<$0.Duration>(14, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'latency', subBuilder: $0.Duration.create)
..aOS(15, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'protocol')
..hasRequiredFields = false;
HttpRequest._() : super();
factory HttpRequest({
$core.String requestMethod,
$core.String requestUrl,
$fixnum.Int64 requestSize,
$core.int status,
$fixnum.Int64 responseSize,
$core.String userAgent,
$core.String remoteIp,
$core.String referer,
$core.bool cacheHit,
$core.bool cacheValidatedWithOriginServer,
$core.bool cacheLookup,
$fixnum.Int64 cacheFillBytes,
$core.String serverIp,
$0.Duration latency,
$core.String protocol,
$core.String? requestMethod,
$core.String? requestUrl,
$fixnum.Int64? requestSize,
$core.int? status,
$fixnum.Int64? responseSize,
$core.String? userAgent,
$core.String? remoteIp,
$core.String? referer,
$core.bool? cacheHit,
$core.bool? cacheValidatedWithOriginServer,
$core.bool? cacheLookup,
$fixnum.Int64? cacheFillBytes,
$core.String? serverIp,
$0.Duration? latency,
$core.String? protocol,
}) {
final _result = create();
final result = create();
if (requestMethod != null) {
_result.requestMethod = requestMethod;
result.requestMethod = requestMethod;
}
if (requestUrl != null) {
_result.requestUrl = requestUrl;
result.requestUrl = requestUrl;
}
if (requestSize != null) {
_result.requestSize = requestSize;
result.requestSize = requestSize;
}
if (status != null) {
_result.status = status;
result.status = status;
}
if (responseSize != null) {
_result.responseSize = responseSize;
result.responseSize = responseSize;
}
if (userAgent != null) {
_result.userAgent = userAgent;
result.userAgent = userAgent;
}
if (remoteIp != null) {
_result.remoteIp = remoteIp;
result.remoteIp = remoteIp;
}
if (referer != null) {
_result.referer = referer;
result.referer = referer;
}
if (cacheHit != null) {
_result.cacheHit = cacheHit;
result.cacheHit = cacheHit;
}
if (cacheValidatedWithOriginServer != null) {
_result.cacheValidatedWithOriginServer = cacheValidatedWithOriginServer;
result.cacheValidatedWithOriginServer = cacheValidatedWithOriginServer;
}
if (cacheLookup != null) {
_result.cacheLookup = cacheLookup;
result.cacheLookup = cacheLookup;
}
if (cacheFillBytes != null) {
_result.cacheFillBytes = cacheFillBytes;
result.cacheFillBytes = cacheFillBytes;
}
if (serverIp != null) {
_result.serverIp = serverIp;
result.serverIp = serverIp;
}
if (latency != null) {
_result.latency = latency;
result.latency = latency;
}
if (protocol != null) {
_result.protocol = protocol;
result.protocol = protocol;
}
return _result;
return result;
}
HttpRequest._() : super();
factory HttpRequest.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory HttpRequest.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'HttpRequest',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.logging.type'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'requestMethod')
..aOS(2, _omitFieldNames ? '' : 'requestUrl')
..aInt64(3, _omitFieldNames ? '' : 'requestSize')
..a<$core.int>(4, _omitFieldNames ? '' : 'status', $pb.PbFieldType.O3)
..aInt64(5, _omitFieldNames ? '' : 'responseSize')
..aOS(6, _omitFieldNames ? '' : 'userAgent')
..aOS(7, _omitFieldNames ? '' : 'remoteIp')
..aOS(8, _omitFieldNames ? '' : 'referer')
..aOB(9, _omitFieldNames ? '' : 'cacheHit')
..aOB(10, _omitFieldNames ? '' : 'cacheValidatedWithOriginServer')
..aOB(11, _omitFieldNames ? '' : 'cacheLookup')
..aInt64(12, _omitFieldNames ? '' : 'cacheFillBytes')
..aOS(13, _omitFieldNames ? '' : 'serverIp')
..aOM<$0.Duration>(14, _omitFieldNames ? '' : 'latency',
subBuilder: $0.Duration.create)
..aOS(15, _omitFieldNames ? '' : 'protocol')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -134,9 +124,11 @@ class HttpRequest extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HttpRequest copyWith(void Function(HttpRequest) updates) =>
super.copyWith((message) =>
updates(message as HttpRequest)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as HttpRequest))
as HttpRequest;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static HttpRequest create() => HttpRequest._();
HttpRequest createEmptyInstance() => create();
@ -144,8 +136,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static HttpRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HttpRequest>(create);
static HttpRequest _defaultInstance;
static HttpRequest? _defaultInstance;
/// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
@$pb.TagNumber(1)
$core.String get requestMethod => $_getSZ(0);
@$pb.TagNumber(1)
@ -158,6 +151,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearRequestMethod() => clearField(1);
/// The scheme (http, https), the host name, the path and the query
/// portion of the URL that was requested.
/// Example: `"http://example.com/some/info?color=red"`.
@$pb.TagNumber(2)
$core.String get requestUrl => $_getSZ(1);
@$pb.TagNumber(2)
@ -170,6 +166,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearRequestUrl() => clearField(2);
/// The size of the HTTP request message in bytes, including the request
/// headers and the request body.
@$pb.TagNumber(3)
$fixnum.Int64 get requestSize => $_getI64(2);
@$pb.TagNumber(3)
@ -182,6 +180,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearRequestSize() => clearField(3);
/// The response code indicating the status of response.
/// Examples: 200, 404.
@$pb.TagNumber(4)
$core.int get status => $_getIZ(3);
@$pb.TagNumber(4)
@ -194,6 +194,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(4)
void clearStatus() => clearField(4);
/// The size of the HTTP response message sent back to the client, in bytes,
/// including the response headers and the response body.
@$pb.TagNumber(5)
$fixnum.Int64 get responseSize => $_getI64(4);
@$pb.TagNumber(5)
@ -206,6 +208,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(5)
void clearResponseSize() => clearField(5);
/// The user agent sent by the client. Example:
/// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
/// CLR 1.0.3705)"`.
@$pb.TagNumber(6)
$core.String get userAgent => $_getSZ(5);
@$pb.TagNumber(6)
@ -218,6 +223,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(6)
void clearUserAgent() => clearField(6);
/// The IP address (IPv4 or IPv6) of the client that issued the HTTP
/// request. This field can include port information. Examples:
/// `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`.
@$pb.TagNumber(7)
$core.String get remoteIp => $_getSZ(6);
@$pb.TagNumber(7)
@ -230,6 +238,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(7)
void clearRemoteIp() => clearField(7);
/// The referer URL of the request, as defined in
/// [HTTP/1.1 Header Field
/// Definitions](https://datatracker.ietf.org/doc/html/rfc2616#section-14.36).
@$pb.TagNumber(8)
$core.String get referer => $_getSZ(7);
@$pb.TagNumber(8)
@ -242,6 +253,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(8)
void clearReferer() => clearField(8);
/// Whether or not an entity was served from cache
/// (with or without validation).
@$pb.TagNumber(9)
$core.bool get cacheHit => $_getBF(8);
@$pb.TagNumber(9)
@ -254,6 +267,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(9)
void clearCacheHit() => clearField(9);
/// Whether or not the response was validated with the origin server before
/// being served from cache. This field is only meaningful if `cache_hit` is
/// True.
@$pb.TagNumber(10)
$core.bool get cacheValidatedWithOriginServer => $_getBF(9);
@$pb.TagNumber(10)
@ -266,6 +282,7 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(10)
void clearCacheValidatedWithOriginServer() => clearField(10);
/// Whether or not a cache lookup was attempted.
@$pb.TagNumber(11)
$core.bool get cacheLookup => $_getBF(10);
@$pb.TagNumber(11)
@ -278,6 +295,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(11)
void clearCacheLookup() => clearField(11);
/// The number of HTTP response bytes inserted into cache. Set only when a
/// cache fill was attempted.
@$pb.TagNumber(12)
$fixnum.Int64 get cacheFillBytes => $_getI64(11);
@$pb.TagNumber(12)
@ -290,6 +309,9 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(12)
void clearCacheFillBytes() => clearField(12);
/// The IP address (IPv4 or IPv6) of the origin server that the request was
/// sent to. This field can include port information. Examples:
/// `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`.
@$pb.TagNumber(13)
$core.String get serverIp => $_getSZ(12);
@$pb.TagNumber(13)
@ -302,6 +324,8 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(13)
void clearServerIp() => clearField(13);
/// The request processing latency on the server, from the time the request was
/// received until the response was sent.
@$pb.TagNumber(14)
$0.Duration get latency => $_getN(13);
@$pb.TagNumber(14)
@ -316,6 +340,7 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(14)
$0.Duration ensureLatency() => $_ensure(13);
/// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
@$pb.TagNumber(15)
$core.String get protocol => $_getSZ(14);
@$pb.TagNumber(15)
@ -328,3 +353,7 @@ class HttpRequest extends $pb.GeneratedMessage {
@$pb.TagNumber(15)
void clearProtocol() => clearField(15);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/http_request.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,29 +1,32 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/http_request.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const HttpRequest$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use httpRequestDescriptor instead')
const HttpRequest$json = {
'1': 'HttpRequest',
'2': const [
const {
'1': 'request_method',
'3': 1,
'4': 1,
'5': 9,
'10': 'requestMethod'
},
const {'1': 'request_url', '3': 2, '4': 1, '5': 9, '10': 'requestUrl'},
const {'1': 'request_size', '3': 3, '4': 1, '5': 3, '10': 'requestSize'},
const {'1': 'status', '3': 4, '4': 1, '5': 5, '10': 'status'},
const {'1': 'response_size', '3': 5, '4': 1, '5': 3, '10': 'responseSize'},
const {'1': 'user_agent', '3': 6, '4': 1, '5': 9, '10': 'userAgent'},
const {'1': 'remote_ip', '3': 7, '4': 1, '5': 9, '10': 'remoteIp'},
const {'1': 'server_ip', '3': 13, '4': 1, '5': 9, '10': 'serverIp'},
const {'1': 'referer', '3': 8, '4': 1, '5': 9, '10': 'referer'},
const {
'2': [
{'1': 'request_method', '3': 1, '4': 1, '5': 9, '10': 'requestMethod'},
{'1': 'request_url', '3': 2, '4': 1, '5': 9, '10': 'requestUrl'},
{'1': 'request_size', '3': 3, '4': 1, '5': 3, '10': 'requestSize'},
{'1': 'status', '3': 4, '4': 1, '5': 5, '10': 'status'},
{'1': 'response_size', '3': 5, '4': 1, '5': 3, '10': 'responseSize'},
{'1': 'user_agent', '3': 6, '4': 1, '5': 9, '10': 'userAgent'},
{'1': 'remote_ip', '3': 7, '4': 1, '5': 9, '10': 'remoteIp'},
{'1': 'server_ip', '3': 13, '4': 1, '5': 9, '10': 'serverIp'},
{'1': 'referer', '3': 8, '4': 1, '5': 9, '10': 'referer'},
{
'1': 'latency',
'3': 14,
'4': 1,
@ -31,22 +34,30 @@ const HttpRequest$json = const {
'6': '.google.protobuf.Duration',
'10': 'latency'
},
const {'1': 'cache_lookup', '3': 11, '4': 1, '5': 8, '10': 'cacheLookup'},
const {'1': 'cache_hit', '3': 9, '4': 1, '5': 8, '10': 'cacheHit'},
const {
{'1': 'cache_lookup', '3': 11, '4': 1, '5': 8, '10': 'cacheLookup'},
{'1': 'cache_hit', '3': 9, '4': 1, '5': 8, '10': 'cacheHit'},
{
'1': 'cache_validated_with_origin_server',
'3': 10,
'4': 1,
'5': 8,
'10': 'cacheValidatedWithOriginServer'
},
const {
'1': 'cache_fill_bytes',
'3': 12,
'4': 1,
'5': 3,
'10': 'cacheFillBytes'
},
const {'1': 'protocol', '3': 15, '4': 1, '5': 9, '10': 'protocol'},
{'1': 'cache_fill_bytes', '3': 12, '4': 1, '5': 3, '10': 'cacheFillBytes'},
{'1': 'protocol', '3': 15, '4': 1, '5': 9, '10': 'protocol'},
],
};
/// Descriptor for `HttpRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List httpRequestDescriptor = $convert.base64Decode(
'CgtIdHRwUmVxdWVzdBIlCg5yZXF1ZXN0X21ldGhvZBgBIAEoCVINcmVxdWVzdE1ldGhvZBIfCg'
'tyZXF1ZXN0X3VybBgCIAEoCVIKcmVxdWVzdFVybBIhCgxyZXF1ZXN0X3NpemUYAyABKANSC3Jl'
'cXVlc3RTaXplEhYKBnN0YXR1cxgEIAEoBVIGc3RhdHVzEiMKDXJlc3BvbnNlX3NpemUYBSABKA'
'NSDHJlc3BvbnNlU2l6ZRIdCgp1c2VyX2FnZW50GAYgASgJUgl1c2VyQWdlbnQSGwoJcmVtb3Rl'
'X2lwGAcgASgJUghyZW1vdGVJcBIbCglzZXJ2ZXJfaXAYDSABKAlSCHNlcnZlcklwEhgKB3JlZm'
'VyZXIYCCABKAlSB3JlZmVyZXISMwoHbGF0ZW5jeRgOIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5E'
'dXJhdGlvblIHbGF0ZW5jeRIhCgxjYWNoZV9sb29rdXAYCyABKAhSC2NhY2hlTG9va3VwEhsKCW'
'NhY2hlX2hpdBgJIAEoCFIIY2FjaGVIaXQSSgoiY2FjaGVfdmFsaWRhdGVkX3dpdGhfb3JpZ2lu'
'X3NlcnZlchgKIAEoCFIeY2FjaGVWYWxpZGF0ZWRXaXRoT3JpZ2luU2VydmVyEigKEGNhY2hlX2'
'ZpbGxfYnl0ZXMYDCABKANSDmNhY2hlRmlsbEJ5dGVzEhoKCHByb3RvY29sGA8gASgJUghwcm90'
'b2NvbA==');

View File

@ -1,9 +1,13 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/log_severity.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;

View File

@ -1,60 +1,52 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/log_severity.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// The severity of the event described in a log entry, expressed as one of the
/// standard severity levels listed below. For your reference, the levels are
/// assigned the listed numeric values. The effect of using numeric values other
/// than those listed is undefined.
///
/// You can filter for log entries by severity. For example, the following
/// filter expression will match log entries with severities `INFO`, `NOTICE`,
/// and `WARNING`:
///
/// severity > DEBUG AND severity <= WARNING
///
/// If you are writing log entries, you should map other severity encodings to
/// one of these standard levels. For example, you might map all of Java's FINE,
/// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
/// original severity level in the log entry payload if you wish.
class LogSeverity extends $pb.ProtobufEnum {
static const LogSeverity DEFAULT = LogSeverity._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'DEFAULT');
static const LogSeverity DEBUG = LogSeverity._(
100,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'DEBUG');
static const LogSeverity INFO = LogSeverity._(
200,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'INFO');
static const LogSeverity NOTICE = LogSeverity._(
300,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'NOTICE');
static const LogSeverity WARNING = LogSeverity._(
400,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'WARNING');
static const LogSeverity ERROR = LogSeverity._(
500,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'ERROR');
static const LogSeverity CRITICAL = LogSeverity._(
600,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'CRITICAL');
static const LogSeverity ALERT = LogSeverity._(
700,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'ALERT');
static const LogSeverity EMERGENCY = LogSeverity._(
800,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'EMERGENCY');
static const LogSeverity DEFAULT =
LogSeverity._(0, _omitEnumNames ? '' : 'DEFAULT');
static const LogSeverity DEBUG =
LogSeverity._(100, _omitEnumNames ? '' : 'DEBUG');
static const LogSeverity INFO =
LogSeverity._(200, _omitEnumNames ? '' : 'INFO');
static const LogSeverity NOTICE =
LogSeverity._(300, _omitEnumNames ? '' : 'NOTICE');
static const LogSeverity WARNING =
LogSeverity._(400, _omitEnumNames ? '' : 'WARNING');
static const LogSeverity ERROR =
LogSeverity._(500, _omitEnumNames ? '' : 'ERROR');
static const LogSeverity CRITICAL =
LogSeverity._(600, _omitEnumNames ? '' : 'CRITICAL');
static const LogSeverity ALERT =
LogSeverity._(700, _omitEnumNames ? '' : 'ALERT');
static const LogSeverity EMERGENCY =
LogSeverity._(800, _omitEnumNames ? '' : 'EMERGENCY');
static const $core.List<LogSeverity> values = <LogSeverity>[
DEFAULT,
@ -70,7 +62,9 @@ class LogSeverity extends $pb.ProtobufEnum {
static final $core.Map<$core.int, LogSeverity> _byValue =
$pb.ProtobufEnum.initByValue(values);
static LogSeverity valueOf($core.int value) => _byValue[value];
static LogSeverity? valueOf($core.int value) => _byValue[value];
const LogSeverity._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,21 +1,36 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/log_severity.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const LogSeverity$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use logSeverityDescriptor instead')
const LogSeverity$json = {
'1': 'LogSeverity',
'2': const [
const {'1': 'DEFAULT', '2': 0},
const {'1': 'DEBUG', '2': 100},
const {'1': 'INFO', '2': 200},
const {'1': 'NOTICE', '2': 300},
const {'1': 'WARNING', '2': 400},
const {'1': 'ERROR', '2': 500},
const {'1': 'CRITICAL', '2': 600},
const {'1': 'ALERT', '2': 700},
const {'1': 'EMERGENCY', '2': 800},
'2': [
{'1': 'DEFAULT', '2': 0},
{'1': 'DEBUG', '2': 100},
{'1': 'INFO', '2': 200},
{'1': 'NOTICE', '2': 300},
{'1': 'WARNING', '2': 400},
{'1': 'ERROR', '2': 500},
{'1': 'CRITICAL', '2': 600},
{'1': 'ALERT', '2': 700},
{'1': 'EMERGENCY', '2': 800},
],
};
/// Descriptor for `LogSeverity`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List logSeverityDescriptor = $convert.base64Decode(
'CgtMb2dTZXZlcml0eRILCgdERUZBVUxUEAASCQoFREVCVUcQZBIJCgRJTkZPEMgBEgsKBk5PVE'
'lDRRCsAhIMCgdXQVJOSU5HEJADEgoKBUVSUk9SEPQDEg0KCENSSVRJQ0FMENgEEgoKBUFMRVJU'
'ELwFEg4KCUVNRVJHRU5DWRCgBg==');

View File

@ -1,26 +1,111 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/log_entry.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;
import '../../api/monitored_resource.pb.dart' as $3;
import '../../protobuf/any.pb.dart' as $0;
import '../../protobuf/struct.pb.dart' as $1;
import '../type/http_request.pb.dart' as $2;
import '../../api/monitored_resource.pb.dart' as $3;
import '../../protobuf/timestamp.pb.dart' as $4;
import '../type/http_request.pb.dart' as $2;
import '../type/log_severity.pbenum.dart' as $5;
enum LogEntry_Payload { protoPayload, textPayload, jsonPayload, notSet }
/// An individual entry in a log.
class LogEntry extends $pb.GeneratedMessage {
factory LogEntry({
$0.Any? protoPayload,
$core.String? textPayload,
$core.String? insertId,
$1.Struct? jsonPayload,
$2.HttpRequest? httpRequest,
$3.MonitoredResource? resource,
$4.Timestamp? timestamp,
$5.LogSeverity? severity,
$core.Map<$core.String, $core.String>? labels,
$core.String? logName,
LogEntryOperation? operation,
$core.String? trace,
LogEntrySourceLocation? sourceLocation,
$4.Timestamp? receiveTimestamp,
$core.String? spanId,
$core.bool? traceSampled,
LogSplit? split,
}) {
final result = create();
if (protoPayload != null) {
result.protoPayload = protoPayload;
}
if (textPayload != null) {
result.textPayload = textPayload;
}
if (insertId != null) {
result.insertId = insertId;
}
if (jsonPayload != null) {
result.jsonPayload = jsonPayload;
}
if (httpRequest != null) {
result.httpRequest = httpRequest;
}
if (resource != null) {
result.resource = resource;
}
if (timestamp != null) {
result.timestamp = timestamp;
}
if (severity != null) {
result.severity = severity;
}
if (labels != null) {
result.labels.addAll(labels);
}
if (logName != null) {
result.logName = logName;
}
if (operation != null) {
result.operation = operation;
}
if (trace != null) {
result.trace = trace;
}
if (sourceLocation != null) {
result.sourceLocation = sourceLocation;
}
if (receiveTimestamp != null) {
result.receiveTimestamp = receiveTimestamp;
}
if (spanId != null) {
result.spanId = spanId;
}
if (traceSampled != null) {
result.traceSampled = traceSampled;
}
if (split != null) {
result.split = split;
}
return result;
}
LogEntry._() : super();
factory LogEntry.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LogEntry.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static const $core.Map<$core.int, LogEntry_Payload> _LogEntry_PayloadByTag = {
2: LogEntry_Payload.protoPayload,
3: LogEntry_Payload.textPayload,
@ -28,115 +113,47 @@ class LogEntry extends $pb.GeneratedMessage {
0: LogEntry_Payload.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'LogEntry',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.logging.v2'),
_omitMessageNames ? '' : 'LogEntry',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.logging.v2'),
createEmptyInstance: create)
..oo(0, [2, 3, 6])
..aOM<$0.Any>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'protoPayload',
..aOM<$0.Any>(2, _omitFieldNames ? '' : 'protoPayload',
subBuilder: $0.Any.create)
..aOS(3,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'textPayload')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertId')
..aOM<$1.Struct>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'jsonPayload', subBuilder: $1.Struct.create)
..aOM<$2.HttpRequest>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'httpRequest', subBuilder: $2.HttpRequest.create)
..aOM<$3.MonitoredResource>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'resource', subBuilder: $3.MonitoredResource.create)
..aOM<$4.Timestamp>(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timestamp', subBuilder: $4.Timestamp.create)
..e<$5.LogSeverity>(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'severity', $pb.PbFieldType.OE, defaultOrMaker: $5.LogSeverity.DEFAULT, valueOf: $5.LogSeverity.valueOf, enumValues: $5.LogSeverity.values)
..m<$core.String, $core.String>(11, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'labels', entryClassName: 'LogEntry.LabelsEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS, packageName: const $pb.PackageName('google.logging.v2'))
..aOS(12, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'logName')
..aOM<LogEntryOperation>(15, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'operation', subBuilder: LogEntryOperation.create)
..aOS(22, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trace')
..aOM<LogEntrySourceLocation>(23, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sourceLocation', subBuilder: LogEntrySourceLocation.create)
..aOM<$4.Timestamp>(24, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'receiveTimestamp', subBuilder: $4.Timestamp.create)
..aOS(27, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'spanId')
..aOB(30, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'traceSampled')
..aOS(3, _omitFieldNames ? '' : 'textPayload')
..aOS(4, _omitFieldNames ? '' : 'insertId')
..aOM<$1.Struct>(6, _omitFieldNames ? '' : 'jsonPayload',
subBuilder: $1.Struct.create)
..aOM<$2.HttpRequest>(7, _omitFieldNames ? '' : 'httpRequest',
subBuilder: $2.HttpRequest.create)
..aOM<$3.MonitoredResource>(8, _omitFieldNames ? '' : 'resource',
subBuilder: $3.MonitoredResource.create)
..aOM<$4.Timestamp>(9, _omitFieldNames ? '' : 'timestamp',
subBuilder: $4.Timestamp.create)
..e<$5.LogSeverity>(
10, _omitFieldNames ? '' : 'severity', $pb.PbFieldType.OE,
defaultOrMaker: $5.LogSeverity.DEFAULT,
valueOf: $5.LogSeverity.valueOf,
enumValues: $5.LogSeverity.values)
..m<$core.String, $core.String>(11, _omitFieldNames ? '' : 'labels',
entryClassName: 'LogEntry.LabelsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OS,
packageName: const $pb.PackageName('google.logging.v2'))
..aOS(12, _omitFieldNames ? '' : 'logName')
..aOM<LogEntryOperation>(15, _omitFieldNames ? '' : 'operation',
subBuilder: LogEntryOperation.create)
..aOS(22, _omitFieldNames ? '' : 'trace')
..aOM<LogEntrySourceLocation>(23, _omitFieldNames ? '' : 'sourceLocation',
subBuilder: LogEntrySourceLocation.create)
..aOM<$4.Timestamp>(24, _omitFieldNames ? '' : 'receiveTimestamp',
subBuilder: $4.Timestamp.create)
..aOS(27, _omitFieldNames ? '' : 'spanId')
..aOB(30, _omitFieldNames ? '' : 'traceSampled')
..aOM<LogSplit>(35, _omitFieldNames ? '' : 'split',
subBuilder: LogSplit.create)
..hasRequiredFields = false;
LogEntry._() : super();
factory LogEntry({
$0.Any protoPayload,
$core.String textPayload,
$core.String insertId,
$1.Struct jsonPayload,
$2.HttpRequest httpRequest,
$3.MonitoredResource resource,
$4.Timestamp timestamp,
$5.LogSeverity severity,
$core.Map<$core.String, $core.String> labels,
$core.String logName,
LogEntryOperation operation,
$core.String trace,
LogEntrySourceLocation sourceLocation,
$4.Timestamp receiveTimestamp,
$core.String spanId,
$core.bool traceSampled,
}) {
final _result = create();
if (protoPayload != null) {
_result.protoPayload = protoPayload;
}
if (textPayload != null) {
_result.textPayload = textPayload;
}
if (insertId != null) {
_result.insertId = insertId;
}
if (jsonPayload != null) {
_result.jsonPayload = jsonPayload;
}
if (httpRequest != null) {
_result.httpRequest = httpRequest;
}
if (resource != null) {
_result.resource = resource;
}
if (timestamp != null) {
_result.timestamp = timestamp;
}
if (severity != null) {
_result.severity = severity;
}
if (labels != null) {
_result.labels.addAll(labels);
}
if (logName != null) {
_result.logName = logName;
}
if (operation != null) {
_result.operation = operation;
}
if (trace != null) {
_result.trace = trace;
}
if (sourceLocation != null) {
_result.sourceLocation = sourceLocation;
}
if (receiveTimestamp != null) {
_result.receiveTimestamp = receiveTimestamp;
}
if (spanId != null) {
_result.spanId = spanId;
}
if (traceSampled != null) {
_result.traceSampled = traceSampled;
}
return _result;
}
factory LogEntry.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LogEntry.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -145,9 +162,10 @@ class LogEntry extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
LogEntry copyWith(void Function(LogEntry) updates) =>
super.copyWith((message) =>
updates(message as LogEntry)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as LogEntry)) as LogEntry;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static LogEntry create() => LogEntry._();
LogEntry createEmptyInstance() => create();
@ -155,11 +173,19 @@ class LogEntry extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static LogEntry getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<LogEntry>(create);
static LogEntry _defaultInstance;
static LogEntry? _defaultInstance;
LogEntry_Payload whichPayload() => _LogEntry_PayloadByTag[$_whichOneof(0)];
LogEntry_Payload whichPayload() => _LogEntry_PayloadByTag[$_whichOneof(0)]!;
void clearPayload() => clearField($_whichOneof(0));
/// The log entry payload, represented as a protocol buffer. Some Google
/// Cloud Platform services use this field for their log entry payloads.
///
/// The following protocol buffer types are supported; user-defined types
/// are not supported:
///
/// "type.googleapis.com/google.cloud.audit.AuditLog"
/// "type.googleapis.com/google.appengine.logging.v1.RequestLog"
@$pb.TagNumber(2)
$0.Any get protoPayload => $_getN(0);
@$pb.TagNumber(2)
@ -174,6 +200,7 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
$0.Any ensureProtoPayload() => $_ensure(0);
/// The log entry payload, represented as a Unicode string (UTF-8).
@$pb.TagNumber(3)
$core.String get textPayload => $_getSZ(1);
@$pb.TagNumber(3)
@ -186,6 +213,17 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearTextPayload() => clearField(3);
/// Optional. A unique identifier for the log entry. If you provide a value,
/// then Logging considers other log entries in the same project, with the same
/// `timestamp`, and with the same `insert_id` to be duplicates which are
/// removed in a single query result. However, there are no guarantees of
/// de-duplication in the export of logs.
///
/// If the `insert_id` is omitted when writing a log entry, the Logging API
/// assigns its own unique identifier in this field.
///
/// In queries, the `insert_id` is also used to order log entries that have
/// the same `log_name` and `timestamp` values.
@$pb.TagNumber(4)
$core.String get insertId => $_getSZ(2);
@$pb.TagNumber(4)
@ -198,6 +236,8 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(4)
void clearInsertId() => clearField(4);
/// The log entry payload, represented as a structure that is
/// expressed as a JSON object.
@$pb.TagNumber(6)
$1.Struct get jsonPayload => $_getN(3);
@$pb.TagNumber(6)
@ -212,6 +252,8 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(6)
$1.Struct ensureJsonPayload() => $_ensure(3);
/// Optional. Information about the HTTP request associated with this log
/// entry, if applicable.
@$pb.TagNumber(7)
$2.HttpRequest get httpRequest => $_getN(4);
@$pb.TagNumber(7)
@ -226,6 +268,11 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(7)
$2.HttpRequest ensureHttpRequest() => $_ensure(4);
/// Required. The monitored resource that produced this log entry.
///
/// Example: a log entry that reports a database error would be associated with
/// the monitored resource designating the particular database that reported
/// the error.
@$pb.TagNumber(8)
$3.MonitoredResource get resource => $_getN(5);
@$pb.TagNumber(8)
@ -240,6 +287,18 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(8)
$3.MonitoredResource ensureResource() => $_ensure(5);
/// Optional. The time the event described by the log entry occurred. This time
/// is used to compute the log entry's age and to enforce the logs retention
/// period. If this field is omitted in a new log entry, then Logging assigns
/// it the current time. Timestamps have nanosecond accuracy, but trailing
/// zeros in the fractional seconds might be omitted when the timestamp is
/// displayed.
///
/// Incoming log entries must have timestamps that don't exceed the
/// [logs retention
/// period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
/// the past, and that don't exceed 24 hours in the future. Log entries outside
/// those time boundaries aren't ingested by Logging.
@$pb.TagNumber(9)
$4.Timestamp get timestamp => $_getN(6);
@$pb.TagNumber(9)
@ -254,6 +313,8 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(9)
$4.Timestamp ensureTimestamp() => $_ensure(6);
/// Optional. The severity of the log entry. The default value is
/// `LogSeverity.DEFAULT`.
@$pb.TagNumber(10)
$5.LogSeverity get severity => $_getN(7);
@$pb.TagNumber(10)
@ -266,9 +327,46 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(10)
void clearSeverity() => clearField(10);
/// Optional. A map of key, value pairs that provides additional information
/// about the log entry. The labels can be user-defined or system-defined.
///
/// User-defined labels are arbitrary key, value pairs that you can use to
/// classify logs.
///
/// System-defined labels are defined by GCP services for platform logs.
/// They have two components - a service namespace component and the
/// attribute name. For example: `compute.googleapis.com/resource_name`.
///
/// Cloud Logging truncates label keys that exceed 512 B and label
/// values that exceed 64 KB upon their associated log entry being
/// written. The truncation is indicated by an ellipsis at the
/// end of the character string.
@$pb.TagNumber(11)
$core.Map<$core.String, $core.String> get labels => $_getMap(8);
/// Required. The resource name of the log to which this log entry belongs:
///
/// "projects/[PROJECT_ID]/logs/[LOG_ID]"
/// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
/// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
/// "folders/[FOLDER_ID]/logs/[LOG_ID]"
///
/// A project number may be used in place of PROJECT_ID. The project number is
/// translated to its corresponding PROJECT_ID internally and the `log_name`
/// field will contain PROJECT_ID in queries and exports.
///
/// `[LOG_ID]` must be URL-encoded within `log_name`. Example:
/// `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
///
/// `[LOG_ID]` must be less than 512 characters long and can only include the
/// following characters: upper and lower case alphanumeric characters,
/// forward-slash, underscore, hyphen, and period.
///
/// For backward compatibility, if `log_name` begins with a forward-slash, such
/// as `/projects/...`, then the log entry is ingested as usual, but the
/// forward-slash is removed. Listing the log entry will not show the leading
/// slash and filtering for a log name with a leading slash will never return
/// any results.
@$pb.TagNumber(12)
$core.String get logName => $_getSZ(9);
@$pb.TagNumber(12)
@ -281,6 +379,8 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(12)
void clearLogName() => clearField(12);
/// Optional. Information about an operation associated with the log entry, if
/// applicable.
@$pb.TagNumber(15)
LogEntryOperation get operation => $_getN(10);
@$pb.TagNumber(15)
@ -295,6 +395,15 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(15)
LogEntryOperation ensureOperation() => $_ensure(10);
/// Optional. The REST resource name of the trace being written to
/// [Cloud Trace](https://cloud.google.com/trace) in
/// association with this log entry. For example, if your trace data is stored
/// in the Cloud project "my-trace-project" and if the service that is creating
/// the log entry receives a trace header that includes the trace ID "12345",
/// then the service should use "projects/my-tracing-project/traces/12345".
///
/// The `trace` field provides the link between logs and traces. By using
/// this field, you can navigate from a log entry to a trace.
@$pb.TagNumber(22)
$core.String get trace => $_getSZ(11);
@$pb.TagNumber(22)
@ -307,6 +416,8 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(22)
void clearTrace() => clearField(22);
/// Optional. Source code location information associated with the log entry,
/// if any.
@$pb.TagNumber(23)
LogEntrySourceLocation get sourceLocation => $_getN(12);
@$pb.TagNumber(23)
@ -321,6 +432,7 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(23)
LogEntrySourceLocation ensureSourceLocation() => $_ensure(12);
/// Output only. The time the log entry was received by Logging.
@$pb.TagNumber(24)
$4.Timestamp get receiveTimestamp => $_getN(13);
@$pb.TagNumber(24)
@ -335,6 +447,36 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(24)
$4.Timestamp ensureReceiveTimestamp() => $_ensure(13);
/// Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span
/// associated with the current operation in which the log is being written.
/// For example, if a span has the REST resource name of
/// "projects/some-project/traces/some-trace/spans/some-span-id", then the
/// `span_id` field is "some-span-id".
///
/// A
/// [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span)
/// represents a single operation within a trace. Whereas a trace may involve
/// multiple different microservices running on multiple different machines,
/// a span generally corresponds to a single logical operation being performed
/// in a single instance of a microservice on one specific machine. Spans
/// are the nodes within the tree that is a trace.
///
/// Applications that are [instrumented for
/// tracing](https://cloud.google.com/trace/docs/setup) will generally assign a
/// new, unique span ID on each incoming request. It is also common to create
/// and record additional spans corresponding to internal processing elements
/// as well as issuing requests to dependencies.
///
/// The span ID is expected to be a 16-character, hexadecimal encoding of an
/// 8-byte array and should not be zero. It should be unique within the trace
/// and should, ideally, be generated in a manner that is uniformly random.
///
/// Example values:
///
/// - `000000000000004a`
/// - `7a2190356c3fc94b`
/// - `0000f00300090021`
/// - `d39223e101960076`
@$pb.TagNumber(27)
$core.String get spanId => $_getSZ(14);
@$pb.TagNumber(27)
@ -347,6 +489,13 @@ class LogEntry extends $pb.GeneratedMessage {
@$pb.TagNumber(27)
void clearSpanId() => clearField(27);
/// Optional. The sampling decision of the trace associated with the log entry.
///
/// True means that the trace resource name in the `trace` field was sampled
/// for storage in a trace backend. False means that the trace was not sampled
/// for storage when this log entry was written, or the sampling decision was
/// unknown at the time. A non-sampled `trace` value is still useful as a
/// request correlation identifier. The default is False.
@$pb.TagNumber(30)
$core.bool get traceSampled => $_getBF(15);
@$pb.TagNumber(30)
@ -358,65 +507,67 @@ class LogEntry extends $pb.GeneratedMessage {
$core.bool hasTraceSampled() => $_has(15);
@$pb.TagNumber(30)
void clearTraceSampled() => clearField(30);
/// Optional. Information indicating this LogEntry is part of a sequence of
/// multiple log entries split from a single LogEntry.
@$pb.TagNumber(35)
LogSplit get split => $_getN(16);
@$pb.TagNumber(35)
set split(LogSplit v) {
setField(35, v);
}
@$pb.TagNumber(35)
$core.bool hasSplit() => $_has(16);
@$pb.TagNumber(35)
void clearSplit() => clearField(35);
@$pb.TagNumber(35)
LogSplit ensureSplit() => $_ensure(16);
}
/// Additional information about a potentially long-running operation with which
/// a log entry is associated.
class LogEntryOperation extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'LogEntryOperation',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.logging.v2'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'id')
..aOS(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'producer')
..aOB(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'first')
..aOB(4,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'last')
..hasRequiredFields = false;
LogEntryOperation._() : super();
factory LogEntryOperation({
$core.String id,
$core.String producer,
$core.bool first,
$core.bool last,
$core.String? id,
$core.String? producer,
$core.bool? first,
$core.bool? last,
}) {
final _result = create();
final result = create();
if (id != null) {
_result.id = id;
result.id = id;
}
if (producer != null) {
_result.producer = producer;
result.producer = producer;
}
if (first != null) {
_result.first = first;
result.first = first;
}
if (last != null) {
_result.last = last;
result.last = last;
}
return _result;
return result;
}
LogEntryOperation._() : super();
factory LogEntryOperation.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LogEntryOperation.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'LogEntryOperation',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.logging.v2'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'id')
..aOS(2, _omitFieldNames ? '' : 'producer')
..aOB(3, _omitFieldNames ? '' : 'first')
..aOB(4, _omitFieldNames ? '' : 'last')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -425,9 +576,11 @@ class LogEntryOperation extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
LogEntryOperation copyWith(void Function(LogEntryOperation) updates) =>
super.copyWith((message) => updates(
message as LogEntryOperation)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as LogEntryOperation))
as LogEntryOperation;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static LogEntryOperation create() => LogEntryOperation._();
LogEntryOperation createEmptyInstance() => create();
@ -436,8 +589,10 @@ class LogEntryOperation extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static LogEntryOperation getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<LogEntryOperation>(create);
static LogEntryOperation _defaultInstance;
static LogEntryOperation? _defaultInstance;
/// Optional. An arbitrary operation identifier. Log entries with the same
/// identifier are assumed to be part of the same operation.
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
@ -450,6 +605,9 @@ class LogEntryOperation extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearId() => clearField(1);
/// Optional. An arbitrary producer identifier. The combination of `id` and
/// `producer` must be globally unique. Examples for `producer`:
/// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
@$pb.TagNumber(2)
$core.String get producer => $_getSZ(1);
@$pb.TagNumber(2)
@ -462,6 +620,7 @@ class LogEntryOperation extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearProducer() => clearField(2);
/// Optional. Set this to True if this is the first log entry in the operation.
@$pb.TagNumber(3)
$core.bool get first => $_getBF(2);
@$pb.TagNumber(3)
@ -474,6 +633,7 @@ class LogEntryOperation extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearFirst() => clearField(3);
/// Optional. Set this to True if this is the last log entry in the operation.
@$pb.TagNumber(4)
$core.bool get last => $_getBF(3);
@$pb.TagNumber(4)
@ -487,57 +647,44 @@ class LogEntryOperation extends $pb.GeneratedMessage {
void clearLast() => clearField(4);
}
/// Additional information about the source code location that produced the log
/// entry.
class LogEntrySourceLocation extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'LogEntrySourceLocation',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.logging.v2'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'file')
..aInt64(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'line')
..aOS(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'function')
..hasRequiredFields = false;
LogEntrySourceLocation._() : super();
factory LogEntrySourceLocation({
$core.String file,
$fixnum.Int64 line,
$core.String function,
$core.String? file,
$fixnum.Int64? line,
$core.String? function,
}) {
final _result = create();
final result = create();
if (file != null) {
_result.file = file;
result.file = file;
}
if (line != null) {
_result.line = line;
result.line = line;
}
if (function != null) {
_result.function = function;
result.function = function;
}
return _result;
return result;
}
LogEntrySourceLocation._() : super();
factory LogEntrySourceLocation.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LogEntrySourceLocation.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'LogEntrySourceLocation',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.logging.v2'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'file')
..aInt64(2, _omitFieldNames ? '' : 'line')
..aOS(3, _omitFieldNames ? '' : 'function')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -548,9 +695,11 @@ class LogEntrySourceLocation extends $pb.GeneratedMessage {
'Will be removed in next major version')
LogEntrySourceLocation copyWith(
void Function(LogEntrySourceLocation) updates) =>
super.copyWith((message) => updates(
message as LogEntrySourceLocation)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as LogEntrySourceLocation))
as LogEntrySourceLocation;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static LogEntrySourceLocation create() => LogEntrySourceLocation._();
LogEntrySourceLocation createEmptyInstance() => create();
@ -559,8 +708,10 @@ class LogEntrySourceLocation extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static LogEntrySourceLocation getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<LogEntrySourceLocation>(create);
static LogEntrySourceLocation _defaultInstance;
static LogEntrySourceLocation? _defaultInstance;
/// Optional. Source file name. Depending on the runtime environment, this
/// might be a simple name or a fully-qualified name.
@$pb.TagNumber(1)
$core.String get file => $_getSZ(0);
@$pb.TagNumber(1)
@ -573,6 +724,8 @@ class LogEntrySourceLocation extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearFile() => clearField(1);
/// Optional. Line within the source file. 1-based; 0 indicates no line number
/// available.
@$pb.TagNumber(2)
$fixnum.Int64 get line => $_getI64(1);
@$pb.TagNumber(2)
@ -585,6 +738,12 @@ class LogEntrySourceLocation extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearLine() => clearField(2);
/// Optional. Human-readable name of the function or method being invoked, with
/// optional context such as the class or package name. This information may be
/// used in contexts such as the logs viewer, where a file and line number are
/// less meaningful. The format can vary by language. For example:
/// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
/// (Python).
@$pb.TagNumber(3)
$core.String get function => $_getSZ(2);
@$pb.TagNumber(3)
@ -597,3 +756,111 @@ class LogEntrySourceLocation extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearFunction() => clearField(3);
}
/// Additional information used to correlate multiple log entries. Used when a
/// single LogEntry would exceed the Google Cloud Logging size limit and is
/// split across multiple log entries.
class LogSplit extends $pb.GeneratedMessage {
factory LogSplit({
$core.String? uid,
$core.int? index,
$core.int? totalSplits,
}) {
final result = create();
if (uid != null) {
result.uid = uid;
}
if (index != null) {
result.index = index;
}
if (totalSplits != null) {
result.totalSplits = totalSplits;
}
return result;
}
LogSplit._() : super();
factory LogSplit.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory LogSplit.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'LogSplit',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.logging.v2'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'uid')
..a<$core.int>(2, _omitFieldNames ? '' : 'index', $pb.PbFieldType.O3)
..a<$core.int>(3, _omitFieldNames ? '' : 'totalSplits', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
LogSplit clone() => LogSplit()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
LogSplit copyWith(void Function(LogSplit) updates) =>
super.copyWith((message) => updates(message as LogSplit)) as LogSplit;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static LogSplit create() => LogSplit._();
LogSplit createEmptyInstance() => create();
static $pb.PbList<LogSplit> createRepeated() => $pb.PbList<LogSplit>();
@$core.pragma('dart2js:noInline')
static LogSplit getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<LogSplit>(create);
static LogSplit? _defaultInstance;
/// A globally unique identifier for all log entries in a sequence of split log
/// entries. All log entries with the same |LogSplit.uid| are assumed to be
/// part of the same sequence of split log entries.
@$pb.TagNumber(1)
$core.String get uid => $_getSZ(0);
@$pb.TagNumber(1)
set uid($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasUid() => $_has(0);
@$pb.TagNumber(1)
void clearUid() => clearField(1);
/// The index of this LogEntry in the sequence of split log entries. Log
/// entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
/// entries.
@$pb.TagNumber(2)
$core.int get index => $_getIZ(1);
@$pb.TagNumber(2)
set index($core.int v) {
$_setSignedInt32(1, v);
}
@$pb.TagNumber(2)
$core.bool hasIndex() => $_has(1);
@$pb.TagNumber(2)
void clearIndex() => clearField(2);
/// The total number of log entries that the original LogEntry was split into.
@$pb.TagNumber(3)
$core.int get totalSplits => $_getIZ(2);
@$pb.TagNumber(3)
set totalSplits($core.int v) {
$_setSignedInt32(2, v);
}
@$pb.TagNumber(3)
$core.bool hasTotalSplits() => $_has(2);
@$pb.TagNumber(3)
void clearTotalSplits() => clearField(3);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/log_entry.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,31 +1,33 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/log_entry.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const LogEntry$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use logEntryDescriptor instead')
const LogEntry$json = {
'1': 'LogEntry',
'2': const [
const {
'1': 'log_name',
'3': 12,
'4': 1,
'5': 9,
'8': const {},
'10': 'logName'
},
const {
'2': [
{'1': 'log_name', '3': 12, '4': 1, '5': 9, '8': {}, '10': 'logName'},
{
'1': 'resource',
'3': 8,
'4': 1,
'5': 11,
'6': '.google.api.MonitoredResource',
'8': const {},
'8': {},
'10': 'resource'
},
const {
{
'1': 'proto_payload',
'3': 2,
'4': 1,
@ -34,15 +36,8 @@ const LogEntry$json = const {
'9': 0,
'10': 'protoPayload'
},
const {
'1': 'text_payload',
'3': 3,
'4': 1,
'5': 9,
'9': 0,
'10': 'textPayload'
},
const {
{'1': 'text_payload', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'textPayload'},
{
'1': 'json_payload',
'3': 6,
'4': 1,
@ -51,140 +46,176 @@ const LogEntry$json = const {
'9': 0,
'10': 'jsonPayload'
},
const {
{
'1': 'timestamp',
'3': 9,
'4': 1,
'5': 11,
'6': '.google.protobuf.Timestamp',
'8': const {},
'8': {},
'10': 'timestamp'
},
const {
{
'1': 'receive_timestamp',
'3': 24,
'4': 1,
'5': 11,
'6': '.google.protobuf.Timestamp',
'8': const {},
'8': {},
'10': 'receiveTimestamp'
},
const {
{
'1': 'severity',
'3': 10,
'4': 1,
'5': 14,
'6': '.google.logging.type.LogSeverity',
'8': const {},
'8': {},
'10': 'severity'
},
const {
'1': 'insert_id',
'3': 4,
'4': 1,
'5': 9,
'8': const {},
'10': 'insertId'
},
const {
{'1': 'insert_id', '3': 4, '4': 1, '5': 9, '8': {}, '10': 'insertId'},
{
'1': 'http_request',
'3': 7,
'4': 1,
'5': 11,
'6': '.google.logging.type.HttpRequest',
'8': const {},
'8': {},
'10': 'httpRequest'
},
const {
{
'1': 'labels',
'3': 11,
'4': 3,
'5': 11,
'6': '.google.logging.v2.LogEntry.LabelsEntry',
'8': const {},
'8': {},
'10': 'labels'
},
const {
{
'1': 'operation',
'3': 15,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogEntryOperation',
'8': const {},
'8': {},
'10': 'operation'
},
const {'1': 'trace', '3': 22, '4': 1, '5': 9, '8': const {}, '10': 'trace'},
const {
'1': 'span_id',
'3': 27,
'4': 1,
'5': 9,
'8': const {},
'10': 'spanId'
},
const {
{'1': 'trace', '3': 22, '4': 1, '5': 9, '8': {}, '10': 'trace'},
{'1': 'span_id', '3': 27, '4': 1, '5': 9, '8': {}, '10': 'spanId'},
{
'1': 'trace_sampled',
'3': 30,
'4': 1,
'5': 8,
'8': const {},
'8': {},
'10': 'traceSampled'
},
const {
{
'1': 'source_location',
'3': 23,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogEntrySourceLocation',
'8': const {},
'8': {},
'10': 'sourceLocation'
},
{
'1': 'split',
'3': 35,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogSplit',
'8': {},
'10': 'split'
},
],
'3': const [LogEntry_LabelsEntry$json],
'7': const {},
'8': const [
const {'1': 'payload'},
'3': [LogEntry_LabelsEntry$json],
'7': {},
'8': [
{'1': 'payload'},
],
};
const LogEntry_LabelsEntry$json = const {
@$core.Deprecated('Use logEntryDescriptor instead')
const LogEntry_LabelsEntry$json = {
'1': 'LabelsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
],
'7': const {'7': true},
'7': {'7': true},
};
const LogEntryOperation$json = const {
/// Descriptor for `LogEntry`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List logEntryDescriptor = $convert.base64Decode(
'CghMb2dFbnRyeRIeCghsb2dfbmFtZRgMIAEoCUID4EECUgdsb2dOYW1lEj4KCHJlc291cmNlGA'
'ggASgLMh0uZ29vZ2xlLmFwaS5Nb25pdG9yZWRSZXNvdXJjZUID4EECUghyZXNvdXJjZRI7Cg1w'
'cm90b19wYXlsb2FkGAIgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueUgAUgxwcm90b1BheWxvYW'
'QSIwoMdGV4dF9wYXlsb2FkGAMgASgJSABSC3RleHRQYXlsb2FkEjwKDGpzb25fcGF5bG9hZBgG'
'IAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIAFILanNvblBheWxvYWQSPQoJdGltZXN0YW'
'1wGAkgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEBUgl0aW1lc3RhbXASTAoR'
'cmVjZWl2ZV90aW1lc3RhbXAYGCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQ'
'NSEHJlY2VpdmVUaW1lc3RhbXASQQoIc2V2ZXJpdHkYCiABKA4yIC5nb29nbGUubG9nZ2luZy50'
'eXBlLkxvZ1NldmVyaXR5QgPgQQFSCHNldmVyaXR5EiAKCWluc2VydF9pZBgEIAEoCUID4EEBUg'
'hpbnNlcnRJZBJICgxodHRwX3JlcXVlc3QYByABKAsyIC5nb29nbGUubG9nZ2luZy50eXBlLkh0'
'dHBSZXF1ZXN0QgPgQQFSC2h0dHBSZXF1ZXN0EkQKBmxhYmVscxgLIAMoCzInLmdvb2dsZS5sb2'
'dnaW5nLnYyLkxvZ0VudHJ5LkxhYmVsc0VudHJ5QgPgQQFSBmxhYmVscxJHCglvcGVyYXRpb24Y'
'DyABKAsyJC5nb29nbGUubG9nZ2luZy52Mi5Mb2dFbnRyeU9wZXJhdGlvbkID4EEBUglvcGVyYX'
'Rpb24SGQoFdHJhY2UYFiABKAlCA+BBAVIFdHJhY2USHAoHc3Bhbl9pZBgbIAEoCUID4EEBUgZz'
'cGFuSWQSKAoNdHJhY2Vfc2FtcGxlZBgeIAEoCEID4EEBUgx0cmFjZVNhbXBsZWQSVwoPc291cm'
'NlX2xvY2F0aW9uGBcgASgLMikuZ29vZ2xlLmxvZ2dpbmcudjIuTG9nRW50cnlTb3VyY2VMb2Nh'
'dGlvbkID4EEBUg5zb3VyY2VMb2NhdGlvbhI2CgVzcGxpdBgjIAEoCzIbLmdvb2dsZS5sb2dnaW'
'5nLnYyLkxvZ1NwbGl0QgPgQQFSBXNwbGl0GjkKC0xhYmVsc0VudHJ5EhAKA2tleRgBIAEoCVID'
'a2V5EhQKBXZhbHVlGAIgASgJUgV2YWx1ZToCOAE6vQHqQbkBChpsb2dnaW5nLmdvb2dsZWFwaX'
'MuY29tL0xvZxIdcHJvamVjdHMve3Byb2plY3R9L2xvZ3Mve2xvZ30SJ29yZ2FuaXphdGlvbnMv'
'e29yZ2FuaXphdGlvbn0vbG9ncy97bG9nfRIbZm9sZGVycy97Zm9sZGVyfS9sb2dzL3tsb2d9Ei'
'xiaWxsaW5nQWNjb3VudHMve2JpbGxpbmdfYWNjb3VudH0vbG9ncy97bG9nfRoIbG9nX25hbWVC'
'CQoHcGF5bG9hZA==');
@$core.Deprecated('Use logEntryOperationDescriptor instead')
const LogEntryOperation$json = {
'1': 'LogEntryOperation',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'id'},
const {
'1': 'producer',
'3': 2,
'4': 1,
'5': 9,
'8': const {},
'10': 'producer'
},
const {'1': 'first', '3': 3, '4': 1, '5': 8, '8': const {}, '10': 'first'},
const {'1': 'last', '3': 4, '4': 1, '5': 8, '8': const {}, '10': 'last'},
'2': [
{'1': 'id', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'id'},
{'1': 'producer', '3': 2, '4': 1, '5': 9, '8': {}, '10': 'producer'},
{'1': 'first', '3': 3, '4': 1, '5': 8, '8': {}, '10': 'first'},
{'1': 'last', '3': 4, '4': 1, '5': 8, '8': {}, '10': 'last'},
],
};
const LogEntrySourceLocation$json = const {
/// Descriptor for `LogEntryOperation`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List logEntryOperationDescriptor = $convert.base64Decode(
'ChFMb2dFbnRyeU9wZXJhdGlvbhITCgJpZBgBIAEoCUID4EEBUgJpZBIfCghwcm9kdWNlchgCIA'
'EoCUID4EEBUghwcm9kdWNlchIZCgVmaXJzdBgDIAEoCEID4EEBUgVmaXJzdBIXCgRsYXN0GAQg'
'ASgIQgPgQQFSBGxhc3Q=');
@$core.Deprecated('Use logEntrySourceLocationDescriptor instead')
const LogEntrySourceLocation$json = {
'1': 'LogEntrySourceLocation',
'2': const [
const {'1': 'file', '3': 1, '4': 1, '5': 9, '8': const {}, '10': 'file'},
const {'1': 'line', '3': 2, '4': 1, '5': 3, '8': const {}, '10': 'line'},
const {
'1': 'function',
'3': 3,
'4': 1,
'5': 9,
'8': const {},
'10': 'function'
},
'2': [
{'1': 'file', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'file'},
{'1': 'line', '3': 2, '4': 1, '5': 3, '8': {}, '10': 'line'},
{'1': 'function', '3': 3, '4': 1, '5': 9, '8': {}, '10': 'function'},
],
};
/// Descriptor for `LogEntrySourceLocation`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List logEntrySourceLocationDescriptor = $convert.base64Decode(
'ChZMb2dFbnRyeVNvdXJjZUxvY2F0aW9uEhcKBGZpbGUYASABKAlCA+BBAVIEZmlsZRIXCgRsaW'
'5lGAIgASgDQgPgQQFSBGxpbmUSHwoIZnVuY3Rpb24YAyABKAlCA+BBAVIIZnVuY3Rpb24=');
@$core.Deprecated('Use logSplitDescriptor instead')
const LogSplit$json = {
'1': 'LogSplit',
'2': [
{'1': 'uid', '3': 1, '4': 1, '5': 9, '10': 'uid'},
{'1': 'index', '3': 2, '4': 1, '5': 5, '10': 'index'},
{'1': 'total_splits', '3': 3, '4': 1, '5': 5, '10': 'totalSplits'},
],
};
/// Descriptor for `LogSplit`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List logSplitDescriptor = $convert.base64Decode(
'CghMb2dTcGxpdBIQCgN1aWQYASABKAlSA3VpZBIUCgVpbmRleBgCIAEoBVIFaW5kZXgSIQoMdG'
'90YWxfc3BsaXRzGAMgASgFUgt0b3RhbFNwbGl0cw==');

View File

@ -1,33 +1,29 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/logging.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// An indicator of why entries were omitted.
class TailLogEntriesResponse_SuppressionInfo_Reason extends $pb.ProtobufEnum {
static const TailLogEntriesResponse_SuppressionInfo_Reason
REASON_UNSPECIFIED = TailLogEntriesResponse_SuppressionInfo_Reason._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'REASON_UNSPECIFIED');
0, _omitEnumNames ? '' : 'REASON_UNSPECIFIED');
static const TailLogEntriesResponse_SuppressionInfo_Reason RATE_LIMIT =
TailLogEntriesResponse_SuppressionInfo_Reason._(
1,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'RATE_LIMIT');
1, _omitEnumNames ? '' : 'RATE_LIMIT');
static const TailLogEntriesResponse_SuppressionInfo_Reason NOT_CONSUMED =
TailLogEntriesResponse_SuppressionInfo_Reason._(
2,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'NOT_CONSUMED');
2, _omitEnumNames ? '' : 'NOT_CONSUMED');
static const $core.List<TailLogEntriesResponse_SuppressionInfo_Reason>
values = <TailLogEntriesResponse_SuppressionInfo_Reason>[
@ -37,9 +33,9 @@ class TailLogEntriesResponse_SuppressionInfo_Reason extends $pb.ProtobufEnum {
];
static final $core
.Map<$core.int, TailLogEntriesResponse_SuppressionInfo_Reason>
_byValue = $pb.ProtobufEnum.initByValue(values);
static TailLogEntriesResponse_SuppressionInfo_Reason valueOf(
.Map<$core.int, TailLogEntriesResponse_SuppressionInfo_Reason> _byValue =
$pb.ProtobufEnum.initByValue(values);
static TailLogEntriesResponse_SuppressionInfo_Reason? valueOf(
$core.int value) =>
_byValue[value];
@ -47,3 +43,5 @@ class TailLogEntriesResponse_SuppressionInfo_Reason extends $pb.ProtobufEnum {
$core.int v, $core.String n)
: super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,197 +1,205 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/logging.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'logging.pb.dart' as $2;
import 'package:protobuf/protobuf.dart' as $pb;
import '../../protobuf/empty.pb.dart' as $1;
import 'logging.pb.dart' as $0;
export 'logging.pb.dart';
@$pb.GrpcServiceName('google.logging.v2.LoggingServiceV2')
class LoggingServiceV2Client extends $grpc.Client {
static final _$deleteLog = $grpc.ClientMethod<$2.DeleteLogRequest, $1.Empty>(
static final _$deleteLog = $grpc.ClientMethod<$0.DeleteLogRequest, $1.Empty>(
'/google.logging.v2.LoggingServiceV2/DeleteLog',
($2.DeleteLogRequest value) => value.writeToBuffer(),
($0.DeleteLogRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $1.Empty.fromBuffer(value));
static final _$writeLogEntries =
$grpc.ClientMethod<$2.WriteLogEntriesRequest, $2.WriteLogEntriesResponse>(
$grpc.ClientMethod<$0.WriteLogEntriesRequest, $0.WriteLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/WriteLogEntries',
($2.WriteLogEntriesRequest value) => value.writeToBuffer(),
($0.WriteLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$2.WriteLogEntriesResponse.fromBuffer(value));
$0.WriteLogEntriesResponse.fromBuffer(value));
static final _$listLogEntries =
$grpc.ClientMethod<$2.ListLogEntriesRequest, $2.ListLogEntriesResponse>(
$grpc.ClientMethod<$0.ListLogEntriesRequest, $0.ListLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/ListLogEntries',
($2.ListLogEntriesRequest value) => value.writeToBuffer(),
($0.ListLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$2.ListLogEntriesResponse.fromBuffer(value));
$0.ListLogEntriesResponse.fromBuffer(value));
static final _$listMonitoredResourceDescriptors = $grpc.ClientMethod<
$2.ListMonitoredResourceDescriptorsRequest,
$2.ListMonitoredResourceDescriptorsResponse>(
$0.ListMonitoredResourceDescriptorsRequest,
$0.ListMonitoredResourceDescriptorsResponse>(
'/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors',
($2.ListMonitoredResourceDescriptorsRequest value) =>
($0.ListMonitoredResourceDescriptorsRequest value) =>
value.writeToBuffer(),
($core.List<$core.int> value) =>
$2.ListMonitoredResourceDescriptorsResponse.fromBuffer(value));
$0.ListMonitoredResourceDescriptorsResponse.fromBuffer(value));
static final _$listLogs =
$grpc.ClientMethod<$2.ListLogsRequest, $2.ListLogsResponse>(
$grpc.ClientMethod<$0.ListLogsRequest, $0.ListLogsResponse>(
'/google.logging.v2.LoggingServiceV2/ListLogs',
($2.ListLogsRequest value) => value.writeToBuffer(),
($0.ListLogsRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$2.ListLogsResponse.fromBuffer(value));
$0.ListLogsResponse.fromBuffer(value));
static final _$tailLogEntries =
$grpc.ClientMethod<$2.TailLogEntriesRequest, $2.TailLogEntriesResponse>(
$grpc.ClientMethod<$0.TailLogEntriesRequest, $0.TailLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/TailLogEntries',
($2.TailLogEntriesRequest value) => value.writeToBuffer(),
($0.TailLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$2.TailLogEntriesResponse.fromBuffer(value));
$0.TailLogEntriesResponse.fromBuffer(value));
LoggingServiceV2Client($grpc.ClientChannel channel,
{$grpc.CallOptions options,
$core.Iterable<$grpc.ClientInterceptor> interceptors})
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$1.Empty> deleteLog($2.DeleteLogRequest request,
{$grpc.CallOptions options}) {
$grpc.ResponseFuture<$1.Empty> deleteLog($0.DeleteLogRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$deleteLog, request, options: options);
}
$grpc.ResponseFuture<$2.WriteLogEntriesResponse> writeLogEntries(
$2.WriteLogEntriesRequest request,
{$grpc.CallOptions options}) {
$grpc.ResponseFuture<$0.WriteLogEntriesResponse> writeLogEntries(
$0.WriteLogEntriesRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$writeLogEntries, request, options: options);
}
$grpc.ResponseFuture<$2.ListLogEntriesResponse> listLogEntries(
$2.ListLogEntriesRequest request,
{$grpc.CallOptions options}) {
$grpc.ResponseFuture<$0.ListLogEntriesResponse> listLogEntries(
$0.ListLogEntriesRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listLogEntries, request, options: options);
}
$grpc.ResponseFuture<$2.ListMonitoredResourceDescriptorsResponse>
$grpc.ResponseFuture<$0.ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors(
$2.ListMonitoredResourceDescriptorsRequest request,
{$grpc.CallOptions options}) {
$0.ListMonitoredResourceDescriptorsRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listMonitoredResourceDescriptors, request,
options: options);
}
$grpc.ResponseFuture<$2.ListLogsResponse> listLogs($2.ListLogsRequest request,
{$grpc.CallOptions options}) {
$grpc.ResponseFuture<$0.ListLogsResponse> listLogs($0.ListLogsRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listLogs, request, options: options);
}
$grpc.ResponseStream<$2.TailLogEntriesResponse> tailLogEntries(
$async.Stream<$2.TailLogEntriesRequest> request,
{$grpc.CallOptions options}) {
$grpc.ResponseStream<$0.TailLogEntriesResponse> tailLogEntries(
$async.Stream<$0.TailLogEntriesRequest> request,
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$tailLogEntries, request, options: options);
}
}
@$pb.GrpcServiceName('google.logging.v2.LoggingServiceV2')
abstract class LoggingServiceV2ServiceBase extends $grpc.Service {
$core.String get $name => 'google.logging.v2.LoggingServiceV2';
LoggingServiceV2ServiceBase() {
$addMethod($grpc.ServiceMethod<$2.DeleteLogRequest, $1.Empty>(
$addMethod($grpc.ServiceMethod<$0.DeleteLogRequest, $1.Empty>(
'DeleteLog',
deleteLog_Pre,
false,
false,
($core.List<$core.int> value) => $2.DeleteLogRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.DeleteLogRequest.fromBuffer(value),
($1.Empty value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.WriteLogEntriesRequest,
$2.WriteLogEntriesResponse>(
$addMethod($grpc.ServiceMethod<$0.WriteLogEntriesRequest,
$0.WriteLogEntriesResponse>(
'WriteLogEntries',
writeLogEntries_Pre,
false,
false,
($core.List<$core.int> value) =>
$2.WriteLogEntriesRequest.fromBuffer(value),
($2.WriteLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.ListLogEntriesRequest,
$2.ListLogEntriesResponse>(
$0.WriteLogEntriesRequest.fromBuffer(value),
($0.WriteLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ListLogEntriesRequest,
$0.ListLogEntriesResponse>(
'ListLogEntries',
listLogEntries_Pre,
false,
false,
($core.List<$core.int> value) =>
$2.ListLogEntriesRequest.fromBuffer(value),
($2.ListLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.ListMonitoredResourceDescriptorsRequest,
$2.ListMonitoredResourceDescriptorsResponse>(
$0.ListLogEntriesRequest.fromBuffer(value),
($0.ListLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ListMonitoredResourceDescriptorsRequest,
$0.ListMonitoredResourceDescriptorsResponse>(
'ListMonitoredResourceDescriptors',
listMonitoredResourceDescriptors_Pre,
false,
false,
($core.List<$core.int> value) =>
$2.ListMonitoredResourceDescriptorsRequest.fromBuffer(value),
($2.ListMonitoredResourceDescriptorsResponse value) =>
$0.ListMonitoredResourceDescriptorsRequest.fromBuffer(value),
($0.ListMonitoredResourceDescriptorsResponse value) =>
value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.ListLogsRequest, $2.ListLogsResponse>(
$addMethod($grpc.ServiceMethod<$0.ListLogsRequest, $0.ListLogsResponse>(
'ListLogs',
listLogs_Pre,
false,
false,
($core.List<$core.int> value) => $2.ListLogsRequest.fromBuffer(value),
($2.ListLogsResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.TailLogEntriesRequest,
$2.TailLogEntriesResponse>(
($core.List<$core.int> value) => $0.ListLogsRequest.fromBuffer(value),
($0.ListLogsResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.TailLogEntriesRequest,
$0.TailLogEntriesResponse>(
'TailLogEntries',
tailLogEntries,
true,
true,
($core.List<$core.int> value) =>
$2.TailLogEntriesRequest.fromBuffer(value),
($2.TailLogEntriesResponse value) => value.writeToBuffer()));
$0.TailLogEntriesRequest.fromBuffer(value),
($0.TailLogEntriesResponse value) => value.writeToBuffer()));
}
$async.Future<$1.Empty> deleteLog_Pre($grpc.ServiceCall call,
$async.Future<$2.DeleteLogRequest> request) async {
$async.Future<$0.DeleteLogRequest> request) async {
return deleteLog(call, await request);
}
$async.Future<$2.WriteLogEntriesResponse> writeLogEntries_Pre(
$async.Future<$0.WriteLogEntriesResponse> writeLogEntries_Pre(
$grpc.ServiceCall call,
$async.Future<$2.WriteLogEntriesRequest> request) async {
$async.Future<$0.WriteLogEntriesRequest> request) async {
return writeLogEntries(call, await request);
}
$async.Future<$2.ListLogEntriesResponse> listLogEntries_Pre(
$async.Future<$0.ListLogEntriesResponse> listLogEntries_Pre(
$grpc.ServiceCall call,
$async.Future<$2.ListLogEntriesRequest> request) async {
$async.Future<$0.ListLogEntriesRequest> request) async {
return listLogEntries(call, await request);
}
$async.Future<$2.ListMonitoredResourceDescriptorsResponse>
$async.Future<$0.ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors_Pre(
$grpc.ServiceCall call,
$async.Future<$2.ListMonitoredResourceDescriptorsRequest>
$async.Future<$0.ListMonitoredResourceDescriptorsRequest>
request) async {
return listMonitoredResourceDescriptors(call, await request);
}
$async.Future<$2.ListLogsResponse> listLogs_Pre(
$grpc.ServiceCall call, $async.Future<$2.ListLogsRequest> request) async {
$async.Future<$0.ListLogsResponse> listLogs_Pre(
$grpc.ServiceCall call, $async.Future<$0.ListLogsRequest> request) async {
return listLogs(call, await request);
}
$async.Future<$1.Empty> deleteLog(
$grpc.ServiceCall call, $2.DeleteLogRequest request);
$async.Future<$2.WriteLogEntriesResponse> writeLogEntries(
$grpc.ServiceCall call, $2.WriteLogEntriesRequest request);
$async.Future<$2.ListLogEntriesResponse> listLogEntries(
$grpc.ServiceCall call, $2.ListLogEntriesRequest request);
$async.Future<$2.ListMonitoredResourceDescriptorsResponse>
$grpc.ServiceCall call, $0.DeleteLogRequest request);
$async.Future<$0.WriteLogEntriesResponse> writeLogEntries(
$grpc.ServiceCall call, $0.WriteLogEntriesRequest request);
$async.Future<$0.ListLogEntriesResponse> listLogEntries(
$grpc.ServiceCall call, $0.ListLogEntriesRequest request);
$async.Future<$0.ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors($grpc.ServiceCall call,
$2.ListMonitoredResourceDescriptorsRequest request);
$async.Future<$2.ListLogsResponse> listLogs(
$grpc.ServiceCall call, $2.ListLogsRequest request);
$async.Stream<$2.TailLogEntriesResponse> tailLogEntries(
$grpc.ServiceCall call, $async.Stream<$2.TailLogEntriesRequest> request);
$0.ListMonitoredResourceDescriptorsRequest request);
$async.Future<$0.ListLogsResponse> listLogs(
$grpc.ServiceCall call, $0.ListLogsRequest request);
$async.Stream<$0.TailLogEntriesResponse> tailLogEntries(
$grpc.ServiceCall call, $async.Stream<$0.TailLogEntriesRequest> request);
}

View File

@ -1,99 +1,111 @@
///
//
// Generated code. Do not modify.
// source: google/logging/v2/logging.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const DeleteLogRequest$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use deleteLogRequestDescriptor instead')
const DeleteLogRequest$json = {
'1': 'DeleteLogRequest',
'2': const [
const {
'1': 'log_name',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'logName'
},
'2': [
{'1': 'log_name', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'logName'},
],
};
const WriteLogEntriesRequest$json = const {
/// Descriptor for `DeleteLogRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List deleteLogRequestDescriptor = $convert.base64Decode(
'ChBEZWxldGVMb2dSZXF1ZXN0Ej0KCGxvZ19uYW1lGAEgASgJQiLgQQL6QRwKGmxvZ2dpbmcuZ2'
'9vZ2xlYXBpcy5jb20vTG9nUgdsb2dOYW1l');
@$core.Deprecated('Use writeLogEntriesRequestDescriptor instead')
const WriteLogEntriesRequest$json = {
'1': 'WriteLogEntriesRequest',
'2': const [
const {
'1': 'log_name',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'logName'
},
const {
'2': [
{'1': 'log_name', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'logName'},
{
'1': 'resource',
'3': 2,
'4': 1,
'5': 11,
'6': '.google.api.MonitoredResource',
'8': const {},
'8': {},
'10': 'resource'
},
const {
{
'1': 'labels',
'3': 3,
'4': 3,
'5': 11,
'6': '.google.logging.v2.WriteLogEntriesRequest.LabelsEntry',
'8': const {},
'8': {},
'10': 'labels'
},
const {
{
'1': 'entries',
'3': 4,
'4': 3,
'5': 11,
'6': '.google.logging.v2.LogEntry',
'8': const {},
'8': {},
'10': 'entries'
},
const {
{
'1': 'partial_success',
'3': 5,
'4': 1,
'5': 8,
'8': const {},
'8': {},
'10': 'partialSuccess'
},
const {
'1': 'dry_run',
'3': 6,
'4': 1,
'5': 8,
'8': const {},
'10': 'dryRun'
},
{'1': 'dry_run', '3': 6, '4': 1, '5': 8, '8': {}, '10': 'dryRun'},
],
'3': const [WriteLogEntriesRequest_LabelsEntry$json],
'3': [WriteLogEntriesRequest_LabelsEntry$json],
};
const WriteLogEntriesRequest_LabelsEntry$json = const {
@$core.Deprecated('Use writeLogEntriesRequestDescriptor instead')
const WriteLogEntriesRequest_LabelsEntry$json = {
'1': 'LabelsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
],
'7': const {'7': true},
'7': {'7': true},
};
const WriteLogEntriesResponse$json = const {
/// Descriptor for `WriteLogEntriesRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List writeLogEntriesRequestDescriptor = $convert.base64Decode(
'ChZXcml0ZUxvZ0VudHJpZXNSZXF1ZXN0Ej0KCGxvZ19uYW1lGAEgASgJQiLgQQH6QRwKGmxvZ2'
'dpbmcuZ29vZ2xlYXBpcy5jb20vTG9nUgdsb2dOYW1lEj4KCHJlc291cmNlGAIgASgLMh0uZ29v'
'Z2xlLmFwaS5Nb25pdG9yZWRSZXNvdXJjZUID4EEBUghyZXNvdXJjZRJSCgZsYWJlbHMYAyADKA'
'syNS5nb29nbGUubG9nZ2luZy52Mi5Xcml0ZUxvZ0VudHJpZXNSZXF1ZXN0LkxhYmVsc0VudHJ5'
'QgPgQQFSBmxhYmVscxI6CgdlbnRyaWVzGAQgAygLMhsuZ29vZ2xlLmxvZ2dpbmcudjIuTG9nRW'
'50cnlCA+BBAlIHZW50cmllcxIsCg9wYXJ0aWFsX3N1Y2Nlc3MYBSABKAhCA+BBAVIOcGFydGlh'
'bFN1Y2Nlc3MSHAoHZHJ5X3J1bhgGIAEoCEID4EEBUgZkcnlSdW4aOQoLTGFiZWxzRW50cnkSEA'
'oDa2V5GAEgASgJUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4AQ==');
@$core.Deprecated('Use writeLogEntriesResponseDescriptor instead')
const WriteLogEntriesResponse$json = {
'1': 'WriteLogEntriesResponse',
};
const WriteLogEntriesPartialErrors$json = const {
/// Descriptor for `WriteLogEntriesResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List writeLogEntriesResponseDescriptor =
$convert.base64Decode('ChdXcml0ZUxvZ0VudHJpZXNSZXNwb25zZQ==');
@$core.Deprecated('Use writeLogEntriesPartialErrorsDescriptor instead')
const WriteLogEntriesPartialErrors$json = {
'1': 'WriteLogEntriesPartialErrors',
'2': const [
const {
'2': [
{
'1': 'log_entry_errors',
'3': 1,
'4': 3,
@ -103,14 +115,15 @@ const WriteLogEntriesPartialErrors$json = const {
'10': 'logEntryErrors'
},
],
'3': const [WriteLogEntriesPartialErrors_LogEntryErrorsEntry$json],
'3': [WriteLogEntriesPartialErrors_LogEntryErrorsEntry$json],
};
const WriteLogEntriesPartialErrors_LogEntryErrorsEntry$json = const {
@$core.Deprecated('Use writeLogEntriesPartialErrorsDescriptor instead')
const WriteLogEntriesPartialErrors_LogEntryErrorsEntry$json = {
'1': 'LogEntryErrorsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 5, '10': 'key'},
const {
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 5, '10': 'key'},
{
'1': 'value',
'3': 2,
'4': 1,
@ -119,59 +132,49 @@ const WriteLogEntriesPartialErrors_LogEntryErrorsEntry$json = const {
'10': 'value'
},
],
'7': const {'7': true},
'7': {'7': true},
};
const ListLogEntriesRequest$json = const {
/// Descriptor for `WriteLogEntriesPartialErrors`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List writeLogEntriesPartialErrorsDescriptor = $convert.base64Decode(
'ChxXcml0ZUxvZ0VudHJpZXNQYXJ0aWFsRXJyb3JzEm0KEGxvZ19lbnRyeV9lcnJvcnMYASADKA'
'syQy5nb29nbGUubG9nZ2luZy52Mi5Xcml0ZUxvZ0VudHJpZXNQYXJ0aWFsRXJyb3JzLkxvZ0Vu'
'dHJ5RXJyb3JzRW50cnlSDmxvZ0VudHJ5RXJyb3JzGlUKE0xvZ0VudHJ5RXJyb3JzRW50cnkSEA'
'oDa2V5GAEgASgFUgNrZXkSKAoFdmFsdWUYAiABKAsyEi5nb29nbGUucnBjLlN0YXR1c1IFdmFs'
'dWU6AjgB');
@$core.Deprecated('Use listLogEntriesRequestDescriptor instead')
const ListLogEntriesRequest$json = {
'1': 'ListLogEntriesRequest',
'2': const [
const {
'2': [
{
'1': 'resource_names',
'3': 8,
'4': 3,
'5': 9,
'8': const {},
'8': {},
'10': 'resourceNames'
},
const {
'1': 'filter',
'3': 2,
'4': 1,
'5': 9,
'8': const {},
'10': 'filter'
},
const {
'1': 'order_by',
'3': 3,
'4': 1,
'5': 9,
'8': const {},
'10': 'orderBy'
},
const {
'1': 'page_size',
'3': 4,
'4': 1,
'5': 5,
'8': const {},
'10': 'pageSize'
},
const {
'1': 'page_token',
'3': 5,
'4': 1,
'5': 9,
'8': const {},
'10': 'pageToken'
},
{'1': 'filter', '3': 2, '4': 1, '5': 9, '8': {}, '10': 'filter'},
{'1': 'order_by', '3': 3, '4': 1, '5': 9, '8': {}, '10': 'orderBy'},
{'1': 'page_size', '3': 4, '4': 1, '5': 5, '8': {}, '10': 'pageSize'},
{'1': 'page_token', '3': 5, '4': 1, '5': 9, '8': {}, '10': 'pageToken'},
],
};
const ListLogEntriesResponse$json = const {
/// Descriptor for `ListLogEntriesRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listLogEntriesRequestDescriptor = $convert.base64Decode(
'ChVMaXN0TG9nRW50cmllc1JlcXVlc3QSSQoOcmVzb3VyY2VfbmFtZXMYCCADKAlCIuBBAvpBHB'
'IabG9nZ2luZy5nb29nbGVhcGlzLmNvbS9Mb2dSDXJlc291cmNlTmFtZXMSGwoGZmlsdGVyGAIg'
'ASgJQgPgQQFSBmZpbHRlchIeCghvcmRlcl9ieRgDIAEoCUID4EEBUgdvcmRlckJ5EiAKCXBhZ2'
'Vfc2l6ZRgEIAEoBUID4EEBUghwYWdlU2l6ZRIiCgpwYWdlX3Rva2VuGAUgASgJQgPgQQFSCXBh'
'Z2VUb2tlbg==');
@$core.Deprecated('Use listLogEntriesResponseDescriptor instead')
const ListLogEntriesResponse$json = {
'1': 'ListLogEntriesResponse',
'2': const [
const {
'2': [
{
'1': 'entries',
'3': 1,
'4': 3,
@ -179,42 +182,38 @@ const ListLogEntriesResponse$json = const {
'6': '.google.logging.v2.LogEntry',
'10': 'entries'
},
const {
'1': 'next_page_token',
'3': 2,
'4': 1,
'5': 9,
'10': 'nextPageToken'
},
{'1': 'next_page_token', '3': 2, '4': 1, '5': 9, '10': 'nextPageToken'},
],
};
const ListMonitoredResourceDescriptorsRequest$json = const {
/// Descriptor for `ListLogEntriesResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listLogEntriesResponseDescriptor = $convert.base64Decode(
'ChZMaXN0TG9nRW50cmllc1Jlc3BvbnNlEjUKB2VudHJpZXMYASADKAsyGy5nb29nbGUubG9nZ2'
'luZy52Mi5Mb2dFbnRyeVIHZW50cmllcxImCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAlSDW5leHRQ'
'YWdlVG9rZW4=');
@$core
.Deprecated('Use listMonitoredResourceDescriptorsRequestDescriptor instead')
const ListMonitoredResourceDescriptorsRequest$json = {
'1': 'ListMonitoredResourceDescriptorsRequest',
'2': const [
const {
'1': 'page_size',
'3': 1,
'4': 1,
'5': 5,
'8': const {},
'10': 'pageSize'
},
const {
'1': 'page_token',
'3': 2,
'4': 1,
'5': 9,
'8': const {},
'10': 'pageToken'
},
'2': [
{'1': 'page_size', '3': 1, '4': 1, '5': 5, '8': {}, '10': 'pageSize'},
{'1': 'page_token', '3': 2, '4': 1, '5': 9, '8': {}, '10': 'pageToken'},
],
};
const ListMonitoredResourceDescriptorsResponse$json = const {
/// Descriptor for `ListMonitoredResourceDescriptorsRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listMonitoredResourceDescriptorsRequestDescriptor =
$convert.base64Decode(
'CidMaXN0TW9uaXRvcmVkUmVzb3VyY2VEZXNjcmlwdG9yc1JlcXVlc3QSIAoJcGFnZV9zaXplGA'
'EgASgFQgPgQQFSCHBhZ2VTaXplEiIKCnBhZ2VfdG9rZW4YAiABKAlCA+BBAVIJcGFnZVRva2Vu');
@$core.Deprecated(
'Use listMonitoredResourceDescriptorsResponseDescriptor instead')
const ListMonitoredResourceDescriptorsResponse$json = {
'1': 'ListMonitoredResourceDescriptorsResponse',
'2': const [
const {
'2': [
{
'1': 'resource_descriptors',
'3': 1,
'4': 3,
@ -222,103 +221,93 @@ const ListMonitoredResourceDescriptorsResponse$json = const {
'6': '.google.api.MonitoredResourceDescriptor',
'10': 'resourceDescriptors'
},
const {
'1': 'next_page_token',
'3': 2,
'4': 1,
'5': 9,
'10': 'nextPageToken'
},
{'1': 'next_page_token', '3': 2, '4': 1, '5': 9, '10': 'nextPageToken'},
],
};
const ListLogsRequest$json = const {
/// Descriptor for `ListMonitoredResourceDescriptorsResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listMonitoredResourceDescriptorsResponseDescriptor =
$convert.base64Decode(
'CihMaXN0TW9uaXRvcmVkUmVzb3VyY2VEZXNjcmlwdG9yc1Jlc3BvbnNlEloKFHJlc291cmNlX2'
'Rlc2NyaXB0b3JzGAEgAygLMicuZ29vZ2xlLmFwaS5Nb25pdG9yZWRSZXNvdXJjZURlc2NyaXB0'
'b3JSE3Jlc291cmNlRGVzY3JpcHRvcnMSJgoPbmV4dF9wYWdlX3Rva2VuGAIgASgJUg1uZXh0UG'
'FnZVRva2Vu');
@$core.Deprecated('Use listLogsRequestDescriptor instead')
const ListLogsRequest$json = {
'1': 'ListLogsRequest',
'2': const [
const {
'1': 'parent',
'3': 1,
'4': 1,
'5': 9,
'8': const {},
'10': 'parent'
},
const {
'1': 'page_size',
'3': 2,
'4': 1,
'5': 5,
'8': const {},
'10': 'pageSize'
},
const {
'1': 'page_token',
'3': 3,
'4': 1,
'5': 9,
'8': const {},
'10': 'pageToken'
},
const {
'2': [
{'1': 'parent', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'parent'},
{
'1': 'resource_names',
'3': 8,
'4': 3,
'5': 9,
'8': const {},
'8': {},
'10': 'resourceNames'
},
{'1': 'page_size', '3': 2, '4': 1, '5': 5, '8': {}, '10': 'pageSize'},
{'1': 'page_token', '3': 3, '4': 1, '5': 9, '8': {}, '10': 'pageToken'},
],
};
const ListLogsResponse$json = const {
/// Descriptor for `ListLogsRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listLogsRequestDescriptor = $convert.base64Decode(
'Cg9MaXN0TG9nc1JlcXVlc3QSOgoGcGFyZW50GAEgASgJQiLgQQL6QRwSGmxvZ2dpbmcuZ29vZ2'
'xlYXBpcy5jb20vTG9nUgZwYXJlbnQSSQoOcmVzb3VyY2VfbmFtZXMYCCADKAlCIuBBAfpBHBIa'
'bG9nZ2luZy5nb29nbGVhcGlzLmNvbS9Mb2dSDXJlc291cmNlTmFtZXMSIAoJcGFnZV9zaXplGA'
'IgASgFQgPgQQFSCHBhZ2VTaXplEiIKCnBhZ2VfdG9rZW4YAyABKAlCA+BBAVIJcGFnZVRva2Vu');
@$core.Deprecated('Use listLogsResponseDescriptor instead')
const ListLogsResponse$json = {
'1': 'ListLogsResponse',
'2': const [
const {'1': 'log_names', '3': 3, '4': 3, '5': 9, '10': 'logNames'},
const {
'1': 'next_page_token',
'3': 2,
'4': 1,
'5': 9,
'10': 'nextPageToken'
},
'2': [
{'1': 'log_names', '3': 3, '4': 3, '5': 9, '10': 'logNames'},
{'1': 'next_page_token', '3': 2, '4': 1, '5': 9, '10': 'nextPageToken'},
],
};
const TailLogEntriesRequest$json = const {
/// Descriptor for `ListLogsResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listLogsResponseDescriptor = $convert.base64Decode(
'ChBMaXN0TG9nc1Jlc3BvbnNlEhsKCWxvZ19uYW1lcxgDIAMoCVIIbG9nTmFtZXMSJgoPbmV4dF'
'9wYWdlX3Rva2VuGAIgASgJUg1uZXh0UGFnZVRva2Vu');
@$core.Deprecated('Use tailLogEntriesRequestDescriptor instead')
const TailLogEntriesRequest$json = {
'1': 'TailLogEntriesRequest',
'2': const [
const {
'2': [
{
'1': 'resource_names',
'3': 1,
'4': 3,
'5': 9,
'8': const {},
'8': {},
'10': 'resourceNames'
},
const {
'1': 'filter',
'3': 2,
'4': 1,
'5': 9,
'8': const {},
'10': 'filter'
},
const {
{'1': 'filter', '3': 2, '4': 1, '5': 9, '8': {}, '10': 'filter'},
{
'1': 'buffer_window',
'3': 3,
'4': 1,
'5': 11,
'6': '.google.protobuf.Duration',
'8': const {},
'8': {},
'10': 'bufferWindow'
},
],
};
const TailLogEntriesResponse$json = const {
/// Descriptor for `TailLogEntriesRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List tailLogEntriesRequestDescriptor = $convert.base64Decode(
'ChVUYWlsTG9nRW50cmllc1JlcXVlc3QSKgoOcmVzb3VyY2VfbmFtZXMYASADKAlCA+BBAlINcm'
'Vzb3VyY2VOYW1lcxIbCgZmaWx0ZXIYAiABKAlCA+BBAVIGZmlsdGVyEkMKDWJ1ZmZlcl93aW5k'
'b3cYAyABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb25CA+BBAVIMYnVmZmVyV2luZG93');
@$core.Deprecated('Use tailLogEntriesResponseDescriptor instead')
const TailLogEntriesResponse$json = {
'1': 'TailLogEntriesResponse',
'2': const [
const {
'2': [
{
'1': 'entries',
'3': 1,
'4': 3,
@ -326,7 +315,7 @@ const TailLogEntriesResponse$json = const {
'6': '.google.logging.v2.LogEntry',
'10': 'entries'
},
const {
{
'1': 'suppression_info',
'3': 2,
'4': 3,
@ -335,13 +324,14 @@ const TailLogEntriesResponse$json = const {
'10': 'suppressionInfo'
},
],
'3': const [TailLogEntriesResponse_SuppressionInfo$json],
'3': [TailLogEntriesResponse_SuppressionInfo$json],
};
const TailLogEntriesResponse_SuppressionInfo$json = const {
@$core.Deprecated('Use tailLogEntriesResponseDescriptor instead')
const TailLogEntriesResponse_SuppressionInfo$json = {
'1': 'SuppressionInfo',
'2': const [
const {
'2': [
{
'1': 'reason',
'3': 1,
'4': 1,
@ -349,22 +339,28 @@ const TailLogEntriesResponse_SuppressionInfo$json = const {
'6': '.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason',
'10': 'reason'
},
const {
'1': 'suppressed_count',
'3': 2,
'4': 1,
'5': 5,
'10': 'suppressedCount'
},
{'1': 'suppressed_count', '3': 2, '4': 1, '5': 5, '10': 'suppressedCount'},
],
'4': const [TailLogEntriesResponse_SuppressionInfo_Reason$json],
'4': [TailLogEntriesResponse_SuppressionInfo_Reason$json],
};
const TailLogEntriesResponse_SuppressionInfo_Reason$json = const {
@$core.Deprecated('Use tailLogEntriesResponseDescriptor instead')
const TailLogEntriesResponse_SuppressionInfo_Reason$json = {
'1': 'Reason',
'2': const [
const {'1': 'REASON_UNSPECIFIED', '2': 0},
const {'1': 'RATE_LIMIT', '2': 1},
const {'1': 'NOT_CONSUMED', '2': 2},
'2': [
{'1': 'REASON_UNSPECIFIED', '2': 0},
{'1': 'RATE_LIMIT', '2': 1},
{'1': 'NOT_CONSUMED', '2': 2},
],
};
/// Descriptor for `TailLogEntriesResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List tailLogEntriesResponseDescriptor = $convert.base64Decode(
'ChZUYWlsTG9nRW50cmllc1Jlc3BvbnNlEjUKB2VudHJpZXMYASADKAsyGy5nb29nbGUubG9nZ2'
'luZy52Mi5Mb2dFbnRyeVIHZW50cmllcxJkChBzdXBwcmVzc2lvbl9pbmZvGAIgAygLMjkuZ29v'
'Z2xlLmxvZ2dpbmcudjIuVGFpbExvZ0VudHJpZXNSZXNwb25zZS5TdXBwcmVzc2lvbkluZm9SD3'
'N1cHByZXNzaW9uSW5mbxraAQoPU3VwcHJlc3Npb25JbmZvElgKBnJlYXNvbhgBIAEoDjJALmdv'
'b2dsZS5sb2dnaW5nLnYyLlRhaWxMb2dFbnRyaWVzUmVzcG9uc2UuU3VwcHJlc3Npb25JbmZvLl'
'JlYXNvblIGcmVhc29uEikKEHN1cHByZXNzZWRfY291bnQYAiABKAVSD3N1cHByZXNzZWRDb3Vu'
'dCJCCgZSZWFzb24SFgoSUkVBU09OX1VOU1BFQ0lGSUVEEAASDgoKUkFURV9MSU1JVBABEhAKDE'
'5PVF9DT05TVU1FRBAC');

View File

@ -1,61 +1,138 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/any.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
/// `Any` contains an arbitrary serialized protocol buffer message along with a
/// URL that describes the type of the serialized message.
///
/// Protobuf library provides support to pack/unpack Any values in the form
/// of utility functions or additional generated methods of the Any type.
///
/// Example 1: Pack and unpack a message in C++.
///
/// Foo foo = ...;
/// Any any;
/// any.PackFrom(foo);
/// ...
/// if (any.UnpackTo(&foo)) {
/// ...
/// }
///
/// Example 2: Pack and unpack a message in Java.
///
/// Foo foo = ...;
/// Any any = Any.pack(foo);
/// ...
/// if (any.is(Foo.class)) {
/// foo = any.unpack(Foo.class);
/// }
/// // or ...
/// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
/// foo = any.unpack(Foo.getDefaultInstance());
/// }
///
/// Example 3: Pack and unpack a message in Python.
///
/// foo = Foo(...)
/// any = Any()
/// any.Pack(foo)
/// ...
/// if any.Is(Foo.DESCRIPTOR):
/// any.Unpack(foo)
/// ...
///
/// Example 4: Pack and unpack a message in Go
///
/// foo := &pb.Foo{...}
/// any, err := anypb.New(foo)
/// if err != nil {
/// ...
/// }
/// ...
/// foo := &pb.Foo{}
/// if err := any.UnmarshalTo(foo); err != nil {
/// ...
/// }
///
/// The pack methods provided by protobuf library will by default use
/// 'type.googleapis.com/full.type.name' as the type URL and the unpack
/// methods only use the fully qualified type name after the last '/'
/// in the type URL, for example "foo.bar.com/x/y.z" will yield type
/// name "y.z".
///
/// JSON
/// ====
/// The JSON representation of an `Any` value uses the regular
/// representation of the deserialized, embedded message, with an
/// additional field `@type` which contains the type URL. Example:
///
/// package google.profile;
/// message Person {
/// string first_name = 1;
/// string last_name = 2;
/// }
///
/// {
/// "@type": "type.googleapis.com/google.profile.Person",
/// "firstName": <string>,
/// "lastName": <string>
/// }
///
/// If the embedded message type is well-known and has a custom JSON
/// representation, that representation will be embedded adding a field
/// `value` which holds the custom JSON in addition to the `@type`
/// field. Example (for message [google.protobuf.Duration][]):
///
/// {
/// "@type": "type.googleapis.com/google.protobuf.Duration",
/// "value": "1.212s"
/// }
class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Any',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.AnyMixin.toProto3JsonHelper,
fromProto3Json: $mixin.AnyMixin.fromProto3JsonHelper)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'typeUrl')
..a<$core.List<$core.int>>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'value',
$pb.PbFieldType.OY)
..hasRequiredFields = false;
Any._() : super();
factory Any({
$core.String typeUrl,
$core.List<$core.int> value,
$core.String? typeUrl,
$core.List<$core.int>? value,
}) {
final _result = create();
final result = create();
if (typeUrl != null) {
_result.typeUrl = typeUrl;
result.typeUrl = typeUrl;
}
if (value != null) {
_result.value = value;
result.value = value;
}
return _result;
return result;
}
Any._() : super();
factory Any.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Any.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Any',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.AnyMixin.toProto3JsonHelper,
fromProto3Json: $mixin.AnyMixin.fromProto3JsonHelper)
..aOS(1, _omitFieldNames ? '' : 'typeUrl')
..a<$core.List<$core.int>>(
2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OY)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -63,9 +140,11 @@ class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Any copyWith(void Function(Any) updates) => super.copyWith(
(message) => updates(message as Any)); // ignore: deprecated_member_use
Any copyWith(void Function(Any) updates) =>
super.copyWith((message) => updates(message as Any)) as Any;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Any create() => Any._();
Any createEmptyInstance() => create();
@ -73,8 +152,36 @@ class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
@$core.pragma('dart2js:noInline')
static Any getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Any>(create);
static Any _defaultInstance;
static Any? _defaultInstance;
/// A URL/resource name that uniquely identifies the type of the serialized
/// protocol buffer message. This string must contain at least
/// one "/" character. The last segment of the URL's path must represent
/// the fully qualified name of the type (as in
/// `path/google.protobuf.Duration`). The name should be in a canonical form
/// (e.g., leading "." is not accepted).
///
/// In practice, teams usually precompile into the binary all types that they
/// expect it to use in the context of Any. However, for URLs which use the
/// scheme `http`, `https`, or no scheme, one can optionally set up a type
/// server that maps type URLs to message definitions as follows:
///
/// * If no scheme is provided, `https` is assumed.
/// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
/// value in binary format, or produce an error.
/// * Applications are allowed to cache lookup results based on the
/// URL, or have them precompiled into a binary to avoid any
/// lookup. Therefore, binary compatibility needs to be preserved
/// on changes to types. (Use versioned type names to manage
/// breaking changes.)
///
/// Note: this functionality is not currently available in the official
/// protobuf release, and it is not used for type URLs beginning with
/// type.googleapis.com. As of May 2023, there are no widely used type server
/// implementations and no plans to implement one.
///
/// Schemes other than `http`, `https` (or the empty scheme) might be
/// used with implementation specific semantics.
@$pb.TagNumber(1)
$core.String get typeUrl => $_getSZ(0);
@$pb.TagNumber(1)
@ -87,6 +194,7 @@ class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
@$pb.TagNumber(1)
void clearTypeUrl() => clearField(1);
/// Must be a valid serialized protocol buffer of the above specified type.
@$pb.TagNumber(2)
$core.List<$core.int> get value => $_getN(1);
@$pb.TagNumber(2)
@ -110,3 +218,7 @@ class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
return result;
}
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/any.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,14 +1,27 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/any.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Any$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use anyDescriptor instead')
const Any$json = {
'1': 'Any',
'2': const [
const {'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'},
const {'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'},
'2': [
{'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'},
{'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'},
],
};
/// Descriptor for `Any`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List anyDescriptor = $convert.base64Decode(
'CgNBbnkSGQoIdHlwZV91cmwYASABKAlSB3R5cGVVcmwSFAoFdmFsdWUYAiABKAxSBXZhbHVl');

View File

@ -1,62 +1,111 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/duration.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
/// A Duration represents a signed, fixed-length span of time represented
/// as a count of seconds and fractions of seconds at nanosecond
/// resolution. It is independent of any calendar and concepts like "day"
/// or "month". It is related to Timestamp in that the difference between
/// two Timestamp values is a Duration and it can be added or subtracted
/// from a Timestamp. Range is approximately +-10,000 years.
///
/// # Examples
///
/// Example 1: Compute Duration from two Timestamps in pseudo code.
///
/// Timestamp start = ...;
/// Timestamp end = ...;
/// Duration duration = ...;
///
/// duration.seconds = end.seconds - start.seconds;
/// duration.nanos = end.nanos - start.nanos;
///
/// if (duration.seconds < 0 && duration.nanos > 0) {
/// duration.seconds += 1;
/// duration.nanos -= 1000000000;
/// } else if (duration.seconds > 0 && duration.nanos < 0) {
/// duration.seconds -= 1;
/// duration.nanos += 1000000000;
/// }
///
/// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
///
/// Timestamp start = ...;
/// Duration duration = ...;
/// Timestamp end = ...;
///
/// end.seconds = start.seconds + duration.seconds;
/// end.nanos = start.nanos + duration.nanos;
///
/// if (end.nanos < 0) {
/// end.seconds -= 1;
/// end.nanos += 1000000000;
/// } else if (end.nanos >= 1000000000) {
/// end.seconds += 1;
/// end.nanos -= 1000000000;
/// }
///
/// Example 3: Compute Duration from datetime.timedelta in Python.
///
/// td = datetime.timedelta(days=3, minutes=10)
/// duration = Duration()
/// duration.FromTimedelta(td)
///
/// # JSON Mapping
///
/// In JSON format, the Duration type is encoded as a string rather than an
/// object, where the string ends in the suffix "s" (indicating seconds) and
/// is preceded by the number of seconds, with nanoseconds expressed as
/// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
/// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
/// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
/// microsecond should be expressed in JSON format as "3.000001s".
class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Duration',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.DurationMixin.toProto3JsonHelper,
fromProto3Json: $mixin.DurationMixin.fromProto3JsonHelper)
..aInt64(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'seconds')
..a<$core.int>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'nanos',
$pb.PbFieldType.O3)
..hasRequiredFields = false;
Duration._() : super();
factory Duration({
$fixnum.Int64 seconds,
$core.int nanos,
$fixnum.Int64? seconds,
$core.int? nanos,
}) {
final _result = create();
final result = create();
if (seconds != null) {
_result.seconds = seconds;
result.seconds = seconds;
}
if (nanos != null) {
_result.nanos = nanos;
result.nanos = nanos;
}
return _result;
return result;
}
Duration._() : super();
factory Duration.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Duration.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Duration',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.DurationMixin.toProto3JsonHelper,
fromProto3Json: $mixin.DurationMixin.fromProto3JsonHelper)
..aInt64(1, _omitFieldNames ? '' : 'seconds')
..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -65,9 +114,10 @@ class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Duration copyWith(void Function(Duration) updates) =>
super.copyWith((message) =>
updates(message as Duration)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as Duration)) as Duration;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Duration create() => Duration._();
Duration createEmptyInstance() => create();
@ -75,8 +125,11 @@ class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
@$core.pragma('dart2js:noInline')
static Duration getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Duration>(create);
static Duration _defaultInstance;
static Duration? _defaultInstance;
/// Signed seconds of the span of time. Must be from -315,576,000,000
/// to +315,576,000,000 inclusive. Note: these bounds are computed from:
/// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
@$pb.TagNumber(1)
$fixnum.Int64 get seconds => $_getI64(0);
@$pb.TagNumber(1)
@ -89,6 +142,12 @@ class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
@$pb.TagNumber(1)
void clearSeconds() => clearField(1);
/// Signed fractions of a second at nanosecond resolution of the span
/// of time. Durations less than one second are represented with a 0
/// `seconds` field and a positive or negative `nanos` field. For durations
/// of one second or more, a non-zero value for the `nanos` field must be
/// of the same sign as the `seconds` field. Must be from -999,999,999
/// to +999,999,999 inclusive.
@$pb.TagNumber(2)
$core.int get nanos => $_getIZ(1);
@$pb.TagNumber(2)
@ -101,3 +160,7 @@ class Duration extends $pb.GeneratedMessage with $mixin.DurationMixin {
@$pb.TagNumber(2)
void clearNanos() => clearField(2);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/duration.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,14 +1,28 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/duration.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Duration$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use durationDescriptor instead')
const Duration$json = {
'1': 'Duration',
'2': const [
const {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'},
const {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'},
'2': [
{'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'},
{'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'},
],
};
/// Descriptor for `Duration`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List durationDescriptor = $convert.base64Decode(
'CghEdXJhdGlvbhIYCgdzZWNvbmRzGAEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW'
'5vcw==');

View File

@ -1,34 +1,42 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/empty.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// A generic empty message that you can re-use to avoid defining duplicated
/// empty messages in your APIs. A typical example is to use it as the request
/// or the response type of an API method. For instance:
///
/// service Foo {
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
/// }
class Empty extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Empty',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create)
..hasRequiredFields = false;
Empty._() : super();
factory Empty() => create();
Empty._() : super();
factory Empty.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Empty.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Empty',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -36,9 +44,11 @@ class Empty extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Empty copyWith(void Function(Empty) updates) => super.copyWith(
(message) => updates(message as Empty)); // ignore: deprecated_member_use
Empty copyWith(void Function(Empty) updates) =>
super.copyWith((message) => updates(message as Empty)) as Empty;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Empty create() => Empty._();
Empty createEmptyInstance() => create();
@ -46,5 +56,8 @@ class Empty extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Empty getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Empty>(create);
static Empty _defaultInstance;
static Empty? _defaultInstance;
}
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/empty.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,10 +1,23 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/empty.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Empty$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use emptyDescriptor instead')
const Empty$json = {
'1': 'Empty',
};
/// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List emptyDescriptor =
$convert.base64Decode('CgVFbXB0eQ==');

View File

@ -1,60 +1,65 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
import 'struct.pbenum.dart';
export 'struct.pbenum.dart';
/// `Struct` represents a structured data value, consisting of fields
/// which map to dynamically typed values. In some languages, `Struct`
/// might be supported by a native representation. For example, in
/// scripting languages like JS a struct is represented as an
/// object. The details of that representation are described together
/// with the proto support for the language.
///
/// The JSON representation for `Struct` is JSON object.
class Struct extends $pb.GeneratedMessage with $mixin.StructMixin {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Struct',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.StructMixin.toProto3JsonHelper,
fromProto3Json: $mixin.StructMixin.fromProto3JsonHelper)
..m<$core.String, Value>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'fields',
entryClassName: 'Struct.FieldsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OM,
valueCreator: Value.create,
packageName: const $pb.PackageName('google.protobuf'))
..hasRequiredFields = false;
Struct._() : super();
factory Struct({
$core.Map<$core.String, Value> fields,
$core.Map<$core.String, Value>? fields,
}) {
final _result = create();
final result = create();
if (fields != null) {
_result.fields.addAll(fields);
result.fields.addAll(fields);
}
return _result;
return result;
}
Struct._() : super();
factory Struct.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Struct.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Struct',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.StructMixin.toProto3JsonHelper,
fromProto3Json: $mixin.StructMixin.fromProto3JsonHelper)
..m<$core.String, Value>(1, _omitFieldNames ? '' : 'fields',
entryClassName: 'Struct.FieldsEntry',
keyFieldType: $pb.PbFieldType.OS,
valueFieldType: $pb.PbFieldType.OM,
valueCreator: Value.create,
valueDefaultOrMaker: Value.getDefault,
packageName: const $pb.PackageName('google.protobuf'))
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -62,9 +67,11 @@ class Struct extends $pb.GeneratedMessage with $mixin.StructMixin {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Struct copyWith(void Function(Struct) updates) => super.copyWith(
(message) => updates(message as Struct)); // ignore: deprecated_member_use
Struct copyWith(void Function(Struct) updates) =>
super.copyWith((message) => updates(message as Struct)) as Struct;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Struct create() => Struct._();
Struct createEmptyInstance() => create();
@ -72,8 +79,9 @@ class Struct extends $pb.GeneratedMessage with $mixin.StructMixin {
@$core.pragma('dart2js:noInline')
static Struct getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Struct>(create);
static Struct _defaultInstance;
static Struct? _defaultInstance;
/// Unordered map of dynamically typed values.
@$pb.TagNumber(1)
$core.Map<$core.String, Value> get fields => $_getMap(0);
}
@ -88,7 +96,50 @@ enum Value_Kind {
notSet
}
/// `Value` represents a dynamically typed value which can be either
/// null, a number, a string, a boolean, a recursive struct value, or a
/// list of values. A producer of value is expected to set one of these
/// variants. Absence of any variant indicates an error.
///
/// The JSON representation for `Value` is JSON value.
class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
factory Value({
NullValue? nullValue,
$core.double? numberValue,
$core.String? stringValue,
$core.bool? boolValue,
Struct? structValue,
ListValue? listValue,
}) {
final result = create();
if (nullValue != null) {
result.nullValue = nullValue;
}
if (numberValue != null) {
result.numberValue = numberValue;
}
if (stringValue != null) {
result.stringValue = stringValue;
}
if (boolValue != null) {
result.boolValue = boolValue;
}
if (structValue != null) {
result.structValue = structValue;
}
if (listValue != null) {
result.listValue = listValue;
}
return result;
}
Value._() : super();
factory Value.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Value.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static const $core.Map<$core.int, Value_Kind> _Value_KindByTag = {
1: Value_Kind.nullValue,
2: Value_Kind.numberValue,
@ -99,71 +150,27 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
0: Value_Kind.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Value',
package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
_omitMessageNames ? '' : 'Value',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.ValueMixin.toProto3JsonHelper,
fromProto3Json: $mixin.ValueMixin.fromProto3JsonHelper)
..oo(0, [1, 2, 3, 4, 5, 6])
..e<NullValue>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'nullValue',
$pb.PbFieldType.OE,
..e<NullValue>(1, _omitFieldNames ? '' : 'nullValue', $pb.PbFieldType.OE,
defaultOrMaker: NullValue.NULL_VALUE,
valueOf: NullValue.valueOf,
enumValues: NullValue.values)
..a<$core.double>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'numberValue',
$pb.PbFieldType.OD)
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'stringValue')
..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'boolValue')
..aOM<Struct>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'structValue', subBuilder: Struct.create)
..aOM<ListValue>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'listValue', subBuilder: ListValue.create)
2, _omitFieldNames ? '' : 'numberValue', $pb.PbFieldType.OD)
..aOS(3, _omitFieldNames ? '' : 'stringValue')
..aOB(4, _omitFieldNames ? '' : 'boolValue')
..aOM<Struct>(5, _omitFieldNames ? '' : 'structValue',
subBuilder: Struct.create)
..aOM<ListValue>(6, _omitFieldNames ? '' : 'listValue',
subBuilder: ListValue.create)
..hasRequiredFields = false;
Value._() : super();
factory Value({
NullValue nullValue,
$core.double numberValue,
$core.String stringValue,
$core.bool boolValue,
Struct structValue,
ListValue listValue,
}) {
final _result = create();
if (nullValue != null) {
_result.nullValue = nullValue;
}
if (numberValue != null) {
_result.numberValue = numberValue;
}
if (stringValue != null) {
_result.stringValue = stringValue;
}
if (boolValue != null) {
_result.boolValue = boolValue;
}
if (structValue != null) {
_result.structValue = structValue;
}
if (listValue != null) {
_result.listValue = listValue;
}
return _result;
}
factory Value.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Value.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -171,9 +178,11 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Value copyWith(void Function(Value) updates) => super.copyWith(
(message) => updates(message as Value)); // ignore: deprecated_member_use
Value copyWith(void Function(Value) updates) =>
super.copyWith((message) => updates(message as Value)) as Value;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Value create() => Value._();
Value createEmptyInstance() => create();
@ -181,11 +190,12 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$core.pragma('dart2js:noInline')
static Value getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Value>(create);
static Value _defaultInstance;
static Value? _defaultInstance;
Value_Kind whichKind() => _Value_KindByTag[$_whichOneof(0)];
Value_Kind whichKind() => _Value_KindByTag[$_whichOneof(0)]!;
void clearKind() => clearField($_whichOneof(0));
/// Represents a null value.
@$pb.TagNumber(1)
NullValue get nullValue => $_getN(0);
@$pb.TagNumber(1)
@ -198,6 +208,7 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$pb.TagNumber(1)
void clearNullValue() => clearField(1);
/// Represents a double value.
@$pb.TagNumber(2)
$core.double get numberValue => $_getN(1);
@$pb.TagNumber(2)
@ -210,6 +221,7 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$pb.TagNumber(2)
void clearNumberValue() => clearField(2);
/// Represents a string value.
@$pb.TagNumber(3)
$core.String get stringValue => $_getSZ(2);
@$pb.TagNumber(3)
@ -222,6 +234,7 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$pb.TagNumber(3)
void clearStringValue() => clearField(3);
/// Represents a boolean value.
@$pb.TagNumber(4)
$core.bool get boolValue => $_getBF(3);
@$pb.TagNumber(4)
@ -234,6 +247,7 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$pb.TagNumber(4)
void clearBoolValue() => clearField(4);
/// Represents a structured value.
@$pb.TagNumber(5)
Struct get structValue => $_getN(4);
@$pb.TagNumber(5)
@ -248,6 +262,7 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
@$pb.TagNumber(5)
Struct ensureStructValue() => $_ensure(4);
/// Represents a repeated `Value`.
@$pb.TagNumber(6)
ListValue get listValue => $_getN(5);
@$pb.TagNumber(6)
@ -263,43 +278,38 @@ class Value extends $pb.GeneratedMessage with $mixin.ValueMixin {
ListValue ensureListValue() => $_ensure(5);
}
/// `ListValue` is a wrapper around a repeated field of values.
///
/// The JSON representation for `ListValue` is JSON array.
class ListValue extends $pb.GeneratedMessage with $mixin.ListValueMixin {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'ListValue',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.ListValueMixin.toProto3JsonHelper,
fromProto3Json: $mixin.ListValueMixin.fromProto3JsonHelper)
..pc<Value>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'values',
$pb.PbFieldType.PM,
subBuilder: Value.create)
..hasRequiredFields = false;
ListValue._() : super();
factory ListValue({
$core.Iterable<Value> values,
$core.Iterable<Value>? values,
}) {
final _result = create();
final result = create();
if (values != null) {
_result.values.addAll(values);
result.values.addAll(values);
}
return _result;
return result;
}
ListValue._() : super();
factory ListValue.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory ListValue.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ListValue',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.ListValueMixin.toProto3JsonHelper,
fromProto3Json: $mixin.ListValueMixin.fromProto3JsonHelper)
..pc<Value>(1, _omitFieldNames ? '' : 'values', $pb.PbFieldType.PM,
subBuilder: Value.create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -308,9 +318,10 @@ class ListValue extends $pb.GeneratedMessage with $mixin.ListValueMixin {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ListValue copyWith(void Function(ListValue) updates) =>
super.copyWith((message) =>
updates(message as ListValue)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as ListValue)) as ListValue;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ListValue create() => ListValue._();
ListValue createEmptyInstance() => create();
@ -318,8 +329,13 @@ class ListValue extends $pb.GeneratedMessage with $mixin.ListValueMixin {
@$core.pragma('dart2js:noInline')
static ListValue getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ListValue>(create);
static ListValue _defaultInstance;
static ListValue? _defaultInstance;
/// Repeated field of dynamically typed values.
@$pb.TagNumber(1)
$core.List<Value> get values => $_getList(0);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,20 +1,25 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// `NullValue` is a singleton enumeration to represent the null value for the
/// `Value` type union.
///
/// The JSON representation for `NullValue` is JSON `null`.
class NullValue extends $pb.ProtobufEnum {
static const NullValue NULL_VALUE = NullValue._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'NULL_VALUE');
static const NullValue NULL_VALUE =
NullValue._(0, _omitEnumNames ? '' : 'NULL_VALUE');
static const $core.List<NullValue> values = <NullValue>[
NULL_VALUE,
@ -22,7 +27,9 @@ class NullValue extends $pb.ProtobufEnum {
static final $core.Map<$core.int, NullValue> _byValue =
$pb.ProtobufEnum.initByValue(values);
static NullValue valueOf($core.int value) => _byValue[value];
static NullValue? valueOf($core.int value) => _byValue[value];
const NullValue._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,21 +1,35 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const NullValue$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use nullValueDescriptor instead')
const NullValue$json = {
'1': 'NullValue',
'2': const [
const {'1': 'NULL_VALUE', '2': 0},
'2': [
{'1': 'NULL_VALUE', '2': 0},
],
};
const Struct$json = const {
/// Descriptor for `NullValue`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List nullValueDescriptor =
$convert.base64Decode('CglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAA');
@$core.Deprecated('Use structDescriptor instead')
const Struct$json = {
'1': 'Struct',
'2': const [
const {
'2': [
{
'1': 'fields',
'3': 1,
'4': 3,
@ -24,14 +38,15 @@ const Struct$json = const {
'10': 'fields'
},
],
'3': const [Struct_FieldsEntry$json],
'3': [Struct_FieldsEntry$json],
};
const Struct_FieldsEntry$json = const {
@$core.Deprecated('Use structDescriptor instead')
const Struct_FieldsEntry$json = {
'1': 'FieldsEntry',
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{
'1': 'value',
'3': 2,
'4': 1,
@ -40,13 +55,20 @@ const Struct_FieldsEntry$json = const {
'10': 'value'
},
],
'7': const {'7': true},
'7': {'7': true},
};
const Value$json = const {
/// Descriptor for `Struct`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List structDescriptor = $convert.base64Decode(
'CgZTdHJ1Y3QSOwoGZmllbGRzGAEgAygLMiMuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdC5GaWVsZH'
'NFbnRyeVIGZmllbGRzGlEKC0ZpZWxkc0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EiwKBXZhbHVl'
'GAIgASgLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgV2YWx1ZToCOAE=');
@$core.Deprecated('Use valueDescriptor instead')
const Value$json = {
'1': 'Value',
'2': const [
const {
'2': [
{
'1': 'null_value',
'3': 1,
'4': 1,
@ -55,31 +77,10 @@ const Value$json = const {
'9': 0,
'10': 'nullValue'
},
const {
'1': 'number_value',
'3': 2,
'4': 1,
'5': 1,
'9': 0,
'10': 'numberValue'
},
const {
'1': 'string_value',
'3': 3,
'4': 1,
'5': 9,
'9': 0,
'10': 'stringValue'
},
const {
'1': 'bool_value',
'3': 4,
'4': 1,
'5': 8,
'9': 0,
'10': 'boolValue'
},
const {
{'1': 'number_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'numberValue'},
{'1': 'string_value', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'stringValue'},
{'1': 'bool_value', '3': 4, '4': 1, '5': 8, '9': 0, '10': 'boolValue'},
{
'1': 'struct_value',
'3': 5,
'4': 1,
@ -88,7 +89,7 @@ const Value$json = const {
'9': 0,
'10': 'structValue'
},
const {
{
'1': 'list_value',
'3': 6,
'4': 1,
@ -98,15 +99,25 @@ const Value$json = const {
'10': 'listValue'
},
],
'8': const [
const {'1': 'kind'},
'8': [
{'1': 'kind'},
],
};
const ListValue$json = const {
/// Descriptor for `Value`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List valueDescriptor = $convert.base64Decode(
'CgVWYWx1ZRI7CgpudWxsX3ZhbHVlGAEgASgOMhouZ29vZ2xlLnByb3RvYnVmLk51bGxWYWx1ZU'
'gAUgludWxsVmFsdWUSIwoMbnVtYmVyX3ZhbHVlGAIgASgBSABSC251bWJlclZhbHVlEiMKDHN0'
'cmluZ192YWx1ZRgDIAEoCUgAUgtzdHJpbmdWYWx1ZRIfCgpib29sX3ZhbHVlGAQgASgISABSCW'
'Jvb2xWYWx1ZRI8CgxzdHJ1Y3RfdmFsdWUYBSABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0'
'SABSC3N0cnVjdFZhbHVlEjsKCmxpc3RfdmFsdWUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuTG'
'lzdFZhbHVlSABSCWxpc3RWYWx1ZUIGCgRraW5k');
@$core.Deprecated('Use listValueDescriptor instead')
const ListValue$json = {
'1': 'ListValue',
'2': const [
const {
'2': [
{
'1': 'values',
'3': 1,
'4': 3,
@ -116,3 +127,8 @@ const ListValue$json = const {
},
],
};
/// Descriptor for `ListValue`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listValueDescriptor = $convert.base64Decode(
'CglMaXN0VmFsdWUSLgoGdmFsdWVzGAEgAygLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgZ2YW'
'x1ZXM=');

View File

@ -1,62 +1,142 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/timestamp.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
/// A Timestamp represents a point in time independent of any time zone or local
/// calendar, encoded as a count of seconds and fractions of seconds at
/// nanosecond resolution. The count is relative to an epoch at UTC midnight on
/// January 1, 1970, in the proleptic Gregorian calendar which extends the
/// Gregorian calendar backwards to year one.
///
/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
/// second table is needed for interpretation, using a [24-hour linear
/// smear](https://developers.google.com/time/smear).
///
/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
/// restricting to that range, we ensure that we can convert to and from [RFC
/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
///
/// # Examples
///
/// Example 1: Compute Timestamp from POSIX `time()`.
///
/// Timestamp timestamp;
/// timestamp.set_seconds(time(NULL));
/// timestamp.set_nanos(0);
///
/// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
///
/// struct timeval tv;
/// gettimeofday(&tv, NULL);
///
/// Timestamp timestamp;
/// timestamp.set_seconds(tv.tv_sec);
/// timestamp.set_nanos(tv.tv_usec * 1000);
///
/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
///
/// FILETIME ft;
/// GetSystemTimeAsFileTime(&ft);
/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
///
/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
/// Timestamp timestamp;
/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
///
/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
///
/// long millis = System.currentTimeMillis();
///
/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
/// .setNanos((int) ((millis % 1000) * 1000000)).build();
///
/// Example 5: Compute Timestamp from Java `Instant.now()`.
///
/// Instant now = Instant.now();
///
/// Timestamp timestamp =
/// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
/// .setNanos(now.getNano()).build();
///
/// Example 6: Compute Timestamp from current time in Python.
///
/// timestamp = Timestamp()
/// timestamp.GetCurrentTime()
///
/// # JSON Mapping
///
/// In JSON format, the Timestamp type is encoded as a string in the
/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
/// where {year} is always expressed using four digits while {month}, {day},
/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
/// is required. A proto3 JSON serializer should always use UTC (as indicated by
/// "Z") when printing the Timestamp type and a proto3 JSON parser should be
/// able to accept both UTC and other timezones (as indicated by an offset).
///
/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
/// 01:30 UTC on January 15, 2017.
///
/// In JavaScript, one can convert a Date object to this format using the
/// standard
/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
/// method. In Python, a standard `datetime.datetime` object can be converted
/// to this format using
/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
/// the Joda Time's [`ISODateTimeFormat.dateTime()`](
/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
/// ) to obtain a formatter capable of generating timestamps in this format.
class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Timestamp',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.TimestampMixin.toProto3JsonHelper,
fromProto3Json: $mixin.TimestampMixin.fromProto3JsonHelper)
..aInt64(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'seconds')
..a<$core.int>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'nanos',
$pb.PbFieldType.O3)
..hasRequiredFields = false;
Timestamp._() : super();
factory Timestamp({
$fixnum.Int64 seconds,
$core.int nanos,
$fixnum.Int64? seconds,
$core.int? nanos,
}) {
final _result = create();
final result = create();
if (seconds != null) {
_result.seconds = seconds;
result.seconds = seconds;
}
if (nanos != null) {
_result.nanos = nanos;
result.nanos = nanos;
}
return _result;
return result;
}
Timestamp._() : super();
factory Timestamp.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Timestamp.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Timestamp',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create,
toProto3Json: $mixin.TimestampMixin.toProto3JsonHelper,
fromProto3Json: $mixin.TimestampMixin.fromProto3JsonHelper)
..aInt64(1, _omitFieldNames ? '' : 'seconds')
..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -65,9 +145,10 @@ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Timestamp copyWith(void Function(Timestamp) updates) =>
super.copyWith((message) =>
updates(message as Timestamp)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as Timestamp)) as Timestamp;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Timestamp create() => Timestamp._();
Timestamp createEmptyInstance() => create();
@ -75,8 +156,11 @@ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
@$core.pragma('dart2js:noInline')
static Timestamp getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Timestamp>(create);
static Timestamp _defaultInstance;
static Timestamp? _defaultInstance;
/// Represents seconds of UTC time since Unix epoch
/// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
/// 9999-12-31T23:59:59Z inclusive.
@$pb.TagNumber(1)
$fixnum.Int64 get seconds => $_getI64(0);
@$pb.TagNumber(1)
@ -89,6 +173,10 @@ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
@$pb.TagNumber(1)
void clearSeconds() => clearField(1);
/// Non-negative fractions of a second at nanosecond resolution. Negative
/// second values with fractions must still have non-negative nanos values
/// that count forward in time. Must be from 0 to 999,999,999
/// inclusive.
@$pb.TagNumber(2)
$core.int get nanos => $_getIZ(1);
@$pb.TagNumber(2)
@ -110,3 +198,7 @@ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
return result;
}
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/timestamp.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,14 +1,28 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/timestamp.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Timestamp$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use timestampDescriptor instead')
const Timestamp$json = {
'1': 'Timestamp',
'2': const [
const {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'},
const {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'},
'2': [
{'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'},
{'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'},
],
};
/// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode(
'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm'
'Fub3M=');

View File

@ -1,9 +1,13 @@
///
//
// Generated code. Do not modify.
// source: google/rpc/status.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
@ -11,58 +15,49 @@ import 'package:protobuf/protobuf.dart' as $pb;
import '../protobuf/any.pb.dart' as $0;
/// The `Status` type defines a logical error model that is suitable for
/// different programming environments, including REST APIs and RPC APIs. It is
/// used by [gRPC](https://github.com/grpc). Each `Status` message contains
/// three pieces of data: error code, error message, and error details.
///
/// You can find out more about this error model and how to work with it in the
/// [API Design Guide](https://cloud.google.com/apis/design/errors).
class Status extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i =
$pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Status',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'google.rpc'),
createEmptyInstance: create)
..a<$core.int>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'code',
$pb.PbFieldType.O3)
..aOS(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..pc<$0.Any>(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'details',
$pb.PbFieldType.PM,
subBuilder: $0.Any.create)
..hasRequiredFields = false;
Status._() : super();
factory Status({
$core.int code,
$core.String message,
$core.Iterable<$0.Any> details,
$core.int? code,
$core.String? message,
$core.Iterable<$0.Any>? details,
}) {
final _result = create();
final result = create();
if (code != null) {
_result.code = code;
result.code = code;
}
if (message != null) {
_result.message = message;
result.message = message;
}
if (details != null) {
_result.details.addAll(details);
result.details.addAll(details);
}
return _result;
return result;
}
Status._() : super();
factory Status.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Status.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Status',
package: const $pb.PackageName(_omitMessageNames ? '' : 'google.rpc'),
createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'code', $pb.PbFieldType.O3)
..aOS(2, _omitFieldNames ? '' : 'message')
..pc<$0.Any>(3, _omitFieldNames ? '' : 'details', $pb.PbFieldType.PM,
subBuilder: $0.Any.create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -70,9 +65,11 @@ class Status extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Status copyWith(void Function(Status) updates) => super.copyWith(
(message) => updates(message as Status)); // ignore: deprecated_member_use
Status copyWith(void Function(Status) updates) =>
super.copyWith((message) => updates(message as Status)) as Status;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Status create() => Status._();
Status createEmptyInstance() => create();
@ -80,8 +77,10 @@ class Status extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Status getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Status>(create);
static Status _defaultInstance;
static Status? _defaultInstance;
/// The status code, which should be an enum value of
/// [google.rpc.Code][google.rpc.Code].
@$pb.TagNumber(1)
$core.int get code => $_getIZ(0);
@$pb.TagNumber(1)
@ -94,6 +93,10 @@ class Status extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearCode() => clearField(1);
/// A developer-facing error message, which should be in English. Any
/// user-facing error message should be localized and sent in the
/// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
/// by the client.
@$pb.TagNumber(2)
$core.String get message => $_getSZ(1);
@$pb.TagNumber(2)
@ -106,6 +109,12 @@ class Status extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearMessage() => clearField(2);
/// A list of messages that carry the error details. There is a common set of
/// message types for APIs to use.
@$pb.TagNumber(3)
$core.List<$0.Any> get details => $_getList(2);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: google/rpc/status.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,16 +1,25 @@
///
//
// Generated code. Do not modify.
// source: google/rpc/status.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Status$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use statusDescriptor instead')
const Status$json = {
'1': 'Status',
'2': const [
const {'1': 'code', '3': 1, '4': 1, '5': 5, '10': 'code'},
const {'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
const {
'2': [
{'1': 'code', '3': 1, '4': 1, '5': 5, '10': 'code'},
{'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
{
'1': 'details',
'3': 3,
'4': 3,
@ -20,3 +29,8 @@ const Status$json = const {
},
],
};
/// Descriptor for `Status`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List statusDescriptor = $convert.base64Decode(
'CgZTdGF0dXMSEgoEY29kZRgBIAEoBVIEY29kZRIYCgdtZXNzYWdlGAIgASgJUgdtZXNzYWdlEi'
'4KB2RldGFpbHMYAyADKAsyFC5nb29nbGUucHJvdG9idWYuQW55UgdkZXRhaWxz');

View File

@ -3,13 +3,15 @@ description: Dart gRPC client sample for Google APIs
publish_to: none
environment:
sdk: '>=2.2.0 <3.0.0'
sdk: ^3.8.0
dependencies:
async: ^2.2.0
async: ^2.13.0
fixnum: ^1.1.1
grpc:
path: ../../
protobuf: ^2.0.0-nullsafety
protobuf: ^4.1.0
dev_dependencies:
test: ^1.6.4
lints: ^6.0.0
test: ^1.26.2

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
if [ ! -d "$PROTOBUF" ]; then
echo "Please set the PROTOBUF environment variable to your clone of google/protobuf."
echo "Please set the PROTOBUF environment variable to your clone of protocolbuffers/protobuf."
exit -1
fi
@ -29,4 +29,4 @@ $PROTOC $PROTOBUF/src/google/protobuf/empty.proto
$PROTOC $PROTOBUF/src/google/protobuf/struct.proto
$PROTOC $PROTOBUF/src/google/protobuf/timestamp.proto
dartfmt -w lib/src/generated
dart format lib/src/generated

View File

@ -8,7 +8,7 @@ This is meant to be used with the echo example provided by the grpc-web reposito
Install 'webdev', by running
```sh
$ pub global activate webdev
$ dart pub global activate webdev
```
You will need a clone of the [grpc-web](https://github.com/grpc/grpc-web) repository to run the example server.
@ -24,7 +24,7 @@ To compile and run the example, assuming you are in the root of the grpc-web
folder, i.e., .../example/grpc-web/, first get the dependencies by running:
```sh
$ pub get
$ dart pub get
```
Compile and run the website with:
@ -50,7 +50,7 @@ To install protoc, see the instructions on
The easiest way to get the Dart protoc plugin is by running
```sh
$ pub global activate protoc_plugin
$ dart pub global activate protoc_plugin
```
and follow the directions to add `~/.pub-cache/bin` to your PATH, if you haven't

View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -1,7 +1,21 @@
import 'dart:async';
import 'dart:html';
// Copyright (c) 2024, the gRPC project authors. Please see the AUTHORS file
// for details. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:grpc_web/src/generated/echo.pbgrpc.dart';
import 'dart:async';
import 'package:web/web.dart';
import 'src/generated/echo.pbgrpc.dart';
class EchoApp {
final EchoServiceClient _service;
@ -25,11 +39,17 @@ class EchoApp {
..message = message
..messageCount = count
..messageInterval = 500;
_service.serverStreamingEcho(request).listen((response) {
_addRightMessage(response.message);
}, onError: (error) {
_addRightMessage(error.toString());
}, onDone: () => print('Closed connection to server.'));
_service
.serverStreamingEcho(request)
.listen(
(response) {
_addRightMessage(response.message);
},
onError: (error) {
_addRightMessage(error.toString());
},
onDone: () => print('Closed connection to server.'),
);
}
void _addLeftMessage(String message) {
@ -41,13 +61,30 @@ class EchoApp {
}
void _addMessage(String message, String cssClass) {
final classes = cssClass.split(' ');
querySelector('#first').after(DivElement()
..classes.add('row')
..append(Element.tag('h2')
..append(SpanElement()
..classes.add('label')
..classes.addAll(classes)
..text = message)));
document
.querySelector('#first')!
.after(
HTMLDivElement()
..classList.add('row')
..append(
HTMLHeadingElement.h2()..append(
HTMLSpanElement()
..classList.add('label')
..classList.addAll(cssClass)
..textContent = message,
),
),
);
}
}
// The documentation of DOMTokenList.add implies it can handle multiple classes,
// but in Chrome at least it does not.
extension AddAll on DOMTokenList {
void addAll(String cssClass) {
final classes = cssClass.split(' ');
for (final c in classes) {
add(c);
}
}
}

View File

@ -1,47 +1,44 @@
///
//
// Generated code. Do not modify.
// source: echo.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class EchoRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'EchoRequest',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..hasRequiredFields = false;
EchoRequest._() : super();
factory EchoRequest({
$core.String message,
$core.String? message,
}) {
final _result = create();
final result = create();
if (message != null) {
_result.message = message;
result.message = message;
}
return _result;
return result;
}
EchoRequest._() : super();
factory EchoRequest.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory EchoRequest.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'EchoRequest',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -50,9 +47,11 @@ class EchoRequest extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
EchoRequest copyWith(void Function(EchoRequest) updates) =>
super.copyWith((message) =>
updates(message as EchoRequest)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as EchoRequest))
as EchoRequest;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static EchoRequest create() => EchoRequest._();
EchoRequest createEmptyInstance() => create();
@ -60,7 +59,7 @@ class EchoRequest extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static EchoRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<EchoRequest>(create);
static EchoRequest _defaultInstance;
static EchoRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@ -76,38 +75,31 @@ class EchoRequest extends $pb.GeneratedMessage {
}
class EchoResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'EchoResponse',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..hasRequiredFields = false;
EchoResponse._() : super();
factory EchoResponse({
$core.String message,
$core.String? message,
}) {
final _result = create();
final result = create();
if (message != null) {
_result.message = message;
result.message = message;
}
return _result;
return result;
}
EchoResponse._() : super();
factory EchoResponse.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory EchoResponse.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'EchoResponse',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -116,9 +108,11 @@ class EchoResponse extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
EchoResponse copyWith(void Function(EchoResponse) updates) =>
super.copyWith((message) =>
updates(message as EchoResponse)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as EchoResponse))
as EchoResponse;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static EchoResponse create() => EchoResponse._();
EchoResponse createEmptyInstance() => create();
@ -127,7 +121,7 @@ class EchoResponse extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static EchoResponse getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<EchoResponse>(create);
static EchoResponse _defaultInstance;
static EchoResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@ -143,58 +137,42 @@ class EchoResponse extends $pb.GeneratedMessage {
}
class ServerStreamingEchoRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'ServerStreamingEchoRequest',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..a<$core.int>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'messageCount',
$pb.PbFieldType.O3)
..a<$core.int>(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'messageInterval',
$pb.PbFieldType.O3)
..hasRequiredFields = false;
ServerStreamingEchoRequest._() : super();
factory ServerStreamingEchoRequest({
$core.String message,
$core.int messageCount,
$core.int messageInterval,
$core.String? message,
$core.int? messageCount,
$core.int? messageInterval,
}) {
final _result = create();
final result = create();
if (message != null) {
_result.message = message;
result.message = message;
}
if (messageCount != null) {
_result.messageCount = messageCount;
result.messageCount = messageCount;
}
if (messageInterval != null) {
_result.messageInterval = messageInterval;
result.messageInterval = messageInterval;
}
return _result;
return result;
}
ServerStreamingEchoRequest._() : super();
factory ServerStreamingEchoRequest.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory ServerStreamingEchoRequest.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ServerStreamingEchoRequest',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..a<$core.int>(2, _omitFieldNames ? '' : 'messageCount', $pb.PbFieldType.O3)
..a<$core.int>(
3, _omitFieldNames ? '' : 'messageInterval', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -205,9 +183,12 @@ class ServerStreamingEchoRequest extends $pb.GeneratedMessage {
'Will be removed in next major version')
ServerStreamingEchoRequest copyWith(
void Function(ServerStreamingEchoRequest) updates) =>
super.copyWith((message) => updates(message
as ServerStreamingEchoRequest)); // ignore: deprecated_member_use
super.copyWith(
(message) => updates(message as ServerStreamingEchoRequest))
as ServerStreamingEchoRequest;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoRequest create() => ServerStreamingEchoRequest._();
ServerStreamingEchoRequest createEmptyInstance() => create();
@ -216,7 +197,7 @@ class ServerStreamingEchoRequest extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<ServerStreamingEchoRequest>(create);
static ServerStreamingEchoRequest _defaultInstance;
static ServerStreamingEchoRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@ -256,38 +237,31 @@ class ServerStreamingEchoRequest extends $pb.GeneratedMessage {
}
class ServerStreamingEchoResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'ServerStreamingEchoResponse',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..hasRequiredFields = false;
ServerStreamingEchoResponse._() : super();
factory ServerStreamingEchoResponse({
$core.String message,
$core.String? message,
}) {
final _result = create();
final result = create();
if (message != null) {
_result.message = message;
result.message = message;
}
return _result;
return result;
}
ServerStreamingEchoResponse._() : super();
factory ServerStreamingEchoResponse.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory ServerStreamingEchoResponse.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ServerStreamingEchoResponse',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'grpc.gateway.testing'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -298,9 +272,12 @@ class ServerStreamingEchoResponse extends $pb.GeneratedMessage {
'Will be removed in next major version')
ServerStreamingEchoResponse copyWith(
void Function(ServerStreamingEchoResponse) updates) =>
super.copyWith((message) => updates(message
as ServerStreamingEchoResponse)); // ignore: deprecated_member_use
super.copyWith(
(message) => updates(message as ServerStreamingEchoResponse))
as ServerStreamingEchoResponse;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoResponse create() =>
ServerStreamingEchoResponse._();
@ -310,7 +287,7 @@ class ServerStreamingEchoResponse extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoResponse getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<ServerStreamingEchoResponse>(create);
static ServerStreamingEchoResponse _defaultInstance;
static ServerStreamingEchoResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@ -324,3 +301,7 @@ class ServerStreamingEchoResponse extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearMessage() => clearField(1);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: echo.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,18 +1,25 @@
///
//
// Generated code. Do not modify.
// source: echo.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'echo.pb.dart' as $0;
export 'echo.pb.dart';
@$pb.GrpcServiceName('grpc.gateway.testing.EchoService')
class EchoServiceClient extends $grpc.Client {
static final _$echo = $grpc.ClientMethod<$0.EchoRequest, $0.EchoResponse>(
'/grpc.gateway.testing.EchoService/Echo',
@ -26,24 +33,25 @@ class EchoServiceClient extends $grpc.Client {
$0.ServerStreamingEchoResponse.fromBuffer(value));
EchoServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions options,
$core.Iterable<$grpc.ClientInterceptor> interceptors})
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$0.EchoResponse> echo($0.EchoRequest request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$echo, request, options: options);
}
$grpc.ResponseStream<$0.ServerStreamingEchoResponse> serverStreamingEcho(
$0.ServerStreamingEchoRequest request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(
_$serverStreamingEcho, $async.Stream.fromIterable([request]),
options: options);
}
}
@$pb.GrpcServiceName('grpc.gateway.testing.EchoService')
abstract class EchoServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.gateway.testing.EchoService';

View File

@ -1,42 +1,69 @@
///
//
// Generated code. Do not modify.
// source: echo.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const EchoRequest$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use echoRequestDescriptor instead')
const EchoRequest$json = {
'1': 'EchoRequest',
'2': const [
const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
const EchoResponse$json = const {
/// Descriptor for `EchoRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List echoRequestDescriptor = $convert
.base64Decode('CgtFY2hvUmVxdWVzdBIYCgdtZXNzYWdlGAEgASgJUgdtZXNzYWdl');
@$core.Deprecated('Use echoResponseDescriptor instead')
const EchoResponse$json = {
'1': 'EchoResponse',
'2': const [
const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
const ServerStreamingEchoRequest$json = const {
/// Descriptor for `EchoResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List echoResponseDescriptor = $convert
.base64Decode('CgxFY2hvUmVzcG9uc2USGAoHbWVzc2FnZRgBIAEoCVIHbWVzc2FnZQ==');
@$core.Deprecated('Use serverStreamingEchoRequestDescriptor instead')
const ServerStreamingEchoRequest$json = {
'1': 'ServerStreamingEchoRequest',
'2': const [
const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
const {'1': 'message_count', '3': 2, '4': 1, '5': 5, '10': 'messageCount'},
const {
'1': 'message_interval',
'3': 3,
'4': 1,
'5': 5,
'10': 'messageInterval'
},
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
{'1': 'message_count', '3': 2, '4': 1, '5': 5, '10': 'messageCount'},
{'1': 'message_interval', '3': 3, '4': 1, '5': 5, '10': 'messageInterval'},
],
};
const ServerStreamingEchoResponse$json = const {
/// Descriptor for `ServerStreamingEchoRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List serverStreamingEchoRequestDescriptor =
$convert.base64Decode(
'ChpTZXJ2ZXJTdHJlYW1pbmdFY2hvUmVxdWVzdBIYCgdtZXNzYWdlGAEgASgJUgdtZXNzYWdlEi'
'MKDW1lc3NhZ2VfY291bnQYAiABKAVSDG1lc3NhZ2VDb3VudBIpChBtZXNzYWdlX2ludGVydmFs'
'GAMgASgFUg9tZXNzYWdlSW50ZXJ2YWw=');
@$core.Deprecated('Use serverStreamingEchoResponseDescriptor instead')
const ServerStreamingEchoResponse$json = {
'1': 'ServerStreamingEchoResponse',
'2': const [
const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
/// Descriptor for `ServerStreamingEchoResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List serverStreamingEchoResponseDescriptor =
$convert.base64Decode(
'ChtTZXJ2ZXJTdHJlYW1pbmdFY2hvUmVzcG9uc2USGAoHbWVzc2FnZRgBIAEoCVIHbWVzc2FnZQ'
'==');

View File

@ -3,18 +3,15 @@ description: Dart gRPC-Web sample client
publish_to: none
environment:
sdk: '>=2.0.0 <3.0.0'
sdk: ^3.8.0
dependencies:
grpc:
path: ../../
protobuf: ^2.0.0-nullsafety
protobuf: ^4.1.0
web: ^1.1.1
dev_dependencies:
build_runner: ^1.5.2
build_web_compilers: ^2.1.1
dependency_overrides:
# TODO: Need bazel_worker 1.0.0-nullsafety.0 published
bazel_worker:
git: https://github.com/dart-lang/bazel_worker
build_runner: ^2.4.15
build_web_compilers: ^4.1.5
lints: ^6.0.0

View File

@ -12,24 +12,23 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'dart:html';
import 'package:grpc/grpc_web.dart';
import 'package:grpc_web/app.dart';
import 'package:grpc_web/src/generated/echo.pbgrpc.dart';
import 'package:web/web.dart';
void main() {
final channel = GrpcWebClientChannel.xhr(Uri.parse('http://localhost:8080'));
final service = EchoServiceClient(channel);
final app = EchoApp(service);
final button = querySelector('#send') as ButtonElement;
final button = document.querySelector('#send') as HTMLButtonElement;
button.onClick.listen((e) async {
final msg = querySelector('#msg') as TextInputElement;
final msg = document.querySelector('#msg') as HTMLInputElement;
final value = msg.value.trim();
msg.value = '';
if (value.isEmpty) return false;
if (value.isEmpty) return;
if (value.indexOf(' ') > 0) {
final countStr = value.substring(0, value.indexOf(' '));

View File

@ -9,7 +9,7 @@ To compile and run the example, assuming you are in the root of the helloworld
folder, i.e., .../example/helloworld/, first get the dependencies by running:
```sh
$ pub get
$ dart pub get
```
## Run TCP sample code

View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -13,19 +13,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Dart implementation of the gRPC helloworld.Greeter client.
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pb.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';
/// Dart implementation of the gRPC helloworld.Greeter client.
Future<void> main(List<String> args) async {
final channel = ClientChannel(
'localhost',
port: 50051,
options: ChannelOptions(
credentials: ChannelCredentials.insecure(),
codecRegistry:
CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
codecRegistry: CodecRegistry(
codecs: const [GzipCodec(), IdentityCodec()],
),
),
);
final stub = GreeterClient(channel);

View File

@ -13,11 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Dart implementation of the gRPC helloworld.Greeter server.
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pb.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';
/// Dart implementation of the gRPC helloworld.Greeter server.
class GreeterService extends GreeterServiceBase {
@override
Future<HelloReply> sayHello(ServiceCall call, HelloRequest request) async {
@ -26,10 +25,9 @@ class GreeterService extends GreeterServiceBase {
}
Future<void> main(List<String> args) async {
final server = Server(
[GreeterService()],
const <Interceptor>[],
CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
final server = Server.create(
services: [GreeterService()],
codecRegistry: CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
);
await server.serve(port: 50051);
print('Server listening on port ${server.port}...');

View File

@ -13,16 +13,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Dart implementation of the gRPC helloworld.Greeter client.
import 'dart:io';
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pb.dart';
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';
/// Dart implementation of the gRPC helloworld.Greeter client.
Future<void> main(List<String> args) async {
final udsAddress =
InternetAddress('localhost', type: InternetAddressType.unix);
final udsAddress = InternetAddress(
'localhost',
type: InternetAddressType.unix,
);
final channel = ClientChannel(
udsAddress,
port: 0,

View File

@ -13,13 +13,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Dart implementation of the gRPC helloworld.Greeter server.
import 'dart:io';
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pb.dart';
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';
/// Dart implementation of the gRPC helloworld.Greeter server.
class GreeterService extends GreeterServiceBase {
@override
Future<HelloReply> sayHello(ServiceCall call, HelloRequest request) async {
@ -28,9 +27,11 @@ class GreeterService extends GreeterServiceBase {
}
Future<void> main(List<String> args) async {
final udsAddress =
InternetAddress('localhost', type: InternetAddressType.unix);
final server = Server([GreeterService()]);
final udsAddress = InternetAddress(
'localhost',
type: InternetAddressType.unix,
);
final server = Server.create(services: [GreeterService()]);
await server.serve(address: udsAddress);
print('Start UNIX Server @localhost...');
}

View File

@ -1,47 +1,44 @@
///
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// The request message containing the user's name.
class HelloRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'HelloRequest',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'helloworld'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'name')
..hasRequiredFields = false;
HelloRequest._() : super();
factory HelloRequest({
$core.String name,
$core.String? name,
}) {
final _result = create();
final result = create();
if (name != null) {
_result.name = name;
result.name = name;
}
return _result;
return result;
}
HelloRequest._() : super();
factory HelloRequest.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory HelloRequest.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'HelloRequest',
package: const $pb.PackageName(_omitMessageNames ? '' : 'helloworld'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'name')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -50,9 +47,11 @@ class HelloRequest extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HelloRequest copyWith(void Function(HelloRequest) updates) =>
super.copyWith((message) =>
updates(message as HelloRequest)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as HelloRequest))
as HelloRequest;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static HelloRequest create() => HelloRequest._();
HelloRequest createEmptyInstance() => create();
@ -61,7 +60,7 @@ class HelloRequest extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static HelloRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HelloRequest>(create);
static HelloRequest _defaultInstance;
static HelloRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get name => $_getSZ(0);
@ -76,39 +75,32 @@ class HelloRequest extends $pb.GeneratedMessage {
void clearName() => clearField(1);
}
/// The response message containing the greetings
class HelloReply extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'HelloReply',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'helloworld'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..hasRequiredFields = false;
HelloReply._() : super();
factory HelloReply({
$core.String message,
$core.String? message,
}) {
final _result = create();
final result = create();
if (message != null) {
_result.message = message;
result.message = message;
}
return _result;
return result;
}
HelloReply._() : super();
factory HelloReply.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory HelloReply.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'HelloReply',
package: const $pb.PackageName(_omitMessageNames ? '' : 'helloworld'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -117,9 +109,10 @@ class HelloReply extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HelloReply copyWith(void Function(HelloReply) updates) =>
super.copyWith((message) =>
updates(message as HelloReply)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as HelloReply)) as HelloReply;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static HelloReply create() => HelloReply._();
HelloReply createEmptyInstance() => create();
@ -127,7 +120,7 @@ class HelloReply extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static HelloReply getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HelloReply>(create);
static HelloReply _defaultInstance;
static HelloReply? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@ -141,3 +134,7 @@ class HelloReply extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearMessage() => clearField(1);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,18 +1,25 @@
///
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'helloworld.pb.dart' as $0;
export 'helloworld.pb.dart';
@$pb.GrpcServiceName('helloworld.Greeter')
class GreeterClient extends $grpc.Client {
static final _$sayHello = $grpc.ClientMethod<$0.HelloRequest, $0.HelloReply>(
'/helloworld.Greeter/SayHello',
@ -20,16 +27,17 @@ class GreeterClient extends $grpc.Client {
($core.List<$core.int> value) => $0.HelloReply.fromBuffer(value));
GreeterClient($grpc.ClientChannel channel,
{$grpc.CallOptions options,
$core.Iterable<$grpc.ClientInterceptor> interceptors})
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$0.HelloReply> sayHello($0.HelloRequest request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$sayHello, request, options: options);
}
}
@$pb.GrpcServiceName('helloworld.Greeter')
abstract class GreeterServiceBase extends $grpc.Service {
$core.String get $name => 'helloworld.Greeter';

View File

@ -1,20 +1,38 @@
///
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const HelloRequest$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use helloRequestDescriptor instead')
const HelloRequest$json = {
'1': 'HelloRequest',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
'2': [
{'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
],
};
const HelloReply$json = const {
/// Descriptor for `HelloRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List helloRequestDescriptor =
$convert.base64Decode('CgxIZWxsb1JlcXVlc3QSEgoEbmFtZRgBIAEoCVIEbmFtZQ==');
@$core.Deprecated('Use helloReplyDescriptor instead')
const HelloReply$json = {
'1': 'HelloReply',
'2': const [
const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
/// Descriptor for `HelloReply`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List helloReplyDescriptor = $convert
.base64Decode('CgpIZWxsb1JlcGx5EhgKB21lc3NhZ2UYASABKAlSB21lc3NhZ2U=');

View File

@ -3,10 +3,13 @@ description: Dart gRPC sample client and server.
publish_to: none
environment:
sdk: '>=2.8.0 <3.0.0'
sdk: ^3.8.0
dependencies:
async: ^2.2.0
async: ^2.13.0
grpc:
path: ../../
protobuf: ^2.0.0-nullsafety
protobuf: ^4.1.0
dev_dependencies:
lints: ^6.0.0

View File

@ -9,7 +9,7 @@ To compile and run the example, assuming you are in the root of the metadata
folder, i.e., .../example/metadata/, first get the dependencies by running:
```sh
$ pub get
$ dart pub get
```
Then, to run the server:
@ -40,7 +40,7 @@ To install protoc with Dart support, take these steps:
1. Get the Dart protoc plugin by running
```sh
$ pub global activate protoc_plugin
$ dart pub global activate protoc_plugin
```
1. Add `~/.pub-cache/bin` to your PATH, if you haven't

View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -20,14 +20,15 @@ import 'package:grpc/grpc.dart';
import 'generated/metadata.pbgrpc.dart';
class Client {
ClientChannel channel;
MetadataClient stub;
late ClientChannel channel;
late MetadataClient stub;
Future<void> main(List<String> args) async {
channel = ClientChannel('127.0.0.1',
port: 8080,
options:
const ChannelOptions(credentials: ChannelCredentials.insecure()));
channel = ClientChannel(
'127.0.0.1',
port: 8080,
options: const ChannelOptions(credentials: ChannelCredentials.insecure()),
);
stub = MetadataClient(channel);
// Run all of the demos in order.
await runEcho();
@ -44,8 +45,10 @@ class Client {
/// metadata.
Future<void> runEcho() async {
final request = Record()..value = 'Kaj';
final call =
stub.echo(request, options: CallOptions(metadata: {'peer': 'Verner'}));
final call = stub.echo(
request,
options: CallOptions(metadata: {'peer': 'Verner'}),
);
call.headers.then((headers) {
print('Received header metadata: $headers');
});
@ -62,11 +65,15 @@ class Client {
/// well as a per-call metadata. The server will delay the response for the
/// requested duration, during which the client will cancel the RPC.
Future<void> runEchoDelayCancel() async {
final stubWithCustomOptions = MetadataClient(channel,
options: CallOptions(metadata: {'peer': 'Verner'}));
final stubWithCustomOptions = MetadataClient(
channel,
options: CallOptions(metadata: {'peer': 'Verner'}),
);
final request = Record()..value = 'Kaj';
final call = stubWithCustomOptions.echo(request,
options: CallOptions(metadata: {'delay': '1'}));
final call = stubWithCustomOptions.echo(
request,
options: CallOptions(metadata: {'delay': '1'}),
);
call.headers.then((headers) {
print('Received header metadata: $headers');
});
@ -89,8 +96,9 @@ class Client {
/// receiving 3 responses.
Future<void> runAddOneCancel() async {
final numbers = StreamController<int>();
final call =
stub.addOne(numbers.stream.map((value) => Number()..value = value));
final call = stub.addOne(
numbers.stream.map((value) => Number()..value = value),
);
final receivedThree = Completer<bool>();
final sub = call.listen((number) {
print('AddOneCancel: Received ${number.value}');
@ -133,8 +141,10 @@ class Client {
/// Call an RPC that returns a stream of Fibonacci numbers, and specify an RPC
/// timeout of 2 seconds.
Future<void> runFibonacciTimeout() async {
final call = stub.fibonacci(Empty(),
options: CallOptions(timeout: Duration(seconds: 2)));
final call = stub.fibonacci(
Empty(),
options: CallOptions(timeout: Duration(seconds: 2)),
);
var count = 0;
try {
await for (var number in call) {

View File

@ -1,47 +1,44 @@
///
//
// Generated code. Do not modify.
// source: metadata.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// A message containing a single string value.
class Record extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Record',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'value')
..hasRequiredFields = false;
Record._() : super();
factory Record({
$core.String value,
$core.String? value,
}) {
final _result = create();
final result = create();
if (value != null) {
_result.value = value;
result.value = value;
}
return _result;
return result;
}
Record._() : super();
factory Record.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Record.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Record',
package: const $pb.PackageName(_omitMessageNames ? '' : 'grpc'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'value')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -49,9 +46,11 @@ class Record extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Record copyWith(void Function(Record) updates) => super.copyWith(
(message) => updates(message as Record)); // ignore: deprecated_member_use
Record copyWith(void Function(Record) updates) =>
super.copyWith((message) => updates(message as Record)) as Record;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Record create() => Record._();
Record createEmptyInstance() => create();
@ -59,7 +58,7 @@ class Record extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Record getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Record>(create);
static Record _defaultInstance;
static Record? _defaultInstance;
@$pb.TagNumber(1)
$core.String get value => $_getSZ(0);
@ -74,40 +73,32 @@ class Record extends $pb.GeneratedMessage {
void clearValue() => clearField(1);
}
/// A message containing a single number.
class Number extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Number',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc'),
createEmptyInstance: create)
..a<$core.int>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'value',
$pb.PbFieldType.O3)
..hasRequiredFields = false;
Number._() : super();
factory Number({
$core.int value,
$core.int? value,
}) {
final _result = create();
final result = create();
if (value != null) {
_result.value = value;
result.value = value;
}
return _result;
return result;
}
Number._() : super();
factory Number.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Number.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Number',
package: const $pb.PackageName(_omitMessageNames ? '' : 'grpc'),
createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'value', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -115,9 +106,11 @@ class Number extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Number copyWith(void Function(Number) updates) => super.copyWith(
(message) => updates(message as Number)); // ignore: deprecated_member_use
Number copyWith(void Function(Number) updates) =>
super.copyWith((message) => updates(message as Number)) as Number;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Number create() => Number._();
Number createEmptyInstance() => create();
@ -125,7 +118,7 @@ class Number extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Number getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Number>(create);
static Number _defaultInstance;
static Number? _defaultInstance;
@$pb.TagNumber(1)
$core.int get value => $_getIZ(0);
@ -140,26 +133,23 @@ class Number extends $pb.GeneratedMessage {
void clearValue() => clearField(1);
}
/// A message containing nothing.
class Empty extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Empty',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc'),
createEmptyInstance: create)
..hasRequiredFields = false;
Empty._() : super();
factory Empty() => create();
Empty._() : super();
factory Empty.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Empty.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Empty',
package: const $pb.PackageName(_omitMessageNames ? '' : 'grpc'),
createEmptyInstance: create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -167,9 +157,11 @@ class Empty extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Empty copyWith(void Function(Empty) updates) => super.copyWith(
(message) => updates(message as Empty)); // ignore: deprecated_member_use
Empty copyWith(void Function(Empty) updates) =>
super.copyWith((message) => updates(message as Empty)) as Empty;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Empty create() => Empty._();
Empty createEmptyInstance() => create();
@ -177,5 +169,9 @@ class Empty extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Empty getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Empty>(create);
static Empty _defaultInstance;
static Empty? _defaultInstance;
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,18 +1,25 @@
///
//
// Generated code. Do not modify.
// source: metadata.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'metadata.pb.dart' as $0;
export 'metadata.pb.dart';
@$pb.GrpcServiceName('grpc.Metadata')
class MetadataClient extends $grpc.Client {
static final _$echo = $grpc.ClientMethod<$0.Record, $0.Record>(
'/grpc.Metadata/Echo',
@ -28,28 +35,29 @@ class MetadataClient extends $grpc.Client {
($core.List<$core.int> value) => $0.Number.fromBuffer(value));
MetadataClient($grpc.ClientChannel channel,
{$grpc.CallOptions options,
$core.Iterable<$grpc.ClientInterceptor> interceptors})
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$0.Record> echo($0.Record request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$echo, request, options: options);
}
$grpc.ResponseStream<$0.Number> addOne($async.Stream<$0.Number> request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$addOne, request, options: options);
}
$grpc.ResponseStream<$0.Number> fibonacci($0.Empty request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(
_$fibonacci, $async.Stream.fromIterable([request]),
options: options);
}
}
@$pb.GrpcServiceName('grpc.Metadata')
abstract class MetadataServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.Metadata';

View File

@ -24,13 +24,13 @@ class MetadataService extends MetadataServiceBase {
@override
Future<Record> echo(grpc.ServiceCall call, Record request) async {
final peer = call.clientMetadata['peer'];
final peer = call.clientMetadata!['peer']!;
final count = callCount++;
print('Echo: Call #$count: Peer: $peer, request: ${request.value}');
call.headers['count'] = '${count}';
call.trailers['hello'] = request.value;
call.headers!['count'] = '$count';
call.trailers!['hello'] = request.value;
final delay = call.clientMetadata['delay'];
final delay = call.clientMetadata!['delay'];
if (delay != null) {
await Future.delayed(Duration(seconds: int.parse(delay)));
}
@ -78,7 +78,7 @@ class MetadataService extends MetadataServiceBase {
class Server {
Future<void> main(List<String> args) async {
final server = grpc.Server([MetadataService()]);
final server = grpc.Server.create(services: [MetadataService()]);
await server.serve(port: 8080);
print('Server listening on port ${server.port}...');
}

View File

@ -3,13 +3,14 @@ description: Dart gRPC sample client and server.
publish_to: none
environment:
sdk: '>=2.2.0 <3.0.0'
sdk: ^3.8.0
dependencies:
async: ^2.2.0
async: ^2.13.0
grpc:
path: ../../
protobuf: ^2.0.0-nullsafety
protobuf: ^4.1.0
dev_dependencies:
test: ^1.6.0
lints: ^6.0.0
test: ^1.26.2

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
protoc --dart_out=grpc:lib/src/generated -Iprotos protos/metadata.proto
rm lib/src/generated/metadata.pb{enum,json}.dart
dartfmt -w lib/src/generated
dart format -o write lib/src/generated

View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -18,19 +18,21 @@ import 'dart:math' show Random;
import 'package:grpc/grpc.dart';
import 'common.dart';
import 'generated/route_guide.pb.dart';
import 'generated/route_guide.pbgrpc.dart';
class Client {
RouteGuideClient stub;
late RouteGuideClient stub;
Future<void> main(List<String> args) async {
final channel = ClientChannel('127.0.0.1',
port: 8080,
options:
const ChannelOptions(credentials: ChannelCredentials.insecure()));
stub = RouteGuideClient(channel,
options: CallOptions(timeout: Duration(seconds: 30)));
final channel = ClientChannel(
'127.0.0.1',
port: 8080,
options: const ChannelOptions(credentials: ChannelCredentials.insecure()),
);
stub = RouteGuideClient(
channel,
options: CallOptions(timeout: Duration(seconds: 30)),
);
// Run all of the demos in order.
try {
await runGetFeature();
@ -50,7 +52,8 @@ class Client {
? 'no feature'
: 'feature called "${feature.name}"';
print(
'Found $name at ${latitude / coordFactor}, ${longitude / coordFactor}');
'Found $name at ${latitude / coordFactor}, ${longitude / coordFactor}',
);
}
/// Run the getFeature demo. Calls getFeature with a point known to have a
@ -97,7 +100,8 @@ class Client {
for (var i = 0; i < count; i++) {
final point = featuresDb[random.nextInt(featuresDb.length)].location;
print(
'Visiting point ${point.latitude / coordFactor}, ${point.longitude / coordFactor}');
'Visiting point ${point.latitude / coordFactor}, ${point.longitude / coordFactor}',
);
yield point;
await Future.delayed(Duration(milliseconds: 200 + random.nextInt(100)));
}
@ -133,8 +137,10 @@ class Client {
for (final note in notes) {
// Short delay to simulate some other interaction.
await Future.delayed(Duration(milliseconds: 10));
print('Sending message ${note.message} at ${note.location.latitude}, '
'${note.location.longitude}');
print(
'Sending message ${note.message} at ${note.location.latitude}, '
'${note.location.longitude}',
);
yield note;
}
}
@ -142,7 +148,8 @@ class Client {
final call = stub.routeChat(outgoingNotes());
await for (var note in call) {
print(
'Got message ${note.message} at ${note.location.latitude}, ${note.location.longitude}');
'Got message ${note.message} at ${note.location.latitude}, ${note.location.longitude}',
);
}
}
}

View File

@ -1,58 +1,52 @@
///
//
// Generated code. Do not modify.
// source: route_guide.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// Points are represented as latitude-longitude pairs in the E7 representation
/// (degrees multiplied by 10**7 and rounded to the nearest integer).
/// Latitudes should be in the range +/- 90 degrees and longitude should be in
/// the range +/- 180 degrees (inclusive).
class Point extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Point',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'routeguide'),
createEmptyInstance: create)
..a<$core.int>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'latitude',
$pb.PbFieldType.O3)
..a<$core.int>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'longitude',
$pb.PbFieldType.O3)
..hasRequiredFields = false;
Point._() : super();
factory Point({
$core.int latitude,
$core.int longitude,
$core.int? latitude,
$core.int? longitude,
}) {
final _result = create();
final result = create();
if (latitude != null) {
_result.latitude = latitude;
result.latitude = latitude;
}
if (longitude != null) {
_result.longitude = longitude;
result.longitude = longitude;
}
return _result;
return result;
}
Point._() : super();
factory Point.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Point.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Point',
package: const $pb.PackageName(_omitMessageNames ? '' : 'routeguide'),
createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'latitude', $pb.PbFieldType.O3)
..a<$core.int>(2, _omitFieldNames ? '' : 'longitude', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -60,9 +54,11 @@ class Point extends $pb.GeneratedMessage {
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Point copyWith(void Function(Point) updates) => super.copyWith(
(message) => updates(message as Point)); // ignore: deprecated_member_use
Point copyWith(void Function(Point) updates) =>
super.copyWith((message) => updates(message as Point)) as Point;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Point create() => Point._();
Point createEmptyInstance() => create();
@ -70,7 +66,7 @@ class Point extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Point getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Point>(create);
static Point _defaultInstance;
static Point? _defaultInstance;
@$pb.TagNumber(1)
$core.int get latitude => $_getIZ(0);
@ -97,44 +93,38 @@ class Point extends $pb.GeneratedMessage {
void clearLongitude() => clearField(2);
}
/// A latitude-longitude rectangle, represented as two diagonally opposite
/// points "lo" and "hi".
class Rectangle extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Rectangle',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'routeguide'),
createEmptyInstance: create)
..aOM<Point>(1,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'lo',
subBuilder: Point.create)
..aOM<Point>(2,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'hi',
subBuilder: Point.create)
..hasRequiredFields = false;
Rectangle._() : super();
factory Rectangle({
Point lo,
Point hi,
Point? lo,
Point? hi,
}) {
final _result = create();
final result = create();
if (lo != null) {
_result.lo = lo;
result.lo = lo;
}
if (hi != null) {
_result.hi = hi;
result.hi = hi;
}
return _result;
return result;
}
Rectangle._() : super();
factory Rectangle.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Rectangle.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Rectangle',
package: const $pb.PackageName(_omitMessageNames ? '' : 'routeguide'),
createEmptyInstance: create)
..aOM<Point>(1, _omitFieldNames ? '' : 'lo', subBuilder: Point.create)
..aOM<Point>(2, _omitFieldNames ? '' : 'hi', subBuilder: Point.create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -143,9 +133,10 @@ class Rectangle extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Rectangle copyWith(void Function(Rectangle) updates) =>
super.copyWith((message) =>
updates(message as Rectangle)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as Rectangle)) as Rectangle;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Rectangle create() => Rectangle._();
Rectangle createEmptyInstance() => create();
@ -153,8 +144,9 @@ class Rectangle extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Rectangle getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Rectangle>(create);
static Rectangle _defaultInstance;
static Rectangle? _defaultInstance;
/// One corner of the rectangle.
@$pb.TagNumber(1)
Point get lo => $_getN(0);
@$pb.TagNumber(1)
@ -169,6 +161,7 @@ class Rectangle extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
Point ensureLo() => $_ensure(0);
/// The other corner of the rectangle.
@$pb.TagNumber(2)
Point get hi => $_getN(1);
@$pb.TagNumber(2)
@ -184,49 +177,39 @@ class Rectangle extends $pb.GeneratedMessage {
Point ensureHi() => $_ensure(1);
}
/// A feature names something at a given point.
///
/// If a feature could not be named, the name is empty.
class Feature extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Feature',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'routeguide'),
createEmptyInstance: create)
..aOS(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'name')
..aOM<Point>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'location',
subBuilder: Point.create)
..hasRequiredFields = false;
Feature._() : super();
factory Feature({
$core.String name,
Point location,
$core.String? name,
Point? location,
}) {
final _result = create();
final result = create();
if (name != null) {
_result.name = name;
result.name = name;
}
if (location != null) {
_result.location = location;
result.location = location;
}
return _result;
return result;
}
Feature._() : super();
factory Feature.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Feature.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Feature',
package: const $pb.PackageName(_omitMessageNames ? '' : 'routeguide'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'name')
..aOM<Point>(2, _omitFieldNames ? '' : 'location', subBuilder: Point.create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -235,9 +218,10 @@ class Feature extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Feature copyWith(void Function(Feature) updates) =>
super.copyWith((message) =>
updates(message as Feature)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as Feature)) as Feature;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Feature create() => Feature._();
Feature createEmptyInstance() => create();
@ -245,8 +229,9 @@ class Feature extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static Feature getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Feature>(create);
static Feature _defaultInstance;
static Feature? _defaultInstance;
/// The name of the feature.
@$pb.TagNumber(1)
$core.String get name => $_getSZ(0);
@$pb.TagNumber(1)
@ -259,6 +244,7 @@ class Feature extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearName() => clearField(1);
/// The point where the feature is detected.
@$pb.TagNumber(2)
Point get location => $_getN(1);
@$pb.TagNumber(2)
@ -274,49 +260,37 @@ class Feature extends $pb.GeneratedMessage {
Point ensureLocation() => $_ensure(1);
}
/// A RouteNote is a message sent while at a given point.
class RouteNote extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'RouteNote',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'routeguide'),
createEmptyInstance: create)
..aOM<Point>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'location',
subBuilder: Point.create)
..aOS(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'message')
..hasRequiredFields = false;
RouteNote._() : super();
factory RouteNote({
Point location,
$core.String message,
Point? location,
$core.String? message,
}) {
final _result = create();
final result = create();
if (location != null) {
_result.location = location;
result.location = location;
}
if (message != null) {
_result.message = message;
result.message = message;
}
return _result;
return result;
}
RouteNote._() : super();
factory RouteNote.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory RouteNote.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'RouteNote',
package: const $pb.PackageName(_omitMessageNames ? '' : 'routeguide'),
createEmptyInstance: create)
..aOM<Point>(1, _omitFieldNames ? '' : 'location', subBuilder: Point.create)
..aOS(2, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -325,9 +299,10 @@ class RouteNote extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RouteNote copyWith(void Function(RouteNote) updates) =>
super.copyWith((message) =>
updates(message as RouteNote)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as RouteNote)) as RouteNote;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RouteNote create() => RouteNote._();
RouteNote createEmptyInstance() => create();
@ -335,8 +310,9 @@ class RouteNote extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static RouteNote getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RouteNote>(create);
static RouteNote _defaultInstance;
static RouteNote? _defaultInstance;
/// The location from which the message is sent.
@$pb.TagNumber(1)
Point get location => $_getN(0);
@$pb.TagNumber(1)
@ -351,6 +327,7 @@ class RouteNote extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
Point ensureLocation() => $_ensure(0);
/// The message to be sent.
@$pb.TagNumber(2)
$core.String get message => $_getSZ(1);
@$pb.TagNumber(2)
@ -364,63 +341,51 @@ class RouteNote extends $pb.GeneratedMessage {
void clearMessage() => clearField(2);
}
/// A RouteSummary is received in response to a RecordRoute rpc.
///
/// It contains the number of individual points received, the number of
/// detected features, and the total distance covered as the cumulative sum of
/// the distance between each point.
class RouteSummary extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'RouteSummary',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'routeguide'),
createEmptyInstance: create)
..a<$core.int>(
1,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'pointCount',
$pb.PbFieldType.O3)
..a<$core.int>(
2,
const $core.bool.fromEnvironment('protobuf.omit_field_names')
? ''
: 'featureCount',
$pb.PbFieldType.O3)
..a<$core.int>(
3,
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'distance',
$pb.PbFieldType.O3)
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'elapsedTime', $pb.PbFieldType.O3)
..hasRequiredFields = false;
RouteSummary._() : super();
factory RouteSummary({
$core.int pointCount,
$core.int featureCount,
$core.int distance,
$core.int elapsedTime,
$core.int? pointCount,
$core.int? featureCount,
$core.int? distance,
$core.int? elapsedTime,
}) {
final _result = create();
final result = create();
if (pointCount != null) {
_result.pointCount = pointCount;
result.pointCount = pointCount;
}
if (featureCount != null) {
_result.featureCount = featureCount;
result.featureCount = featureCount;
}
if (distance != null) {
_result.distance = distance;
result.distance = distance;
}
if (elapsedTime != null) {
_result.elapsedTime = elapsedTime;
result.elapsedTime = elapsedTime;
}
return _result;
return result;
}
RouteSummary._() : super();
factory RouteSummary.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory RouteSummary.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'RouteSummary',
package: const $pb.PackageName(_omitMessageNames ? '' : 'routeguide'),
createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'pointCount', $pb.PbFieldType.O3)
..a<$core.int>(2, _omitFieldNames ? '' : 'featureCount', $pb.PbFieldType.O3)
..a<$core.int>(3, _omitFieldNames ? '' : 'distance', $pb.PbFieldType.O3)
..a<$core.int>(4, _omitFieldNames ? '' : 'elapsedTime', $pb.PbFieldType.O3)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -429,9 +394,11 @@ class RouteSummary extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RouteSummary copyWith(void Function(RouteSummary) updates) =>
super.copyWith((message) =>
updates(message as RouteSummary)); // ignore: deprecated_member_use
super.copyWith((message) => updates(message as RouteSummary))
as RouteSummary;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RouteSummary create() => RouteSummary._();
RouteSummary createEmptyInstance() => create();
@ -440,8 +407,9 @@ class RouteSummary extends $pb.GeneratedMessage {
@$core.pragma('dart2js:noInline')
static RouteSummary getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<RouteSummary>(create);
static RouteSummary _defaultInstance;
static RouteSummary? _defaultInstance;
/// The number of points received.
@$pb.TagNumber(1)
$core.int get pointCount => $_getIZ(0);
@$pb.TagNumber(1)
@ -454,6 +422,7 @@ class RouteSummary extends $pb.GeneratedMessage {
@$pb.TagNumber(1)
void clearPointCount() => clearField(1);
/// The number of known features passed while traversing the route.
@$pb.TagNumber(2)
$core.int get featureCount => $_getIZ(1);
@$pb.TagNumber(2)
@ -466,6 +435,7 @@ class RouteSummary extends $pb.GeneratedMessage {
@$pb.TagNumber(2)
void clearFeatureCount() => clearField(2);
/// The distance covered in metres.
@$pb.TagNumber(3)
$core.int get distance => $_getIZ(2);
@$pb.TagNumber(3)
@ -478,6 +448,7 @@ class RouteSummary extends $pb.GeneratedMessage {
@$pb.TagNumber(3)
void clearDistance() => clearField(3);
/// The duration of the traversal in seconds.
@$pb.TagNumber(4)
$core.int get elapsedTime => $_getIZ(3);
@$pb.TagNumber(4)
@ -490,3 +461,7 @@ class RouteSummary extends $pb.GeneratedMessage {
@$pb.TagNumber(4)
void clearElapsedTime() => clearField(4);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,6 +1,10 @@
///
//
// Generated code. Do not modify.
// source: route_guide.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

View File

@ -1,18 +1,25 @@
///
//
// Generated code. Do not modify.
// source: route_guide.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'route_guide.pb.dart' as $0;
export 'route_guide.pb.dart';
@$pb.GrpcServiceName('routeguide.RouteGuide')
class RouteGuideClient extends $grpc.Client {
static final _$getFeature = $grpc.ClientMethod<$0.Point, $0.Feature>(
'/routeguide.RouteGuide/GetFeature',
@ -32,17 +39,17 @@ class RouteGuideClient extends $grpc.Client {
($core.List<$core.int> value) => $0.RouteNote.fromBuffer(value));
RouteGuideClient($grpc.ClientChannel channel,
{$grpc.CallOptions options,
$core.Iterable<$grpc.ClientInterceptor> interceptors})
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$0.Feature> getFeature($0.Point request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$getFeature, request, options: options);
}
$grpc.ResponseStream<$0.Feature> listFeatures($0.Rectangle request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(
_$listFeatures, $async.Stream.fromIterable([request]),
options: options);
@ -50,18 +57,19 @@ class RouteGuideClient extends $grpc.Client {
$grpc.ResponseFuture<$0.RouteSummary> recordRoute(
$async.Stream<$0.Point> request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$recordRoute, request, options: options)
.single;
}
$grpc.ResponseStream<$0.RouteNote> routeChat(
$async.Stream<$0.RouteNote> request,
{$grpc.CallOptions options}) {
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$routeChat, request, options: options);
}
}
@$pb.GrpcServiceName('routeguide.RouteGuide')
abstract class RouteGuideServiceBase extends $grpc.Service {
$core.String get $name => 'routeguide.RouteGuide';

View File

@ -1,45 +1,52 @@
///
//
// Generated code. Do not modify.
// source: route_guide.proto
//
// @dart = 2.7
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// @dart = 2.12
const Point$json = const {
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use pointDescriptor instead')
const Point$json = {
'1': 'Point',
'2': const [
const {'1': 'latitude', '3': 1, '4': 1, '5': 5, '10': 'latitude'},
const {'1': 'longitude', '3': 2, '4': 1, '5': 5, '10': 'longitude'},
'2': [
{'1': 'latitude', '3': 1, '4': 1, '5': 5, '10': 'latitude'},
{'1': 'longitude', '3': 2, '4': 1, '5': 5, '10': 'longitude'},
],
};
const Rectangle$json = const {
/// Descriptor for `Point`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List pointDescriptor = $convert.base64Decode(
'CgVQb2ludBIaCghsYXRpdHVkZRgBIAEoBVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAIgASgFUg'
'lsb25naXR1ZGU=');
@$core.Deprecated('Use rectangleDescriptor instead')
const Rectangle$json = {
'1': 'Rectangle',
'2': const [
const {
'1': 'lo',
'3': 1,
'4': 1,
'5': 11,
'6': '.routeguide.Point',
'10': 'lo'
},
const {
'1': 'hi',
'3': 2,
'4': 1,
'5': 11,
'6': '.routeguide.Point',
'10': 'hi'
},
'2': [
{'1': 'lo', '3': 1, '4': 1, '5': 11, '6': '.routeguide.Point', '10': 'lo'},
{'1': 'hi', '3': 2, '4': 1, '5': 11, '6': '.routeguide.Point', '10': 'hi'},
],
};
const Feature$json = const {
/// Descriptor for `Rectangle`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List rectangleDescriptor = $convert.base64Decode(
'CglSZWN0YW5nbGUSIQoCbG8YASABKAsyES5yb3V0ZWd1aWRlLlBvaW50UgJsbxIhCgJoaRgCIA'
'EoCzIRLnJvdXRlZ3VpZGUuUG9pbnRSAmhp');
@$core.Deprecated('Use featureDescriptor instead')
const Feature$json = {
'1': 'Feature',
'2': const [
const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
const {
'2': [
{'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
{
'1': 'location',
'3': 2,
'4': 1,
@ -50,10 +57,16 @@ const Feature$json = const {
],
};
const RouteNote$json = const {
/// Descriptor for `Feature`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List featureDescriptor = $convert.base64Decode(
'CgdGZWF0dXJlEhIKBG5hbWUYASABKAlSBG5hbWUSLQoIbG9jYXRpb24YAiABKAsyES5yb3V0ZW'
'd1aWRlLlBvaW50Ughsb2NhdGlvbg==');
@$core.Deprecated('Use routeNoteDescriptor instead')
const RouteNote$json = {
'1': 'RouteNote',
'2': const [
const {
'2': [
{
'1': 'location',
'3': 1,
'4': 1,
@ -61,16 +74,28 @@ const RouteNote$json = const {
'6': '.routeguide.Point',
'10': 'location'
},
const {'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
{'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
],
};
const RouteSummary$json = const {
/// Descriptor for `RouteNote`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List routeNoteDescriptor = $convert.base64Decode(
'CglSb3V0ZU5vdGUSLQoIbG9jYXRpb24YASABKAsyES5yb3V0ZWd1aWRlLlBvaW50Ughsb2NhdG'
'lvbhIYCgdtZXNzYWdlGAIgASgJUgdtZXNzYWdl');
@$core.Deprecated('Use routeSummaryDescriptor instead')
const RouteSummary$json = {
'1': 'RouteSummary',
'2': const [
const {'1': 'point_count', '3': 1, '4': 1, '5': 5, '10': 'pointCount'},
const {'1': 'feature_count', '3': 2, '4': 1, '5': 5, '10': 'featureCount'},
const {'1': 'distance', '3': 3, '4': 1, '5': 5, '10': 'distance'},
const {'1': 'elapsed_time', '3': 4, '4': 1, '5': 5, '10': 'elapsedTime'},
'2': [
{'1': 'point_count', '3': 1, '4': 1, '5': 5, '10': 'pointCount'},
{'1': 'feature_count', '3': 2, '4': 1, '5': 5, '10': 'featureCount'},
{'1': 'distance', '3': 3, '4': 1, '5': 5, '10': 'distance'},
{'1': 'elapsed_time', '3': 4, '4': 1, '5': 5, '10': 'elapsedTime'},
],
};
/// Descriptor for `RouteSummary`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List routeSummaryDescriptor = $convert.base64Decode(
'CgxSb3V0ZVN1bW1hcnkSHwoLcG9pbnRfY291bnQYASABKAVSCnBvaW50Q291bnQSIwoNZmVhdH'
'VyZV9jb3VudBgCIAEoBVIMZmVhdHVyZUNvdW50EhoKCGRpc3RhbmNlGAMgASgFUghkaXN0YW5j'
'ZRIhCgxlbGFwc2VkX3RpbWUYBCABKAVSC2VsYXBzZWRUaW1l');

View File

@ -15,10 +15,10 @@
import 'dart:math' show atan2, cos, max, min, pi, sin, sqrt;
import 'package:collection/collection.dart' show IterableExtension;
import 'package:grpc/grpc.dart' as grpc;
import 'common.dart';
import 'generated/route_guide.pb.dart';
import 'generated/route_guide.pbgrpc.dart';
class RouteGuideService extends RouteGuideServiceBase {
@ -28,8 +28,10 @@ class RouteGuideService extends RouteGuideServiceBase {
/// The [context] object provides access to client metadata, cancellation, etc.
@override
Future<Feature> getFeature(grpc.ServiceCall call, Point request) async {
return featuresDb.firstWhere((f) => f.location == request,
orElse: () => Feature()..location = request);
return featuresDb.firstWhere(
(f) => f.location == request,
orElse: () => Feature()..location = request,
);
}
Rectangle _normalize(Rectangle r) {
@ -57,7 +59,9 @@ class RouteGuideService extends RouteGuideServiceBase {
/// rectangle.
@override
Stream<Feature> listFeatures(
grpc.ServiceCall call, Rectangle request) async* {
grpc.ServiceCall call,
Rectangle request,
) async* {
final normalizedRectangle = _normalize(request);
// For each feature, check if it is in the given bounding box
for (var feature in featuresDb) {
@ -74,18 +78,21 @@ class RouteGuideService extends RouteGuideServiceBase {
/// total distance traveled, and total time spent.
@override
Future<RouteSummary> recordRoute(
grpc.ServiceCall call, Stream<Point> request) async {
grpc.ServiceCall call,
Stream<Point> request,
) async {
var pointCount = 0;
var featureCount = 0;
var distance = 0.0;
Point previous;
Point? previous;
final timer = Stopwatch();
await for (var location in request) {
if (!timer.isRunning) timer.start();
pointCount++;
final feature = featuresDb.firstWhere((f) => f.location == location,
orElse: () => null);
final feature = featuresDb.firstWhereOrNull(
(f) => f.location == location,
);
if (feature != null) {
featureCount++;
}
@ -107,7 +114,9 @@ class RouteGuideService extends RouteGuideServiceBase {
/// locations.
@override
Stream<RouteNote> routeChat(
grpc.ServiceCall call, Stream<RouteNote> request) async* {
grpc.ServiceCall call,
Stream<RouteNote> request,
) async* {
await for (var note in request) {
final notes = routeNotes.putIfAbsent(note.location, () => <RouteNote>[]);
for (var note in notes) {
@ -134,7 +143,8 @@ class RouteGuideService extends RouteGuideServiceBase {
final dLat = toRadians(lat2 - lat1);
final dLon = toRadians(lon2 - lon1);
final a = sin(dLat / 2) * sin(dLat / 2) +
final a =
sin(dLat / 2) * sin(dLat / 2) +
cos(phi1) * cos(phi2) * sin(dLon / 2) * sin(dLon / 2);
final c = 2 * atan2(sqrt(a), sqrt(1 - a));
@ -144,7 +154,7 @@ class RouteGuideService extends RouteGuideServiceBase {
class Server {
Future<void> main(List<String> args) async {
final server = grpc.Server([RouteGuideService()]);
final server = grpc.Server.create(services: [RouteGuideService()]);
await server.serve(port: 8080);
print('Server listening on port ${server.port}...');
}

View File

@ -3,10 +3,14 @@ description: Dart gRPC sample client and server.
publish_to: none
environment:
sdk: '>=2.2.0 <3.0.0'
sdk: ^3.8.0
dependencies:
async: ^2.2.0
async: ^2.13.0
collection: ^1.19.1
grpc:
path: ../../
protobuf: ^2.0.0-nullsafety
protobuf: ^4.1.0
dev_dependencies:
lints: ^6.0.0

View File

@ -0,0 +1 @@
include: package:lints/recommended.yaml

View File

@ -61,49 +61,77 @@ const _serviceAccountKeyFileArgument = 'service_account_key_file';
/// checking.
Future<int> main(List<String> args) async {
final argumentParser = ArgParser();
argumentParser.addOption(_serverHostArgument,
help: 'The server host to connect to. For example, "localhost" or '
'"127.0.0.1".');
argumentParser.addOption(_serverHostOverrideArgument,
help: 'The server host to claim to be connecting to, for use in TLS and '
'HTTP/2 :authority header. If unspecified, the value of '
'--server_host will be used.');
argumentParser.addOption(_serverPortArgument,
help: 'The server port to connect to. For example, "8080".');
argumentParser.addOption(_testCaseArgument,
help:
'The name of the test case to execute. For example, "empty_unary".');
argumentParser.addOption(_useTLSArgument,
defaultsTo: 'false',
help: 'Whether to use a plaintext or encrypted connection.');
argumentParser.addOption(_useTestCAArgument,
help: 'Whether to replace platform root CAs with ca.pem as the CA root.');
argumentParser.addOption(_defaultServiceAccountArgument,
help: 'Email of the GCE default service account.');
argumentParser.addOption(_oauthScopeArgument,
help: 'OAuth scope. For example, '
'"https://www.googleapis.com/auth/xapi.zoo".');
argumentParser.addOption(_serviceAccountKeyFileArgument,
help: 'The path to the service account JSON key file generated from GCE '
'developer console.');
argumentParser.addOption(
_serverHostArgument,
help:
'The server host to connect to. For example, "localhost" or '
'"127.0.0.1".',
);
argumentParser.addOption(
_serverHostOverrideArgument,
help:
'The server host to claim to be connecting to, for use in TLS and '
'HTTP/2 :authority header. If unspecified, the value of '
'--server_host will be used.',
);
argumentParser.addOption(
_serverPortArgument,
help: 'The server port to connect to. For example, "8080".',
);
argumentParser.addOption(
_testCaseArgument,
help: 'The name of the test case to execute. For example, "empty_unary".',
);
argumentParser.addOption(
_useTLSArgument,
defaultsTo: 'false',
help: 'Whether to use a plaintext or encrypted connection.',
);
argumentParser.addOption(
_useTestCAArgument,
defaultsTo: 'false',
help: 'Whether to replace platform root CAs with ca.pem as the CA root.',
);
argumentParser.addOption(
_defaultServiceAccountArgument,
help: 'Email of the GCE default service account.',
);
argumentParser.addOption(
_oauthScopeArgument,
help:
'OAuth scope. For example, '
'"https://www.googleapis.com/auth/xapi.zoo".',
);
argumentParser.addOption(
_serviceAccountKeyFileArgument,
help:
'The path to the service account JSON key file generated from GCE '
'developer console.',
);
final arguments = argumentParser.parse(args);
late Tester testClient;
try {
testClient = Tester(
serverHost: arguments[_serverHostArgument] ??
(throw 'Must specify --$_serverHostArgument'),
serverHostOverride: arguments[_serverHostOverrideArgument],
serverPort: int.tryParse(arguments[_serverPortArgument] ??
(throw 'Must specify --$_serverPortArgument')) ??
(throw 'Invalid port "${arguments[_serverPortArgument]}"'),
testCase: arguments[_testCaseArgument] ??
(throw 'Must specify --$_testCaseArgument'),
useTls: arguments[_useTLSArgument] != 'false',
useTestCA: arguments[_useTestCAArgument],
defaultServiceAccount: arguments[_defaultServiceAccountArgument],
oauthScope: arguments[_oauthScopeArgument],
serviceAccountKeyFile: arguments[_serviceAccountKeyFileArgument]);
serverHost:
arguments[_serverHostArgument] ??
(throw 'Must specify --$_serverHostArgument'),
serverHostOverride: arguments[_serverHostOverrideArgument],
serverPort:
int.tryParse(
arguments[_serverPortArgument] ??
(throw 'Must specify --$_serverPortArgument'),
) ??
(throw 'Invalid port "${arguments[_serverPortArgument]}"'),
testCase:
arguments[_testCaseArgument] ??
(throw 'Must specify --$_testCaseArgument'),
useTls: arguments[_useTLSArgument] == 'true',
useTestCA: arguments[_useTestCAArgument] == 'true',
defaultServiceAccount: arguments[_defaultServiceAccountArgument],
oauthScope: arguments[_oauthScopeArgument],
serviceAccountKeyFile: arguments[_serviceAccountKeyFileArgument],
);
} catch (e) {
print(e);
print(argumentParser.usage);

View File

@ -47,10 +47,14 @@ class TestService extends TestServiceBase {
@override
Future<SimpleResponse> unaryCall(
ServiceCall call, SimpleRequest request) async {
ServiceCall call,
SimpleRequest request,
) async {
if (request.responseStatus.code != 0) {
throw GrpcError.custom(
request.responseStatus.code, request.responseStatus.message);
request.responseStatus.code,
request.responseStatus.message,
);
}
final payload = Payload()..body = List.filled(request.responseSize, 0);
return SimpleResponse()..payload = payload;
@ -58,7 +62,9 @@ class TestService extends TestServiceBase {
@override
Future<SimpleResponse> cacheableUnaryCall(
ServiceCall call, SimpleRequest request) async {
ServiceCall call,
SimpleRequest request,
) async {
final timestamp = DateTime.now().microsecond * 1000;
final responsePayload = Payload()..body = ascii.encode('$timestamp');
return SimpleResponse()..payload = responsePayload;
@ -66,9 +72,13 @@ class TestService extends TestServiceBase {
@override
Future<StreamingInputCallResponse> streamingInputCall(
ServiceCall call, Stream<StreamingInputCallRequest> request) async {
ServiceCall call,
Stream<StreamingInputCallRequest> request,
) async {
final aggregatedPayloadSize = await request.fold<int>(
0, (size, message) => size + message.payload.body.length);
0,
(size, message) => size + message.payload.body.length,
);
return StreamingInputCallResponse()
..aggregatedPayloadSize = aggregatedPayloadSize;
}
@ -78,7 +88,9 @@ class TestService extends TestServiceBase {
@override
Stream<StreamingOutputCallResponse> streamingOutputCall(
ServiceCall call, StreamingOutputCallRequest request) async* {
ServiceCall call,
StreamingOutputCallRequest request,
) async* {
for (final entry in request.responseParameters) {
if (entry.intervalUs > 0) {
await Future.delayed(Duration(microseconds: entry.intervalUs));
@ -88,10 +100,13 @@ class TestService extends TestServiceBase {
}
StreamingOutputCallResponse _responseForRequest(
StreamingOutputCallRequest request) {
StreamingOutputCallRequest request,
) {
if (request.responseStatus.code != 0) {
throw GrpcError.custom(
request.responseStatus.code, request.responseStatus.message);
request.responseStatus.code,
request.responseStatus.message,
);
}
final response = StreamingOutputCallResponse();
if (request.responseParameters.isNotEmpty) {
@ -102,13 +117,17 @@ class TestService extends TestServiceBase {
@override
Stream<StreamingOutputCallResponse> fullDuplexCall(
ServiceCall call, Stream<StreamingOutputCallRequest> request) async* {
ServiceCall call,
Stream<StreamingOutputCallRequest> request,
) async* {
yield* request.map(_responseForRequest);
}
@override
Stream<StreamingOutputCallResponse> halfDuplexCall(
ServiceCall call, Stream<StreamingOutputCallRequest> request) async* {
ServiceCall call,
Stream<StreamingOutputCallRequest> request,
) async* {
final bufferedResponses = await request.map(_responseForRequest).toList();
yield* Stream.fromIterable(bufferedResponses);
}
@ -131,14 +150,16 @@ Future<void> main(List<String> args) async {
final services = [TestService()];
final server = Server(services);
final server = Server.create(services: services);
late ServerTlsCredentials tlsCredentials;
ServerTlsCredentials? tlsCredentials;
if (arguments['use_tls'] == 'true') {
final certificate = File(arguments['tls_cert_file']).readAsBytes();
final privateKey = File(arguments['tls_key_file']).readAsBytes();
tlsCredentials = ServerTlsCredentials(
certificate: await certificate, privateKey: await privateKey);
certificate: await certificate,
privateKey: await privateKey,
);
}
await server.serve(port: port, security: tlsCredentials);
print('Server listening on port ${server.port}...');

View File

@ -19,6 +19,7 @@ import 'dart:typed_data';
import 'package:collection/collection.dart';
import 'package:grpc/grpc.dart';
import 'generated/empty.pb.dart';
import 'generated/messages.pb.dart';
import 'generated/test.pbgrpc.dart';
@ -41,16 +42,17 @@ class Tester {
final String? serviceAccountKeyFile;
String? _serviceAccountJson;
Tester(
{required this.serverHost,
required this.serverHostOverride,
required this.serverPort,
required this.testCase,
required this.useTls,
required this.useTestCA,
required this.defaultServiceAccount,
required this.oauthScope,
required this.serviceAccountKeyFile});
Tester({
required this.serverHost,
required this.serverHostOverride,
required this.serverPort,
required this.testCase,
required this.useTls,
required this.useTestCA,
required this.defaultServiceAccount,
required this.oauthScope,
required this.serviceAccountKeyFile,
});
String get serviceAccountJson =>
_serviceAccountJson ??= _readServiceAccountJson();
@ -74,7 +76,9 @@ class Tester {
trustedRoot = File('ca.pem').readAsBytesSync();
}
credentials = ChannelCredentials.secure(
certificates: trustedRoot, authority: serverHostOverride);
certificates: trustedRoot,
authority: serverHostOverride,
);
} else {
credentials = const ChannelCredentials.insecure();
}
@ -152,8 +156,7 @@ class Tester {
/// * call was successful
/// * response is non-null
Future<void> emptyUnary() async {
final response = await client.emptyCall(Empty());
if (response is! Empty) throw 'Expected Empty response.';
await client.emptyCall(Empty());
}
/// This test verifies that gRPC requests marked as cacheable use GET verb
@ -208,7 +211,7 @@ class Tester {
final receivedBytes = response.payload.body.length;
if (receivedBytes != 314159) {
throw 'Response payload mismatch. Expected 314159 bytes, '
'got ${receivedBytes}.';
'got $receivedBytes.';
}
}
@ -438,14 +441,16 @@ class Tester {
final request = StreamingOutputCallRequest()
..responseParameters.addAll(
expectedResponses.map((size) => ResponseParameters()..size = size));
expectedResponses.map((size) => ResponseParameters()..size = size),
);
final responses = await client.streamingOutputCall(request).toList();
if (responses.length != 4) {
throw 'Incorrect number of responses (${responses.length}).';
}
final responseLengths =
responses.map((response) => response.payload.body.length).toList();
final responseLengths = responses
.map((response) => response.payload.body.length)
.toList();
if (!ListEquality().equals(responseLengths, expectedResponses)) {
throw 'Incorrect response lengths received (${responseLengths.join(', ')} != ${expectedResponses.join(', ')})';
@ -549,8 +554,9 @@ class Tester {
final payload = Payload()..body = Uint8List(requestSizes[index]);
final request = StreamingOutputCallRequest()
..payload = payload
..responseParameters
.add(ResponseParameters()..size = expectedResponses[index]);
..responseParameters.add(
ResponseParameters()..size = expectedResponses[index],
);
return request;
}
@ -629,11 +635,16 @@ class Tester {
/// zero and comparing the entire response message against a golden response
Future<void> computeEngineCreds() async {
final credentials = ComputeEngineAuthenticator();
final clientWithCredentials =
TestServiceClient(channel, options: credentials.toCallOptions);
final clientWithCredentials = TestServiceClient(
channel,
options: credentials.toCallOptions,
);
final response = await _sendSimpleRequestForAuth(clientWithCredentials,
fillUsername: true, fillOauthScope: true);
final response = await _sendSimpleRequestForAuth(
clientWithCredentials,
fillUsername: true,
fillOauthScope: true,
);
final user = response.username;
final oauth = response.oauthScope;
@ -719,11 +730,15 @@ class Tester {
/// zero and comparing the entire response message against a golden response
Future<void> jwtTokenCreds() async {
final credentials = JwtServiceAccountAuthenticator(serviceAccountJson);
final clientWithCredentials =
TestServiceClient(channel, options: credentials.toCallOptions);
final clientWithCredentials = TestServiceClient(
channel,
options: credentials.toCallOptions,
);
final response = await _sendSimpleRequestForAuth(clientWithCredentials,
fillUsername: true);
final response = await _sendSimpleRequestForAuth(
clientWithCredentials,
fillUsername: true,
);
final username = response.username;
if (username.isEmpty) {
throw 'Username not received.';
@ -773,13 +788,19 @@ class Tester {
/// check against the json key file or GCE default service account email.
/// * received SimpleResponse.oauth_scope is in `--oauth_scope`
Future<void> oauth2AuthToken() async {
final credentials =
ServiceAccountAuthenticator(serviceAccountJson, [oauthScope!]);
final clientWithCredentials =
TestServiceClient(channel, options: credentials.toCallOptions);
final credentials = ServiceAccountAuthenticator(serviceAccountJson, [
oauthScope!,
]);
final clientWithCredentials = TestServiceClient(
channel,
options: credentials.toCallOptions,
);
final response = await _sendSimpleRequestForAuth(clientWithCredentials,
fillUsername: true, fillOauthScope: true);
final response = await _sendSimpleRequestForAuth(
clientWithCredentials,
fillUsername: true,
fillOauthScope: true,
);
final user = response.username;
final oauth = response.oauthScope;
@ -829,13 +850,16 @@ class Tester {
/// file used by the auth library. The client can optionally check the
/// username matches the email address in the key file.
Future<void> perRpcCreds() async {
final credentials =
ServiceAccountAuthenticator(serviceAccountJson, [oauthScope!]);
final credentials = ServiceAccountAuthenticator(serviceAccountJson, [
oauthScope!,
]);
final response = await _sendSimpleRequestForAuth(client,
fillUsername: true,
fillOauthScope: true,
options: credentials.toCallOptions);
final response = await _sendSimpleRequestForAuth(
client,
fillUsername: true,
fillOauthScope: true,
options: credentials.toCallOptions,
);
final user = response.username;
final oauth = response.oauthScope;
@ -855,10 +879,12 @@ class Tester {
}
}
Future<SimpleResponse> _sendSimpleRequestForAuth(TestServiceClient client,
{bool fillUsername = false,
bool fillOauthScope = false,
CallOptions? options}) async {
Future<SimpleResponse> _sendSimpleRequestForAuth(
TestServiceClient client, {
bool fillUsername = false,
bool fillOauthScope = false,
CallOptions? options,
}) async {
final payload = Payload()..body = Uint8List(271828);
final request = SimpleRequest()
..responseSize = 314159
@ -869,7 +895,7 @@ class Tester {
final receivedBytes = response.payload.body.length;
if (receivedBytes != 314159) {
throw 'Response payload mismatch. Expected 314159 bytes, '
'got ${receivedBytes}.';
'got $receivedBytes.';
}
return response;
}
@ -922,15 +948,18 @@ class Tester {
}
}
final options = CallOptions(metadata: {
_headerEchoKey: _headerEchoData,
_trailerEchoKey: _trailerEchoData,
});
final options = CallOptions(
metadata: {
_headerEchoKey: _headerEchoData,
_trailerEchoKey: _trailerEchoData,
},
);
final unaryCall = client.unaryCall(
SimpleRequest()
..responseSize = 314159
..payload = (Payload()..body = Uint8List(271828)),
options: options);
SimpleRequest()
..responseSize = 314159
..payload = (Payload()..body = Uint8List(271828)),
options: options,
);
var headers = await unaryCall.headers;
var trailers = await unaryCall.trailers;
await unaryCall;
@ -1096,31 +1125,42 @@ class Tester {
final completer = Completer();
var receivedResponse = false;
call.listen((response) {
if (receivedResponse) {
completer.completeError('Received too many responses.');
return;
}
receivedResponse = true;
if (response.payload.body.length != 31415) {
completer.completeError('Invalid response length: '
'${response.payload.body.length} != 31415.');
}
call.cancel();
}, onError: (e) {
if (e is! GrpcError) completer.completeError('Unexpected error: $e.');
if (e.code != StatusCode.cancelled) {
completer
.completeError('Unexpected status code ${e.code}: ${e.message}.');
}
completer.complete(true);
}, onDone: () {
if (!completer.isCompleted) completer.completeError('Expected error.');
});
call.listen(
(response) {
if (receivedResponse) {
completer.completeError('Received too many responses.');
return;
}
receivedResponse = true;
if (response.payload.body.length != 31415) {
completer.completeError(
'Invalid response length: '
'${response.payload.body.length} != 31415.',
);
}
call.cancel();
},
onError: (e) {
if (e is! GrpcError) {
completer.completeError('Unexpected error: $e.');
} else if (e.code != StatusCode.cancelled) {
completer.completeError(
'Unexpected status code ${e.code}: ${e.message}.',
);
} else {
completer.complete(true);
}
},
onDone: () {
if (!completer.isCompleted) completer.completeError('Expected error.');
},
);
requests.add(StreamingOutputCallRequest()
..responseParameters.add(ResponseParameters()..size = 31415)
..payload = (Payload()..body = Uint8List(27182)));
requests.add(
StreamingOutputCallRequest()
..responseParameters.add(ResponseParameters()..size = 31415)
..payload = (Payload()..body = Uint8List(27182)),
);
await completer.future;
requests.close();
}
@ -1143,10 +1183,14 @@ class Tester {
/// * Call completed with status DEADLINE_EXCEEDED.
Future<void> timeoutOnSleepingServer() async {
final requests = StreamController<StreamingOutputCallRequest>();
final call = client.fullDuplexCall(requests.stream,
options: CallOptions(timeout: Duration(milliseconds: 1)));
requests.add(StreamingOutputCallRequest()
..payload = (Payload()..body = Uint8List(27182)));
final call = client.fullDuplexCall(
requests.stream,
options: CallOptions(timeout: Duration(milliseconds: 1)),
);
requests.add(
StreamingOutputCallRequest()
..payload = (Payload()..body = Uint8List(27182)),
);
try {
await for (final _ in call) {
throw 'Unexpected response received.';

View File

@ -1,34 +1,41 @@
///
//
// Generated code. Do not modify.
// source: empty.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// An empty message that you can re-use to avoid defining duplicated empty
/// messages in your project. A typical example is to use it as argument or the
/// return value of a service API. For instance:
///
/// service Foo {
/// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
/// };
class Empty extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'Empty',
package: const $pb.PackageName(
const $core.bool.fromEnvironment('protobuf.omit_message_names')
? ''
: 'grpc.testing'),
createEmptyInstance: create)
..hasRequiredFields = false;
Empty._() : super();
factory Empty() => create();
Empty._() : super();
factory Empty.fromBuffer($core.List<$core.int> i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(i, r);
factory Empty.fromJson($core.String i,
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Empty',
package: const $pb.PackageName(_omitMessageNames ? '' : 'grpc.testing'),
createEmptyInstance: create)
..hasRequiredFields = false;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
@ -37,9 +44,10 @@ class Empty extends $pb.GeneratedMessage {
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Empty copyWith(void Function(Empty) updates) =>
super.copyWith((message) => updates(message as Empty))
as Empty; // ignore: deprecated_member_use
super.copyWith((message) => updates(message as Empty)) as Empty;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Empty create() => Empty._();
Empty createEmptyInstance() => create();
@ -49,3 +57,6 @@ class Empty extends $pb.GeneratedMessage {
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Empty>(create);
static Empty? _defaultInstance;
}
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,23 @@
///
//
// Generated code. Do not modify.
// source: messages.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// DEPRECATED, don't use. To be removed shortly.
/// The type of payload that should be returned.
class PayloadType extends $pb.ProtobufEnum {
static const PayloadType COMPRESSABLE = PayloadType._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'COMPRESSABLE');
static const PayloadType COMPRESSABLE =
PayloadType._(0, _omitEnumNames ? '' : 'COMPRESSABLE');
static const $core.List<PayloadType> values = <PayloadType>[
COMPRESSABLE,
@ -26,3 +29,5 @@ class PayloadType extends $pb.ProtobufEnum {
const PayloadType._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,8 +1,12 @@
///
//
// Generated code. Do not modify.
// source: test.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;

View File

@ -1,19 +1,26 @@
///
//
// Generated code. Do not modify.
// source: test.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'empty.pb.dart' as $0;
import 'messages.pb.dart' as $1;
export 'test.pb.dart';
@$pb.GrpcServiceName('grpc.testing.TestService')
class TestServiceClient extends $grpc.Client {
static final _$emptyCall = $grpc.ClientMethod<$0.Empty, $0.Empty>(
'/grpc.testing.TestService/EmptyCall',
@ -112,6 +119,7 @@ class TestServiceClient extends $grpc.Client {
}
}
@$pb.GrpcServiceName('grpc.testing.TestService')
abstract class TestServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.testing.TestService';
@ -228,6 +236,7 @@ abstract class TestServiceBase extends $grpc.Service {
$grpc.ServiceCall call, $0.Empty request);
}
@$pb.GrpcServiceName('grpc.testing.UnimplementedService')
class UnimplementedServiceClient extends $grpc.Client {
static final _$unimplementedCall = $grpc.ClientMethod<$0.Empty, $0.Empty>(
'/grpc.testing.UnimplementedService/UnimplementedCall',
@ -245,6 +254,7 @@ class UnimplementedServiceClient extends $grpc.Client {
}
}
@$pb.GrpcServiceName('grpc.testing.UnimplementedService')
abstract class UnimplementedServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.testing.UnimplementedService';
@ -267,6 +277,7 @@ abstract class UnimplementedServiceBase extends $grpc.Service {
$grpc.ServiceCall call, $0.Empty request);
}
@$pb.GrpcServiceName('grpc.testing.ReconnectService')
class ReconnectServiceClient extends $grpc.Client {
static final _$start = $grpc.ClientMethod<$1.ReconnectParams, $0.Empty>(
'/grpc.testing.ReconnectService/Start',
@ -293,6 +304,7 @@ class ReconnectServiceClient extends $grpc.Client {
}
}
@$pb.GrpcServiceName('grpc.testing.ReconnectService')
abstract class ReconnectServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.testing.ReconnectService';

Some files were not shown because too many files have changed in this diff Show More