Compare commits

97 Commits

Author SHA1 Message Date
7e27e05f58 Autogenerated update for f248c19b07...2cdd6874b4 2026-03-01 21:10:36 +00:00
f23b9e7950 Autogenerated update for c400d2d58b...f248c19b07 2026-03-01 21:05:37 +00:00
7c3e48031a Autogenerated update for 0405aba995...c400d2d58b 2026-02-28 23:04:54 +00:00
822392fc6b Autogenerated update for d3f2d336a0...0405aba995 2025-12-28 20:41:19 +00:00
0f7774b7ce Autogenerated update for 0773cba6c7...83ebab1cc6 2025-12-28 20:17:45 +00:00
44e6826010 v1.7.1 bot_analyzer: directly accept download url 2025-09-21 17:37:36 -07:00
99308b0f37 Autogenerated update for 63ad706dd9...0773cba6c7 2025-09-22 00:35:27 +00:00
4f6871a58e v1.7.0 bot_analyzer 2025-09-21 17:12:37 -07:00
a0e716fda0 Autogenerated update for 8dce6ee1ba...63ad706dd9 2025-09-22 00:03:53 +00:00
98a818acd5 Autogenerated update for 9a7a123284...8dce6ee1ba 2025-08-15 01:33:27 +00:00
0688d3778c v1.6.1 operation success endpoint 2025-08-14 16:58:00 -07:00
b526ae64ca Autogenerated update for e7913b7950...9a7a123284 2025-08-14 23:57:02 +00:00
0e86b1bb6c v1.6.0 validator failure endpoints 2025-08-14 16:14:35 -07:00
61c96d0bb5 Autogenerated update for 6210d5dac9...e7913b7950 2025-08-14 23:12:58 +00:00
f23ecc15df v1.5.1 fix release requests 2025-08-13 19:12:24 -07:00
4ea04b5f1c Autogenerated update for 4e6ed67dda...6210d5dac9 2025-08-14 02:11:20 +00:00
4189c5f584 v1.5.0 metadata maintenance + update prost & tonic 2025-08-13 18:54:06 -07:00
f50ab2d18e update deps 2025-08-13 18:52:50 -07:00
c4bc661de8 update tonic and prost 2025-08-13 18:52:33 -07:00
ee1998efc2 Autogenerated update for a4f5b6b13d...4e6ed67dda 2025-08-14 01:51:25 +00:00
36abded202 Autogenerated update for 2db81d21bc...1ed8ffbc3c 2025-08-14 01:28:16 +00:00
6fb3c91ff4 Autogenerated update for e252921e91...2db81d21bc 2025-08-13 18:24:53 -07:00
b79479d38e Autogenerated update for eb8d873290...e252921e91 2025-08-14 00:49:37 +00:00
41d70fbb43 v1.4.0 cut down maps fields 2025-08-06 18:12:36 -07:00
ad0c7cabcf Autogenerated update for 69aa45ffe6...eb8d873290 2025-08-07 00:50:13 +00:00
117c689f73 Autogenerated update for 889662bc99...69aa45ffe6 2025-08-07 00:39:55 +00:00
59067b96ac v1.3.4 maps_extended.IncrementLoadCount 2025-07-23 20:26:15 -07:00
1e386b78fe Autogenerated update for a9bdcbb1d7...889662bc99 2025-07-24 03:00:21 +00:00
c12619d6cd v1.3.3 fix maps_extended.MapCreate 2025-07-23 19:48:05 -07:00
0575a0e8e3 Autogenerated update for 601798097a...a9bdcbb1d7 2025-07-24 01:18:43 +00:00
2ce4e6628f v1.3.2 maps_extended 2025-07-22 19:55:50 -07:00
9ac8b11d94 Autogenerated update for 5f38e94770...601798097a 2025-07-23 02:46:21 +00:00
f59e720f82 Autogenerated update for 2285e79d6b...5f38e94770 2025-07-22 05:41:14 +00:00
e7b04fefb5 Autogenerated update for 522731d92a...2285e79d6b 2025-07-22 05:01:20 +00:00
14b0f575aa delete maps_embedded 2025-07-21 21:59:56 -07:00
20f4a0943a Autogenerated update for b820089a93...522731d92a 2025-07-22 04:55:24 +00:00
cc6ddf5fd4 v1.3.1 maps_embedded 2025-07-21 21:26:21 -07:00
bc3f3c202e Autogenerated update for 77d88876f6...d9db4fefb8 2025-07-22 04:15:42 +00:00
a0fbebf62f Autogenerated update for d8f3fd54a6...77d88876f6 2025-07-22 03:24:06 +00:00
289f39e32c v1.3.0 ResourceType enum 2025-07-18 20:34:44 -07:00
42cc8501c7 Autogenerated update for cbb7084898...d8f3fd54a6 2025-07-19 03:33:11 +00:00
1e6162635e v1.2.1 validator api 2025-07-17 22:59:42 -07:00
1615c22ccf Autogenerated update for e4d6e3882f...0c22f1035e 2025-07-18 05:52:43 +00:00
dff8cff8ba Autogenerated update for 7646d55b34...e4d6e3882f 2025-07-18 05:29:59 +00:00
a09deedc90 Autogenerated update for 3476ecaee0...7646d55b34 2025-07-18 05:08:57 +00:00
2253aa2294 Autogenerated update for 43d65cfa2e...3476ecaee0 2025-07-18 04:54:51 +00:00
a7431d0680 Autogenerated update for 8f843ce8dc...f9f0fbde77 2025-07-18 04:11:26 +00:00
98d8db1b91 Autogenerated update for d5bb0a8972...8f843ce8dc 2025-07-18 04:09:56 +00:00
e448885cc8 v1.2.0 2025-07-15 02:57:40 -07:00
89e06cf613 update deps 2025-07-15 02:57:11 -07:00
130ecf9a28 v1.1.2 2025-07-15 02:57:11 -07:00
885bb4f54a update deps 2025-07-08 04:48:32 -07:00
2393763b3a Autogenerated update for cd767e3390...d5bb0a8972 2025-07-08 11:39:41 +00:00
da5327b86a Autogenerated update for 5b12236c59...cd767e3390 2025-07-08 11:12:21 +00:00
22162e7ee9 Autogenerated update for 5b12236c59...cd767e3390 2025-06-28 02:17:38 +00:00
3eee75d3a8 Autogenerated update for 4b9803cf66...5b12236c59 2025-06-28 01:38:37 +00:00
1cc5d37e73 Autogenerated update for b8bc25bb8e...4b9803cf66 2025-06-28 01:34:06 +00:00
9b8ce168dd Autogenerated update for 34e63ea6ba...b8bc25bb8e 2025-06-28 01:18:27 +00:00
c992b75c0d Autogenerated update for a1d08b3ea6...6497b12c5b 2025-06-24 03:22:25 +00:00
43b97117d9 Autogenerated update for 82ca9f2b0c...a1d08b3ea6 2025-06-22 14:50:55 +00:00
f3a07ac312 Autogenerated update for ad8e4ebacf...82ca9f2b0c 2025-06-22 14:19:40 +00:00
ec2e5fbf43 Autogenerated update for b636336ed2...ad8e4ebacf 2025-06-22 01:26:00 +00:00
ec31bb9fba Autogenerated update for 5641c3a33e...b636336ed2 2025-06-21 06:13:41 -07:00
c3cb36dd43 Autogenerated update for ef23f7d07e...5641c3a33e 2025-06-21 06:03:47 -07:00
117a09c714 Autogenerated update for b5b8cc5413...ef23f7d07e 2025-06-21 07:41:29 +00:00
81bf0e2849 Autogenerated update for a8135fd45c...b5b8cc5413 2025-06-21 07:36:42 +00:00
be34490829 v1.1.1 2025-06-20 19:31:19 -07:00
0493892e65 add moderation module 2025-06-20 19:31:00 -07:00
8528972e5c v1.1.0 2025-06-20 19:14:28 -07:00
560ff7bcc6 Autogenerated update for 05f8a3b57e...a8135fd45c 2025-06-20 16:14:26 +00:00
a49195e09a Autogenerated update for 2ca53038ef...05f8a3b57e 2024-11-29 08:12:29 +00:00
5bf70a6516 Autogenerated update for fab429fc74...2ca53038ef 2024-11-29 08:08:23 +00:00
97738cf1f7 Autogenerated update for cc0845f68e...fab429fc74 2024-11-29 04:10:00 +00:00
725adb294f Autogenerated update for 2186c5cb96...cc0845f68e 2024-11-28 05:12:22 +00:00
4903ba92b7 v1.0.3 2024-11-26 00:10:49 -08:00
a71fa9a3a6 update deps 2024-11-26 00:09:35 -08:00
39a4b08ab4 v1.0.2 2024-07-21 19:26:15 -07:00
5a35fdb5c4 Autogenerated update for f8d480e834...2186c5cb96 2024-07-22 00:40:53 +00:00
67fbd96728 v1.0.1 2024-07-19 12:03:38 -07:00
d6138299e2 Autogenerated update for 5cfa6745a6...f8d480e834 2024-07-19 12:02:44 -07:00
0925221315 v1.0.0 2024-07-18 22:34:33 -07:00
490c643c1f Autogenerated update for e67b57e397...5cfa6745a6 2024-07-18 22:12:09 +00:00
e02b0147a8 update lib 2024-07-18 14:18:49 -07:00
a91ce588cf Autogenerated update for 0976e4e6ad...e67b57e397 2024-07-17 23:26:01 +00:00
841ba85d65 Autogenerated update for 8f0bfd19ae...0976e4e6ad 2024-07-17 23:23:55 +00:00
f5c723be08 Autogenerated update for c872a75347...8f0bfd19ae 2024-07-17 23:21:55 +00:00
a412b6da97 Autogenerated update for 423ef695ef...dbec402e18 2024-07-16 20:24:18 +00:00
c87ea2701b Autogenerated update for 871d9c3cd5...067aed97f4 2024-07-16 20:01:15 +00:00
5843d113b7 Autogenerated update for 20516bab8d...871d9c3cd5 2024-07-16 19:58:42 +00:00
9c42d96fb2 update lib: use patched prost-types 2024-07-14 09:33:02 -07:00
016bce27eb update lib 2024-07-14 08:47:01 -07:00
7d840b2246 Autogenerated update for d6f891afeb...20516bab8d 2024-07-14 15:45:12 +00:00
6c2a6b80b3 update lib 2024-07-13 17:42:22 -07:00
4cb5927982 Autogenerated update for 65a9abe6d3...f7f9376b4e 2024-07-14 00:40:26 +00:00
f015124dbd Autogenerated update for 65a9abe6d3...f7f9376b4e 2024-03-02 21:53:38 +00:00
cdd65f19f4 lib 2024-02-25 02:54:59 -08:00
a6b61beb88 Autogenerated update for db2e2e990f...65a9abe6d3 2024-02-20 04:54:41 +00:00
39 changed files with 14690 additions and 0 deletions

