diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..790f680 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2166 @@ +# 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 = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[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 0.52.6", +] + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link 0.2.0", +] + +[[package]] +name = "clap" +version = "4.5.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" +dependencies = [ + "cookie", + "document-features", + "idna", + "log", + "publicsuffix", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "deranged" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "document-features" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +dependencies = [ + "litrs", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.0", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[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 = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.7+wasi-0.2.4", +] + +[[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.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[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 = "humantime" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" + +[[package]] +name = "hyper" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852f13bec5eba4ba9afbeb93fd7c13fe56147f055939ae21c43a29a0ecb2702e" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.175" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "litrs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[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 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[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 = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[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 = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psl-types" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" + +[[package]] +name = "publicsuffix" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" +dependencies = [ + "idna", + "psl-types", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "redox_syscall" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + +[[package]] +name = "reqwest" +version = "0.12.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" +dependencies = [ + "base64", + "bytes", + "cookie", + "cookie_store", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.0", +] + +[[package]] +name = "rustls" +version = "0.23.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8572f3c2cb9934231157b45499fc41e1f58c589fdfb81a844ba873265e80f8eb" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.226" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.226" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.226" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[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 0.59.0", +] + +[[package]] +name = "spond" +version = "0.1.0" +dependencies = [ + "chrono", + "clap", + "env_logger", + "log", + "reqwest", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +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" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.61.0", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[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", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[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-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f63835928ca123f1bef57abbcd23bb2ba0ac9ae1235f1e65bda0d06e7786bd" +dependencies = [ + "rustls", + "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 = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[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-core", +] + +[[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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[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 = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab10a69fbd0a177f5f649ad4d8d3305499c42bab9aef2f7ff592d0ec8f833819" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb702423545a6007bbc368fde243ba47ca275e549c8a28617f56f6ba53b1d1c" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0b221ff421256839509adbb55998214a70d829d3a28c69b4a6672e9d2a42f67" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc65f4f411d91494355917b605e1480033152658d71f722a90647f56a70c88a0" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc003a991398a8ee604a401e194b6b3a39677b3173d6e74495eb51b82e99a32" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "293c37f4efa430ca14db3721dfbe48d8c33308096bd44d80ebaa775ab71ba1cf" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbe734895e869dc429d78c4b433f8d17d95f8d05317440b4fad5ab2d33e596dc" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.0", +] + +[[package]] +name = "windows-core" +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fe7168f7de578d2d8a05b07fd61870d2e73b4020e9f49aa00da8471723497c" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.0", + "windows-result 0.4.0", + "windows-strings 0.5.0", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + +[[package]] +name = "windows-registry" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" +dependencies = [ + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", +] + +[[package]] +name = "windows-sys" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +dependencies = [ + "windows-link 0.2.0", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link 0.1.3", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[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_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[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_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e66338c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "spond" +version = "0.1.0" +edition = "2024" + +[dependencies] +clap = { version = "4.5", features = [ "derive" ] } +reqwest = { version = "0.12", features = [ "json", "cookies" ] } +tokio = { version = "1", features = [ "full" ] } +serde = "1.0" +env_logger = "0.10" +log = "0.4" +chrono = { version = "0.4", features = [ "serde" ] } +serde_json = "1.0" diff --git a/api/Cargo.toml b/api/Cargo.toml deleted file mode 100644 index c9643b8..0000000 --- a/api/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "spond" -version = "0.1.0" -edition = "2024" - -[features] -reqwest = [ "dep:reqwest", "reqwest/json" ] -log = [ "tracing/log" ] -tracing = [ ] -cookies = [ "reqwest?/cookies" ] - - -[dependencies] -async-trait = "0.1.89" -bon = "3.9.0" -bytes = "1.11.1" -chrono = { version = "0.4.43", features = ["serde"] } -#macro = { path = "../macro" } -reqwest = { version = "0.13.2", optional = true } -serde = { version = "1.0.228", features = ["derive"] } -serde_json = "1.0.149" -#spond-auth-login = { version = "0.1.0", path = "../login" } -thiserror = "2.0.18" -tokio = { version = "1.49.0" } -tracing = { version = "0.1.44", features = [] } -url = "2.5.8" - -[dev-dependencies] -tokio = { version = "1.49.0", features = ["macros"] } diff --git a/api/src/authentication/login/email.rs b/api/src/authentication/login/email.rs deleted file mode 100644 index 678b60b..0000000 --- a/api/src/authentication/login/email.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[derive(Debug, serde::Serialize)] -pub struct Email { - email: String, - password: String, -} - -impl Email { - pub fn new(email: &str, password: &str) -> Self { - Self { - email: email.to_string(), - password: password.to_string(), - } - } -} - -impl super::Credentials for Email {} diff --git a/api/src/authentication/login/mod.rs b/api/src/authentication/login/mod.rs deleted file mode 100644 index 8ac83b5..0000000 --- a/api/src/authentication/login/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -mod email; -mod phone; - -pub use email::Email; -pub use phone::Phone; - -use crate::{ - Method, - authentication::Tokens, - traits::{authentication::login::Credentials, endpoint}, -}; - -pub struct Login; - -impl endpoint::Public for Login { - const METHOD: Method = Method::POST; - type Schema = Tokens; - - fn path(&self, _: &C) -> &str { - "core/v1/auth2/login" - } -} diff --git a/api/src/authentication/login/phone.rs b/api/src/authentication/login/phone.rs deleted file mode 100644 index ad68c23..0000000 --- a/api/src/authentication/login/phone.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[derive(Debug, serde::Serialize)] -pub struct Phone { - phone: String, - password: String, -} - -impl Phone { - pub fn new(phone: &str, password: &str) -> Self { - Self { - phone: phone.to_string(), - password: password.to_string(), - } - } -} - -impl super::Credentials for Phone {} diff --git a/api/src/authentication/mod.rs b/api/src/authentication/mod.rs deleted file mode 100644 index bba562c..0000000 --- a/api/src/authentication/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub mod login; -pub mod token; - -pub use login::Login; -pub use token::Token; - -use serde::Deserialize; - -#[derive(Debug, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Tokens { - pub access_token: token::Access, - pub refresh_token: token::Refresh, -} diff --git a/api/src/authentication/token.rs b/api/src/authentication/token.rs deleted file mode 100644 index a7bdce8..0000000 --- a/api/src/authentication/token.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::traits::Request; -use chrono::{DateTime, Utc}; -use serde::{Deserialize, Serialize}; - -use std::ops::Deref; - -#[derive(Debug, Clone, Deserialize)] -pub struct Access(Expire); - -impl Deref for Access { - type Target = Expire; - - fn deref(&self) -> &Expire { - &self.0 - } -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct Refresh(Expire); - -impl Deref for Refresh { - type Target = Expire; - - fn deref(&self) -> &Expire { - &self.0 - } -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct Token { - token: String, -} - -impl AsRef for Token { - fn as_ref(&self) -> &str { - &self.token - } -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct Expire { - #[serde(flatten)] - token: Token, - #[serde(skip_serializing)] - expiration: DateTime, -} - -impl Expire { - pub fn expired(&self) -> bool { - Utc::now() <= self.expiration - } -} - -impl Deref for Expire { - type Target = Token; - - fn deref(&self) -> &Token { - &self.token - } -} - -trait Factory: Serialize {} -impl Factory for Refresh {} -impl Factory for Token {} - -impl crate::traits::endpoint::Public for R -{ - const METHOD: crate::Method = crate::Method::POST; - type Schema = super::Tokens; - - fn path(&self, _: &R) -> &str { - "auth2/refresh" - } -} diff --git a/api/src/authorization.rs b/api/src/authorization.rs deleted file mode 100644 index 19c38d5..0000000 --- a/api/src/authorization.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub struct True; -pub struct False; diff --git a/api/src/error.rs b/api/src/error.rs deleted file mode 100644 index 92ae258..0000000 --- a/api/src/error.rs +++ /dev/null @@ -1,67 +0,0 @@ -use thiserror::Error; - -pub mod api { - use thiserror::Error; - - pub type Refresh = Public; - - #[derive(Debug, Error)] - pub enum Private { - #[error("endpoint url")] - Url(url::ParseError), - - #[error("json decode")] - Decode(Decode), - - #[error("unauthorized")] - Unauthorized, - - #[error("token refresh")] // TODO: serde_json::Error -> Schema::...? - Refresh(Refresh), - - #[error("send error")] - Send(Transfer), - - #[error("receive error")] - Receive(Transfer), - } - - #[derive(Debug, Error)] - pub enum Public { - #[error("endpoint url")] - Url(url::ParseError), - - #[error("json decode")] - Decode(Decode), - - #[error("send error")] - Send(Transfer), - - #[error("receive error")] - Receive(Transfer), - } -} - -#[derive(Debug, Error)] -pub enum Id { - #[error("invalid length")] - Length(usize), - - #[error("invalid symbol")] - Parser(#[from] std::num::ParseIntError), -} - -#[derive(Debug, Error)] -pub enum Authorization { - #[error("unauthorized")] - Unauthorized, -} - -//#[derive(Debug, Error)] -//pub enum Authentication { -// #[error("unauthorized")] -// Public(A), -// -// #[error("authorized")] -// Private(B), -//} diff --git a/api/src/id.rs b/api/src/id.rs deleted file mode 100644 index b4c4003..0000000 --- a/api/src/id.rs +++ /dev/null @@ -1,50 +0,0 @@ -use serde::{Serialize, Deserialize}; -use std::{ - fmt, - str::FromStr, - ops::Deref, -}; - -use crate::{ - utils::X128, - traits::id::Marker, -}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct Id { - #[serde(flatten)] - id: X128, - #[serde(skip)] - _marker: std::marker::PhantomData, -} - -impl Id { - pub fn new(value: impl Into) -> Self { - Self { - id: value.into(), - _marker: std::marker::PhantomData, - } - } -} - -impl Deref for Id { - type Target = X128; - - fn deref(&self) -> &X128 { - &self.id - } -} - -impl fmt::Display for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.id) - } -} - -impl FromStr for Id { - type Err = ::Err; - - fn from_str(s: &str) -> Result { - X128::from_str(s).map(Self::new) - } -} diff --git a/api/src/lib.rs b/api/src/lib.rs deleted file mode 100644 index 0fdb56e..0000000 --- a/api/src/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub mod authentication; -pub mod authorization; -pub mod error; -pub mod id; -pub mod schema; -pub mod traits; - -mod utils; - -#[derive(Debug)] -pub enum Method { - GET, - POST, -} - -pub use id::Id; - - -#[cfg(feature = "reqwest")] -pub mod reqwest; diff --git a/api/src/reqwest/client.rs b/api/src/reqwest/client.rs deleted file mode 100644 index d2e59e7..0000000 --- a/api/src/reqwest/client.rs +++ /dev/null @@ -1,133 +0,0 @@ -use async_trait::async_trait; -use crate::{ - authentication, - error, -}; -use crate::traits::{ - client, - endpoint, - Request, - Schema, -}; - -pub struct Public { - client: reqwest::Client, - base: url::Url, -} - -pub struct Private { - public: Public, - tokens: tokio::sync::RwLock, -} - -impl Private { - async fn current_token(&self) -> authentication::Token { - let tokens = self.tokens.read().await; - let token: &authentication::Token = (&*tokens).into(); - token.clone() - } - - async fn refresh_tokens(&self) -> Result> { - let mut tokens = self.tokens.write().await; - *tokens = (*tokens).refresh(self).await?; - let token: &authentication::Token = (&*tokens).into(); - Ok(token.clone()) - } -} - -pub type Client = Private; - - -type AuthorizedError, R: Request> = error::api::Private; -type UnauthorizedError, R: Request> = error::api::Public; - -async fn authorized(client: &reqwest::Client, method: reqwest::Method, base: &url::Url, path: &str, request: &R, token: &authentication::Token) -> Result> -where - R: Request + Sync, - S: Schema, -{ - let url = base.join(path).map_err(AuthorizedError::::Url)?; - - let response = client.request(method, url) - .json(request) - .bearer_auth(token.as_ref()) - .send() - .await - .map_err(AuthorizedError::::Send)?; - - let body = match response.status() { - _ => response.text_with_charset("utf-8") - .await - .map_err(AuthorizedError::::Receive)?, - }; - - S::deserialize(request, &body).map_err(AuthorizedError::::Decode) -} - -async fn unauthorized(client: &reqwest::Client, method: reqwest::Method, base: &url::Url, path: &str, request: &R) -> Result> -where - R: Request + Sync, - S: Schema, -{ - let url = base.join(path).map_err(UnauthorizedError::::Url)?; - - let response = client.request(method, url) - .json(request) - .send() - .await - .map_err(UnauthorizedError::::Send)?; - - let body = match response.status() { - _ => response.text_with_charset("utf-8") - .await - .map_err(UnauthorizedError::::Receive)?, - }; - - S::deserialize(request, &body).map_err(UnauthorizedError::::Decode) -} - -#[async_trait] -impl client::Public for Public { - type Error = reqwest::Error; - - async fn execute(&self, endpoint: &E, request: &R) -> Result>::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync, - { - unauthorized::(&self.client, E::METHOD.into(), &self.base, endpoint.path(request), &request).await - } -} - -#[async_trait] -impl client::Public for Private { - type Error = reqwest::Error; - - async fn execute(&self, endpoint: &E, request: &R) -> Result>::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync, - { - self.public.execute::(endpoint, request).await - } -} - -#[async_trait] -impl client::Private for Private { - type Error = reqwest::Error; - - async fn execute(&self, endpoint: &E, request: &R) -> Result>::Error>> - where - E: endpoint::Private + Sync, - R: Request + Sync, - { - let token = self.current_token().await; - match authorized::(&self.public.client, E::METHOD.into(), &self.public.base, endpoint.path(request), &request, &token).await { - Err(AuthorizedError::::Unauthorized) if token.expired() => { - let token = self.refresh_tokens().await.map_err(AuthorizedError::::Refresh)?; - authorized::(&self.public.client, E::METHOD.into(), &self.public.base, endpoint.path(request), &request, &token).await - }, - result => result, - } - } -} diff --git a/api/src/reqwest/mod.rs b/api/src/reqwest/mod.rs deleted file mode 100644 index 8b3f738..0000000 --- a/api/src/reqwest/mod.rs +++ /dev/null @@ -1,250 +0,0 @@ -use crate::Method; -pub use reqwest; - -impl From for reqwest::Method { - fn from(method: Method) -> Self { - match method { - Method::GET => reqwest::Method::GET, - Method::POST => reqwest::Method::POST, - } - } -} -use crate::traits::{Request, Schema, client, endpoint}; -use crate::{authentication, error}; -use async_trait::async_trait; - -#[derive(Debug, Clone)] -pub struct Public { - client: reqwest::Client, - base: url::Url, -} - -impl Public { - pub fn new() -> Result { - let base = url::Url::parse("https://api.spond.com").unwrap(); - Self::new_with_base(base) - } - - pub fn new_with_base(base: url::Url) -> Result { - let client = reqwest::Client::builder() - .https_only(true) - .redirect(reqwest::redirect::Policy::limited(1)); - #[cfg(feature = "cookies")] - let client = client.cookie_store(true); - #[cfg(feature = "tracing")] - let client = client.connection_verbose(true); - - let client = client - //.user_agent("...") - //.read_timeout(std::time::Duration) - //.connect_timeout(std::time::Duration) - .build()?; - Ok(Self { client, base }) - } -} - -#[async_trait] -impl client::Authenticator for Public { - type Private = Private; - - fn with_tokens(&self, tokens: authentication::Tokens) -> Self::Private { - Private { - public: self.clone(), - tokens: tokio::sync::RwLock::new(tokens), - } - } -} - -#[derive(Debug)] -pub struct Private { - public: Public, - tokens: tokio::sync::RwLock, -} - -impl Private { - async fn current_token(&self) -> authentication::token::Access { - let tokens = self.tokens.read().await; - tokens.access_token.clone() - } - - async fn refresh_tokens( - &self, - ) -> Result> { - use client::Public; - let mut tokens = self.tokens.write().await; - *tokens = self - .public - .execute(&tokens.refresh_token, &tokens.refresh_token) - .await?; - Ok((*tokens).access_token.clone()) - } -} - -pub type Client = Private; - -type AuthorizedError = error::api::Private>::Error>; -type UnauthorizedError = error::api::Public>::Error>; - -#[tracing::instrument] -async fn authorized( - client: &reqwest::Client, - method: reqwest::Method, - base: &url::Url, - path: &str, - request: &R, - token: &authentication::token::Access, -) -> Result> -where - R: Request + Sync, - S: Schema, -{ - let url = base.join(path).map_err(AuthorizedError::::Url)?; - - let builder = client - .request(method, url) - .json(request) - .bearer_auth(token.as_ref()); - tracing::debug!("request: {builder:?}"); - - let response = builder - .send() - .await - .map_err(AuthorizedError::::Send)?; - tracing::debug!("response: {response:?}"); - - let body = match response.status() { - _ => response - .bytes() - .await - .map_err(AuthorizedError::::Receive)?, - }; - tracing::debug!("body: {body:?}"); - - let result = S::deserialize(request, &body).map_err(AuthorizedError::::Decode)?; - tracing::debug!("result: {result:?}"); - - Ok(result) -} - -#[tracing::instrument] -async fn unauthorized( - client: &reqwest::Client, - method: reqwest::Method, - base: &url::Url, - path: &str, - request: &R, -) -> Result> -where - R: Request + Sync, - S: Schema, -{ - let url = base.join(path).map_err(UnauthorizedError::::Url)?; - - let builder = client - .request(method, url) - .json(request); - tracing::debug!("request: {builder:?}"); - let response = builder - .send() - .await - .map_err(UnauthorizedError::::Send)?; - tracing::debug!("response: {response:?}"); - - let body = match response.status() { - _ => response - .bytes() - .await - .map_err(UnauthorizedError::::Receive)?, - }; - tracing::debug!("body: {body:?}"); - - let result = S::deserialize(request, &body).map_err(UnauthorizedError::::Decode)?; - tracing::debug!("result: {result:?}"); - - Ok(result) -} - -#[async_trait] -impl client::Public for Public { - type Error = reqwest::Error; - - async fn execute( - &self, - endpoint: &E, - request: &R, - ) -> Result>::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync, - { - unauthorized::( - &self.client, - E::METHOD.into(), - &self.base, - endpoint.path(request), - &request, - ) - .await - } -} - -#[async_trait] -impl client::Public for Private { - type Error = reqwest::Error; - - async fn execute( - &self, - endpoint: &E, - request: &R, - ) -> Result>::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync, - { - self.public.execute::(endpoint, request).await - } -} - -#[async_trait] -impl client::Private for Private { - type Error = reqwest::Error; - - async fn execute( - &self, - endpoint: &E, - request: &R, - ) -> Result>::Error>> - where - E: endpoint::Private + Sync, - R: Request + Sync, - { - let token = self.current_token().await; - match authorized::( - &self.public.client, - E::METHOD.into(), - &self.public.base, - endpoint.path(request), - &request, - &token, - ) - .await - { - Err(AuthorizedError::::Unauthorized) if token.expired() => { - let token = self - .refresh_tokens() - .await - .map_err(AuthorizedError::::Refresh)?; - authorized::( - &self.public.client, - E::METHOD.into(), - &self.public.base, - endpoint.path(request), - &request, - &token, - ) - .await - } - result => result, - } - } -} diff --git a/api/src/schema/mod.rs b/api/src/schema/mod.rs deleted file mode 100644 index 29fe093..0000000 --- a/api/src/schema/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod sponds; diff --git a/api/src/schema/sponds.rs b/api/src/schema/sponds.rs deleted file mode 100644 index ee2c814..0000000 --- a/api/src/schema/sponds.rs +++ /dev/null @@ -1,57 +0,0 @@ -// TODO: use crate::Id; -use crate::traits; - -// { -// "heading" : "Kraftraum putzen", -// "id" : "D678340FAA6341058E368AE2FB6082CA", -// "series" : false, -// "startTime" : "2026-11-07T08:00:00Z", -// "unanswered" : true, -// "updated" : 1770872490567 -// } -#[derive(serde::Deserialize, Debug)] -pub struct Spond { - pub id: crate::utils::X128, - pub updated: crate::utils::Timestamp, - pub start_time: chrono::DateTime, - pub heading: String, - #[serde(default)] - pub unanswered: bool, - pub series: bool, -} - -#[derive(serde::Deserialize, Debug, Default)] -pub struct Sponds(Vec); - -impl std::ops::Deref for Sponds { - type Target = [Spond]; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[derive(serde::Serialize, Debug)] -pub struct Upcoming; - -impl traits::endpoint::Private for Sponds { - const METHOD: crate::Method = crate::Method::GET; - type Schema = Self; - - fn path(&self, _: &Upcoming) -> &str { - "/core/v1/sponds/upcoming" - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn decode_upcoming_schema() { - const DATA: &[u8] = include_bytes!("./sponds_upcoming.json"); - let bytes = bytes::Bytes::from_static(DATA); - let v: Sponds = >::deserialize(&Upcoming, &bytes).expect("VALID JSON"); - println!("{v:?}"); - } -} diff --git a/api/src/schema/sponds_upcoming.json b/api/src/schema/sponds_upcoming.json deleted file mode 100644 index 2787f86..0000000 --- a/api/src/schema/sponds_upcoming.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":"AD033E0F90EF4A0E889C3E0EE4F7AACD","updated":1771395198239,"startTime":"2026-02-18T18:00:00Z","heading":"Abteilungsversammlung","series":false},{"id":"65CC28113E724113B1CE9AEC2BBF153E","updated":1771280224611,"startTime":"2026-02-19T13:00:00Z","heading":"Test","series":false},{"id":"5737EB7C021F498E878F14F4A9B39E63","updated":1771368685416,"startTime":"2026-02-19T18:45:00Z","heading":"Krafttraining Donnerstag","unanswered":true,"series":true},{"id":"81B37D845FB944E8A2652A8D425DB83E","updated":1771368696319,"startTime":"2026-02-20T17:30:00Z","heading":"Krafttraining Freitag","unanswered":true,"series":true},{"id":"0FD94BC6EE5243968BA068277DDAF5B1","updated":1771399515512,"startTime":"2026-02-21T10:45:00Z","heading":"Schwimmtraining Samstag","unanswered":true,"series":true},{"id":"4E6B81B750A34896AAD681E66A477AE4","updated":1770822214509,"startTime":"2026-02-22T09:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"94F4351412E14788B1CE8020A43E22AE","updated":1771341718834,"startTime":"2026-02-22T17:25:00Z","heading":"Athletik-Training","unanswered":true,"series":true},{"id":"E1D9A6C5C1554070BA592C2752270906","updated":1770872493135,"startTime":"2026-02-23T18:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"AC4C0EDD66FE4C29A66E6F637B5EF7AB","updated":1770872492350,"startTime":"2026-02-24T16:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"333BDC3E6DC04897B79334C887865DB1","updated":1770872490703,"startTime":"2026-02-25T18:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"CFB8D04583DA4F05977ABAB63821570E","updated":1770896398600,"startTime":"2026-02-26T18:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"D621B290A9B74F4CB5FFD4950F6EEBA4","updated":1770872491371,"startTime":"2026-02-26T18:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"547699FCE1944010A67A707399AE2A89","updated":1770872492706,"startTime":"2026-02-27T17:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"E06314BDF7804A9C83B6EE4E01DD4831","updated":1770809084109,"startTime":"2026-02-28T10:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"5360D7D37ED74F2D904B71BD4DA55B1F","updated":1770872492022,"startTime":"2026-03-01T09:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"16A8E790B9324173B57819E7687DC19E","updated":1770872491695,"startTime":"2026-03-01T17:25:00Z","heading":"Athletik-Training","series":true},{"id":"4D9928E94A0445CB8A29510BC619890C","updated":1770872493135,"startTime":"2026-03-02T18:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"6A99A0909F2346C796B14A011C613930","updated":1770872492350,"startTime":"2026-03-03T16:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"200FC5E4DCAB472EB96547CF468AC51E","updated":1770872490703,"startTime":"2026-03-04T18:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"25F4F0277E234C6BAE706A6828356D33","updated":1770896398600,"startTime":"2026-03-05T18:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"76416FBD18A4480E8FD8D0A09FE2F894","updated":1770872491371,"startTime":"2026-03-05T18:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"B67A85BEFCBB43BCB02E4A2B8E8BC5EE","updated":1770872492706,"startTime":"2026-03-06T17:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"E555E5F9355B429498E2650F409CDD4A","updated":1770571414141,"startTime":"2026-03-07T10:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"9628DFD73A0944C59819A5178AF5F912","updated":1770872492022,"startTime":"2026-03-08T09:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"44DDB2ACA9554DD89DD41F1EDF0EF7D4","updated":1770872491695,"startTime":"2026-03-08T17:25:00Z","heading":"Athletik-Training","series":true},{"id":"2E7E5A07FF4946F2AD0588922E39A966","updated":1770872493135,"startTime":"2026-03-09T18:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"6FE61FCEADBC40028CE048E78A38503B","updated":1770872492350,"startTime":"2026-03-10T16:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"CF0AA0DD1C0A43D681EEC7175F0B6030","updated":1770872490703,"startTime":"2026-03-11T18:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"E41A8DC5976E44CDBB944ABFABB939CF","updated":1770896398600,"startTime":"2026-03-12T18:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"F131CD46F80A42B9909D8E7F4018D8E1","updated":1770872491371,"startTime":"2026-03-12T18:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"A06ADBDC5FE547EA90B90A6886BF8FDF","updated":1770872492706,"startTime":"2026-03-13T17:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"2EF37B808AAE4C6AB0E053E31F381A75","updated":1770809084109,"startTime":"2026-03-14T10:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"FE0B1F8BC436438DA95E8F22A8FE6E61","updated":1770872492022,"startTime":"2026-03-15T09:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"CF6FEAE6EB14471184D5831945455005","updated":1770872491695,"startTime":"2026-03-15T17:25:00Z","heading":"Athletik-Training","series":true},{"id":"41AB8F2F49D54878A596268E3131D5F4","updated":1770872493135,"startTime":"2026-03-16T18:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"2590B6BFAFEF43E58C8040A127D5D119","updated":1770872492350,"startTime":"2026-03-17T16:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"922D71BF46F142CCAFEEE3933367ECD0","updated":1770872490703,"startTime":"2026-03-18T18:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"9E9960878AF847D08453E6618FCD1DE8","updated":1770896398600,"startTime":"2026-03-19T18:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"C3A14D8B724841079CD4AF2BEEBF452B","updated":1770872491371,"startTime":"2026-03-19T18:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"C43851BAF8914794935D0548BA7AF60D","updated":1770872492706,"startTime":"2026-03-20T17:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"AC95CBE05E8A4EB3BCCD8F4A180BA7FC","updated":1770809084109,"startTime":"2026-03-21T10:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"315A7320E90B493299341E5FBC4E3704","updated":1770872489876,"startTime":"2026-03-21T11:00:00Z","heading":"WK Run: Erlanger Winterwaldlauf","unanswered":true,"series":false},{"id":"7623A15FBB7C42F79A113F4428BC95D3","updated":1770872492022,"startTime":"2026-03-22T09:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"420B2D3BCB9548DCB80FBAFDD13ED962","updated":1770872491695,"startTime":"2026-03-22T17:25:00Z","heading":"Athletik-Training","series":true},{"id":"0CA6E6E0EB65442F89641D2EE895CE09","updated":1770872493135,"startTime":"2026-03-23T18:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"42064DCFCA4B49E98F9614AB3C7AABD0","updated":1770872492350,"startTime":"2026-03-24T16:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"1D49ABF2ED8D4C139675673800C62995","updated":1770872490703,"startTime":"2026-03-25T18:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"77346DC63E7B47FAA0328039F724B78F","updated":1770896398600,"startTime":"2026-03-26T18:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"6D23D3D0E9F2462180417BCA21E873CE","updated":1770872491371,"startTime":"2026-03-26T18:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"BB1F770E56954C4289213A09444DB76C","updated":1770872492706,"startTime":"2026-03-27T17:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"F0A208D28BF6436F87543E6324E58FC7","updated":1770809084109,"startTime":"2026-03-28T10:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"16FC02765C124B4EB950BA84D0C10069","updated":1770872492022,"startTime":"2026-03-29T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"1410B75032484CF19E676C894C128B85","updated":1770872491695,"startTime":"2026-03-29T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"F8A7A4616D154897AA7BD0F9C78C62FA","updated":1770872493135,"startTime":"2026-03-30T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"3A9517F2FD80451F9E2DE185FF887DC6","updated":1770872492350,"startTime":"2026-03-31T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"BE005E971955419B872333C538A819D8","updated":1770872490703,"startTime":"2026-04-01T17:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"318130BCC9E6404BB90123E731F04808","updated":1770896398600,"startTime":"2026-04-02T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"41A78760E3C949379E6E8C786A4B4574","updated":1770872491371,"startTime":"2026-04-02T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"87538464E4AD4AE29D8E6A4E8FD01C8E","updated":1770872492706,"startTime":"2026-04-03T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"6EE6269B5A204CC0AE2B6A04732D4775","updated":1770809084109,"startTime":"2026-04-04T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"B6DDBD0298A0449783DFD2AE956A3D26","updated":1770872492022,"startTime":"2026-04-05T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"FAB6FA8FB7554EC184B020001ADD8B94","updated":1770872491695,"startTime":"2026-04-05T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"E4424B8088D54FD38A9D18B1F0BDD3EC","updated":1770872493135,"startTime":"2026-04-06T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"A465565A012F4B3D8F0A723A3FEFCAA3","updated":1770872492350,"startTime":"2026-04-07T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"F142A604C9894396B10F22CAA01F8D7B","updated":1770872490703,"startTime":"2026-04-08T17:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"8EFED442D9444478A375DCFDBAFF0BDA","updated":1770896398600,"startTime":"2026-04-09T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"C27D9930301F4CC8B01CD8180BE0E10E","updated":1770872491371,"startTime":"2026-04-09T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"EE93FA9F675D401285AE2B501C31AED5","updated":1770872492706,"startTime":"2026-04-10T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"F94829E35A9B4A48A042646C8B658B01","updated":1770809084109,"startTime":"2026-04-11T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"4CA9B19A86204C2B8B47C469A4C54504","updated":1770872489114,"startTime":"2026-04-12T05:00:00Z","heading":"WK Run: Obermain-Marathon Bad Staffelstein","unanswered":true,"series":false},{"id":"2DB79CCDC3024429927D949DA45CCBE7","updated":1770872492022,"startTime":"2026-04-12T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"D194BD466EE74247A10BC41CE9094CB0","updated":1770872491695,"startTime":"2026-04-12T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"A141E76AA03345B3B32ED01FC602DEEA","updated":1770872493135,"startTime":"2026-04-13T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"274FE98580DD413FB58E784DD3BD99B5","updated":1770872492350,"startTime":"2026-04-14T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"731D5094989147659BC937327B235FE7","updated":1770872490703,"startTime":"2026-04-15T17:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"D52B3730DD404254BE7B517640ED174E","updated":1770896398600,"startTime":"2026-04-16T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"C389610AC9BF4970A3AFBB36431FE585","updated":1770872491371,"startTime":"2026-04-16T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"FEA2E4FFC9E6452EAB7B289223724EC5","updated":1770872492706,"startTime":"2026-04-17T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"950F44DE301F4A548F541B0FE5ED399F","updated":1770809084109,"startTime":"2026-04-18T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"79A681BC733A477A88794B26A9D0093E","updated":1770872492022,"startTime":"2026-04-19T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"D9310DC4BA274B6B90EBDF9D1E1F998F","updated":1770872491695,"startTime":"2026-04-19T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"53243D99E9824746B6C32711AF5B6900","updated":1770872493135,"startTime":"2026-04-20T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"47C16959F4774D3A8B36F9ECB42EE843","updated":1770872492350,"startTime":"2026-04-21T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"B3E387563B0745DEA0F720F3F26D66F6","updated":1770872490703,"startTime":"2026-04-22T17:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"07B9D6739D0B481EB7219F12461F3AC4","updated":1770896398600,"startTime":"2026-04-23T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"739F2147F8F7454CA339B14F7F9664E1","updated":1770872491371,"startTime":"2026-04-23T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"349B839EB9464198B62535EBC758E2FF","updated":1770872492706,"startTime":"2026-04-24T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"086E679C1E0B41F29025308C33B10B41","updated":1770809084109,"startTime":"2026-04-25T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"B15B6E51DD2749FCA773841632E66129","updated":1771358967671,"startTime":"2026-04-25T15:00:00Z","heading":"WK Swim & Run: Forcheim","unanswered":true,"series":false},{"id":"0E69CE6CFDE14A3DAB54E9CA9CA17469","updated":1770872492022,"startTime":"2026-04-26T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"62ED6865F64A4AD0BF5C8F5DCB236B4D","updated":1770872491695,"startTime":"2026-04-26T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"3BBC799F72094D809B5F08111449AA6D","updated":1770872493135,"startTime":"2026-04-27T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"564E309B351F4084BA75C19CEE97869C","updated":1770872492350,"startTime":"2026-04-28T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"FC025A3D356F4E2D8BA00F4A8C958F58","updated":1770872490703,"startTime":"2026-04-29T17:25:00Z","heading":"Virtual Bike Training (ictrainer)","series":true},{"id":"6FA76E8266B141AB9A2668749132240C","updated":1770896398600,"startTime":"2026-04-30T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"4003D5F0A3504F93BE84AAC86CD9973A","updated":1770872491371,"startTime":"2026-04-30T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"27A1A2E7F78E427295E26B2A83658B2E","updated":1770872489399,"startTime":"2026-05-01T06:00:00Z","heading":"WK Bike: Eschborn-Frankfurt","unanswered":true,"series":false},{"id":"9710E49CF5454A139B47D577A0219984","updated":1770872492706,"startTime":"2026-05-01T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"8B2233B360524F7695B64148E432C68F","updated":1770809084109,"startTime":"2026-05-02T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"33C43197140F4E009549B7339278C2D2","updated":1770872492022,"startTime":"2026-05-03T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"8F1843E801E544F4822F7F92AAA822DF","updated":1770872491695,"startTime":"2026-05-03T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"3D3F7931216E46D69FED303DB3DAECE3","updated":1770872493135,"startTime":"2026-05-04T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"CB9DB4AE1C684E9CA419798C2380D964","updated":1770872492350,"startTime":"2026-05-05T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"0298D709FE364907BB99E9F370D528BE","updated":1770896398600,"startTime":"2026-05-07T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"B25FE6D86FE241EF8CDBFEA9A1CCFDD2","updated":1770872491371,"startTime":"2026-05-07T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"403CA787543F4A83ABD9A23FC3A32F46","updated":1770872492706,"startTime":"2026-05-08T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"8DD4409556DE4F108A5179C436A00C34","updated":1770872489612,"startTime":"2026-05-09T04:00:00Z","heading":"WK Tri: Weiden Triathlon","unanswered":true,"series":false},{"id":"8180BAAD76A24DC2B94D4394CF21BD58","updated":1770809084109,"startTime":"2026-05-09T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"7AF03606CF784532A080EF75718517F3","updated":1770872492022,"startTime":"2026-05-10T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"369E46341FAD44189558D1CA369A2D16","updated":1770872491695,"startTime":"2026-05-10T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"14B080871B8541A4AB7F6B05D698D9E4","updated":1770872493135,"startTime":"2026-05-11T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"CEFAEB27108548C08BDFAEC83B192086","updated":1770872492350,"startTime":"2026-05-12T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"9486F14CB6F9474F850465A13D84B1EC","updated":1770896398600,"startTime":"2026-05-14T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"DCDA1DA4197844B8BEFDCA921BC3FD27","updated":1770872491371,"startTime":"2026-05-14T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"A3A3A0C1C8B544C580993B3E4E53AF40","updated":1770872492706,"startTime":"2026-05-15T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"FC1C7372F16B4893942EB5910DA60C0F","updated":1770809084109,"startTime":"2026-05-16T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"5B35D8E10EFB4A34B6BE08C463CE3842","updated":1770872490042,"startTime":"2026-05-17T05:00:00Z","heading":"WK Tri: Schweinfurt MainCityTriathlon","unanswered":true,"series":false},{"id":"2DAA54C83EB54DF6B09FB09E4BC53244","updated":1770872492022,"startTime":"2026-05-17T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"6E2047A76DDB4B9188DDDC1A046FB2BC","updated":1770872491695,"startTime":"2026-05-17T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"DF4F4BA284604010A11EA7CAF81ECFF1","updated":1770872493135,"startTime":"2026-05-18T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"2171B4D900134E729F13289C3C4FE0C8","updated":1770872492350,"startTime":"2026-05-19T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"62E1A57B3938448DA6561B2242ED5668","updated":1770896398600,"startTime":"2026-05-21T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"AA9279C8100F4BD49D39274BD5A1AD12","updated":1770872491371,"startTime":"2026-05-21T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"F05A75CA3B294EABB4E3526C0A02DED2","updated":1770872492706,"startTime":"2026-05-22T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"88312F5063ED4F3AA07323F3D22F5E16","updated":1770809084109,"startTime":"2026-05-23T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"A4334CCDF2B040118297049C0D882235","updated":1770872492022,"startTime":"2026-05-24T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"128FF4E69E2D46FE9E31EF95AC276612","updated":1770872491695,"startTime":"2026-05-24T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"BDAC8DB396E148769A2468CCFC617E1D","updated":1770872493135,"startTime":"2026-05-25T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"900BE134E7CA4DEBB885F78348DF38CE","updated":1770872492350,"startTime":"2026-05-26T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"F8D90B5CD38744869FA539B6ED83D725","updated":1770896398600,"startTime":"2026-05-28T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"E79BF9D5E88A4075A26CD78A72BCC268","updated":1770872491371,"startTime":"2026-05-28T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"7FAD5D73F82341E988BA71A818EBDEC3","updated":1770872492706,"startTime":"2026-05-29T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"91B7AEEE784D4492900518284FF45255","updated":1770809084109,"startTime":"2026-05-30T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"83CEFA07B61D4D2C8905B47F9017A3A2","updated":1770872492022,"startTime":"2026-05-31T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"DBD8EC4F7ED64608AC1F4250DCCF62E1","updated":1770872491695,"startTime":"2026-05-31T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"AA55DF652913416D9C2698BA29EA694D","updated":1770872493135,"startTime":"2026-06-01T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"0DC10A25F7FC4C2FA58CAE3D50300D4C","updated":1770872492350,"startTime":"2026-06-02T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"2F7021C8234C4C4B8B6B1B85E7572DDD","updated":1770896398600,"startTime":"2026-06-04T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"517C2489DFAD4D3090A95826E6768A92","updated":1770872491371,"startTime":"2026-06-04T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"1C131C2950DB481C93A9E19322BE1630","updated":1770872492706,"startTime":"2026-06-05T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"DE3D3C652E9848C8ADAE0B6DDFFA522E","updated":1770809084109,"startTime":"2026-06-06T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"DDB1D0E25E8844A59A52DB00884C48A7","updated":1770872489185,"startTime":"2026-06-07T04:00:00Z","heading":"WK Tri: Ironman Hamburg","unanswered":true,"series":false},{"id":"58D55ABC265F4D2EBA0D56A9F38EB866","updated":1770872492022,"startTime":"2026-06-07T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"F7B66F6E50A145AA92DD4534C956A5CB","updated":1771358975548,"startTime":"2026-06-07T11:00:00Z","heading":"WK Tri: Bamberg Rattelsdorf-Ebing","unanswered":true,"series":false},{"id":"48FA244668A94754B088CF6FD833BC08","updated":1770872491695,"startTime":"2026-06-07T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"FB7F2D0E11E04775BDF3A8C128982FB7","updated":1770872493135,"startTime":"2026-06-08T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"5758BB1344984CDDB352356E12CCC00D","updated":1770872492350,"startTime":"2026-06-09T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"CB9D20D975D34D6EA5FBAD22309F48B2","updated":1770896398600,"startTime":"2026-06-11T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"62F6322CD41D45EABBA83E35DE93CBEA","updated":1770872491371,"startTime":"2026-06-11T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"8F57067F3B9F47DF8DF8C6C14F806758","updated":1770872492706,"startTime":"2026-06-12T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"4D5F35EAEC2441DCA2CDEFF1059A50FA","updated":1770809084109,"startTime":"2026-06-13T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"B8B6CF361F9A498C8BE6084A0C9EB0A4","updated":1770872489824,"startTime":"2026-06-13T11:00:00Z","heading":"WK Tri: Kallmünzer Triathlon","unanswered":true,"series":false},{"id":"DF952E9C2CE64830AD852C00874A51C2","updated":1770872489346,"startTime":"2026-06-14T05:00:00Z","heading":"WK Tri: Forcheim Triathlon","unanswered":true,"series":false},{"id":"EE7E37CB7555435DA37155ED2F2413F0","updated":1770872490149,"startTime":"2026-06-14T06:00:00Z","heading":"WK Tri: Ingolstadt Triathlon","unanswered":true,"series":false},{"id":"57F40409B2A54888A199B05B89E45915","updated":1770872492022,"startTime":"2026-06-14T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"01ADB52C67794CA7BB6D69D26E67B2FC","updated":1770872491695,"startTime":"2026-06-14T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"E57918F0FC134E069FAA880C6BC573C8","updated":1770872493135,"startTime":"2026-06-15T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"863A72BCFCDE408BAE8A2DF82E78FEB1","updated":1770872492350,"startTime":"2026-06-16T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"3A2C5200466845EB91E3A0BBB4A8DBDF","updated":1770896398600,"startTime":"2026-06-18T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"41F1816B0FFE4778A518212D5DBC1756","updated":1770872491371,"startTime":"2026-06-18T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"0FD3581FF10C40D9BEAC883864AE8F54","updated":1770872492706,"startTime":"2026-06-19T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"B5C73942755A45C0A26735A74571B147","updated":1771358989948,"startTime":"2026-06-20T05:00:00Z","heading":"WK Tri: Rothsee Triathlon - Sprint & Schüler","unanswered":true,"series":false},{"id":"B665D8CAFDA84A4BA6417E19D4A5BBCF","updated":1770809084109,"startTime":"2026-06-20T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"E2AC39AA47D641BCA494EE5E1C2A6C9D","updated":1770872489559,"startTime":"2026-06-21T05:00:00Z","heading":"WK Tri: Rothsee Triathlon - Olympisch","unanswered":true,"series":false},{"id":"0F983EDD457D4078A83CABCDC225A382","updated":1770872492022,"startTime":"2026-06-21T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"0C0247F25D5B4EEAAB046320CD9E7708","updated":1770872491695,"startTime":"2026-06-21T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"089630E27C174208A09F2380CB90F9BE","updated":1770872493135,"startTime":"2026-06-22T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"98C437703DE5486E8E64E94FF7B612F9","updated":1770872492350,"startTime":"2026-06-23T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"CEF688E08CFD4ABBA64AAA43AD77B353","updated":1770896398600,"startTime":"2026-06-25T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"A39BE570AF754754AA7F7282404D69E7","updated":1770872491371,"startTime":"2026-06-25T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"DED0BB679FE444F0AB31BED51185E471","updated":1770872492706,"startTime":"2026-06-26T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"C3E50842A4AC4CB8B02ACF8E560CC3BE","updated":1770809084109,"startTime":"2026-06-27T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"6BCB8683D912404F8ABF5C5DEF377782","updated":1770872489982,"startTime":"2026-06-28T04:00:00Z","heading":"WK Tri: Ironman Frankfurt ","unanswered":true,"series":false},{"id":"1C828D56FC3C4726959545C9C3AFF9DE","updated":1771358981104,"startTime":"2026-06-28T05:00:00Z","heading":"WK Tri: Trebgast Triathlon","unanswered":true,"series":false},{"id":"19133B8E5DB440DF99139D8E7C90B986","updated":1771359005002,"startTime":"2026-06-28T06:00:00Z","heading":"WK Tri: Herzoman","unanswered":true,"series":false},{"id":"193F5C0D4518407CB9875D8FC23B11BF","updated":1770872492022,"startTime":"2026-06-28T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"AC7CDB68663849479CE411F70F0E50C8","updated":1770872491695,"startTime":"2026-06-28T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"2FE40255B00F4115B152AC69EF6AAA31","updated":1770872493135,"startTime":"2026-06-29T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"3C6EDD866CB143EFA92D16C67E879623","updated":1770872492350,"startTime":"2026-06-30T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"D15FC0223CE047E3AE3A978F17ED7BEF","updated":1770896398600,"startTime":"2026-07-02T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"D000D3A8DE074BFCB0BBAC0E39819038","updated":1770872491371,"startTime":"2026-07-02T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"7728A184DAE64011B18848BF9F956F8D","updated":1770872492706,"startTime":"2026-07-03T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"6236B4F4769647B39EBFDAE4112AB18B","updated":1770809084109,"startTime":"2026-07-04T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"0045063DCDAE4C879F67BFFD2643B51B","updated":1770872490199,"startTime":"2026-07-05T04:00:00Z","heading":"WK Tri: Challenge Roth","unanswered":true,"series":false},{"id":"E05E9905FBD048E693BEAD63D8072B7C","updated":1770872492022,"startTime":"2026-07-05T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"985E53EF1A0740D5A397E17473E2DA7B","updated":1770872491695,"startTime":"2026-07-05T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"85EFCF12E907492CB1C49BABB7A9F55C","updated":1770872493135,"startTime":"2026-07-06T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"8069A7E5221749B8B4C55592CDA72DE4","updated":1770872492350,"startTime":"2026-07-07T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"A3DF460077DD45E8AC2D3A2524BC590C","updated":1770896398600,"startTime":"2026-07-09T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"4C47FA4C6CB4445ABB79CD4D29D59BBA","updated":1770872491371,"startTime":"2026-07-09T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"2FF7145EFE4C4AA4BE393D5CF5930EAE","updated":1770872492706,"startTime":"2026-07-10T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"2FF4B87D66664B75AEB8FB2BC21923BD","updated":1770809084109,"startTime":"2026-07-11T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"1F812F83763D4566ABBC0AAD50994716","updated":1770872490463,"startTime":"2026-07-12T05:00:00Z","heading":"WK Tri: Hof Triathlon","unanswered":true,"series":false},{"id":"13B16D2193714DFDA30D45C829FF52EF","updated":1770872492022,"startTime":"2026-07-12T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"E2F769722C3B46E099D61710A589123C","updated":1770872491695,"startTime":"2026-07-12T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"62389FE9A5AA4049B07288DC2B32B848","updated":1770872493135,"startTime":"2026-07-13T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"91625CB3B14B429CB6EB88BE7FA09BF7","updated":1770872492350,"startTime":"2026-07-14T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"713614E7EBFB4B12B52297DC9DE4E9D8","updated":1770896398600,"startTime":"2026-07-16T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"F0E9D5686E5B4FFEAE958750558EC44F","updated":1770872491371,"startTime":"2026-07-16T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"8B950304FA5D49869901651C7D42FE00","updated":1770872492706,"startTime":"2026-07-17T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"8189C6AE2A18431491D32D6A90F13D66","updated":1770809084109,"startTime":"2026-07-18T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"493EC5E1B30F47E6BE94245A189856D8","updated":1770872492022,"startTime":"2026-07-19T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"E8EBD45D473E45738ED53C60CA621944","updated":1770872491695,"startTime":"2026-07-19T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"8F009AD5ECF14302A57F2D9611A0C63D","updated":1770872493135,"startTime":"2026-07-20T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"E87E3974791B4DCA8E9123ABB140AC72","updated":1770872492350,"startTime":"2026-07-21T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"2708F93B29ED49D8941B9C05D29A7D67","updated":1770896398600,"startTime":"2026-07-23T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"3700734186F044038474C2A600EEF4F3","updated":1770872491371,"startTime":"2026-07-23T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"0D0333358AD04C33908DE97DF042F019","updated":1770872492706,"startTime":"2026-07-24T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"3C48E9130D2140FA940BD32F6D86C55F","updated":1770809084109,"startTime":"2026-07-25T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"3597C7A9DFEE4D3990F4364CDBD48854","updated":1770872490251,"startTime":"2026-07-26T05:00:00Z","heading":"WK Tri: Erlanger Triathlon","unanswered":true,"series":false},{"id":"94D76E20515341299C16C2D5558E1294","updated":1770872492022,"startTime":"2026-07-26T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"48F4A73A24BB4746B8131688789DE579","updated":1770872491695,"startTime":"2026-07-26T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"608334E080854CCE840F6378A5CD84C2","updated":1770872493135,"startTime":"2026-07-27T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"2412DB8A6556427EB8BCE4F349E13037","updated":1770872492350,"startTime":"2026-07-28T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"462D25DFBC2F4384A679CDF8D5C0691B","updated":1770896398600,"startTime":"2026-07-30T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"2DBF2336730D43AAAC58E914837C5F0E","updated":1770872491371,"startTime":"2026-07-30T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"ACC91422FAD349F48557F287B27FBD51","updated":1770872492706,"startTime":"2026-07-31T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"FDAED0C615AD4E3BAA836247D37DE6AF","updated":1770809084109,"startTime":"2026-08-01T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"8CB986167D8B4E9F916BBF3C9DDBDB3C","updated":1770872492022,"startTime":"2026-08-02T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"7A1E9CA2F54C470D89ED3A18A02ADBBA","updated":1770872491695,"startTime":"2026-08-02T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"C9D25BB4931C4E4F90465370177ECE64","updated":1770872493135,"startTime":"2026-08-03T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"120B893E4D1E496698FDEF4074887968","updated":1770872492350,"startTime":"2026-08-04T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"F49DC332CF024F62B4B3E0A0A3488580","updated":1770896398600,"startTime":"2026-08-06T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"94677D04655144E985176DE32668457E","updated":1770872491371,"startTime":"2026-08-06T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"883E2D725D46422793D2A109908495E4","updated":1770872492706,"startTime":"2026-08-07T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"F4748051C0EA47F6B7EF8B63E75AFF3A","updated":1770809084109,"startTime":"2026-08-08T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"86171BB304DB48CBB5A390CA0A55A1ED","updated":1770872489291,"startTime":"2026-08-09T05:00:00Z","heading":"WK Tri: Nürnberg Triathlon","unanswered":true,"series":false},{"id":"FF6CEF5D64474351818A14271F7C1B46","updated":1770872492022,"startTime":"2026-08-09T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"C5BC881DDCA348DA833D9D484F0EEB39","updated":1770872491695,"startTime":"2026-08-09T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"BDC179CB3C764A2690B13E2058D3EEAF","updated":1770872493135,"startTime":"2026-08-10T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"368B2DC59B324FBFA79395A96A19DB75","updated":1770872492350,"startTime":"2026-08-11T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"B0DDD8947F464018BC8DD23055EAFBD7","updated":1770896398600,"startTime":"2026-08-13T17:45:00Z","heading":"Krafttraining Donnerstag","series":true},{"id":"DA28C1995394492CBD9BE0A6C30A09D7","updated":1770872491371,"startTime":"2026-08-13T17:55:00Z","heading":"Schwimmtraining Donnerstag","series":true},{"id":"83242F9071E34B34BE5005755F1920BF","updated":1770931780528,"startTime":"2026-08-14T16:30:00Z","heading":"Krafttraining Freitag","series":true},{"id":"341C5932BF674488B2790DB969B15504","updated":1770978099780,"startTime":"2026-08-15T09:45:00Z","heading":"Schwimmtraining Samstag","series":true},{"id":"AA88F8A874DA4775A61E029631BEE55D","updated":1771056456282,"startTime":"2026-08-16T08:00:00Z","heading":"MTB am Sonntag","series":true},{"id":"FA4BCD9A656A42C3BE01B80FF50D0EBE","updated":1771086954334,"startTime":"2026-08-16T16:25:00Z","heading":"Athletik-Training","series":true},{"id":"302E7BCFAF674BBCA0EE77B0D119158E","updated":1771196256828,"startTime":"2026-08-17T17:45:00Z","heading":"Schwimmtraining Montag","series":true},{"id":"C9E5B5C2D5694F82B1F3DB1BDC0B5CBD","updated":1771306178424,"startTime":"2026-08-18T15:55:00Z","heading":"Lauftraining Intervalle Dienstag","series":true},{"id":"16EA34002E0A4AA29548881CC3FF0FD5","updated":1770872489772,"startTime":"2026-08-23T05:00:00Z","heading":"WK Tri: Allgäu Triathlon","unanswered":true,"series":false},{"id":"7686681ADE904FAFAEF03D24BA225E4C","updated":1770872490305,"startTime":"2026-08-30T05:00:00Z","heading":"WK Tri: Brombachsee Triathlon","unanswered":true,"series":false},{"id":"888EA479199B4FF588BD8DCD1D5BBAFF","updated":1770872489508,"startTime":"2026-09-06T19:00:00Z","heading":"WK Run: Fränkische Schweiz-Marathon","unanswered":true,"series":false},{"id":"C3446FA49A39439AAFB63822C7117153","updated":1771359026096,"startTime":"2026-09-13T05:00:00Z","heading":"WK Tri: Seenland Triathlon","unanswered":true,"series":false},{"id":"2123C68846F94E4EAA30C2153124A231","updated":1770872489927,"startTime":"2026-09-20T08:00:00Z","heading":"WK Run: Tegernseelauf","unanswered":true,"series":false},{"id":"43C7F527BE1441C0A4CE29E566F49516","updated":1771359109568,"startTime":"2026-09-27T05:00:00Z","heading":"WK Run: Marathon Berlin","unanswered":true,"series":false},{"id":"263B93B766824638A85128ED22D3FB98","updated":1770872490514,"startTime":"2026-10-11T05:00:00Z","heading":"WK Run: München Marathon","unanswered":true,"series":false},{"id":"D678340FAA6341058E368AE2FB6082CA","updated":1770872490567,"startTime":"2026-11-07T08:00:00Z","heading":"Kraftraum putzen","unanswered":true,"series":false}] diff --git a/api/src/traits/authentication/login.rs b/api/src/traits/authentication/login.rs deleted file mode 100644 index 15c6559..0000000 --- a/api/src/traits/authentication/login.rs +++ /dev/null @@ -1 +0,0 @@ -pub trait Credentials: super::super::Request {} diff --git a/api/src/traits/authentication/mod.rs b/api/src/traits/authentication/mod.rs deleted file mode 100644 index d86da16..0000000 --- a/api/src/traits/authentication/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod login; -pub use login::Credentials; diff --git a/api/src/traits/authorization.rs b/api/src/traits/authorization.rs deleted file mode 100644 index 30aa41b..0000000 --- a/api/src/traits/authorization.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub trait Authorization: private::Seal {} - -mod private { - use crate::authorization::{False, True}; - pub trait Seal {} - - impl Seal for True {} - impl Seal for False {} -} - -impl Authorization for T {} diff --git a/api/src/traits/client.rs b/api/src/traits/client.rs deleted file mode 100644 index e27b561..0000000 --- a/api/src/traits/client.rs +++ /dev/null @@ -1,80 +0,0 @@ -use super::{Authorization, Endpoint, Request, Schema, endpoint}; -use crate::{authorization, authentication, error}; -use async_trait::async_trait; - -pub trait Client: Public + Private {} - -impl Client for C {} - -#[async_trait] -pub trait Handler, R: Request, A: Authorization> { - type Error: std::error::Error; - - async fn execute(&self, endpoint: &E, request: &R) -> Result; -} - -#[async_trait] -pub trait Authenticator: Public { - type Private: Private; - - fn with_tokens(&self, tokens: authentication::Tokens) -> Self::Private; - - async fn authenticate(&self, endpoint: &E, request: &R) -> Result::Error, >::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync, - { - let tokens = self.execute(endpoint, request).await?; - Ok(self.with_tokens(tokens)) - } -} - -#[async_trait] -pub trait Public { - type Error: std::error::Error + Send; - - async fn execute( - &self, - endpoint: &E, - request: &R, - ) -> Result>::Error>> - where - E: endpoint::Public + Sync, - R: Request + Sync; -} - -#[async_trait] -impl + Sync, R: Request + Sync> - Handler for P -{ - type Error = error::api::Public>::Error>; - - async fn execute(&self, endpoint: &E, request: &R) -> Result { - self.execute(endpoint, request).await - } -} - -#[async_trait] -pub trait Private { - type Error: std::error::Error + Send; - - async fn execute( - &self, - endpoint: &E, - request: &R, - ) -> Result>::Error>> - where - E: endpoint::Private + Sync, - R: Request + Sync; -} - -#[async_trait] -impl + Sync, R: Request + Sync> - Handler for P -{ - type Error = error::api::Private>::Error>; - - async fn execute(&self, endpoint: &E, request: &R) -> Result { - self.execute(endpoint, request).await - } -} diff --git a/api/src/traits/endpoint.rs b/api/src/traits/endpoint.rs deleted file mode 100644 index d8aef19..0000000 --- a/api/src/traits/endpoint.rs +++ /dev/null @@ -1,53 +0,0 @@ -use super::{Authorization, Request, Schema}; -use crate::{Method, authorization}; - -pub trait Endpoint: private::Seal { - const METHOD: Method; - type Schema: Schema; - - fn path(&self, request: &R) -> &str; -} - -/// A Endpoint with required authorization -pub trait Private { - const METHOD: Method; - type Schema: Schema; - - fn path(&self, request: &R) -> &str; -} - -impl, R: Request> Endpoint for T { - const METHOD: Method = T::METHOD; - type Schema = T::Schema; - - fn path(&self, request: &R) -> &str { - self.path(request) - } -} - -/// A Endpoint without required authorization -pub trait Public { - const METHOD: Method; - type Schema: Schema; - - fn path(&self, request: &R) -> &str; -} - -impl, R: Request> Endpoint for T { - const METHOD: Method = T::METHOD; - type Schema = T::Schema; - - fn path(&self, request: &R) -> &str { - self.path(request) - } -} - -mod private { - use super::*; - - /// Seal the Endpoint dependency - pub trait Seal {} - - impl> Seal for P {} - impl> Seal for P {} -} diff --git a/api/src/traits/id.rs b/api/src/traits/id.rs deleted file mode 100644 index 956ac12..0000000 --- a/api/src/traits/id.rs +++ /dev/null @@ -1,22 +0,0 @@ -use super::{ - client::Handler, - Schema, - Endpoint, -}; -use crate::{ - Id, - authorization, -}; -use async_trait::async_trait; - -#[async_trait] -pub trait Marker: Schema> + Endpoint, authorization::True, Schema=Self> + std::fmt::Debug { - async fn resolve, authorization::True> + Sync>(&self, id: &Id, handler: &H) -> Result; -} - -#[async_trait] -impl> + Endpoint, authorization::True, Schema=T> + Sync + std::fmt::Debug> Marker for T { - async fn resolve, authorization::True> + Sync>(&self, id: &Id, handler: &H) -> Result { - handler.execute(&self, id).await - } -} diff --git a/api/src/traits/mod.rs b/api/src/traits/mod.rs deleted file mode 100644 index 93881d9..0000000 --- a/api/src/traits/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -pub mod authentication; -pub mod authorization; -pub mod client; -pub mod endpoint; -pub mod id; -pub mod request; -pub mod schema; - -pub use authentication::Credentials; -pub use authorization::Authorization; -pub use client::Client; -pub use endpoint::Endpoint; -pub use request::Request; -pub use schema::Schema; - -//#[cfg(test)] -//mod test; diff --git a/api/src/traits/request.rs b/api/src/traits/request.rs deleted file mode 100644 index a7f8a19..0000000 --- a/api/src/traits/request.rs +++ /dev/null @@ -1,5 +0,0 @@ -use serde::Serialize; - -pub trait Request: Serialize + std::fmt::Debug {} - -impl Request for T {} diff --git a/api/src/traits/schema.rs b/api/src/traits/schema.rs deleted file mode 100644 index 1524861..0000000 --- a/api/src/traits/schema.rs +++ /dev/null @@ -1,17 +0,0 @@ -use super::Request; -use bytes::Bytes; -use serde::de::DeserializeOwned; - -pub trait Schema: std::fmt::Debug + Send + Sized { - type Error: std::error::Error + Send; - - fn deserialize(request: &R, response: &Bytes) -> Result; -} - -impl Schema for T { - type Error = serde_json::Error; - - fn deserialize(_: &R, response: &Bytes) -> Result { - serde_json::from_slice(&response) - } -} diff --git a/api/src/traits/test.rs b/api/src/traits/test.rs deleted file mode 100644 index d13987c..0000000 --- a/api/src/traits/test.rs +++ /dev/null @@ -1,53 +0,0 @@ -use async_trait::async_trait; - -struct Private; -struct Endpoint; -#[derive(serde::Serialize)] -struct Request; -#[derive(serde::Deserialize)] -struct Schema; - -#[async_trait] -impl super::client::Private for Private { - type Error = error::Private; - - async fn execute(&self, _: &E, _: &R) -> Result>::Error>> - where - E: super::endpoint::Private, - R: super::Request + Sync, - { - Err(error::Private::Unauthorized) - } -} - -impl super::endpoint::Private for Endpoint { - const METHOD: reqwest::Method = reqwest::Method::GET; - type Schema = Schema; - - fn path(&self, _: &Request) -> &str { - "/core/v1/endpoint/private" - } -} - -mod error { - use thiserror::Error; - - #[derive(Debug, Error)] - pub enum Private { - #[error("unauthorized")] - Unauthorized, - } -} - -#[tokio::test] -async fn private_endpoint() { - use super::client::Private; - let client = Private; - let request = Request; - let endpoint = Endpoint; - let result = match client.execute(&endpoint, &request).await { - Err(error::Private::Unauthorized) => false, - _ => true, - }; - assert_eq!(result, true) -} diff --git a/api/src/utils/mod.rs b/api/src/utils/mod.rs deleted file mode 100644 index 1e4bbdc..0000000 --- a/api/src/utils/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod x128; -pub use x128::X128; - -mod timestamp; -pub use timestamp::Timestamp; diff --git a/api/src/utils/timestamp.rs b/api/src/utils/timestamp.rs deleted file mode 100644 index 097b5fe..0000000 --- a/api/src/utils/timestamp.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[derive(Debug, serde::Deserialize)] -pub struct Timestamp(u64); diff --git a/api/src/utils/x128.rs b/api/src/utils/x128.rs deleted file mode 100644 index af6daef..0000000 --- a/api/src/utils/x128.rs +++ /dev/null @@ -1,78 +0,0 @@ -use serde::{Serialize, Deserialize, Serializer, Deserializer}; -use std::ops::Deref; -use std::str::FromStr; -use std::fmt; - -/// Wrapper for u128 that serializes/deserializes as 32-charachter hex -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -pub struct X128(u128); - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("invalid length: {0}")] - Length(usize), - - #[error("parser error: {0}")] - Parser(#[from] std::num::ParseIntError), -} - -impl X128 { - /// construct a new value - pub fn new(value: u128) -> Self { - Self(value) - } - - /// access the inner value explicitely - pub fn value(&self) -> u128 { - self.0 - } -} - -impl FromStr for X128 { - type Err = Error; - - fn from_str(s: &str) -> Result { - match s.len() { - 32 => u128::from_str_radix(s, 16) - .map(Self::new) - .map_err(Error::Parser), - len => Err(Error::Length(len)), - } - } -} - -impl TryFrom<&str> for X128 { - type Error = Error; - - fn try_from(s: &str) -> Result { - Self::from_str(s) - } -} - -impl Deref for X128 { - type Target = u128; - - fn deref(&self) -> &u128 { - &self.0 - } -} - -impl fmt::Display for X128 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:032x}", self.0) - } -} - -impl Serialize for X128 { - fn serialize(&self, serializer: S) -> Result { - serializer.serialize_str(&self.to_string()) - } -} - -impl<'de> Deserialize<'de> for X128 { - fn deserialize>(deserializer: D) -> Result { - let s = String::deserialize(deserializer)?; - - Self::from_str(&s).map_err(serde::de::Error::custom) - } -} diff --git a/flake.lock b/flake.lock index cad5b4b..091e321 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,18 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1770843696, - "narHash": "sha256-LovWTGDwXhkfCOmbgLVA10bvsi/P8eDDpRudgk68HA8=", - "owner": "NixOS", + "lastModified": 1758427187, + "narHash": "sha256-pHpxZ/IyCwoTQPtFIAG2QaxuSm8jWzrzBGjwQZIttJc=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "2343bbb58f99267223bc2aac4fc9ea301a155a16", + "rev": "554be6495561ff07b6c724047bdd7e0716aa7b46", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 635f84f..71d9959 100644 --- a/flake.nix +++ b/flake.nix @@ -1,59 +1,17 @@ { - outputs = { nixpkgs, ... }: let - spond = { rustPlatform, rustfmt, clippy, pkg-config, openssl, ... }: rustPlatform.buildRustPackage { - pname = "spond"; - version = "0.0.0"; + description = "spond bot"; - src = ./.; - cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [ - pkg-config - ]; - propagatedBuildInputs = [ - openssl.dev - ]; - }; + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - allpkgs = system: pkgs: pkgs.extend (_: _: nixpkgs.lib.attrsets.filterAttrs (name: _: name != "default") (packages system pkgs)); - - packages = system: pkgs': let - pkgs = allpkgs system pkgs'; - in { - default = pkgs.spond; - spond = pkgs.callPackage spond {}; - }; - - devShells = system: pkgs': let - pkgs = allpkgs system pkgs'; - in builtins.mapAttrs (devShell pkgs) (packages system pkgs'); - - devShell = pkgs: name: pkg: pkgs.mkShell { - buildInputs = with pkgs; [ - cargo - cargo-machete - cargo-workspaces - cargo-unused-features - cargo-udeps - cargo-audit - cargo-diet - cargo-duplicates - cargo-flamegraph - clippy - - (python3.withPackages (py: [ py.pyyaml ])) - - rustc - rustfmt - ] ++ pkg.buildInputs; - - nativeBuildInputs = pkg.nativeBuildInputs; - - shellHook = '' - printf 'Dev shell for %s ready!\n' '${pkg.name}' - ''; - }; - in { - packages = builtins.mapAttrs packages nixpkgs.legacyPackages; - devShells = builtins.mapAttrs devShells nixpkgs.legacyPackages; + outputs = { self, nixpkgs }: { + devShells = builtins.mapAttrs (_: pkgs: { + default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + cargo + openssl.dev + pkg-config + ]; + }; + }) nixpkgs.legacyPackages; }; } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..ed4ea8d --- /dev/null +++ b/src/main.rs @@ -0,0 +1,254 @@ +use reqwest::Client; +use reqwest::ClientBuilder; +use reqwest::RequestBuilder; +use reqwest::Response; +use reqwest::Method; +use reqwest::Request; +use clap::Parser; +use serde::{Deserialize, Serialize}; +use log::*; + +type Timestamp = chrono::DateTime; + +#[derive(Debug, Serialize, Deserialize)] +struct Login<'a> { + email: &'a str, + password: &'a str, +} + +#[derive(Debug, Deserialize)] +struct Token { + token: String, + expiration: Timestamp, +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Tokens { + access_token: Token, + refresh_token: Token, +} + +#[derive(Parser)] +struct Cli { + email: String, + password: String, +} + +struct Spond { + client: Client, + tokens: Tokens, +} + +#[derive(Debug)] +enum Order { + Ascending, + Descending, +} + +trait SpondRequest { + type Response; + + async fn request(&self, client: &Client) -> Result>; + async fn parse(self, response: Response) -> Result>; +} + +#[derive(Debug)] +struct EventsRequest { + query: std::vec::Vec<(String, String)>, +} + +impl SpondRequest for EventsRequest { + type Response = std::vec::Vec; + + async fn request(&self, client: &Client) -> Result> { + let request = client.request(Method::GET, Spond::endpoint("sponds")) + .query(&self.query); + Ok(request) + } + async fn parse(self, response: Response) -> Result> { + Ok(response.json().await?) + } +} + +impl EventsRequest { + pub fn new() -> Self { + Self { query: std::vec::Vec::new() } + } + + fn add(self, key: K, value: V) -> Self { + let mut query = self.query; + query.push((key.to_string(), value.to_string())); + Self { query } + } + + pub fn comments(self, value: bool) -> Self { + self.add("includeComments", value) + } + + pub fn hidden(self, value: bool) -> Self { + self.add("includeHidden", value) + } + + pub fn profile_info(self, value: bool) -> Self { + self.add("addProfileInfo", value) + } + + pub fn scheduled(self, value: bool) -> Self { + self.add("scheduled", value) + } + + pub fn order(self, order: Order) -> Self { + self.add("order", match order { + Order::Ascending => "asc", + Order::Descending => "dsc", + }) + } + + pub fn max(self, count: u64) -> Self { + self.add("max", count) + } + + pub fn min_end_timestamp(self, timestamp: Timestamp) -> Self { + // TODO: make actual timestamp working + self.add("minEndTimestamp", timestamp.date_naive()) + } +} + +impl Spond { + fn endpoint(endpoint: &str) -> String { + format!("https://api.spond.com/core/v1/{}", endpoint) + } + + pub async fn new(email: &str, password: &str) -> Result> { + let client = ClientBuilder::new() + .cookie_store(true) + .https_only(true) + .connection_verbose(false) + .build()?; + + // get the landing page for initial set of cookies + let _ = client.get("https://spond.com/landing/login/").send().await?; + + // try to log in + let login = Login { email, password }; + let login = client.post(Spond::endpoint("auth2/login")) + .json(&login) + .send() + .await?; + + let tokens: Tokens = login.json().await?; + + let spond = Spond { + client: client, + tokens: tokens, + }; + + Ok(spond) + } + + pub async fn send>(&self, info: T) -> Result> { + let req = self.request(&info).await?; + debug!("send: {req:#?}"); + let res = self.client.execute(req).await?; + debug!("recv: {res:#?}"); + info.parse(res).await + } + + pub async fn request(&self, info: &T) -> Result> { + let request = info.request(&self.client) + .await? + .bearer_auth(&self.tokens.access_token.token) + .build()?; + Ok(request) + } + +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Event { + id: String, + heading: String, + start_timestamp: Timestamp, + end_timestamp: Timestamp, + behalf_of_ids: std::vec::Vec, +} + +impl Event { + pub fn accept(self) -> EventReplyRequest { + self.reply(true) + } + + pub fn decline(self) -> EventReplyRequest { + self.reply(false) + } + + pub fn reply(self, accept: bool) -> EventReplyRequest { + EventReplyRequest { + event_id: self.id, + user_id: self.behalf_of_ids[0].clone(), + accept: accept, + } + } +} + +#[derive(Debug)] +struct EventReplyRequest { + event_id: String, + user_id: String, + accept: bool, +} + +impl SpondRequest for EventReplyRequest { + type Response = Response; + + async fn request(&self, client: &Client) -> Result> { + #[derive(Serialize)] + struct Reply { + accepted: bool, + } + let request = client.request(Method::PUT, Spond::endpoint(&format!("sponds/{0}/responses/{1}", &self.event_id, &self.user_id))) + .json(&Reply { accepted: self.accept }); + Ok(request) + } + + async fn parse(self, response: Response) -> Result> { + Ok(response) + } +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::init(); + + trace!("trace"); + debug!("debug"); + info!("info"); + warn!("warn"); + error!("error"); + + let args = Cli::parse(); + + let spond = Spond::new(&args.email, &args.password).await?; + + let events_request = EventsRequest::new() + .comments(false) + .hidden(false) + .profile_info(false) + .scheduled(true) + .order(Order::Ascending) + .max(20) + .min_end_timestamp(chrono::Utc::now()) + ; + + let events = spond.send(events_request).await?; + for event in events { + if event.heading == "Krafttraining Donnerstag" && event.start_timestamp.date_naive() == chrono::Utc::now().date_naive() { + let result = spond.send(event.accept()).await?; + debug!("{result:#?}"); + } + } + + Ok(()) +} diff --git a/turnerbund/:w b/turnerbund/:w deleted file mode 100644 index 4a1c242..0000000 --- a/turnerbund/:w +++ /dev/null @@ -1,231 +0,0 @@ -use tracing_subscriber::prelude::*; -use tracing_subscriber::{fmt, EnvFilter}; -pub use tracing::{error, warn, info, debug, trace}; - -#[cfg(feature="disabled")] -mod disabled { - -//mod select; -//use select::WeightedSet; -mod api; -mod utils; -mod id; -mod user; - -use tracing_subscriber::prelude::*; -use tracing_subscriber::{fmt, EnvFilter}; -pub use tracing::{error, warn, info, debug, trace}; - -use rand::prelude::*; -use std::collections::HashSet; -use std::collections::HashMap; - -#[derive(Debug, thiserror::Error)] -pub enum NoError {} - -#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)] -struct UserID(u128); - -impl std::fmt::Display for UserID { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "UserID({})", self.0) - } -} - -#[derive(Default)] -struct Participants(Vec<(UserID, usize)>); - -trait Event { - fn registered(&self, uid: UserID) -> bool; - fn participated(&self, uid: UserID) -> bool { self.registered(uid) } -} - -#[derive(Clone)] -struct MockEvent { - id: usize, - users: HashMap, -} - -impl MockEvent { - fn new(id: usize, registrants: HashSet, participants: HashSet) -> Self { - let users = registrants.into_iter() - .map(|uid| (uid, participants.contains(&uid))) - .collect(); - Self { id, users } - } -} - -impl std::fmt::Display for MockEvent { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "MockEvent{}({:?})", self.id, self.users) - } -} - -impl Event for &MockEvent { - fn registered(&self, uid: UserID) -> bool { - self.users.get(&uid).is_some() - } - - fn participated(&self, uid: UserID) -> bool { - self.users.get(&uid).is_some_and(|participated|*participated) - } -} - -impl Participants { - pub fn add(mut self, uid: UserID) -> Self { - self.0.push((uid, 1)); - self - } - - pub fn select(mut self, history: H, rng: &mut impl Rng, count: usize) - -> HashSet - where - H: Iterator, - ::Item: Event, - { - for event in history { - let mut modified = false; - for item in self.0.iter_mut() { - if event.registered(item.0) && !event.participated(item.0) { - modified = true; - item.1 += 1; - } - } - if !modified { - break; - } - } - - println!("{:?}", self.0); - - self.0.sample_weighted(rng, count, |item: &'_ (_, usize)| item.1 as f64) - .unwrap() - .map(|item| item.0) - .collect() - } -} - -async fn connect<'a, I: spond::auth::Identifier + From<&'a str>>(id: &'a str) -> Result { - let pw = std::env::var("SPOND_PASSWORD").expect("a password is required in SPOND_PASSWORD"); - let id: I = id.into(); - let auth = spond::auth::Login::new(id, pw); - let client = spond::Api::new(auth).await?; - Ok(client) -} - -async fn main() -> anyhow::Result<()> { - let filter = EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new("info")); - tracing_subscriber::registry() - .with(fmt::layer().pretty()) - .with(filter) - .init(); - - error!("Error Message"); - warn!("Warn Message"); - info!("Info Message"); - debug!("Debug Message"); - trace!("Trace Message"); - - let client = if let Ok(email) = std::env::var("SPOND_EMAIL") { - connect::(&email).await? - } else if let Ok(phone) = std::env::var("SPOND_PHONE") { - connect::(&phone).await? - } else { - panic!("no credentials provided"); - }; - - let _ = client; - - - let users = (0..25).map(UserID).collect::>(); - let mut events = Vec::new(); - - for id in 0..5 { - let mut rng = rand::rng(); - let want = users.iter().filter(|_| (&mut rng).random_bool(0.75)).map(|id|id.clone()).collect::>(); - - let mut participants = Participants::default(); - for uid in want.iter() { - participants = participants.add(*uid); - } - - let participants = participants.select(events.iter().rev(), &mut rng, 12); - let event = MockEvent::new(id, want, participants); - println!("{event}"); - events.push(event); - } - - for uid in users.into_iter() { - let (registered, participated) = events.iter() - .fold((0, 0), |(registered, participated), event| { - let registered = registered + if event.registered(uid) { 1 } else { 0 }; - let participated = participated + if event.participated(uid) { 1 } else { 0 }; - (registered, participated) - }); - - println!("{uid}: ({participated}/{registered}) {:.2}%", - (participated as f64) / (registered as f64) * 100f64); - } - - Ok(()) -} -} - -fn tracing_setup(filter: &str) { - let filter = EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new(filter)); - - tracing_subscriber::registry() - .with(fmt::layer().pretty()) - .with(filter) - .init(); -} - -async fn connect(authenticator: A, credentials: C) -> Result::Error, >::Error>> { - let auth = spond::authentication::Login; - - authenticator.authenticate(&auth, &credentials).await -} - -#[derive(serde::Deserialize)] -struct Spond() - -#[derive(serde::Deserialize)] -struct Sponds(Vec); - -impl spond::traits::endpoint::Private for Sponds { - const METHOD: spond::Method = spond::Method::GET; - type Schema = Self; - - fn path(&self, _: &SpodsW -} - -#[derive(serde::Seralize)] -struct SpondsQuery; - -#[tokio::main] -async fn main() { - tracing_setup("info"); - - #[cfg(feature="disabled")] - disabled::main().await; - - error!("Error Message"); - warn!("Warn Message"); - info!("Info Message"); - debug!("Debug Message"); - trace!("Trace Message"); - - let pw = std::env::var("SPOND_PASSWORD").expect("a password is required in SPOND_PASSWORD"); - let client = spond::reqwest::Public::new().expect("public client"); - let client = if let Ok(email) = std::env::var("SPOND_EMAIL") { - connect(client, spond::authentication::login::Email::new(&email, &pw)).await - } else if let Ok(phone) = std::env::var("SPOND_PHONE") { - connect(client, spond::authentication::login::Phone::new(&phone, &pw)).await - } else { - panic!("no credentials provided"); - }; - - let _ = client.execute(; -} diff --git a/turnerbund/Cargo.toml b/turnerbund/Cargo.toml deleted file mode 100644 index 678a760..0000000 --- a/turnerbund/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "turnerbund" -version = "0.1.0" -edition = "2024" - -[features] -disabled=[] - -[dependencies] -spond = { path = "../api", features = [ "reqwest" ] } -anyhow = "1.0.101" -async-trait = "0.1.89" -bon = "3.9.0" -chrono = { version = "0.4.43", features = ["serde"] } -http = "1.4.0" -rand = "0.10.0" -#reqwest = { version = "0.13.2", features = ["json", "zstd", "brotli", "gzip", "deflate"] } -reqwest-middleware = { version = "0.5.1", features = ["json", "http2"] } -serde = { version = "1.0.228", features = ["derive"] } -serde_json = "1.0.149" -thiserror = "2.0.18" -tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread", "tracing"] } -tracing = { version = "0.1.44", features = ["log"] } -tracing-subscriber = { version = "0.3.22", features = ["serde", "json", "tracing", "env-filter", "chrono"] } -url = "2.5.8" diff --git a/turnerbund/src/api/api.rs b/turnerbund/src/api/api.rs deleted file mode 100644 index dee5917..0000000 --- a/turnerbund/src/api/api.rs +++ /dev/null @@ -1,201 +0,0 @@ -use super::{ - Request, - error, - token, - auth, -}; -use crate::utils::Bool; - -#[async_trait::async_trait] -trait Interface { - fn client(&self) -> &reqwest::Client; - fn url(&self, endpoint: &str) -> Result; - fn current_token(&self) -> Option>; - async fn refresh_token(&self, api: Api) -> Result>, error::Token>; -} - -#[derive(Debug)] -struct Internal { - client: reqwest::Client, - base: reqwest::Url, - token_provider: T, -} - -impl Internal { - fn new(client: reqwest::Client, base: reqwest::Url, token_provider: T) - -> std::sync::Arc { - std::sync::Arc::new(Self { client, base, token_provider }) - } - - #[tracing::instrument(skip_all, fields(endpoint=request.endpoint(), request, token))] - async fn call(&self, request: &R, token: Option<&token::Token>) -> Result - { - let url = self.base.join(request.endpoint()).map_err(error::Api::Url)?; - let builder = self.client.request(R::METHOD, url); - let builder = if let Some(token) = token { - token.r#use(builder) - } else { - builder - }; - - let response = builder.json(request) - .send() - .await - .map_err(error::Api::Reqwest)?; - - match response.status() { - reqwest::StatusCode::OK => (), - status => return Err(error::Api::Http(status)), - } - let result: R::Response = response.json().await?; - Ok(result) - } -} - -async fn deserialize(response: reqwest::Response) -> Result -{ - let response: R::Response = response.json().await.map_err(error::Api::Reqwest)?; - Ok(response) -} - -#[tracing::instrument(skip_all, fields(url, request, token))] -async fn call(client: &reqwest::Client, url: reqwest::Url, request: &R, token: Option<&token::Token>) -> Result { - let builder = client.request(R::METHOD, url); - let builder = if let Some(token) = token { - builder.bearer_auth(token.as_ref()) - } else { - builder - }; - let response = builder.json(request) - .send() - .await - .map_err(error::Api::Reqwest)?; - - match response.status() { - reqwest::StatusCode::OK => - deserialize::(response).await, - status => Err(error::Api::Http(status)), - } -} - -#[async_trait::async_trait] -impl Interface for Internal { - fn client(&self) -> &reqwest::Client { - &self.client - } - - fn url(&self, endpoint: &str) -> Result { - self.base.join(endpoint) - } - - fn current_token(&self) -> Option> { - self.token_provider.current() - } - - async fn refresh_token(&self, api: Api) -> Result>, error::Token> { - self.token_provider.refresh(api).await - } -} - -#[derive(Debug)] -struct NoToken; - -#[async_trait::async_trait] -impl token::Provider for NoToken { - fn current(&self) -> Option> { - None - } - - async fn refresh(&self, _api: Api) -> Result>, error::Token> { - Ok(None) - } -} - -#[derive(Clone)] -pub struct Api(std::sync::Arc); - -impl Api { - pub async fn new(auth: A) -> Result - { - Self::new_with_base("https://api.spond.com", auth).await - } - - pub async fn new_with_base(base: &str, auth: A) -> Result { - let base = reqwest::Url::parse(base)?; - let host = base.host_str().unwrap().to_owned(); - - let client = reqwest::Client::builder() - //.https_only(true) - .redirect(reqwest::redirect::Policy::limited(1)) - .retry(reqwest::retry::for_host(host) - .max_retries_per_request(2) - .classify_fn(|req_rep| { - use reqwest::StatusCode; - match req_rep.status() { - Some(StatusCode::UNAUTHORIZED) => req_rep.retryable(), - _ => req_rep.success(), - } - })) - // TODO - //.cookie_store(true) - .user_agent("spond-selection-bot") - .read_timeout(std::time::Duration::from_secs(5)) - .connect_timeout(std::time::Duration::from_secs(15)) - .connection_verbose(true) - .build()?; - - let api = Api(Internal::new(client.clone(), base.clone(), NoToken)); - let provider = auth.authenticate(api).await?; - - tracing::info!("{:?}", provider); - let api = Api(Internal::new(client, base, provider)); - Ok(api) - } - - - pub async fn call(&self, request: &R) -> Result - { - //async fn call(&self, api: &Api, call: &C, request: &C::Request) -> Result> { - // let mut token = self.token_provider.current(); - // loop { - // match self.common.call(call, request, &token) { - // Err(error::Call::::Http(reqwest::StatusCode::UNAUTHORIZED)) if token.is_some_and(|token|token.expired()) - // => token = self.token_provider.refresh(api).map_err(error::Call::::Token)?, - // result => return result, - // } - // } - //} - - let client = self.0.client(); - - if R::Authorization::VALUE == false { - let url = self.0.url(request.endpoint())?; - call(client, url, request, None).await - } else { - let mut current = self.0.current_token(); - loop { - use std::ops::Deref; - let token = if let Some(ref token) = current { - Some(token.deref()) - } else { - None - }; - let url = self.0.url(request.endpoint())?; - current = match call(client, url, request, token).await { - Err(error::Api::Http(reqwest::StatusCode::UNAUTHORIZED)) if current.is_some_and(|t|t.expired()) - => self.0.refresh_token(self.clone()).await?, - result => break result, - } - } - } - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[tokio::test] - async fn mock() {} -} - diff --git a/turnerbund/src/api/auth.rs b/turnerbund/src/api/auth.rs deleted file mode 100644 index ddb54de..0000000 --- a/turnerbund/src/api/auth.rs +++ /dev/null @@ -1,185 +0,0 @@ -use async_trait::async_trait; -use thiserror::Error; -use crate::utils::False; - -use super::{ - Request, - error, -}; - -use serde::{ - Deserialize, - Serialize, - Serializer, - ser::SerializeStruct, -}; - -#[derive(Debug, Error)] -pub enum Error { - //#[error(transparent)] - //Provider(P) - #[error("invalid credentials")] - Credentials, -} - -#[async_trait] -pub trait Provider { - type TokenProvider: super::token::Provider + 'static; - - async fn authenticate(&self, api: super::Api) -> Result; -} - -pub trait Identifier: Sync + Send + Serialize + std::fmt::Debug { - const KEY: &'static str; -} - -macro_rules! transparent_identifier { - ($name:ident, $key:expr) => { - transparent_string!($name); - - impl Identifier for $name { - const KEY: &'static str = $key; - } - }; -} - -macro_rules! transparent_string { - ($name:ident) => { - #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] - #[serde(transparent)] - pub struct $name(String); - - impl From<&str> for $name { - fn from(s: &str) -> Self { - s.to_string().into() - } - } - - impl From for $name { - fn from(s: String) -> Self { - Self(s) - } - } - - impl<'a> From<&'a $name> for &'a str { - fn from(id: &'a $name) -> Self { - &id.0 - } - } - - impl From<$name> for String { - fn from(id: $name) -> Self { - id.0 - } - } - }; -} - -transparent_string!(Password); -transparent_identifier!(Email, "email"); -transparent_identifier!(Phone, "phone"); - -#[derive(Debug)] -pub struct Login { - identifier: I, - password: Password, -} - -impl Login { - pub fn new>(identifier: I, password: P) -> Self { - Self { - identifier: identifier, - password: password.into(), - } - } -} - -impl Serialize for Login { - fn serialize(&self, serializer: S) -> Result { - let mut state = serializer.serialize_struct("Login", 2)?; - state.serialize_field(I::KEY, &self.identifier)?; - state.serialize_field("password", &self.password)?; - state.end() - } -} - -#[async_trait] -impl Provider for Login { - type TokenProvider = TokenProvider; - - async fn authenticate(&self, api: super::Api) -> Result { - Ok(api.call(self).await?.into()) - //todo!("implement me") - } -} - -#[derive(Debug, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Tokens { - access_token: super::token::Token, - refresh_token: super::token::Token, -} - -#[derive(Debug)] -pub struct TokenProvider { - access: std::sync::RwLock>, - refresh: std::sync::Mutex, -} - -impl From for TokenProvider { - fn from(tokens: Tokens) -> Self { - use std::sync::{Mutex,RwLock, Arc}; - Self { - access: RwLock::new(Arc::new(tokens.access_token)), - refresh: Mutex::new(tokens.refresh_token), - } - } -} - -#[async_trait::async_trait] -impl super::token::Provider for TokenProvider { - fn current(&self) -> Option> { - Some(self.access.read().ok()?.clone()) - } - - async fn refresh(&self, api: super::Api) -> Result>, super::error::Token> { - // TODO - let _ = api; - Err(super::error::Token::Expired(chrono::TimeDelta::seconds(-5))) - } -} - -impl Request for Login { - const METHOD: super::reqwest::Method = super::reqwest::Method::POST; - type Response = Tokens; - type Authorization = False; - - fn endpoint(&self) -> &str { - "core/v1/auth2/login" - } -} - - -#[cfg(test)] -mod test { - mod serialize { - use super::super::*; - use serde_json; - - #[test] - fn email_login() { - let login = Login::::new("user@spond.com", "secret"); - - let json = serde_json::to_string(&login).unwrap(); - assert_eq!(json, r#"{"email":"user@spond.com","password":"secret"}"#) - } - - #[test] - fn phone_login() { - let login = Login::::new("+1234567890", "secret"); - - let json = serde_json::to_string(&login).unwrap(); - assert_eq!(json, r#"{"phone":"+1234567890","password":"secret"}"#) - } - } -} diff --git a/turnerbund/src/api/endpoint/mod.rs b/turnerbund/src/api/endpoint/mod.rs deleted file mode 100644 index a3dd347..0000000 --- a/turnerbund/src/api/endpoint/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use serde::{Serialize, Deserialize}; - -pub trait Method { - const HTTP: http::Method; -} - -macro_rules! method { - ($name:ident) => { - struct $name; - - impl Method for $name { - const HTTP = http::Method::$name; - } - }; -} - -method!(GET); -method!(POST); - -pub trait Endpoint: Serialize { - type Result: Deserialize; - - fn path(&self) -> &str; -} diff --git a/turnerbund/src/api/error.rs b/turnerbund/src/api/error.rs deleted file mode 100644 index 5120e1b..0000000 --- a/turnerbund/src/api/error.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub trait Error: std::error::Error + std::fmt::Debug + Send + Sync + 'static {} -impl Error for E {} - -#[derive(Debug, thiserror::Error)] -pub enum Api { - #[error("reqwest")] - Reqwest(#[from] reqwest::Error), - - #[error("encode")] - Encode(serde_json::Error), - - #[error("decode")] - Decode(serde_json::Error), - - #[error("url")] - Url(#[from] url::ParseError), - - #[error("token")] - Token(#[from] Token), - - #[error("http")] - Http(reqwest::StatusCode), -} - -#[derive(Debug, thiserror::Error)] -pub enum Token { - #[error("expired token")] - Expired(chrono::TimeDelta), -} diff --git a/turnerbund/src/api/mod.rs b/turnerbund/src/api/mod.rs deleted file mode 100644 index ce4563a..0000000 --- a/turnerbund/src/api/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -pub mod auth; -pub mod token; -pub mod error; -pub mod request; -mod api; -pub use api::Api; -pub use request::{ - Request, -}; - -use reqwest_middleware::reqwest; - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("unspecified")] - Unspecified, - - #[error("reqwest error")] - Reqwest(#[from] reqwest::Error), - - #[error("middleware error")] - Middleware(anyhow::Error), - - #[error("url parser error")] - UrlParseError(#[from] url::ParseError), - - #[error("http status code")] - Http(reqwest::StatusCode), - - #[error(transparent)] - Custom(Auth) -} diff --git a/turnerbund/src/api/request.rs b/turnerbund/src/api/request.rs deleted file mode 100644 index b9d880e..0000000 --- a/turnerbund/src/api/request.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::utils::Bool; - -trait Authorization: Bool {} - -impl Authorization for T {} - -pub trait Request: Sized + std::fmt::Debug + serde::Serialize { - const METHOD: reqwest::Method = reqwest::Method::GET; - type Authorization: Authorization; - type Response: for<'a> serde::Deserialize<'a> + Sized; - - fn endpoint(&self) -> &str; -} diff --git a/turnerbund/src/api/token.rs b/turnerbund/src/api/token.rs deleted file mode 100644 index 73965fb..0000000 --- a/turnerbund/src/api/token.rs +++ /dev/null @@ -1,38 +0,0 @@ -use async_trait::async_trait; - -#[derive(Debug, Clone, serde::Deserialize)] -pub struct Token { - token: String, - expiration: chrono::DateTime, -} - -impl AsRef for Token { - fn as_ref(&self) -> &str { - &self.token - } -} - -impl Token { - pub fn expired(&self) -> bool { - self.expiration < chrono::Utc::now() - } - - pub fn expired_in(&self, offset: chrono::TimeDelta) -> bool { - self.time_delta() < offset - } - - pub fn time_delta(&self) -> chrono::TimeDelta { - self.expiration - chrono::Utc::now() - } - - pub fn r#use(&self, builder: reqwest::RequestBuilder) -> reqwest::RequestBuilder { - builder.bearer_auth(&self.token) - } -} - -#[async_trait] -pub trait Provider: std::fmt::Debug + Send + Sync { - fn current(&self) -> Option>; - - async fn refresh(&self, api: super::Api) -> Result>, super::error::Token>; -} diff --git a/turnerbund/src/client/mod.rs b/turnerbund/src/client/mod.rs deleted file mode 100644 index 83f0aad..0000000 --- a/turnerbund/src/client/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -use reqwest_middleware::reqwest; -use reqwest_middleware::ClientWithMiddleware as Backend; - -struct Client { - backend: Backend, -} - -impl Client { - -} diff --git a/turnerbund/src/id.rs b/turnerbund/src/id.rs deleted file mode 100644 index e628b3e..0000000 --- a/turnerbund/src/id.rs +++ /dev/null @@ -1,74 +0,0 @@ -use serde::{Serialize, Deserialize, Serializer, Deserializer}; -use serde::de; -use std::fmt; -use std::str::FromStr; -use super::api::Api; - -#[derive(Debug)] -pub enum ParseError { - Length(usize), - IntError(std::num::ParseIntError), -} - -impl From for ParseError { - fn from(e: std::num::ParseIntError) -> Self { - Self::IntError(e) - } -} - -impl fmt::Display for ParseError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Length(len) => write!(f, "Id strig must be 32 characters, got {}", len), - Self::IntError(e) => write!(f, "{}", e), - } - } -} - -pub trait Marker { - async fn resolve(id: Id, api: Api) -> Result; -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct Id(u128, std::marker::PhantomData); - -impl Id { - pub fn new(value: u128) -> Self { - Self(value, std::marker::PhantomData) - } - - pub fn value(&self) -> u128 { - self.0 - } -} - -impl fmt::Display for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:032X}", self.0) - } -} - -impl FromStr for Id { - type Err = ParseError; - - fn from_str(s: &str) -> Result { - match s.len() { - 32 => Ok(Self::new(u128::from_str_radix(s, 16)?)), - len => Err(ParseError::Length(len)), - } - } -} - -impl Serialize for Id { - fn serialize(&self, serializer: S) -> Result { - serializer.serialize_str(&self.to_string()) - } -} - -impl<'de, T: Marker> Deserialize<'de> for Id { - fn deserialize>(deserializer: D) -> Result { - String::deserialize(deserializer)? - .parse() - .map_err(de::Error::custom) - } -} diff --git a/turnerbund/src/main.rs b/turnerbund/src/main.rs deleted file mode 100644 index fe9b31d..0000000 --- a/turnerbund/src/main.rs +++ /dev/null @@ -1,51 +0,0 @@ -use tracing_subscriber::prelude::*; -use tracing_subscriber::{fmt, EnvFilter}; -pub use tracing::{error, warn, info, debug, trace}; - -fn tracing_setup(filter: &str) { - let filter = EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new(filter)); - - tracing_subscriber::registry() - .with(fmt::layer().pretty()) - .with(filter) - .init(); -} - -async fn connect(authenticator: A, credentials: C) -> Result::Error, >::Error>> { - let auth = spond::authentication::Login; - - authenticator.authenticate(&auth, &credentials).await -} - -#[tokio::main] -async fn main() -> anyhow::Result<()> { - tracing_setup("info"); - - #[cfg(feature="disabled")] - disabled::main().await; - - error!("Error Message"); - warn!("Warn Message"); - info!("Info Message"); - debug!("Debug Message"); - trace!("Trace Message"); - - let pw = std::env::var("SPOND_PASSWORD").expect("a password is required in SPOND_PASSWORD"); - let client = spond::reqwest::Public::new().expect("public client"); - let client = if let Ok(email) = std::env::var("SPOND_EMAIL") { - connect(client, spond::authentication::login::Email::new(&email, &pw)).await - } else if let Ok(phone) = std::env::var("SPOND_PHONE") { - connect(client, spond::authentication::login::Phone::new(&phone, &pw)).await - } else { - panic!("no credentials provided"); - }?; - - - use spond::traits::client::Private; - - let _ = client.execute(&spond::schema::sponds::Sponds::default(), &spond::schema::sponds::Upcoming).await?; - - - Ok(()) -} diff --git a/turnerbund/src/select.rs b/turnerbund/src/select.rs deleted file mode 100644 index ef0abcc..0000000 --- a/turnerbund/src/select.rs +++ /dev/null @@ -1,166 +0,0 @@ -use rand::prelude::*; -use std::collections::HashSet; -use std::collections::HashMap; - -#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)] -struct UserID(u128); - -impl std::fmt::Display for UserID { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "UserID({})", self.0) - } -} - -#[derive(Default)] -struct Participants(Vec<(UserID, usize)>); - -trait Event { - fn registered(&self, uid: UserID) -> bool; - fn participated(&self, uid: UserID) -> bool { self.registered(uid) } -} - -impl Participants { - pub fn add(mut self, uid: UserID) -> Self { - self.0.push((uid, 1)); - self - } - - pub fn select(mut self, history: IntoIterator, rng: &mut impl Rng, count: usize) - -> HashSet - { - for event in history { - let mut modified = false; - for item in self.0.iter_mut() { - if event.registered(item.0) && !event.participated(item.0) { - modified = true; - item.1 += 1; - } - } - if !modified { - break; - } - } - - println!("{:?}", self.0); - - self.0.sample_weighted(rng, count, |item: &'_ (_, usize)| item.1 as f64) - .unwrap() - .map(|item| item.0) - .collect() - } -} - -#[cfg(feature="disabled")] -mod disabled { - -//mod select; -//use select::WeightedSet; - -use tracing_subscriber::prelude::*; -use tracing_subscriber::{fmt, EnvFilter}; -pub use tracing::{error, warn, info, debug, trace}; - - -#[derive(Debug, thiserror::Error)] -pub enum NoError {} - - - -#[derive(Clone)] -struct MockEvent { - id: usize, - users: HashMap, -} - -impl MockEvent { - fn new(id: usize, registrants: HashSet, participants: HashSet) -> Self { - let users = registrants.into_iter() - .map(|uid| (uid, participants.contains(&uid))) - .collect(); - Self { id, users } - } -} - -impl std::fmt::Display for MockEvent { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "MockEvent{}({:?})", self.id, self.users) - } -} - -impl Event for &MockEvent { - fn registered(&self, uid: UserID) -> bool { - self.users.get(&uid).is_some() - } - - fn participated(&self, uid: UserID) -> bool { - self.users.get(&uid).is_some_and(|participated|*participated) - } -} - -async fn connect<'a, I: spond::auth::Identifier + From<&'a str>>(id: &'a str) -> Result { - let pw = std::env::var("SPOND_PASSWORD").expect("a password is required in SPOND_PASSWORD"); - let id: I = id.into(); - let auth = spond::auth::Login::new(id, pw); - let client = spond::Api::new(auth).await?; - Ok(client) -} - -async fn main() -> anyhow::Result<()> { - let filter = EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new("info")); - tracing_subscriber::registry() - .with(fmt::layer().pretty()) - .with(filter) - .init(); - - error!("Error Message"); - warn!("Warn Message"); - info!("Info Message"); - debug!("Debug Message"); - trace!("Trace Message"); - - let client = if let Ok(email) = std::env::var("SPOND_EMAIL") { - connect::(&email).await? - } else if let Ok(phone) = std::env::var("SPOND_PHONE") { - connect::(&phone).await? - } else { - panic!("no credentials provided"); - }; - - let _ = client; - - - let users = (0..25).map(UserID).collect::>(); - let mut events = Vec::new(); - - for id in 0..5 { - let mut rng = rand::rng(); - let want = users.iter().filter(|_| (&mut rng).random_bool(0.75)).map(|id|id.clone()).collect::>(); - - let mut participants = Participants::default(); - for uid in want.iter() { - participants = participants.add(*uid); - } - - let participants = participants.select(events.iter().rev(), &mut rng, 12); - let event = MockEvent::new(id, want, participants); - println!("{event}"); - events.push(event); - } - - for uid in users.into_iter() { - let (registered, participated) = events.iter() - .fold((0, 0), |(registered, participated), event| { - let registered = registered + if event.registered(uid) { 1 } else { 0 }; - let participated = participated + if event.participated(uid) { 1 } else { 0 }; - (registered, participated) - }); - - println!("{uid}: ({participated}/{registered}) {:.2}%", - (participated as f64) / (registered as f64) * 100f64); - } - - Ok(()) -} -} - diff --git a/turnerbund/src/select/candidate.rs b/turnerbund/src/select/candidate.rs deleted file mode 100644 index ac1a094..0000000 --- a/turnerbund/src/select/candidate.rs +++ /dev/null @@ -1,48 +0,0 @@ -use super::Key; -use std::cmp::Ordering; - -#[derive(Debug)] -pub struct Candidate { - item: T, - key: Key, -} - -impl Candidate { - pub fn new_with_key(item: T, key: Key) -> Self { - Self { item, key } - } - - pub fn new(item: T, rng: R, weight: W) -> Option - where - R: FnOnce() -> F, - F: Into, - W: Into, - { - Key::new(rng, weight).map(|key|Self::new_with_key(item, key)) - } - - pub fn item(self) -> T { - self.item - } -} - -impl Ord for Candidate { - fn cmp(&self, other: &Self) -> Ordering { - // Reverse for max-heap: largest key is "greatest" - other.key.partial_cmp(&self.key).unwrap().reverse() - } -} - -impl PartialOrd for Candidate { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl PartialEq for Candidate { - fn eq(&self, other: &Self) -> bool { - self.key == other.key - } -} - -impl Eq for Candidate {} diff --git a/turnerbund/src/select/key.rs b/turnerbund/src/select/key.rs deleted file mode 100644 index e75b5fa..0000000 --- a/turnerbund/src/select/key.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Key newtype wrapping a f64 in the range [0.0,1.0] -#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] -pub struct Key(f64); - -impl Key { - pub fn new(rng: R, weight: W) -> Option - where - R: FnOnce() -> F, - F: Into, - W: Into, - { - let weight = weight.into(); - - if weight.is_finite() && weight > 0.0 { - let u = -rng().into().ln(); - Some(Key((u / weight).recip())) - } else { - None - } - } -} - -impl Ord for Key { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - // we are always in range [0.0,1.0] - self.0.partial_cmp(&other.0).unwrap() - } -} - -impl Eq for Key {} - diff --git a/turnerbund/src/user.rs b/turnerbund/src/user.rs deleted file mode 100644 index f75071f..0000000 --- a/turnerbund/src/user.rs +++ /dev/null @@ -1,2 +0,0 @@ -struct Profile; -struct User; diff --git a/turnerbund/src/utils.rs b/turnerbund/src/utils.rs deleted file mode 100644 index 698dc9e..0000000 --- a/turnerbund/src/utils.rs +++ /dev/null @@ -1,19 +0,0 @@ -trait BoolValue {} - -pub trait Bool: BoolValue { - const VALUE: bool; -} - -pub struct True; -pub struct False; - -impl BoolValue for True {} -impl BoolValue for False {} - -impl Bool for True { - const VALUE: bool = true; -} - -impl Bool for False { - const VALUE: bool = false; -}