diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 166d4c8..398c52f 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -13,7 +13,7 @@ jobs:
rust:
runs-on: ubuntu-latest
-
+
steps:
- uses: actions/checkout@v3
- name: Clone spacebar server
@@ -21,7 +21,7 @@ jobs:
git clone https://github.com/bitfl0wer/server.git
- uses: actions/setup-node@v3
with:
- node-version: 16
+ node-version: 18
cache: 'npm'
cache-dependency-path: server/package-lock.json
- name: Prepare and start Spacebar server
@@ -31,7 +31,17 @@ jobs:
npm run start &
working-directory: ./server
- uses: Swatinem/rust-cache@v2
- - name: Build
- run: cargo build --verbose
- - name: Run tests
- run: cargo test --verbose
+ with:
+ cache-all-crates: "true"
+ - name: Build, Test and Publish Coverage
+ run: |
+ if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
+ curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
+ cargo binstall --no-confirm cargo-tarpaulin --force
+ cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120
+ else
+ echo "Code Coverage step is skipped on forks!"
+ cargo build --verbose --all-features
+ cargo test --verbose --all-features
+ fi
+
diff --git a/.gitignore b/.gitignore
index d3170e2..1bb4c89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
# Generated by Cargo
# will have compiled files and executables
-/target/
+/**/target/
# These are backup files generated by rustfmt
**/*.rs.bk
diff --git a/Cargo.lock b/Cargo.lock
index c90b667..8c8c26e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
-version = "0.20.0"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"gimli",
]
@@ -19,31 +19,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
-version = "0.7.6"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
+checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
+ "cfg-if",
"getrandom",
"once_cell",
"version_check",
]
-[[package]]
-name = "ahash"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
-dependencies = [
- "cfg-if",
- "once_cell",
- "version_check",
-]
-
[[package]]
name = "aho-corasick"
-version = "1.0.2"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
+checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a"
dependencies = [
"memchr",
]
@@ -71,20 +61,20 @@ dependencies = [
[[package]]
name = "async-trait"
-version = "0.1.71"
+version = "0.1.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf"
+checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
name = "atoi"
-version = "1.0.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e"
+checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
dependencies = [
"num-traits",
]
@@ -97,9 +87,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
-version = "0.3.68"
+version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12"
+checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
"addr2line",
"cc",
@@ -118,9 +108,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
-version = "0.21.2"
+version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
+checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
[[package]]
name = "base64ct"
@@ -136,9 +126,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.3.3"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
+checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
dependencies = [
"serde",
]
@@ -172,9 +162,12 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
[[package]]
name = "cc"
-version = "1.0.79"
+version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
+checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
+dependencies = [
+ "libc",
+]
[[package]]
name = "cfg-if"
@@ -184,11 +177,12 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chorus"
-version = "0.1.0"
+version = "0.4.0"
dependencies = [
"async-trait",
- "base64 0.21.2",
- "bitflags 2.3.3",
+ "base64 0.21.3",
+ "bitflags 2.4.0",
+ "chorus-macros",
"chrono",
"custom_error",
"futures-util",
@@ -215,6 +209,15 @@ dependencies = [
"url",
]
+[[package]]
+name = "chorus-macros"
+version = "0.1.0"
+dependencies = [
+ "async-trait",
+ "quote",
+ "syn 2.0.29",
+]
+
[[package]]
name = "chrono"
version = "0.4.26"
@@ -242,9 +245,9 @@ dependencies = [
[[package]]
name = "const-oid"
-version = "0.7.1"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
+checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f"
[[package]]
name = "core-foundation"
@@ -305,16 +308,6 @@ dependencies = [
"cfg-if",
]
-[[package]]
-name = "crypto-bigint"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21"
-dependencies = [
- "generic-array",
- "subtle",
-]
-
[[package]]
name = "crypto-common"
version = "0.1.6"
@@ -352,7 +345,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -363,7 +356,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -374,13 +367,22 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "der"
-version = "0.5.1"
+version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
+checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c"
dependencies = [
"const-oid",
- "crypto-bigint",
"pem-rfc7468",
+ "zeroize",
+]
+
+[[package]]
+name = "deranged"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
+dependencies = [
+ "serde",
]
[[package]]
@@ -390,7 +392,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
+ "const-oid",
"crypto-common",
+ "subtle",
]
[[package]]
@@ -401,15 +405,18 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "either"
-version = "1.8.1"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+dependencies = [
+ "serde",
+]
[[package]]
name = "encoding_rs"
-version = "0.8.32"
+version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
+checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [
"cfg-if",
]
@@ -432,9 +439,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
+checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
dependencies = [
"errno-dragonfly",
"libc",
@@ -451,6 +458,17 @@ dependencies = [
"libc",
]
+[[package]]
+name = "etcetera"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
+dependencies = [
+ "cfg-if",
+ "home",
+ "windows-sys",
+]
+
[[package]]
name = "event-listener"
version = "2.5.3"
@@ -459,12 +477,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "fastrand"
-version = "1.9.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
-dependencies = [
- "instant",
-]
+checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
[[package]]
name = "flume"
@@ -543,15 +558,21 @@ dependencies = [
[[package]]
name = "futures-intrusive"
-version = "0.4.2"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5"
+checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
dependencies = [
"futures-core",
"lock_api",
- "parking_lot 0.11.2",
+ "parking_lot",
]
+[[package]]
+name = "futures-io"
+version = "0.3.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
+
[[package]]
name = "futures-macro"
version = "0.3.28"
@@ -560,7 +581,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -582,9 +603,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [
"futures-core",
+ "futures-io",
"futures-macro",
"futures-sink",
"futures-task",
+ "memchr",
"pin-project-lite",
"pin-utils",
"slab",
@@ -622,15 +645,15 @@ dependencies = [
[[package]]
name = "gimli"
-version = "0.27.3"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
+checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]]
name = "h2"
-version = "0.3.20"
+version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049"
+checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
dependencies = [
"bytes",
"fnv",
@@ -657,7 +680,7 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
dependencies = [
- "ahash 0.8.3",
+ "ahash",
"allocator-api2",
]
@@ -716,6 +739,33 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+[[package]]
+name = "hkdf"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437"
+dependencies = [
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest",
+]
+
+[[package]]
+name = "home"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
+dependencies = [
+ "windows-sys",
+]
+
[[package]]
name = "hostname"
version = "0.3.1"
@@ -757,9 +807,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "httpdate"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
@@ -778,7 +828,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
- "socket2",
+ "socket2 0.4.9",
"tokio",
"tower-service",
"tracing",
@@ -856,26 +906,7 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
-]
-
-[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "io-lifetimes"
-version = "1.0.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
-dependencies = [
- "hermit-abi",
- "libc",
- "windows-sys",
+ "serde",
]
[[package]]
@@ -886,9 +917,12 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
[[package]]
name = "ipnetwork"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f84f1612606f3753f205a4e9a2efd6fe5b4c573a6269b2cc6c3003d44a0d127"
+checksum = "bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e"
+dependencies = [
+ "serde",
+]
[[package]]
name = "itertools"
@@ -920,7 +954,7 @@ version = "8.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"pem",
"ring",
"serde",
@@ -951,9 +985,9 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
[[package]]
name = "libsqlite3-sys"
-version = "0.24.2"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14"
+checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
dependencies = [
"cc",
"pkg-config",
@@ -962,9 +996,9 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
-version = "0.3.8"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
+checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
[[package]]
name = "lock_api"
@@ -978,9 +1012,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.19"
+version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "match_cfg"
@@ -988,6 +1022,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
+[[package]]
+name = "md-5"
+version = "0.10.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca"
+dependencies = [
+ "digest",
+]
+
[[package]]
name = "memchr"
version = "2.5.0"
@@ -1072,9 +1115,9 @@ dependencies = [
[[package]]
name = "num-bigint"
-version = "0.4.3"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
+checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
"autocfg",
"num-integer",
@@ -1121,9 +1164,9 @@ dependencies = [
[[package]]
name = "num-traits"
-version = "0.2.15"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
+checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
dependencies = [
"autocfg",
"libm",
@@ -1141,9 +1184,9 @@ dependencies = [
[[package]]
name = "object"
-version = "0.31.1"
+version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1"
+checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe"
dependencies = [
"memchr",
]
@@ -1156,9 +1199,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "openssl"
-version = "0.10.55"
+version = "0.10.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d"
+checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
@@ -1177,7 +1220,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -1188,9 +1231,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
-version = "0.9.90"
+version = "0.9.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6"
+checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac"
dependencies = [
"cc",
"libc",
@@ -1198,17 +1241,6 @@ dependencies = [
"vcpkg",
]
-[[package]]
-name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core 0.8.6",
-]
-
[[package]]
name = "parking_lot"
version = "0.12.1"
@@ -1216,21 +1248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.8",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall 0.2.16",
- "smallvec",
- "winapi",
+ "parking_lot_core",
]
[[package]]
@@ -1241,7 +1259,7 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.3.5",
+ "redox_syscall",
"smallvec",
"windows-targets",
]
@@ -1263,9 +1281,9 @@ dependencies = [
[[package]]
name = "pem-rfc7468"
-version = "0.3.1"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30"
+checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
dependencies = [
"base64ct",
]
@@ -1278,29 +1296,29 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pin-project"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842"
+checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c"
+checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
name = "pin-project-lite"
-version = "0.2.10"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]]
name = "pin-utils"
@@ -1310,24 +1328,23 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkcs1"
-version = "0.3.3"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320"
+checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
"der",
"pkcs8",
- "zeroize",
+ "spki",
]
[[package]]
name = "pkcs8"
-version = "0.8.0"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
"der",
"spki",
- "zeroize",
]
[[package]]
@@ -1338,9 +1355,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "poem"
-version = "1.3.56"
+version = "1.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a56df40b79ebdccf7986b337f9b0e51ac55cd5e9d21fb20b6aa7c7d49741854"
+checksum = "f0d92c532a37a9e98c0e9a0411e6852b8acccf9ec07d5e6e450b01cbf947d90b"
dependencies = [
"async-trait",
"bytes",
@@ -1349,7 +1366,7 @@ dependencies = [
"http",
"hyper",
"mime",
- "parking_lot 0.12.1",
+ "parking_lot",
"percent-encoding",
"pin-project-lite",
"poem-derive",
@@ -1367,14 +1384,14 @@ dependencies = [
[[package]]
name = "poem-derive"
-version = "1.3.56"
+version = "1.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1701f977a2d650a03df42c053686ea0efdb83554f34c7b026b89383c0a1b7846"
+checksum = "f5dd58846a1f582215370384c3090c62c9ef188e9d798ffc67ea90d0a1a8a3b8"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.29",
]
[[package]]
@@ -1404,9 +1421,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.31"
+version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
@@ -1441,15 +1458,6 @@ dependencies = [
"getrandom",
]
-[[package]]
-name = "redox_syscall"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
-dependencies = [
- "bitflags 1.3.2",
-]
-
[[package]]
name = "redox_syscall"
version = "0.3.5"
@@ -1461,9 +1469,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.9.1"
+version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
+checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29"
dependencies = [
"aho-corasick",
"memchr",
@@ -1473,9 +1481,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.3.3"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
+checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629"
dependencies = [
"aho-corasick",
"memchr",
@@ -1484,17 +1492,17 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.7.4"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
+checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "reqwest"
-version = "0.11.18"
+version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55"
+checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"bytes",
"encoding_rs",
"futures-core",
@@ -1552,11 +1560,12 @@ dependencies = [
[[package]]
name = "rsa"
-version = "0.6.1"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b"
+checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8"
dependencies = [
"byteorder",
+ "const-oid",
"digest",
"num-bigint-dig",
"num-integer",
@@ -1565,7 +1574,8 @@ dependencies = [
"pkcs1",
"pkcs8",
"rand_core",
- "smallvec",
+ "signature",
+ "spki",
"subtle",
"zeroize",
]
@@ -1578,13 +1588,12 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustix"
-version = "0.37.23"
+version = "0.38.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
+checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49"
dependencies = [
- "bitflags 1.3.2",
+ "bitflags 2.4.0",
"errno",
- "io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
@@ -1625,9 +1634,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "security-framework"
-version = "2.9.1"
+version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8"
+checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
@@ -1638,9 +1647,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
-version = "2.9.0"
+version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7"
+checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
dependencies = [
"core-foundation-sys",
"libc",
@@ -1648,9 +1657,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.171"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9"
+checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [
"serde_derive",
]
@@ -1668,20 +1677,20 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.171"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
+checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
name = "serde_json"
-version = "1.0.103"
+version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
+checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
dependencies = [
"itoa",
"ryu",
@@ -1690,13 +1699,13 @@ dependencies = [
[[package]]
name = "serde_repr"
-version = "0.1.14"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731"
+checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -1713,30 +1722,31 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "3.1.0"
+version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21e47d95bc83ed33b2ecf84f4187ad1ab9685d18ff28db000c99deac8ce180e3"
+checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"chrono",
"hex",
"indexmap 1.9.3",
+ "indexmap 2.0.0",
"serde",
"serde_json",
"serde_with_macros",
- "time 0.3.23",
+ "time 0.3.27",
]
[[package]]
name = "serde_with_macros"
-version = "3.1.0"
+version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea3cee93715c2e266b9338b7544da68a9f24e227722ba482bd1c024367c77c65"
+checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c"
dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -1770,6 +1780,16 @@ dependencies = [
"libc",
]
+[[package]]
+name = "signature"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500"
+dependencies = [
+ "digest",
+ "rand_core",
+]
+
[[package]]
name = "simple_asn1"
version = "0.6.2"
@@ -1779,14 +1799,14 @@ dependencies = [
"num-bigint",
"num-traits",
"thiserror",
- "time 0.3.23",
+ "time 0.3.27",
]
[[package]]
name = "slab"
-version = "0.4.8"
+version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
@@ -1807,6 +1827,16 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "socket2"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
[[package]]
name = "spin"
version = "0.5.2"
@@ -1824,9 +1854,9 @@ dependencies = [
[[package]]
name = "spki"
-version = "0.5.4"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
+checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a"
dependencies = [
"base64ct",
"der",
@@ -1845,95 +1875,206 @@ dependencies = [
[[package]]
name = "sqlx"
-version = "0.6.3"
-source = "git+https://github.com/zert3x/sqlx?branch=feature/skip#b417a65842442b177e2abb39f3940a7c95265d90"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721"
dependencies = [
"sqlx-core",
"sqlx-macros",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
]
[[package]]
name = "sqlx-core"
-version = "0.6.3"
-source = "git+https://github.com/zert3x/sqlx?branch=feature/skip#b417a65842442b177e2abb39f3940a7c95265d90"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
dependencies = [
- "ahash 0.7.6",
+ "ahash",
"atoi",
- "bitflags 1.3.2",
"byteorder",
"bytes",
"chrono",
"crc",
"crossbeam-queue",
- "digest",
"dotenvy",
"either",
"event-listener",
+ "futures-channel",
+ "futures-core",
+ "futures-intrusive",
+ "futures-io",
+ "futures-util",
+ "hashlink",
+ "hex",
+ "indexmap 2.0.0",
+ "ipnetwork",
+ "log",
+ "memchr",
+ "native-tls",
+ "once_cell",
+ "paste",
+ "percent-encoding",
+ "serde",
+ "serde_json",
+ "sha2",
+ "smallvec",
+ "sqlformat",
+ "thiserror",
+ "tokio",
+ "tokio-stream",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "sqlx-macros"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "sqlx-core",
+ "sqlx-macros-core",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "sqlx-macros-core"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc"
+dependencies = [
+ "dotenvy",
+ "either",
+ "heck",
+ "hex",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "sha2",
+ "sqlx-core",
+ "sqlx-mysql",
+ "sqlx-postgres",
+ "sqlx-sqlite",
+ "syn 1.0.109",
+ "tempfile",
+ "tokio",
+ "url",
+]
+
+[[package]]
+name = "sqlx-mysql"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482"
+dependencies = [
+ "atoi",
+ "base64 0.21.3",
+ "bitflags 2.4.0",
+ "byteorder",
+ "bytes",
+ "chrono",
+ "crc",
+ "digest",
+ "dotenvy",
+ "either",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "generic-array",
+ "hex",
+ "hkdf",
+ "hmac",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "percent-encoding",
+ "rand",
+ "rsa",
+ "serde",
+ "sha1",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-postgres"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e"
+dependencies = [
+ "atoi",
+ "base64 0.21.3",
+ "bitflags 2.4.0",
+ "byteorder",
+ "chrono",
+ "crc",
+ "dotenvy",
+ "etcetera",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "hex",
+ "hkdf",
+ "hmac",
+ "home",
+ "ipnetwork",
+ "itoa",
+ "log",
+ "md-5",
+ "memchr",
+ "once_cell",
+ "rand",
+ "serde",
+ "serde_json",
+ "sha1",
+ "sha2",
+ "smallvec",
+ "sqlx-core",
+ "stringprep",
+ "thiserror",
+ "tracing",
+ "whoami",
+]
+
+[[package]]
+name = "sqlx-sqlite"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2"
+dependencies = [
+ "atoi",
+ "chrono",
"flume",
"futures-channel",
"futures-core",
"futures-executor",
"futures-intrusive",
"futures-util",
- "generic-array",
- "hashlink",
- "hex",
- "indexmap 1.9.3",
- "ipnetwork",
- "itoa",
- "libc",
"libsqlite3-sys",
"log",
- "memchr",
- "num-bigint",
- "once_cell",
- "paste",
"percent-encoding",
- "rand",
- "rsa",
"serde",
- "serde_json",
- "sha1",
- "sha2",
- "smallvec",
- "sqlformat",
- "sqlx-rt",
- "stringprep",
- "thiserror",
- "tokio-stream",
- "url",
-]
-
-[[package]]
-name = "sqlx-macros"
-version = "0.6.3"
-source = "git+https://github.com/zert3x/sqlx?branch=feature/skip#b417a65842442b177e2abb39f3940a7c95265d90"
-dependencies = [
- "dotenvy",
- "either",
- "heck",
- "once_cell",
- "proc-macro2",
- "quote",
- "serde_json",
- "sha2",
"sqlx-core",
- "sqlx-rt",
- "syn 1.0.109",
+ "tracing",
"url",
]
-[[package]]
-name = "sqlx-rt"
-version = "0.6.3"
-source = "git+https://github.com/zert3x/sqlx?branch=feature/skip#b417a65842442b177e2abb39f3940a7c95265d90"
-dependencies = [
- "native-tls",
- "once_cell",
- "tokio",
- "tokio-native-tls",
-]
-
[[package]]
name = "stringprep"
version = "0.1.3"
@@ -1969,9 +2110,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.26"
+version = "2.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970"
+checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
dependencies = [
"proc-macro2",
"quote",
@@ -1980,36 +2121,35 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.6.0"
+version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
+checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
dependencies = [
- "autocfg",
"cfg-if",
"fastrand",
- "redox_syscall 0.3.5",
+ "redox_syscall",
"rustix",
"windows-sys",
]
[[package]]
name = "thiserror"
-version = "1.0.43"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
+checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.43"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
+checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -2025,10 +2165,11 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.23"
+version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
+checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07"
dependencies = [
+ "deranged",
"itoa",
"serde",
"time-core",
@@ -2043,9 +2184,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
-version = "0.2.10"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
+checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9"
dependencies = [
"time-core",
]
@@ -2067,20 +2208,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.29.1"
+version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da"
+checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
dependencies = [
- "autocfg",
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
- "parking_lot 0.12.1",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
- "socket2",
+ "socket2 0.5.3",
"tokio-macros",
"windows-sys",
]
@@ -2093,7 +2233,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -2119,9 +2259,9 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c"
+checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2"
dependencies = [
"futures-util",
"log",
@@ -2184,6 +2324,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [
"cfg-if",
+ "log",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@@ -2197,7 +2338,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
]
[[package]]
@@ -2217,9 +2358,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "tungstenite"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67"
+checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649"
dependencies = [
"byteorder",
"bytes",
@@ -2252,9 +2393,9 @@ dependencies = [
[[package]]
name = "unicase"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
+checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
dependencies = [
"version_check",
]
@@ -2375,7 +2516,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
"wasm-bindgen-shared",
]
@@ -2409,7 +2550,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.26",
+ "syn 2.0.29",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -2430,6 +2571,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "whoami"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50"
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -2472,9 +2619,9 @@ dependencies = [
[[package]]
name = "windows-targets"
-version = "0.48.1"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
@@ -2487,62 +2634,63 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winnow"
-version = "0.5.0"
+version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7"
+checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
-version = "0.10.1"
+version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
+checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
- "winapi",
+ "cfg-if",
+ "windows-sys",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 4126146..3d2732b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,14 @@
[package]
name = "chorus"
-version = "0.1.0"
-license = "AGPL-3"
+description = "A library for interacting with multiple Spacebar-compatible Instances at once."
+version = "0.4.0"
+license = "AGPL-3.0"
edition = "2021"
+repository = "https://github.com/polyphony-chat/chorus"
+readme = "README.md"
+keywords = ["spacebar", "discord", "polyphony"]
+website = ["https://discord.com/invite/m3FpcapGDD"]
+
[features]
default = ["client"]
@@ -10,34 +16,43 @@ backend = ["poem", "sqlx"]
client = []
[dependencies]
-tokio = {version = "1.29.1", features = ["macros"]}
-serde = {version = "1.0.171", features = ["derive"]}
-serde_json = {version= "1.0.103", features = ["raw_value"]}
+tokio = { version = "1.29.1", features = ["macros"] }
+serde = { version = "1.0.188", features = ["derive", "rc"] }
+serde_json = { version = "1.0.105", features = ["raw_value"] }
serde-aux = "4.2.0"
-serde_with = "3.0.0"
-serde_repr = "0.1.14"
-reqwest = {version = "0.11.18", features = ["multipart"]}
+serde_with = "3.3.0"
+serde_repr = "0.1.16"
+reqwest = { version = "0.11.20", features = ["multipart", "json"] }
url = "2.4.0"
-chrono = {version = "0.4.26", features = ["serde"]}
-regex = "1.9.1"
+chrono = { version = "0.4.26", features = ["serde"] }
+regex = "1.9.4"
custom_error = "1.9.2"
native-tls = "0.2.11"
-tokio-tungstenite = {version = "0.19.0", features = ["native-tls"]}
+tokio-tungstenite = { version = "0.20.0", features = ["native-tls"] }
futures-util = "0.3.28"
http = "0.2.9"
-openssl = "0.10.55"
-base64 = "0.21.2"
+openssl = "0.10.56"
+base64 = "0.21.3"
hostname = "0.3.1"
-bitflags = { version = "2.3.3", features = ["serde"] }
+bitflags = { version = "2.4.0", features = ["serde"] }
lazy_static = "1.4.0"
-poem = { version = "1.3.56", optional = true }
-sqlx = { git = "https://github.com/zert3x/sqlx", branch="feature/skip", features = ["mysql", "sqlite", "json", "chrono", "ipnetwork", "runtime-tokio-native-tls", "any"], optional = true }
-thiserror = "1.0.43"
+poem = { version = "1.3.57", optional = true }
+sqlx = { version = "0.7.1", features = [
+ "mysql",
+ "sqlite",
+ "json",
+ "chrono",
+ "ipnetwork",
+ "runtime-tokio-native-tls",
+ "any",
+], optional = true }
+thiserror = "1.0.47"
jsonwebtoken = "8.3.0"
-log = "0.4.19"
-async-trait = "0.1.71"
+log = "0.4.20"
+async-trait = "0.1.73"
+chorus-macros = { path = "chorus-macros", version = "0.1.0" }
[dev-dependencies]
-tokio = {version = "1.29.1", features = ["full"]}
+tokio = { version = "1.32.0", features = ["full"] }
lazy_static = "1.4.0"
rusty-hook = "0.11.2"
diff --git a/README.md b/README.md
index 9292a46..74dff4c 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,11 @@
[![Discord]][Discord-invite]
[![Build][build-shield]][build-url]
+[![Coverage][coverage-shield]][coverage-url]
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Issues][issues-shield]][issues-url]
-
+
@@ -37,6 +38,7 @@ Chorus is a Rust library that allows developers to interact with multiple Spaceb
## Contributing
+If you'd like to contribute new functionality, check out [The 'Meta'-issues.](https://github.com/polyphony-chat/chorus/issues?q=is%3Aissue+label%3A%22Type%3A+Meta%22+) They contain a comprehensive list of all features which are yet missing for full Discord.com compatibility.
If you would like to contribute, please feel free to open an Issue with the idea you have, or a
Pull Request. Please keep our [contribution guidelines](https://github.com/polyphony-chat/.github/blob/main/CONTRIBUTION_GUIDELINES.md) in mind. Your contribution might not be
accepted, if it violates these guidelines or [our Code of Conduct](https://github.com/polyphony-chat/.github/blob/main/CODE_OF_CONDUCT.md).
@@ -123,6 +125,8 @@ accepted, if it violates these guidelines or [our Code of Conduct](https://githu
[clippy-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/clippy.yml
[contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/chorus.svg?style=flat
[contributors-url]: https://github.com/polyphony-chat/chorus/graphs/contributors
+ [coverage-shield]: https://coveralls.io/repos/github/polyphony-chat/chorus/badge.svg?branch=main
+ [coverage-url]: https://coveralls.io/github/polyphony-chat/chorus?branch=main
[forks-shield]: https://img.shields.io/github/forks/polyphony-chat/chorus.svg?style=flat
[forks-url]: https://github.com/polyphony-chat/chorus/network/members
[stars-shield]: https://img.shields.io/github/stars/polyphony-chat/chorus.svg?style=flat
@@ -133,4 +137,4 @@ accepted, if it violates these guidelines or [our Code of Conduct](https://githu
[license-url]: https://github.com/polyphony-chat/chorus/blob/master/LICENSE
[Discord]: https://dcbadge.vercel.app/api/server/m3FpcapGDD?style=flat
[Discord-invite]: https://discord.com/invite/m3FpcapGDD
-
\ No newline at end of file
+
diff --git a/chorus-macros/Cargo.lock b/chorus-macros/Cargo.lock
new file mode 100644
index 0000000..17404a2
--- /dev/null
+++ b/chorus-macros/Cargo.lock
@@ -0,0 +1,58 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "async-trait"
+version = "0.1.73"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "chorus-macros"
+version = "0.1.0"
+dependencies = [
+ "async-trait",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.66"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
diff --git a/chorus-macros/Cargo.toml b/chorus-macros/Cargo.toml
new file mode 100644
index 0000000..098159f
--- /dev/null
+++ b/chorus-macros/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "chorus-macros"
+version = "0.1.0"
+edition = "2021"
+license = "AGPL-3.0"
+description = "Macros for the chorus crate."
+
+[lib]
+proc-macro = true
+
+[dependencies]
+quote = "1.0.33"
+syn = "2.0.29"
+async-trait = "0.1.73"
diff --git a/chorus-macros/src/lib.rs b/chorus-macros/src/lib.rs
new file mode 100644
index 0000000..f825568
--- /dev/null
+++ b/chorus-macros/src/lib.rs
@@ -0,0 +1,122 @@
+use proc_macro::TokenStream;
+use quote::quote;
+use syn::{parse_macro_input, Data, DeriveInput, Field, Fields, FieldsNamed};
+
+#[proc_macro_derive(Updateable)]
+pub fn updateable_macro_derive(input: TokenStream) -> TokenStream {
+ let ast: syn::DeriveInput = syn::parse(input).unwrap();
+
+ let name = &ast.ident;
+ // No need for macro hygiene, we're only using this in chorus
+ quote! {
+ impl Updateable for #name {
+ fn id(&self) -> Snowflake {
+ self.id
+ }
+ }
+ }
+ .into()
+}
+
+#[proc_macro_derive(JsonField)]
+pub fn jsonfield_macro_derive(input: TokenStream) -> TokenStream {
+ let ast: syn::DeriveInput = syn::parse(input).unwrap();
+
+ let name = &ast.ident;
+ // No need for macro hygiene, we're only using this in chorus
+ quote! {
+ impl JsonField for #name {
+ fn get_json(&self) -> String {
+ self.json.clone()
+ }
+ fn set_json(&mut self, json: String) {
+ self.json = json;
+ }
+ }
+ }
+ .into()
+}
+
+#[proc_macro_attribute]
+pub fn observe_option(_args: TokenStream, input: TokenStream) -> TokenStream {
+ input
+}
+
+#[proc_macro_attribute]
+pub fn observe_option_vec(_args: TokenStream, input: TokenStream) -> TokenStream {
+ input
+}
+
+#[proc_macro_attribute]
+pub fn observe(_args: TokenStream, input: TokenStream) -> TokenStream {
+ input
+}
+
+#[proc_macro_attribute]
+pub fn observe_vec(_args: TokenStream, input: TokenStream) -> TokenStream {
+ input
+}
+
+#[proc_macro_derive(
+ Composite,
+ attributes(observe_option_vec, observe_option, observe, observe_vec)
+)]
+pub fn composite_derive(input: TokenStream) -> TokenStream {
+ let input = parse_macro_input!(input as DeriveInput);
+
+ let process_field = |field: &Field| {
+ let field_name = &field.ident;
+ let attrs = &field.attrs;
+
+ let observe_option = attrs
+ .iter()
+ .any(|attr| attr.path().is_ident("observe_option"));
+ let observe_option_vec = attrs
+ .iter()
+ .any(|attr| attr.path().is_ident("observe_option_vec"));
+ let observe = attrs.iter().any(|attr| attr.path().is_ident("observe"));
+ let observe_vec = attrs.iter().any(|attr| attr.path().is_ident("observe_vec"));
+
+ match (observe_option, observe_option_vec, observe, observe_vec) {
+ (true, _, _, _) => quote! {
+ #field_name: Self::option_observe_fn(self.#field_name, gateway).await
+ },
+ (_, true, _, _) => quote! {
+ #field_name: Self::option_vec_observe_fn(self.#field_name, gateway).await
+ },
+ (_, _, true, _) => quote! {
+ #field_name: Self::value_observe_fn(self.#field_name, gateway).await
+ },
+ (_, _, _, true) => quote! {
+ #field_name: Self::vec_observe_fn(self.#field_name, gateway).await
+ },
+ _ => quote! {
+ #field_name: self.#field_name
+ },
+ }
+ };
+
+ match &input.data {
+ Data::Struct(data) => match &data.fields {
+ Fields::Named(FieldsNamed { named, .. }) => {
+ let field_exprs = named.iter().map(process_field);
+
+ let ident = &input.ident;
+ let expanded = quote! {
+ #[async_trait::async_trait(?Send)]
+ impl
Composite for #ident {
+ async fn watch_whole(self, gateway: &GatewayHandle) -> Self {
+ Self {
+ #(#field_exprs,)*
+ }
+ }
+ }
+ };
+
+ TokenStream::from(expanded)
+ }
+ _ => panic!("Composite derive macro only supports named fields"),
+ },
+ _ => panic!("Composite derive macro only supports structs"),
+ }
+}
diff --git a/src/api/auth/login.rs b/src/api/auth/login.rs
index baae4ae..46951be 100644
--- a/src/api/auth/login.rs
+++ b/src/api/auth/login.rs
@@ -1,28 +1,34 @@
-use std::cell::RefCell;
-use std::rc::Rc;
+use std::sync::{Arc, RwLock};
use reqwest::Client;
use serde_json::to_string;
use crate::api::LimitType;
use crate::errors::ChorusResult;
-use crate::instance::{Instance, UserMeta};
+use crate::gateway::Gateway;
+use crate::instance::{ChorusUser, Instance};
use crate::ratelimiter::ChorusRequest;
-use crate::types::{LoginResult, LoginSchema};
+use crate::types::{GatewayIdentifyPayload, LoginResult, LoginSchema};
impl Instance {
- pub async fn login_account(&mut self, login_schema: &LoginSchema) -> ChorusResult {
+ /// Logs into an existing account on the spacebar server.
+ ///
+ /// # Reference
+ /// See
+ pub async fn login_account(&mut self, login_schema: &LoginSchema) -> ChorusResult {
let endpoint_url = self.urls.api.clone() + "/auth/login";
let chorus_request = ChorusRequest {
request: Client::new()
.post(endpoint_url)
- .body(to_string(login_schema).unwrap()),
+ .body(to_string(login_schema).unwrap())
+ .header("Content-Type", "application/json"),
limit_type: LimitType::AuthLogin,
};
// We do not have a user yet, and the UserRateLimits will not be affected by a login
// request (since login is an instance wide limit), which is why we are just cloning the
// instances' limits to pass them on as user_rate_limits later.
- let mut shell = UserMeta::shell(Rc::new(RefCell::new(self.clone())), "None".to_string());
+ let mut shell =
+ ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None".to_string()).await;
let login_result = chorus_request
.deserialize_response::(&mut shell)
.await?;
@@ -30,12 +36,17 @@ impl Instance {
if self.limits_information.is_some() {
self.limits_information.as_mut().unwrap().ratelimits = shell.limits.clone().unwrap();
}
- let user = UserMeta::new(
- Rc::new(RefCell::new(self.clone())),
+ let mut identify = GatewayIdentifyPayload::common();
+ let gateway = Gateway::new(self.urls.wss.clone()).await.unwrap();
+ identify.token = login_result.token.clone();
+ gateway.send_identify(identify).await;
+ let user = ChorusUser::new(
+ Arc::new(RwLock::new(self.clone())),
login_result.token,
self.clone_limits_if_some(),
login_result.settings,
- object,
+ Arc::new(RwLock::new(object)),
+ Arc::new(gateway),
);
Ok(user)
}
diff --git a/src/api/auth/register.rs b/src/api/auth/register.rs
index a6849cc..44c29d8 100644
--- a/src/api/auth/register.rs
+++ b/src/api/auth/register.rs
@@ -1,41 +1,40 @@
-use std::{cell::RefCell, rc::Rc};
+use std::sync::{Arc, RwLock};
use reqwest::Client;
use serde_json::to_string;
+use crate::gateway::Gateway;
+use crate::types::GatewayIdentifyPayload;
use crate::{
api::policies::instance::LimitType,
errors::ChorusResult,
- instance::{Instance, Token, UserMeta},
+ instance::{ChorusUser, Instance, Token},
ratelimiter::ChorusRequest,
types::RegisterSchema,
};
impl Instance {
- /// Registers a new user on the Spacebar server.
+ /// Registers a new user on the server.
///
- /// # Arguments
- ///
- /// * `register_schema` - The [`RegisterSchema`] that contains all the information that is needed to register a new user.
- ///
- /// # Errors
- ///
- /// * [`ChorusLibError`] - If the server does not respond.
+ /// # Reference
+ /// See
pub async fn register_account(
&mut self,
register_schema: &RegisterSchema,
- ) -> ChorusResult {
+ ) -> ChorusResult {
let endpoint_url = self.urls.api.clone() + "/auth/register";
let chorus_request = ChorusRequest {
request: Client::new()
.post(endpoint_url)
- .body(to_string(register_schema).unwrap()),
+ .body(to_string(register_schema).unwrap())
+ .header("Content-Type", "application/json"),
limit_type: LimitType::AuthRegister,
};
// We do not have a user yet, and the UserRateLimits will not be affected by a login
// request (since register is an instance wide limit), which is why we are just cloning
// the instances' limits to pass them on as user_rate_limits later.
- let mut shell = UserMeta::shell(Rc::new(RefCell::new(self.clone())), "None".to_string());
+ let mut shell =
+ ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None".to_string()).await;
let token = chorus_request
.deserialize_response::(&mut shell)
.await?
@@ -44,13 +43,18 @@ impl Instance {
self.limits_information.as_mut().unwrap().ratelimits = shell.limits.unwrap();
}
let user_object = self.get_user(token.clone(), None).await.unwrap();
- let settings = UserMeta::get_settings(&token, &self.urls.api.clone(), self).await?;
- let user = UserMeta::new(
- Rc::new(RefCell::new(self.clone())),
+ let settings = ChorusUser::get_settings(&token, &self.urls.api.clone(), self).await?;
+ let mut identify = GatewayIdentifyPayload::common();
+ let gateway = Gateway::new(self.urls.wss.clone()).await.unwrap();
+ identify.token = token.clone();
+ gateway.send_identify(identify).await;
+ let user = ChorusUser::new(
+ Arc::new(RwLock::new(self.clone())),
token.clone(),
self.clone_limits_if_some(),
- settings,
- user_object,
+ Arc::new(RwLock::new(settings)),
+ Arc::new(RwLock::new(user_object)),
+ Arc::new(gateway),
);
Ok(user)
}
diff --git a/src/api/channels/channels.rs b/src/api/channels/channels.rs
index de23b4a..7250b0e 100644
--- a/src/api/channels/channels.rs
+++ b/src/api/channels/channels.rs
@@ -1,128 +1,164 @@
use reqwest::Client;
use serde_json::to_string;
-use crate::types::AddChannelRecipientSchema;
+use crate::types::{AddChannelRecipientSchema, ModifyChannelPositionsSchema};
use crate::{
api::LimitType,
errors::{ChorusError, ChorusResult},
- instance::UserMeta,
+ instance::ChorusUser,
ratelimiter::ChorusRequest,
types::{Channel, ChannelModifySchema, GetChannelMessagesSchema, Message, Snowflake},
};
impl Channel {
- pub async fn get(user: &mut UserMeta, channel_id: Snowflake) -> ChorusResult {
- let url = user.belongs_to.borrow().urls.api.clone();
- let chorus_request = ChorusRequest {
- request: Client::new()
- .get(format!("{}/channels/{}/", url, channel_id))
- .bearer_auth(user.token()),
- limit_type: LimitType::Channel(channel_id),
- };
+ /// Retrieves a channel from the server.
+ ///
+ /// # Reference
+ /// See
+ pub async fn get(user: &mut ChorusUser, channel_id: Snowflake) -> ChorusResult {
+ let chorus_request = ChorusRequest::new(
+ http::Method::GET,
+ &format!(
+ "{}/channels/{}",
+ user.belongs_to.read().unwrap().urls.api.clone(),
+ channel_id
+ ),
+ None,
+ None,
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+
chorus_request.deserialize_response::(user).await
}
- /// Deletes a channel.
+ /// Deletes self.
///
- /// # Arguments
+ /// Requires the [`MANAGE_CHANNELS`](crate::types::PermissionFlags::MANAGE_CHANNELS) permission in a guild, or
+ /// the [`MANAGE_THREADS`](crate::types::PermissionFlags::MANAGE_THREADS) permission if the channel is a thread.
///
- /// * `token` - A string slice that holds the authorization token.
- /// * `url_api` - A string slice that holds the URL of the API.
- /// * `channel` - A `Channel` object that represents the channel to be deleted.
- /// * `limits_user` - A mutable reference to a `Limits` object that represents the user's rate limits.
- /// * `limits_instance` - A mutable reference to a `Limits` object that represents the instance's rate limits.
- ///
- /// # Returns
- ///
- /// A `Result` that contains a `ChorusLibError` if an error occurred during the request, or `()` if the request was successful.
- pub async fn delete(self, user: &mut UserMeta) -> ChorusResult<()> {
- let chorus_request = ChorusRequest {
- request: Client::new()
- .delete(format!(
- "{}/channels/{}/",
- user.belongs_to.borrow().urls.api,
- self.id
- ))
- .bearer_auth(user.token()),
- limit_type: LimitType::Channel(self.id),
- };
- chorus_request.handle_request_as_result(user).await
- }
-
- /// Modifies a channel.
- ///
- /// # Arguments
- ///
- /// * `modify_data` - A `ChannelModifySchema` object that represents the modifications to be made to the channel.
- /// * `token` - A string slice that holds the authorization token.
- /// * `url_api` - A string slice that holds the URL of the API.
- /// * `channel_id` - A string slice that holds the ID of the channel to be modified.
- /// * `limits_user` - A mutable reference to a `Limits` object that represents the user's rate limits.
- /// * `limits_instance` - A mutable reference to a `Limits` object that represents the instance's rate limits.
- ///
- /// # Returns
- ///
- /// A `Result` that contains a `Channel` object if the request was successful, or an `ChorusLibError` if an error occurred during the request.
- pub async fn modify(
- &mut self,
- modify_data: ChannelModifySchema,
- channel_id: Snowflake,
- user: &mut UserMeta,
+ /// # Reference
+ /// See
+ pub async fn delete(
+ self,
+ audit_log_reason: Option,
+ user: &mut ChorusUser,
) -> ChorusResult<()> {
- let chorus_request = ChorusRequest {
- request: Client::new()
- .patch(format!(
- "{}/channels/{}/",
- user.belongs_to.borrow().urls.api,
- channel_id
- ))
- .bearer_auth(user.token())
- .body(to_string(&modify_data).unwrap()),
- limit_type: LimitType::Channel(channel_id),
- };
- let new_channel = chorus_request.deserialize_response::(user).await?;
- let _ = std::mem::replace(self, new_channel);
- Ok(())
+ let url = format!(
+ "{}/channels/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ self.id,
+ );
+
+ let request = ChorusRequest::new(
+ http::Method::DELETE,
+ &url,
+ None,
+ audit_log_reason.as_deref(),
+ None,
+ Some(user),
+ LimitType::Channel(self.id),
+ );
+
+ request.handle_request_as_result(user).await
}
+ /// Modifies a channel with the provided data.
+ /// Returns the new Channel.
+ ///
+ /// Requires the [`MANAGE_CHANNELS`](crate::types::PermissionFlags::MANAGE_CHANNELS) permission in a guild.
+ ///
+ /// If modifying permission overwrites, the [`MANAGE_ROLES`](crate::types::PermissionFlags::MANAGE_ROLES) permission is required.
+ /// Only permissions you have in the guild or parent channel (if applicable) can be allowed/denied
+ /// (unless you have a [`MANAGE_ROLES`](crate::types::PermissionFlags::MANAGE_ROLES) overwrite in the channel).
+ ///
+ /// If modifying a thread and setting `archived` to `false`, when `locked` is also `false`, only the [`SEND_MESSAGES`](crate::types::PermissionFlags::SEND_MESSAGES) permission is required.
+ /// Otherwise, requires the [`MANAGE_THREADS`](crate::types::PermissionFlags::MANAGE_THREADS) permission. Requires the thread to have `archived` set to `false` or be set to `false` in the request.
+ ///
+ /// # Reference
+ /// See
+ pub async fn modify(
+ &self,
+ modify_data: ChannelModifySchema,
+ audit_log_reason: Option,
+ user: &mut ChorusUser,
+ ) -> ChorusResult {
+ let channel_id = self.id;
+ let url = format!(
+ "{}/channels/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id
+ );
+
+ let request = ChorusRequest::new(
+ http::Method::PATCH,
+ &url,
+ Some(to_string(&modify_data).unwrap()),
+ audit_log_reason.as_deref(),
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+
+ request.deserialize_response::(user).await
+ }
+
+ /// Fetches recent messages from a channel.
+ ///
+ /// If operating on a guild channel, this endpoint requires the [`VIEW_CHANNEL`](crate::types::PermissionFlags::VIEW_CHANNEL) permission.
+ ///
+ /// If the user is missing the [`READ_MESSAGE_HISTORY`](crate::types::PermissionFlags::READ_MESSAGE_HISTORY) permission,
+ /// this method returns an empty list.
+ ///
+ /// # Reference
+ /// See
pub async fn messages(
range: GetChannelMessagesSchema,
channel_id: Snowflake,
- user: &mut UserMeta,
+ user: &mut ChorusUser,
) -> Result, ChorusError> {
- let chorus_request = ChorusRequest {
- request: Client::new()
- .get(format!(
- "{}/channels/{}/messages",
- user.belongs_to.borrow().urls.api,
- channel_id
- ))
- .bearer_auth(user.token())
- .query(&range),
- limit_type: Default::default(),
- };
+ let url = format!(
+ "{}/channels/{}/messages",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id
+ );
+
+ let mut chorus_request = ChorusRequest::new(
+ http::Method::GET,
+ &url,
+ None,
+ None,
+ None,
+ Some(user),
+ Default::default(),
+ );
+ chorus_request.request = chorus_request.request.query(&range);
chorus_request
.deserialize_response::>(user)
.await
}
+ /// Adds a recipient to a group DM.
+ ///
/// # Reference:
- /// Read:
+ /// See
pub async fn add_channel_recipient(
&self,
recipient_id: Snowflake,
- user: &mut UserMeta,
+ user: &mut ChorusUser,
add_channel_recipient_schema: Option,
) -> ChorusResult<()> {
let mut request = Client::new()
.put(format!(
- "{}/channels/{}/recipients/{}/",
- user.belongs_to.borrow().urls.api,
+ "{}/channels/{}/recipients/{}",
+ user.belongs_to.read().unwrap().urls.api,
self.id,
recipient_id
))
- .bearer_auth(user.token());
+ .header("Authorization", user.token())
+ .header("Content-Type", "application/json");
if let Some(schema) = add_channel_recipient_schema {
request = request.body(to_string(&schema).unwrap());
}
@@ -134,26 +170,61 @@ impl Channel {
.await
}
+ /// Removes a recipient from a group DM.
+ ///
/// # Reference:
- /// Read:
+ /// See
pub async fn remove_channel_recipient(
&self,
recipient_id: Snowflake,
- user: &mut UserMeta,
+ user: &mut ChorusUser,
) -> ChorusResult<()> {
- let request = Client::new()
- .delete(format!(
- "{}/channels/{}/recipients/{}/",
- user.belongs_to.borrow().urls.api,
- self.id,
- recipient_id
- ))
- .bearer_auth(user.token());
- ChorusRequest {
- request,
- limit_type: LimitType::Channel(self.id),
- }
- .handle_request_as_result(user)
- .await
+ let url = format!(
+ "{}/channels/{}/recipients/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ self.id,
+ recipient_id
+ );
+
+ let request = ChorusRequest::new(
+ http::Method::DELETE,
+ &url,
+ None,
+ None,
+ None,
+ Some(user),
+ LimitType::Channel(self.id),
+ );
+
+ request.handle_request_as_result(user).await
+ }
+
+ /// Modifies the positions of a set of channel objects for the guild. Requires the `MANAGE_CHANNELS` permission.
+ /// Only channels to be modified are required.
+ ///
+ /// # Reference:
+ /// See
+ pub async fn modify_positions(
+ schema: Vec,
+ guild_id: Snowflake,
+ user: &mut ChorusUser,
+ ) -> ChorusResult<()> {
+ let url = format!(
+ "{}/guilds/{}/channels",
+ user.belongs_to.read().unwrap().urls.api,
+ guild_id
+ );
+
+ let request = ChorusRequest::new(
+ http::Method::PATCH,
+ &url,
+ Some(to_string(&schema).unwrap()),
+ None,
+ None,
+ Some(user),
+ LimitType::Guild(guild_id),
+ );
+
+ request.handle_request_as_result(user).await
}
}
diff --git a/src/api/channels/messages.rs b/src/api/channels/messages.rs
index 6beec7f..960e492 100644
--- a/src/api/channels/messages.rs
+++ b/src/api/channels/messages.rs
@@ -1,27 +1,37 @@
use http::header::CONTENT_DISPOSITION;
use http::HeaderMap;
use reqwest::{multipart, Client};
-use serde_json::to_string;
+use serde_json::{from_value, to_string, Value};
use crate::api::LimitType;
-use crate::instance::UserMeta;
+use crate::errors::{ChorusError, ChorusResult};
+use crate::instance::ChorusUser;
use crate::ratelimiter::ChorusRequest;
-use crate::types::{Message, MessageSendSchema, Snowflake};
+use crate::types::{
+ Channel, CreateGreetMessage, Message, MessageAck, MessageModifySchema, MessageSearchEndpoint,
+ MessageSearchQuery, MessageSendSchema, Snowflake,
+};
impl Message {
+ /// Sends a message in the channel with the provided channel_id.
+ /// Returns the sent message.
+ ///
+ /// # Reference
+ /// See
pub async fn send(
- user: &mut UserMeta,
+ user: &mut ChorusUser,
channel_id: Snowflake,
mut message: MessageSendSchema,
- ) -> Result {
- let url_api = user.belongs_to.borrow().urls.api.clone();
+ ) -> ChorusResult {
+ let url_api = user.belongs_to.read().unwrap().urls.api.clone();
if message.attachments.is_none() {
let chorus_request = ChorusRequest {
request: Client::new()
- .post(format!("{}/channels/{}/messages/", url_api, channel_id))
- .bearer_auth(user.token())
- .body(to_string(&message).unwrap()),
+ .post(format!("{}/channels/{}/messages", url_api, channel_id))
+ .header("Authorization", user.token())
+ .body(to_string(&message).unwrap())
+ .header("Content-Type", "application/json"),
limit_type: LimitType::Channel(channel_id),
};
chorus_request.deserialize_response::(user).await
@@ -55,22 +65,462 @@ impl Message {
let chorus_request = ChorusRequest {
request: Client::new()
- .post(format!("{}/channels/{}/messages/", url_api, channel_id))
- .bearer_auth(user.token())
+ .post(format!("{}/channels/{}/messages", url_api, channel_id))
+ .header("Authorization", user.token())
.multipart(form),
limit_type: LimitType::Channel(channel_id),
};
chorus_request.deserialize_response::(user).await
}
}
+
+ /// Returns messages without the reactions key that match a search query in the guild or channel.
+ /// The messages that are direct results will have an extra hit key set to true.
+ /// If operating on a guild channel, this endpoint requires the `READ_MESSAGE_HISTORY`
+ /// permission to be present on the current user.
+ ///
+ /// If the guild/channel you are searching is not yet indexed, the endpoint will return a 202 accepted response.
+ /// In this case, the method will return a [`ChorusError::InvalidResponse`] error.
+ ///
+ /// # Reference:
+ /// See
+ pub(crate) async fn search(
+ endpoint: MessageSearchEndpoint,
+ query: MessageSearchQuery,
+ user: &mut ChorusUser,
+ ) -> ChorusResult> {
+ let limit_type = match &endpoint {
+ MessageSearchEndpoint::Channel(id) => LimitType::Channel(*id),
+ MessageSearchEndpoint::GuildChannel(id) => LimitType::Guild(*id),
+ };
+ let request = ChorusRequest {
+ limit_type,
+ request: Client::new()
+ .get(format!(
+ "{}/{}/messages/search",
+ &user.belongs_to.read().unwrap().urls.api,
+ endpoint
+ ))
+ .header("Authorization", user.token())
+ .header("Content-Type", "application/json")
+ .body(to_string(&query).unwrap()),
+ };
+ let result = request.send_request(user).await?;
+ let result_json = result.json::().await.unwrap();
+ if !result_json.is_object() {
+ return Err(search_error(result_json.to_string()));
+ }
+ let value_map = result_json.as_object().unwrap();
+ if let Some(messages) = value_map.get("messages") {
+ if let Ok(response) = from_value::>>(messages.clone()) {
+ let result_messages: Vec = response.into_iter().flatten().collect();
+ return Ok(result_messages);
+ }
+ }
+ // The code below might be incorrect. We'll cross that bridge when we come to it
+ if !value_map.contains_key("code") || !value_map.contains_key("retry_after") {
+ return Err(search_error(result_json.to_string()));
+ }
+ let code = value_map.get("code").unwrap().as_u64().unwrap();
+ let retry_after = value_map.get("retry_after").unwrap().as_u64().unwrap();
+ Err(ChorusError::NotFound {
+ error: format!(
+ "Index not yet available. Try again later. Code: {}. Retry after {}s",
+ code, retry_after
+ ),
+ })
+ }
+
+ /// Returns all pinned messages in the channel as a Vector of message objects without the reactions key.
+ /// # Reference:
+ /// See:
+ pub async fn get_sticky(
+ channel_id: Snowflake,
+ user: &mut ChorusUser,
+ ) -> ChorusResult> {
+ let chorus_request = ChorusRequest::new(
+ http::Method::GET,
+ format!(
+ "{}/channels/{}/pins",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id
+ )
+ .as_str(),
+ None,
+ None,
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+ chorus_request
+ .deserialize_response::>(user)
+ .await
+ }
+
+ /// Pins a message in a channel. Requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success.
+ /// The max pinned messages is 50.
+ ///
+ /// # Reference:
+ /// See:
+ pub async fn sticky(
+ channel_id: Snowflake,
+ message_id: Snowflake,
+ audit_log_reason: Option<&str>,
+ user: &mut ChorusUser,
+ ) -> ChorusResult<()> {
+ let request = ChorusRequest::new(
+ http::Method::PUT,
+ format!(
+ "{}/channels/{}/pins/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id,
+ message_id
+ )
+ .as_str(),
+ None,
+ audit_log_reason,
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+ request.handle_request_as_result(user).await
+ }
+
+ /// Unpins a message in a channel. Requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success.
+ /// # Reference:
+ /// See:
+ pub async fn unsticky(
+ channel_id: Snowflake,
+ message_id: Snowflake,
+ audit_log_reason: Option<&str>,
+ user: &mut ChorusUser,
+ ) -> ChorusResult<()> {
+ let request = ChorusRequest::new(
+ http::Method::DELETE,
+ format!(
+ "{}/channels/{}/pins/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id,
+ message_id
+ )
+ .as_str(),
+ None,
+ audit_log_reason,
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+ request.handle_request_as_result(user).await
+ }
+
+ /// Returns a specific message object in the channel.
+ /// If operating on a guild channel, this endpoint requires the `READ_MESSAGE_HISTORY` permission to be present on the current user.
+ /// # Reference:
+ /// See:
+ pub async fn get(
+ channel_id: Snowflake,
+ message_id: Snowflake,
+ user: &mut ChorusUser,
+ ) -> ChorusResult {
+ let chorus_request = ChorusRequest {
+ request: Client::new()
+ .get(format!(
+ "{}/channels/{}/messages/{}",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id,
+ message_id
+ ))
+ .header("Authorization", user.token())
+ .header("Content-Type", "application/json"),
+ limit_type: LimitType::Channel(channel_id),
+ };
+ chorus_request.deserialize_response::(user).await
+ }
+
+ /// Posts a greet message to a channel. This endpoint requires the channel is a DM channel or you reply to a system message.
+ /// # Reference:
+ /// See:
+ pub async fn create_greet(
+ channel_id: Snowflake,
+ schema: CreateGreetMessage,
+ user: &mut ChorusUser,
+ ) -> ChorusResult {
+ let request = ChorusRequest::new(
+ http::Method::POST,
+ format!(
+ "{}/channels/{}/messages/greet",
+ user.belongs_to.read().unwrap().urls.api,
+ channel_id,
+ )
+ .as_str(),
+ Some(to_string(&schema).unwrap()),
+ None,
+ None,
+ Some(user),
+ LimitType::Channel(channel_id),
+ );
+ request.deserialize_response::(user).await
+ }
+
+ /// Sets the channel's latest acknowledged message (marks a message as read) for the current user.
+ /// The message ID parameter does not need to be a valid message ID, but it must be a valid snowflake.
+ /// If the message ID is being set to a message sent prior to the latest acknowledged one,
+ /// manual should be true or the resulting read state update should be ignored by clients (but is still saved), resulting in undefined behavior.
+ /// In this case, mention_count should also be set to the amount of mentions unacknowledged as it is not automatically calculated by Discord.
+ ///
+ /// Returns an optional token, which can be used as the new `ack` token for following `ack`s.
+ ///
+ /// # Reference:
+ /// See:
+ pub async fn acknowledge(
+ channel_id: Snowflake,
+ message_id: Snowflake,
+ schema: MessageAck,
+ user: &mut ChorusUser,
+ ) -> ChorusResult