diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a7803ba --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project are documented here. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] + +Initial release of `beckon`. + +`beckon` is the continuation of the crate previously published as `http-provider-macro`, +renamed for a clearer, single, consistent name across the macro, crate, and repository. + +### Features + +- `beckon!` macro that generates a type-safe, async HTTP client from endpoint definitions. +- Per-endpoint configuration: `method`, `path`, `req`, `res`, `path_params`, `query_params`, + `headers`, `fn_name`, and `retries`. +- Built-in auth strategies: `Bearer`, `Basic`, and `ApiKey`. +- Global and per-endpoint retries with exponential backoff (5xx and timeouts only). +- A generated trait per client for mocking in tests, and a typed error enum. diff --git a/Cargo.lock b/Cargo.lock index 3bf4b28..13c4066 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # 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" @@ -26,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" - [[package]] name = "assert-json-diff" version = "2.0.2" @@ -43,26 +22,10 @@ dependencies = [ ] [[package]] -name = "async-channel" -version = "1.9.0" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-trait" -version = "0.1.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" @@ -70,38 +33,27 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[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.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +name = "beckon" +version = "0.1.0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.102", + "tokio", + "wiremock", +] [[package]] name = "bitflags" @@ -136,15 +88,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -161,22 +104,15 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "deadpool" -version = "0.9.5" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e" +checksum = "0be2b1d1d6ec8d846f05e137292d0b89133caf95ef33695424c09568bdd39b1b" dependencies = [ - "async-trait", "deadpool-runtime", + "lazy_static", "num_cpus", - "retain_mut", "tokio", ] @@ -194,7 +130,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] [[package]] @@ -222,21 +158,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "fastrand" version = "2.3.0" @@ -321,21 +242,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.31" @@ -344,7 +250,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] [[package]] @@ -359,12 +265,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - [[package]] name = "futures-util" version = "0.3.31" @@ -385,13 +285,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] @@ -406,23 +306,17 @@ dependencies = [ "wasi 0.14.2+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.3.26" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap", "slab", @@ -451,61 +345,35 @@ checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "http" -version = "0.2.12" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" dependencies = [ "bytes", - "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.4.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" dependencies = [ "bytes", "http", - "pin-project-lite", ] [[package]] -name = "http-provider-macro" +name = "http-body-util" version = "0.1.4" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn", - "tokio", - "wiremock", -] - -[[package]] -name = "http-types" -version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2" dependencies = [ - "anyhow", - "async-channel", - "base64 0.13.1", - "futures-lite", + "bytes", + "futures-core", "http", - "infer", + "http-body", "pin-project-lite", - "rand", - "serde", - "serde_json", - "serde_qs", - "serde_urlencoded", - "url", ] [[package]] @@ -522,14 +390,14 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.32" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" dependencies = [ + "atomic-waker", "bytes", "futures-channel", "futures-core", - "futures-util", "h2", "http", "http-body", @@ -537,24 +405,65 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +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.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.5.10", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", ] [[package]] @@ -674,21 +583,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "infer" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" - -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -711,11 +605,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" -version = "0.2.172" +version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "linux-raw-sys" @@ -757,24 +657,15 @@ 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" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" dependencies = [ "libc", "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -804,15 +695,6 @@ dependencies = [ "libc", ] -[[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" @@ -825,7 +707,7 @@ version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ - "bitflags 2.9.1", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -842,7 +724,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] [[package]] @@ -863,12 +745,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - [[package]] name = "parking_lot" version = "0.12.4" @@ -889,7 +765,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -925,15 +801,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro2" version = "1.0.95" @@ -958,54 +825,13 @@ version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - [[package]] name = "redox_syscall" version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ - "bitflags 2.9.1", + "bitflags", ] [[package]] @@ -1039,55 +865,57 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ - "base64 0.21.7", + "base64", "bytes", "encoding_rs", "futures-core", - "futures-util", "h2", "http", "http-body", + "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", - "ipnet", + "hyper-util", "js-sys", "log", "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", + "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", ] [[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - -[[package]] -name = "rustc-demangle" -version = "0.1.25" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] [[package]] name = "rustix" @@ -1095,7 +923,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.9.1", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -1103,12 +931,36 @@ dependencies = [ ] [[package]] -name = "rustls-pemfile" -version = "1.0.4" +name = "rustls" +version = "0.23.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" dependencies = [ - "base64 0.21.7", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -1144,7 +996,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.1", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -1178,7 +1030,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] [[package]] @@ -1193,17 +1045,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_qs" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" -dependencies = [ - "percent-encoding", - "serde", - "thiserror", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1256,12 +1097,28 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[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.102" @@ -1273,11 +1130,25 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" @@ -1287,25 +1158,25 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -1317,33 +1188,13 @@ version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ - "fastrand 2.3.0", + "fastrand", "getrandom 0.3.3", "once_cell", "rustix", "windows-sys 0.59.0", ] -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tinystr" version = "0.8.1" @@ -1356,31 +1207,30 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.1" +version = "1.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" dependencies = [ - "backtrace", "bytes", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.6.5", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.3", ] [[package]] @@ -1393,6 +1243,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.15" @@ -1406,6 +1266,45 @@ dependencies = [ "tokio", ] +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[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" @@ -1443,6 +1342,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[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.4" @@ -1452,7 +1357,6 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", - "serde", ] [[package]] @@ -1467,12 +1371,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "waker-fn" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - [[package]] name = "want" version = "0.3.1" @@ -1482,12 +1380,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -1525,7 +1417,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.102", "wasm-bindgen-shared", ] @@ -1560,7 +1452,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1585,12 +1477,38 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-targets 0.48.5", + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", ] [[package]] @@ -1599,7 +1517,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -1608,22 +1526,16 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" 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", + "windows-link", ] [[package]] @@ -1632,46 +1544,28 @@ 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_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "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", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[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.6" @@ -1684,84 +1578,51 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[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.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[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 = "wiremock" -version = "0.5.22" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a3a53eaf34f390dd30d7b1b078287dd05df2aa2e21a589ccb80f5c7253c2e9" +checksum = "08db1edfb05d9b3c1542e521aea074442088292f00b5f28e435c714a98f85031" dependencies = [ "assert-json-diff", - "async-trait", - "base64 0.21.7", + "base64", "deadpool", "futures", - "futures-timer", - "http-types", + "http", + "http-body-util", "hyper", + "hyper-util", "log", "once_cell", "regex", "serde", "serde_json", "tokio", + "url", ] [[package]] @@ -1770,7 +1631,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", + "bitflags", ] [[package]] @@ -1799,30 +1660,10 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", "synstructure", ] -[[package]] -name = "zerocopy" -version = "0.8.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zerofrom" version = "0.1.6" @@ -1840,10 +1681,16 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", "synstructure", ] +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + [[package]] name = "zerotrie" version = "0.2.2" @@ -1874,5 +1721,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.102", ] diff --git a/Cargo.toml b/Cargo.toml index fb4039a..17b308d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,16 @@ [package] -name = "http-provider-macro" -version = "0.1.4" +name = "beckon" +version = "0.1.0" edition = "2021" -authors = ["AzeemShaik azeemshaik025@gmail.com"] -description = "A procedural macro for generating type-safe API clients" -repository = "https://github.com/Azeem-0/api-client-macro" +authors = ["Azeem Shaik "] +description = "Generate type-safe, async HTTP clients from endpoint definitions — a Rust proc macro." +repository = "https://github.com/azeemshaik025/beckon" +homepage = "https://github.com/azeemshaik025/beckon" license = "MIT OR Apache-2.0" -keywords = ["http", "client", "macro", "rest", "api"] +keywords = ["http", "client", "rest", "api", "proc-macro"] categories = ["web-programming::http-client", "development-tools"] readme = "README.md" -documentation = "https://docs.rs/http-provider-macro" +documentation = "https://docs.rs/beckon" [lib] proc-macro = true @@ -22,8 +23,8 @@ regex = "1.11.1" syn = { version = "2.0.102", features = ["full", "extra-traits", "parsing"] } [dev-dependencies] -wiremock = "0.5" -reqwest = { version = "0.11", features = ["json"] } +wiremock = "0.6" +reqwest = { version = "0.12", features = ["json"] } tokio = { version = "1.0", features = ["full"] } serde = { version = "1.0.204", features = ["derive"] } serde_json = "1.0.122" diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..4307bc7 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 Azeem Shaik + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..4436832 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Azeem Shaik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index f8cf098..13897c0 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,23 @@ -# API Client Macro +# beckon -A procedural macro for generating type-safe API clients in Rust. +[![crates.io](https://img.shields.io/crates/v/beckon.svg)](https://crates.io/crates/beckon) +[![docs.rs](https://img.shields.io/docsrs/beckon)](https://docs.rs/beckon) +[![CI](https://github.com/azeemshaik025/beckon/actions/workflows/ci.yml/badge.svg)](https://github.com/azeemshaik025/beckon/actions/workflows/ci.yml) +[![license](https://img.shields.io/crates/l/beckon.svg)](#license) + +**Generate type-safe, async HTTP clients from endpoint definitions.** + +`beckon!` takes a client name and a list of endpoints, and expands to a struct with one +async method per endpoint — plus a trait for mocking and a typed error enum. No hand-written +request boilerplate. ## Install ```sh -cargo add http-provider-macro +cargo add beckon ``` -The crate remains published as `http-provider-macro`, and the recommended macro is `api_client!`. - -You'll also need these dependencies: +You'll also need the runtime dependencies the generated code uses: ```sh cargo add reqwest --features json @@ -18,10 +25,10 @@ cargo add serde --features derive cargo add tokio --features full ``` -## Usage +## Example ```rust -use http_provider_macro::api_client; +use beckon::beckon; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] @@ -35,7 +42,7 @@ struct UserPath { id: u32, } -api_client!( +beckon!( UserApi, { { @@ -86,8 +93,8 @@ async fn main() -> Result<(), Box> { - `path_params`: Type for path parameters - `query_params`: Type for query parameters - `headers`: Header type (e.g., `reqwest::header::HeaderMap`) -- `fn_name`: Custom function name -- `retries`: Retry count for this endpoint (overrides global) +- `fn_name`: Custom method name +- `retries`: Retry count for this endpoint (overrides the global setting) ## Auth @@ -95,26 +102,29 @@ Add automatic authentication to every request. Three strategies are supported: ```rust // Bearer token — injects `Authorization: Bearer ` -api_client!(GithubApi, auth: Bearer, { ... }); +beckon!(GithubApi, auth: Bearer, { /* ... */ }); let client = GithubApi::new(url, "ghp_xxxx", Some(5000)); // Basic auth — injects `Authorization: Basic ` -api_client!(DbApi, auth: Basic, { ... }); +beckon!(DbApi, auth: Basic, { /* ... */ }); let client = DbApi::new(url, "admin", "secret", Some(5000)); // API key — injects a custom header -api_client!(StripeApi, auth: ApiKey("X-Api-Key"), { ... }); +beckon!(StripeApi, auth: ApiKey("X-Api-Key"), { /* ... */ }); let client = StripeApi::new(url, "sk_live_xxxx", Some(5000)); ``` -Omitting `auth` keeps the original `new(url, timeout)` constructor (backward compatible). Auth works with all other features including retries. +Omitting `auth` keeps the plain `new(url, timeout)` constructor. Auth composes with every +other feature, including retries. ## Retry with Backoff -Set a global retry count that applies to all endpoints. Retries use exponential backoff (100ms base, 2x multiplier, 5s cap) and trigger on 5xx errors and request timeouts. 4xx errors are never retried. +Set a global retry count that applies to all endpoints. Retries use exponential backoff +(100ms base, 2x multiplier, 5s cap) and trigger on 5xx errors and request timeouts. 4xx +errors are never retried. ```rust -api_client!( +beckon!( UserApi, retries: 3, { @@ -122,38 +132,43 @@ api_client!( path: "/users", method: GET, res: Vec, - // inherits retries: 3 from global + // inherits retries: 3 from the global setting }, { path: "/health", method: GET, - retries: 0, // override: no retries for this endpoint + retries: 0, // override: no retries for this endpoint }, } ); ``` -Per-endpoint `retries` overrides the global value. Omitting `retries` entirely means no retries (backward compatible). +Per-endpoint `retries` overrides the global value. Omitting `retries` entirely means no retries. ## Generated Code -The macro generates: +For a client named `UserApi`, the macro generates: -- A **struct** with `new(url, timeout)` constructor +- A **struct** `UserApi` with a `new(url, timeout)` constructor - An **async method** for each endpoint -- A **trait** (`{Name}Trait`) for mocking in tests -- An **error enum** (`{Name}Error`) with variants for URL, request, HTTP, and deserialization errors +- A **trait** `UserApiTrait` for mocking in tests +- An **error enum** `UserApiError` with variants for URL, request, HTTP, and deserialization errors ## Examples See the [`examples/`](examples/) directory: -- [`basic.rs`](examples/basic.rs) - Simple GET requests -- [`params.rs`](examples/params.rs) - Path and query parameters -- [`advanced.rs`](examples/advanced.rs) - All features -- [`mocking.rs`](examples/mocking.rs) - Testing with generated traits -- [`multiple_path_params.rs`](examples/multiple_path_params.rs) - Nested resources +- [`basic.rs`](examples/basic.rs) — simple GET requests +- [`params.rs`](examples/params.rs) — path and query parameters +- [`advanced.rs`](examples/advanced.rs) — all features +- [`mocking.rs`](examples/mocking.rs) — testing with the generated trait +- [`multiple_path_params.rs`](examples/multiple_path_params.rs) — nested resources ## License -MIT OR Apache-2.0 +Licensed under either of + +- [Apache License, Version 2.0](LICENSE-APACHE) +- [MIT license](LICENSE-MIT) + +at your option. diff --git a/examples/advanced.rs b/examples/advanced.rs index bb713ee..1fe7e08 100644 --- a/examples/advanced.rs +++ b/examples/advanced.rs @@ -1,4 +1,4 @@ -//! Comprehensive example demonstrating all features of the `api_client` macro. +//! Comprehensive example demonstrating all features of the `beckon` macro. //! //! This example shows: //! - Request bodies (`req`) @@ -9,14 +9,14 @@ //! - Optional response types (omitting `res` returns `()`) //! - Endpoints without paths -use http_provider_macro::api_client; +use beckon::beckon; use reqwest::{header::HeaderMap, Url}; use serde::{Deserialize, Serialize}; // Response types #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct User { +pub struct User { id: u32, name: String, email: String, @@ -24,46 +24,46 @@ struct User { #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct CreateUserResponse { +pub struct CreateUserResponse { id: u32, message: String, } #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct SearchResults { +pub struct SearchResults { results: Vec, total: u32, } // Request body types #[derive(Serialize)] -struct CreateUserRequest { +pub struct CreateUserRequest { name: String, email: String, } #[derive(Serialize)] -struct UpdateUserRequest { +pub struct UpdateUserRequest { name: Option, email: Option, } // Path parameters #[derive(Serialize)] -struct UserPathParams { +pub struct UserPathParams { id: u32, } // Query parameters #[derive(Serialize)] -struct SearchQueryParams { +pub struct SearchQueryParams { q: String, limit: Option, } // Define an API client with all features -api_client!( +beckon!( ApiClient, { // Basic GET with path and response diff --git a/examples/basic.rs b/examples/basic.rs index 21c0481..eeb5e6d 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,29 +1,29 @@ -//! Basic example demonstrating minimal usage of the `api_client` macro. +//! Basic example demonstrating minimal usage of the `beckon` macro. //! //! This example shows the simplest way to create an HTTP API client //! with just the essential fields: `method`, `path`, and `res`. -use http_provider_macro::api_client; +use beckon::beckon; use reqwest::Url; use serde::Deserialize; // Define your response types #[derive(Deserialize, Debug)] -struct User { +pub struct User { id: u32, name: String, email: String, } #[derive(Deserialize, Debug)] -struct Post { +pub struct Post { id: u32, title: String, content: String, } // Define your API client with minimal configuration -api_client!( +beckon!( ApiClient, { { diff --git a/examples/mocking.rs b/examples/mocking.rs index 3982721..cfd3b79 100644 --- a/examples/mocking.rs +++ b/examples/mocking.rs @@ -1,28 +1,28 @@ //! Example demonstrating how to mock the generated API client for testing. //! -//! The `api_client` macro generates a trait (e.g., `ApiClientTrait`) that +//! The `beckon` macro generates a trait (e.g., `ApiClientTrait`) that //! the client struct implements. You can implement this trait yourself to //! create mock clients for testing without making actual HTTP requests. -use http_provider_macro::api_client; +use beckon::beckon; use serde::{Deserialize, Serialize}; // Response type #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct User { +pub struct User { id: u32, name: String, } // Path parameters #[derive(Serialize)] -struct UserPathParams { +pub struct UserPathParams { id: u32, } // Define the client with a single endpoint -api_client!( +beckon!( ApiClient, { { @@ -35,7 +35,7 @@ api_client!( ); // Mock client implementing the generated trait -struct MockProvider; +pub struct MockProvider; impl ApiClientTrait for MockProvider { async fn get_users_by_id(&self, path_params: &UserPathParams) -> Result { diff --git a/examples/multiple_path_params.rs b/examples/multiple_path_params.rs index 72e4aa7..c502d7b 100644 --- a/examples/multiple_path_params.rs +++ b/examples/multiple_path_params.rs @@ -3,13 +3,13 @@ //! When you have multiple path parameters like `/users/{user_id}/posts/{post_id}`, //! the generated function name will be: `get_users_by_user_id_posts_by_post_id` -use http_provider_macro::api_client; +use beckon::beckon; use reqwest::Url; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct Post { +pub struct Post { id: u32, title: String, content: String, @@ -17,13 +17,13 @@ struct Post { // Path parameters struct - fields must match all `{param}` placeholders in the path #[derive(Serialize)] -struct UserPostPathParams { +pub struct UserPostPathParams { user_id: u32, post_id: u32, } // Define an API client with multiple path parameters -api_client!( +beckon!( ApiClient, { { @@ -46,7 +46,7 @@ api_client!( ); #[derive(Serialize)] -struct CommentReplyPathParams { +pub struct CommentReplyPathParams { id: u32, comment_id: u32, reply_id: u32, diff --git a/examples/params.rs b/examples/params.rs index 86d36f3..06a58f7 100644 --- a/examples/params.rs +++ b/examples/params.rs @@ -3,14 +3,14 @@ //! This example shows how to use `path_params` for dynamic URL segments //! and `query_params` for query string parameters. -use http_provider_macro::api_client; +use beckon::beckon; use reqwest::Url; use serde::{Deserialize, Serialize}; // Response types #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct User { +pub struct User { id: u32, name: String, email: String, @@ -18,32 +18,32 @@ struct User { #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct SearchResults { +pub struct SearchResults { results: Vec, total: u32, } // Path parameters - fields must match the `{param}` placeholders in the path #[derive(Serialize)] -struct UserPathParams { +pub struct UserPathParams { id: u32, } #[derive(Serialize)] -struct PostPathParams { +pub struct PostPathParams { post_id: u32, } // Query parameters - will be serialized as query string #[derive(Serialize)] -struct SearchQueryParams { +pub struct SearchQueryParams { q: String, limit: Option, offset: Option, } // Define an API client with path and query parameters -api_client!( +beckon!( ApiClient, { { @@ -69,7 +69,7 @@ api_client!( #[derive(Deserialize, Debug)] #[allow(dead_code)] -struct Post { +pub struct Post { id: u32, title: String, content: String, diff --git a/src/lib.rs b/src/lib.rs index 367bb36..c7f9365 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,11 @@ -//! Generate HTTP client methods from endpoint definitions. +//! Generate type-safe, async HTTP clients from endpoint definitions. +//! +//! `beckon!` takes a client name and a list of endpoints and expands to a struct +//! with one async method per endpoint, a matching trait for mocking, and a typed +//! error enum. //! //! ```ignore -//! use http_provider_macro::api_client; +//! use beckon::beckon; //! use serde::{Deserialize, Serialize}; //! //! #[derive(Serialize, Deserialize)] @@ -10,7 +14,12 @@ //! name: String, //! } //! -//! api_client!( +//! #[derive(Serialize)] +//! struct UserPath { +//! id: u32, +//! } +//! +//! beckon!( //! UserApi, //! { //! { @@ -27,15 +36,9 @@ //! } //! ); //! -//! #[derive(Serialize)] -//! struct UserPath { -//! id: u32, -//! } -//! -//! // Usage -//! let client = UserApi::new(reqwest::Url::parse("https://api.example.com")?, Some(30)); -//! let users = client.get_users().await?; -//! let user = client.get_users_by_id(&UserPath { id: 1 }).await?; +//! // let client = UserApi::new(reqwest::Url::parse("https://api.example.com")?, Some(30)); +//! // let users = client.get_users().await?; +//! // let user = client.get_users_by_id(&UserPath { id: 1 }).await?; //! ``` extern crate proc_macro; @@ -56,12 +59,11 @@ fn expand_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream { } } +/// Generate a type-safe, async HTTP client from endpoint definitions. +/// +/// See the [crate-level docs](crate) for the full endpoint grammar and features +/// (auth, retries, path/query params, headers, custom method names). #[proc_macro] -pub fn api_client(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - expand_macro(input) -} - -#[proc_macro] -pub fn http_provider(input: proc_macro::TokenStream) -> proc_macro::TokenStream { +pub fn beckon(input: proc_macro::TokenStream) -> proc_macro::TokenStream { expand_macro(input) } diff --git a/tests/provider_tests.rs b/tests/provider_tests.rs index 939aed3..6ce4f35 100644 --- a/tests/provider_tests.rs +++ b/tests/provider_tests.rs @@ -1,13 +1,13 @@ #[cfg(test)] mod tests { - use http_provider_macro::{api_client, http_provider}; + use beckon::beckon; use reqwest::{header::HeaderMap, Url}; use serde::{Deserialize, Serialize}; use std::str::FromStr; use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate}; // Define the client with various endpoint configurations - api_client!( + beckon!( HttpProvider, { { @@ -48,22 +48,22 @@ mod tests { // Test data structures #[derive(Serialize, Deserialize, Debug, PartialEq)] - struct MyResponse { + pub struct MyResponse { value: String, } #[derive(Serialize, Deserialize)] - struct MyRequest { + pub struct MyRequest { data: String, } #[derive(Serialize, Deserialize)] - struct PathParams { + pub struct PathParams { id: String, } #[derive(Serialize, Deserialize)] - struct QueryParams { + pub struct QueryParams { q: String, } @@ -74,35 +74,6 @@ mod tests { } // Basic functionality tests - #[tokio::test] - async fn test_http_provider_macro_alias() -> Result<(), Box> { - http_provider!( - AliasProvider, - { - { - path: "/alias", - method: GET, - res: MyResponse, - }, - } - ); - - let mock_server = MockServer::start().await; - let response = create_success_response("alias-ok"); - - Mock::given(method("GET")) - .and(wiremock::matchers::path("/alias")) - .respond_with(ResponseTemplate::new(200).set_body_json(response)) - .mount(&mock_server) - .await; - - let provider = AliasProvider::new(Url::from_str(&mock_server.uri())?, Some(5000)); - let result = provider.get_alias().await?; - - assert_eq!(result.value, "alias-ok"); - Ok(()) - } - #[tokio::test] async fn test_get_with_path() -> Result<(), Box> { let mock_server = MockServer::start().await; @@ -232,7 +203,7 @@ mod tests { #[tokio::test] async fn test_trait_mock_provider() -> Result<(), Box> { // Simple client for trait testing - api_client!( + beckon!( SimpleProvider, { { @@ -249,7 +220,7 @@ mod tests { } ); - struct MockProvider; + pub struct MockProvider; impl SimpleProviderTrait for MockProvider { async fn get_items(&self) -> Result { @@ -281,7 +252,7 @@ mod tests { #[tokio::test] async fn test_patch_with_body() -> Result<(), Box> { - api_client!( + beckon!( PatchProvider, { { @@ -346,12 +317,12 @@ mod tests { #[tokio::test] async fn test_multiple_path_params() -> Result<(), Box> { #[derive(Serialize, Deserialize)] - struct MultiPathParams { + pub struct MultiPathParams { user_id: String, post_id: String, } - api_client!( + beckon!( MultiParamProvider, { { @@ -389,7 +360,7 @@ mod tests { #[tokio::test] async fn test_retry_on_5xx_succeeds_after_transient_failure( ) -> Result<(), Box> { - api_client!( + beckon!( RetryProvider, retries: 3, { @@ -428,7 +399,7 @@ mod tests { #[tokio::test] async fn test_no_retry_on_4xx() -> Result<(), Box> { - api_client!( + beckon!( Retry4xxProvider, retries: 3, { @@ -458,7 +429,7 @@ mod tests { #[tokio::test] async fn test_retry_endpoint_override() -> Result<(), Box> { - api_client!( + beckon!( RetryOverrideProvider, retries: 3, { @@ -510,7 +481,7 @@ mod tests { #[tokio::test] async fn test_optional_response() -> Result<(), Box> { // Client with optional response (no res field) - api_client!( + beckon!( NoResponseProvider, { { @@ -560,7 +531,7 @@ mod tests { #[tokio::test] async fn test_bearer_auth() -> Result<(), Box> { - api_client!( + beckon!( BearerApi, auth: Bearer, { @@ -594,7 +565,7 @@ mod tests { #[tokio::test] async fn test_basic_auth() -> Result<(), Box> { - api_client!( + beckon!( BasicApi, auth: Basic, { @@ -630,7 +601,7 @@ mod tests { #[tokio::test] async fn test_api_key_auth() -> Result<(), Box> { - api_client!( + beckon!( ApiKeyApi, auth: ApiKey("X-Api-Key"), { @@ -665,7 +636,7 @@ mod tests { #[tokio::test] async fn test_auth_with_retries() -> Result<(), Box> { - api_client!( + beckon!( AuthRetryApi, auth: Bearer, retries: 2,