Compare commits

...

277 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
Kevin Moore def1a19339
Prepare for stable v3 release (#452) 2021-02-11 15:36:03 -08:00
Sam Rawlins 7e8952c352
Bump mockito to breaking change with fixes (#450) 2021-02-04 09:42:29 +01:00
Ji Li eedc9acdc8
Make status code name as a getter to sync with internal impl (#439) 2021-02-02 12:13:54 -08:00
Kevin Moore afea2e71d8
fix spelling of repository, add missing dev_dependency on pkg:path (#449) 2021-02-01 20:43:22 +01:00
Kevin Moore 97b8e47224
Move to published, null-safey packages (#441)
* Move to published, null-safey packages

Also updated homepage -> repository

* unblocked to publish grpc!
2021-02-01 19:53:21 +01:00
Ivan Inozemtsev d7dc79971e
Update interop to null-safe grpc-dart (#448)
Also replace dependency_overrides with published versions
2021-02-01 15:38:31 +01:00
Kevin Moore b437d1089d
Update example pubspecs (#442)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-01 09:18:39 +01:00
Kevin Moore 1327ad7416
Spelling fixes (#443)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-01 09:16:10 +01:00
Kevin Moore 32fbc03c63
Enable and fix pedantic v1.9 lints (#445)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-01 09:12:26 +01:00
Kevin Moore cbec527ba7
Fix grpc-web example, update documentation (#446)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-01 09:04:30 +01:00
Kevin Moore b8adf24ec4
Regenerate proto code with latest generator (#444) 2021-02-01 09:03:11 +01:00
Ivan Inozemtsev 1e1831a187
Migrate grpc to null safety (#432) 2021-01-29 12:40:52 +01:00
Vyacheslav Egorov d3f0ec7f37
Release 2.9.0 (#437) 2021-01-28 13:19:14 +01:00
Ankur Jain 17c0d37ae5
Proper NPE fix (#436)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-28 13:10:58 +01:00
Ji Li 2584a5e536
Add XHR raw response to the GrpcError for a better debugging (#423)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-28 12:33:41 +01:00
Ankur Jain 0eb331f157
Fix potential NPE (#435)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-27 23:51:24 +01:00
Ankur Jain b2f1f697be
Export codecRegistry for connection interface. (#434) 2021-01-27 23:50:21 +01:00
Michael Thomsen f28a9d9d6d
Create SECURITY.md (#433) 2021-01-26 14:56:10 +01:00
Vyacheslav Egorov fbcb426f21
Make sure that grpc_web.dart builds on the Web (#427)
c48af63 accidentally introduced a dependency on VM specific libraries in the shared code

Fix envoy configuration to make sure grpcweb tests runs
2021-01-22 15:35:21 +01:00
Luis Alejandro Herrera León 93c21feb56
Prevent an exception to be thrown when a web connection stream is closed (#414) 2020-12-20 23:05:59 +01:00
Vyacheslav Egorov ed960c26c6
Avoid deprecated List() constructor. (#415)
Enable prefer_collection_literals lint.
2020-12-17 10:50:45 +01:00
Ankur Jain c48af638a5
Support message compression (#409)
* Added support for compression/decompression, which can be configured through 
  `ChannelOptions` constructor's `codecRegistry` parameter or adding the 
  `grpc-accept-encoding` to `metadata` parameter of `CallOptions` on the client 
  side and `codecRegistry` parameter to `Server` on the server side.
  Outgoing rpc can be compressed using the `compression` parameter on the 
  `CallOptions`.

Closes #6
2020-12-11 09:52:24 +01:00
Kevin Moore e51c5a3d5d
Add weekly cron to GitHub workflow (#407)
Make sure we keep working as we roll new dev releases
2020-12-03 20:25:27 +01:00
Vyacheslav Egorov 5b0e9429b8
Release 2.8.0 (#399) 2020-11-12 12:53:46 +01:00
Isaac Saldana 275cc544c9
Fix concurrent modification error in GrpcWebClientChannel.terminate
Fixes #331

Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2020-11-12 12:52:04 +01:00
Vyacheslav Egorov f1c475603f
Cleanups (#398)
* Regenerate protobuf files using newest protoc plugin
* Fix lints everywhere
* Remove visibleForTesting from profile.dart
2020-11-12 11:36:59 +01:00
Vyacheslav Egorov e634f9749f
Fix for duplicate headers (#397) 2020-11-12 09:51:57 +01:00
Ben Konyi b8197a5897
Add timeline logging to grpc client (#392)
Co-authored-by: Zichang Guo <zichangguo@google.com>
2020-11-11 15:51:16 +01:00
Zbigniew Mandziejewicz 8b71a9dab2
Ensure CallOptions merge preserves Web specific options 2020-11-11 15:49:39 +01:00
Lei Liu 52bea07000
Add support for unix domain sockets (#327)
Fixes #299
2020-11-11 15:43:05 +01:00
Michael Thomsen 5b3a125914
Fix badge in readme (#391) 2020-11-04 09:38:16 +01:00
Vyacheslav Egorov 1ea269916d
Remove Travis (#393) 2020-11-04 08:39:40 +01:00
Vyacheslav Egorov 4d55137ef4
Enable Web tests and make sure to install right channel (#390) 2020-11-04 08:33:18 +01:00
Michael Thomsen 3a1c57530f
Update README.md (#388) 2020-11-03 23:09:17 +01:00
Michael Thomsen 0c4d83ab7a
Update dart.yml: Add matrix for 'analyze' job (#389) 2020-11-03 23:08:06 +01:00
Vyacheslav Egorov 63f551b14b
Update dart.yml (#387) 2020-11-03 22:49:23 +01:00
Michael Thomsen 8e353d4675
Create dart.yml (#383) 2020-11-03 22:12:47 +01:00
Vyacheslav Egorov cb1c0ea8b3
Update pubspec.yaml, CHANGELOG.md and expand deprecation notice (#378)
* Opt grpc_web_server.dart out of NNBD.
2020-11-03 14:21:04 +01:00
Zbigniew Mandziejewicz 9f83e124e9
feat: support client interceptors (#338)
* Added support for client interceptors, which can be configured through
  Client constructor's interceptors parameter. Interceptors will be
  executed by Client.$createStreamingCall and Client.$createUnaryCall.
  Using interceptors requires regenerating client stubs using version 19.2.0 or
  newer of protobuf compiler plugin.
* Client.$createCall is deprecated because it does not invoke client
  interceptors.
2020-11-02 11:13:56 +01:00
Vyacheslav Egorov 0589503800
Bump SDK constraint and add dependency on fixnum (#377) 2020-10-30 12:04:57 +01:00
Sigurd Meldgaard 21529c6be7
Don't print from server (#212)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-29 12:57:47 +01:00
Vyacheslav Egorov 7ea15a8160
Propagate cancellation from responses stream to the call (#376)
It is not enough to just cancel the subscription.

Fixes #368
2020-10-29 12:56:49 +01:00
Andrew Coutts b6e40c34e3
Add decoded grpc-status-details-bin details to GrpcError (#349)
Closes #209
2020-10-27 17:07:58 +01:00
Rui Craveiro 3d731e0690
Call to onMetadata handles exceptions (#342)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-26 15:39:49 +01:00
Vyacheslav Egorov 2957ec003f
Add a simple end-to-end gRPC-web test (#354)
We did not have any before which allowed for regressions like #306 to
slip through. Unfortunately we can't test gRPC-web implementation
in pure Dart because we don't have a server side implementation of
the protocol. Instead we add a dependency on the third party
gRPC-web proxy (grpcwebproxy by Improbable Engineering - the choice made
purely based on the simplicity of installation) which forwards all
request gRPC server (written in Dart).
2020-10-25 12:53:53 +01:00
Michael R Fairhurst e2f3d74087
Remove unused dart:async imports (#358)
Since Dart 2.1, Future and Stream have been exported from dart:core
2020-10-25 12:43:15 +01:00
Vyacheslav Egorov f593d21694
Revert "Fix for Windows Travis builds" (#370)
This reverts commit dd34af2de4.
2020-10-13 09:08:29 +02:00
Nic Hite fa6b127dca
Create gRPC servers and clients with TransportConnections. (#364)
* Create gRPC servers and clients with TransportConnections.

* switch class ordering to put base class first.
2020-10-05 19:34:39 -07:00
Vyacheslav Egorov 831f5d8cfb
Revert "Not to fail pending requests, just reschedule it (#303)" (#366)
This reverts commit 9ed03b6b96.

This change prevents client from gracefully handling connection issues and instead just makes it infinitely trying to reconnect.

Closes #339
2020-10-02 22:22:33 +02:00
Nic Hite a657916168
Add client validation to server credentials (#363)
* Add ability to validate clients to server credentials.
2020-09-29 11:55:28 -07:00
Nic Hite a774583de0
Beef up exception handling in gRPC code. (#360)
* Beef up exception handling in gRPC code.

* Verify default stacktrace isn't used in exceptions
2020-09-29 01:01:18 -07:00
Nic Hite bb4eab0f1f
Add browser features to Dart gRPC-web for parity with JS implementation. (#347)
* Add bypassCorsPreflight capability to gRPC-web Dart.

* fix tests and run dartfmt.

* remove print statement

* dartfmt

* Update pubspec.

* Fix changelog.

* Fix tests

* final dartfmt

* Respond to requested changes.

* revert extra newline in changelog

Co-authored-by: Michael Thomsen <mit@google.com>
2020-09-24 21:52:35 -07:00
Vyacheslav Egorov dd34af2de4
Fix for Windows Travis builds (#359)
This works around the issue with googlechrome package.

This package downloads an installer from official Google build source
which provides only the latest version. Whenever a new build is 
published Chocolatey package needs to be updated to resolve 
hash mismatch between new installer and what is hardcoded into the
package itself. Usually this happens automatically but
currently the package is stuck in moderation breaking
normal installation flow. 

We work around the issue by hardcoding the hash for the
current installer version.
2020-09-23 11:37:14 +02:00
Vyacheslav Egorov b70f069671
Prepare to publish 2.2.3 (#355) 2020-09-21 12:18:36 +02:00
Wayne Li afacaa30e0
Remove check for SecurityContext.alpnSupported in security#createSecurityContext (#353)
Co-authored-by: Vyacheslav Egorov <vegorov@google.com>
2020-09-18 10:29:09 +02:00
Vyacheslav Egorov 17a40219ba
Regenerate certificates used by tests. (#352)
Current certificates don't pass verification on Mac OS X Catalina
making it impossible to run test suite on Mac laptops.
2020-09-18 10:27:36 +02:00
Vyacheslav Egorov 3414356950
Revert "Support grpc-web in pure dart (#287)" (#351)
This reverts commit c513e1467f.

The original commit has broken streaming due to limitations of package:http.
2020-09-17 10:59:15 -07:00
Patrice Chalin 6fa4616bac
Example: route guide client cleanup (#350)
Match the tutorial code: the `channel` variable should be a local variable rather than a member of `Client`.
2020-09-16 14:18:17 +02:00
Mehmet Fidanboylu ad2c0f6f3e
Use SecureSocket.connect directly if there's no authority in Credentials (#343) 2020-08-27 15:06:54 -07:00
Patrice Chalin 5891eb81bb
Relax crypto version constraint (for Flutter) (#322) 2020-08-04 10:19:36 +02:00
Patrice Chalin 3d9c8c760c
Fix typo in changelog: grpc-web.dart -> grpc_web.dart (#323) 2020-08-03 22:22:11 +02:00
Patrice Chalin ae0a7df169
README rework: link into language/dart page on grpc.io etc (#324) 2020-08-03 15:50:55 +02:00
Koichi Ishida e4947e2909
Encode server error message (#330) 2020-07-24 10:20:23 +02:00
Koichi Ishida 98ff843751
Decode gRPC error message (#326) 2020-07-20 16:11:19 +02:00
Sigurd Meldgaard 27d9164f28
Add direct dependency to package:crypto. (#316) 2020-06-11 14:33:23 +02:00
Jonas Finnemann Jensen 449faa80ee
Added Application Default Credentials Support (#315)
* Application Default Credentials support

* Prepare a 2.2.0 release of grpc

* Update CHANGELOG.md

Co-authored-by: Sigurd Meldgaard <sigurdm@google.com>

Co-authored-by: Sigurd Meldgaard <sigurdm@google.com>
2020-06-11 14:18:30 +02:00
Oleg Maslovsky 9ed03b6b96
Not to fail pending requests, just reschedule it (#303) 2020-06-08 10:16:00 +02:00
Robson Araujo c513e1467f
Support grpc-web in pure dart (#287)
By using package:http for making connections.
2020-05-12 09:01:36 +02:00
Sigurd Meldgaard 39c751128c
Use tcpNoDelay option for sockets (#298) 2020-05-11 12:47:15 +02:00
Jia Hao 03ecb84064
Export more symbols in grpc_connection_interface.dart (#292)
To create an alternate implementation of ClientChannel, we currently need to import symbols from lib/src which are "private" to the package. This change exports them as part of the public API.
2020-04-16 10:34:59 +02:00
Patrice Chalin 4ba2a13b16
Fix typo in example README (#288) 2020-03-30 12:42:58 +02:00
Jiangtao Li 496c8b07d1
Update test credentials to use 2048-bit RSA (#285) 2020-03-23 14:20:21 +01:00
Patrice Chalin 63dd99e3f3
helloworld and route_guide: update to protobuf v1 (#279) 2020-03-10 09:06:16 +01:00
Sigurd Meldgaard 7d3b3749e8
server: Cancel call when the outgoing messages are closed (#274) 2020-01-28 09:29:05 +01:00
Igor Demyanov ae17e712e4 Share port support (#253)
* Share port support
2019-12-04 09:35:02 +01:00
Igor Demyanov caa1a31bb8 ignore '.idea' directory (#251) 2019-11-29 08:06:46 +01:00
Sigurd Meldgaard 6061512afa
Grpc-web Handle empty trailers (#247)
* Grpc-web Handle empty trailers
2019-11-07 10:52:13 +01:00
Michael Thomsen fd92060ad0
Update README.md (#245) 2019-10-31 10:16:07 +01:00
Sigurd Meldgaard 588c21e542
Avoid sending headers as trailers twice (#244) 2019-10-24 09:35:28 +02:00
Tim e70ea6f2d0 Fix grpc-web import in Readme (#243) 2019-10-23 11:02:46 +02:00
Nic Hite 7ed8b741cd
Add explicit 'localhost' to tests involving server (#242)
* Add explicit 'localhost' to tests involving server

* Bump version

* Clean up CHANGELOG

* Revert version bump.
2019-09-30 01:22:16 -07:00
Sigurd Meldgaard 7af96e5ced
Update test certificate (#241)
The old one was expired.
This one will expire in 2119 hopefully making it somebody elses problem.
2019-09-24 13:32:32 +01:00
Sigurd Meldgaard 20352dd718 Use host without port as authority when making secure connection (#238) 2019-09-09 09:41:56 +02:00
Jan Tattermusch 8e23f00f41 Update MAINTAINERS.md (#234) 2019-08-27 14:37:35 +02:00
Sigurd Meldgaard b7be3af34b
Fix use of authority when making a secure connection 2019-08-22 14:26:29 +02:00
Michael Thomsen 78dcb0f4f1
Create MAINTAINERS.md (#232) 2019-08-20 15:57:49 +02:00
Sigurd Meldgaard 992e2dcc29
Improve connection handling (#231)
* Improve connection handling

* Address review. Add round-trip-test
2019-08-19 15:31:16 +02:00
Sigurd Meldgaard 5ac5d6a1e4 Update .travis.yml (#230) 2019-08-16 09:06:09 +01:00
Sigurd Meldgaard 1213bc546b
Relax dependency on package:meta (#227) 2019-08-08 13:34:51 +02:00
Sigurd Meldgaard 3aeafa77cb
Improve error handling (#204)
* Improve error handling

1) Let GrpcError implement exception

As the user is (usually) expected to catch these they should implement
Exception.
There is a bigger clean-up in splitting off the GrpcError.internal as
that seems to be for invariant violations

2) Convert some thrown strings into exceptions.
2019-07-03 09:26:45 +02:00
Florian Pirmin Groetzner c305f0d685 Update README.md (#210)
Fix double word
2019-07-02 10:30:26 +02:00
Sigurd Meldgaard 9d2a469655
Provide scheme as part of audience (#211) 2019-06-28 15:24:59 +02:00
Sigurd Meldgaard 6d485375ba
Unimplement unimplementedMethod in interop (#208) 2019-06-27 15:36:43 +02:00
Sigurd Meldgaard dcac905a13
Fix interop (#207)
* Fix computation of authority
2019-06-27 14:43:15 +02:00
Sigurd Meldgaard 054ac9de3c
Fix imports (#199) 2019-06-25 13:00:58 +02:00
Sigurd Meldgaard 91564ff7aa
grpc-web support (#191)
* grpc-web support

This commits merges the grpc-web branch into master.

It is based on work by https://github.com/fuzzybinary .
2019-06-17 13:31:07 +02:00
Sigurd Meldgaard e65c52070b
Wait longer for timeout in timeout_test (#192) 2019-06-14 10:34:45 +02:00
Brett Morgan 6c0f61aaf6 Updating for Protobuf 0.13 (#190) 2019-06-14 09:24:05 +02:00
Nic Hite c9c4e40088
Remove unnecessary 'new' and 'const' keywords. (#186) 2019-06-04 11:31:01 -07:00
Sigurd Meldgaard c415d0f4e2
update changelog (#183) 2019-06-03 15:04:10 +02:00
Michael Thomsen 0c8f5ae057
Update README.md (#184) 2019-05-28 15:08:42 +02:00
Ivan c65afe9ec0 Add userAgent for ChannelOptions (#155)
Add userAgent for ChannelOptions
2019-05-28 12:31:35 +02:00
Sigurd Meldgaard f3e1e32973
Allow authority for insecure connections (#179) 2019-05-23 15:48:46 +02:00
Michael Thomsen 0cbc5401c8 Add Windows to the test config (#129) 2019-04-09 11:11:41 +02:00
Sigurd Meldgaard 56c77f84ae
bump_version (#165) 2019-04-03 15:15:01 +02:00
Sigurd Meldgaard 92731e1a71
Cancel `ServerHandler` when `ServerTransportConnection.incomingStreams` is closed (#164)
* Cancel ServerHandler when connection closes
2019-04-03 14:57:55 +02:00
Sigurd Meldgaard d7ae930e7f
Revert "Support grpc-web" (#159)
This reverts commit d58659507c.

Development of grpc-web will continue on the branch
https://github.com/grpc/grpc-dart/tree/grpc-web until it is ready.
2019-03-18 13:46:50 +01:00
Jeff Ward d58659507c Support grpc-web 2019-03-15 12:51:06 +01:00
Sigurd Meldgaard 76159960e2
Add service_api.dart with platform independent exports (#152) 2019-01-24 13:44:59 +01:00
Sigurd Meldgaard f48144271c
Update CHANGELOG.md (#151) 2019-01-22 13:26:58 +01:00
Ivan d62009e9fb Update dependencies(http2,mockito) (#145) 2019-01-22 13:08:25 +01:00
Nic Hite eafca2ab28 Replace Future<Null> with Future<void>. (#146) 2019-01-03 08:13:25 +01:00
Michael Thomsen ae9a7c7142
Graduate package to 1.0 stable (#143)
* Update README.md

* Update pubspec.yaml

* Update CHANGELOG.md

* Extend the package description
2018-12-17 15:49:14 +01:00
Michael Thomsen 6428b4e2f7
Create README.md (#144) 2018-12-17 15:33:48 +01:00
Sigurd Meldgaard e0d0516c9c
Version bump to publish without stray files (#142) 2018-12-13 12:21:59 +01:00
Alexandre Ardhuin 921f4df0b9 don't throw on closing channel not open (#128)
Don't throw on closing channel not open
2018-11-12 14:54:11 +01:00
Sigurd Meldgaard c252ada1a5
Don't rely on package:test internals (#136) 2018-11-05 15:39:51 +01:00
Sigurd Meldgaard 175910c58a
Update dependencies (#127) 2018-10-24 12:49:33 +02:00
Sigurd Meldgaard c02c5c46de Update .travis.yml (#119) 2018-10-17 13:31:57 +02:00
Alexandre Ardhuin 3e3ba6682f allows async interceptors (#120)
* allows async interceptors

* prevent chunks to come before starting streaming request
2018-09-18 08:17:39 +02:00
Sigurd Meldgaard 97e47bd3e7
Version bump (#118) 2018-09-07 10:27:05 +02:00
Alexandre Ardhuin 1051232d17 bump versions for dart 2 (#117) 2018-09-07 10:09:52 +02:00
Sigurd Meldgaard 561f8fe716
Make Status codes `static const` instead of `static final`. (#104)
Make Status codes `static const` instead of `static final`.
This enables using the codes in switch statements and default values.
2018-08-06 13:47:45 +02:00
Sigurd Meldgaard 17ce11f7fc
Allow for non ascii headers (#103) 2018-07-19 15:46:23 +02:00
Bob Nystrom 238fd7ec67 Finish migrating to the Dart 2 core library constants. (#101) 2018-07-19 15:16:58 +02:00
Michael Thomsen c32a9e97be
Use new Dart 2 APIs (#99)
* Upgrade to Dart 2 APIs

* Run dartfmt

* Update CHANGELOG.md

* Update pubspec.yaml
2018-07-13 12:57:18 +02:00
Michael Thomsen 72aac2adbe
Declare Dart 2.0 compatability (#98)
* Widen Dart SDK constraint to support Dart 2.0 stable

* Update CHANGELOG.md
2018-07-12 11:28:46 +02:00
Michael Thomsen 9e1f296a3f
Add Pub badge to readme (#96) 2018-07-10 16:59:30 +02:00
Michael Thomsen ee1b0f9141
Prepare 0.5.0 release (#94)
* Prepare 0.5.0 release
2018-07-10 14:45:22 +02:00
German Saprykin 847a3625e1 Added interceptors. (#86)
* Add draft implementation of interceptors.

* Fix review comment.

* Revert example files.

* Revert interop files.

* Revert interop files.

* Format.

* Fix typos.
2018-07-09 16:57:07 +02:00
Sigurd Meldgaard 694332921a Update test dependencies (#92)
* Update test dependencies

* Revert "Update test dependencies"

This reverts commit 86a6ae2dad.

* Update test dependencies

* Fix use of mockito when

* NOP

* Revert "NOP"

This reverts commit dec6a5a57a.

* Upgrade mockito

* Increase SDK dependency

* Increase deleay to trigger timeout

* Reintroduce include

* Relax sdk version constraint
2018-07-09 16:44:12 +02:00
Jon Kirkman 7428ab3b51 removed version from example pubspecs (#90) 2018-07-04 08:35:56 +02:00
Jakob Andersen b8e5c5c2c5
Fix tests in Dart 2 mode. (#85)
Also updated generated code using latest protoc_plugin, for Dart 2 updates.

Fixes #84.
2018-05-02 12:39:58 +02:00
Michael Thomsen 696413339f
Update README.md (#83) 2018-04-24 22:53:39 +02:00
Jakob Andersen 88485bad11
Tweaks. (#82)
Using address: 'localhost' didn't work as expected in the Docker
environment, so reverting to old behavior.

Fixed a typo.
2018-04-06 11:35:11 +02:00
Jakob Andersen 38ad37e2ef
Remove superfluous 'is'. (#81) 2018-04-05 13:50:40 +02:00
Jakob Andersen 8a397d8c86
Prepare release 0.4.1 (#80) 2018-04-05 10:14:10 +02:00
Jakob Andersen 686ecb3943
Dart 2 fixes (#77) 2018-04-05 09:43:42 +02:00
Jakob Andersen 0393703f58
Ensure shutdown and terminate always return a Future<Null>. (#75)
Even if _transport.finish()/terminate() returns some other kind of
Future.
2018-03-28 14:54:09 +02:00
Michael Thomsen c914f67c11
Clarify protoc steps (#69)
* Clarify protoc steps

* Update README.md
2018-03-23 11:11:45 +01:00
Michael Thomsen d9c6f6ed77
Add details about platforms (#70) 2018-03-23 11:11:03 +01:00
Jakob Andersen db484e154e
Prepare release 0.4.0 (#65) 2018-03-19 11:32:05 +01:00
Jakob Andersen 00bab79945
Widen version constraint for async. (#64)
Fixes #63.
2018-03-16 11:31:09 +01:00
Jakob Andersen d9dea0e489
Move TLS credentials for server into a separate class. (#61)
Add address parameter for server, to control which address to listen to,
and the ability to use an ephemeral port.
2018-03-14 16:38:52 +01:00
Michael Thomsen 9ef437d2be Fix the Travis badge after move (#62) 2018-03-07 09:33:47 +01:00
Jakob Roland Andersen f6126c5325 Add direct dependency on package:http. 2018-02-27 10:21:39 +01:00
Jakob Roland Andersen 26cb308d36 Release 0.3.1 2018-02-27 10:15:15 +01:00
Jakob Andersen 40ffab8da5
Split out TLS credentials to a separate class. (#60)
Add a 'bad certificate handler' to the new ChannelCredentials, which can
be used to override certificate validation (for example, to allow
auto-generated self-signed certificates during development).

Also fixed a bug in Server.shutdown().
2018-02-27 10:10:44 +01:00
Jakob Andersen 582ca1b60d
Add helloworld example. (#59)
This will be used in the quickstart docs, similar to the other
languages.
2018-02-20 14:49:04 +01:00
Jakob Andersen 3f60746689
Fix lint. (#58) 2018-02-06 13:31:59 -08:00
Jakob Andersen 325eadec8c
Fix GCE auth interop test. (#57)
Hopefully.
2018-02-06 12:46:53 -08:00
Leaf Petersen ab92276174
Fix bad override in test (#56) 2018-02-06 06:17:19 -08:00
Jakob Andersen 7621132097
Authenticated cloud-to-prod interop tests. (#55)
Added authentication provider classes, and wired up the auth interop
tests.

Refactored connection logic to throw initial connection errors early.

Fixes #53
2018-02-05 23:17:16 +01:00
Michael Thomsen c082e5b673
Update CODE-OF-CONDUCT.md (#49) 2018-01-19 10:50:18 +01:00
236 changed files with 24193 additions and 4897 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"

97
.github/workflows/dart.yml vendored Normal file
View File

@ -0,0 +1,97 @@
name: Dart
on:
# Run CI on pushes to the master branch, and on PRs against master.
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 0 * * 0"
jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [stable, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ matrix.sdk }}
- name: Report version
run: dart --version
- name: Install dependencies
run: dart pub get
- 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: |
for example in interop example/*/; do
pushd $example
echo [Getting dependencies in $example]
dart pub get
popd
done
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
# 2. release channel: dev
# 3. TODO: Dart execution mode: native, web
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, dev]
platform: [vm, chrome]
exclude:
# We only run Chrome tests on Linux. No need to run them
# on Windows and Mac because they are platform independent.
- os: windows-latest
platform: chrome
- os: macos-latest
platform: chrome
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ matrix.sdk }}
- name: Report version
run: dart --version
- name: Install envoy
if: ${{ matrix.platform == 'chrome' }}
run: |
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
- name: Install dependencies
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

6
.gitignore vendored
View File

@ -1,4 +1,5 @@
# Files and directories created by pub
.dart_tool/
.packages
.pub/
build/
@ -9,3 +10,8 @@ pubspec.lock
# Directory created by dartdoc
doc/api/
# Directory created by WebStorm
.idea/
# Macos
.DS_Store

View File

@ -1,38 +0,0 @@
language: dart
sudo: false
# Run against dev and stable channels.
dart:
- dev
- stable
# Define test tasks to run.
dart_task:
- test: --platform vm
# Only run one instance of the formatter and the analyzer, rather than running
# them against each Dart version.
matrix:
include:
- dart: stable
dart_task: dartfmt
# Wish we could exclude `example` in `analysis_options.yaml` but it seems
# blocked by https://github.com/dart-lang/sdk/issues/26212
- dart: dev
script:
- dartanalyzer lib test
- for example in example/*; do (cd $example; echo [Analyzing $example]; pub get; dartanalyzer .); done
- (cd interop; echo [Analyzing interop]; pub get; dartanalyzer .)
# Only building master means that we don't run two builds for each pull request.
branches:
only: [master]
os:
- linux
- osx
cache:
directories:
- $HOME/.pub-cache

View File

@ -4,3 +4,5 @@
# Name/Organization <email address>
Google Inc.
German Saprykin <saprykin.h@gmail.com>
Alexandre Ardhuin <alexandre.ardhuin@gmail.com>

View File

@ -1,23 +1,368 @@
## 0.2.1 - 2018-01-18
## 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.
* Require Dart 2.12 or greater.
## 2.9.0
* Added support for compression/decompression, which can be configured through
`ChannelOptions` constructor's `codecRegistry` parameter or adding the
`grpc-accept-encoding` to `metadata` parameter of `CallOptions` on the client
side and `codecRegistry` parameter to `Server` on the server side.
Outgoing rpc can be compressed using the `compression` parameter on the
`CallOptions`.
* Fix issue [#206](https://github.com/grpc/grpc-dart/issues/206). Prevent an
exception to be thrown when a web connection stream is closed.
* Add XHR raw response to the GrpcError for a better debugging
([PR #423](https://github.com/grpc/grpc-dart/pulls/423)).
Note: this is the last release supporting SDK < 2.12. Next release will
be nullsafe and thus require SDK >= 2.12.
## 2.8.0
* Added support for client interceptors, which can be configured through
`Client` constructor's `interceptors` parameter. Interceptors will be
executed by `Client.$createStreamingCall` and `Client.$createUnaryCall`.
Using interceptors requires regenerating client stubs using version 19.2.0 or
newer of protobuf compiler plugin.
* `Client.$createCall` is deprecated because it does not invoke client
interceptors.
* Fix issue [#380](https://github.com/grpc/grpc-dart/issues/380) causing
incorrect duplicated headers in gRPC-Web requests.
* Change minimum required Dart SDK to 2.8 to enable access to Unix domain sockets.
* Add support for Unix domain sockets in `Socket.serve` and `ClientChannel`.
* Fix issue [#331](https://github.com/grpc/grpc-dart/issues/331) causing
an exception in `GrpcWebClientChannel.terminate()`.
## 2.7.0
* Added decoding/parsing of `grpc-status-details-bin` to pass all response
exception details to the `GrpcError` thrown in Dart, via
[#349](https://github.com/grpc/grpc-dart/pull/349).
* Dart SDK constraint is bumped to `>=2.3.0 <3.0.0` due to language version
in the generated protobuf code.
## 2.6.0
* Create gRPC servers and clients with [Server|Client]TransportConnection.
This allows callers to provide their own transport configuration, such
as their own implementation of streams and sinks instead of sockets.
## 2.5.0
* Expose a `validateClient` method for server credentials so gRPC server
users may know when clients are loopback addresses.
## 2.4.1
* Plumb stacktraces through request / response stream error handlers.
* Catch and forward any errors decoding the response.
## 2.4.0
* Add the ability to bypass CORS preflight requests.
## 2.3.0
* Revert [PR #287](https://github.com/grpc/grpc-dart/pull/287), which allowed
using gRPC-web in native environments but also broke streaming.
## 2.2.0+1
* Relax `crypto` version dependency constraint from `^2.1.5` to `^2.1.4`.
## 2.2.0
* Added `applicationDefaultCredentialsAuthenticator` function for creating an
authenticator using [Application Default Credentials](https://cloud.google.com/docs/authentication/production).
* Less latency by using the `tcpNoDelay` option for sockets.
* Support grpc-web in a non-web setting.
## 2.1.3
* Fix bug in grpc-web when receiving an empty trailer.
* Fix a state bug in the server.
## 2.1.2
* Fix bug introduced in 2.1.1 where the port would be added to the default authority when making a
secure connection.
## 2.1.1
* Fix bug introduced in 2.1.0 where an explicit `authority` would not be used when making a secure
connection.
## 2.1.0
* Do a health check of the http2-connection before making request.
* Introduce `ChannelOptions.connectionLimit` the longest time a single connection is used for new
requests.
* Use Tcp.nodelay to improve client call speed.
* Use SecureSocket supportedProtocols to save a round trip when establishing a secure connection.
* Allow passing http2 `ServerSettings` to `Server.serve`.
## 2.0.3
* GrpcError now implements Exception to indicate it can be reasonably handled.
## 2.0.2
* Fix computation of the audience given to metadata providers to include the scheme.
## 2.0.1
* Fix computation of authority. This should fix authorization.
## 2.0.0+1
* Fix imports to ensure `grpc_web.dart` has no accidental transitive dependencies on dart:io.
## 2.0.0
* Add initial support for grpc-web.
See `example/grpc-web` for an example of this working.
* **Breaking**: `grpc.dart` no longer exposes `ClientConnection`. It was supposed to be an internal
abstraction.
* **Breaking**: `grpc.dart` no longer exposes the deprecated `ServerHandler`.
It was supposed to be an internal abstraction.
* `service_api.dart` no longer exports Server - it has never been used by the generated code.
## 1.0.3
* Allow custom user agent with a `userAgent` argument for `ChannelOptions()`.
* Allow specifying `authority` for `ChannelCredentials.insecure()`.
* Add `userAgent` as an optional named argument for `clientConnection.createCallHeaders()`.
## 1.0.2
* Fix bug where the server would crash if the client would break the connection.
## 1.0.1
* Add `service_api.dart` that only contains the minimal imports needed by the code generated by
protoc_plugin.
## 1.0.0+1
* Support package:http2 1.0.0.
## 1.0.0
* Graduate package to 1.0.
## 0.6.8+1
* Removes stray files that where published by accident in version 0.6.8.
## 0.6.8
* Calling `terminate()` or `shutdown()` on a channel doesn't throw error if the
channel is not yet open.
## 0.6.7
* Support package:test 1.5.
## 0.6.6
* Support `package:http` `>=0.11.3+17 <0.13.0`.
* Update `package:googleapis_auth` to `^0.2.5+3`.
## 0.6.5
* Interceptors are now async.
## 0.6.4
* Update dependencies to be compatible with Dart 2.
## 0.6.3
* Make fields of `StatusCode` const rather than final.
## 0.6.2
* Allow for non-ascii header values.
## 0.6.1
* More fixes to update to Dart 2 core library APIs.
## 0.6.0+1
* Updated implementation to use new Dart 2 APIs using
[dart2_fix](https://github.com/dart-lang/dart2_fix).
## 0.6.0
* Dart SDK upper constraint raised to declare compatibility with Dart 2.0 stable.
## 0.5.0
* Breaking change: The package now exclusively supports Dart 2.
* Fixed tests to pass in Dart 2.
* Added support for Interceptors ([issue #79](https://github.com/grpc/grpc-dart/issues/79)); thanks to [@mogol](https://github.com/mogol) for contributing!
## 0.4.1
* Fixes for supporting Dart 2.
## 0.4.0
* Moved TLS credentials for server into a separate class.
* Added support for specifying the address for the server, and support for
serving on an ephemeral port.
## 0.3.1
* Split out TLS credentials to a separate class.
## 0.3.0
* Added authentication metadata providers, optimized for use with Google Cloud.
* Added service URI to metadata provider API, needed for Json Web Token generation.
* Added authenticated cloud-to-prod interoperability tests.
* Refactored connection logic to throw initial connection errors early.
## 0.2.1
* Updated generated code in examples using latest protoc compiler plugin.
* Dart 2.0 fixes.
* Changed license to Apache 2.0.
## 0.2.0 - 2017-12-15
## 0.2.0
* Implemented support for per-RPC metadata providers. This can be used for
authentication providers which may need to obtain or refresh a token before
the RPC is sent.
## 0.1.0 - 2017-10-12
## 0.1.0
* Core gRPC functionality is implemented and passes
[gRPC compliance tests](https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md).
The API is shaping up, but may still change as more advanced features are implemented.
## 0.0.1 - 2017-07-05
## 0.0.1
* Initial version.

View File

@ -1,12 +1,3 @@
We expect contributors to act professionally and respectfully, and we
expect our social spaces to be safe and dignified environments.
## Community Code of Conduct
Specifically:
* Respect people, their identities, their culture, and their work.
* Be kind. Be courteous. Be welcoming.
* Listen. Consider and acknowledge peoples points before responding.
We will not tolerate harrasment from anyone in our community.
gRPC follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

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,10 +33,13 @@ 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`](
https://www.envoyproxy.io/docs/envoy/latest/start/start.html) binary to be
available in the PATH.
## Guidelines for Pull Requests
How to get your contributions merged smoothly and quickly.
@ -63,3 +66,6 @@ early on.
- Exceptions to the rules can be made if there's a compelling reason for doing
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/generated`.

15
MAINTAINERS.md Normal file
View File

@ -0,0 +1,15 @@
This page lists all active maintainers of this repository. If you were a
maintainer and would like to add your name to the Emeritus list, please send us a
PR.
See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md)
for general contribution guidelines.
## Maintainers (in alphabetical order)
- [mit-mit](https://github.com/mit-mit), Google LLC
- [nichite](https://github.com/nichite), Google LLC
- [szakarias](https://github.com/szakarias), Google LLC
- [sigurdm](https://github.com/sigurdm), Google LLC
## Emeritus Maintainers (in alphabetical order)
- [jakobr-google](https://github.com/jakobr-google), Google LLC

View File

@ -1,21 +1,27 @@
The [Dart](https://www.dartlang.org/) implementation of
[![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.
[![Build Status](https://travis-ci.org/dart-lang/grpc-dart.svg?branch=master)](https://travis-ci.org/dart-lang/grpc-dart)
## Learn more
# Usage
- [Quick Start](https://grpc.io/docs/languages/dart/quickstart) - get an app running in minutes
- [Examples](https://github.com/grpc/grpc-dart/tree/master/example)
- [API reference](https://grpc.io/docs/languages/dart/api)
See the [route_guide example](example/route_guide/) for an example on how to
use this package.
For complete documentation, see [Dart gRPC](https://grpc.io/docs/languages/dart).
# Status
## Supported platforms
This package is currently in *beta*: It is available for general usage,
and is considered feature complete.
- [Dart native](https://dart.dev/platforms)
- [Flutter](https://flutter.dev)
If you experience issues, or if you have feature requests,
please [open an issue](https://github.com/dart-lang/grpc-dart/issues).
> **Note:** [grpc-web](https://github.com/grpc/grpc-web) is supported by `package:grpc/grpc_web.dart`.
> **UDS-unix domain socket** is supported with sdk version >= 2.8.0.
# Notes
## Contributing
This library requires Dart SDK version 1.24.3 or later.
If you experience problems or have feature requests, [open an issue](https://github.com/dart-lang/grpc-dart/issues/new).
Note that we have limited bandwidth to accept PRs, and that all PRs require signing the [EasyCLA](https://lfcla.com).

3
SECURITY.md Normal file
View File

@ -0,0 +1,3 @@
# Security Policy
For information on the gRPC-Dart security policy, please see https://dart.dev/security.

View File

@ -1,21 +1,21 @@
analyzer:
strong-mode: true
# exclude:
# - path/to/excluded/files/**
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
# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
linter:
rules:
- avoid_init_to_null
- always_declare_return_types
- cancel_subscriptions
- close_sinks
- directives_ordering
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- prefer_final_fields
- omit_local_variable_types
- prefer_final_locals
- prefer_is_not_empty
- prefer_relative_imports
- prefer_single_quotes
- strict_top_level_inference
- test_types_in_equals
- unrelated_type_equality_checks
- valid_regexps

5
build.yaml Normal file
View File

@ -0,0 +1,5 @@
targets:
$default:
sources:
exclude:
- example/**

15
example/README.md Normal file
View File

@ -0,0 +1,15 @@
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 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.
1. [metadata](https://github.com/grpc/grpc-dart/tree/master/example/metadata):
A demonstration of how to handle custom metadata, cancellation, and timeouts in Dart gRPC.
1. [route_guide](https://github.com/grpc/grpc-dart/tree/master/example/route_guide):
A demonstration of how to perform unary, client streaming, server streaming and full duplex RPCs.
For a complete, step-wise working example, see the [Dart gRPC Quick Start](https://grpc.io/docs/quickstart/dart).

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

@ -0,0 +1 @@
include: ../../analysis_options.yaml

View File

@ -14,77 +14,21 @@
// limitations under the License.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:googleapis_auth/auth_io.dart' as auth;
import 'package:grpc/grpc.dart';
import 'package:http/http.dart' as http;
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';
const _tokenExpirationThreshold = const Duration(seconds: 30);
class ServiceAccountAuthenticator {
auth.ServiceAccountCredentials _serviceAccountCredentials;
final List<String> _scopes;
String _projectId;
auth.AccessToken _accessToken;
Future<CallOptions> _call;
ServiceAccountAuthenticator(String serviceAccountJson, this._scopes) {
final serviceAccount = JSON.decode(serviceAccountJson);
_serviceAccountCredentials =
new auth.ServiceAccountCredentials.fromJson(serviceAccount);
_projectId = serviceAccount['project_id'];
}
String get projectId => _projectId;
Future authenticate(Map<String, String> metadata) async {
if (_accessToken == null || _accessToken.hasExpired) {
await _obtainAccessCredentials();
}
metadata['authorization'] = 'Bearer ${_accessToken.data}';
if (_tokenExpiresSoon) {
// Token is about to expire. Extend it prematurely.
_obtainAccessCredentials().catchError((_) {});
}
}
bool get _tokenExpiresSoon => _accessToken.expiry
.subtract(_tokenExpirationThreshold)
.isBefore(new DateTime.now().toUtc());
Future _obtainAccessCredentials() {
if (_call == null) {
final authClient = new http.Client();
_call = auth
.obtainAccessCredentialsViaServiceAccount(
_serviceAccountCredentials, _scopes, authClient)
.then((credentials) {
_accessToken = credentials.accessToken;
_call = null;
authClient.close();
});
}
return _call;
}
CallOptions get toCallOptions => new CallOptions(providers: [authenticate]);
}
Future<Null> main() async {
final serviceAccountFile = new File('logging-service-account.json');
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);
}
@ -93,21 +37,26 @@ Future<Null> main() async {
'https://www.googleapis.com/auth/logging.write',
];
final authenticator = new ServiceAccountAuthenticator(
serviceAccountFile.readAsStringSync(), scopes);
final authenticator = ServiceAccountAuthenticator(
serviceAccountFile.readAsStringSync(),
scopes,
);
final projectId = authenticator.projectId;
final channel = new ClientChannel('logging.googleapis.com',
options: const ChannelOptions.secure());
final logging =
new LoggingServiceV2Client(channel, options: authenticator.toCallOptions);
final channel = ClientChannel('logging.googleapis.com');
final logging = LoggingServiceV2Client(
channel,
options: authenticator.toCallOptions,
);
final request = new WriteLogEntriesRequest()
..entries.add(new LogEntry()
final request = WriteLogEntriesRequest()
..entries.add(
LogEntry()
..logName = 'projects/$projectId/logs/example'
..severity = LogSeverity.INFO
..resource = (new MonitoredResource()..type = 'global')
..textPayload = 'This is a log entry!');
..resource = (MonitoredResource()..type = 'global')
..textPayload = 'This is a log entry!',
);
await logging.writeLogEntries(request);
await channel.shutdown();

View File

@ -1,78 +1,125 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_label;
// source: google/api/label.proto
//
// @dart = 2.12
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
// 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 'package:protobuf/protobuf.dart';
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'label.pbenum.dart';
export 'label.pbenum.dart';
class LabelDescriptor extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('LabelDescriptor')
..aOS(1, 'key')
/// A description of a label.
class LabelDescriptor extends $pb.GeneratedMessage {
factory LabelDescriptor({
$core.String? key,
LabelDescriptor_ValueType? valueType,
$core.String? description,
}) {
final result = create();
if (key != null) {
result.key = key;
}
if (valueType != null) {
result.valueType = valueType;
}
if (description != null) {
result.description = description;
}
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,
'valueType',
PbFieldType.OE,
LabelDescriptor_ValueType.STRING,
LabelDescriptor_ValueType.valueOf,
LabelDescriptor_ValueType.values)
..aOS(3, 'description')
2, _omitFieldNames ? '' : 'valueType', $pb.PbFieldType.OE,
defaultOrMaker: LabelDescriptor_ValueType.STRING,
valueOf: LabelDescriptor_ValueType.valueOf,
enumValues: LabelDescriptor_ValueType.values)
..aOS(3, _omitFieldNames ? '' : 'description')
..hasRequiredFields = false;
LabelDescriptor() : super();
LabelDescriptor.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
LabelDescriptor.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
LabelDescriptor clone() => new LabelDescriptor()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static LabelDescriptor create() => new LabelDescriptor();
static PbList<LabelDescriptor> createRepeated() =>
new PbList<LabelDescriptor>();
static LabelDescriptor getDefault() {
if (_defaultInstance == null)
_defaultInstance = new _ReadonlyLabelDescriptor();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
LabelDescriptor clone() => LabelDescriptor()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
LabelDescriptor copyWith(void Function(LabelDescriptor) updates) =>
super.copyWith((message) => updates(message as LabelDescriptor))
as LabelDescriptor;
static LabelDescriptor _defaultInstance;
static void $checkItem(LabelDescriptor v) {
if (v is! LabelDescriptor) checkItemFailed(v, 'LabelDescriptor');
}
$pb.BuilderInfo get info_ => _i;
String get key => $_getS(0, '');
set key(String v) {
@$core.pragma('dart2js:noInline')
static LabelDescriptor create() => LabelDescriptor._();
LabelDescriptor createEmptyInstance() => create();
static $pb.PbList<LabelDescriptor> createRepeated() =>
$pb.PbList<LabelDescriptor>();
@$core.pragma('dart2js:noInline')
static LabelDescriptor getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
static LabelDescriptor? _defaultInstance;
/// The label key.
@$pb.TagNumber(1)
$core.String get key => $_getSZ(0);
@$pb.TagNumber(1)
set key($core.String v) {
$_setString(0, v);
}
bool hasKey() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasKey() => $_has(0);
@$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)
set valueType(LabelDescriptor_ValueType v) {
setField(2, v);
}
bool hasValueType() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasValueType() => $_has(1);
@$pb.TagNumber(2)
void clearValueType() => clearField(2);
String get description => $_getS(2, '');
set description(String v) {
/// A human-readable description for the label.
@$pb.TagNumber(3)
$core.String get description => $_getSZ(2);
@$pb.TagNumber(3)
set description($core.String v) {
$_setString(2, v);
}
bool hasDescription() => $_has(2);
@$pb.TagNumber(3)
$core.bool hasDescription() => $_has(2);
@$pb.TagNumber(3)
void clearDescription() => clearField(3);
}
class _ReadonlyLabelDescriptor extends LabelDescriptor
with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,35 +1,39 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_label_pbenum;
// source: google/api/label.proto
//
// @dart = 2.12
// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME
import 'dart:core' show int, dynamic, String, List, Map;
import 'package:protobuf/protobuf.dart';
// 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
class LabelDescriptor_ValueType extends ProtobufEnum {
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 =
const LabelDescriptor_ValueType._(0, 'STRING');
LabelDescriptor_ValueType._(0, _omitEnumNames ? '' : 'STRING');
static const LabelDescriptor_ValueType BOOL =
const LabelDescriptor_ValueType._(1, 'BOOL');
LabelDescriptor_ValueType._(1, _omitEnumNames ? '' : 'BOOL');
static const LabelDescriptor_ValueType INT64 =
const LabelDescriptor_ValueType._(2, 'INT64');
LabelDescriptor_ValueType._(2, _omitEnumNames ? '' : 'INT64');
static const List<LabelDescriptor_ValueType> values =
const <LabelDescriptor_ValueType>[
static const $core.List<LabelDescriptor_ValueType> values =
<LabelDescriptor_ValueType>[
STRING,
BOOL,
INT64,
];
static final Map<int, dynamic> _byValue = ProtobufEnum.initByValue(values);
static LabelDescriptor_ValueType valueOf(int value) =>
_byValue[value] as LabelDescriptor_ValueType;
static void $checkItem(LabelDescriptor_ValueType v) {
if (v is! LabelDescriptor_ValueType)
checkItemFailed(v, 'LabelDescriptor_ValueType');
}
static final $core.Map<$core.int, LabelDescriptor_ValueType> _byValue =
$pb.ProtobufEnum.initByValue(values);
static LabelDescriptor_ValueType? valueOf($core.int value) => _byValue[value];
const LabelDescriptor_ValueType._(int v, String n) : super(v, n);
const LabelDescriptor_ValueType._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,14 +1,24 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_label_pbjson;
// source: google/api/label.proto
//
// @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,
@ -16,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

@ -0,0 +1,14 @@
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @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;
export 'launch_stage.pbenum.dart';

View File

@ -0,0 +1,53 @@
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @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 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, _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,
UNIMPLEMENTED,
PRELAUNCH,
EARLY_ACCESS,
ALPHA,
BETA,
GA,
DEPRECATED,
];
static final $core.Map<$core.int, LaunchStage> _byValue =
$pb.ProtobufEnum.initByValue(values);
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

@ -0,0 +1,35 @@
//
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
//
// @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: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': [
{'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,186 +1,395 @@
///
//
// Generated code. Do not modify.
// source: google/api/monitored_resource.proto
//
// @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 '../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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_monitored_resource;
/// 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 {
factory MonitoredResourceDescriptor({
$core.String? type,
$core.String? displayName,
$core.String? description,
$core.Iterable<$0.LabelDescriptor>? labels,
$core.String? name,
$2.LaunchStage? launchStage,
}) {
final result = create();
if (type != null) {
result.type = type;
}
if (displayName != null) {
result.displayName = displayName;
}
if (description != null) {
result.description = description;
}
if (labels != null) {
result.labels.addAll(labels);
}
if (name != null) {
result.name = name;
}
if (launchStage != null) {
result.launchStage = launchStage;
}
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:protobuf/protobuf.dart';
import 'label.pb.dart';
class MonitoredResourceDescriptor extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('MonitoredResourceDescriptor')
..aOS(1, 'type')
..aOS(2, 'displayName')
..aOS(3, 'description')
..pp<LabelDescriptor>(4, 'labels', PbFieldType.PM,
LabelDescriptor.$checkItem, LabelDescriptor.create)
..aOS(5, 'name')
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;
MonitoredResourceDescriptor() : super();
MonitoredResourceDescriptor.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
MonitoredResourceDescriptor.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
MonitoredResourceDescriptor clone() =>
new MonitoredResourceDescriptor()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
MonitoredResourceDescriptor()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MonitoredResourceDescriptor copyWith(
void Function(MonitoredResourceDescriptor) updates) =>
super.copyWith(
(message) => updates(message as MonitoredResourceDescriptor))
as MonitoredResourceDescriptor;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MonitoredResourceDescriptor create() =>
new MonitoredResourceDescriptor();
static PbList<MonitoredResourceDescriptor> createRepeated() =>
new PbList<MonitoredResourceDescriptor>();
static MonitoredResourceDescriptor getDefault() {
if (_defaultInstance == null)
_defaultInstance = new _ReadonlyMonitoredResourceDescriptor();
return _defaultInstance;
}
MonitoredResourceDescriptor._();
MonitoredResourceDescriptor createEmptyInstance() => create();
static $pb.PbList<MonitoredResourceDescriptor> createRepeated() =>
$pb.PbList<MonitoredResourceDescriptor>();
@$core.pragma('dart2js:noInline')
static MonitoredResourceDescriptor getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceDescriptor>(create);
static MonitoredResourceDescriptor? _defaultInstance;
static MonitoredResourceDescriptor _defaultInstance;
static void $checkItem(MonitoredResourceDescriptor v) {
if (v is! MonitoredResourceDescriptor)
checkItemFailed(v, 'MonitoredResourceDescriptor');
}
String get type => $_getS(0, '');
set type(String v) {
/// 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)
set type($core.String v) {
$_setString(0, v);
}
bool hasType() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasType() => $_has(0);
@$pb.TagNumber(1)
void clearType() => clearField(1);
String get displayName => $_getS(1, '');
set displayName(String v) {
/// 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)
set displayName($core.String v) {
$_setString(1, v);
}
bool hasDisplayName() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasDisplayName() => $_has(1);
@$pb.TagNumber(2)
void clearDisplayName() => clearField(2);
String get description => $_getS(2, '');
set description(String v) {
/// 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)
set description($core.String v) {
$_setString(2, v);
}
bool hasDescription() => $_has(2);
@$pb.TagNumber(3)
$core.bool hasDescription() => $_has(2);
@$pb.TagNumber(3)
void clearDescription() => clearField(3);
List<LabelDescriptor> get labels => $_getN(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);
String get name => $_getS(4, '');
set name(String v) {
/// 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)
set name($core.String v) {
$_setString(4, v);
}
bool hasName() => $_has(4);
@$pb.TagNumber(5)
$core.bool hasName() => $_has(4);
@$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)
set launchStage($2.LaunchStage v) {
setField(7, v);
}
@$pb.TagNumber(7)
$core.bool hasLaunchStage() => $_has(5);
@$pb.TagNumber(7)
void clearLaunchStage() => clearField(7);
}
class _ReadonlyMonitoredResourceDescriptor extends MonitoredResourceDescriptor
with ReadonlyMessageMixin {}
/// 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 {
factory MonitoredResource({
$core.String? type,
$core.Map<$core.String, $core.String>? labels,
}) {
final result = create();
if (type != null) {
result.type = type;
}
if (labels != null) {
result.labels.addAll(labels);
}
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);
class MonitoredResource_LabelsEntry extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('MonitoredResource_LabelsEntry')
..aOS(1, 'key')
..aOS(2, 'value')
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;
MonitoredResource_LabelsEntry() : super();
MonitoredResource_LabelsEntry.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
MonitoredResource_LabelsEntry.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
MonitoredResource_LabelsEntry clone() =>
new MonitoredResource_LabelsEntry()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static MonitoredResource_LabelsEntry create() =>
new MonitoredResource_LabelsEntry();
static PbList<MonitoredResource_LabelsEntry> createRepeated() =>
new PbList<MonitoredResource_LabelsEntry>();
static MonitoredResource_LabelsEntry getDefault() {
if (_defaultInstance == null)
_defaultInstance = new _ReadonlyMonitoredResource_LabelsEntry();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
MonitoredResource clone() => MonitoredResource()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MonitoredResource copyWith(void Function(MonitoredResource) updates) =>
super.copyWith((message) => updates(message as MonitoredResource))
as MonitoredResource;
static MonitoredResource_LabelsEntry _defaultInstance;
static void $checkItem(MonitoredResource_LabelsEntry v) {
if (v is! MonitoredResource_LabelsEntry)
checkItemFailed(v, 'MonitoredResource_LabelsEntry');
}
$pb.BuilderInfo get info_ => _i;
String get key => $_getS(0, '');
set key(String v) {
@$core.pragma('dart2js:noInline')
static MonitoredResource create() => MonitoredResource._();
MonitoredResource createEmptyInstance() => create();
static $pb.PbList<MonitoredResource> createRepeated() =>
$pb.PbList<MonitoredResource>();
@$core.pragma('dart2js:noInline')
static MonitoredResource getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResource>(create);
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)
set type($core.String v) {
$_setString(0, v);
}
bool hasKey() => $_has(0);
void clearKey() => clearField(1);
String get value => $_getS(1, '');
set value(String v) {
$_setString(1, v);
}
bool hasValue() => $_has(1);
void clearValue() => clearField(2);
}
class _ReadonlyMonitoredResource_LabelsEntry
extends MonitoredResource_LabelsEntry with ReadonlyMessageMixin {}
class MonitoredResource extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('MonitoredResource')
..aOS(1, 'type')
..pp<MonitoredResource_LabelsEntry>(
2,
'labels',
PbFieldType.PM,
MonitoredResource_LabelsEntry.$checkItem,
MonitoredResource_LabelsEntry.create)
..hasRequiredFields = false;
MonitoredResource() : super();
MonitoredResource.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
MonitoredResource.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
MonitoredResource clone() => new MonitoredResource()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static MonitoredResource create() => new MonitoredResource();
static PbList<MonitoredResource> createRepeated() =>
new PbList<MonitoredResource>();
static MonitoredResource getDefault() {
if (_defaultInstance == null)
_defaultInstance = new _ReadonlyMonitoredResource();
return _defaultInstance;
}
static MonitoredResource _defaultInstance;
static void $checkItem(MonitoredResource v) {
if (v is! MonitoredResource) checkItemFailed(v, 'MonitoredResource');
}
String get type => $_getS(0, '');
set type(String v) {
$_setString(0, v);
}
bool hasType() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasType() => $_has(0);
@$pb.TagNumber(1)
void clearType() => clearField(1);
List<MonitoredResource_LabelsEntry> get labels => $_getN(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);
}
class _ReadonlyMonitoredResource extends MonitoredResource
with ReadonlyMessageMixin {}
/// 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 {
factory MonitoredResourceMetadata({
$1.Struct? systemLabels,
$core.Map<$core.String, $core.String>? userLabels,
}) {
final result = create();
if (systemLabels != null) {
result.systemLabels = systemLabels;
}
if (userLabels != null) {
result.userLabels.addAll(userLabels);
}
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')
MonitoredResourceMetadata clone() =>
MonitoredResourceMetadata()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MonitoredResourceMetadata copyWith(
void Function(MonitoredResourceMetadata) updates) =>
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();
static $pb.PbList<MonitoredResourceMetadata> createRepeated() =>
$pb.PbList<MonitoredResourceMetadata>();
@$core.pragma('dart2js:noInline')
static MonitoredResourceMetadata getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<MonitoredResourceMetadata>(create);
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)
set systemLabels($1.Struct v) {
setField(1, v);
}
@$pb.TagNumber(1)
$core.bool hasSystemLabels() => $_has(0);
@$pb.TagNumber(1)
void clearSystemLabels() => clearField(1);
@$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,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_monitored_resource_pbenum;
// source: google/api/monitored_resource.proto
//
// @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,17 +1,27 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.api_monitored_resource_pbjson;
// source: google/api/monitored_resource.proto
//
// @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,
@ -19,14 +29,31 @@ const MonitoredResourceDescriptor$json = const {
'6': '.google.api.LabelDescriptor',
'10': 'labels'
},
{
'1': 'launch_stage',
'3': 7,
'4': 1,
'5': 14,
'6': '.google.api.LaunchStage',
'10': 'launchStage'
},
],
};
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,
@ -35,14 +62,63 @@ 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},
};
/// 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': [
{
'1': 'system_labels',
'3': 1,
'4': 1,
'5': 11,
'6': '.google.protobuf.Struct',
'10': 'systemLabels'
},
{
'1': 'user_labels',
'3': 2,
'4': 3,
'5': 11,
'6': '.google.api.MonitoredResourceMetadata.UserLabelsEntry',
'10': 'userLabels'
},
],
'3': [MonitoredResourceMetadata_UserLabelsEntry$json],
};
@$core.Deprecated('Use monitoredResourceMetadataDescriptor instead')
const MonitoredResourceMetadata_UserLabelsEntry$json = {
'1': 'UserLabelsEntry',
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
],
'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,177 +1,359 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_http_request;
// source: google/logging/type/http_request.proto
//
// @dart = 2.12
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
// 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 'package:fixnum/fixnum.dart';
import 'package:protobuf/protobuf.dart';
import 'dart:core' as $core;
import '../../protobuf/duration.pb.dart' as $google$protobuf;
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;
class HttpRequest extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('HttpRequest')
..aOS(1, 'requestMethod')
..aOS(2, 'requestUrl')
..aInt64(3, 'requestSize')
..a<int>(4, 'status', PbFieldType.O3)
..aInt64(5, 'responseSize')
..aOS(6, 'userAgent')
..aOS(7, 'remoteIp')
..aOS(8, 'referer')
..aOB(9, 'cacheHit')
..aOB(10, 'cacheValidatedWithOriginServer')
..aOB(11, 'cacheLookup')
..aInt64(12, 'cacheFillBytes')
..aOS(13, 'serverIp')
..a<$google$protobuf.Duration>(14, 'latency', PbFieldType.OM,
$google$protobuf.Duration.getDefault, $google$protobuf.Duration.create)
..aOS(15, 'protocol')
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 {
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,
}) {
final result = create();
if (requestMethod != null) {
result.requestMethod = requestMethod;
}
if (requestUrl != null) {
result.requestUrl = requestUrl;
}
if (requestSize != null) {
result.requestSize = requestSize;
}
if (status != null) {
result.status = status;
}
if (responseSize != null) {
result.responseSize = responseSize;
}
if (userAgent != null) {
result.userAgent = userAgent;
}
if (remoteIp != null) {
result.remoteIp = remoteIp;
}
if (referer != null) {
result.referer = referer;
}
if (cacheHit != null) {
result.cacheHit = cacheHit;
}
if (cacheValidatedWithOriginServer != null) {
result.cacheValidatedWithOriginServer = cacheValidatedWithOriginServer;
}
if (cacheLookup != null) {
result.cacheLookup = cacheLookup;
}
if (cacheFillBytes != null) {
result.cacheFillBytes = cacheFillBytes;
}
if (serverIp != null) {
result.serverIp = serverIp;
}
if (latency != null) {
result.latency = latency;
}
if (protocol != null) {
result.protocol = protocol;
}
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;
HttpRequest() : super();
HttpRequest.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
HttpRequest.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
HttpRequest clone() => new HttpRequest()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static HttpRequest create() => new HttpRequest();
static PbList<HttpRequest> createRepeated() => new PbList<HttpRequest>();
static HttpRequest getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyHttpRequest();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
HttpRequest clone() => HttpRequest()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HttpRequest copyWith(void Function(HttpRequest) updates) =>
super.copyWith((message) => updates(message as HttpRequest))
as HttpRequest;
static HttpRequest _defaultInstance;
static void $checkItem(HttpRequest v) {
if (v is! HttpRequest) checkItemFailed(v, 'HttpRequest');
}
$pb.BuilderInfo get info_ => _i;
String get requestMethod => $_getS(0, '');
set requestMethod(String v) {
@$core.pragma('dart2js:noInline')
static HttpRequest create() => HttpRequest._();
HttpRequest createEmptyInstance() => create();
static $pb.PbList<HttpRequest> createRepeated() => $pb.PbList<HttpRequest>();
@$core.pragma('dart2js:noInline')
static HttpRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HttpRequest>(create);
static HttpRequest? _defaultInstance;
/// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
@$pb.TagNumber(1)
$core.String get requestMethod => $_getSZ(0);
@$pb.TagNumber(1)
set requestMethod($core.String v) {
$_setString(0, v);
}
bool hasRequestMethod() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasRequestMethod() => $_has(0);
@$pb.TagNumber(1)
void clearRequestMethod() => clearField(1);
String get requestUrl => $_getS(1, '');
set requestUrl(String v) {
/// 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)
set requestUrl($core.String v) {
$_setString(1, v);
}
bool hasRequestUrl() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasRequestUrl() => $_has(1);
@$pb.TagNumber(2)
void clearRequestUrl() => clearField(2);
Int64 get requestSize => $_getI64(2);
set requestSize(Int64 v) {
/// 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)
set requestSize($fixnum.Int64 v) {
$_setInt64(2, v);
}
bool hasRequestSize() => $_has(2);
@$pb.TagNumber(3)
$core.bool hasRequestSize() => $_has(2);
@$pb.TagNumber(3)
void clearRequestSize() => clearField(3);
int get status => $_get(3, 0);
set status(int v) {
$_setUnsignedInt32(3, v);
/// The response code indicating the status of response.
/// Examples: 200, 404.
@$pb.TagNumber(4)
$core.int get status => $_getIZ(3);
@$pb.TagNumber(4)
set status($core.int v) {
$_setSignedInt32(3, v);
}
bool hasStatus() => $_has(3);
@$pb.TagNumber(4)
$core.bool hasStatus() => $_has(3);
@$pb.TagNumber(4)
void clearStatus() => clearField(4);
Int64 get responseSize => $_getI64(4);
set responseSize(Int64 v) {
/// 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)
set responseSize($fixnum.Int64 v) {
$_setInt64(4, v);
}
bool hasResponseSize() => $_has(4);
@$pb.TagNumber(5)
$core.bool hasResponseSize() => $_has(4);
@$pb.TagNumber(5)
void clearResponseSize() => clearField(5);
String get userAgent => $_getS(5, '');
set userAgent(String v) {
/// 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)
set userAgent($core.String v) {
$_setString(5, v);
}
bool hasUserAgent() => $_has(5);
@$pb.TagNumber(6)
$core.bool hasUserAgent() => $_has(5);
@$pb.TagNumber(6)
void clearUserAgent() => clearField(6);
String get remoteIp => $_getS(6, '');
set remoteIp(String v) {
/// 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)
set remoteIp($core.String v) {
$_setString(6, v);
}
bool hasRemoteIp() => $_has(6);
@$pb.TagNumber(7)
$core.bool hasRemoteIp() => $_has(6);
@$pb.TagNumber(7)
void clearRemoteIp() => clearField(7);
String get referer => $_getS(7, '');
set referer(String v) {
/// 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)
set referer($core.String v) {
$_setString(7, v);
}
bool hasReferer() => $_has(7);
@$pb.TagNumber(8)
$core.bool hasReferer() => $_has(7);
@$pb.TagNumber(8)
void clearReferer() => clearField(8);
bool get cacheHit => $_get(8, false);
set cacheHit(bool v) {
/// 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)
set cacheHit($core.bool v) {
$_setBool(8, v);
}
bool hasCacheHit() => $_has(8);
@$pb.TagNumber(9)
$core.bool hasCacheHit() => $_has(8);
@$pb.TagNumber(9)
void clearCacheHit() => clearField(9);
bool get cacheValidatedWithOriginServer => $_get(9, false);
set cacheValidatedWithOriginServer(bool v) {
/// 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)
set cacheValidatedWithOriginServer($core.bool v) {
$_setBool(9, v);
}
bool hasCacheValidatedWithOriginServer() => $_has(9);
@$pb.TagNumber(10)
$core.bool hasCacheValidatedWithOriginServer() => $_has(9);
@$pb.TagNumber(10)
void clearCacheValidatedWithOriginServer() => clearField(10);
bool get cacheLookup => $_get(10, false);
set cacheLookup(bool v) {
/// Whether or not a cache lookup was attempted.
@$pb.TagNumber(11)
$core.bool get cacheLookup => $_getBF(10);
@$pb.TagNumber(11)
set cacheLookup($core.bool v) {
$_setBool(10, v);
}
bool hasCacheLookup() => $_has(10);
@$pb.TagNumber(11)
$core.bool hasCacheLookup() => $_has(10);
@$pb.TagNumber(11)
void clearCacheLookup() => clearField(11);
Int64 get cacheFillBytes => $_getI64(11);
set cacheFillBytes(Int64 v) {
/// 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)
set cacheFillBytes($fixnum.Int64 v) {
$_setInt64(11, v);
}
bool hasCacheFillBytes() => $_has(11);
@$pb.TagNumber(12)
$core.bool hasCacheFillBytes() => $_has(11);
@$pb.TagNumber(12)
void clearCacheFillBytes() => clearField(12);
String get serverIp => $_getS(12, '');
set serverIp(String v) {
/// 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)
set serverIp($core.String v) {
$_setString(12, v);
}
bool hasServerIp() => $_has(12);
@$pb.TagNumber(13)
$core.bool hasServerIp() => $_has(12);
@$pb.TagNumber(13)
void clearServerIp() => clearField(13);
$google$protobuf.Duration get latency => $_getN(13);
set latency($google$protobuf.Duration v) {
/// 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)
set latency($0.Duration v) {
setField(14, v);
}
bool hasLatency() => $_has(13);
@$pb.TagNumber(14)
$core.bool hasLatency() => $_has(13);
@$pb.TagNumber(14)
void clearLatency() => clearField(14);
@$pb.TagNumber(14)
$0.Duration ensureLatency() => $_ensure(13);
String get protocol => $_getS(14, '');
set protocol(String v) {
/// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
@$pb.TagNumber(15)
$core.String get protocol => $_getSZ(14);
@$pb.TagNumber(15)
set protocol($core.String v) {
$_setString(14, v);
}
bool hasProtocol() => $_has(14);
@$pb.TagNumber(15)
$core.bool hasProtocol() => $_has(14);
@$pb.TagNumber(15)
void clearProtocol() => clearField(15);
}
class _ReadonlyHttpRequest extends HttpRequest with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_http_request_pbenum;
// source: google/logging/type/http_request.proto
//
// @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,28 +1,32 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_http_request_pbjson;
// source: google/logging/type/http_request.proto
//
// @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,
@ -30,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,10 +1,14 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_log_severity;
// source: google/logging/type/log_severity.proto
//
// @dart = 2.12
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
// 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;
export 'log_severity.pbenum.dart';

View File

@ -1,25 +1,54 @@
///
//
// Generated code. Do not modify.
// source: google/logging/type/log_severity.proto
//
// @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 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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_log_severity_pbenum;
/// 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, _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');
// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME
import 'dart:core' show int, dynamic, String, List, Map;
import 'package:protobuf/protobuf.dart';
class LogSeverity extends ProtobufEnum {
static const LogSeverity DEFAULT = const LogSeverity._(0, 'DEFAULT');
static const LogSeverity DEBUG = const LogSeverity._(100, 'DEBUG');
static const LogSeverity INFO = const LogSeverity._(200, 'INFO');
static const LogSeverity NOTICE = const LogSeverity._(300, 'NOTICE');
static const LogSeverity WARNING = const LogSeverity._(400, 'WARNING');
static const LogSeverity ERROR = const LogSeverity._(500, 'ERROR');
static const LogSeverity CRITICAL = const LogSeverity._(600, 'CRITICAL');
static const LogSeverity ALERT = const LogSeverity._(700, 'ALERT');
static const LogSeverity EMERGENCY = const LogSeverity._(800, 'EMERGENCY');
static const List<LogSeverity> values = const <LogSeverity>[
static const $core.List<LogSeverity> values = <LogSeverity>[
DEFAULT,
DEBUG,
INFO,
@ -31,11 +60,11 @@ class LogSeverity extends ProtobufEnum {
EMERGENCY,
];
static final Map<int, dynamic> _byValue = ProtobufEnum.initByValue(values);
static LogSeverity valueOf(int value) => _byValue[value] as LogSeverity;
static void $checkItem(LogSeverity v) {
if (v is! LogSeverity) checkItemFailed(v, 'LogSeverity');
}
static final $core.Map<$core.int, LogSeverity> _byValue =
$pb.ProtobufEnum.initByValue(values);
static LogSeverity? valueOf($core.int value) => _byValue[value];
const LogSeverity._(int v, String n) : super(v, n);
const LogSeverity._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,20 +1,36 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.type_log_severity_pbjson;
// source: google/logging/type/log_severity.proto
//
// @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,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.v2_log_entry_pbenum;
// source: google/logging/v2/log_entry.proto
//
// @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,22 +1,33 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.v2_log_entry_pbjson;
// source: google/logging/v2/log_entry.proto
//
// @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, '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': {},
'10': 'resource'
},
const {
{
'1': 'proto_payload',
'3': 2,
'4': 1,
@ -25,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,
@ -42,96 +46,176 @@ const LogEntry$json = const {
'9': 0,
'10': 'jsonPayload'
},
const {
{
'1': 'timestamp',
'3': 9,
'4': 1,
'5': 11,
'6': '.google.protobuf.Timestamp',
'8': {},
'10': 'timestamp'
},
const {
{
'1': 'receive_timestamp',
'3': 24,
'4': 1,
'5': 11,
'6': '.google.protobuf.Timestamp',
'8': {},
'10': 'receiveTimestamp'
},
const {
{
'1': 'severity',
'3': 10,
'4': 1,
'5': 14,
'6': '.google.logging.type.LogSeverity',
'8': {},
'10': 'severity'
},
const {'1': 'insert_id', '3': 4, '4': 1, '5': 9, '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': {},
'10': 'httpRequest'
},
const {
{
'1': 'labels',
'3': 11,
'4': 3,
'5': 11,
'6': '.google.logging.v2.LogEntry.LabelsEntry',
'8': {},
'10': 'labels'
},
const {
{
'1': 'operation',
'3': 15,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogEntryOperation',
'8': {},
'10': 'operation'
},
const {'1': 'trace', '3': 22, '4': 1, '5': 9, '10': 'trace'},
const {'1': 'span_id', '3': 27, '4': 1, '5': 9, '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': {},
'10': 'traceSampled'
},
{
'1': 'source_location',
'3': 23,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogEntrySourceLocation',
'8': {},
'10': 'sourceLocation'
},
{
'1': 'split',
'3': 35,
'4': 1,
'5': 11,
'6': '.google.logging.v2.LogSplit',
'8': {},
'10': 'split'
},
],
'3': const [LogEntry_LabelsEntry$json],
'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, '10': 'id'},
const {'1': 'producer', '3': 2, '4': 1, '5': 9, '10': 'producer'},
const {'1': 'first', '3': 3, '4': 1, '5': 8, '10': 'first'},
const {'1': 'last', '3': 4, '4': 1, '5': 8, '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, '10': 'file'},
const {'1': 'line', '3': 2, '4': 1, '5': 3, '10': 'line'},
const {'1': 'function', '3': 3, '4': 1, '5': 9, '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,5 +1,47 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.v2_logging_pbenum;
// source: google/logging/v2/logging.proto
//
// @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;
/// 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, _omitEnumNames ? '' : 'REASON_UNSPECIFIED');
static const TailLogEntriesResponse_SuppressionInfo_Reason RATE_LIMIT =
TailLogEntriesResponse_SuppressionInfo_Reason._(
1, _omitEnumNames ? '' : 'RATE_LIMIT');
static const TailLogEntriesResponse_SuppressionInfo_Reason NOT_CONSUMED =
TailLogEntriesResponse_SuppressionInfo_Reason._(
2, _omitEnumNames ? '' : 'NOT_CONSUMED');
static const $core.List<TailLogEntriesResponse_SuppressionInfo_Reason>
values = <TailLogEntriesResponse_SuppressionInfo_Reason>[
REASON_UNSPECIFIED,
RATE_LIMIT,
NOT_CONSUMED,
];
static final $core
.Map<$core.int, TailLogEntriesResponse_SuppressionInfo_Reason> _byValue =
$pb.ProtobufEnum.initByValue(values);
static TailLogEntriesResponse_SuppressionInfo_Reason? valueOf(
$core.int value) =>
_byValue[value];
const TailLogEntriesResponse_SuppressionInfo_Reason._(
$core.int v, $core.String n)
: super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@ -1,170 +1,205 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.v2_logging_pbgrpc;
// source: google/logging/v2/logging.proto
//
// @dart = 2.12
import 'dart:async';
// 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 'package:grpc/grpc.dart';
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 '../../protobuf/empty.pb.dart' as $1;
import 'logging.pb.dart' as $0;
import '../../protobuf/empty.pb.dart' as $google$protobuf;
import 'logging.pb.dart';
export 'logging.pb.dart';
class LoggingServiceV2Client extends Client {
static final _$deleteLog =
new ClientMethod<DeleteLogRequest, $google$protobuf.Empty>(
@$pb.GrpcServiceName('google.logging.v2.LoggingServiceV2')
class LoggingServiceV2Client extends $grpc.Client {
static final _$deleteLog = $grpc.ClientMethod<$0.DeleteLogRequest, $1.Empty>(
'/google.logging.v2.LoggingServiceV2/DeleteLog',
(DeleteLogRequest value) => value.writeToBuffer(),
(List<int> value) => new $google$protobuf.Empty.fromBuffer(value));
($0.DeleteLogRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $1.Empty.fromBuffer(value));
static final _$writeLogEntries =
new ClientMethod<WriteLogEntriesRequest, WriteLogEntriesResponse>(
$grpc.ClientMethod<$0.WriteLogEntriesRequest, $0.WriteLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/WriteLogEntries',
(WriteLogEntriesRequest value) => value.writeToBuffer(),
(List<int> value) => new WriteLogEntriesResponse.fromBuffer(value));
($0.WriteLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.WriteLogEntriesResponse.fromBuffer(value));
static final _$listLogEntries =
new ClientMethod<ListLogEntriesRequest, ListLogEntriesResponse>(
$grpc.ClientMethod<$0.ListLogEntriesRequest, $0.ListLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/ListLogEntries',
(ListLogEntriesRequest value) => value.writeToBuffer(),
(List<int> value) => new ListLogEntriesResponse.fromBuffer(value));
static final _$listMonitoredResourceDescriptors = new ClientMethod<
ListMonitoredResourceDescriptorsRequest,
ListMonitoredResourceDescriptorsResponse>(
($0.ListLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ListLogEntriesResponse.fromBuffer(value));
static final _$listMonitoredResourceDescriptors = $grpc.ClientMethod<
$0.ListMonitoredResourceDescriptorsRequest,
$0.ListMonitoredResourceDescriptorsResponse>(
'/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors',
(ListMonitoredResourceDescriptorsRequest value) => value.writeToBuffer(),
(List<int> value) =>
new ListMonitoredResourceDescriptorsResponse.fromBuffer(value));
static final _$listLogs = new ClientMethod<ListLogsRequest, ListLogsResponse>(
($0.ListMonitoredResourceDescriptorsRequest value) =>
value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ListMonitoredResourceDescriptorsResponse.fromBuffer(value));
static final _$listLogs =
$grpc.ClientMethod<$0.ListLogsRequest, $0.ListLogsResponse>(
'/google.logging.v2.LoggingServiceV2/ListLogs',
(ListLogsRequest value) => value.writeToBuffer(),
(List<int> value) => new ListLogsResponse.fromBuffer(value));
($0.ListLogsRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ListLogsResponse.fromBuffer(value));
static final _$tailLogEntries =
$grpc.ClientMethod<$0.TailLogEntriesRequest, $0.TailLogEntriesResponse>(
'/google.logging.v2.LoggingServiceV2/TailLogEntries',
($0.TailLogEntriesRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.TailLogEntriesResponse.fromBuffer(value));
LoggingServiceV2Client(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
LoggingServiceV2Client($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
ResponseFuture<$google$protobuf.Empty> deleteLog(DeleteLogRequest request,
{CallOptions options}) {
final call = $createCall(_$deleteLog, new Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
$grpc.ResponseFuture<$1.Empty> deleteLog($0.DeleteLogRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$deleteLog, request, options: options);
}
ResponseFuture<WriteLogEntriesResponse> writeLogEntries(
WriteLogEntriesRequest request,
{CallOptions options}) {
final call = $createCall(
_$writeLogEntries, new Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
$grpc.ResponseFuture<$0.WriteLogEntriesResponse> writeLogEntries(
$0.WriteLogEntriesRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$writeLogEntries, request, options: options);
}
ResponseFuture<ListLogEntriesResponse> listLogEntries(
ListLogEntriesRequest request,
{CallOptions options}) {
final call = $createCall(
_$listLogEntries, new Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
$grpc.ResponseFuture<$0.ListLogEntriesResponse> listLogEntries(
$0.ListLogEntriesRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listLogEntries, request, options: options);
}
ResponseFuture<ListMonitoredResourceDescriptorsResponse>
$grpc.ResponseFuture<$0.ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors(
ListMonitoredResourceDescriptorsRequest request,
{CallOptions options}) {
final call = $createCall(
_$listMonitoredResourceDescriptors, new Stream.fromIterable([request]),
$0.ListMonitoredResourceDescriptorsRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listMonitoredResourceDescriptors, request,
options: options);
return new ResponseFuture(call);
}
ResponseFuture<ListLogsResponse> listLogs(ListLogsRequest request,
{CallOptions options}) {
final call = $createCall(_$listLogs, new Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
$grpc.ResponseFuture<$0.ListLogsResponse> listLogs($0.ListLogsRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$listLogs, request, options: options);
}
$grpc.ResponseStream<$0.TailLogEntriesResponse> tailLogEntries(
$async.Stream<$0.TailLogEntriesRequest> request,
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$tailLogEntries, request, options: options);
}
}
abstract class LoggingServiceV2ServiceBase extends Service {
String get $name => 'google.logging.v2.LoggingServiceV2';
@$pb.GrpcServiceName('google.logging.v2.LoggingServiceV2')
abstract class LoggingServiceV2ServiceBase extends $grpc.Service {
$core.String get $name => 'google.logging.v2.LoggingServiceV2';
LoggingServiceV2ServiceBase() {
$addMethod(new ServiceMethod<DeleteLogRequest, $google$protobuf.Empty>(
$addMethod($grpc.ServiceMethod<$0.DeleteLogRequest, $1.Empty>(
'DeleteLog',
deleteLog_Pre,
false,
false,
(List<int> value) => new DeleteLogRequest.fromBuffer(value),
($google$protobuf.Empty value) => value.writeToBuffer()));
$addMethod(
new ServiceMethod<WriteLogEntriesRequest, WriteLogEntriesResponse>(
($core.List<$core.int> value) => $0.DeleteLogRequest.fromBuffer(value),
($1.Empty value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.WriteLogEntriesRequest,
$0.WriteLogEntriesResponse>(
'WriteLogEntries',
writeLogEntries_Pre,
false,
false,
(List<int> value) => new WriteLogEntriesRequest.fromBuffer(value),
(WriteLogEntriesResponse value) => value.writeToBuffer()));
$addMethod(new ServiceMethod<ListLogEntriesRequest, ListLogEntriesResponse>(
($core.List<$core.int> value) =>
$0.WriteLogEntriesRequest.fromBuffer(value),
($0.WriteLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ListLogEntriesRequest,
$0.ListLogEntriesResponse>(
'ListLogEntries',
listLogEntries_Pre,
false,
false,
(List<int> value) => new ListLogEntriesRequest.fromBuffer(value),
(ListLogEntriesResponse value) => value.writeToBuffer()));
$addMethod(new ServiceMethod<ListMonitoredResourceDescriptorsRequest,
ListMonitoredResourceDescriptorsResponse>(
($core.List<$core.int> value) =>
$0.ListLogEntriesRequest.fromBuffer(value),
($0.ListLogEntriesResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ListMonitoredResourceDescriptorsRequest,
$0.ListMonitoredResourceDescriptorsResponse>(
'ListMonitoredResourceDescriptors',
listMonitoredResourceDescriptors_Pre,
false,
false,
(List<int> value) =>
new ListMonitoredResourceDescriptorsRequest.fromBuffer(value),
(ListMonitoredResourceDescriptorsResponse value) =>
($core.List<$core.int> value) =>
$0.ListMonitoredResourceDescriptorsRequest.fromBuffer(value),
($0.ListMonitoredResourceDescriptorsResponse value) =>
value.writeToBuffer()));
$addMethod(new ServiceMethod<ListLogsRequest, ListLogsResponse>(
$addMethod($grpc.ServiceMethod<$0.ListLogsRequest, $0.ListLogsResponse>(
'ListLogs',
listLogs_Pre,
false,
false,
(List<int> value) => new ListLogsRequest.fromBuffer(value),
(ListLogsResponse value) => value.writeToBuffer()));
($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) =>
$0.TailLogEntriesRequest.fromBuffer(value),
($0.TailLogEntriesResponse value) => value.writeToBuffer()));
}
Future<$google$protobuf.Empty> deleteLog_Pre(
ServiceCall call, Future<DeleteLogRequest> request) async {
$async.Future<$1.Empty> deleteLog_Pre($grpc.ServiceCall call,
$async.Future<$0.DeleteLogRequest> request) async {
return deleteLog(call, await request);
}
Future<WriteLogEntriesResponse> writeLogEntries_Pre(
ServiceCall call, Future<WriteLogEntriesRequest> request) async {
$async.Future<$0.WriteLogEntriesResponse> writeLogEntries_Pre(
$grpc.ServiceCall call,
$async.Future<$0.WriteLogEntriesRequest> request) async {
return writeLogEntries(call, await request);
}
Future<ListLogEntriesResponse> listLogEntries_Pre(
ServiceCall call, Future<ListLogEntriesRequest> request) async {
$async.Future<$0.ListLogEntriesResponse> listLogEntries_Pre(
$grpc.ServiceCall call,
$async.Future<$0.ListLogEntriesRequest> request) async {
return listLogEntries(call, await request);
}
Future<ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors_Pre(ServiceCall call,
Future<ListMonitoredResourceDescriptorsRequest> request) async {
$async.Future<$0.ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors_Pre(
$grpc.ServiceCall call,
$async.Future<$0.ListMonitoredResourceDescriptorsRequest>
request) async {
return listMonitoredResourceDescriptors(call, await request);
}
Future<ListLogsResponse> listLogs_Pre(
ServiceCall call, Future<ListLogsRequest> request) async {
$async.Future<$0.ListLogsResponse> listLogs_Pre(
$grpc.ServiceCall call, $async.Future<$0.ListLogsRequest> request) async {
return listLogs(call, await request);
}
Future<$google$protobuf.Empty> deleteLog(
ServiceCall call, DeleteLogRequest request);
Future<WriteLogEntriesResponse> writeLogEntries(
ServiceCall call, WriteLogEntriesRequest request);
Future<ListLogEntriesResponse> listLogEntries(
ServiceCall call, ListLogEntriesRequest request);
Future<ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptors(
ServiceCall call, ListMonitoredResourceDescriptorsRequest request);
Future<ListLogsResponse> listLogs(ServiceCall call, ListLogsRequest request);
$async.Future<$1.Empty> deleteLog(
$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,
$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,72 +1,111 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.logging.v2_logging_pbjson;
// source: google/logging/v2/logging.proto
//
// @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, '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, '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': {},
'10': 'resource'
},
const {
{
'1': 'labels',
'3': 3,
'4': 3,
'5': 11,
'6': '.google.logging.v2.WriteLogEntriesRequest.LabelsEntry',
'8': {},
'10': 'labels'
},
const {
{
'1': 'entries',
'3': 4,
'4': 3,
'5': 11,
'6': '.google.logging.v2.LogEntry',
'8': {},
'10': 'entries'
},
const {
{
'1': 'partial_success',
'3': 5,
'4': 1,
'5': 8,
'8': {},
'10': 'partialSuccess'
},
{'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,
@ -76,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,
@ -92,31 +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 {'1': 'project_ids', '3': 1, '4': 3, '5': 9, '10': 'projectIds'},
const {
'2': [
{
'1': 'resource_names',
'3': 8,
'4': 3,
'5': 9,
'8': {},
'10': 'resourceNames'
},
const {'1': 'filter', '3': 2, '4': 1, '5': 9, '10': 'filter'},
const {'1': 'order_by', '3': 3, '4': 1, '5': 9, '10': 'orderBy'},
const {'1': 'page_size', '3': 4, '4': 1, '5': 5, '10': 'pageSize'},
const {'1': 'page_token', '3': 5, '4': 1, '5': 9, '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,
@ -124,28 +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, '10': 'pageSize'},
const {'1': 'page_token', '3': 2, '4': 1, '5': 9, '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,
@ -153,35 +221,146 @@ 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, '10': 'parent'},
const {'1': 'page_size', '3': 2, '4': 1, '5': 5, '10': 'pageSize'},
const {'1': 'page_token', '3': 3, '4': 1, '5': 9, '10': 'pageToken'},
'2': [
{'1': 'parent', '3': 1, '4': 1, '5': 9, '8': {}, '10': 'parent'},
{
'1': 'resource_names',
'3': 8,
'4': 3,
'5': 9,
'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,
'2': [
{'1': 'log_names', '3': 3, '4': 3, '5': 9, '10': 'logNames'},
{'1': 'next_page_token', '3': 2, '4': 1, '5': 9, '10': 'nextPageToken'},
],
};
/// 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': [
{
'1': 'resource_names',
'3': 1,
'4': 3,
'5': 9,
'10': 'nextPageToken'
'8': {},
'10': 'resourceNames'
},
{'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': {},
'10': 'bufferWindow'
},
],
};
/// 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': [
{
'1': 'entries',
'3': 1,
'4': 3,
'5': 11,
'6': '.google.logging.v2.LogEntry',
'10': 'entries'
},
{
'1': 'suppression_info',
'3': 2,
'4': 3,
'5': 11,
'6': '.google.logging.v2.TailLogEntriesResponse.SuppressionInfo',
'10': 'suppressionInfo'
},
],
'3': [TailLogEntriesResponse_SuppressionInfo$json],
};
@$core.Deprecated('Use tailLogEntriesResponseDescriptor instead')
const TailLogEntriesResponse_SuppressionInfo$json = {
'1': 'SuppressionInfo',
'2': [
{
'1': 'reason',
'3': 1,
'4': 1,
'5': 14,
'6': '.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason',
'10': 'reason'
},
{'1': 'suppressed_count', '3': 2, '4': 1, '5': 5, '10': 'suppressedCount'},
],
'4': [TailLogEntriesResponse_SuppressionInfo_Reason$json],
};
@$core.Deprecated('Use tailLogEntriesResponseDescriptor instead')
const TailLogEntriesResponse_SuppressionInfo_Reason$json = {
'1': 'Reason',
'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,54 +1,224 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/any.proto
//
// @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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_any;
/// 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 {
factory Any({
$core.String? typeUrl,
$core.List<$core.int>? value,
}) {
final result = create();
if (typeUrl != null) {
result.typeUrl = typeUrl;
}
if (value != null) {
result.value = value;
}
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:protobuf/protobuf.dart';
class Any extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Any')
..aOS(1, 'typeUrl')
..a<List<int>>(2, 'value', PbFieldType.OY)
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;
Any() : super();
Any.fromBuffer(List<int> i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Any.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Any clone() => new Any()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Any create() => new Any();
static PbList<Any> createRepeated() => new PbList<Any>();
static Any getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyAny();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Any clone() => Any()..mergeFromMessage(this);
@$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)) as Any;
static Any _defaultInstance;
static void $checkItem(Any v) {
if (v is! Any) checkItemFailed(v, 'Any');
}
$pb.BuilderInfo get info_ => _i;
String get typeUrl => $_getS(0, '');
set typeUrl(String v) {
@$core.pragma('dart2js:noInline')
static Any create() => Any._();
Any createEmptyInstance() => create();
static $pb.PbList<Any> createRepeated() => $pb.PbList<Any>();
@$core.pragma('dart2js:noInline')
static Any getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Any>(create);
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)
set typeUrl($core.String v) {
$_setString(0, v);
}
bool hasTypeUrl() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasTypeUrl() => $_has(0);
@$pb.TagNumber(1)
void clearTypeUrl() => clearField(1);
List<int> get value => $_getN(1);
set value(List<int> v) {
/// 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)
set value($core.List<$core.int> v) {
$_setBytes(1, v);
}
bool hasValue() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasValue() => $_has(1);
@$pb.TagNumber(2)
void clearValue() => clearField(2);
/// Creates a new [Any] encoding [message].
///
/// The [typeUrl] will be [typeUrlPrefix]/`fullName` where `fullName` is
/// the fully qualified name of the type of [message].
static Any pack($pb.GeneratedMessage message,
{$core.String typeUrlPrefix = 'type.googleapis.com'}) {
final result = create();
$mixin.AnyMixin.packIntoAny(result, message, typeUrlPrefix: typeUrlPrefix);
return result;
}
}
class _ReadonlyAny extends Any with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_any_pbenum;
// source: google/protobuf/any.proto
//
// @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,13 +1,27 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_any_pbjson;
// source: google/protobuf/any.proto
//
// @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,56 +1,166 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/duration.proto
//
// @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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_duration;
/// # 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 {
factory Duration({
$fixnum.Int64? seconds,
$core.int? nanos,
}) {
final result = create();
if (seconds != null) {
result.seconds = seconds;
}
if (nanos != null) {
result.nanos = nanos;
}
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:fixnum/fixnum.dart';
import 'package:protobuf/protobuf.dart';
class Duration extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Duration')
..aInt64(1, 'seconds')
..a<int>(2, 'nanos', PbFieldType.O3)
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;
Duration() : super();
Duration.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Duration.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Duration clone() => new Duration()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Duration create() => new Duration();
static PbList<Duration> createRepeated() => new PbList<Duration>();
static Duration getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyDuration();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Duration clone() => Duration()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Duration copyWith(void Function(Duration) updates) =>
super.copyWith((message) => updates(message as Duration)) as Duration;
static Duration _defaultInstance;
static void $checkItem(Duration v) {
if (v is! Duration) checkItemFailed(v, 'Duration');
}
$pb.BuilderInfo get info_ => _i;
Int64 get seconds => $_getI64(0);
set seconds(Int64 v) {
@$core.pragma('dart2js:noInline')
static Duration create() => Duration._();
Duration createEmptyInstance() => create();
static $pb.PbList<Duration> createRepeated() => $pb.PbList<Duration>();
@$core.pragma('dart2js:noInline')
static Duration getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Duration>(create);
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)
set seconds($fixnum.Int64 v) {
$_setInt64(0, v);
}
bool hasSeconds() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasSeconds() => $_has(0);
@$pb.TagNumber(1)
void clearSeconds() => clearField(1);
int get nanos => $_get(1, 0);
set nanos(int v) {
$_setUnsignedInt32(1, v);
/// 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)
set nanos($core.int v) {
$_setSignedInt32(1, v);
}
bool hasNanos() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasNanos() => $_has(1);
@$pb.TagNumber(2)
void clearNanos() => clearField(2);
}
class _ReadonlyDuration extends Duration with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_duration_pbenum;
// source: google/protobuf/duration.proto
//
// @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,13 +1,28 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_duration_pbjson;
// source: google/protobuf/duration.proto
//
// @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,36 +1,63 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/empty.proto
//
// @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:
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_empty;
/// service Foo {
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
/// }
class Empty extends $pb.GeneratedMessage {
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:protobuf/protobuf.dart';
class Empty extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Empty')
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Empty',
package:
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
createEmptyInstance: create)
..hasRequiredFields = false;
Empty() : super();
Empty.fromBuffer(List<int> i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Empty.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Empty clone() => new Empty()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Empty create() => new Empty();
static PbList<Empty> createRepeated() => new PbList<Empty>();
static Empty getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyEmpty();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Empty clone() => Empty()..mergeFromMessage(this);
@$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)) as Empty;
static Empty _defaultInstance;
static void $checkItem(Empty v) {
if (v is! Empty) checkItemFailed(v, 'Empty');
}
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Empty create() => Empty._();
Empty createEmptyInstance() => create();
static $pb.PbList<Empty> createRepeated() => $pb.PbList<Empty>();
@$core.pragma('dart2js:noInline')
static Empty getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Empty>(create);
static Empty? _defaultInstance;
}
class _ReadonlyEmpty extends Empty with ReadonlyMessageMixin {}
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_empty_pbenum;
// source: google/protobuf/empty.proto
//
// @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,9 +1,23 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_empty_pbjson;
// source: google/protobuf/empty.proto
//
// @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,208 +1,341 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_struct;
// source: google/protobuf/struct.proto
//
// @dart = 2.12
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
// 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 'package:protobuf/protobuf.dart';
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';
class Struct_FieldsEntry extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Struct_FieldsEntry')
..aOS(1, 'key')
..a<Value>(2, 'value', PbFieldType.OM, Value.getDefault, Value.create)
/// `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 {
factory Struct({
$core.Map<$core.String, Value>? fields,
}) {
final result = create();
if (fields != null) {
result.fields.addAll(fields);
}
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;
Struct_FieldsEntry() : super();
Struct_FieldsEntry.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Struct_FieldsEntry.fromJson(String i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Struct_FieldsEntry clone() =>
new Struct_FieldsEntry()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Struct_FieldsEntry create() => new Struct_FieldsEntry();
static PbList<Struct_FieldsEntry> createRepeated() =>
new PbList<Struct_FieldsEntry>();
static Struct_FieldsEntry getDefault() {
if (_defaultInstance == null)
_defaultInstance = new _ReadonlyStruct_FieldsEntry();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Struct clone() => Struct()..mergeFromMessage(this);
@$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)) as Struct;
static Struct_FieldsEntry _defaultInstance;
static void $checkItem(Struct_FieldsEntry v) {
if (v is! Struct_FieldsEntry) checkItemFailed(v, 'Struct_FieldsEntry');
}
$pb.BuilderInfo get info_ => _i;
String get key => $_getS(0, '');
set key(String v) {
$_setString(0, v);
}
@$core.pragma('dart2js:noInline')
static Struct create() => Struct._();
Struct createEmptyInstance() => create();
static $pb.PbList<Struct> createRepeated() => $pb.PbList<Struct>();
@$core.pragma('dart2js:noInline')
static Struct getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Struct>(create);
static Struct? _defaultInstance;
bool hasKey() => $_has(0);
void clearKey() => clearField(1);
Value get value => $_getN(1);
set value(Value v) {
setField(2, v);
}
bool hasValue() => $_has(1);
void clearValue() => clearField(2);
/// Unordered map of dynamically typed values.
@$pb.TagNumber(1)
$core.Map<$core.String, Value> get fields => $_getMap(0);
}
class _ReadonlyStruct_FieldsEntry extends Struct_FieldsEntry
with ReadonlyMessageMixin {}
class Struct extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Struct')
..pp<Struct_FieldsEntry>(1, 'fields', PbFieldType.PM,
Struct_FieldsEntry.$checkItem, Struct_FieldsEntry.create)
..hasRequiredFields = false;
Struct() : super();
Struct.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Struct.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Struct clone() => new Struct()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Struct create() => new Struct();
static PbList<Struct> createRepeated() => new PbList<Struct>();
static Struct getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyStruct();
return _defaultInstance;
}
static Struct _defaultInstance;
static void $checkItem(Struct v) {
if (v is! Struct) checkItemFailed(v, 'Struct');
}
List<Struct_FieldsEntry> get fields => $_getN(0);
enum Value_Kind {
nullValue,
numberValue,
stringValue,
boolValue,
structValue,
listValue,
notSet
}
class _ReadonlyStruct extends Struct with ReadonlyMessageMixin {}
/// `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);
class Value extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Value')
..e<NullValue>(1, 'nullValue', PbFieldType.OE, NullValue.NULL_VALUE,
NullValue.valueOf, NullValue.values)
..a<double>(2, 'numberValue', PbFieldType.OD)
..aOS(3, 'stringValue')
..aOB(4, 'boolValue')
..a<Struct>(
5, 'structValue', PbFieldType.OM, Struct.getDefault, Struct.create)
..a<ListValue>(
6, 'listValue', PbFieldType.OM, ListValue.getDefault, ListValue.create)
static const $core.Map<$core.int, Value_Kind> _Value_KindByTag = {
1: Value_Kind.nullValue,
2: Value_Kind.numberValue,
3: Value_Kind.stringValue,
4: Value_Kind.boolValue,
5: Value_Kind.structValue,
6: Value_Kind.listValue,
0: Value_Kind.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_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, _omitFieldNames ? '' : 'nullValue', $pb.PbFieldType.OE,
defaultOrMaker: NullValue.NULL_VALUE,
valueOf: NullValue.valueOf,
enumValues: NullValue.values)
..a<$core.double>(
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();
Value.fromBuffer(List<int> i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Value.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Value clone() => new Value()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Value create() => new Value();
static PbList<Value> createRepeated() => new PbList<Value>();
static Value getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyValue();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Value clone() => Value()..mergeFromMessage(this);
@$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)) as Value;
static Value _defaultInstance;
static void $checkItem(Value v) {
if (v is! Value) checkItemFailed(v, 'Value');
}
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Value create() => Value._();
Value createEmptyInstance() => create();
static $pb.PbList<Value> createRepeated() => $pb.PbList<Value>();
@$core.pragma('dart2js:noInline')
static Value getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Value>(create);
static Value? _defaultInstance;
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)
set nullValue(NullValue v) {
setField(1, v);
}
bool hasNullValue() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasNullValue() => $_has(0);
@$pb.TagNumber(1)
void clearNullValue() => clearField(1);
double get numberValue => $_getN(1);
set numberValue(double v) {
/// Represents a double value.
@$pb.TagNumber(2)
$core.double get numberValue => $_getN(1);
@$pb.TagNumber(2)
set numberValue($core.double v) {
$_setDouble(1, v);
}
bool hasNumberValue() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasNumberValue() => $_has(1);
@$pb.TagNumber(2)
void clearNumberValue() => clearField(2);
String get stringValue => $_getS(2, '');
set stringValue(String v) {
/// Represents a string value.
@$pb.TagNumber(3)
$core.String get stringValue => $_getSZ(2);
@$pb.TagNumber(3)
set stringValue($core.String v) {
$_setString(2, v);
}
bool hasStringValue() => $_has(2);
@$pb.TagNumber(3)
$core.bool hasStringValue() => $_has(2);
@$pb.TagNumber(3)
void clearStringValue() => clearField(3);
bool get boolValue => $_get(3, false);
set boolValue(bool v) {
/// Represents a boolean value.
@$pb.TagNumber(4)
$core.bool get boolValue => $_getBF(3);
@$pb.TagNumber(4)
set boolValue($core.bool v) {
$_setBool(3, v);
}
bool hasBoolValue() => $_has(3);
@$pb.TagNumber(4)
$core.bool hasBoolValue() => $_has(3);
@$pb.TagNumber(4)
void clearBoolValue() => clearField(4);
/// Represents a structured value.
@$pb.TagNumber(5)
Struct get structValue => $_getN(4);
@$pb.TagNumber(5)
set structValue(Struct v) {
setField(5, v);
}
bool hasStructValue() => $_has(4);
@$pb.TagNumber(5)
$core.bool hasStructValue() => $_has(4);
@$pb.TagNumber(5)
void clearStructValue() => clearField(5);
@$pb.TagNumber(5)
Struct ensureStructValue() => $_ensure(4);
/// Represents a repeated `Value`.
@$pb.TagNumber(6)
ListValue get listValue => $_getN(5);
@$pb.TagNumber(6)
set listValue(ListValue v) {
setField(6, v);
}
bool hasListValue() => $_has(5);
@$pb.TagNumber(6)
$core.bool hasListValue() => $_has(5);
@$pb.TagNumber(6)
void clearListValue() => clearField(6);
@$pb.TagNumber(6)
ListValue ensureListValue() => $_ensure(5);
}
class _ReadonlyValue extends Value with ReadonlyMessageMixin {}
/// `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 {
factory ListValue({
$core.Iterable<Value>? values,
}) {
final result = create();
if (values != null) {
result.values.addAll(values);
}
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);
class ListValue extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('ListValue')
..pp<Value>(1, 'values', PbFieldType.PM, Value.$checkItem, Value.create)
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;
ListValue() : super();
ListValue.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
ListValue.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
ListValue clone() => new ListValue()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static ListValue create() => new ListValue();
static PbList<ListValue> createRepeated() => new PbList<ListValue>();
static ListValue getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyListValue();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ListValue clone() => ListValue()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ListValue copyWith(void Function(ListValue) updates) =>
super.copyWith((message) => updates(message as ListValue)) as ListValue;
static ListValue _defaultInstance;
static void $checkItem(ListValue v) {
if (v is! ListValue) checkItemFailed(v, 'ListValue');
}
$pb.BuilderInfo get info_ => _i;
List<Value> get values => $_getN(0);
@$core.pragma('dart2js:noInline')
static ListValue create() => ListValue._();
ListValue createEmptyInstance() => create();
static $pb.PbList<ListValue> createRepeated() => $pb.PbList<ListValue>();
@$core.pragma('dart2js:noInline')
static ListValue getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ListValue>(create);
static ListValue? _defaultInstance;
/// Repeated field of dynamically typed values.
@$pb.TagNumber(1)
$core.List<Value> get values => $_getList(0);
}
class _ReadonlyListValue extends ListValue with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,25 +1,35 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
//
// @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;
/// `NullValue` is a singleton enumeration to represent the null value for the
/// `Value` type union.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_struct_pbenum;
/// The JSON representation for `NullValue` is JSON `null`.
class NullValue extends $pb.ProtobufEnum {
static const NullValue NULL_VALUE =
NullValue._(0, _omitEnumNames ? '' : 'NULL_VALUE');
// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME
import 'dart:core' show int, dynamic, String, List, Map;
import 'package:protobuf/protobuf.dart';
class NullValue extends ProtobufEnum {
static const NullValue NULL_VALUE = const NullValue._(0, 'NULL_VALUE');
static const List<NullValue> values = const <NullValue>[
static const $core.List<NullValue> values = <NullValue>[
NULL_VALUE,
];
static final Map<int, dynamic> _byValue = ProtobufEnum.initByValue(values);
static NullValue valueOf(int value) => _byValue[value] as NullValue;
static void $checkItem(NullValue v) {
if (v is! NullValue) checkItemFailed(v, 'NullValue');
}
static final $core.Map<$core.int, NullValue> _byValue =
$pb.ProtobufEnum.initByValue(values);
static NullValue? valueOf($core.int value) => _byValue[value];
const NullValue._(int v, String n) : super(v, n);
const NullValue._($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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_struct_pbjson;
// source: google/protobuf/struct.proto
//
// @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,
@ -23,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,
@ -39,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,
@ -54,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,
@ -87,7 +89,7 @@ const Value$json = const {
'9': 0,
'10': 'structValue'
},
const {
{
'1': 'list_value',
'3': 6,
'4': 1,
@ -97,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,
@ -115,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,56 +1,204 @@
///
//
// Generated code. Do not modify.
// source: google/protobuf/timestamp.proto
//
// @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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_timestamp;
/// 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 {
factory Timestamp({
$fixnum.Int64? seconds,
$core.int? nanos,
}) {
final result = create();
if (seconds != null) {
result.seconds = seconds;
}
if (nanos != null) {
result.nanos = nanos;
}
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:fixnum/fixnum.dart';
import 'package:protobuf/protobuf.dart';
class Timestamp extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Timestamp')
..aInt64(1, 'seconds')
..a<int>(2, 'nanos', PbFieldType.O3)
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;
Timestamp() : super();
Timestamp.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Timestamp.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Timestamp clone() => new Timestamp()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Timestamp create() => new Timestamp();
static PbList<Timestamp> createRepeated() => new PbList<Timestamp>();
static Timestamp getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyTimestamp();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Timestamp clone() => Timestamp()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Timestamp copyWith(void Function(Timestamp) updates) =>
super.copyWith((message) => updates(message as Timestamp)) as Timestamp;
static Timestamp _defaultInstance;
static void $checkItem(Timestamp v) {
if (v is! Timestamp) checkItemFailed(v, 'Timestamp');
}
$pb.BuilderInfo get info_ => _i;
Int64 get seconds => $_getI64(0);
set seconds(Int64 v) {
@$core.pragma('dart2js:noInline')
static Timestamp create() => Timestamp._();
Timestamp createEmptyInstance() => create();
static $pb.PbList<Timestamp> createRepeated() => $pb.PbList<Timestamp>();
@$core.pragma('dart2js:noInline')
static Timestamp getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Timestamp>(create);
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)
set seconds($fixnum.Int64 v) {
$_setInt64(0, v);
}
bool hasSeconds() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasSeconds() => $_has(0);
@$pb.TagNumber(1)
void clearSeconds() => clearField(1);
int get nanos => $_get(1, 0);
set nanos(int v) {
$_setUnsignedInt32(1, v);
/// 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)
set nanos($core.int v) {
$_setSignedInt32(1, v);
}
bool hasNanos() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasNanos() => $_has(1);
@$pb.TagNumber(2)
void clearNanos() => clearField(2);
/// Creates a new instance from [dateTime].
///
/// Time zone information will not be preserved.
static Timestamp fromDateTime($core.DateTime dateTime) {
final result = create();
$mixin.TimestampMixin.setFromDateTime(result, dateTime);
return result;
}
}
class _ReadonlyTimestamp extends Timestamp with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_timestamp_pbenum;
// source: google/protobuf/timestamp.proto
//
// @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,13 +1,28 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.protobuf_timestamp_pbjson;
// source: google/protobuf/timestamp.proto
//
// @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,61 +1,120 @@
///
//
// Generated code. Do not modify.
// source: google/rpc/status.proto
//
// @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 '../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.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.rpc_status;
/// 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 {
factory Status({
$core.int? code,
$core.String? message,
$core.Iterable<$0.Any>? details,
}) {
final result = create();
if (code != null) {
result.code = code;
}
if (message != null) {
result.message = message;
}
if (details != null) {
result.details.addAll(details);
}
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);
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
import 'package:protobuf/protobuf.dart';
import '../protobuf/any.pb.dart' as $google$protobuf;
class Status extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Status')
..a<int>(1, 'code', PbFieldType.O3)
..aOS(2, 'message')
..pp<$google$protobuf.Any>(3, 'details', PbFieldType.PM,
$google$protobuf.Any.$checkItem, $google$protobuf.Any.create)
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;
Status() : super();
Status.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Status.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Status clone() => new Status()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Status create() => new Status();
static PbList<Status> createRepeated() => new PbList<Status>();
static Status getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyStatus();
return _defaultInstance;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Status clone() => Status()..mergeFromMessage(this);
@$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)) as Status;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Status create() => Status._();
Status createEmptyInstance() => create();
static $pb.PbList<Status> createRepeated() => $pb.PbList<Status>();
@$core.pragma('dart2js:noInline')
static Status getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Status>(create);
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)
set code($core.int v) {
$_setSignedInt32(0, v);
}
static Status _defaultInstance;
static void $checkItem(Status v) {
if (v is! Status) checkItemFailed(v, 'Status');
}
int get code => $_get(0, 0);
set code(int v) {
$_setUnsignedInt32(0, v);
}
bool hasCode() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasCode() => $_has(0);
@$pb.TagNumber(1)
void clearCode() => clearField(1);
String get message => $_getS(1, '');
set message(String v) {
/// 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)
set message($core.String v) {
$_setString(1, v);
}
bool hasMessage() => $_has(1);
@$pb.TagNumber(2)
$core.bool hasMessage() => $_has(1);
@$pb.TagNumber(2)
void clearMessage() => clearField(2);
List<$google$protobuf.Any> get details => $_getN(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);
}
class _ReadonlyStatus extends Status with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,5 +1,10 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.rpc_status_pbenum;
// source: google/rpc/status.proto
//
// @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,15 +1,25 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library google.rpc_status_pbjson;
// source: google/rpc/status.proto
//
// @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,
@ -19,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

@ -1,17 +1,17 @@
name: googleapis
description: Dart gRPC client sample for Google APIs
version: 0.0.1
homepage: https://github.com/dart-lang/grpc-dart
publish_to: none
environment:
sdk: '>=1.24.3 <2.0.0'
sdk: ^3.8.0
dependencies:
async: ^1.13.3
googleapis_auth: ^0.2.3+6
async: ^2.13.0
fixnum: ^1.1.1
grpc:
path: ../../
protobuf: ^0.7.0
protobuf: ^4.1.0
dev_dependencies:
test: ^0.12.0
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
@ -19,6 +19,7 @@ $PROTOC $GOOGLEAPIS/google/logging/type/http_request.proto
$PROTOC $GOOGLEAPIS/google/api/monitored_resource.proto
$PROTOC $GOOGLEAPIS/google/api/label.proto
$PROTOC $GOOGLEAPIS/google/api/launch_stage.proto
$PROTOC $GOOGLEAPIS/google/rpc/status.proto
@ -28,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

@ -0,0 +1,63 @@
# Description
The grpc-web example shows how to use the Dart gRPC library with a gRPC-Web capable server.
This is meant to be used with the echo example provided by the grpc-web repository. The definition of the service is given in echo.proto.
# Prerequisites
Install 'webdev', by running
```sh
$ 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.
# Run the sample code
Follow the instructions for starting the grpc-web example server. The simplest version of this involves running the grpc-web server in a docker container with:
```sh
$ docker-compose up node-server envoy commonjs-client
```
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
$ dart pub get
```
Compile and run the website with:
```sh
$ webdev serve web:9000
```
Note that the alternate port (9000) is necessary because the grpc-web server runs the grpc server on port 8080 by default (the same as webdev).
You can then navigate to http://localhost:9000/ to try out the example.
# Regenerate the stubs
If you have made changes to the message or service definition in
`protos/echo.proto` and need to regenerate the corresponding Dart files,
you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin
version 16.0.0 or higher on your PATH.
To install protoc, see the instructions on
[the Protocol Buffers website](https://developers.google.com/protocol-buffers/).
The easiest way to get the Dart protoc plugin is by running
```sh
$ dart pub global activate protoc_plugin
```
and follow the directions to add `~/.pub-cache/bin` to your PATH, if you haven't
already done so.
You can now regenerate the Dart files by running
```sh
$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/echo.proto
```

View File

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

View File

@ -0,0 +1,90 @@
// 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 'dart:async';
import 'package:web/web.dart';
import 'src/generated/echo.pbgrpc.dart';
class EchoApp {
final EchoServiceClient _service;
EchoApp(this._service);
Future<void> echo(String message) async {
_addLeftMessage(message);
try {
final response = await _service.echo(EchoRequest()..message = message);
_addRightMessage(response.message);
} catch (error) {
_addRightMessage(error.toString());
}
}
void repeatEcho(String message, int count) {
_addLeftMessage(message);
final request = ServerStreamingEchoRequest()
..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.'),
);
}
void _addLeftMessage(String message) {
_addMessage(message, 'label-primary pull-left');
}
void _addRightMessage(String message) {
_addMessage(message, 'label-default pull-right');
}
void _addMessage(String message, String cssClass) {
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

@ -0,0 +1,307 @@
//
// Generated code. Do not modify.
// source: echo.proto
//
// @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 {
factory EchoRequest({
$core.String? message,
}) {
final result = create();
if (message != null) {
result.message = message;
}
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')
EchoRequest clone() => EchoRequest()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
EchoRequest copyWith(void Function(EchoRequest) updates) =>
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();
static $pb.PbList<EchoRequest> createRepeated() => $pb.PbList<EchoRequest>();
@$core.pragma('dart2js:noInline')
static EchoRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<EchoRequest>(create);
static EchoRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$pb.TagNumber(1)
void clearMessage() => clearField(1);
}
class EchoResponse extends $pb.GeneratedMessage {
factory EchoResponse({
$core.String? message,
}) {
final result = create();
if (message != null) {
result.message = message;
}
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')
EchoResponse clone() => EchoResponse()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
EchoResponse copyWith(void Function(EchoResponse) updates) =>
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();
static $pb.PbList<EchoResponse> createRepeated() =>
$pb.PbList<EchoResponse>();
@$core.pragma('dart2js:noInline')
static EchoResponse getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<EchoResponse>(create);
static EchoResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$pb.TagNumber(1)
void clearMessage() => clearField(1);
}
class ServerStreamingEchoRequest extends $pb.GeneratedMessage {
factory ServerStreamingEchoRequest({
$core.String? message,
$core.int? messageCount,
$core.int? messageInterval,
}) {
final result = create();
if (message != null) {
result.message = message;
}
if (messageCount != null) {
result.messageCount = messageCount;
}
if (messageInterval != null) {
result.messageInterval = messageInterval;
}
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')
ServerStreamingEchoRequest clone() =>
ServerStreamingEchoRequest()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ServerStreamingEchoRequest copyWith(
void Function(ServerStreamingEchoRequest) updates) =>
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();
static $pb.PbList<ServerStreamingEchoRequest> createRepeated() =>
$pb.PbList<ServerStreamingEchoRequest>();
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<ServerStreamingEchoRequest>(create);
static ServerStreamingEchoRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$pb.TagNumber(1)
void clearMessage() => clearField(1);
@$pb.TagNumber(2)
$core.int get messageCount => $_getIZ(1);
@$pb.TagNumber(2)
set messageCount($core.int v) {
$_setSignedInt32(1, v);
}
@$pb.TagNumber(2)
$core.bool hasMessageCount() => $_has(1);
@$pb.TagNumber(2)
void clearMessageCount() => clearField(2);
@$pb.TagNumber(3)
$core.int get messageInterval => $_getIZ(2);
@$pb.TagNumber(3)
set messageInterval($core.int v) {
$_setSignedInt32(2, v);
}
@$pb.TagNumber(3)
$core.bool hasMessageInterval() => $_has(2);
@$pb.TagNumber(3)
void clearMessageInterval() => clearField(3);
}
class ServerStreamingEchoResponse extends $pb.GeneratedMessage {
factory ServerStreamingEchoResponse({
$core.String? message,
}) {
final result = create();
if (message != null) {
result.message = message;
}
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')
ServerStreamingEchoResponse clone() =>
ServerStreamingEchoResponse()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ServerStreamingEchoResponse copyWith(
void Function(ServerStreamingEchoResponse) updates) =>
super.copyWith(
(message) => updates(message as ServerStreamingEchoResponse))
as ServerStreamingEchoResponse;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoResponse create() =>
ServerStreamingEchoResponse._();
ServerStreamingEchoResponse createEmptyInstance() => create();
static $pb.PbList<ServerStreamingEchoResponse> createRepeated() =>
$pb.PbList<ServerStreamingEchoResponse>();
@$core.pragma('dart2js:noInline')
static ServerStreamingEchoResponse getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<ServerStreamingEchoResponse>(create);
static ServerStreamingEchoResponse? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$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

@ -0,0 +1,10 @@
//
// Generated code. Do not modify.
// source: echo.proto
//
// @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

@ -0,0 +1,92 @@
//
// Generated code. Do not modify.
// source: echo.proto
//
// @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',
($0.EchoRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.EchoResponse.fromBuffer(value));
static final _$serverStreamingEcho = $grpc.ClientMethod<
$0.ServerStreamingEchoRequest, $0.ServerStreamingEchoResponse>(
'/grpc.gateway.testing.EchoService/ServerStreamingEcho',
($0.ServerStreamingEchoRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ServerStreamingEchoResponse.fromBuffer(value));
EchoServiceClient($grpc.ClientChannel channel,
{$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}) {
return $createUnaryCall(_$echo, request, options: options);
}
$grpc.ResponseStream<$0.ServerStreamingEchoResponse> serverStreamingEcho(
$0.ServerStreamingEchoRequest request,
{$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';
EchoServiceBase() {
$addMethod($grpc.ServiceMethod<$0.EchoRequest, $0.EchoResponse>(
'Echo',
echo_Pre,
false,
false,
($core.List<$core.int> value) => $0.EchoRequest.fromBuffer(value),
($0.EchoResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ServerStreamingEchoRequest,
$0.ServerStreamingEchoResponse>(
'ServerStreamingEcho',
serverStreamingEcho_Pre,
false,
true,
($core.List<$core.int> value) =>
$0.ServerStreamingEchoRequest.fromBuffer(value),
($0.ServerStreamingEchoResponse value) => value.writeToBuffer()));
}
$async.Future<$0.EchoResponse> echo_Pre(
$grpc.ServiceCall call, $async.Future<$0.EchoRequest> request) async {
return echo(call, await request);
}
$async.Stream<$0.ServerStreamingEchoResponse> serverStreamingEcho_Pre(
$grpc.ServiceCall call,
$async.Future<$0.ServerStreamingEchoRequest> request) async* {
yield* serverStreamingEcho(call, await request);
}
$async.Future<$0.EchoResponse> echo(
$grpc.ServiceCall call, $0.EchoRequest request);
$async.Stream<$0.ServerStreamingEchoResponse> serverStreamingEcho(
$grpc.ServiceCall call, $0.ServerStreamingEchoRequest request);
}

View File

@ -0,0 +1,69 @@
//
// Generated code. Do not modify.
// source: echo.proto
//
// @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: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': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
/// 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': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
/// 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': [
{'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'},
],
};
/// 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': [
{'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

@ -0,0 +1,41 @@
// Copyright 2018 Google LLC
//
// 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
//
// https://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.
syntax = "proto3";
package grpc.gateway.testing;
message EchoRequest {
string message = 1;
}
message EchoResponse {
string message = 1;
}
message ServerStreamingEchoRequest {
string message = 1;
int32 message_count = 2;
int32 message_interval = 3;
}
message ServerStreamingEchoResponse {
string message = 1;
}
service EchoService {
rpc Echo(EchoRequest) returns (EchoResponse);
rpc ServerStreamingEcho(ServerStreamingEchoRequest)
returns (stream ServerStreamingEchoResponse);
}

View File

@ -0,0 +1,17 @@
name: grpc_web
description: Dart gRPC-Web sample client
publish_to: none
environment:
sdk: ^3.8.0
dependencies:
grpc:
path: ../../
protobuf: ^4.1.0
web: ^1.1.1
dev_dependencies:
build_runner: ^2.4.15
build_web_compilers: ^4.1.5
lints: ^6.0.0

View File

@ -0,0 +1,42 @@
<!--
Copyright (c) 2018, 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.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Echo Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script defer src="main.dart.js"></script>
</head>
<body>
<div class="container">
<div class="row" id="first">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" id="msg">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" id="send">Send
</button>
</span>
</div>
<p class="help-block">Example: "Hello", "4 Hello"</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,46 @@
// Copyright (c) 2018, 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/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 = document.querySelector('#send') as HTMLButtonElement;
button.onClick.listen((e) async {
final msg = document.querySelector('#msg') as HTMLInputElement;
final value = msg.value.trim();
msg.value = '';
if (value.isEmpty) return;
if (value.indexOf(' ') > 0) {
final countStr = value.substring(0, value.indexOf(' '));
final count = int.tryParse(countStr);
if (count != null) {
app.repeatEcho(value.substring(value.indexOf(' ') + 1), count);
} else {
app.echo(value);
}
} else {
app.echo(value);
}
});
}

View File

@ -0,0 +1,66 @@
# Description
The hello world server and client demonstrate how to use Dart gRPC libraries to
perform unary RPCs.
See the definition of the hello world service in `protos/helloworld.proto`.
# Run the sample code
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
$ dart pub get
```
## Run TCP sample code
Start the server:
```sh
$ dart bin/server.dart
```
Likewise, to run the client:
```sh
$ dart bin/client.dart
```
## Run UDS sample code
Start the server:
```sh
$ dart bin/unix_server.dart
```
Likewise, to run the client:
```sh
$ dart bin/unix_client.dart
```
>**Note** the `UDS` only support *nix plantform.
# Regenerate the stubs
If you have made changes to the message or service definition in
`protos/helloworld.proto` and need to regenerate the corresponding Dart files,
you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin
version 0.7.9 or higher on your PATH.
To install protoc, see the instructions on
[the Protocol Buffers website](https://developers.google.com/protocol-buffers/).
The easiest way to get the Dart protoc plugin is by running
```sh
$ pub global activate protoc_plugin
```
and follow the directions to add `~/.pub-cache/bin` to your PATH, if you haven't
already done so.
You can now regenerate the Dart files by running
```sh
$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/helloworld.proto
```

View File

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

View File

@ -0,0 +1,45 @@
// Copyright (c) 2018, 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/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 channel = ClientChannel(
'localhost',
port: 50051,
options: ChannelOptions(
credentials: ChannelCredentials.insecure(),
codecRegistry: CodecRegistry(
codecs: const [GzipCodec(), IdentityCodec()],
),
),
);
final stub = GreeterClient(channel);
final name = args.isNotEmpty ? args[0] : 'world';
try {
final response = await stub.sayHello(
HelloRequest()..name = name,
options: CallOptions(compression: const GzipCodec()),
);
print('Greeter client received: ${response.message}');
} catch (e) {
print('Caught error: $e');
}
await channel.shutdown();
}

View File

@ -0,0 +1,34 @@
// Copyright (c) 2018, 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/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 {
return HelloReply()..message = 'Hello, ${request.name}!';
}
}
Future<void> main(List<String> args) async {
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

@ -0,0 +1,43 @@
// Copyright (c) 2020, 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 'dart:io';
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 channel = ClientChannel(
udsAddress,
port: 0,
options: const ChannelOptions(credentials: ChannelCredentials.insecure()),
);
final stub = GreeterClient(channel);
final name = args.isNotEmpty ? args[0] : 'world';
try {
final response = await stub.sayHello(HelloRequest()..name = name);
print('Greeter client received: ${response.message}');
} catch (e) {
print('Caught error: $e');
}
await channel.shutdown();
}

View File

@ -0,0 +1,37 @@
// Copyright (c) 2020, 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 'dart:io';
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 {
return HelloReply()..message = 'Hello, ${request.name}!';
}
}
Future<void> main(List<String> args) async {
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

@ -0,0 +1,140 @@
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @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 {
factory HelloRequest({
$core.String? name,
}) {
final result = create();
if (name != null) {
result.name = name;
}
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')
HelloRequest clone() => HelloRequest()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HelloRequest copyWith(void Function(HelloRequest) updates) =>
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();
static $pb.PbList<HelloRequest> createRepeated() =>
$pb.PbList<HelloRequest>();
@$core.pragma('dart2js:noInline')
static HelloRequest getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HelloRequest>(create);
static HelloRequest? _defaultInstance;
@$pb.TagNumber(1)
$core.String get name => $_getSZ(0);
@$pb.TagNumber(1)
set name($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasName() => $_has(0);
@$pb.TagNumber(1)
void clearName() => clearField(1);
}
/// The response message containing the greetings
class HelloReply extends $pb.GeneratedMessage {
factory HelloReply({
$core.String? message,
}) {
final result = create();
if (message != null) {
result.message = message;
}
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')
HelloReply clone() => HelloReply()..mergeFromMessage(this);
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
HelloReply copyWith(void Function(HelloReply) updates) =>
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();
static $pb.PbList<HelloReply> createRepeated() => $pb.PbList<HelloReply>();
@$core.pragma('dart2js:noInline')
static HelloReply getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<HelloReply>(create);
static HelloReply? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String v) {
$_setString(0, v);
}
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$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

@ -0,0 +1,10 @@
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @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

@ -0,0 +1,61 @@
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @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',
($0.HelloRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.HelloReply.fromBuffer(value));
GreeterClient($grpc.ClientChannel channel,
{$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}) {
return $createUnaryCall(_$sayHello, request, options: options);
}
}
@$pb.GrpcServiceName('helloworld.Greeter')
abstract class GreeterServiceBase extends $grpc.Service {
$core.String get $name => 'helloworld.Greeter';
GreeterServiceBase() {
$addMethod($grpc.ServiceMethod<$0.HelloRequest, $0.HelloReply>(
'SayHello',
sayHello_Pre,
false,
false,
($core.List<$core.int> value) => $0.HelloRequest.fromBuffer(value),
($0.HelloReply value) => value.writeToBuffer()));
}
$async.Future<$0.HelloReply> sayHello_Pre(
$grpc.ServiceCall call, $async.Future<$0.HelloRequest> request) async {
return sayHello(call, await request);
}
$async.Future<$0.HelloReply> sayHello(
$grpc.ServiceCall call, $0.HelloRequest request);
}

View File

@ -0,0 +1,38 @@
//
// Generated code. Do not modify.
// source: helloworld.proto
//
// @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: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': [
{'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
],
};
/// 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': [
{'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

@ -0,0 +1,38 @@
// Copyright 2015 gRPC authors.
//
// 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.
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}

View File

@ -0,0 +1,15 @@
name: helloworld
description: Dart gRPC sample client and server.
publish_to: none
environment:
sdk: ^3.8.0
dependencies:
async: ^2.13.0
grpc:
path: ../../
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:
@ -23,3 +23,31 @@ Likewise, to run the client:
```sh
$ dart bin/client.dart
```
# Regenerate the stubs
If you have made changes to the message or service definition in
`protos/route_guide.proto` and need to regenerate the corresponding Dart files,
you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin
version 0.7.9 or higher on your PATH.
To install protoc with Dart support, take these steps:
1. Install the `protoc` matching your development operating system from
[the Protocol Buffers releases page](https://github.com/google/protobuf/releases)
(e.g. `protoc-3.5.1-osx-x86_64.zip` for macOS).
1. Get the Dart protoc plugin by running
```sh
$ dart pub global activate protoc_plugin
```
1. Add `~/.pub-cache/bin` to your PATH, if you haven't
already done so.
You can now regenerate the Dart files by running
```sh
$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/metadata.proto
```

View File

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

View File

@ -15,6 +15,6 @@
import 'package:metadata/src/client.dart';
main(List<String> args) {
new Client().main(args);
void main(List<String> args) {
Client().main(args);
}

View File

@ -15,6 +15,6 @@
import 'package:metadata/src/server.dart';
main(List<String> args) {
new Server().main(args);
void main(List<String> args) {
Server().main(args);
}

View File

@ -20,13 +20,16 @@ import 'package:grpc/grpc.dart';
import 'generated/metadata.pbgrpc.dart';
class Client {
ClientChannel channel;
MetadataClient stub;
late ClientChannel channel;
late MetadataClient stub;
Future<Null> main(List<String> args) async {
channel = new ClientChannel('127.0.0.1',
port: 8080, options: const ChannelOptions.insecure());
stub = new MetadataClient(channel);
Future<void> main(List<String> args) async {
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();
await runEchoDelayCancel();
@ -40,10 +43,12 @@ class Client {
///
/// Send custom metadata with a RPC, and print out the received response and
/// metadata.
Future<Null> runEcho() async {
final request = new Record()..value = 'Kaj';
final call = stub.echo(request,
options: new CallOptions(metadata: {'peer': 'Verner'}));
Future<void> runEcho() async {
final request = Record()..value = 'Kaj';
final call = stub.echo(
request,
options: CallOptions(metadata: {'peer': 'Verner'}),
);
call.headers.then((headers) {
print('Received header metadata: $headers');
});
@ -59,19 +64,23 @@ class Client {
/// Same as the echo demo, but demonstrating per-client custom metadata, as
/// 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<Null> runEchoDelayCancel() async {
final stubWithCustomOptions = new MetadataClient(channel,
options: new CallOptions(metadata: {'peer': 'Verner'}));
final request = new Record()..value = 'Kaj';
final call = stubWithCustomOptions.echo(request,
options: new CallOptions(metadata: {'delay': '1'}));
Future<void> runEchoDelayCancel() async {
final stubWithCustomOptions = MetadataClient(
channel,
options: CallOptions(metadata: {'peer': 'Verner'}),
);
final request = Record()..value = 'Kaj';
final call = stubWithCustomOptions.echo(
request,
options: CallOptions(metadata: {'delay': '1'}),
);
call.headers.then((headers) {
print('Received header metadata: $headers');
});
call.trailers.then((trailers) {
print('Received trailer metadata: $trailers');
});
await new Future.delayed(new Duration(milliseconds: 10));
await Future.delayed(Duration(milliseconds: 10));
call.cancel();
try {
final response = await call;
@ -85,11 +94,12 @@ class Client {
///
/// Makes a bi-directional RPC, sends 4 requests, and cancels the RPC after
/// receiving 3 responses.
Future<Null> runAddOneCancel() async {
final numbers = new StreamController<int>();
final call =
stub.addOne(numbers.stream.map((value) => new Number()..value = value));
final receivedThree = new Completer<bool>();
Future<void> runAddOneCancel() async {
final numbers = StreamController<int>();
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}');
if (number.value == 3) {
@ -109,9 +119,9 @@ class Client {
///
/// Call an RPC that returns a stream of Fibonacci numbers. Cancel the call
/// after receiving more than 5 responses.
Future<Null> runFibonacciCancel() async {
final call = stub.fibonacci(new Empty());
int count = 0;
Future<void> runFibonacciCancel() async {
final call = stub.fibonacci(Empty());
var count = 0;
try {
await for (var number in call) {
count++;
@ -130,10 +140,12 @@ class Client {
///
/// Call an RPC that returns a stream of Fibonacci numbers, and specify an RPC
/// timeout of 2 seconds.
Future<Null> runFibonacciTimeout() async {
final call = stub.fibonacci(new Empty(),
options: new CallOptions(timeout: new Duration(seconds: 2)));
int count = 0;
Future<void> runFibonacciTimeout() async {
final call = stub.fibonacci(
Empty(),
options: CallOptions(timeout: Duration(seconds: 2)),
);
var count = 0;
try {
await for (var number in call) {
count++;

View File

@ -1,108 +1,177 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library grpc_metadata;
// source: metadata.proto
//
// @dart = 2.12
// ignore: UNUSED_SHOWN_NAME
import 'dart:core' show int, bool, double, String, List, override;
// 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 'package:protobuf/protobuf.dart';
import 'dart:core' as $core;
class Record extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Record')
..aOS(1, 'value')
import 'package:protobuf/protobuf.dart' as $pb;
/// A message containing a single string value.
class Record extends $pb.GeneratedMessage {
factory Record({
$core.String? value,
}) {
final result = create();
if (value != null) {
result.value = value;
}
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;
Record() : super();
Record.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Record.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Record clone() => new Record()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Record create() => new Record();
static PbList<Record> createRepeated() => new PbList<Record>();
static Record getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyRecord();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Record clone() => Record()..mergeFromMessage(this);
@$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)) as Record;
static Record _defaultInstance;
static void $checkItem(Record v) {
if (v is! Record) checkItemFailed(v, 'Record');
}
$pb.BuilderInfo get info_ => _i;
String get value => $_getS(0, '');
set value(String v) {
@$core.pragma('dart2js:noInline')
static Record create() => Record._();
Record createEmptyInstance() => create();
static $pb.PbList<Record> createRepeated() => $pb.PbList<Record>();
@$core.pragma('dart2js:noInline')
static Record getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Record>(create);
static Record? _defaultInstance;
@$pb.TagNumber(1)
$core.String get value => $_getSZ(0);
@$pb.TagNumber(1)
set value($core.String v) {
$_setString(0, v);
}
bool hasValue() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasValue() => $_has(0);
@$pb.TagNumber(1)
void clearValue() => clearField(1);
}
class _ReadonlyRecord extends Record with ReadonlyMessageMixin {}
/// A message containing a single number.
class Number extends $pb.GeneratedMessage {
factory Number({
$core.int? value,
}) {
final result = create();
if (value != null) {
result.value = value;
}
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);
class Number extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Number')
..a<int>(1, 'value', PbFieldType.O3)
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;
Number() : super();
Number.fromBuffer(List<int> i,
[ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Number.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Number clone() => new Number()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Number create() => new Number();
static PbList<Number> createRepeated() => new PbList<Number>();
static Number getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyNumber();
return _defaultInstance;
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Number clone() => Number()..mergeFromMessage(this);
@$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)) as Number;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Number create() => Number._();
Number createEmptyInstance() => create();
static $pb.PbList<Number> createRepeated() => $pb.PbList<Number>();
@$core.pragma('dart2js:noInline')
static Number getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Number>(create);
static Number? _defaultInstance;
@$pb.TagNumber(1)
$core.int get value => $_getIZ(0);
@$pb.TagNumber(1)
set value($core.int v) {
$_setSignedInt32(0, v);
}
static Number _defaultInstance;
static void $checkItem(Number v) {
if (v is! Number) checkItemFailed(v, 'Number');
}
int get value => $_get(0, 0);
set value(int v) {
$_setUnsignedInt32(0, v);
}
bool hasValue() => $_has(0);
@$pb.TagNumber(1)
$core.bool hasValue() => $_has(0);
@$pb.TagNumber(1)
void clearValue() => clearField(1);
}
class _ReadonlyNumber extends Number with ReadonlyMessageMixin {}
/// A message containing nothing.
class Empty extends $pb.GeneratedMessage {
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);
class Empty extends GeneratedMessage {
static final BuilderInfo _i = new BuilderInfo('Empty')
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'Empty',
package: const $pb.PackageName(_omitMessageNames ? '' : 'grpc'),
createEmptyInstance: create)
..hasRequiredFields = false;
Empty() : super();
Empty.fromBuffer(List<int> i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromBuffer(i, r);
Empty.fromJson(String i, [ExtensionRegistry r = ExtensionRegistry.EMPTY])
: super.fromJson(i, r);
Empty clone() => new Empty()..mergeFromMessage(this);
BuilderInfo get info_ => _i;
static Empty create() => new Empty();
static PbList<Empty> createRepeated() => new PbList<Empty>();
static Empty getDefault() {
if (_defaultInstance == null) _defaultInstance = new _ReadonlyEmpty();
return _defaultInstance;
}
@$core.Deprecated('Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Empty clone() => Empty()..mergeFromMessage(this);
@$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)) as Empty;
static Empty _defaultInstance;
static void $checkItem(Empty v) {
if (v is! Empty) checkItemFailed(v, 'Empty');
}
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Empty create() => Empty._();
Empty createEmptyInstance() => create();
static $pb.PbList<Empty> createRepeated() => $pb.PbList<Empty>();
@$core.pragma('dart2js:noInline')
static Empty getDefault() =>
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Empty>(create);
static Empty? _defaultInstance;
}
class _ReadonlyEmpty extends Empty with ReadonlyMessageMixin {}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames =
$core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@ -1,87 +1,102 @@
///
//
// Generated code. Do not modify.
///
// ignore_for_file: non_constant_identifier_names,library_prefixes
library grpc_metadata_pbgrpc;
// source: metadata.proto
//
// @dart = 2.12
import 'dart:async';
// 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 'package:grpc/grpc.dart';
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;
import 'metadata.pb.dart';
export 'metadata.pb.dart';
class MetadataClient extends Client {
static final _$echo = new ClientMethod<Record, Record>(
@$pb.GrpcServiceName('grpc.Metadata')
class MetadataClient extends $grpc.Client {
static final _$echo = $grpc.ClientMethod<$0.Record, $0.Record>(
'/grpc.Metadata/Echo',
(Record value) => value.writeToBuffer(),
(List<int> value) => new Record.fromBuffer(value));
static final _$addOne = new ClientMethod<Number, Number>(
($0.Record value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Record.fromBuffer(value));
static final _$addOne = $grpc.ClientMethod<$0.Number, $0.Number>(
'/grpc.Metadata/AddOne',
(Number value) => value.writeToBuffer(),
(List<int> value) => new Number.fromBuffer(value));
static final _$fibonacci = new ClientMethod<Empty, Number>(
($0.Number value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Number.fromBuffer(value));
static final _$fibonacci = $grpc.ClientMethod<$0.Empty, $0.Number>(
'/grpc.Metadata/Fibonacci',
(Empty value) => value.writeToBuffer(),
(List<int> value) => new Number.fromBuffer(value));
($0.Empty value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Number.fromBuffer(value));
MetadataClient(ClientChannel channel, {CallOptions options})
: super(channel, options: options);
MetadataClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
ResponseFuture<Record> echo(Record request, {CallOptions options}) {
final call = $createCall(_$echo, new Stream.fromIterable([request]),
options: options);
return new ResponseFuture(call);
$grpc.ResponseFuture<$0.Record> echo($0.Record request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$echo, request, options: options);
}
ResponseStream<Number> addOne(Stream<Number> request, {CallOptions options}) {
final call = $createCall(_$addOne, request, options: options);
return new ResponseStream(call);
$grpc.ResponseStream<$0.Number> addOne($async.Stream<$0.Number> request,
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$addOne, request, options: options);
}
ResponseStream<Number> fibonacci(Empty request, {CallOptions options}) {
final call = $createCall(_$fibonacci, new Stream.fromIterable([request]),
$grpc.ResponseStream<$0.Number> fibonacci($0.Empty request,
{$grpc.CallOptions? options}) {
return $createStreamingCall(
_$fibonacci, $async.Stream.fromIterable([request]),
options: options);
return new ResponseStream(call);
}
}
abstract class MetadataServiceBase extends Service {
String get $name => 'grpc.Metadata';
@$pb.GrpcServiceName('grpc.Metadata')
abstract class MetadataServiceBase extends $grpc.Service {
$core.String get $name => 'grpc.Metadata';
MetadataServiceBase() {
$addMethod(new ServiceMethod<Record, Record>(
$addMethod($grpc.ServiceMethod<$0.Record, $0.Record>(
'Echo',
echo_Pre,
false,
false,
(List<int> value) => new Record.fromBuffer(value),
(Record value) => value.writeToBuffer()));
$addMethod(new ServiceMethod<Number, Number>(
($core.List<$core.int> value) => $0.Record.fromBuffer(value),
($0.Record value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.Number, $0.Number>(
'AddOne',
addOne,
true,
true,
(List<int> value) => new Number.fromBuffer(value),
(Number value) => value.writeToBuffer()));
$addMethod(new ServiceMethod<Empty, Number>(
($core.List<$core.int> value) => $0.Number.fromBuffer(value),
($0.Number value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.Empty, $0.Number>(
'Fibonacci',
fibonacci_Pre,
false,
true,
(List<int> value) => new Empty.fromBuffer(value),
(Number value) => value.writeToBuffer()));
($core.List<$core.int> value) => $0.Empty.fromBuffer(value),
($0.Number value) => value.writeToBuffer()));
}
Future<Record> echo_Pre(ServiceCall call, Future<Record> request) async {
$async.Future<$0.Record> echo_Pre(
$grpc.ServiceCall call, $async.Future<$0.Record> request) async {
return echo(call, await request);
}
Stream<Number> fibonacci_Pre(ServiceCall call, Future<Empty> request) async* {
$async.Stream<$0.Number> fibonacci_Pre(
$grpc.ServiceCall call, $async.Future<$0.Empty> request) async* {
yield* fibonacci(call, await request);
}
Future<Record> echo(ServiceCall call, Record request);
Stream<Number> addOne(ServiceCall call, Stream<Number> request);
Stream<Number> fibonacci(ServiceCall call, Empty request);
$async.Future<$0.Record> echo($grpc.ServiceCall call, $0.Record request);
$async.Stream<$0.Number> addOne(
$grpc.ServiceCall call, $async.Stream<$0.Number> request);
$async.Stream<$0.Number> fibonacci($grpc.ServiceCall call, $0.Empty request);
}

View File

@ -24,27 +24,27 @@ 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 new Future.delayed(new Duration(seconds: int.parse(delay)));
await Future.delayed(Duration(seconds: int.parse(delay)));
}
return new Record()..value = peer;
return Record()..value = peer;
}
@override
Stream<Number> addOne(grpc.ServiceCall call, Stream<Number> request) async* {
int lastNumber = -1;
var lastNumber = -1;
try {
await for (var number in request) {
lastNumber = number.value;
yield new Number()..value = number.value + 1;
yield Number()..value = number.value + 1;
}
} catch (error) {
print('Caught: $error, last number = $lastNumber');
@ -56,13 +56,14 @@ class MetadataService extends MetadataServiceBase {
}
/// Streams a Fibonacci number every 500ms until the call is canceled.
@override
Stream<Number> fibonacci(grpc.ServiceCall call, Empty request) async* {
int previous = 0;
int current = 1;
var previous = 0;
var current = 1;
try {
while (true) {
await new Future.delayed(new Duration(milliseconds: 500));
yield new Number()..value = current;
await Future.delayed(Duration(milliseconds: 500));
yield Number()..value = current;
final next = current + previous;
previous = current;
current = next;
@ -76,10 +77,9 @@ class MetadataService extends MetadataServiceBase {
}
class Server {
Future<Null> main(List<String> args) async {
final server =
new grpc.Server.insecure([new MetadataService()], port: 8080);
await server.serve();
print('Server listening...');
Future<void> main(List<String> args) async {
final server = grpc.Server.create(services: [MetadataService()]);
await server.serve(port: 8080);
print('Server listening on port ${server.port}...');
}
}

View File

@ -1,16 +1,16 @@
name: metadata
description: Dart gRPC sample client and server.
version: 0.0.1
homepage: https://github.com/dart-lang/grpc-dart
publish_to: none
environment:
sdk: '>=1.24.3 <2.0.0'
sdk: ^3.8.0
dependencies:
async: ^1.13.3
async: ^2.13.0
grpc:
path: ../../
protobuf: ^0.7.0
protobuf: ^4.1.0
dev_dependencies:
test: ^0.12.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

@ -31,16 +31,19 @@ If you have made changes to the message or service definition in
you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin
version 0.7.9 or higher on your PATH.
To install protoc, see the instructions on
[the Protocol Buffers website](https://developers.google.com/protocol-buffers/).
To install protoc with Dart support, take these steps:
The easiest way to get the Dart protoc plugin is by running
1. Install the `protoc` matching your development operating system from
[the Protocol Buffers releases page](https://github.com/google/protobuf/releases)
(e.g. `protoc-3.5.1-osx-x86_64.zip` for macOS).
```sh
$ pub global activate protoc_plugin
```
1. Get the Dart protoc plugin by running
and follow the directions to add `~/.pub-cache/bin` to your PATH, if you haven't
```sh
$ pub global activate protoc_plugin
```
1. Add `~/.pub-cache/bin` to your PATH, if you haven't
already done so.
You can now regenerate the Dart files by running

View File

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

View File

@ -15,6 +15,6 @@
import 'package:route_guide/src/client.dart';
main(List<String> args) async {
await new Client().main(args);
Future<void> main(List<String> args) async {
await Client().main(args);
}

View File

@ -15,6 +15,6 @@
import 'package:route_guide/src/server.dart';
main(List<String> args) async {
await new Server().main(args);
Future<void> main(List<String> args) async {
await Server().main(args);
}

View File

@ -13,24 +13,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import 'dart:async';
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 {
ClientChannel channel;
RouteGuideClient stub;
late RouteGuideClient stub;
Future<Null> main(List<String> args) async {
channel = new ClientChannel('127.0.0.1',
port: 8080, options: const ChannelOptions.insecure());
stub = new RouteGuideClient(channel,
options: new CallOptions(timeout: new Duration(seconds: 30)));
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)),
);
// Run all of the demos in order.
try {
await runGetFeature();
@ -50,16 +52,17 @@ 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
/// feature and a point known not to have a feature.
Future<Null> runGetFeature() async {
final point1 = new Point()
Future<void> runGetFeature() async {
final point1 = Point()
..latitude = 409146138
..longitude = -746188906;
final point2 = new Point()
final point2 = Point()
..latitude = 0
..longitude = 0;
@ -70,14 +73,14 @@ class Client {
/// Run the listFeatures demo. Calls listFeatures with a rectangle containing
/// all of the features in the pre-generated database. Prints each response as
/// it comes in.
Future<Null> runListFeatures() async {
final lo = new Point()
Future<void> runListFeatures() async {
final lo = Point()
..latitude = 400000000
..longitude = -750000000;
final hi = new Point()
final hi = Point()
..latitude = 420000000
..longitude = -730000000;
final rect = new Rectangle()
final rect = Rectangle()
..lo = lo
..hi = hi;
@ -90,18 +93,17 @@ class Client {
/// Run the recordRoute demo. Sends several randomly chosen points from the
/// pre-generated feature database with a variable delay in between. Prints
/// the statistics when they are sent from the server.
Future<Null> runRecordRoute() async {
Future<void> runRecordRoute() async {
Stream<Point> generateRoute(int count) async* {
final random = new Random();
final random = Random();
for (int i = 0; i < count; i++) {
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 new Future.delayed(
new Duration(milliseconds: 200 + random.nextInt(100)));
await Future.delayed(Duration(milliseconds: 200 + random.nextInt(100)));
}
}
@ -114,12 +116,12 @@ class Client {
/// Run the routeChat demo. Send some chat messages, and print any chat
/// messages that are sent from the server.
Future<Null> runRouteChat() async {
Future<void> runRouteChat() async {
RouteNote createNote(String message, int latitude, int longitude) {
final location = new Point()
final location = Point()
..latitude = latitude
..longitude = longitude;
return new RouteNote()
return RouteNote()
..message = message
..location = location;
}
@ -134,17 +136,20 @@ class Client {
Stream<RouteNote> outgoingNotes() async* {
for (final note in notes) {
// Short delay to simulate some other interaction.
await new Future.delayed(new Duration(milliseconds: 10));
print('Sending message ${note.message} at ${note.location.latitude}, '
'${note.location.longitude}');
await Future.delayed(Duration(milliseconds: 10));
print(
'Sending message ${note.message} at ${note.location.latitude}, '
'${note.location.longitude}',
);
yield note;
}
}
final call = stub.routeChat(outgoingNotes());
await for (var note in call) {
print('Got message ${note.message} at ${note.location.latitude}, ${note
.location.longitude}');
print(
'Got message ${note.message} at ${note.location.latitude}, ${note.location.longitude}',
);
}
}
}

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