From 4e60216b8e9a9d9c49140e79cb1043855dba8791 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Sun, 25 Feb 2024 12:22:24 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + Cargo.lock | 1551 ++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 12 + gql/GetItem.graphql | 7 + gql/GetSpell.graphql | 19 + gql/schema.graphql | 1446 +++++++++++++++++++++++++++++++++++++++ src/api_client.rs | 142 ++++ src/main.rs | 35 + src/print.rs | 129 ++++ src/types.rs | 18 + 10 files changed, 3360 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 gql/GetItem.graphql create mode 100644 gql/GetSpell.graphql create mode 100644 gql/schema.graphql create mode 100644 src/api_client.rs create mode 100644 src/main.rs create mode 100644 src/print.rs create mode 100644 src/types.rs 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..2dcc923 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1551 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "bumpalo" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" + +[[package]] +name = "bytemuck" +version = "1.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "escpos" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e6d90aac0c79a104880a422a8d8473f40fd426ab54d47366eaa08e6f7a6444" +dependencies = [ + "encoding_rs", + "image", + "log", +] + +[[package]] +name = "exr" +version = "1.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +dependencies = [ + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fdeflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "spin", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-io", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gif" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "graphql-introspection-query" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2a4732cf5140bd6c082434494f785a19cfb566ab07d1382c3671f5812fed6d" +dependencies = [ + "serde", +] + +[[package]] +name = "graphql-parser" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ebc8013b4426d5b81a4364c419a95ed0b404af2b82e2457de52d9348f0e474" +dependencies = [ + "combine", + "thiserror", +] + +[[package]] +name = "graphql_client" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cdf7b487d864c2939b23902291a5041bc4a84418268f25fda1c8d4e15ad8fa" +dependencies = [ + "graphql_query_derive", + "reqwest", + "serde", + "serde_json", +] + +[[package]] +name = "graphql_client_codegen" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40f793251171991c4eb75bd84bc640afa8b68ff6907bc89d3b712a22f700506" +dependencies = [ + "graphql-introspection-query", + "graphql-parser", + "heck", + "lazy_static", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 1.0.109", +] + +[[package]] +name = "graphql_query_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00bda454f3d313f909298f626115092d348bc231025699f557b27e248475f48c" +dependencies = [ + "graphql_client_codegen", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "h2" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "image" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034bbe799d1909622a74d1193aa50147769440040ff36cb2baa947609b0a4e23" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", + "gif", + "jpeg-decoder", + "num-traits", + "png", + "qoi", + "tiff", +] + +[[package]] +name = "indexmap" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jpeg-decoder" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" +dependencies = [ + "rayon", +] + +[[package]] +name = "js-sys" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[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.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.4.2", + "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 2.0.49", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae94056a791d0e1217d18b6cbdccb02c61e3054fc69893607f4067e3bb0b1fd1" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[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.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "png" +version = "0.17.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c2378060fb13acff3ba0325b83442c1d2c44fbb76df481160ddc1687cce160" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "printer-api" +version = "0.1.0" +dependencies = [ + "escpos", + "graphql_client", + "reqwest", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "reqwest" +version = "0.11.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +dependencies = [ + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64", +] + +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.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.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + +[[package]] +name = "serde_json" +version = "1.0.113" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[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 = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + +[[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[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-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +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-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[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.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.49", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" + +[[package]] +name = "web-sys" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "weezl" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[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.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..06b6d22 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "printer-api" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +escpos = { version = "0.6.2", features = ["full"] } +graphql_client = { version = "0.13.0", features = ["graphql_query_derive" , "reqwest-blocking"] } +reqwest = { version = "0.11.24", features = ["json", "blocking"] } +serde = "1.0.196" diff --git a/gql/GetItem.graphql b/gql/GetItem.graphql new file mode 100644 index 0000000..0190690 --- /dev/null +++ b/gql/GetItem.graphql @@ -0,0 +1,7 @@ +query GetItem($index: String!) { + magicItem(index: $index){ + name, + rarity, + desc + } +} \ No newline at end of file diff --git a/gql/GetSpell.graphql b/gql/GetSpell.graphql new file mode 100644 index 0000000..6ede738 --- /dev/null +++ b/gql/GetSpell.graphql @@ -0,0 +1,19 @@ +query GetSpell($index: String!){ + spell(index: $index){ + name, + level, + school { + name + } + desc, + components, + duration, + ritual, + range, + casting_time, + area_of_effect { + size + type + } + } +} \ No newline at end of file diff --git a/gql/schema.graphql b/gql/schema.graphql new file mode 100644 index 0000000..15dce6e --- /dev/null +++ b/gql/schema.graphql @@ -0,0 +1,1446 @@ +"""String or list of strings""" +scalar StringFilter + +""" +Int, list of ints, or object with gte (>=), gt (>), lte (<=), and lt (<) properties for range of values +""" +scalar IntFilter + +""" +Float, list of floats, or object with gte (>=), gt (>), lte (<=), and lt (<) properties for range of values +""" +scalar FloatFilter + +type AbilityScore { + index: String! + name: String! + full_name: String! + desc: [String!]! + skills(order_direction: OrderByDirection, name: String): [Skill!]! +} + +type Skill { + index: String! + name: String! + desc: [String!]! + ability_score: AbilityScore! +} + +type Alignment { + index: String! + name: String! + abbreviation: String! + desc: String! +} + +type Condition { + index: String! + name: String! + desc: [String!]! +} + +type DamageType { + index: String! + name: String! + desc: [String!]! +} + +type WeaponProperty { + index: String! + name: String! + desc: [String!]! +} + +enum Currency { + CP + SP + GP +} + +type Cost { + quantity: Int! + unit: Currency! +} + +type EquipmentCategory { + index: String! + name: String! + equipment(order: EquipmentCategoryOrder, skip: Int, limit: Int! = 100, name: String): [IEquipmentBase!]! +} + +interface IEquipmentBase { + index: String! + name: String! + desc: [String!] + equipment_category: EquipmentCategory! +} + +enum MagicItemRarity { + VARIES + COMMON + UNCOMMON + RARE + VERY_RARE + LEGENDARY + ARTIFACT +} + +type MagicItem implements IEquipmentBase { + index: String! + name: String! + desc: [String!]! + rarity: MagicItemRarity! + equipment_category: EquipmentCategory! +} + +interface IEquipment implements IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float +} + +type Tool implements IEquipment & IEquipmentBase { + index: String! + name: String! + desc: [String!] + cost: Cost! + equipment_category: EquipmentCategory! + weight: Float + tool_category: EquipmentCategory! +} + +interface IGear implements IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + gear_category: EquipmentCategory! +} + +type Gear implements IGear & IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + gear_category: EquipmentCategory! +} + +type PackQuantity { + quantity: Int! + item: IEquipment! +} + +type Quantity { + quantity: Int! + equipment: IEquipment! +} + +type Pack implements IGear & IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + gear_category: EquipmentCategory! + contents: [PackQuantity!]! +} + +type Ammunition implements IGear & IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + gear_category: EquipmentCategory! + quantity: Int! +} + +type Damage { + damage_dice: String! + damage_type: DamageType! +} + +type Range { + normal: Int! + long: Int +} + +enum WeaponRange { + MELEE + RANGED +} + +type Weapon implements IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + damage: Damage + range: Range! + throw_range: Range + weapon_category: EquipmentCategory! + weapon_range: WeaponRange! + category_range: EquipmentCategory! + two_handed_damage: Damage + properties(name: String): [WeaponProperty!]! + special: [String!] +} + +type ArmorClass { + base: Int! + dex_bonus: Boolean! + max_bonus: Int +} + +type Armor implements IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + armor_category: EquipmentCategory! + str_minimum: Int! + stealth_disadvantage: Boolean! + armor_class: ArmorClass! +} + +type Speed { + quantity: Float! + unit: String! +} + +type Vehicle implements IEquipment & IEquipmentBase { + index: String! + name: String! + cost: Cost! + desc: [String!] + equipment_category: EquipmentCategory! + weight: Float + vehicle_category: EquipmentCategory! + speed: Speed + capacity: String +} + +type AbilityScorePrerequisite { + ability_score: AbilityScore! + minimum_score: Int! +} + +type Feat { + index: String! + name: String! + desc: [String!]! + prerequisites: [AbilityScorePrerequisite!]! +} + +enum LanguageType { + STANDARD + EXOTIC +} + +enum LanguageScript { + COMMON + ELVISH + DWARVISH + INFERNAL + DRACONIC + CELESTIAL +} + +""" +LanguageScript ("COMMON", "ELVISH", "DWARVISH", "INFERNAL", "DRACONIC", "CELESTIAL") or list of LanguageScripts +""" +scalar LanguageScriptFilter + +type Language { + index: String! + name: String! + desc: String + script: LanguageScript + type: LanguageType! + typical_speakers: [String!]! +} + +type Rule { + index: String! + name: String! + desc: String! + subsections(name: String): [RuleSection!]! +} + +type RuleSection { + index: String! + name: String! + desc: String! +} + +type AreaOfEffect { + type: AreaOfEffectType! + size: Int! +} + +enum AreaOfEffectType { + SPHERE + CUBE + CYLINDER + LINE + CONE +} + +""" +AreaOfEffectType ("SPHERE", "CUBE", "CYLINDER", "LINE", "CONE") or list of AreaOfEffectTypes +""" +scalar AreaOfEffectTypeFilter + +enum SpellComponent { + V + S + M +} + +type DamageAtLevel { + level: Int! + damage: String! +} + +type SpellDamage { + damage_at_slot_level: [DamageAtLevel!] + damage_at_character_level: [DamageAtLevel!] + damage_type: DamageType +} + +type HealingAtLevel { + level: Int! + healing: String! +} + +enum DcSuccess { + NONE + HALF + OTHER +} + +type SpellDc { + success: DcSuccess! + type: AbilityScore! + desc: String +} + +type MagicSchool { + index: String! + name: String! + desc: String! + spells(level: IntFilter, class: StringFilter, subclass: StringFilter, concentration: Boolean, ritual: Boolean, attack_type: SpellAttackTypeFilter, casting_time: StringFilter, area_of_effect: AreaOfEffectFilter, damage_type: StringFilter, dc_type: StringFilter, range: StringFilter, order: SpellOrder, skip: Int, limit: Int! = 100, name: String): [Spell!]! +} + +enum SpellAttackType { + MELEE + RANGED +} + +"""SpellAttackType ("MELEE", "RANGED") or list of SpellAttackTypes""" +scalar SpellAttackTypeFilter + +type Spell { + index: String! + area_of_effect: AreaOfEffect + attack_type: SpellAttackType + casting_time: String! + classes(name: String): [Class!]! + subclasses(name: String): [Subclass!]! + components: [SpellComponent] + concentration: Boolean! + damage: SpellDamage + dc: SpellDc + desc: [String!]! + duration: String! + heal_at_slot_level: [HealingAtLevel!] + higher_level: [String!] + level: Int! + material: String + name: String! + range: String! + ritual: Boolean! + school: MagicSchool! +} + +union ProficiencyReference = EquipmentCategory | Skill | AbilityScore | Tool | Armor | Weapon | Vehicle | Gear | Pack | Ammunition + +enum ProficiencyType { + WEAPONS + ARTISANS_TOOLS + SKILLS + ARMOR + MUSICAL_INSTRUMENTS + SAVING_THROWS + OTHER + GAMING_SETS + VEHICLES +} + +""" +ProficiencyType ("WEAPONS", "ARTISANS_TOOLS", "SKILLS", "ARMOR", "MUSICAL_INSTRUMENTS", "SAVING_THROWS", "OTHER", "GAMING_SETS", "VEHICLES") or list of ProficiencyTypes +""" +scalar ProficiencyTypeFilter + +type Proficiency { + index: String! + name: String! + classes(name: String): [Class!]! + type: ProficiencyType! + races(name: String): [ProficiencyRace!]! + reference: ProficiencyReference! +} + +type ActionDc { + type: AbilityScore! + value: Int! + success: DcSuccess! +} + +type LegendaryAction { + name: String! + desc: String! + dc: ActionDc + damage: [Damage!] +} + +type MonsterProficiency { + proficiency: Proficiency! + value: Int! +} + +type Reaction { + name: String! + desc: String! + dc: ActionDc +} + +type Senses { + blindsight: String + darkvision: String + passive_perception: Int! + tremorsense: String + truesight: String +} + +enum RestType { + SHORT + LONG +} + +enum UsageType { + AT_WILL + PER_DAY + RECHARGE_ON_ROLL + RECHARGE_AFTER_REST + PER_REST +} + +type Usage { + type: UsageType! + times: Int + rest_types: [RestType!] + dice: String + min_value: Int +} + +type MonsterSpellSlot { + level: Int! + slots: Int! +} + +type MonsterSpell { + spell: Spell! + usage: Usage +} + +type MonsterSpellcasting { + level: Int + ability: AbilityScore! + dc: Int + modifier: Int + components_required: [SpellComponent!] + school: String + slots: [MonsterSpellSlot!] + spells: [MonsterSpell!]! +} + +type SpecialAbility { + name: String! + desc: String! + usage: Usage + dc: ActionDc + spellcasting: MonsterSpellcasting + damage: [Damage!] +} + +type MonsterSpeed { + burrow: String + climb: String + fly: String + hover: Boolean + swim: String + walk: String +} + +enum Size { + TINY + SMALL + MEDIUM + LARGE + HUGE + GARGANTUAN +} + +""" +Size ("TINY", "SMALL", "MEDIUM", "LARGE", "HUGE", "GARGANTUAN") or list of sizes +""" +scalar SizeFilter + +enum MonsterType { + BEAST + MONSTROSITY + DRAGON + HUMANOID + UNDEAD + FIEND + CELESTIAL + CONSTRUCT + GIANT + ELEMENTAL + FEY + ABERRATION + OOZE + SWARM + PLANT +} + +""" +MonsterTypes ("BEAST", "MONSTROSITY", "DRAGON", "HUMANOID", "UNDEAD", "FIEND", "CELESTIAL", "CONSTRUCT", "GIANT", "ELEMENTAL", "FEY", "ABERRATION", "OOZE", "SWARM", "PLANT") or list of MonsterTypes +""" +scalar MonsterTypeFilter + +enum MonsterSubtype { + ANY_RACE + HUMAN + DWARF + ELF + GOBLINOID + MERFOLK + SHAPECHANGER + DEMON + DEVIL + ORC + SAHUAGIN + TITAN + KOBOLD + GNOLL + GRIMLOCK + LIZARDFOLK + GNOME +} + +""" +MonsterSubtype ("ANY_RACE", "HUMAN", "DWARF", "ELF", "GOBLINOID", "MERFOLK", "SHAPECHANGER", "DEMON", "DEVIL", "ORC", "SAHUAGIN", "TITAN", "KOBOLD", "GNOLL", "GRIMLOCK", "LIZARDFOLK", "GNOME") or list of MonsterSubtypes +""" +scalar MonsterSubtypeFilter + +"""Int or string""" +scalar ActionCount + +type ActionOption { + option_type: String! + action_name: String! + count: ActionCount! + type: String +} + +type MultipleActionOption { + option_type: String! + items: [ActionOption!]! +} + +union MonsterActionOption = ActionOption | MultipleActionOption + +type MonsterActionOptionSet { + option_set_type: String! + options: [MonsterActionOption!]! +} + +type MonsterActionChoice { + choose: Int! + type: String! + from: MonsterActionOptionSet! +} + +type Action { + action_name: String! + count: ActionCount! + type: String! +} + +type Attack { + damage: [Damage!] + dc: ActionDc! + name: String! +} + +type DamageOption { + option_type: String! + damage_dice: String! + damage_type: DamageType! + notes: String +} + +type DamageOptionSet { + option_set_type: String! + options: [DamageOption!]! +} + +type ActionDamage { + damage_dice: String + damage_type: DamageType + choose: Int + dc: ActionDc + type: String + from: DamageOptionSet +} + +type BreathOption { + option_type: String! + name: String! + dc: ActionDc! + damage: [Damage!] +} + +type BreathOptionSet { + option_set_type: String! + options: [BreathOption!]! +} + +type BreathChoice { + choose: Int! + type: String! + from: BreathOptionSet! +} + +type MonsterAction { + action_options: MonsterActionChoice + actions: [Action!] + name: String! + multiattack_type: String + attack_bonus: Int + attacks: [Attack!] + damage: [ActionDamage!] + desc: String! + dc: ActionDc + options: BreathChoice + usage: Usage +} + +enum MonsterArmorClassType { + dex + natural + armor + spell + condition +} + +type MonsterArmorClass { + type: MonsterArmorClassType! + desc: String + value: Int! + armor: [Armor] + spell: Spell + condition: Condition +} + +type Monster { + index: String! + name: String! + alignment: String! + armor_class: [MonsterArmorClass] + desc: String + actions: [MonsterAction!] + challenge_rating: Float! + proficiency_bonus: Int! + charisma: Int! + condition_immunities: [Condition!]! + constitution: Int! + damage_immunities: [String!]! + damage_resistances: [String!]! + damage_vulnerabilities: [String!]! + dexterity: Int! + forms: [Monster!] + hit_dice: String! + hit_points: Int! + hit_points_roll: String! + intelligence: Int! + languages: String! + legendary_actions: [LegendaryAction!] + proficiencies: [MonsterProficiency!]! + reactions: [Reaction!] + senses: Senses! + size: Size! + special_abilities: [SpecialAbility!] + speed: MonsterSpeed! + strength: Int! + subtype: MonsterSubtype + type: MonsterType! + wisdom: Int! + xp: Int! + image: String +} + +type ProficiencyReferenceOption { + option_type: String! + item: Proficiency! +} + +type ProficiencyChoiceOption { + option_type: String! + choice: ProficiencyChoice! +} + +union ProficiencyOption = ProficiencyChoiceOption | ProficiencyReferenceOption + +type ProficiencyOptionSet { + option_set_type: String! + options: [ProficiencyOption!]! +} + +type ProficiencyChoice { + desc: String + choose: Int! + type: String! + from: ProficiencyOptionSet! +} + +type BreathWeaponDc { + type: AbilityScore! + success: DcSuccess! +} + +type BreathWeaponUsage { + times: Int! + type: UsageType! +} + +type BreathWeaponDamage { + damage_at_character_level: [DamageAtLevel!]! + damage_type: DamageType! +} + +type BreathWeaponTrait { + name: String! + desc: String! + dc: BreathWeaponDc! + usage: BreathWeaponUsage! + damage: [BreathWeaponDamage!]! + area_of_effect: AreaOfEffect! +} + +type SpellOption { + option_type: String! + item: Spell! +} + +type SpellOptionSet { + option_set_type: String! + options: [SpellOption!]! +} + +type SpellChoice { + choose: Int! + type: String! + from: SpellOptionSet! +} + +type TraitOption { + option_type: String! + item: Trait! +} + +type TraitOptionSet { + option_set_type: String! + options: [TraitOption!]! +} + +type TraitChoice { + choose: Int! + type: String! + from: TraitOptionSet! +} + +type TraitSpecific { + breath_weapon: BreathWeaponTrait + damage_type: DamageType + spell_options: SpellChoice + subtrait_options: TraitChoice +} + +type Trait { + index: String! + desc: [String!]! + name: String! + proficiencies(name: String): [Proficiency!]! + parent: Trait + races(name: String): [Race]! + subraces(name: String): [Subrace!]! + proficiency_choices: ProficiencyChoice + language_options: LanguageChoice + trait_specific: TraitSpecific +} + +type AbilityBonus { + ability_score: AbilityScore! + bonus: Int! +} + +type AbilityBonusOption { + option_type: String! + bonus: Int! + ability_score: AbilityScore! +} + +type AbilityBonusOptionSet { + option_set_type: String! + options: [AbilityBonusOption!]! +} + +type AbilityBonusChoice { + choose: Int! + type: String! + from: AbilityBonusOptionSet! +} + +type LanguageOption { + option_type: String! + item: Language! +} + +type LanguageOptionSet { + option_set_type: String! + options: [LanguageOption!]! +} + +type LanguageChoice { + choose: Int! + type: String! + from: LanguageOptionSet! +} + +type Race implements ProficiencyRace { + index: String! + name: String! + ability_bonuses: [AbilityBonus!]! + ability_bonus_options: AbilityBonusChoice + age: String! + alignment: String! + language_desc: String! + languages(name: String): [Language!]! + language_options: LanguageChoice + size: Size! + size_description: String! + speed: Int! + starting_proficiencies(name: String): [Proficiency!]! + starting_proficiency_options: ProficiencyChoice + subraces(name: String): [Subrace!]! + traits(name: String): [Trait!]! +} + +type Subrace implements ProficiencyRace { + index: String! + name: String! + ability_bonuses: [AbilityBonus!]! + desc: String! + race: Race! + racial_traits(name: String): [Trait!]! + starting_proficiencies(name: String): [Proficiency!]! + language_options: LanguageChoice +} + +interface ProficiencyRace { + index: String! + name: String! + ability_bonuses: [AbilityBonus!]! +} + +type BackgroundFeature { + name: String! + desc: [String!]! +} + +type EquipmentCategoryOptionSet { + option_set_type: String! + equipment_category: EquipmentCategory! +} + +type EquipmentCategoryChoice { + choose: Int! + type: String! + from: EquipmentCategoryOptionSet! +} + +type IdealOption { + option_type: String! + desc: String! + alignments: [Alignment!]! +} + +type IdealOptionSet { + option_set_type: String! + options: [IdealOption!]! +} + +type IdealChoice { + choose: Int! + type: String! + from: IdealOptionSet! +} + +type StringOption { + option_type: String! + string: String! +} + +type StringOptionSet { + option_set_type: String! + options: [StringOption!]! +} + +type StringChoice { + choose: Int! + type: String! + from: StringOptionSet! +} + +type Background { + index: String! + name: String! + starting_proficiencies(name: String): [Proficiency!]! + starting_equipment(name: String): [Quantity!]! + feature: BackgroundFeature! + language_options: LanguageChoice! + starting_equipment_options: [EquipmentCategoryChoice!]! + ideals: IdealChoice! + personality_traits: StringChoice! + bonds: StringChoice! + flaws: StringChoice! +} + +type SpellcastingInfo { + name: String! + desc: [String!]! +} + +type ClassSpellcasting { + info: [SpellcastingInfo!]! + level: Int! + spellcasting_ability: AbilityScore! +} + +type PrerequisiteOption { + option_type: String! + ability_score: AbilityScore! + minimum_score: Int! +} + +type PrerequisiteOptionSet { + option_set_type: String! + options: [PrerequisiteOption!]! +} + +type PrerequisiteChoice { + choose: Int! + type: String! + from: PrerequisiteOptionSet! +} + +type Multiclassing { + prerequisites: [AbilityScorePrerequisite!] + prerequisite_options: PrerequisiteChoice + proficiencies: [Proficiency!]! + proficiency_choices: [ProficiencyChoice!] +} + +type ProficiencyPrerequisite { + type: String! + proficiency: Proficiency! +} + +type CountedReferenceOption { + option_type: String! + count: Int! + of: IEquipment! + prerequisites: [ProficiencyPrerequisite!] +} + +type EquipmentCategoryChoiceOption { + option_type: String! + choice: EquipmentCategoryChoice! +} + +union EquipmentMultipleItem = CountedReferenceOption | EquipmentCategoryChoiceOption + +type EquipmentMultipleOption { + option_type: String! + items: [EquipmentMultipleItem!]! +} + +union EquipmentOption = CountedReferenceOption | EquipmentCategoryChoiceOption | EquipmentMultipleOption + +type EquipmentOptionSet { + option_set_type: String! + options: [EquipmentOption!]! +} + +union StartingEquipmentOptionSet = EquipmentCategoryOptionSet | EquipmentOptionSet + +type StartingEquipmentChoice { + choose: Int! + desc: String! + type: String! + from: StartingEquipmentOptionSet! +} + +type Class { + index: String! + name: String! + hit_die: Int! + proficiencies(name: String): [Proficiency!]! + saving_throws: [AbilityScore!]! + spellcasting: ClassSpellcasting + spells(school: StringFilter, level: IntFilter, subclass: StringFilter, concentration: Boolean, ritual: Boolean, attack_type: SpellAttackTypeFilter, casting_time: StringFilter, area_of_effect: AreaOfEffectFilter, damage_type: StringFilter, dc_type: StringFilter, range: StringFilter, order: SpellOrder, skip: Int, limit: Int! = 100, name: String): [Spell!] + starting_equipment: [Quantity!]! + class_levels: [Level!]! + subclasses(name: String): [Subclass!]! + multi_classing: Multiclassing! + proficiency_choices: [ProficiencyChoice!]! + starting_equipment_options: [StartingEquipmentChoice!]! +} + +type FeaturePrerequisite { + type: String! + feature: Feature + level: Int + spell: Spell +} + +type FeatureOption { + option_type: String! + item: Feature! +} + +type FeatureOptionSet { + option_set_type: String! + options: [FeatureOption!]! +} + +type FeatureChoice { + choose: Int! + type: String! + from: FeatureOptionSet! +} + +type ExpertiseMultipleOption { + option_type: String! + items: [ProficiencyOption!]! +} + +union ExpertiseOption = ExpertiseMultipleOption | ProficiencyChoiceOption | ProficiencyReferenceOption + +type ExpertiseOptionSet { + option_set_type: String! + options: [ExpertiseOption!]! +} + +type ExpertiseChoice { + choose: Int! + type: String! + from: ExpertiseOptionSet! +} + +type FeatureSpecific { + expertise_options: ExpertiseChoice + subfeature_options: FeatureChoice + invocations: [Feature!] +} + +type Feature { + index: String! + name: String! + level: Int! + desc: [String!]! + parent: Feature + class: Class! + subclass: Subclass + prerequisites: [FeaturePrerequisite!]! + reference: String + feature_specific: FeatureSpecific +} + +type LevelSpellcasting { + cantrips_known: Int + spell_slots_level_1: Int + spell_slots_level_2: Int + spell_slots_level_3: Int + spell_slots_level_4: Int + spell_slots_level_5: Int + spell_slots_level_6: Int + spell_slots_level_7: Int + spell_slots_level_8: Int + spell_slots_level_9: Int + spells_known: Int +} + +type Dice { + dice_count: Int! + dice_value: Int! +} + +type BarbarianSpecific { + rage_count: Int! + rage_damage_bonus: Int! + brutal_critical_dice: Int! +} + +type BardSpecific { + bardic_inspiration_die: Int! + song_of_rest_die: Int! + magical_secrets_max_5: Int! + magical_secrets_max_7: Int! + magical_secrets_max_9: Int! +} + +type ClericSpecific { + channel_divinity_charges: Int! + destroy_undead_cr: Float! +} + +type DruidSpecific { + wild_shape_max_cr: Float! + wild_shape_swim: Boolean! + wild_shape_fly: Boolean! +} + +type FighterSpecific { + action_surges: Int! + indomitable_uses: Int! + extra_attacks: Int! +} + +type MonkSpecific { + martial_arts: Dice! + ki_points: Int! + unarmored_movement: Int! +} + +type PaladinSpecific { + aura_range: Int! +} + +type RangerSpecific { + favored_enemies: Int! + favored_terrain: Int! +} + +type RogueSpecific { + sneak_attack: Dice! +} + +type SpellSlotCreation { + sorcery_point_cost: Int! + spell_slot_level: Int! +} + +type SorcererSpecific { + sorcery_points: Int! + metamagic_known: Int! + creating_spell_slots: [SpellSlotCreation!]! +} + +type WarlockSpecific { + invocations_known: Int! + mystic_arcanum_level_6: Int! + mystic_arcanum_level_7: Int! + mystic_arcanum_level_8: Int! + mystic_arcanum_level_9: Int! +} + +type WizardSpecific { + arcane_recovery_levels: Int! +} + +union ClassSpecific = BarbarianSpecific | BardSpecific | ClericSpecific | DruidSpecific | FighterSpecific | MonkSpecific | PaladinSpecific | RangerSpecific | RogueSpecific | SorcererSpecific | WarlockSpecific | WizardSpecific + +type DevotionSpecific { + aura_range: Int! +} + +type LoreSpecific { + additional_magical_secrets_max_lvl: Int! +} + +union SubclassSpecific = DevotionSpecific | LoreSpecific + +type Level { + index: String! + level: Int! + ability_score_bonuses: Int + class: Class! + subclass: Subclass + features(order_direction: OrderByDirection, name: String): [Feature!]! + prof_bonus: Int + spellcasting: LevelSpellcasting + class_specific: ClassSpecific + subclass_specific: SubclassSpecific +} + +union SpellPrerequisite = Feature | Level + +type SpellWithPrerequisite { + prerequisites: [SpellPrerequisite]! + spell: Spell! +} + +type Subclass { + index: String! + name: String! + desc: [String!]! + class: Class! + subclass_flavor: String! + subclass_levels: [Level]! + spells(school: StringFilter, class: StringFilter, level: IntFilter, concentration: Boolean, ritual: Boolean, attack_type: SpellAttackTypeFilter, casting_time: StringFilter, area_of_effect: AreaOfEffectFilter, damage_type: StringFilter, dc_type: StringFilter, range: StringFilter, order: SpellOrder, skip: Int, limit: Int! = 100, name: String): [SpellWithPrerequisite!] +} + +input AreaOfEffectFilter { + type: AreaOfEffectTypeFilter + size: IntFilter +} + +enum OrderByDirection { + ASCENDING + DESCENDING +} + +input SpellOrder { + by: SpellOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: SpellOrder +} + +enum SpellOrderBy { + NAME + LEVEL + AREA_OF_EFFECT_SIZE + CONCENTRATION + RITUAL + SCHOOL +} + +input EquipmentOrder { + by: EquipmentOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: EquipmentOrder +} + +enum EquipmentOrderBy { + NAME + WEIGHT + EQUIPMENT_CATEGORY +} + +input ClassOrder { + by: ClassOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: ClassOrder +} + +enum ClassOrderBy { + NAME + HIT_DIE +} + +input MagicItemOrder { + by: MagicItemOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: MagicItemOrder +} + +enum MagicItemOrderBy { + NAME + EQUIPMENT_CATEGORY +} + +input EquipmentCategoryOrder { + by: EquipmentCategoryOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: EquipmentCategoryOrder +} + +enum EquipmentCategoryOrderBy { + NAME + WEIGHT +} + +input FeatureOrder { + by: FeatureOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: FeatureOrder +} + +enum FeatureOrderBy { + NAME + LEVEL + CLASS + SUBCLASS +} + +input LanguageOrder { + by: LanguageOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: LanguageOrder +} + +enum LanguageOrderBy { + NAME + TYPE + SCRIPT +} + +input LevelOrder { + by: LevelOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: LevelOrder +} + +enum LevelOrderBy { + LEVEL + CLASS + SUBCLASS + PROF_BONUS + ABILITY_SCORE_BONUSES +} + +input MonsterOrder { + by: MonsterOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: MonsterOrder +} + +enum MonsterOrderBy { + NAME + SIZE + TYPE + SUBTYPE + ARMOR_CLASS + CHALLENGE_RATING + CHARISMA + CONSTITUTION + STRENGTH + WISDOM + INTELLIGENCE + DEXTERITY + XP +} + +input ProficiencyOrder { + by: ProficiencyOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: ProficiencyOrder +} + +enum ProficiencyOrderBy { + NAME + TYPE +} + +input RaceOrder { + by: RaceOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: RaceOrder +} + +enum RaceOrderBy { + NAME + SIZE + SPEED +} + +input SkillOrder { + by: SkillOrderBy! + direction: OrderByDirection! = ASCENDING + then_by: SkillOrder +} + +enum SkillOrderBy { + NAME + ABILITY_SCORE +} + +type Query { + abilityScore(index: String): AbilityScore + abilityScores(order_direction: OrderByDirection, name: String, full_name: String): [AbilityScore!] + alignment(index: String): Alignment + alignments(order_direction: OrderByDirection, name: String): [Alignment!] + background(index: String): Background + backgrounds(order_direction: OrderByDirection, name: String): [Background!]! + class(index: String): Class + classes(hit_die: IntFilter, order: ClassOrder, name: String): [Class!]! + condition(index: String): Condition + conditions(order_direction: OrderByDirection, name: String): [Condition!] + damageType(index: String): DamageType + damageTypes(order_direction: OrderByDirection, name: String): [DamageType!] + equipment(index: String): IEquipment + equipments(equipment_category: StringFilter, order: EquipmentOrder, skip: Int, limit: Int! = 100, name: String): [IEquipment!] + equipmentCategory(index: String): EquipmentCategory + equipmentCategories(order_direction: OrderByDirection, name: String): [EquipmentCategory!] + feat(index: String): Feat + feats(order_direction: OrderByDirection, name: String): [Feat!] + feature(index: String): Feature + features(level: IntFilter, class: StringFilter, subclass: StringFilter, order: FeatureOrder, skip: Int, limit: Int! = 100, name: String): [Feature!] + language(index: String): Language + languages(type: LanguageType, script: LanguageScriptFilter, order: LanguageOrder, name: String): [Language!] + level(index: String): Level + levels(class: StringFilter, subclass: StringFilter, level: IntFilter, prof_bonus: IntFilter, ability_score_bonuses: IntFilter, order: LevelOrder, skip: Int, limit: Int! = 100): [Level!] + magicItem(index: String): MagicItem + magicItems(equipment_category: StringFilter, order: MagicItemOrder, skip: Int, limit: Int! = 100, name: String): [MagicItem!] + magicSchool(index: String): MagicSchool + magicSchools(order_direction: OrderByDirection, name: String): [MagicSchool!] + monster(index: String): Monster + monsters(size: SizeFilter, type: MonsterTypeFilter, subtype: MonsterSubtypeFilter, damage_immunity: StringFilter, damage_resistance: StringFilter, damage_vulnerability: StringFilter, armor_class: IntFilter, challenge_rating: FloatFilter, charisma: IntFilter, constitution: IntFilter, dexterity: IntFilter, intelligence: IntFilter, strength: IntFilter, wisdom: IntFilter, xp: IntFilter, order: MonsterOrder, skip: Int, limit: Int! = 100, name: String): [Monster!] + proficiency(index: String): Proficiency + proficiencies(class: StringFilter, race: StringFilter, type: ProficiencyTypeFilter, order: ProficiencyOrder, skip: Int, limit: Int! = 100, name: String): [Proficiency!] + race(index: String): Race + races(ability_bonus: StringFilter, size: SizeFilter, language: StringFilter, speed: IntFilter, order: RaceOrder, name: String): [Race!]! + rule(index: String): Rule + rules(order_direction: OrderByDirection, name: String): [Rule] + ruleSection(index: String): RuleSection + ruleSections(order_direction: OrderByDirection, name: String): [RuleSection!] + skill(index: String): Skill + skills(ability_score: StringFilter, order: SkillOrder, name: String): [Skill!] + spell(index: String): Spell + spells(school: StringFilter, level: IntFilter, class: StringFilter, subclass: StringFilter, concentration: Boolean, ritual: Boolean, attack_type: SpellAttackTypeFilter, casting_time: StringFilter, area_of_effect: AreaOfEffectFilter, damage_type: StringFilter, dc_type: StringFilter, range: StringFilter, order: SpellOrder, skip: Int, limit: Int! = 100, name: String): [Spell!] + subclass(index: String): Subclass + subclasses(order_direction: OrderByDirection, name: String): [Subclass!]! + subrace(index: String): Subrace + subraces(order_direction: OrderByDirection, name: String): [Subrace!]! + trait(index: String): Trait + traits(order_direction: OrderByDirection, name: String): [Trait!] + weaponProperty(index: String): WeaponProperty + weaponProperties(order_direction: OrderByDirection, name: String): [WeaponProperty] +} diff --git a/src/api_client.rs b/src/api_client.rs new file mode 100644 index 0000000..b5ae86e --- /dev/null +++ b/src/api_client.rs @@ -0,0 +1,142 @@ +use crate::types::{Item, Spell}; +use graphql_client::{GraphQLQuery, QueryBody, Response}; +use std::error::Error; + +// https://studio.apollographql.com/sandbox?endpoint=https%3A%2F%2Fwww.dnd5eapi.co%2Fgraphql + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "gql/schema.graphql", + query_path = "gql/GetSpell.graphql", + response_derives = "Debug" +)] +struct GetSpell; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "gql/schema.graphql", + query_path = "gql/GetItem.graphql", + response_derives = "Debug" +)] +struct GetItem; + +fn perform_request( + request_body: QueryBody, +) -> Result, Box> +where + Q: GraphQLQuery, +{ + let client = reqwest::blocking::Client::new(); + + let res = client + .post("https://www.dnd5eapi.co/graphql") + .json(&request_body) + .send()?; + let response_body: Response = res.json()?; + + return Ok(response_body); +} + +fn spell_component_to_string(c: &get_spell::SpellComponent) -> String { + match c { + get_spell::SpellComponent::M => String::from("M"), + get_spell::SpellComponent::V => String::from("V"), + get_spell::SpellComponent::S => String::from("S"), + get_spell::SpellComponent::Other(s) => String::from(s), + } +} + +fn rarity_to_string(r: &get_item::MagicItemRarity) -> String { + match r { + get_item::MagicItemRarity::ARTIFACT => String::from("ARTIFACT"), + get_item::MagicItemRarity::LEGENDARY => String::from("LEGENDARY"), + get_item::MagicItemRarity::VERY_RARE => String::from("VERY_RARE"), + get_item::MagicItemRarity::RARE => String::from("RARE"), + get_item::MagicItemRarity::UNCOMMON => String::from("UNCOMMON"), + get_item::MagicItemRarity::COMMON => String::from("COMMON"), + get_item::MagicItemRarity::VARIES => String::from("VARIES"), + get_item::MagicItemRarity::Other(s) => String::from(s), + } +} + +pub fn get_spell(index: &str) -> Result> { + let vars = get_spell::Variables { + index: index.into(), + }; + + let body = GetSpell::build_query(vars); + + let res = perform_request::(body)?; + + match res.data { + Some(data) => match data.spell { + Some(spell) => { + let rtn = Spell { + name: spell.name, + level: spell.level, + school: spell.school.name, + range: spell.range, + desc: spell.desc.join(" "), + components: match spell.components { + Some(components) => { + Some(components + .iter() + .flatten() + .map(spell_component_to_string) + .collect::>().join(" ") + ) + } + _ => None, + }, + duration: spell.duration, + ritual: spell.ritual, + casting_time: spell.casting_time, + }; + + return Ok(rtn); + } + + _ => { + return Err(Box::from("Spell not found")); + } + }, + _ => { + return Err(Box::from("Spell not found")); + } + } +} + +pub fn get_item(index: &str) -> Result>{ + let vars = get_item::Variables { + index: index.into(), + }; + + let body = GetItem::build_query(vars); + + let res = perform_request::(body)?; + + match res.data { + Some(data) => { + match data.magic_item { + Some(item) => { + let rtn = Item{ + name: item.name, + rarity: rarity_to_string(&item.rarity), + desc: item.desc.join(" ") + }; + + return Ok(rtn); + } + + None => { + return Err(Box::from("Item not found")); + } + } + } + + None => { + return Err(Box::from("Item not found")); + } + } + +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..578f14a --- /dev/null +++ b/src/main.rs @@ -0,0 +1,35 @@ +use std::path::Path; + +mod print; +mod api_client; +mod types; + +use escpos::{driver::{ConsoleDriver, FileDriver}, errors::PrinterError, printer::Printer, utils::Protocol}; + +// https://www.dnd5eapi.co/graphql + +fn run() -> Result<(),PrinterError> { + // let driver = FileDriver::open(Path::new("/dev/usb/lp0")).unwrap(); + let driver = ConsoleDriver::open(true); + let mut printer = Printer::new(driver, Protocol::default()); + + printer.init()?; + + print::print_test_page(&mut printer)?; + + return Ok(()); +} + +fn main(){ + let spell = api_client::get_spell("eldritch-blast").unwrap(); + + let driver = FileDriver::open(Path::new("/dev/usb/lp0")).unwrap(); + let mut printer = Printer::new(driver, Protocol::default()); + + printer.init().unwrap(); + + print::print_spell(&mut printer, &spell).unwrap(); + + + println!("{:?}",spell); +} diff --git a/src/print.rs b/src/print.rs new file mode 100644 index 0000000..aec4b76 --- /dev/null +++ b/src/print.rs @@ -0,0 +1,129 @@ +use escpos::{driver::Driver, errors::PrinterError, printer::Printer, utils::JustifyMode}; + +use crate::types::Spell; + +const WIDTH: usize = 32; + +pub fn print_test_page(printer: &mut Printer) -> Result<(), PrinterError> { + printer + .writeln("---Printer Test Page---")? + .bold(true)? + .writeln("This text should be bold.")? + .bold(false)? + .underline(escpos::utils::UnderlineMode::Single)? + .writeln("This text should be single underline.")? + .underline(escpos::utils::UnderlineMode::Double)? + .writeln("This text should be double underline.")? + .underline(escpos::utils::UnderlineMode::None)? + .double_strike(true)? + .writeln("This text should be double striked.")? + .double_strike(true)? + .writeln("Text alignment")? + .justify(JustifyMode::CENTER)? + .writeln("CENTER")? + .justify(JustifyMode::RIGHT)? + .writeln("RIGHT")? + .justify(JustifyMode::LEFT)? + .size(1, 1)? + .writeln("size 1")? + .size(5, 5)? + .writeln("size 5")? + .reset_size()? + .font(escpos::utils::Font::A)? + .write("Font A ")? + .font(escpos::utils::Font::B)? + .write("Font B ")? + .font(escpos::utils::Font::C)? + .writeln("Font C")? + .font(escpos::utils::Font::A)? + .flip(true)? + .writeln("Fliped")? + .flip(false)? + .line_spacing(8)? + .writeln("Line")? + .writeln("Spacing")? + .reset_line_spacing()? + .upside_down(true)? + .writeln("Upside down")? + .upside_down(false)? + // Barcodes + .writeln("EAN-13 (978020137962)")? + .ean13("978020137962")? + .writeln("EAN-8 (9031101)")? + .ean8("9031101")? + .writeln("UPC-A")? + .upca("72527273070")? + .writeln("CODE-39")? + .code39("1234")? + .writeln("CODABAR")? + .writeln("1234")? + .writeln("ITF")? + .itf("1234")? + // 2D Codes + .writeln("QR Code")? + .qrcode("Hello world")? + .writeln("2D GS1 DataBar")? + .gs1_databar_2d("1234567890123")? + .writeln("pdf417")? + .pdf417("Hello world")? + .writeln("Maxi code")? + .maxi_code("Hello world")? + .writeln("Data matrix")? + .data_matrix("Hello world")? + .writeln("aztec")? + .aztec("Hello world")? + // Image + .writeln("raster image")? + // .bit_image("./rust-logo-small.png")? + .print()?; + + return Ok(()); +} + +fn left_right_print(printer: &mut Printer,left: &str, right: &str ) -> Result<(), PrinterError> { + printer + .write(left)? + .write(&".".repeat(WIDTH - left.len() - right.len()))? + .writeln(right)?; + + return Ok(()); +} + +pub fn print_spell(printer: &mut Printer, spell: &Spell) -> Result<(), PrinterError> { + printer + .size(4, 4)? + .writeln(&spell.name)? + .reset_size()? + .line_spacing(1)?; + + if spell.level > 0 { + if spell.ritual { + printer.writeln(&format!("Lvl. {} {} (ritual)", spell.level, spell.school))?; + }else{ + printer.writeln(&format!("Lvl. {} {}", spell.level, spell.school))?; + } + } else { + printer.writeln(&format!("{} cantrip", spell.school))?; + } + + printer.feed()?; + + match &spell.components { + Some(comp) => { + left_right_print(printer, "Components:", &comp)?; + } + _ => {} + } + + left_right_print(printer, "Casting time:", &spell.casting_time)?; + left_right_print(printer, "Range:", &spell.range)?; + left_right_print(printer, "Duration:", &spell.duration)?; + + printer + .reset_line_spacing()? + .write(&spell.desc)? + .feeds(3)? + .print()?; + + return Ok(()); +} diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..92a072b --- /dev/null +++ b/src/types.rs @@ -0,0 +1,18 @@ +#[derive(Debug)] +pub struct Spell{ + pub name: String, + pub level: i64, + pub range: String, + pub school: String, + pub desc: String, + pub components: Option, + pub duration: String, + pub ritual: bool, + pub casting_time: String, +} + +pub struct Item { + pub name: String, + pub rarity: String, + pub desc: String, +}