2
.cargo/config.toml Normal file
View File

@@ -0,0 +1,2 @@
[registries.strafesnet]
index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

835
Cargo.lock generated Normal file
View File

@@ -0,0 +1,835 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "addr2line"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
dependencies = [
"gimli",
]
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "anyhow"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
[[package]]
name = "async-trait"
version = "0.1.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "axum"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
dependencies = [
"axum-core",
"bytes",
"futures-util",
"http",
"http-body",
"http-body-util",
"itoa",
"matchit",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tower",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
dependencies = [
"bytes",
"futures-core",
"http",
"http-body",
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper",
"tower-layer",
"tower-service",
]
[[package]]
name = "backtrace"
version = "0.3.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
"windows-targets",
]
[[package]]
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bitflags"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "bytes"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "cfg-if"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
[[package]]
name = "futures-util"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-core",
"futures-task",
"pin-project-lite",
"pin-utils",
]
[[package]]
name = "gimli"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
[[package]]
name = "h2"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"http",
"indexmap",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
[[package]]
name = "http"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
"bytes",
"http",
]
[[package]]
name = "http-body-util"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
dependencies = [
"bytes",
"futures-core",
"http",
"http-body",
"pin-project-lite",
]
[[package]]
name = "httparse"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "httpdate"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"h2",
"http",
"http-body",
"httparse",
"httpdate",
"itoa",
"pin-project-lite",
"smallvec",
"tokio",
"want",
]
[[package]]
name = "hyper-timeout"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
dependencies = [
"hyper",
"hyper-util",
"pin-project-lite",
"tokio",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http",
"http-body",
"hyper",
"libc",
"pin-project-lite",
"socket2",
"tokio",
"tower-service",
"tracing",
]
[[package]]
name = "indexmap"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "io-uring"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
dependencies = [
"bitflags",
"cfg-if",
"libc",
]
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "libc"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "matchit"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "memchr"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "miniz_oxide"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
]
[[package]]
name = "mio"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
dependencies = [
"libc",
"wasi",
"windows-sys",
]
[[package]]
name = "object"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "proc-macro2"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1"
dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-derive"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "prost-types"
version = "0.14.1-serde2"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "c6bdb43aea117477820c164442f4e943ac7690d0dbe66cde45d78e0f7bb34386"
dependencies = [
"prost",
"serde",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rust-grpc"
version = "1.7.1"
dependencies = [
"prost",
"prost-types",
"serde",
"tonic",
"tonic-prost",
]
[[package]]
name = "rustc-demangle"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
[[package]]
name = "rustversion"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "serde"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "slab"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
[[package]]
name = "smallvec"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "syn"
version = "2.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc3fcb250e53458e712715cf74285c1f889686520d79294a9ef3bd7aa1fc619"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "sync_wrapper"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
[[package]]
name = "tokio"
version = "1.47.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038"
dependencies = [
"backtrace",
"bytes",
"io-uring",
"libc",
"mio",
"pin-project-lite",
"slab",
"socket2",
"tokio-macros",
"windows-sys",
]
[[package]]
name = "tokio-macros"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tokio-stream"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tonic"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ac5a8627ada0968acec063a4746bf79588aa03ccb66db2f75d7dce26722a40"
dependencies = [
"async-trait",
"axum",
"base64",
"bytes",
"h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"socket2",
"sync_wrapper",
"tokio",
"tokio-stream",
"tower",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tonic-prost"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9c511b9a96d40cb12b7d5d00464446acf3b9105fd3ce25437cfe41c92b1c87d"
dependencies = [
"bytes",
"prost",
"tonic",
]
[[package]]
name = "tower"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"indexmap",
"pin-project-lite",
"slab",
"sync_wrapper",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower-layer"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
[[package]]
name = "tower-service"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
dependencies = [
"once_cell",
]
[[package]]
name = "try-lock"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "want"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

13
Cargo.toml Normal file
View File

@@ -0,0 +1,13 @@
[package]
name = "rust-grpc"
version = "1.7.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tonic = { version = "0.14.1" }
tonic-prost = { version = "0.14.1" }
prost = "0.14.1"
prost-types = { version = "=0.14.1-serde2", features = ["serde"], registry = "strafesnet" }
serde = { version = "1.0.204", features = ["derive"] }

587
src/auth/auth.tonic.rs Normal file
View File

@@ -0,0 +1,587 @@
// @generated
/// Generated client implementations.
pub mod auth_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct AuthServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AuthServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AuthServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AuthServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
AuthServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_session_user(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<
tonic::Response<super::SessionUserResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/auth.AuthService/GetSessionUser",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("auth.AuthService", "GetSessionUser"));
self.inner.unary(req, path, codec).await
}
pub async fn get_group_role(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::RoleReponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/auth.AuthService/GetGroupRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("auth.AuthService", "GetGroupRole"));
self.inner.unary(req, path, codec).await
}
pub async fn validate_session(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<
tonic::Response<super::ValidateResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/auth.AuthService/ValidateSession",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("auth.AuthService", "ValidateSession"));
self.inner.unary(req, path, codec).await
}
pub async fn get_auth_metadata(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::AuthMetadataResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/auth.AuthService/GetAuthMetadata",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("auth.AuthService", "GetAuthMetadata"));
self.inner.unary(req, path, codec).await
}
pub async fn get_avatars(
&mut self,
request: impl tonic::IntoRequest<super::AvatarListRequest>,
) -> std::result::Result<
tonic::Response<super::AvatarListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/auth.AuthService/GetAvatars",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("auth.AuthService", "GetAvatars"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod auth_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with AuthServiceServer.
#[async_trait]
pub trait AuthService: std::marker::Send + std::marker::Sync + 'static {
async fn get_session_user(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<
tonic::Response<super::SessionUserResponse>,
tonic::Status,
>;
async fn get_group_role(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::RoleReponse>, tonic::Status>;
async fn validate_session(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<
tonic::Response<super::ValidateResponse>,
tonic::Status,
>;
async fn get_auth_metadata(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::AuthMetadataResponse>,
tonic::Status,
>;
async fn get_avatars(
&self,
request: tonic::Request<super::AvatarListRequest>,
) -> std::result::Result<
tonic::Response<super::AvatarListResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct AuthServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> AuthServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthServiceServer<T>
where
T: AuthService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/auth.AuthService/GetSessionUser" => {
#[allow(non_camel_case_types)]
struct GetSessionUserSvc<T: AuthService>(pub Arc<T>);
impl<T: AuthService> tonic::server::UnaryService<super::IdMessage>
for GetSessionUserSvc<T> {
type Response = super::SessionUserResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_session_user(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSessionUserSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/auth.AuthService/GetGroupRole" => {
#[allow(non_camel_case_types)]
struct GetGroupRoleSvc<T: AuthService>(pub Arc<T>);
impl<T: AuthService> tonic::server::UnaryService<super::IdMessage>
for GetGroupRoleSvc<T> {
type Response = super::RoleReponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_group_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetGroupRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/auth.AuthService/ValidateSession" => {
#[allow(non_camel_case_types)]
struct ValidateSessionSvc<T: AuthService>(pub Arc<T>);
impl<T: AuthService> tonic::server::UnaryService<super::IdMessage>
for ValidateSessionSvc<T> {
type Response = super::ValidateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::validate_session(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ValidateSessionSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/auth.AuthService/GetAuthMetadata" => {
#[allow(non_camel_case_types)]
struct GetAuthMetadataSvc<T: AuthService>(pub Arc<T>);
impl<T: AuthService> tonic::server::UnaryService<()>
for GetAuthMetadataSvc<T> {
type Response = super::AuthMetadataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_auth_metadata(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAuthMetadataSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/auth.AuthService/GetAvatars" => {
#[allow(non_camel_case_types)]
struct GetAvatarsSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::AvatarListRequest>
for GetAvatarsSvc<T> {
type Response = super::AvatarListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AvatarListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_avatars(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAvatarsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for AuthServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "auth.AuthService";
impl<T> tonic::server::NamedService for AuthServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

84
src/auth/mod.rs Normal file
View File

@@ -0,0 +1,84 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(string, tag="1")]
pub session_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SessionUserResponse {
#[prost(uint64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: u64,
#[prost(string, tag="2")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub avatar_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RoleReponse {
#[prost(message, repeated, tag="1")]
pub roles: ::prost::alloc::vec::Vec<RoleItem>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RoleItem {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(int32, tag="3")]
pub rank: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ValidateResponse {
#[prost(bool, tag="1")]
pub valid: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AuthMetadataResponse {
#[prost(string, tag="1")]
pub login_url: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub logout_url: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub account_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AvatarListRequest {
#[prost(uint64, repeated, tag="1")]
pub user_i_ds: ::prost::alloc::vec::Vec<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AvatarItem {
#[prost(uint64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: u64,
#[prost(string, tag="2")]
pub avatar_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AvatarListResponse {
#[prost(message, repeated, tag="1")]
pub avatars: ::prost::alloc::vec::Vec<AvatarItem>,
}
include!("auth.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,298 @@
// @generated
/// Generated client implementations.
pub mod bot_analyzer_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BotAnalyzerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BotAnalyzerClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BotAnalyzerClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BotAnalyzerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BotAnalyzerClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn analyze(
&mut self,
request: impl tonic::IntoRequest<super::DownloadUrl>,
) -> std::result::Result<
tonic::Response<super::AnalysisResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bot_analyzer.BotAnalyzer/Analyze",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bot_analyzer.BotAnalyzer", "Analyze"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod bot_analyzer_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with BotAnalyzerServer.
#[async_trait]
pub trait BotAnalyzer: std::marker::Send + std::marker::Sync + 'static {
async fn analyze(
&self,
request: tonic::Request<super::DownloadUrl>,
) -> std::result::Result<
tonic::Response<super::AnalysisResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct BotAnalyzerServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BotAnalyzerServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BotAnalyzerServer<T>
where
T: BotAnalyzer,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bot_analyzer.BotAnalyzer/Analyze" => {
#[allow(non_camel_case_types)]
struct AnalyzeSvc<T: BotAnalyzer>(pub Arc<T>);
impl<T: BotAnalyzer> tonic::server::UnaryService<super::DownloadUrl>
for AnalyzeSvc<T> {
type Response = super::AnalysisResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DownloadUrl>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotAnalyzer>::analyze(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AnalyzeSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for BotAnalyzerServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "bot_analyzer.BotAnalyzer";
impl<T> tonic::server::NamedService for BotAnalyzerServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

18
src/bot_analyzer/mod.rs Normal file
View File

@@ -0,0 +1,18 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DownloadUrl {
#[prost(string, tag="1")]
pub url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AnalysisResponse {
#[prost(string, tag="1")]
pub analysis: ::prost::alloc::string::String,
}
include!("bot_analyzer.tonic.rs");
// @@protoc_insertion_point(module)

614
src/bots/bots.tonic.rs Normal file
View File

@@ -0,0 +1,614 @@
// @generated
/// Generated client implementations.
pub mod bots_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BotsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BotsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BotsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BotsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BotsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::BotResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::IdList>,
) -> std::result::Result<tonic::Response<super::BotList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/GetList");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::BotRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/Update");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::BotRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/Create");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/Delete");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::BotList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/bots.BotsService/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("bots.BotsService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod bots_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with BotsServiceServer.
#[async_trait]
pub trait BotsService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::BotResponse>, tonic::Status>;
async fn get_list(
&self,
request: tonic::Request<super::IdList>,
) -> std::result::Result<tonic::Response<super::BotList>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::BotRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn create(
&self,
request: tonic::Request<super::BotRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::BotList>, tonic::Status>;
}
#[derive(Debug)]
pub struct BotsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BotsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BotsServiceServer<T>
where
T: BotsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bots.BotsService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::IdMessage>
for GetSvc<T> {
type Response = super::BotResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bots.BotsService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::IdList>
for GetListSvc<T> {
type Response = super::BotList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bots.BotsService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::BotRequest>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::BotRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bots.BotsService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::BotRequest>
for CreateSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::BotRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bots.BotsService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bots.BotsService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: BotsService>(pub Arc<T>);
impl<T: BotsService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::BotList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BotsService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for BotsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "bots.BotsService";
impl<T> tonic::server::NamedService for BotsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

82
src/bots/mod.rs Normal file
View File

@@ -0,0 +1,82 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BotResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(int64, tag="2")]
#[serde(rename = "TimeID")]
pub time_id: i64,
#[prost(int64, tag="3")]
pub date: i64,
#[prost(string, tag="4")]
#[serde(rename = "FileID")]
pub file_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BotRequest {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(int64, optional, tag="2")]
#[serde(rename = "TimeID")]
pub time_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="3")]
pub date: ::core::option::Option<i64>,
#[prost(string, optional, tag="4")]
#[serde(rename = "FileID")]
pub file_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BotList {
#[prost(message, repeated, tag="1")]
pub bots: ::prost::alloc::vec::Vec<BotResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<BotRequest>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("bots.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,432 @@
// @generated
/// Generated client implementations.
pub mod datastore_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct DatastoreServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DatastoreServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DatastoreServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> DatastoreServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
DatastoreServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::KeyMessage>,
) -> std::result::Result<tonic::Response<super::ObjectResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/datastore.DatastoreService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("datastore.DatastoreService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::UpdateMessage>,
) -> std::result::Result<tonic::Response<super::ObjectResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/datastore.DatastoreService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("datastore.DatastoreService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::KeyMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/datastore.DatastoreService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("datastore.DatastoreService", "Delete"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod datastore_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with DatastoreServiceServer.
#[async_trait]
pub trait DatastoreService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::KeyMessage>,
) -> std::result::Result<tonic::Response<super::ObjectResponse>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::UpdateMessage>,
) -> std::result::Result<tonic::Response<super::ObjectResponse>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::KeyMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct DatastoreServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> DatastoreServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for DatastoreServiceServer<T>
where
T: DatastoreService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/datastore.DatastoreService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: DatastoreService>(pub Arc<T>);
impl<
T: DatastoreService,
> tonic::server::UnaryService<super::KeyMessage> for GetSvc<T> {
type Response = super::ObjectResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::KeyMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DatastoreService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/datastore.DatastoreService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: DatastoreService>(pub Arc<T>);
impl<
T: DatastoreService,
> tonic::server::UnaryService<super::UpdateMessage>
for UpdateSvc<T> {
type Response = super::ObjectResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UpdateMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DatastoreService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/datastore.DatastoreService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: DatastoreService>(pub Arc<T>);
impl<
T: DatastoreService,
> tonic::server::UnaryService<super::KeyMessage> for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::KeyMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DatastoreService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for DatastoreServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "datastore.DatastoreService";
impl<T> tonic::server::NamedService for DatastoreServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

36
src/datastore/mod.rs Normal file
View File

@@ -0,0 +1,36 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct KeyMessage {
#[prost(string, tag="1")]
pub key: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UpdateMessage {
#[prost(string, tag="1")]
pub key: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub updates: ::core::option::Option<::prost_types::Struct>,
#[prost(message, optional, tag="3")]
pub deletes: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ObjectResponse {
#[prost(string, tag="1")]
pub key: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("datastore.tonic.rs");
// @@protoc_insertion_point(module)

297
src/dev/dev.tonic.rs Normal file
View File

@@ -0,0 +1,297 @@
// @generated
/// Generated client implementations.
pub mod dev_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct DevServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DevServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DevServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> DevServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
DevServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn validate(
&mut self,
request: impl tonic::IntoRequest<super::ApiValidationRequest>,
) -> std::result::Result<
tonic::Response<super::ApiValidationResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/dev.DevService/Validate");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("dev.DevService", "Validate"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod dev_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with DevServiceServer.
#[async_trait]
pub trait DevService: std::marker::Send + std::marker::Sync + 'static {
async fn validate(
&self,
request: tonic::Request<super::ApiValidationRequest>,
) -> std::result::Result<
tonic::Response<super::ApiValidationResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct DevServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> DevServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for DevServiceServer<T>
where
T: DevService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/dev.DevService/Validate" => {
#[allow(non_camel_case_types)]
struct ValidateSvc<T: DevService>(pub Arc<T>);
impl<
T: DevService,
> tonic::server::UnaryService<super::ApiValidationRequest>
for ValidateSvc<T> {
type Response = super::ApiValidationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ApiValidationRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DevService>::validate(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ValidateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for DevServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "dev.DevService";
impl<T> tonic::server::NamedService for DevServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

53
src/dev/mod.rs Normal file
View File

@@ -0,0 +1,53 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ApiValidationRequest {
#[prost(string, tag="1")]
pub service: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub permission: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub key: ::prost::alloc::string::String,
#[prost(string, tag="4")]
pub ip: ::prost::alloc::string::String,
#[prost(string, tag="5")]
pub resource: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ApiValidationResponse {
/// Response
#[prost(bool, tag="1")]
pub valid: bool,
#[prost(string, tag="2")]
pub error_message: ::prost::alloc::string::String,
#[prost(int32, tag="3")]
pub status_code: i32,
/// Remaining limits
#[prost(uint64, tag="4")]
pub remaining_burst: u64,
#[prost(uint64, tag="5")]
pub remaining_daily: u64,
#[prost(uint64, tag="6")]
pub remaining_monthly: u64,
/// Quota
#[prost(uint64, tag="7")]
pub burst_limit: u64,
#[prost(uint64, tag="8")]
pub burst_duration_seconds: u64,
#[prost(uint64, tag="9")]
pub daily_limit: u64,
#[prost(uint64, tag="10")]
pub monthly_limit: u64,
/// Owner info
#[prost(uint64, tag="11")]
#[serde(rename = "UserID")]
pub user_id: u64,
#[prost(string, tag="12")]
pub application: ::prost::alloc::string::String,
}
include!("dev.tonic.rs");
// @@protoc_insertion_point(module)

432
src/events/events.tonic.rs Normal file
View File

@@ -0,0 +1,432 @@
// @generated
/// Generated client implementations.
pub mod events_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct EventsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EventsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> EventsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> EventsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
EventsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn latest(
&mut self,
request: impl tonic::IntoRequest<super::LatestRequest>,
) -> std::result::Result<tonic::Response<super::LatestResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/events.EventsService/Latest",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("events.EventsService", "Latest"));
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::EventCreate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/events.EventsService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("events.EventsService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn clean(
&mut self,
request: impl tonic::IntoRequest<super::NullResponse>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/events.EventsService/Clean",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("events.EventsService", "Clean"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod events_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with EventsServiceServer.
#[async_trait]
pub trait EventsService: std::marker::Send + std::marker::Sync + 'static {
async fn latest(
&self,
request: tonic::Request<super::LatestRequest>,
) -> std::result::Result<tonic::Response<super::LatestResponse>, tonic::Status>;
async fn create(
&self,
request: tonic::Request<super::EventCreate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn clean(
&self,
request: tonic::Request<super::NullResponse>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct EventsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> EventsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for EventsServiceServer<T>
where
T: EventsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/events.EventsService/Latest" => {
#[allow(non_camel_case_types)]
struct LatestSvc<T: EventsService>(pub Arc<T>);
impl<
T: EventsService,
> tonic::server::UnaryService<super::LatestRequest>
for LatestSvc<T> {
type Response = super::LatestResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LatestRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventsService>::latest(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = LatestSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/events.EventsService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: EventsService>(pub Arc<T>);
impl<
T: EventsService,
> tonic::server::UnaryService<super::EventCreate> for CreateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::EventCreate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventsService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/events.EventsService/Clean" => {
#[allow(non_camel_case_types)]
struct CleanSvc<T: EventsService>(pub Arc<T>);
impl<
T: EventsService,
> tonic::server::UnaryService<super::NullResponse> for CleanSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::NullResponse>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EventsService>::clean(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CleanSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for EventsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "events.EventsService";
impl<T> tonic::server::NamedService for EventsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

69
src/events/mod.rs Normal file
View File

@@ -0,0 +1,69 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct EventCreate {
#[prost(string, tag="1")]
pub event: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub server: ::prost::alloc::string::String,
#[prost(int32, tag="3")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(int64, tag="4")]
pub date: i64,
#[prost(message, optional, tag="5")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct EventItem {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub event: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub server: ::prost::alloc::string::String,
#[prost(int32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(int64, tag="5")]
pub date: i64,
#[prost(message, optional, tag="6")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct LatestRequest {
#[prost(int64, optional, tag="1")]
pub date: ::core::option::Option<i64>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct LatestResponse {
#[prost(message, repeated, tag="1")]
pub events: ::prost::alloc::vec::Vec<EventItem>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("events.tonic.rs");
// @@protoc_insertion_point(module)

17
src/lib.rs Normal file
View File

@@ -0,0 +1,17 @@
pub mod auth;
pub mod bot_analyzer;
pub mod bots;
pub mod datastore;
pub mod dev;
pub mod events;
pub mod mapfixes;
pub mod maps;
pub mod maps_extended;
pub mod moderation;
pub mod ranks;
pub mod servers;
pub mod submissions;
pub mod times;
pub mod transactions;
pub mod users;
pub mod validator;

View File

@@ -0,0 +1,431 @@
// @generated
/// Generated client implementations.
pub mod mapfixes_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MapfixesServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MapfixesServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MapfixesServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MapfixesServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MapfixesServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::MapfixId>,
) -> std::result::Result<tonic::Response<super::MapfixResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/mapfixes.MapfixesService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("mapfixes.MapfixesService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::MapfixIdList>,
) -> std::result::Result<tonic::Response<super::MapfixList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/mapfixes.MapfixesService/GetList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("mapfixes.MapfixesService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapfixList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/mapfixes.MapfixesService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("mapfixes.MapfixesService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod mapfixes_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with MapfixesServiceServer.
#[async_trait]
pub trait MapfixesService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::MapfixId>,
) -> std::result::Result<tonic::Response<super::MapfixResponse>, tonic::Status>;
async fn get_list(
&self,
request: tonic::Request<super::MapfixIdList>,
) -> std::result::Result<tonic::Response<super::MapfixList>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapfixList>, tonic::Status>;
}
#[derive(Debug)]
pub struct MapfixesServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> MapfixesServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for MapfixesServiceServer<T>
where
T: MapfixesService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/mapfixes.MapfixesService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: MapfixesService>(pub Arc<T>);
impl<T: MapfixesService> tonic::server::UnaryService<super::MapfixId>
for GetSvc<T> {
type Response = super::MapfixResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapfixId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapfixesService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/mapfixes.MapfixesService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: MapfixesService>(pub Arc<T>);
impl<
T: MapfixesService,
> tonic::server::UnaryService<super::MapfixIdList>
for GetListSvc<T> {
type Response = super::MapfixList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapfixIdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapfixesService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/mapfixes.MapfixesService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: MapfixesService>(pub Arc<T>);
impl<
T: MapfixesService,
> tonic::server::UnaryService<super::ListRequest> for ListSvc<T> {
type Response = super::MapfixList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapfixesService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for MapfixesServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "mapfixes.MapfixesService";
impl<T> tonic::server::NamedService for MapfixesServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

162
src/mapfixes/mod.rs Normal file
View File

@@ -0,0 +1,162 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixIdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixId {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub creator: ::prost::alloc::string::String,
#[prost(uint32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(int64, tag="5")]
pub created_at: i64,
#[prost(int64, tag="6")]
pub updated_at: i64,
#[prost(uint64, tag="7")]
pub submitter: u64,
#[prost(uint64, tag="8")]
pub asset_id: u64,
#[prost(uint64, tag="9")]
pub asset_version: u64,
#[prost(uint64, optional, tag="10")]
pub validated_asset_id: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="11")]
pub validated_asset_version: ::core::option::Option<u64>,
#[prost(uint64, tag="12")]
pub target_asset_id: u64,
#[prost(enumeration="MapfixStatus", tag="13")]
pub status_id: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixFilter {
#[prost(enumeration="MapfixStatus", optional, tag="1")]
pub status_id: ::core::option::Option<i32>,
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="3")]
pub creator: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<u32>,
#[prost(uint64, optional, tag="5")]
pub submitter: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixList {
#[prost(message, repeated, tag="1")]
pub mapfixes: ::prost::alloc::vec::Vec<MapfixResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<MapfixFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(uint32, tag="1")]
pub size: u32,
#[prost(uint32, tag="2")]
pub number: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MapfixStatus {
/// Phase: Creation
UnderConstruction = 0,
ChangesRequested = 1,
/// Phase: Review
Submitting = 2,
Submitted = 3,
/// Phase: Testing
///
/// pending script review, can re-trigger validation
AcceptedUnvalidated = 4,
Validating = 5,
Validated = 6,
Uploading = 7,
/// uploaded to the group, but pending release
Uploaded = 8,
Releasing = 11,
/// Phase: Final MapfixStatus
Rejected = 9,
Released = 10,
}
impl MapfixStatus {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::UnderConstruction => "MapfixStatusUnderConstruction",
Self::ChangesRequested => "MapfixStatusChangesRequested",
Self::Submitting => "MapfixStatusSubmitting",
Self::Submitted => "MapfixStatusSubmitted",
Self::AcceptedUnvalidated => "MapfixStatusAcceptedUnvalidated",
Self::Validating => "MapfixStatusValidating",
Self::Validated => "MapfixStatusValidated",
Self::Uploading => "MapfixStatusUploading",
Self::Uploaded => "MapfixStatusUploaded",
Self::Releasing => "MapfixStatusReleasing",
Self::Rejected => "MapfixStatusRejected",
Self::Released => "MapfixStatusReleased",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MapfixStatusUnderConstruction" => Some(Self::UnderConstruction),
"MapfixStatusChangesRequested" => Some(Self::ChangesRequested),
"MapfixStatusSubmitting" => Some(Self::Submitting),
"MapfixStatusSubmitted" => Some(Self::Submitted),
"MapfixStatusAcceptedUnvalidated" => Some(Self::AcceptedUnvalidated),
"MapfixStatusValidating" => Some(Self::Validating),
"MapfixStatusValidated" => Some(Self::Validated),
"MapfixStatusUploading" => Some(Self::Uploading),
"MapfixStatusUploaded" => Some(Self::Uploaded),
"MapfixStatusReleasing" => Some(Self::Releasing),
"MapfixStatusRejected" => Some(Self::Rejected),
"MapfixStatusReleased" => Some(Self::Released),
_ => None,
}
}
}
include!("mapfixes.tonic.rs");
// @@protoc_insertion_point(module)

614
src/maps/maps.tonic.rs Normal file
View File

@@ -0,0 +1,614 @@
// @generated
/// Generated client implementations.
pub mod maps_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MapsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MapsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MapsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MapsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MapsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::MapResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::IdList>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/GetList");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::MapRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/Update");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::MapRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/Create");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/Delete");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/maps.MapsService/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("maps.MapsService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod maps_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with MapsServiceServer.
#[async_trait]
pub trait MapsService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::MapResponse>, tonic::Status>;
async fn get_list(
&self,
request: tonic::Request<super::IdList>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::MapRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn create(
&self,
request: tonic::Request<super::MapRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status>;
}
#[derive(Debug)]
pub struct MapsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> MapsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for MapsServiceServer<T>
where
T: MapsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/maps.MapsService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::IdMessage>
for GetSvc<T> {
type Response = super::MapResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps.MapsService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::IdList>
for GetListSvc<T> {
type Response = super::MapList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps.MapsService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapRequest>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps.MapsService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapRequest>
for CreateSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps.MapsService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps.MapsService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::MapList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for MapsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "maps.MapsService";
impl<T> tonic::server::NamedService for MapsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

90
src/maps/mod.rs Normal file
View File

@@ -0,0 +1,90 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(int32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(uint64, tag="6")]
pub thumbnail: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapRequest {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<i32>,
#[prost(uint64, optional, tag="6")]
pub thumbnail: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapFilter {
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapList {
#[prost(message, repeated, tag="1")]
pub maps: ::prost::alloc::vec::Vec<MapResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<MapFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("maps.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,777 @@
// @generated
/// Generated client implementations.
pub mod maps_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MapsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MapsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MapsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MapsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MapsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::MapId>,
) -> std::result::Result<tonic::Response<super::MapResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::MapIdList>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/GetList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::MapUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::MapCreate>,
) -> std::result::Result<tonic::Response<super::MapId>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::MapId>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("maps_extended.MapsService", "List"));
self.inner.unary(req, path, codec).await
}
pub async fn increment_load_count(
&mut self,
request: impl tonic::IntoRequest<super::MapId>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/IncrementLoadCount",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("maps_extended.MapsService", "IncrementLoadCount"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_snfm_download_url(
&mut self,
request: impl tonic::IntoRequest<super::MapId>,
) -> std::result::Result<
tonic::Response<super::SnfmDownloadUrl>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/maps_extended.MapsService/GetSnfmDownloadUrl",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("maps_extended.MapsService", "GetSnfmDownloadUrl"),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod maps_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with MapsServiceServer.
#[async_trait]
pub trait MapsService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::MapId>,
) -> std::result::Result<tonic::Response<super::MapResponse>, tonic::Status>;
async fn get_list(
&self,
request: tonic::Request<super::MapIdList>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::MapUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn create(
&self,
request: tonic::Request<super::MapCreate>,
) -> std::result::Result<tonic::Response<super::MapId>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::MapId>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::MapList>, tonic::Status>;
async fn increment_load_count(
&self,
request: tonic::Request<super::MapId>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn get_snfm_download_url(
&self,
request: tonic::Request<super::MapId>,
) -> std::result::Result<tonic::Response<super::SnfmDownloadUrl>, tonic::Status>;
}
#[derive(Debug)]
pub struct MapsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> MapsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for MapsServiceServer<T>
where
T: MapsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/maps_extended.MapsService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapId>
for GetSvc<T> {
type Response = super::MapResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapIdList>
for GetListSvc<T> {
type Response = super::MapList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapIdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapUpdate>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapUpdate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapCreate>
for CreateSvc<T> {
type Response = super::MapId;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapCreate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapId>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::MapList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/IncrementLoadCount" => {
#[allow(non_camel_case_types)]
struct IncrementLoadCountSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapId>
for IncrementLoadCountSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::increment_load_count(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = IncrementLoadCountSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/maps_extended.MapsService/GetSnfmDownloadUrl" => {
#[allow(non_camel_case_types)]
struct GetSnfmDownloadUrlSvc<T: MapsService>(pub Arc<T>);
impl<T: MapsService> tonic::server::UnaryService<super::MapId>
for GetSnfmDownloadUrlSvc<T> {
type Response = super::SnfmDownloadUrl;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MapId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as MapsService>::get_snfm_download_url(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSnfmDownloadUrlSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for MapsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "maps_extended.MapsService";
impl<T> tonic::server::NamedService for MapsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

155
src/maps_extended/mod.rs Normal file
View File

@@ -0,0 +1,155 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SnfmDownloadUrl {
#[prost(string, tag="1")]
pub url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapIdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapId {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub creator: ::prost::alloc::string::String,
#[prost(uint32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(int64, tag="5")]
pub date: i64,
#[prost(int64, tag="6")]
pub created_at: i64,
#[prost(int64, tag="7")]
pub updated_at: i64,
#[prost(uint64, tag="8")]
pub submitter: u64,
#[prost(uint64, tag="9")]
pub thumbnail: u64,
#[prost(uint64, tag="10")]
pub asset_version: u64,
#[prost(uint32, tag="11")]
pub load_count: u32,
#[prost(uint32, tag="12")]
pub modes: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapCreate {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub creator: ::prost::alloc::string::String,
#[prost(uint32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(int64, tag="5")]
pub date: i64,
/// int64 CreatedAt = 6;
/// int64 UpdatedAt = 7;
#[prost(uint64, tag="6")]
pub submitter: u64,
#[prost(uint64, tag="7")]
pub thumbnail: u64,
#[prost(uint64, tag="8")]
pub asset_version: u64,
/// uint32 LoadCount = 11;
#[prost(uint32, tag="9")]
pub modes: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapUpdate {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="3")]
pub creator: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<u32>,
#[prost(int64, optional, tag="5")]
pub date: ::core::option::Option<i64>,
#[prost(uint64, optional, tag="6")]
pub submitter: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="7")]
pub thumbnail: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="8")]
pub asset_version: ::core::option::Option<u64>,
#[prost(uint32, optional, tag="9")]
pub modes: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapFilter {
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="3")]
pub creator: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<u32>,
#[prost(uint64, optional, tag="5")]
pub submitter: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapList {
#[prost(message, repeated, tag="1")]
pub maps: ::prost::alloc::vec::Vec<MapResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<MapFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(uint32, tag="1")]
pub size: u32,
#[prost(uint32, tag="2")]
pub number: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("maps_extended.tonic.rs");
// @@protoc_insertion_point(module)

44
src/moderation/mod.rs Normal file
View File

@@ -0,0 +1,44 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Null {
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SetStateRequest {
#[prost(int64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: i64,
#[prost(int64, tag="2")]
pub moderator_id: i64,
#[prost(int32, tag="3")]
pub reason_id: i32,
#[prost(int32, tag="4")]
#[serde(rename = "StateID")]
pub state_id: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SetMuteRequest {
#[prost(int64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: i64,
#[prost(int64, tag="2")]
pub moderator_id: i64,
#[prost(bool, tag="3")]
pub muted: bool,
#[prost(int64, optional, tag="4")]
pub duration: ::core::option::Option<i64>,
#[prost(int32, optional, tag="5")]
pub reason_id: ::core::option::Option<i32>,
#[prost(string, optional, tag="6")]
pub reason_text: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag="7")]
pub metadata: ::core::option::Option<::prost_types::Struct>,
}
include!("moderation.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,364 @@
// @generated
/// Generated client implementations.
pub mod moderation_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ModerationServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ModerationServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ModerationServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ModerationServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ModerationServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn set_state(
&mut self,
request: impl tonic::IntoRequest<super::SetStateRequest>,
) -> std::result::Result<tonic::Response<super::Null>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/moderation.ModerationService/SetState",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("moderation.ModerationService", "SetState"));
self.inner.unary(req, path, codec).await
}
pub async fn set_muted(
&mut self,
request: impl tonic::IntoRequest<super::SetMuteRequest>,
) -> std::result::Result<tonic::Response<super::Null>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/moderation.ModerationService/SetMuted",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("moderation.ModerationService", "SetMuted"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod moderation_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with ModerationServiceServer.
#[async_trait]
pub trait ModerationService: std::marker::Send + std::marker::Sync + 'static {
async fn set_state(
&self,
request: tonic::Request<super::SetStateRequest>,
) -> std::result::Result<tonic::Response<super::Null>, tonic::Status>;
async fn set_muted(
&self,
request: tonic::Request<super::SetMuteRequest>,
) -> std::result::Result<tonic::Response<super::Null>, tonic::Status>;
}
#[derive(Debug)]
pub struct ModerationServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ModerationServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ModerationServiceServer<T>
where
T: ModerationService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/moderation.ModerationService/SetState" => {
#[allow(non_camel_case_types)]
struct SetStateSvc<T: ModerationService>(pub Arc<T>);
impl<
T: ModerationService,
> tonic::server::UnaryService<super::SetStateRequest>
for SetStateSvc<T> {
type Response = super::Null;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetStateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ModerationService>::set_state(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetStateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/moderation.ModerationService/SetMuted" => {
#[allow(non_camel_case_types)]
struct SetMutedSvc<T: ModerationService>(pub Arc<T>);
impl<
T: ModerationService,
> tonic::server::UnaryService<super::SetMuteRequest>
for SetMutedSvc<T> {
type Response = super::Null;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetMuteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ModerationService>::set_muted(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetMutedSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for ModerationServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "moderation.ModerationService";
impl<T> tonic::server::NamedService for ModerationServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

99
src/ranks/mod.rs Normal file
View File

@@ -0,0 +1,99 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GetRequest {
#[prost(int64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: i64,
#[prost(int32, tag="2")]
#[serde(rename = "StyleID")]
pub style_id: i32,
#[prost(int32, tag="3")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(int32, tag="4")]
#[serde(rename = "ModeID")]
pub mode_id: i32,
#[prost(int32, repeated, tag="5")]
#[serde(rename = "StateID")]
pub state_id: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(int32, tag="1")]
#[serde(rename = "StyleID")]
pub style_id: i32,
#[prost(int32, tag="2")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(int32, tag="3")]
#[serde(rename = "ModeID")]
pub mode_id: i32,
#[prost(int64, tag="4")]
pub sort: i64,
#[prost(int32, repeated, tag="5")]
#[serde(rename = "StateID")]
pub state_id: ::prost::alloc::vec::Vec<i32>,
#[prost(message, optional, tag="6")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RankList {
#[prost(message, repeated, tag="1")]
pub ranks: ::prost::alloc::vec::Vec<RankMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RankMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(message, optional, tag="2")]
pub user: ::core::option::Option<super::users::UserResponse>,
#[prost(int32, tag="3")]
#[serde(rename = "StyleID")]
pub style_id: i32,
#[prost(int32, tag="4")]
#[serde(rename = "ModeID")]
pub mode_id: i32,
#[prost(int32, tag="5")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(double, tag="6")]
pub rank: f64,
#[prost(double, tag="7")]
pub skill: f64,
#[prost(int64, tag="8")]
pub updated_at: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("ranks.tonic.rs");
// @@protoc_insertion_point(module)

421
src/ranks/ranks.tonic.rs Normal file
View File

@@ -0,0 +1,421 @@
// @generated
/// Generated client implementations.
pub mod ranks_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct RanksServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RanksServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> RanksServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> RanksServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
RanksServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::GetRequest>,
) -> std::result::Result<tonic::Response<super::RankMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/ranks.RanksService/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("ranks.RanksService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::RankList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/ranks.RanksService/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("ranks.RanksService", "List"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/ranks.RanksService/Delete",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("ranks.RanksService", "Delete"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod ranks_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with RanksServiceServer.
#[async_trait]
pub trait RanksService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::GetRequest>,
) -> std::result::Result<tonic::Response<super::RankMessage>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::RankList>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
}
#[derive(Debug)]
pub struct RanksServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> RanksServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for RanksServiceServer<T>
where
T: RanksService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/ranks.RanksService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: RanksService>(pub Arc<T>);
impl<T: RanksService> tonic::server::UnaryService<super::GetRequest>
for GetSvc<T> {
type Response = super::RankMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as RanksService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ranks.RanksService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: RanksService>(pub Arc<T>);
impl<T: RanksService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::RankList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as RanksService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/ranks.RanksService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: RanksService>(pub Arc<T>);
impl<T: RanksService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as RanksService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for RanksServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "ranks.RanksService";
impl<T> tonic::server::NamedService for RanksServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

140
src/servers/mod.rs Normal file
View File

@@ -0,0 +1,140 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerList {
#[prost(message, repeated, tag="1")]
pub servers: ::prost::alloc::vec::Vec<ServerItem>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerCreate {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(int64, tag="2")]
#[serde(rename = "PlaceID")]
pub place_id: i64,
#[prost(int64, tag="3")]
pub start_time: i64,
#[prost(string, tag="4")]
#[serde(rename = "VipServerID")]
pub vip_server_id: ::prost::alloc::string::String,
#[prost(int64, tag="5")]
#[serde(rename = "UserID")]
pub user_id: i64,
#[prost(int32, tag="6")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(int64, tag="7")]
#[serde(rename = "MapID")]
pub map_id: i64,
#[prost(int64, tag="8")]
pub map_date: i64,
#[prost(int64, repeated, tag="9")]
pub player_list: ::prost::alloc::vec::Vec<i64>,
#[prost(int64, tag="10")]
pub last_update: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerItem {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(int64, tag="2")]
#[serde(rename = "PlaceID")]
pub place_id: i64,
#[prost(int64, tag="3")]
pub start_time: i64,
#[prost(string, tag="4")]
#[serde(rename = "VipServerID")]
pub vip_server_id: ::prost::alloc::string::String,
#[prost(message, optional, tag="5")]
pub user: ::core::option::Option<super::users::UserResponse>,
#[prost(int32, tag="6")]
#[serde(rename = "GameID")]
pub game_id: i32,
#[prost(message, optional, tag="7")]
pub map: ::core::option::Option<super::maps::MapResponse>,
#[prost(int64, tag="8")]
pub map_date: i64,
#[prost(int64, repeated, tag="9")]
pub player_list: ::prost::alloc::vec::Vec<i64>,
#[prost(int64, tag="10")]
pub last_update: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerUpdate {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(int64, optional, tag="2")]
#[serde(rename = "MapID")]
pub map_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="3")]
pub map_date: ::core::option::Option<i64>,
#[prost(int64, repeated, tag="4")]
pub player_list: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerFilter {
#[prost(string, optional, tag="1")]
#[serde(rename = "ID")]
pub id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag="2")]
#[serde(rename = "PlaceID")]
pub place_id: ::core::option::Option<i64>,
#[prost(string, optional, tag="4")]
#[serde(rename = "VipServerID")]
pub vip_server_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag="5")]
#[serde(rename = "UserID")]
pub user_id: ::core::option::Option<i64>,
#[prost(int32, optional, tag="6")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<i32>,
#[prost(int64, optional, tag="7")]
#[serde(rename = "MapID")]
pub map_id: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ServerListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<ServerFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("servers.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,567 @@
// @generated
/// Generated client implementations.
pub mod server_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ServerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ServerServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ServerServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ServerServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ServerServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::ServerCreate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/servers.ServerService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("servers.ServerService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::ServerUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/servers.ServerService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("servers.ServerService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/servers.ServerService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("servers.ServerService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::ServerItem>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/servers.ServerService/Get",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("servers.ServerService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ServerListRequest>,
) -> std::result::Result<tonic::Response<super::ServerList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/servers.ServerService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("servers.ServerService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod server_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with ServerServiceServer.
#[async_trait]
pub trait ServerService: std::marker::Send + std::marker::Sync + 'static {
async fn create(
&self,
request: tonic::Request<super::ServerCreate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::ServerUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::ServerItem>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ServerListRequest>,
) -> std::result::Result<tonic::Response<super::ServerList>, tonic::Status>;
}
#[derive(Debug)]
pub struct ServerServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> ServerServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for ServerServiceServer<T>
where
T: ServerService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/servers.ServerService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: ServerService>(pub Arc<T>);
impl<
T: ServerService,
> tonic::server::UnaryService<super::ServerCreate> for CreateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ServerCreate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ServerService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/servers.ServerService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: ServerService>(pub Arc<T>);
impl<
T: ServerService,
> tonic::server::UnaryService<super::ServerUpdate> for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ServerUpdate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ServerService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/servers.ServerService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: ServerService>(pub Arc<T>);
impl<T: ServerService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ServerService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/servers.ServerService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: ServerService>(pub Arc<T>);
impl<T: ServerService> tonic::server::UnaryService<super::IdMessage>
for GetSvc<T> {
type Response = super::ServerItem;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ServerService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/servers.ServerService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: ServerService>(pub Arc<T>);
impl<
T: ServerService,
> tonic::server::UnaryService<super::ServerListRequest>
for ListSvc<T> {
type Response = super::ServerList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ServerListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ServerService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for ServerServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "servers.ServerService";
impl<T> tonic::server::NamedService for ServerServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

159
src/submissions/mod.rs Normal file
View File

@@ -0,0 +1,159 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionIdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionId {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub creator: ::prost::alloc::string::String,
#[prost(uint32, tag="4")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(int64, tag="7")]
pub created_at: i64,
#[prost(int64, tag="8")]
pub updated_at: i64,
#[prost(uint64, tag="9")]
pub submitter: u64,
#[prost(uint64, tag="10")]
pub asset_id: u64,
#[prost(uint64, tag="11")]
pub asset_version: u64,
#[prost(uint64, optional, tag="12")]
pub validated_asset_id: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="13")]
pub validated_asset_version: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="14")]
pub uploaded_asset_id: ::core::option::Option<u64>,
#[prost(enumeration="SubmissionStatus", tag="15")]
pub status_id: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionFilter {
#[prost(enumeration="SubmissionStatus", optional, tag="1")]
pub status_id: ::core::option::Option<i32>,
#[prost(string, optional, tag="2")]
pub display_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="3")]
pub creator: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag="4")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<u32>,
#[prost(uint64, optional, tag="5")]
pub submitter: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionList {
#[prost(message, repeated, tag="1")]
pub submissions: ::prost::alloc::vec::Vec<SubmissionResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<SubmissionFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(uint32, tag="1")]
pub size: u32,
#[prost(uint32, tag="2")]
pub number: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SubmissionStatus {
/// Phase: Creation
UnderConstruction = 0,
ChangesRequested = 1,
/// Phase: Review
Submitting = 2,
Submitted = 3,
/// Phase: Testing
///
/// pending script review, can re-trigger validation
AcceptedUnvalidated = 4,
Validating = 5,
Validated = 6,
Uploading = 7,
/// uploaded to the group, but pending release
Uploaded = 8,
/// Phase: Final SubmissionStatus
Rejected = 9,
Released = 10,
}
impl SubmissionStatus {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::UnderConstruction => "SubmissionStatusUnderConstruction",
Self::ChangesRequested => "SubmissionStatusChangesRequested",
Self::Submitting => "SubmissionStatusSubmitting",
Self::Submitted => "SubmissionStatusSubmitted",
Self::AcceptedUnvalidated => "SubmissionStatusAcceptedUnvalidated",
Self::Validating => "SubmissionStatusValidating",
Self::Validated => "SubmissionStatusValidated",
Self::Uploading => "SubmissionStatusUploading",
Self::Uploaded => "SubmissionStatusUploaded",
Self::Rejected => "SubmissionStatusRejected",
Self::Released => "SubmissionStatusReleased",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SubmissionStatusUnderConstruction" => Some(Self::UnderConstruction),
"SubmissionStatusChangesRequested" => Some(Self::ChangesRequested),
"SubmissionStatusSubmitting" => Some(Self::Submitting),
"SubmissionStatusSubmitted" => Some(Self::Submitted),
"SubmissionStatusAcceptedUnvalidated" => Some(Self::AcceptedUnvalidated),
"SubmissionStatusValidating" => Some(Self::Validating),
"SubmissionStatusValidated" => Some(Self::Validated),
"SubmissionStatusUploading" => Some(Self::Uploading),
"SubmissionStatusUploaded" => Some(Self::Uploaded),
"SubmissionStatusRejected" => Some(Self::Rejected),
"SubmissionStatusReleased" => Some(Self::Released),
_ => None,
}
}
}
include!("submissions.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,438 @@
// @generated
/// Generated client implementations.
pub mod submissions_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct SubmissionsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SubmissionsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SubmissionsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SubmissionsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SubmissionsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::SubmissionId>,
) -> std::result::Result<
tonic::Response<super::SubmissionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/submissions.SubmissionsService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("submissions.SubmissionsService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::SubmissionIdList>,
) -> std::result::Result<tonic::Response<super::SubmissionList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/submissions.SubmissionsService/GetList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("submissions.SubmissionsService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::SubmissionList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/submissions.SubmissionsService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("submissions.SubmissionsService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod submissions_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with SubmissionsServiceServer.
#[async_trait]
pub trait SubmissionsService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::SubmissionId>,
) -> std::result::Result<
tonic::Response<super::SubmissionResponse>,
tonic::Status,
>;
async fn get_list(
&self,
request: tonic::Request<super::SubmissionIdList>,
) -> std::result::Result<tonic::Response<super::SubmissionList>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::SubmissionList>, tonic::Status>;
}
#[derive(Debug)]
pub struct SubmissionsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SubmissionsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SubmissionsServiceServer<T>
where
T: SubmissionsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/submissions.SubmissionsService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: SubmissionsService>(pub Arc<T>);
impl<
T: SubmissionsService,
> tonic::server::UnaryService<super::SubmissionId> for GetSvc<T> {
type Response = super::SubmissionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubmissionId>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SubmissionsService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/submissions.SubmissionsService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: SubmissionsService>(pub Arc<T>);
impl<
T: SubmissionsService,
> tonic::server::UnaryService<super::SubmissionIdList>
for GetListSvc<T> {
type Response = super::SubmissionList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubmissionIdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SubmissionsService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/submissions.SubmissionsService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: SubmissionsService>(pub Arc<T>);
impl<
T: SubmissionsService,
> tonic::server::UnaryService<super::ListRequest> for ListSvc<T> {
type Response = super::SubmissionList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SubmissionsService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for SubmissionsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "submissions.SubmissionsService";
impl<T> tonic::server::NamedService for SubmissionsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

168
src/times/mod.rs Normal file
View File

@@ -0,0 +1,168 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimeRequest {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(int64, optional, tag="2")]
pub time: ::core::option::Option<i64>,
#[prost(int64, optional, tag="3")]
#[serde(rename = "UserID")]
pub user_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="4")]
#[serde(rename = "MapID")]
pub map_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="5")]
pub date: ::core::option::Option<i64>,
#[prost(int32, optional, tag="6")]
#[serde(rename = "StyleID")]
pub style_id: ::core::option::Option<i32>,
#[prost(int32, optional, tag="7")]
#[serde(rename = "ModeID")]
pub mode_id: ::core::option::Option<i32>,
#[prost(int32, optional, tag="8")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<i32>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimeFilter {
#[prost(int64, optional, tag="1")]
#[serde(rename = "ID")]
pub id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="2")]
pub time: ::core::option::Option<i64>,
#[prost(int64, optional, tag="3")]
#[serde(rename = "UserID")]
pub user_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="4")]
#[serde(rename = "MapID")]
pub map_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag="5")]
pub date: ::core::option::Option<i64>,
#[prost(int32, optional, tag="6")]
#[serde(rename = "StyleID")]
pub style_id: ::core::option::Option<i32>,
#[prost(int32, optional, tag="7")]
#[serde(rename = "ModeID")]
pub mode_id: ::core::option::Option<i32>,
#[prost(int32, optional, tag="8")]
#[serde(rename = "GameID")]
pub game_id: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimeResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(int64, tag="2")]
pub time: i64,
#[prost(message, optional, tag="3")]
pub user: ::core::option::Option<super::users::UserResponse>,
#[prost(message, optional, tag="4")]
pub map: ::core::option::Option<super::maps::MapResponse>,
#[prost(message, optional, tag="5")]
pub bot: ::core::option::Option<super::bots::BotResponse>,
#[prost(int64, tag="6")]
pub date: i64,
#[prost(int32, tag="7")]
#[serde(rename = "StyleID")]
pub style_id: i32,
#[prost(int32, tag="8")]
#[serde(rename = "ModeID")]
pub mode_id: i32,
#[prost(int32, tag="9")]
#[serde(rename = "GameID")]
pub game_id: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdListMessage {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TimeList {
#[prost(message, repeated, tag="1")]
pub times: ::prost::alloc::vec::Vec<TimeResponse>,
#[prost(int64, tag="2")]
pub total: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RankListResponse {
#[prost(message, repeated, tag="1")]
pub ranks: ::prost::alloc::vec::Vec<RankResponse>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RankResponse {
#[prost(int64, tag="1")]
pub rank: i64,
#[prost(int64, tag="2")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<TimeFilter>,
#[prost(bool, tag="2")]
pub blacklisted: bool,
#[prost(message, optional, tag="3")]
pub page: ::core::option::Option<Pagination>,
///
/// 0 - time ASC
/// 1 - time DSC
/// 2 - date ASC
/// 3 - date DSC
#[prost(uint32, tag="4")]
pub sort: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct WrListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<TimeFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("times.tonic.rs");
// @@protoc_insertion_point(module)

765
src/times/times.tonic.rs Normal file
View File

@@ -0,0 +1,765 @@
// @generated
/// Generated client implementations.
pub mod times_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TimesServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TimesServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TimesServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TimesServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TimesServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::TimeRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/times.TimesService/Create",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::TimeRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/times.TimesService/Update",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/times.TimesService/Delete",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::TimeResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/times.TimesService/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::TimeList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/times.TimesService/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "List"));
self.inner.unary(req, path, codec).await
}
pub async fn list_wr(
&mut self,
request: impl tonic::IntoRequest<super::WrListRequest>,
) -> std::result::Result<tonic::Response<super::TimeList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/times.TimesService/ListWr",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "ListWr"));
self.inner.unary(req, path, codec).await
}
pub async fn rank(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::RankResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/times.TimesService/Rank");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("times.TimesService", "Rank"));
self.inner.unary(req, path, codec).await
}
pub async fn rank_batch(
&mut self,
request: impl tonic::IntoRequest<super::IdListMessage>,
) -> std::result::Result<
tonic::Response<super::RankListResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/times.TimesService/RankBatch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("times.TimesService", "RankBatch"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod times_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with TimesServiceServer.
#[async_trait]
pub trait TimesService: std::marker::Send + std::marker::Sync + 'static {
async fn create(
&self,
request: tonic::Request<super::TimeRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::TimeRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::TimeResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::TimeList>, tonic::Status>;
async fn list_wr(
&self,
request: tonic::Request<super::WrListRequest>,
) -> std::result::Result<tonic::Response<super::TimeList>, tonic::Status>;
async fn rank(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::RankResponse>, tonic::Status>;
async fn rank_batch(
&self,
request: tonic::Request<super::IdListMessage>,
) -> std::result::Result<
tonic::Response<super::RankListResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct TimesServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TimesServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TimesServiceServer<T>
where
T: TimesService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/times.TimesService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::TimeRequest>
for CreateSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TimeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::TimeRequest>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TimeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::IdMessage>
for GetSvc<T> {
type Response = super::TimeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::TimeList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/ListWr" => {
#[allow(non_camel_case_types)]
struct ListWrSvc<T: TimesService>(pub Arc<T>);
impl<
T: TimesService,
> tonic::server::UnaryService<super::WrListRequest>
for ListWrSvc<T> {
type Response = super::TimeList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::WrListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::list_wr(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListWrSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/Rank" => {
#[allow(non_camel_case_types)]
struct RankSvc<T: TimesService>(pub Arc<T>);
impl<T: TimesService> tonic::server::UnaryService<super::IdMessage>
for RankSvc<T> {
type Response = super::RankResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::rank(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RankSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/times.TimesService/RankBatch" => {
#[allow(non_camel_case_types)]
struct RankBatchSvc<T: TimesService>(pub Arc<T>);
impl<
T: TimesService,
> tonic::server::UnaryService<super::IdListMessage>
for RankBatchSvc<T> {
type Response = super::RankListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdListMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TimesService>::rank_batch(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RankBatchSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TimesServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "times.TimesService";
impl<T> tonic::server::NamedService for TimesServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

122
src/transactions/mod.rs Normal file
View File

@@ -0,0 +1,122 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TransactionCreate {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(int64, tag="2")]
#[serde(rename = "UserID")]
pub user_id: i64,
#[prost(int64, tag="3")]
pub value: i64,
#[prost(int32, tag="4")]
#[serde(rename = "StateID")]
pub state_id: i32,
#[prost(message, optional, tag="5")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TransactionUpdate {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(int64, optional, tag="2")]
pub value: ::core::option::Option<i64>,
#[prost(int32, optional, tag="3")]
#[serde(rename = "StateID")]
pub state_id: ::core::option::Option<i32>,
#[prost(message, optional, tag="4")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TransactionItem {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub user: ::core::option::Option<super::users::UserResponse>,
#[prost(int64, tag="3")]
pub value: i64,
#[prost(int32, tag="4")]
#[serde(rename = "StateID")]
pub state_id: i32,
#[prost(int64, tag="5")]
pub created: i64,
#[prost(int64, tag="6")]
pub updated: i64,
#[prost(message, optional, tag="7")]
pub data: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TransactionFilter {
#[prost(int64, optional, tag="1")]
#[serde(rename = "UserID")]
pub user_id: ::core::option::Option<i64>,
#[prost(int32, optional, tag="2")]
#[serde(rename = "StateID")]
pub state_id: ::core::option::Option<i32>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<TransactionFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TransactionList {
#[prost(message, repeated, tag="1")]
pub transactions: ::prost::alloc::vec::Vec<TransactionItem>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BalanceResponse {
#[prost(int64, tag="1")]
pub balance: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(string, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UserIdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "UserID")]
pub user_id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("transactions.tonic.rs");
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,650 @@
// @generated
/// Generated client implementations.
pub mod transactions_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TransactionsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TransactionsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TransactionsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TransactionsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TransactionsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::TransactionCreate>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::TransactionUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn balance(
&mut self,
request: impl tonic::IntoRequest<super::UserIdMessage>,
) -> std::result::Result<
tonic::Response<super::BalanceResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/Balance",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "Balance"));
self.inner.unary(req, path, codec).await
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<
tonic::Response<super::TransactionItem>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<
tonic::Response<super::TransactionList>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/transactions.TransactionsService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("transactions.TransactionsService", "List"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod transactions_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with TransactionsServiceServer.
#[async_trait]
pub trait TransactionsService: std::marker::Send + std::marker::Sync + 'static {
async fn create(
&self,
request: tonic::Request<super::TransactionCreate>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::TransactionUpdate>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn balance(
&self,
request: tonic::Request<super::UserIdMessage>,
) -> std::result::Result<tonic::Response<super::BalanceResponse>, tonic::Status>;
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::TransactionItem>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::TransactionList>, tonic::Status>;
}
#[derive(Debug)]
pub struct TransactionsServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TransactionsServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TransactionsServiceServer<T>
where
T: TransactionsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/transactions.TransactionsService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::TransactionCreate>
for CreateSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TransactionCreate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/transactions.TransactionsService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::TransactionUpdate>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TransactionUpdate>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/transactions.TransactionsService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::IdMessage> for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/transactions.TransactionsService/Balance" => {
#[allow(non_camel_case_types)]
struct BalanceSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::UserIdMessage>
for BalanceSvc<T> {
type Response = super::BalanceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UserIdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::balance(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = BalanceSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/transactions.TransactionsService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::IdMessage> for GetSvc<T> {
type Response = super::TransactionItem;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/transactions.TransactionsService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: TransactionsService>(pub Arc<T>);
impl<
T: TransactionsService,
> tonic::server::UnaryService<super::ListRequest> for ListSvc<T> {
type Response = super::TransactionList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TransactionsService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TransactionsServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "transactions.TransactionsService";
impl<T> tonic::server::NamedService for TransactionsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

102
src/users/mod.rs Normal file
View File

@@ -0,0 +1,102 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdList {
#[prost(int64, repeated, tag="1")]
#[serde(rename = "ID")]
pub id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct IdMessage {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UserResponse {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, tag="2")]
pub username: ::prost::alloc::string::String,
#[prost(int32, tag="3")]
#[serde(rename = "StateID")]
pub state_id: i32,
#[prost(bool, tag="4")]
pub muted: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UserRequest {
#[prost(int64, tag="1")]
#[serde(rename = "ID")]
pub id: i64,
#[prost(string, optional, tag="2")]
pub username: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag="3")]
#[serde(rename = "StateID")]
pub state_id: ::core::option::Option<i32>,
#[prost(bool, optional, tag="4")]
pub muted: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UserFilter {
#[prost(int64, optional, tag="1")]
#[serde(rename = "ID")]
pub id: ::core::option::Option<i64>,
#[prost(string, optional, tag="2")]
pub username: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag="3")]
#[serde(rename = "StateID")]
pub state_id: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct UserList {
#[prost(message, repeated, tag="1")]
pub users: ::prost::alloc::vec::Vec<UserResponse>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<UserFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(int32, tag="1")]
pub size: i32,
#[prost(int32, tag="2")]
pub number: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SearchByUsernameRequest {
#[prost(string, tag="1")]
pub query: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
include!("users.tonic.rs");
// @@protoc_insertion_point(module)

694
src/users/users.tonic.rs Normal file
View File

@@ -0,0 +1,694 @@
// @generated
/// Generated client implementations.
pub mod users_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct UsersServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl UsersServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> UsersServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> UsersServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
UsersServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::UserResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/users.UsersService/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("users.UsersService", "Get"));
self.inner.unary(req, path, codec).await
}
pub async fn get_list(
&mut self,
request: impl tonic::IntoRequest<super::IdList>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/users.UsersService/GetList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("users.UsersService", "GetList"));
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::UserRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/users.UsersService/Update",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("users.UsersService", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::UserRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/users.UsersService/Create",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("users.UsersService", "Create"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/users.UsersService/Delete",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("users.UsersService", "Delete"));
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/users.UsersService/List");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("users.UsersService", "List"));
self.inner.unary(req, path, codec).await
}
pub async fn search_by_username(
&mut self,
request: impl tonic::IntoRequest<super::SearchByUsernameRequest>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/users.UsersService/SearchByUsername",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("users.UsersService", "SearchByUsername"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod users_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with UsersServiceServer.
#[async_trait]
pub trait UsersService: std::marker::Send + std::marker::Sync + 'static {
async fn get(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::UserResponse>, tonic::Status>;
async fn get_list(
&self,
request: tonic::Request<super::IdList>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status>;
async fn update(
&self,
request: tonic::Request<super::UserRequest>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn create(
&self,
request: tonic::Request<super::UserRequest>,
) -> std::result::Result<tonic::Response<super::IdMessage>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::IdMessage>,
) -> std::result::Result<tonic::Response<super::NullResponse>, tonic::Status>;
async fn list(
&self,
request: tonic::Request<super::ListRequest>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status>;
async fn search_by_username(
&self,
request: tonic::Request<super::SearchByUsernameRequest>,
) -> std::result::Result<tonic::Response<super::UserList>, tonic::Status>;
}
#[derive(Debug)]
pub struct UsersServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> UsersServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for UsersServiceServer<T>
where
T: UsersService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/users.UsersService/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::IdMessage>
for GetSvc<T> {
type Response = super::UserResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::get(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/GetList" => {
#[allow(non_camel_case_types)]
struct GetListSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::IdList>
for GetListSvc<T> {
type Response = super::UserList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdList>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::get_list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::UserRequest>
for UpdateSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UserRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::update(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/Create" => {
#[allow(non_camel_case_types)]
struct CreateSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::UserRequest>
for CreateSvc<T> {
type Response = super::IdMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UserRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::create(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::IdMessage>
for DeleteSvc<T> {
type Response = super::NullResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IdMessage>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::delete(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: UsersService>(pub Arc<T>);
impl<T: UsersService> tonic::server::UnaryService<super::ListRequest>
for ListSvc<T> {
type Response = super::UserList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::list(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/users.UsersService/SearchByUsername" => {
#[allow(non_camel_case_types)]
struct SearchByUsernameSvc<T: UsersService>(pub Arc<T>);
impl<
T: UsersService,
> tonic::server::UnaryService<super::SearchByUsernameRequest>
for SearchByUsernameSvc<T> {
type Response = super::UserList;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SearchByUsernameRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as UsersService>::search_by_username(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SearchByUsernameSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for UsersServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "users.UsersService";
impl<T> tonic::server::NamedService for UsersServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

386
src/validator/mod.rs Normal file
View File

@@ -0,0 +1,386 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixId {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixCreate {
#[prost(uint32, tag="1")]
pub operation_id: u32,
#[prost(uint32, tag="2")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(uint64, tag="3")]
pub asset_owner: u64,
#[prost(uint64, tag="4")]
pub asset_id: u64,
#[prost(uint64, tag="5")]
pub asset_version: u64,
#[prost(uint64, tag="6")]
pub target_asset_id: u64,
#[prost(string, tag="7")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="8")]
pub creator: ::prost::alloc::string::String,
#[prost(string, tag="9")]
pub description: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionId {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionCreate {
#[prost(uint32, tag="1")]
pub operation_id: u32,
#[prost(uint32, tag="2")]
#[serde(rename = "GameID")]
pub game_id: u32,
#[prost(uint32, tag="3")]
pub status: u32,
#[prost(uint32, tag="4")]
pub roles: u32,
#[prost(uint64, tag="5")]
pub asset_owner: u64,
#[prost(uint64, tag="6")]
pub asset_id: u64,
#[prost(uint64, tag="7")]
pub asset_version: u64,
#[prost(string, tag="8")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="9")]
pub creator: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AuditErrorRequest {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(string, tag="2")]
pub error_message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Check {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub summary: ::prost::alloc::string::String,
#[prost(bool, tag="3")]
pub passed: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct AuditChecklistRequest {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(message, repeated, tag="2")]
pub check_list: ::prost::alloc::vec::Vec<Check>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ValidatedModelRequest {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(uint64, tag="2")]
pub validated_model_id: u64,
#[prost(uint64, tag="3")]
pub validated_model_version: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmittedRequest {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(uint64, tag="2")]
pub model_version: u64,
#[prost(string, tag="3")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag="4")]
pub creator: ::prost::alloc::string::String,
#[prost(uint32, tag="5")]
#[serde(rename = "GameID")]
pub game_id: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct StatusUploadedRequest {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(uint64, tag="2")]
pub uploaded_asset_id: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MapfixReleaseRequest {
#[prost(uint64, tag="1")]
pub mapfix_id: u64,
#[prost(uint64, tag="2")]
pub target_asset_id: u64,
#[prost(uint64, tag="3")]
pub asset_version: u64,
#[prost(uint32, tag="4")]
pub modes: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SubmissionReleaseRequest {
#[prost(uint64, tag="1")]
pub submission_id: u64,
#[prost(message, optional, tag="2")]
pub map_create: ::core::option::Option<super::maps_extended::MapCreate>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct NullResponse {
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct OperationSuccessRequest {
#[prost(uint32, tag="1")]
pub operation_id: u32,
#[prost(string, tag="2")]
pub path: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct OperationFailRequest {
#[prost(uint32, tag="1")]
pub operation_id: u32,
#[prost(string, tag="2")]
pub status_message: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Pagination {
#[prost(uint32, tag="1")]
pub size: u32,
#[prost(uint32, tag="2")]
pub number: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptCreate {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub source: ::prost::alloc::string::String,
#[prost(enumeration="ResourceType", tag="3")]
pub resource_type: i32,
#[prost(uint64, optional, tag="4")]
pub resource_id: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptFilter {
#[prost(string, optional, tag="1")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag="2")]
pub source: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration="ResourceType", optional, tag="3")]
pub resource_type: ::core::option::Option<i32>,
#[prost(uint64, optional, tag="4")]
pub resource_id: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="5")]
pub hash: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<ScriptFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptId {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Script {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(uint64, tag="2")]
pub hash: u64,
#[prost(string, tag="3")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag="4")]
pub source: ::prost::alloc::string::String,
#[prost(enumeration="ResourceType", tag="5")]
pub resource_type: i32,
#[prost(uint64, optional, tag="6")]
pub resource_id: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptListResponse {
#[prost(message, repeated, tag="1")]
pub scripts: ::prost::alloc::vec::Vec<Script>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicyCreate {
#[prost(uint64, tag="1")]
pub from_script_id: u64,
#[prost(uint64, tag="2")]
pub to_script_id: u64,
#[prost(enumeration="Policy", tag="3")]
pub policy: i32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicyFilter {
#[prost(uint64, optional, tag="1")]
pub from_script_hash: ::core::option::Option<u64>,
#[prost(uint64, optional, tag="2")]
pub to_script_id: ::core::option::Option<u64>,
#[prost(enumeration="Policy", optional, tag="3")]
pub policy: ::core::option::Option<i32>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicyListRequest {
#[prost(message, optional, tag="1")]
pub filter: ::core::option::Option<ScriptPolicyFilter>,
#[prost(message, optional, tag="2")]
pub page: ::core::option::Option<Pagination>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicyId {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicy {
#[prost(uint64, tag="1")]
#[serde(rename = "ID")]
pub id: u64,
#[prost(uint64, tag="2")]
pub from_script_hash: u64,
#[prost(uint64, tag="3")]
pub to_script_id: u64,
#[prost(enumeration="Policy", tag="4")]
pub policy: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ScriptPolicyListResponse {
#[prost(message, repeated, tag="1")]
pub script_policies: ::prost::alloc::vec::Vec<ScriptPolicy>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResourceType {
None = 0,
Mapfix = 1,
Submission = 2,
}
impl ResourceType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::None => "ResourceTypeNone",
Self::Mapfix => "ResourceTypeMapfix",
Self::Submission => "ResourceTypeSubmission",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ResourceTypeNone" => Some(Self::None),
"ResourceTypeMapfix" => Some(Self::Mapfix),
"ResourceTypeSubmission" => Some(Self::Submission),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Policy {
None = 0,
Allowed = 1,
Blocked = 2,
Delete = 3,
Replace = 4,
}
impl Policy {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::None => "PolicyNone",
Self::Allowed => "PolicyAllowed",
Self::Blocked => "PolicyBlocked",
Self::Delete => "PolicyDelete",
Self::Replace => "PolicyReplace",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PolicyNone" => Some(Self::None),
"PolicyAllowed" => Some(Self::Allowed),
"PolicyBlocked" => Some(Self::Blocked),
"PolicyDelete" => Some(Self::Delete),
"PolicyReplace" => Some(Self::Replace),
_ => None,
}
}
}
include!("validator.tonic.rs");
// @@protoc_insertion_point(module)

File diff suppressed because it is too large Load Diff