diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..2e4fdd83 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +## 0.7.0-rc.1 + +This update refactors all of the clients and changes the way responses are handled. Previously methods that make calls to a third party service would return an `anyhow::Result` over some structured interpretation of the response body (i.e. a deserialized struct, a unit type, or a raw string). Methods now return a `Result, ClientError>` where a `Response` contains the body type that was previously returned along with the status code and headers that were sent from the third party service. When requesting unfolded paginated results the status code and headers returned will be the values returned from the final request made to the service. `ClientError` now provides a more structure error type than the previous `anyhow` error. + +### Fixes +* Fix missing default deserialization on `HashMap`s with fully qualified types. + +### Breaking Changes + +* Methods now return `Result, ClientError>` instead of `anyhow::Result`. The body can be accessed via `response.body`. +* Structured errors are now returned instead of `anyhow::Error`. +* Redirects are no longer followed by default. Previously if a 3xx response code was returned by a service, the inner client would follow it. This prevented services from returning meaningful 3xx responses. Methods that receive 3xx responses will now return them immediately and not attempt to follow them. +* Updates to 0.2 `reqwest-middleware` ecosystem. +* OpenTelemetry is no longer a default feature. To enable OpenTelemetry tracing add `reqwest-tracing` with the appropriate version feature enabled to the target project. \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 7c0d0148..c60c0770 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,9 +38,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.44" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" dependencies = [ "backtrace", ] @@ -74,7 +74,7 @@ checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -85,7 +85,7 @@ checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -210,16 +210,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" -[[package]] -name = "crossbeam-channel" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.14" @@ -301,11 +291,11 @@ dependencies = [ [[package]] name = "docusign" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -339,11 +329,11 @@ dependencies = [ [[package]] name = "dolladollabills" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -542,7 +532,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -637,8 +627,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.10.2+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -649,11 +641,11 @@ checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" [[package]] name = "giphy-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -687,11 +679,10 @@ dependencies = [ [[package]] name = "google-calendar" -version = "0.5.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -727,11 +718,10 @@ dependencies = [ [[package]] name = "google-cloud-resource-manager" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -767,11 +757,10 @@ dependencies = [ [[package]] name = "google-drive" -version = "0.6.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -807,11 +796,10 @@ dependencies = [ [[package]] name = "google-groups-settings" -version = "0.5.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -847,11 +835,10 @@ dependencies = [ [[package]] name = "gsuite-api" -version = "0.6.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -887,11 +874,11 @@ dependencies = [ [[package]] name = "gusto-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -1099,6 +1086,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -1210,11 +1200,11 @@ dependencies = [ [[package]] name = "mailchimp-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -1252,6 +1242,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "matchit" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" + [[package]] name = "memchr" version = "2.4.1" @@ -1422,10 +1418,12 @@ dependencies = [ [[package]] name = "octorust" -version = "0.3.2" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", - "base64 0.13.0", + "async-trait", + "base64 0.21.0", + "bytes", "chrono", "dirs", "http", @@ -1452,16 +1450,17 @@ dependencies = [ "thiserror", "tokio", "url", + "uuid", "wiremock", ] [[package]] name = "okta" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -1495,9 +1494,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" [[package]] name = "openapiv3" @@ -1512,9 +1511,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.48" +version = "0.10.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" +checksum = "12df40a956736488b7b44fe79fe12d4f245bb5b3f5a1f6095e499760015be392" dependencies = [ "bitflags", "cfg-if", @@ -1533,7 +1532,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1544,42 +1543,33 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.83" +version = "0.9.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" +checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", "vcpkg", ] -[[package]] -name = "opentelemetry" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project", - "rand 0.8.5", - "thiserror", -] - [[package]] name = "parking" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1587,20 +1577,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.7", ] [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", + "instant", "libc", "redox_syscall", "smallvec", - "windows-sys 0.36.1", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.45.0", ] [[package]] @@ -1638,31 +1642,11 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" -[[package]] -name = "pin-project" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -1718,29 +1702,29 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] [[package]] name = "ramp-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -1924,9 +1908,9 @@ dependencies = [ [[package]] name = "reqwest-conditional-middleware" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bce134f515eb4c2748bbd928086e7b0aae0d1568daf6c63b51e829aa6f2cf464" +checksum = "59e50a2e70970896c99d1b8f20ddc30a70b30d3ac6e619a03a8353b64a49b277" dependencies = [ "async-trait", "reqwest", @@ -1936,13 +1920,12 @@ dependencies = [ [[package]] name = "reqwest-middleware" -version = "0.1.6" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69539cea4148dce683bec9dc95be3f0397a9bb2c248a49c8296a9d21659a8cdd" +checksum = "4531c89d50effe1fac90d095c8b133c20c5c714204feee0bfc3fd158e784209d" dependencies = [ "anyhow", "async-trait", - "futures", "http", "reqwest", "serde", @@ -1952,38 +1935,41 @@ dependencies = [ [[package]] name = "reqwest-retry" -version = "0.1.4" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5cb0170c4fa3f251c036ef482b35abc550afac6305cf875541c4b78dd76c6c" +checksum = "48d0fd6ef4c6d23790399fe15efc8d12cd9f3d4133958f9bd7801ee5cbaec6c4" dependencies = [ "anyhow", "async-trait", "chrono", "futures", + "getrandom 0.2.3", "http", "hyper", + "parking_lot 0.11.2", "reqwest", "reqwest-middleware", "retry-policies", "task-local-extensions", "tokio", "tracing", + "wasm-timer", ] [[package]] name = "reqwest-tracing" -version = "0.3.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e131e50dcd8f24b88ff964404b96ff38ad4217e3ca6963256856952fe76dc8ec" +checksum = "783e8130d2427ddd7897dd3f814d4a3aea31b05deb42a4fdf8c18258fe5aefd1" dependencies = [ + "anyhow", "async-trait", - "opentelemetry", + "getrandom 0.2.3", + "matchit", "reqwest", "reqwest-middleware", "task-local-extensions", - "tokio", "tracing", - "tracing-opentelemetry", ] [[package]] @@ -2005,11 +1991,11 @@ dependencies = [ [[package]] name = "revai" -version = "0.5.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -2170,7 +2156,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn", + "syn 1.0.99", ] [[package]] @@ -2220,11 +2206,11 @@ dependencies = [ [[package]] name = "sendgrid-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -2273,7 +2259,7 @@ checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -2284,7 +2270,7 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -2334,22 +2320,12 @@ dependencies = [ "unsafe-libyaml", ] -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - [[package]] name = "sheets" -version = "0.6.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", "base64 0.21.0", "bytes", "chrono", @@ -2385,11 +2361,11 @@ dependencies = [ [[package]] name = "shipbob" -version = "0.3.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -2423,11 +2399,11 @@ dependencies = [ [[package]] name = "shopify" -version = "0.3.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -2461,9 +2437,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] @@ -2498,11 +2474,11 @@ checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "slack-chat-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -2583,13 +2559,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "task-local-extensions" -version = "0.1.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36794203e10c86e5998179e260869d156e0674f02d5451b4a3fb9fd86d02aaab" +checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" dependencies = [ - "tokio", + "pin-utils", ] [[package]] @@ -2622,16 +2609,7 @@ checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", + "syn 1.0.99", ] [[package]] @@ -2680,7 +2658,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", @@ -2696,7 +2674,7 @@ checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -2742,9 +2720,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.28" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -2754,66 +2732,31 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.19" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.18", ] [[package]] name = "tracing-core" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46125608c26121c81b0c6d693eab5a420e416da7e43c426d2e8f7df8da8a3acf" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tracing-log" -version = "0.1.2" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-opentelemetry" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f9378e96a9361190ae297e7f3a8ff644aacd2897f244b1ff81f381669196fa6" -dependencies = [ - "opentelemetry", - "tracing", - "tracing-core", - "tracing-log", - "tracing-subscriber", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22" -dependencies = [ - "sharded-slab", - "thread_local", - "tracing-core", + "once_cell", ] [[package]] name = "tripactions" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", @@ -3001,7 +2944,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 1.0.99", "wasm-bindgen-shared", ] @@ -3035,7 +2978,7 @@ checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3046,6 +2989,21 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.55" @@ -3287,11 +3245,11 @@ checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" [[package]] name = "zoom-api" -version = "0.4.0" +version = "0.7.0-rc.1" dependencies = [ "async-recursion", "async-trait", - "base64 0.13.0", + "base64 0.21.0", "bytes", "chrono", "dirs", diff --git a/Makefile b/Makefile index 991fbf63..f2fcb2ab 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ SHELL := bash +VERSION = 0.7.0-rc.1 + DOCUSIGN_SPEC_DIR = $(CURDIR)/specs/docusign DOCUSIGN_SPEC = $(DOCUSIGN_SPEC_DIR)/docusign.yaml DOCUSIGN_SPEC_REPO = docusign/OpenAPI-Specifications @@ -160,7 +162,7 @@ $(DOCUSIGN_SPEC): $(DOCUSIGN_SPEC_DIR) # curl -sSL $(DOCUSIGN_SPEC_REMOTE) -o $@ docusign: target/debug/generator $(DOCUSIGN_SPEC) - ./target/debug/generator -i $(DOCUSIGN_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(DOCUSIGN_SPEC) -v $(VERSION) \ -o docusign \ -n docusign \ --proper-name DocuSign \ @@ -179,7 +181,7 @@ $(GIPHY_SPEC): $(GIPHY_SPEC_DIR) curl -sSL $(GIPHY_SPEC_REMOTE) -o $@ giphy: target/debug/generator $(GIPHY_SPEC) - ./target/debug/generator -i $(GIPHY_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(GIPHY_SPEC) -v $(VERSION) \ -o giphy \ -n giphy-api \ --proper-name "Giphy" \ @@ -196,7 +198,7 @@ $(GITHUB_SPEC): $(GITHUB_SPEC_DIR) curl -sSL $(GITHUB_SPEC_REMOTE) -o $@ github: target/debug/generator $(GITHUB_SPEC) - ./target/debug/generator -i $(GITHUB_SPEC) -v 0.3.2 \ + ./target/debug/generator -i $(GITHUB_SPEC) -v $(VERSION) \ -o github \ -n octorust \ --proper-name GitHub \ @@ -218,7 +220,7 @@ $(GOOGLE_ADMIN_SPEC): $(GOOGLE_ADMIN_SPEC_DIR) curl -sSL $(GOOGLE_ADMIN_SPEC_REMOTE) -o $@ google-admin: target/debug/generator $(GOOGLE_ADMIN_SPEC) - ./target/debug/generator -i $(GOOGLE_ADMIN_SPEC) -v 0.6.0 \ + ./target/debug/generator -i $(GOOGLE_ADMIN_SPEC) -v $(VERSION) \ -o google/admin \ -n gsuite-api \ --proper-name "Google Admin" \ @@ -237,7 +239,7 @@ $(GOOGLE_CALENDAR_SPEC): $(GOOGLE_CALENDAR_SPEC_DIR) curl -sSL $(GOOGLE_CALENDAR_SPEC_REMOTE) -o $@ google-calendar: target/debug/generator $(GOOGLE_CALENDAR_SPEC) - ./target/debug/generator -i $(GOOGLE_CALENDAR_SPEC) -v 0.5.0 \ + ./target/debug/generator -i $(GOOGLE_CALENDAR_SPEC) -v $(VERSION) \ -o google/calendar \ -n google-calendar \ --proper-name "Google Calendar" \ @@ -256,7 +258,7 @@ $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC): $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC_DIR) curl -sSL $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC_REMOTE) -o $@ google-cloud-resource-manager: target/debug/generator $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC) - ./target/debug/generator -i $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(GOOGLE_CLOUD_RESOURCE_MANAGER_SPEC) -v $(VERSION) \ -o google/cloud-resource-manager \ -n google-cloud-resource-manager \ --proper-name "Google Cloud Resource Manager" \ @@ -275,7 +277,7 @@ $(GOOGLE_DRIVE_SPEC): $(GOOGLE_DRIVE_SPEC_DIR) curl -sSL $(GOOGLE_DRIVE_SPEC_REMOTE) -o $@ google-drive: target/debug/generator $(GOOGLE_DRIVE_SPEC) - ./target/debug/generator -i $(GOOGLE_DRIVE_SPEC) -v 0.6.0 \ + ./target/debug/generator -i $(GOOGLE_DRIVE_SPEC) -v $(VERSION) \ -o google/drive \ -n google-drive \ --proper-name "Google Drive" \ @@ -294,7 +296,7 @@ $(GOOGLE_GROUPS_SETTINGS_SPEC): $(GOOGLE_GROUPS_SETTINGS_SPEC_DIR) curl -sSL $(GOOGLE_GROUPS_SETTINGS_SPEC_REMOTE) -o $@ google-groups-settings: target/debug/generator $(GOOGLE_GROUPS_SETTINGS_SPEC) - ./target/debug/generator -i $(GOOGLE_GROUPS_SETTINGS_SPEC) -v 0.5.0 \ + ./target/debug/generator -i $(GOOGLE_GROUPS_SETTINGS_SPEC) -v $(VERSION) \ -o google/groups-settings \ -n google-groups-settings \ --proper-name "Google Groups Settings" \ @@ -313,7 +315,7 @@ $(GOOGLE_SHEETS_SPEC): $(GOOGLE_SHEETS_SPEC_DIR) curl -sSL $(GOOGLE_SHEETS_SPEC_REMOTE) -o $@ google-sheets: target/debug/generator $(GOOGLE_SHEETS_SPEC) - ./target/debug/generator -i $(GOOGLE_SHEETS_SPEC) -v 0.6.0 \ + ./target/debug/generator -i $(GOOGLE_SHEETS_SPEC) -v $(VERSION) \ -o google/sheets \ -n sheets \ --proper-name "Google Sheets" \ @@ -332,7 +334,7 @@ $(GUSTO_SPEC): $(GUSTO_SPEC_DIR) curl -sSL $(GUSTO_SPEC_REMOTE) -o $@ gusto: target/debug/generator $(GUSTO_SPEC) - ./target/debug/generator -i $(GUSTO_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(GUSTO_SPEC) -v $(VERSION) \ -o gusto \ -n gusto-api \ --proper-name Gusto \ @@ -354,7 +356,7 @@ $(MAILCHIMP_SPEC): $(MAILCHIMP_SPEC_DIR) $(MAILCHIMP_SPEC_REMOTE) mailchimp: target/debug/generator $(MAILCHIMP_SPEC) - ./target/debug/generator -i $(MAILCHIMP_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(MAILCHIMP_SPEC) -v $(VERSION) \ -o mailchimp \ -n mailchimp-api \ --proper-name MailChimp \ @@ -376,7 +378,7 @@ $(OKTA_SPEC): $(OKTA_SPEC_DIR) $(OKTA_SPEC_REMOTE) okta: target/debug/generator $(OKTA_SPEC) - ./target/debug/generator -i $(OKTA_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(OKTA_SPEC) -v $(VERSION) \ -o okta \ -n okta \ --proper-name Okta \ @@ -398,7 +400,7 @@ $(RAMP_SPEC): -o $@ $? ramp: target/debug/generator $(RAMP_SPEC) - ./target/debug/generator -i $(RAMP_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(RAMP_SPEC) -v $(VERSION) \ -o ramp \ -n ramp-api \ --proper-name Ramp \ @@ -417,7 +419,7 @@ $(REVAI_SPEC): $(REVAI_SPEC_DIR) curl -sSL $(REVAI_SPEC_REMOTE) -o $@ revai: target/debug/generator $(REVAI_SPEC) - ./target/debug/generator -i $(REVAI_SPEC) -v 0.5.0 \ + ./target/debug/generator -i $(REVAI_SPEC) -v $(VERSION) \ -o rev.ai \ -n revai \ --proper-name "Rev.ai" \ @@ -437,7 +439,7 @@ $(SENDGRID_SPEC): $(SENDGRID_SPEC_DIR) $(SENDGRID_SPEC_REMOTE) sendgrid: target/debug/generator $(SENDGRID_SPEC) - ./target/debug/generator -i $(SENDGRID_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(SENDGRID_SPEC) -v $(VERSION) \ -o sendgrid \ -n sendgrid-api \ --proper-name SendGrid \ @@ -458,7 +460,7 @@ $(SHIPBOB_SPEC): $(SHIPBOB_SPEC_DIR) .PHONY: shipbob shipbob: target/debug/generator $(SHIPBOB_SPEC) - ./target/debug/generator -i $(SHIPBOB_SPEC) -v 0.3.0 \ + ./target/debug/generator -i $(SHIPBOB_SPEC) -v $(VERSION) \ -o shipbob \ -n shipbob \ --proper-name "ShipBob" \ @@ -475,7 +477,7 @@ $(SHOPIFY_SPEC): $(SHOPIFY_SPEC_DIR) curl -sSL $(SHOPIFY_SPEC_REMOTE) -o $@ shopify: target/debug/generator $(SHOPIFY_SPEC) - ./target/debug/generator -i $(SHOPIFY_SPEC) -v 0.3.0 \ + ./target/debug/generator -i $(SHOPIFY_SPEC) -v $(VERSION) \ -o shopify \ -n shopify \ --proper-name "Shopify" \ @@ -497,7 +499,7 @@ $(SLACK_SPEC): $(SLACK_SPEC_DIR) $(SLACK_SPEC_REMOTE) slack: target/debug/generator $(SLACK_SPEC) - ./target/debug/generator -i $(SLACK_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(SLACK_SPEC) -v $(VERSION) \ -o slack \ -n slack-chat-api \ --proper-name Slack \ @@ -519,7 +521,7 @@ $(STRIPE_SPEC): $(STRIPE_SPEC_DIR) $(STRIPE_SPEC_REMOTE) stripe: target/debug/generator $(STRIPE_SPEC) - ./target/debug/generator -i $(STRIPE_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(STRIPE_SPEC) -v $(VERSION) \ -o stripe \ -n dolladollabills \ --proper-name Stripe \ @@ -536,7 +538,7 @@ $(TRIPACTIONS_SPEC): $(TRIPACTIONS_SPEC_DIR) curl -sSL $(TRIPACTIONS_SPEC_REMOTE) -o $@ tripactions: target/debug/generator $(TRIPACTIONS_SPEC) - ./target/debug/generator -i $(TRIPACTIONS_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(TRIPACTIONS_SPEC) -v $(VERSION) \ -o tripactions \ -n tripactions \ --proper-name "TripActions" \ @@ -557,7 +559,7 @@ $(ZOOM_SPEC): $(ZOOM_SPEC_DIR) $(ZOOM_SPEC_REMOTE) zoom: target/debug/generator $(ZOOM_SPEC) - ./target/debug/generator -i $(ZOOM_SPEC) -v 0.4.0 \ + ./target/debug/generator -i $(ZOOM_SPEC) -v $(VERSION) \ -o zoom \ -n zoom-api \ --proper-name Zoom \ diff --git a/docusign/Cargo.toml b/docusign/Cargo.toml index 720a7f44..7e91a728 100644 --- a/docusign/Cargo.toml +++ b/docusign/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "docusign" description = "A fully generated & opinionated API client for the DocuSign API." -version = "0.4.0" +version = "0.7.0-rc.1" documentation = "https://docs.rs/docusign/" repository = "https://github.com/oxidecomputer/third-party-api-clients/tree/main/docusign" readme = "README.md" @@ -9,7 +9,7 @@ edition = "2021" license = "MIT" [features] -default = ["rustls-tls", "reqwest-tracing/opentelemetry_0_17"] +default = ["rustls-tls"] # enable etag-based http_cache functionality httpcache = ["dirs"] native-tls = ["reqwest/default-tls", "openssl"] @@ -28,10 +28,10 @@ parse_link_header = "0.3.3" pem = { version = "1.1.0", default-features = false, optional = true } percent-encoding = "2.2" reqwest = { version = "0.11.14", default-features = false, features = ["json", "multipart"] } -reqwest-conditional-middleware = "0.1.0" -reqwest-middleware = "0.1.5" -reqwest-retry = "0.1.4" -reqwest-tracing = "0.3.0" +reqwest-conditional-middleware = "0.2.1" +reqwest-middleware = "0.2.2" +reqwest-retry = "0.2.2" +reqwest-tracing = "0.4.4" ring = { version = "0.16", default-features = false, optional = true } schemars = { version = "0.8", features = ["bytes", "chrono", "url", "uuid1"] } serde = { version = "1", features = ["derive"] } @@ -42,15 +42,15 @@ bytes = { version = "1", features = ["serde"] } async-trait = "^0.1.51" uuid = { version = "1.1", features = ["serde", "v4"] } thiserror = "1" -tokio = { version = "1.25.0", features = ["full"] } +tokio = { version = "1.25.0", default-features = false } [dev-dependencies] -base64 = "^0.13" +base64 = "^0.21" dirs = "^3.0.2" nom_pem = "4" rand = "0.8.5" rsa = "0.8.1" -tokio = { version = "1.25.0", features = ["test-util"] } +tokio = { version = "1.25.0", features = ["full", "test-util"] } wiremock = "0.5.17" [package.metadata.docs.rs] diff --git a/docusign/README.md b/docusign/README.md index 251a1657..affa7c26 100644 --- a/docusign/README.md +++ b/docusign/README.md @@ -31,7 +31,7 @@ To install the library, add the following to your `Cargo.toml` file. ```toml [dependencies] -docusign = "0.4.0" +docusign = "0.7.0-rc.1" ``` ## Basic example @@ -39,7 +39,7 @@ docusign = "0.4.0" Typical use will require intializing a `Client`. This requires a user agent string and set of credentials. -``` +```rust use docusign::Client; let docusign = Client::new( @@ -60,7 +60,7 @@ the client in the environment: And then you can create a client from the environment. -``` +```rust use docusign::Client; let docusign = Client::new_from_env( @@ -74,7 +74,7 @@ the initial state of the client, you will not know these values. To start off a fresh client and get a `token` and `refresh_token`, use the following. -``` +```rust use docusign::Client; async fn do_call() { diff --git a/docusign/src/account_brands.rs b/docusign/src/account_brands.rs index 8d132a38..92b15c58 100644 --- a/docusign/src/account_brands.rs +++ b/docusign/src/account_brands.rs @@ -31,7 +31,7 @@ impl AccountBrands { account_id: &str, exclude_distributor_brand: &str, include_logos: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !exclude_distributor_brand.is_empty() { query_args.push(( @@ -82,7 +82,7 @@ impl AccountBrands { &self, account_id: &str, body: &crate::types::Brand, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands", @@ -117,7 +117,7 @@ impl AccountBrands { &self, account_id: &str, body: &crate::types::BrandsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands", @@ -157,7 +157,7 @@ impl AccountBrands { brand_id: &str, include_external_references: &str, include_logos: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_external_references.is_empty() { query_args.push(( @@ -207,7 +207,7 @@ impl AccountBrands { account_id: &str, brand_id: &str, body: &crate::types::Brand, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}", @@ -240,7 +240,11 @@ impl AccountBrands { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `brand_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn brand_delete(&self, account_id: &str, brand_id: &str) -> ClientResult<()> { + pub async fn brand_delete( + &self, + account_id: &str, + brand_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}", @@ -277,7 +281,7 @@ impl AccountBrands { &self, account_id: &str, brand_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/file", @@ -316,7 +320,7 @@ impl AccountBrands { account_id: &str, brand_id: &str, logo_type: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/logos/{}", @@ -361,7 +365,7 @@ impl AccountBrands { brand_id: &str, logo_type: &str, body: bytes::Bytes, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/logos/{}", @@ -401,7 +405,7 @@ impl AccountBrands { account_id: &str, brand_id: &str, logo_type: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/logos/{}", @@ -439,7 +443,7 @@ impl AccountBrands { &self, account_id: &str, brand_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/resources", @@ -491,7 +495,7 @@ impl AccountBrands { resource_content_type: &str, langcode: &str, return_master: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !langcode.is_empty() { query_args.push(("langcode".to_string(), langcode.to_string())); @@ -553,7 +557,7 @@ impl AccountBrands { account_id: &str, brand_id: &str, resource_content_type: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/brands/{}/resources/{}", diff --git a/docusign/src/account_consumer_disclosures.rs b/docusign/src/account_consumer_disclosures.rs index be021742..98024816 100644 --- a/docusign/src/account_consumer_disclosures.rs +++ b/docusign/src/account_consumer_disclosures.rs @@ -77,7 +77,7 @@ impl AccountConsumerDisclosures { &self, account_id: &str, lang_code: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !lang_code.is_empty() { query_args.push(("langCode".to_string(), lang_code.to_string())); @@ -167,7 +167,7 @@ impl AccountConsumerDisclosures { &self, account_id: &str, lang_code: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/consumer_disclosure/{}", @@ -300,7 +300,7 @@ impl AccountConsumerDisclosures { lang_code: &str, include_metadata: &str, body: &crate::types::ConsumerDisclosure, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_metadata.is_empty() { query_args.push(("include_metadata".to_string(), include_metadata.to_string())); diff --git a/docusign/src/account_custom_fields.rs b/docusign/src/account_custom_fields.rs index 746aded2..54c58381 100644 --- a/docusign/src/account_custom_fields.rs +++ b/docusign/src/account_custom_fields.rs @@ -22,7 +22,10 @@ impl AccountCustomFields { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn get(&self, account_id: &str) -> ClientResult { + pub async fn get( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/custom_fields", @@ -57,7 +60,7 @@ impl AccountCustomFields { account_id: &str, apply_to_templates: &str, body: &crate::types::CustomField, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !apply_to_templates.is_empty() { query_args.push(( @@ -103,7 +106,7 @@ impl AccountCustomFields { custom_field_id: &str, apply_to_templates: &str, body: &crate::types::CustomField, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !apply_to_templates.is_empty() { query_args.push(( @@ -149,7 +152,7 @@ impl AccountCustomFields { account_id: &str, custom_field_id: &str, apply_to_templates: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !apply_to_templates.is_empty() { query_args.push(( diff --git a/docusign/src/account_password_rules.rs b/docusign/src/account_password_rules.rs index 52e57db3..bb84fccd 100644 --- a/docusign/src/account_password_rules.rs +++ b/docusign/src/account_password_rules.rs @@ -25,7 +25,7 @@ impl AccountPasswordRules { pub async fn get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/password_rules", @@ -60,7 +60,7 @@ impl AccountPasswordRules { &self, account_id: &str, body: &crate::types::AccountPasswordRulesData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/password_rules", @@ -85,7 +85,9 @@ impl AccountPasswordRules { * * */ - pub async fn password_rules_get(&self) -> ClientResult { + pub async fn password_rules_get( + &self, + ) -> ClientResult> { let url = self.client.url("/v2.1/current_user/password_rules", None); self.client .get( diff --git a/docusign/src/account_permission_profiles.rs b/docusign/src/account_permission_profiles.rs index b064b469..57374455 100644 --- a/docusign/src/account_permission_profiles.rs +++ b/docusign/src/account_permission_profiles.rs @@ -35,7 +35,7 @@ impl AccountPermissionProfiles { &self, account_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -76,7 +76,7 @@ impl AccountPermissionProfiles { account_id: &str, include: &str, body: &crate::types::PermissionProfile, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -124,7 +124,7 @@ impl AccountPermissionProfiles { account_id: &str, permission_profile_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -174,7 +174,7 @@ impl AccountPermissionProfiles { permission_profile_id: &str, include: &str, body: &crate::types::PermissionProfile, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -225,7 +225,7 @@ impl AccountPermissionProfiles { account_id: &str, permission_profile_id: &str, move_users_to: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !move_users_to.is_empty() { query_args.push(("move_users_to".to_string(), move_users_to.to_string())); diff --git a/docusign/src/account_seal_providers.rs b/docusign/src/account_seal_providers.rs index a644e146..09e5908e 100644 --- a/docusign/src/account_seal_providers.rs +++ b/docusign/src/account_seal_providers.rs @@ -25,7 +25,7 @@ impl AccountSealProviders { pub async fn account_signature_providers_get_seal( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/seals", diff --git a/docusign/src/account_signature_providers.rs b/docusign/src/account_signature_providers.rs index c890218d..cbf20f8b 100644 --- a/docusign/src/account_signature_providers.rs +++ b/docusign/src/account_signature_providers.rs @@ -25,7 +25,7 @@ impl AccountSignatureProviders { pub async fn get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signatureProviders", diff --git a/docusign/src/account_signatures.rs b/docusign/src/account_signatures.rs index a785e051..d37ed95d 100644 --- a/docusign/src/account_signatures.rs +++ b/docusign/src/account_signatures.rs @@ -31,7 +31,7 @@ impl AccountSignatures { stamp_format: &str, stamp_name: &str, stamp_type: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !stamp_format.is_empty() { query_args.push(("stamp_format".to_string(), stamp_format.to_string())); @@ -62,22 +62,22 @@ impl AccountSignatures { .await } /** - * Updates an account signature. + * Updates an account signature. . - * - * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/signatures` endpoint. - * - * - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - */ + * + * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/signatures` endpoint. + * + * + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + */ pub async fn put_signature( &self, account_id: &str, body: &crate::types::AccountSignaturesInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signatures", @@ -96,24 +96,24 @@ impl AccountSignatures { .await } /** - * Adds or updates one or more account signatures. + * Adds or updates one or more account signatures. This request may include images in multi-part format. - * - * This function performs a `POST` to the `/v2.1/accounts/{accountId}/signatures` endpoint. - * - * - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - * * `decode_only: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - */ + * + * This function performs a `POST` to the `/v2.1/accounts/{accountId}/signatures` endpoint. + * + * + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + * * `decode_only: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + */ pub async fn post( &self, account_id: &str, decode_only: &str, body: &crate::types::AccountSignaturesInformation, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !decode_only.is_empty() { query_args.push(("decode_only".to_string(), decode_only.to_string())); @@ -153,7 +153,7 @@ impl AccountSignatures { &self, account_id: &str, signature_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signatures/{}", @@ -191,7 +191,7 @@ impl AccountSignatures { signature_id: &str, close_existing_signature: &str, body: &crate::types::AccountSignatureDefinition, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !close_existing_signature.is_empty() { query_args.push(( @@ -231,7 +231,11 @@ impl AccountSignatures { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `signature_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete_signature(&self, account_id: &str, signature_id: &str) -> ClientResult<()> { + pub async fn delete_signature( + &self, + account_id: &str, + signature_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signatures/{}", @@ -273,7 +277,7 @@ impl AccountSignatures { image_type: &str, signature_id: &str, include_chrome: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_chrome.is_empty() { query_args.push(("include_chrome".to_string(), include_chrome.to_string())); @@ -322,7 +326,7 @@ impl AccountSignatures { image_type: &str, signature_id: &str, transparent_png: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !transparent_png.is_empty() { query_args.push(("transparent_png".to_string(), transparent_png.to_string())); @@ -369,7 +373,7 @@ impl AccountSignatures { account_id: &str, image_type: &str, signature_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signatures/{}/{}", diff --git a/docusign/src/account_tab_settings.rs b/docusign/src/account_tab_settings.rs index 590acc42..387d26b1 100644 --- a/docusign/src/account_tab_settings.rs +++ b/docusign/src/account_tab_settings.rs @@ -25,7 +25,7 @@ impl AccountTabSettings { pub async fn tab_settings_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/tabs", @@ -58,7 +58,7 @@ impl AccountTabSettings { &self, account_id: &str, body: &crate::types::TabAccountSettings, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/tabs", diff --git a/docusign/src/account_watermarks.rs b/docusign/src/account_watermarks.rs index 48b9b80b..9174a910 100644 --- a/docusign/src/account_watermarks.rs +++ b/docusign/src/account_watermarks.rs @@ -22,7 +22,10 @@ impl AccountWatermarks { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn watermark_get(&self, account_id: &str) -> ClientResult { + pub async fn watermark_get( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/watermark", @@ -55,7 +58,7 @@ impl AccountWatermarks { &self, account_id: &str, body: &crate::types::Watermark, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/watermark", @@ -88,7 +91,7 @@ impl AccountWatermarks { &self, account_id: &str, body: &crate::types::Watermark, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/watermark/preview", diff --git a/docusign/src/accounts.rs b/docusign/src/accounts.rs index 571884f9..07e6284e 100644 --- a/docusign/src/accounts.rs +++ b/docusign/src/accounts.rs @@ -145,7 +145,7 @@ impl Accounts { pub async fn post( &self, body: &crate::types::NewAccountDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url("/v2.1/accounts", None); self.client .post( @@ -164,7 +164,9 @@ impl Accounts { * * Retrieves the account provisioning information for the account. */ - pub async fn get_provisioning(&self) -> ClientResult { + pub async fn get_provisioning( + &self, + ) -> ClientResult> { let url = self.client.url("/v2.1/accounts/provisioning", None); self.client .get( @@ -196,7 +198,7 @@ impl Accounts { &self, account_id: &str, include_account_settings: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_account_settings.is_empty() { query_args.push(( @@ -234,7 +236,7 @@ impl Accounts { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete(&self, account_id: &str) -> ClientResult<()> { + pub async fn delete(&self, account_id: &str) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}", @@ -275,7 +277,7 @@ impl Accounts { &self, account_id: &str, include_charges: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_charges.is_empty() { query_args.push(("include_charges".to_string(), include_charges.to_string())); @@ -316,7 +318,7 @@ impl Accounts { account_id: &str, recipient_part: &str, body: &crate::types::CaptiveRecipientInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/captive_recipients/{}", @@ -351,7 +353,7 @@ impl Accounts { &self, account_id: &str, email: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !email.is_empty() { query_args.push(("email".to_string(), email.to_string())); @@ -389,7 +391,7 @@ impl Accounts { pub async fn settings_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings", @@ -422,7 +424,7 @@ impl Accounts { &self, account_id: &str, body: &crate::types::AccountSettingsInformation, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings", @@ -456,7 +458,7 @@ impl Accounts { pub async fn envelope_purge_configuration_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/envelope_purge_configuration", @@ -493,7 +495,7 @@ impl Accounts { &self, account_id: &str, body: &crate::types::EnvelopePurgeConfiguration, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/envelope_purge_configuration", @@ -525,7 +527,7 @@ impl Accounts { pub async fn notification_defaults_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/notification_defaults", @@ -558,7 +560,7 @@ impl Accounts { &self, account_id: &str, body: &crate::types::NotificationDefaultsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/notification_defaults", @@ -628,7 +630,7 @@ impl Accounts { shared: &str, start_position: &str, user_ids: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -713,7 +715,7 @@ impl Accounts { preserve_existing_shared_access: &str, user_ids: &str, body: &crate::types::AccountSharedAccess, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !item_type.is_empty() { query_args.push(("item_type".to_string(), item_type.to_string())); @@ -766,7 +768,7 @@ impl Accounts { pub async fn supported_languages_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/supported_languages", @@ -798,7 +800,7 @@ impl Accounts { pub async fn unsupported_file_types_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/unsupported_file_types", @@ -832,7 +834,7 @@ impl Accounts { &self, organization_id: &str, result_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/organization_exports/{}/account_settings/{}", diff --git a/docusign/src/appliance_info.rs b/docusign/src/appliance_info.rs index ed716a8c..d174f751 100644 --- a/docusign/src/appliance_info.rs +++ b/docusign/src/appliance_info.rs @@ -25,7 +25,7 @@ impl ApplianceInfo { pub async fn envelope_get_dynamic_system_setting( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/display_appliance_info/dynamicsystemsettings", @@ -57,7 +57,7 @@ impl ApplianceInfo { pub async fn envelope_get_template( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/display_appliance_info/templateInfo", @@ -91,7 +91,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info", @@ -126,7 +126,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/account_info", @@ -161,7 +161,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/custom_fields", @@ -196,7 +196,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/custom_fields/delete", @@ -231,7 +231,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/date_signed", @@ -268,7 +268,7 @@ impl ApplianceInfo { account_id: &str, document_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/document/{}", @@ -306,7 +306,7 @@ impl ApplianceInfo { account_id: &str, document_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/document/{}", @@ -342,7 +342,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/document_page_list", @@ -377,7 +377,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/image", @@ -415,7 +415,7 @@ impl ApplianceInfo { account_id: &str, envelope_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/localepolicy/{}", @@ -447,7 +447,11 @@ impl ApplianceInfo { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn envelope_put_page(&self, account_id: &str, envelope_id: &str) -> ClientResult<()> { + pub async fn envelope_put_page( + &self, + account_id: &str, + envelope_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/page_info", @@ -482,7 +486,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/page_info", @@ -517,7 +521,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/page_info/delete", @@ -552,7 +556,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/pdf", @@ -591,7 +595,7 @@ impl ApplianceInfo { account_id: &str, envelope_id: &str, pdf_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/pdf/{}", @@ -627,7 +631,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/pdf_blobs", @@ -662,7 +666,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/pdf_blobs", @@ -697,7 +701,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/pdf_blobs", @@ -732,7 +736,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/recipient_denied_copy", @@ -767,7 +771,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/recipient_denied_copy", @@ -802,7 +806,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/signer_attachment_info", @@ -837,7 +841,7 @@ impl ApplianceInfo { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/display_appliance_info/signer_attachment_info", @@ -863,7 +867,7 @@ impl ApplianceInfo { * * */ - pub async fn envelope_post_error(&self) -> ClientResult<()> { + pub async fn envelope_post_error(&self) -> ClientResult> { let url = self.client.url("/v2.1/display_appliance_info/error", None); self.client .post( @@ -882,7 +886,9 @@ impl ApplianceInfo { * * */ - pub async fn envelope_post_redeem(&self) -> ClientResult { + pub async fn envelope_post_redeem( + &self, + ) -> ClientResult> { let url = self.client.url("/v2.1/display_appliance_info/redeem", None); self.client .post( diff --git a/docusign/src/bcc_email_archive.rs b/docusign/src/bcc_email_archive.rs index a9300fc9..57fa9a9b 100644 --- a/docusign/src/bcc_email_archive.rs +++ b/docusign/src/bcc_email_archive.rs @@ -29,7 +29,7 @@ impl BccEmailArchive { account_id: &str, count: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -76,7 +76,7 @@ impl BccEmailArchive { &self, account_id: &str, body: &crate::types::BccEmailArchiveData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/bcc_email_archives", @@ -114,7 +114,7 @@ impl BccEmailArchive { bcc_email_archive_id: &str, count: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -157,7 +157,11 @@ impl BccEmailArchive { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `bcc_email_archive_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete(&self, account_id: &str, bcc_email_archive_id: &str) -> ClientResult<()> { + pub async fn delete( + &self, + account_id: &str, + bcc_email_archive_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/bcc_email_archives/{}", diff --git a/docusign/src/billing_plans.rs b/docusign/src/billing_plans.rs index 7f14e299..3503192b 100644 --- a/docusign/src/billing_plans.rs +++ b/docusign/src/billing_plans.rs @@ -40,7 +40,7 @@ impl BillingPlans { include_credit_card_information: &str, include_metadata: &str, include_successor_plans: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_credit_card_information.is_empty() { query_args.push(( @@ -93,7 +93,7 @@ impl BillingPlans { account_id: &str, preview_billing_plan: &str, body: &crate::types::BillingPlanInformation, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !preview_billing_plan.is_empty() { query_args.push(( @@ -134,7 +134,7 @@ impl BillingPlans { pub async fn get_credit_card_info( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_plan/credit_card", @@ -166,7 +166,7 @@ impl BillingPlans { pub async fn get_downgrade_request_info( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_plan/downgrade", @@ -199,7 +199,7 @@ impl BillingPlans { &self, account_id: &str, body: &crate::types::DowngradeBillingPlanInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_plan/downgrade", @@ -232,7 +232,7 @@ impl BillingPlans { &self, account_id: &str, body: &crate::types::PurchasedEnvelopesInformation, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_plan/purchased_envelopes", @@ -257,7 +257,9 @@ impl BillingPlans { * * Retrieves a list of the billing plans associated with a distributor. */ - pub async fn get_billing_plans(&self) -> ClientResult { + pub async fn get_billing_plans( + &self, + ) -> ClientResult> { let url = self.client.url("/v2.1/billing_plans", None); self.client .get( @@ -283,7 +285,7 @@ impl BillingPlans { pub async fn get_plan( &self, billing_plan_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/billing_plans/{}", diff --git a/docusign/src/bulk_send.rs b/docusign/src/bulk_send.rs index 2ec45580..832ef71b 100644 --- a/docusign/src/bulk_send.rs +++ b/docusign/src/bulk_send.rs @@ -42,7 +42,7 @@ impl BulkSend { count: &str, start_position: &str, status: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !batch_ids.is_empty() { query_args.push(("batch_ids".to_string(), batch_ids.to_string())); @@ -97,7 +97,7 @@ impl BulkSend { &self, account_id: &str, bulk_send_batch_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_batch/{}", @@ -133,7 +133,7 @@ impl BulkSend { account_id: &str, bulk_send_batch_id: &str, body: &crate::types::BulkSendBatchRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_batch/{}", @@ -166,7 +166,7 @@ impl BulkSend { pub async fn v_2crud_get_list( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists", @@ -225,7 +225,7 @@ impl BulkSend { &self, account_id: &str, body: &crate::types::BulkSendingList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists", @@ -259,7 +259,7 @@ impl BulkSend { &self, account_id: &str, bulk_send_list_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists/{}", @@ -295,7 +295,7 @@ impl BulkSend { account_id: &str, bulk_send_list_id: &str, body: &crate::types::BulkSendingList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists/{}", @@ -330,7 +330,7 @@ impl BulkSend { &self, account_id: &str, bulk_send_list_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists/{}", @@ -403,7 +403,7 @@ impl BulkSend { account_id: &str, bulk_send_list_id: &str, body: &crate::types::BulkSendRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists/{}/send", @@ -476,7 +476,7 @@ impl BulkSend { account_id: &str, bulk_send_list_id: &str, body: &crate::types::BulkSendRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/bulk_send_lists/{}/test", diff --git a/docusign/src/chunked_uploads.rs b/docusign/src/chunked_uploads.rs index 4510089d..caf00141 100644 --- a/docusign/src/chunked_uploads.rs +++ b/docusign/src/chunked_uploads.rs @@ -26,7 +26,7 @@ impl ChunkedUploads { &self, account_id: &str, body: &crate::types::ChunkedUploadRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/chunked_uploads", @@ -64,7 +64,7 @@ impl ChunkedUploads { account_id: &str, chunked_upload_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -111,7 +111,7 @@ impl ChunkedUploads { account_id: &str, chunked_upload_id: &str, action: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !action.is_empty() { query_args.push(("action".to_string(), action.to_string())); @@ -160,7 +160,7 @@ impl ChunkedUploads { &self, account_id: &str, chunked_upload_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/chunked_uploads/{}", @@ -214,7 +214,7 @@ impl ChunkedUploads { chunked_upload_id: &str, chunked_upload_part_seq: &str, body: &crate::types::ChunkedUploadRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/chunked_uploads/{}/{}", diff --git a/docusign/src/cloud_storage.rs b/docusign/src/cloud_storage.rs index 411f50ae..e024e1b9 100644 --- a/docusign/src/cloud_storage.rs +++ b/docusign/src/cloud_storage.rs @@ -57,7 +57,7 @@ impl CloudStorage { order_by: &str, search_text: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !cloud_storage_folder_path.is_empty() { query_args.push(( @@ -153,7 +153,7 @@ impl CloudStorage { order_by: &str, search_text: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !cloud_storage_folder_path.is_empty() { query_args.push(( diff --git a/docusign/src/cloud_storage_providers.rs b/docusign/src/cloud_storage_providers.rs index 6a7c1895..afb7ea0a 100644 --- a/docusign/src/cloud_storage_providers.rs +++ b/docusign/src/cloud_storage_providers.rs @@ -34,7 +34,7 @@ impl CloudStorageProviders { account_id: &str, user_id: &str, redirect_url: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !redirect_url.is_empty() { query_args.push(("redirectUrl".to_string(), redirect_url.to_string())); @@ -77,7 +77,7 @@ impl CloudStorageProviders { account_id: &str, user_id: &str, body: &crate::types::CloudStorageProvidersData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/cloud_storage", @@ -114,7 +114,7 @@ impl CloudStorageProviders { account_id: &str, user_id: &str, body: &crate::types::CloudStorageProvidersData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/cloud_storage", @@ -159,7 +159,7 @@ impl CloudStorageProviders { service_id: &str, user_id: &str, redirect_url: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !redirect_url.is_empty() { query_args.push(("redirectUrl".to_string(), redirect_url.to_string())); @@ -206,7 +206,7 @@ impl CloudStorageProviders { account_id: &str, service_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/cloud_storage/{}", diff --git a/docusign/src/comments.rs b/docusign/src/comments.rs index eb94fb5f..9c6b53e3 100644 --- a/docusign/src/comments.rs +++ b/docusign/src/comments.rs @@ -31,7 +31,7 @@ impl Comments { account_id: &str, envelope_id: &str, encoding: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !encoding.is_empty() { query_args.push(("encoding".to_string(), encoding.to_string())); diff --git a/docusign/src/connect_configurations.rs b/docusign/src/connect_configurations.rs index 9facabb7..f4c20988 100644 --- a/docusign/src/connect_configurations.rs +++ b/docusign/src/connect_configurations.rs @@ -27,7 +27,7 @@ impl ConnectConfigurations { pub async fn connect_get_config( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect", @@ -62,7 +62,7 @@ impl ConnectConfigurations { &self, account_id: &str, body: &crate::types::ConnectCustomConfiguration, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect", @@ -98,7 +98,7 @@ impl ConnectConfigurations { &self, account_id: &str, body: &crate::types::ConnectCustomConfiguration, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect", @@ -135,7 +135,7 @@ impl ConnectConfigurations { &self, account_id: &str, connect_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/{}", @@ -175,7 +175,7 @@ impl ConnectConfigurations { &self, account_id: &str, connect_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/{}", @@ -233,7 +233,7 @@ impl ConnectConfigurations { start_position: &str, status: &str, user_name_substring: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); diff --git a/docusign/src/connect_events.rs b/docusign/src/connect_events.rs index feb2707e..c0054728 100644 --- a/docusign/src/connect_events.rs +++ b/docusign/src/connect_events.rs @@ -27,7 +27,7 @@ impl ConnectEvents { &self, account_id: &str, body: &crate::types::ConnectFailureFilter, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/envelopes/retry_queue", @@ -61,7 +61,7 @@ impl ConnectEvents { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/envelopes/{}/retry_queue", @@ -102,7 +102,7 @@ impl ConnectEvents { account_id: &str, from_date: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -145,7 +145,7 @@ impl ConnectEvents { &self, account_id: &str, failure_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/failures/{}", @@ -188,7 +188,7 @@ impl ConnectEvents { account_id: &str, from_date: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -226,7 +226,10 @@ impl ConnectEvents { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn connect_log_delete_logs(&self, account_id: &str) -> ClientResult<()> { + pub async fn connect_log_delete_logs( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/logs", @@ -264,7 +267,7 @@ impl ConnectEvents { account_id: &str, log_id: &str, additional_info: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !additional_info.is_empty() { query_args.push(("additional_info".to_string(), additional_info.to_string())); @@ -302,7 +305,11 @@ impl ConnectEvents { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `log_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn connect_log_delete(&self, account_id: &str, log_id: &str) -> ClientResult<()> { + pub async fn connect_log_delete( + &self, + account_id: &str, + log_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/logs/{}", diff --git a/docusign/src/connect_secret.rs b/docusign/src/connect_secret.rs index 2330f0ea..ac963a80 100644 --- a/docusign/src/connect_secret.rs +++ b/docusign/src/connect_secret.rs @@ -27,7 +27,7 @@ impl ConnectSecret { &self, account_id: &str, key_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/connect/secret/{}", diff --git a/docusign/src/contacts.rs b/docusign/src/contacts.rs index dd24366c..e287ca5a 100644 --- a/docusign/src/contacts.rs +++ b/docusign/src/contacts.rs @@ -26,7 +26,7 @@ impl Contacts { &self, account_id: &str, body: &crate::types::ContactModRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/contacts", @@ -61,7 +61,7 @@ impl Contacts { &self, account_id: &str, body: &crate::types::ContactModRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/contacts", @@ -94,7 +94,7 @@ impl Contacts { &self, account_id: &str, body: &crate::types::ContactModRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/contacts", @@ -144,7 +144,7 @@ impl Contacts { account_id: &str, contact_id: &str, cloud_provider: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !cloud_provider.is_empty() { query_args.push(("cloud_provider".to_string(), cloud_provider.to_string())); @@ -185,7 +185,7 @@ impl Contacts { &self, account_id: &str, contact_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/contacts/{}", diff --git a/docusign/src/custom_tabs.rs b/docusign/src/custom_tabs.rs index f21049e1..0bf90b76 100644 --- a/docusign/src/custom_tabs.rs +++ b/docusign/src/custom_tabs.rs @@ -27,7 +27,7 @@ impl CustomTabs { &self, account_id: &str, custom_tab_only: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !custom_tab_only.is_empty() { query_args.push(("custom_tab_only".to_string(), custom_tab_only.to_string())); @@ -68,7 +68,7 @@ impl CustomTabs { &self, account_id: &str, body: &crate::types::TabMetadata, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/tab_definitions", @@ -102,7 +102,7 @@ impl CustomTabs { &self, account_id: &str, custom_tab_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/tab_definitions/{}", @@ -122,25 +122,25 @@ impl CustomTabs { .await } /** - * Updates custom tab information. + * Updates custom tab information. . - * - * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/tab_definitions/{customTabId}` endpoint. - * - * Updates the information in a custom tab for the specified account. - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - * * `custom_tab_id: &str` -- The DocuSign-generated custom tab id for the custom tab to be applied. This can only be used when adding new tabs for a recipient. When used, the new tab inherits all the custom tab properties. - */ + * + * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/tab_definitions/{customTabId}` endpoint. + * + * Updates the information in a custom tab for the specified account. + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + * * `custom_tab_id: &str` -- The DocuSign-generated custom tab id for the custom tab to be applied. This can only be used when adding new tabs for a recipient. When used, the new tab inherits all the custom tab properties. + */ pub async fn tab_put_custom( &self, account_id: &str, custom_tab_id: &str, body: &crate::types::TabMetadata, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/tab_definitions/{}", @@ -175,7 +175,7 @@ impl CustomTabs { &self, account_id: &str, custom_tab_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/tab_definitions/{}", diff --git a/docusign/src/document_responsive_html_preview.rs b/docusign/src/document_responsive_html_preview.rs index b366c05d..78fe2b91 100644 --- a/docusign/src/document_responsive_html_preview.rs +++ b/docusign/src/document_responsive_html_preview.rs @@ -36,7 +36,7 @@ impl DocumentResponsiveHtmlPreview { document_id: &str, envelope_id: &str, body: &crate::types::DocumentHtmlDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/responsive_html_preview", diff --git a/docusign/src/e_note_configurations.rs b/docusign/src/e_note_configurations.rs index 98e4510f..17abe151 100644 --- a/docusign/src/e_note_configurations.rs +++ b/docusign/src/e_note_configurations.rs @@ -22,7 +22,10 @@ impl ENoteConfigurations { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn get(&self, account_id: &str) -> ClientResult { + pub async fn get( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/enote_configuration", @@ -55,7 +58,7 @@ impl ENoteConfigurations { &self, account_id: &str, body: &crate::types::ENoteConfiguration, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/enote_configuration", @@ -84,7 +87,7 @@ impl ENoteConfigurations { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete(&self, account_id: &str) -> ClientResult<()> { + pub async fn delete(&self, account_id: &str) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/settings/enote_configuration", diff --git a/docusign/src/envelope_attachments.rs b/docusign/src/envelope_attachments.rs index 6892f2e2..d25262cd 100644 --- a/docusign/src/envelope_attachments.rs +++ b/docusign/src/envelope_attachments.rs @@ -27,7 +27,7 @@ impl EnvelopeAttachments { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/attachments", @@ -63,7 +63,7 @@ impl EnvelopeAttachments { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeAttachmentsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/attachments", @@ -99,7 +99,7 @@ impl EnvelopeAttachments { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeAttachmentsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/attachments", @@ -136,7 +136,7 @@ impl EnvelopeAttachments { account_id: &str, attachment_id: &str, envelope_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/attachments/{}", @@ -175,7 +175,7 @@ impl EnvelopeAttachments { attachment_id: &str, envelope_id: &str, body: &crate::types::Attachment, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/attachments/{}", diff --git a/docusign/src/envelope_consumer_disclosures.rs b/docusign/src/envelope_consumer_disclosures.rs index e1554a77..5caa66ab 100644 --- a/docusign/src/envelope_consumer_disclosures.rs +++ b/docusign/src/envelope_consumer_disclosures.rs @@ -81,7 +81,7 @@ impl EnvelopeConsumerDisclosures { envelope_id: &str, recipient_id: &str, lang_code: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !lang_code.is_empty() { query_args.push(("langCode".to_string(), lang_code.to_string())); @@ -222,7 +222,7 @@ impl EnvelopeConsumerDisclosures { envelope_id: &str, lang_code: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/consumer_disclosure/{}", diff --git a/docusign/src/envelope_custom_fields.rs b/docusign/src/envelope_custom_fields.rs index 35456ce7..be857750 100644 --- a/docusign/src/envelope_custom_fields.rs +++ b/docusign/src/envelope_custom_fields.rs @@ -29,7 +29,7 @@ impl EnvelopeCustomFields { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/custom_fields", @@ -68,7 +68,7 @@ impl EnvelopeCustomFields { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeCustomFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/custom_fields", @@ -107,7 +107,7 @@ impl EnvelopeCustomFields { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeCustomFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/custom_fields", @@ -143,7 +143,7 @@ impl EnvelopeCustomFields { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeCustomFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/custom_fields", diff --git a/docusign/src/envelope_document_fields.rs b/docusign/src/envelope_document_fields.rs index e01e9ca9..a1a2142f 100644 --- a/docusign/src/envelope_document_fields.rs +++ b/docusign/src/envelope_document_fields.rs @@ -29,7 +29,7 @@ impl EnvelopeDocumentFields { account_id: &str, document_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/fields", @@ -68,7 +68,7 @@ impl EnvelopeDocumentFields { document_id: &str, envelope_id: &str, body: &crate::types::EnvelopeDocumentFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/fields", @@ -107,7 +107,7 @@ impl EnvelopeDocumentFields { document_id: &str, envelope_id: &str, body: &crate::types::EnvelopeDocumentFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/fields", @@ -146,7 +146,7 @@ impl EnvelopeDocumentFields { document_id: &str, envelope_id: &str, body: &crate::types::EnvelopeDocumentFields, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/fields", diff --git a/docusign/src/envelope_document_html_definitions.rs b/docusign/src/envelope_document_html_definitions.rs index 63f12b26..9e97295a 100644 --- a/docusign/src/envelope_document_html_definitions.rs +++ b/docusign/src/envelope_document_html_definitions.rs @@ -12,25 +12,25 @@ impl EnvelopeDocumentHtmlDefinitions { } /** - * Gets the Original HTML Definition used to + * Gets the Original HTML Definition used to generate the Responsive HTML for a given document. - * - * This function performs a `GET` to the `/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/html_definitions` endpoint. - * - * - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - * * `document_id: &str` -- The `documentId` is set by the API client. It is an integer that falls between `1` and 2,147,483,647. The value is encoded as a string without commas. The values `1`, `2`, `3`, and so on are typically used to identify the first few documents in an envelope. Tab definitions include a `documentId` property that specifies the document on which to place the tab. - * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - */ + * + * This function performs a `GET` to the `/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/html_definitions` endpoint. + * + * + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + * * `document_id: &str` -- The `documentId` is set by the API client. It is an integer that falls between `1` and 2,147,483,647. The value is encoded as a string without commas. The values `1`, `2`, `3`, and so on are typically used to identify the first few documents in an envelope. Tab definitions include a `documentId` property that specifies the document on which to place the tab. + * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + */ pub async fn responsive_html_get_envelope_document_definition( &self, account_id: &str, document_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/html_definitions", diff --git a/docusign/src/envelope_document_tabs.rs b/docusign/src/envelope_document_tabs.rs index 107df83f..8fd11cd7 100644 --- a/docusign/src/envelope_document_tabs.rs +++ b/docusign/src/envelope_document_tabs.rs @@ -31,7 +31,7 @@ impl EnvelopeDocumentTabs { document_id: &str, envelope_id: &str, page_number: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/pages/{}/tabs", @@ -78,7 +78,7 @@ impl EnvelopeDocumentTabs { envelope_id: &str, include_metadata: &str, page_numbers: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_metadata.is_empty() { query_args.push(("include_metadata".to_string(), include_metadata.to_string())); @@ -126,7 +126,7 @@ impl EnvelopeDocumentTabs { document_id: &str, envelope_id: &str, body: &crate::types::Tabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/tabs", @@ -165,7 +165,7 @@ impl EnvelopeDocumentTabs { document_id: &str, envelope_id: &str, body: &crate::types::Tabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/tabs", @@ -204,7 +204,7 @@ impl EnvelopeDocumentTabs { document_id: &str, envelope_id: &str, body: &crate::types::Tabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/tabs", diff --git a/docusign/src/envelope_document_visibility.rs b/docusign/src/envelope_document_visibility.rs index 05c638d6..0f0178f5 100644 --- a/docusign/src/envelope_document_visibility.rs +++ b/docusign/src/envelope_document_visibility.rs @@ -29,7 +29,7 @@ impl EnvelopeDocumentVisibility { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/document_visibility", @@ -70,7 +70,7 @@ impl EnvelopeDocumentVisibility { envelope_id: &str, recipient_id: &str, body: &crate::types::DocumentVisibilityList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/document_visibility", diff --git a/docusign/src/envelope_documents.rs b/docusign/src/envelope_documents.rs index 2b8cb52c..2ff3a0bd 100644 --- a/docusign/src/envelope_documents.rs +++ b/docusign/src/envelope_documents.rs @@ -39,7 +39,7 @@ impl EnvelopeDocuments { include_tabs: &str, recipient_id: &str, shared_user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !documents_by_userid.is_empty() { query_args.push(( @@ -111,7 +111,7 @@ impl EnvelopeDocuments { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents", @@ -170,7 +170,7 @@ impl EnvelopeDocuments { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents", @@ -229,7 +229,7 @@ impl EnvelopeDocuments { shared_user_id: &str, show_changes: &str, watermark: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !certificate.is_empty() { query_args.push(("certificate".to_string(), certificate.to_string())); @@ -316,7 +316,7 @@ impl EnvelopeDocuments { account_id: &str, document_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}", diff --git a/docusign/src/envelope_email_settings.rs b/docusign/src/envelope_email_settings.rs index 2ca517e1..73615e30 100644 --- a/docusign/src/envelope_email_settings.rs +++ b/docusign/src/envelope_email_settings.rs @@ -27,7 +27,7 @@ impl EnvelopeEmailSettings { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/email_settings", @@ -65,7 +65,7 @@ impl EnvelopeEmailSettings { account_id: &str, envelope_id: &str, body: &crate::types::EmailSettings, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/email_settings", @@ -103,7 +103,7 @@ impl EnvelopeEmailSettings { account_id: &str, envelope_id: &str, body: &crate::types::EmailSettings, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/email_settings", @@ -138,7 +138,7 @@ impl EnvelopeEmailSettings { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/email_settings", diff --git a/docusign/src/envelope_form_data.rs b/docusign/src/envelope_form_data.rs index a72d2537..e5d220fd 100644 --- a/docusign/src/envelope_form_data.rs +++ b/docusign/src/envelope_form_data.rs @@ -29,7 +29,7 @@ impl EnvelopeFormData { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/form_data", diff --git a/docusign/src/envelope_html_definitions.rs b/docusign/src/envelope_html_definitions.rs index 6d74f674..c3740ec2 100644 --- a/docusign/src/envelope_html_definitions.rs +++ b/docusign/src/envelope_html_definitions.rs @@ -27,7 +27,7 @@ impl EnvelopeHtmlDefinitions { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/html_definitions", diff --git a/docusign/src/envelope_locks.rs b/docusign/src/envelope_locks.rs index 48768108..e26484bf 100644 --- a/docusign/src/envelope_locks.rs +++ b/docusign/src/envelope_locks.rs @@ -39,7 +39,7 @@ impl EnvelopeLocks { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/lock", @@ -97,7 +97,7 @@ impl EnvelopeLocks { account_id: &str, envelope_id: &str, body: &crate::types::LockRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/lock", @@ -189,7 +189,7 @@ impl EnvelopeLocks { account_id: &str, envelope_id: &str, body: &crate::types::LockRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/lock", @@ -240,7 +240,7 @@ impl EnvelopeLocks { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/lock", diff --git a/docusign/src/envelope_recipient_tabs.rs b/docusign/src/envelope_recipient_tabs.rs index 05141cd7..b6376d0f 100644 --- a/docusign/src/envelope_recipient_tabs.rs +++ b/docusign/src/envelope_recipient_tabs.rs @@ -39,7 +39,7 @@ impl EnvelopeRecipientTabs { recipient_id: &str, include_anchor_tab_locations: &str, include_metadata: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_anchor_tab_locations.is_empty() { query_args.push(( @@ -72,28 +72,28 @@ impl EnvelopeRecipientTabs { .await } /** - * Updates the tabs for a recipient. + * Updates the tabs for a recipient. . - * - * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs` endpoint. - * - * Updates one or more tabs for a recipient in a draft envelope. - * **Note**: The Update method can be used if the envelope is not yet complete. To update an existing tab, the request body must include the `tabId`. - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - * * `recipient_id: &str` -- A local reference that senders use to map recipients to other objects, such as specific document tabs. Within an envelope, each `recipientId` must be unique, but there is no uniqueness requirement across envelopes. For example, many envelopes assign the first recipient a `recipientId` of `1`. - */ + * + * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs` endpoint. + * + * Updates one or more tabs for a recipient in a draft envelope. + * **Note**: The Update method can be used if the envelope is not yet complete. To update an existing tab, the request body must include the `tabId`. + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + * * `recipient_id: &str` -- A local reference that senders use to map recipients to other objects, such as specific document tabs. Within an envelope, each `recipientId` must be unique, but there is no uniqueness requirement across envelopes. For example, many envelopes assign the first recipient a `recipientId` of `1`. + */ pub async fn recipients_put_recipient_tabs( &self, account_id: &str, envelope_id: &str, recipient_id: &str, body: &crate::types::EnvelopeRecipientTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/tabs", @@ -132,7 +132,7 @@ impl EnvelopeRecipientTabs { envelope_id: &str, recipient_id: &str, body: &crate::types::EnvelopeRecipientTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/tabs", @@ -171,7 +171,7 @@ impl EnvelopeRecipientTabs { envelope_id: &str, recipient_id: &str, body: &crate::types::EnvelopeRecipientTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/tabs", diff --git a/docusign/src/envelope_recipients.rs b/docusign/src/envelope_recipients.rs index d7b58f36..5bafc4f3 100644 --- a/docusign/src/envelope_recipients.rs +++ b/docusign/src/envelope_recipients.rs @@ -37,7 +37,7 @@ impl EnvelopeRecipients { include_extended: &str, include_metadata: &str, include_tabs: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_anchor_tab_locations.is_empty() { query_args.push(( @@ -126,7 +126,7 @@ impl EnvelopeRecipients { offline_signing: &str, resend_envelope: &str, body: &crate::types::EnvelopeRecipients, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !combine_same_order_recipients.is_empty() { query_args.push(( @@ -181,7 +181,7 @@ impl EnvelopeRecipients { envelope_id: &str, resend_envelope: &str, body: &crate::types::EnvelopeRecipients, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !resend_envelope.is_empty() { query_args.push(("resend_envelope".to_string(), resend_envelope.to_string())); @@ -225,7 +225,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeRecipients, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients", @@ -263,7 +263,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, body: &crate::types::DocumentVisibilityList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/document_visibility", @@ -302,7 +302,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}", @@ -340,7 +340,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/identity_proof_token", @@ -391,7 +391,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/views/identity_manual_review", @@ -430,7 +430,7 @@ impl EnvelopeRecipients { account_id: &str, envelope_id: &str, body: &crate::types::RecipientPreviewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/recipient_preview", diff --git a/docusign/src/envelope_templates.rs b/docusign/src/envelope_templates.rs index 720c6579..42e07f46 100644 --- a/docusign/src/envelope_templates.rs +++ b/docusign/src/envelope_templates.rs @@ -36,7 +36,7 @@ impl EnvelopeTemplates { document_id: &str, envelope_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -83,7 +83,7 @@ impl EnvelopeTemplates { envelope_id: &str, preserve_template_recipient: &str, body: &crate::types::DocumentTemplateList, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !preserve_template_recipient.is_empty() { query_args.push(( @@ -132,7 +132,7 @@ impl EnvelopeTemplates { document_id: &str, envelope_id: &str, template_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/templates/{}", @@ -172,7 +172,7 @@ impl EnvelopeTemplates { account_id: &str, envelope_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -216,7 +216,7 @@ impl EnvelopeTemplates { envelope_id: &str, preserve_template_recipient: &str, body: &crate::types::DocumentTemplateList, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !preserve_template_recipient.is_empty() { query_args.push(( diff --git a/docusign/src/envelope_transfer_rules.rs b/docusign/src/envelope_transfer_rules.rs index bb9fe8aa..3f7d1c48 100644 --- a/docusign/src/envelope_transfer_rules.rs +++ b/docusign/src/envelope_transfer_rules.rs @@ -31,7 +31,7 @@ impl EnvelopeTransferRules { account_id: &str, count: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -75,7 +75,7 @@ impl EnvelopeTransferRules { &self, account_id: &str, body: &crate::types::EnvelopeTransferRuleInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/transfer_rules", @@ -119,7 +119,7 @@ impl EnvelopeTransferRules { &self, account_id: &str, body: &crate::types::EnvelopeTransferRuleRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/transfer_rules", @@ -158,7 +158,7 @@ impl EnvelopeTransferRules { account_id: &str, envelope_transfer_rule_id: &str, body: &crate::types::EnvelopeTransferRule, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/transfer_rules/{}", @@ -195,7 +195,7 @@ impl EnvelopeTransferRules { &self, account_id: &str, envelope_transfer_rule_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/transfer_rules/{}", diff --git a/docusign/src/envelope_views.rs b/docusign/src/envelope_views.rs index b0275614..855965c3 100644 --- a/docusign/src/envelope_views.rs +++ b/docusign/src/envelope_views.rs @@ -43,7 +43,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::CorrectViewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/correct", @@ -79,7 +79,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::CorrectViewRequest, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/correct", @@ -132,7 +132,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::ReturnUrlRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/edit", @@ -194,7 +194,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::RecipientViewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/recipient", @@ -258,7 +258,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::ReturnUrlRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/sender", @@ -299,7 +299,7 @@ impl EnvelopeViews { account_id: &str, envelope_id: &str, body: &crate::types::RecipientViewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/views/shared", @@ -338,7 +338,7 @@ impl EnvelopeViews { &self, account_id: &str, body: &crate::types::ConsoleViewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/views/console", diff --git a/docusign/src/envelope_workflow_definition.rs b/docusign/src/envelope_workflow_definition.rs index 323766d2..c410a8a3 100644 --- a/docusign/src/envelope_workflow_definition.rs +++ b/docusign/src/envelope_workflow_definition.rs @@ -27,7 +27,7 @@ impl EnvelopeWorkflowDefinition { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/workflow", @@ -63,7 +63,7 @@ impl EnvelopeWorkflowDefinition { account_id: &str, envelope_id: &str, body: &crate::types::Workflow, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/workflow", @@ -95,7 +95,11 @@ impl EnvelopeWorkflowDefinition { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete(&self, account_id: &str, envelope_id: &str) -> ClientResult<()> { + pub async fn delete( + &self, + account_id: &str, + envelope_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/workflow", @@ -130,7 +134,7 @@ impl EnvelopeWorkflowDefinition { &self, account_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/workflow", @@ -166,7 +170,7 @@ impl EnvelopeWorkflowDefinition { account_id: &str, template_id: &str, body: &crate::types::Workflow, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/workflow", @@ -197,7 +201,11 @@ impl EnvelopeWorkflowDefinition { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `template_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete_template(&self, account_id: &str, template_id: &str) -> ClientResult<()> { + pub async fn delete_template( + &self, + account_id: &str, + template_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/workflow", diff --git a/docusign/src/envelopes.rs b/docusign/src/envelopes.rs index 14a94751..a5e5c6ab 100644 --- a/docusign/src/envelopes.rs +++ b/docusign/src/envelopes.rs @@ -301,7 +301,7 @@ impl Envelopes { user_filter: &str, user_id: &str, user_name: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !ac_status.is_empty() { query_args.push(("ac_status".to_string(), ac_status.to_string())); @@ -521,7 +521,7 @@ impl Envelopes { completed_documents_only: &str, merge_roles_on_draft: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !cdse_mode.is_empty() { query_args.push(("cdse_mode".to_string(), cdse_mode.to_string())); @@ -692,7 +692,7 @@ impl Envelopes { transaction_ids: &str, user_name: &str, body: &crate::types::EnvelopeIdsRequest, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !ac_status.is_empty() { query_args.push(("ac_status".to_string(), ac_status.to_string())); @@ -782,7 +782,7 @@ impl Envelopes { envelope_id: &str, advanced_update: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !advanced_update.is_empty() { query_args.push(("advanced_update".to_string(), advanced_update.to_string())); @@ -995,7 +995,7 @@ impl Envelopes { advanced_update: &str, resend_envelope: &str, body: &crate::types::Envelope, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !advanced_update.is_empty() { query_args.push(("advanced_update".to_string(), advanced_update.to_string())); @@ -1039,7 +1039,7 @@ impl Envelopes { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/audit_events", @@ -1090,7 +1090,7 @@ impl Envelopes { nocache: &str, show_changes: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -1154,7 +1154,7 @@ impl Envelopes { document_id: &str, envelope_id: &str, page_number: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/pages/{}", @@ -1203,7 +1203,7 @@ impl Envelopes { max_height: &str, max_width: &str, show_changes: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !dpi.is_empty() { query_args.push(("dpi".to_string(), dpi.to_string())); @@ -1260,7 +1260,7 @@ impl Envelopes { envelope_id: &str, page_number: &str, body: &crate::types::PageRequest, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/documents/{}/pages/{}/page_image", @@ -1297,7 +1297,7 @@ impl Envelopes { &self, account_id: &str, envelope_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/notification", @@ -1335,7 +1335,7 @@ impl Envelopes { account_id: &str, envelope_id: &str, body: &crate::types::EnvelopeNotificationRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/notification", @@ -1382,7 +1382,7 @@ impl Envelopes { envelope_id: &str, recipient_id: &str, include_chrome: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_chrome.is_empty() { query_args.push(("include_chrome".to_string(), include_chrome.to_string())); @@ -1428,7 +1428,7 @@ impl Envelopes { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/initials_image", @@ -1466,7 +1466,7 @@ impl Envelopes { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/signature", @@ -1514,7 +1514,7 @@ impl Envelopes { envelope_id: &str, recipient_id: &str, include_chrome: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_chrome.is_empty() { query_args.push(("include_chrome".to_string(), include_chrome.to_string())); @@ -1560,7 +1560,7 @@ impl Envelopes { account_id: &str, envelope_id: &str, recipient_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/recipients/{}/signature_image", diff --git a/docusign/src/favorite_templates.rs b/docusign/src/favorite_templates.rs index 65f65c2b..fb4b15b6 100644 --- a/docusign/src/favorite_templates.rs +++ b/docusign/src/favorite_templates.rs @@ -22,7 +22,10 @@ impl FavoriteTemplates { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn get(&self, account_id: &str) -> ClientResult { + pub async fn get( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/favorite_templates", @@ -41,22 +44,22 @@ impl FavoriteTemplates { .await } /** - * Sets a template as a favorite. + * Sets a template as a favorite. . - * - * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/favorite_templates` endpoint. - * - * - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - */ + * + * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/favorite_templates` endpoint. + * + * + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + */ pub async fn put_template( &self, account_id: &str, body: &crate::types::FavoriteTemplatesInfo, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/favorite_templates", @@ -89,7 +92,7 @@ impl FavoriteTemplates { &self, account_id: &str, body: &crate::types::FavoriteTemplatesInfo, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/favorite_templates", diff --git a/docusign/src/folders.rs b/docusign/src/folders.rs index ecc65336..e4f3afba 100644 --- a/docusign/src/folders.rs +++ b/docusign/src/folders.rs @@ -46,7 +46,7 @@ impl Folders { start_position: &str, template: &str, user_filter: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -114,7 +114,7 @@ impl Folders { start_position: &str, status: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -182,7 +182,7 @@ impl Folders { account_id: &str, folder_id: &str, body: &crate::types::FoldersRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/folders/{}", @@ -239,7 +239,7 @@ impl Folders { order_by: &str, start_position: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !all.is_empty() { query_args.push(("all".to_string(), all.to_string())); diff --git a/docusign/src/group_brands.rs b/docusign/src/group_brands.rs index e287e0ca..6dcbd812 100644 --- a/docusign/src/group_brands.rs +++ b/docusign/src/group_brands.rs @@ -27,7 +27,7 @@ impl GroupBrands { &self, account_id: &str, group_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups/{}/brands", @@ -63,7 +63,7 @@ impl GroupBrands { account_id: &str, group_id: &str, body: &crate::types::BrandsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups/{}/brands", @@ -99,7 +99,7 @@ impl GroupBrands { account_id: &str, group_id: &str, body: &crate::types::BrandsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups/{}/brands", diff --git a/docusign/src/group_users.rs b/docusign/src/group_users.rs index e6e6516e..7b652bb8 100644 --- a/docusign/src/group_users.rs +++ b/docusign/src/group_users.rs @@ -31,7 +31,7 @@ impl GroupUsers { group_id: &str, count: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -76,7 +76,7 @@ impl GroupUsers { account_id: &str, group_id: &str, body: &crate::types::UserInfoList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups/{}/users", @@ -113,7 +113,7 @@ impl GroupUsers { account_id: &str, group_id: &str, body: &crate::types::UserInfoList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups/{}/users", diff --git a/docusign/src/groups.rs b/docusign/src/groups.rs index 7c584b1e..d5483fe2 100644 --- a/docusign/src/groups.rs +++ b/docusign/src/groups.rs @@ -35,7 +35,7 @@ impl Groups { include_usercount: &str, search_text: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -89,7 +89,7 @@ impl Groups { &self, account_id: &str, body: &crate::types::GroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups", @@ -124,7 +124,7 @@ impl Groups { &self, account_id: &str, body: &crate::types::GroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups", @@ -171,7 +171,7 @@ impl Groups { &self, account_id: &str, body: &crate::types::GroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/groups", diff --git a/docusign/src/identity_verifications.rs b/docusign/src/identity_verifications.rs index ac2d23aa..b6b81ba0 100644 --- a/docusign/src/identity_verifications.rs +++ b/docusign/src/identity_verifications.rs @@ -27,7 +27,7 @@ impl IdentityVerifications { pub async fn account_get( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/identity_verification", diff --git a/docusign/src/invoices.rs b/docusign/src/invoices.rs index 1fe35d13..efb097ce 100644 --- a/docusign/src/invoices.rs +++ b/docusign/src/invoices.rs @@ -31,7 +31,7 @@ impl Invoices { account_id: &str, from_date: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -107,7 +107,7 @@ impl Invoices { &self, account_id: &str, invoice_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_invoices/{}", @@ -142,7 +142,7 @@ impl Invoices { pub async fn billing_get_past_due( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_invoices_past_due", diff --git a/docusign/src/lib.rs b/docusign/src/lib.rs index 5f7915e1..cdac10bf 100644 --- a/docusign/src/lib.rs +++ b/docusign/src/lib.rs @@ -29,7 +29,7 @@ //! //! ```toml //! [dependencies] -//! docusign = "0.4.0" +//! docusign = "0.7.0-rc.1" //! ``` //! //! ## Basic example @@ -37,7 +37,7 @@ //! Typical use will require intializing a `Client`. This requires //! a user agent string and set of credentials. //! -//! ``` +//! ```rust //! use docusign::Client; //! //! let docusign = Client::new( @@ -58,7 +58,7 @@ //! //! And then you can create a client from the environment. //! -//! ``` +//! ```rust //! use docusign::Client; //! //! let docusign = Client::new_from_env( @@ -72,7 +72,7 @@ //! //! To start off a fresh client and get a `token` and `refresh_token`, use the following. //! -//! ``` +//! ```rust //! use docusign::Client; //! //! async fn do_call() { @@ -2181,9 +2181,29 @@ pub mod workspace_items; ///**Note**: Documents in a template are not individually listed as files. pub mod workspaces; -use thiserror::Error; +pub use reqwest::{header::HeaderMap, StatusCode}; + +#[derive(Debug)] +pub struct Response { + pub status: reqwest::StatusCode, + pub headers: reqwest::header::HeaderMap, + pub body: T, +} + +impl Response { + pub fn new(status: reqwest::StatusCode, headers: reqwest::header::HeaderMap, body: T) -> Self { + Self { + status, + headers, + body, + } + } +} + type ClientResult = Result; +use thiserror::Error; + /// Errors returned by the client #[derive(Debug, Error)] pub enum ClientError { @@ -2213,6 +2233,7 @@ pub enum ClientError { #[error("HTTP Error. Code: {status}, message: {error}")] HttpError { status: http::StatusCode, + headers: reqwest::header::HeaderMap, error: String, }, } @@ -2329,9 +2350,11 @@ struct InnerToken { } impl Client { - /// Create a new Client struct. It takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key your requests will work. + /// Create a new Client struct. Requires OAuth2 configuration values as well as an access and refresh token. + /// + /// # Panics + /// + /// This function will panic if the internal http client fails to create pub fn new( client_id: I, client_secret: K, @@ -2349,7 +2372,9 @@ impl Client { // Retry up to 3 times with increasing intervals between attempts. let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); - let client = reqwest::Client::builder().build(); + let client = reqwest::Client::builder() + .redirect(reqwest::redirect::Policy::none()) + .build(); match client { Ok(c) => { let client = reqwest_middleware::ClientBuilder::new(c) @@ -2473,12 +2498,16 @@ impl Client { ) } - /// Create a new Client struct from environment variables. It - /// takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key and your requests will work. - /// We pass in the token and refresh token to the client so if you are storing - /// it in a database, you can get it first. + /// Create a new Client struct from environment variables. Requires an existing access and refresh token. + /// + /// The following environment variables are expected to be set: + /// * `DOCUSIGN_CLIENT_ID` + /// * `DOCUSIGN_CLIENT_SECRET` + /// * `DOCUSIGN_REDIRECT_URI` + /// + /// # Panics + /// + /// This function will panic if the expected environment variables can not be found pub fn new_from_env(token: T, refresh_token: R) -> Self where T: ToString, @@ -2688,13 +2717,14 @@ impl Client { method: reqwest::Method, uri: &str, message: Message, - ) -> ClientResult + ) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, { let response = self.request_raw(method, uri, message).await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -2707,16 +2737,18 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) } else { let error = if response_body.is_empty() { ClientError::HttpError { status, + headers, error: "empty response".into(), } } else { ClientError::HttpError { status, + headers, error: String::from_utf8_lossy(&response_body).into(), } }; @@ -2730,13 +2762,14 @@ impl Client { method: http::Method, uri: &str, message: Message, - ) -> ClientResult<(Option, Out)> + ) -> ClientResult<(Option, crate::Response)> where Out: serde::de::DeserializeOwned + 'static + Send, { let response = self.request_raw(method, uri, message).await?; let status = response.status(); + let headers = response.headers().clone(); let link = response .headers() .get(http::header::LINK) @@ -2757,16 +2790,18 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok((link, parsed_response)) + Ok((link, crate::Response::new(status, headers, parsed_response))) } else { let error = if response_body.is_empty() { ClientError::HttpError { status, + headers, error: "empty response".into(), } } else { ClientError::HttpError { status, + headers, error: String::from_utf8_lossy(&response_body).into(), } }; @@ -2776,7 +2811,11 @@ impl Client { /* TODO: make this more DRY */ #[allow(dead_code)] - async fn post_form(&self, uri: &str, form: reqwest::multipart::Form) -> ClientResult + async fn post_form( + &self, + uri: &str, + form: reqwest::multipart::Form, + ) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, { @@ -2801,6 +2840,7 @@ impl Client { let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -2817,16 +2857,18 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) } else { let error = if response_body.is_empty() { ClientError::HttpError { status, + headers, error: "empty response".into(), } } else { ClientError::HttpError { status, + headers, error: String::from_utf8_lossy(&response_body).into(), } }; @@ -2842,7 +2884,7 @@ impl Client { method: reqwest::Method, uri: &str, accept_mime_type: &str, - ) -> ClientResult + ) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, { @@ -2865,6 +2907,7 @@ impl Client { let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -2881,16 +2924,18 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) } else { let error = if response_body.is_empty() { ClientError::HttpError { status, + headers, error: "empty response".into(), } } else { ClientError::HttpError { status, + headers, error: String::from_utf8_lossy(&response_body).into(), } }; @@ -2907,7 +2952,7 @@ impl Client { uri: &str, content: &[u8], mime_type: &str, - ) -> ClientResult + ) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, { @@ -2950,6 +2995,7 @@ impl Client { let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -2962,16 +3008,18 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) } else { let error = if response_body.is_empty() { ClientError::HttpError { status, + headers, error: "empty response".into(), } } else { ClientError::HttpError { status, + headers, error: String::from_utf8_lossy(&response_body).into(), } }; @@ -2985,7 +3033,7 @@ impl Client { method: http::Method, uri: &str, message: Message, - ) -> ClientResult + ) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -2994,7 +3042,7 @@ impl Client { } #[allow(dead_code)] - async fn get(&self, uri: &str, message: Message) -> ClientResult + async fn get(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3002,7 +3050,7 @@ impl Client { } #[allow(dead_code)] - async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult> + async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3012,32 +3060,36 @@ impl Client { /// "unfold" paginated results of a vector of items #[allow(dead_code)] - async fn unfold(&self, uri: &str) -> ClientResult> + async fn unfold(&self, uri: &str) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, { let mut global_items = Vec::new(); - let (new_link, mut items) = self.get_pages(uri).await?; + let (new_link, mut response) = self.get_pages(uri).await?; let mut link = new_link; - while !items.is_empty() { - global_items.append(&mut items); + while !response.body.is_empty() { + global_items.append(&mut response.body); // We need to get the next link. - if let Some(url) = link.as_ref() { + if let Some(url) = &link { let url = reqwest::Url::parse(&url.0)?; - let (new_link, new_items) = self.get_pages_url(&url).await?; + let (new_link, new_response) = self.get_pages_url(&url).await?; link = new_link; - items = new_items; + response = new_response; } } - Ok(global_items) + Ok(Response::new( + response.status, + response.headers, + global_items, + )) } #[allow(dead_code)] async fn get_pages( &self, uri: &str, - ) -> ClientResult<(Option, Vec)> + ) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3049,7 +3101,7 @@ impl Client { async fn get_pages_url( &self, url: &reqwest::Url, - ) -> ClientResult<(Option, Vec)> + ) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3058,7 +3110,7 @@ impl Client { } #[allow(dead_code)] - async fn post(&self, uri: &str, message: Message) -> ClientResult + async fn post(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3066,7 +3118,7 @@ impl Client { } #[allow(dead_code)] - async fn patch(&self, uri: &str, message: Message) -> ClientResult + async fn patch(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3074,7 +3126,7 @@ impl Client { } #[allow(dead_code)] - async fn put(&self, uri: &str, message: Message) -> ClientResult + async fn put(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -3082,7 +3134,7 @@ impl Client { } #[allow(dead_code)] - async fn delete(&self, uri: &str, message: Message) -> ClientResult + async fn delete(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { diff --git a/docusign/src/notary.rs b/docusign/src/notary.rs index bbcca516..965f745d 100644 --- a/docusign/src/notary.rs +++ b/docusign/src/notary.rs @@ -26,7 +26,7 @@ impl Notary { pub async fn get( &self, include_jurisdictions: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_jurisdictions.is_empty() { query_args.push(( @@ -58,7 +58,7 @@ impl Notary { pub async fn put( &self, body: &crate::types::NotaryData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url("/v2.1/current_user/notary", None); self.client .put( @@ -80,7 +80,7 @@ impl Notary { pub async fn post( &self, body: &crate::types::NotaryData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url("/v2.1/current_user/notary", None); self.client .post( diff --git a/docusign/src/notary_journals.rs b/docusign/src/notary_journals.rs index 39c7ff5d..093b52e0 100644 --- a/docusign/src/notary_journals.rs +++ b/docusign/src/notary_journals.rs @@ -29,7 +29,7 @@ impl NotaryJournals { count: &str, search_text: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); diff --git a/docusign/src/notary_jurisdiction.rs b/docusign/src/notary_jurisdiction.rs index e1f5e4b8..ec5aab95 100644 --- a/docusign/src/notary_jurisdiction.rs +++ b/docusign/src/notary_jurisdiction.rs @@ -19,7 +19,9 @@ impl NotaryJurisdiction { * Returns a list of jurisdictions that the notary is registered in. * The current user must be a notary. */ - pub async fn s_get(&self) -> ClientResult { + pub async fn s_get( + &self, + ) -> ClientResult> { let url = self .client .url("/v2.1/current_user/notary/jurisdictions", None); @@ -43,7 +45,7 @@ impl NotaryJurisdiction { pub async fn s_post( &self, body: &crate::types::NotaryJurisdictionData, - ) -> ClientResult { + ) -> ClientResult> { let url = self .client .url("/v2.1/current_user/notary/jurisdictions", None); @@ -103,7 +105,7 @@ impl NotaryJurisdiction { pub async fn s_get_jurisdiction( &self, jurisdiction_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/current_user/notary/jurisdictions/{}", @@ -222,7 +224,7 @@ impl NotaryJurisdiction { &self, jurisdiction_id: &str, body: &crate::types::NotaryJurisdictionData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/current_user/notary/jurisdictions/{}", @@ -279,7 +281,10 @@ impl NotaryJurisdiction { * - `62 - Florida Commissioner of Deeds` * . */ - pub async fn s_delete_jurisdiction(&self, jurisdiction_id: &str) -> ClientResult<()> { + pub async fn s_delete_jurisdiction( + &self, + jurisdiction_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/current_user/notary/jurisdictions/{}", diff --git a/docusign/src/payment_gateway_accounts.rs b/docusign/src/payment_gateway_accounts.rs index 5ffc5de8..d53c7160 100644 --- a/docusign/src/payment_gateway_accounts.rs +++ b/docusign/src/payment_gateway_accounts.rs @@ -25,7 +25,7 @@ impl PaymentGatewayAccounts { pub async fn get_all( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/payment_gateway_accounts", diff --git a/docusign/src/payments.rs b/docusign/src/payments.rs index 3195ae71..6e69d0f6 100644 --- a/docusign/src/payments.rs +++ b/docusign/src/payments.rs @@ -31,7 +31,7 @@ impl Payments { account_id: &str, from_date: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -80,7 +80,7 @@ impl Payments { &self, account_id: &str, body: &crate::types::BillingPaymentRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_payments", @@ -116,7 +116,7 @@ impl Payments { &self, account_id: &str, payment_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/billing_payments/{}", diff --git a/docusign/src/power_form_data.rs b/docusign/src/power_form_data.rs index 4bb5f240..3e9139a3 100644 --- a/docusign/src/power_form_data.rs +++ b/docusign/src/power_form_data.rs @@ -49,7 +49,7 @@ impl PowerFormData { data_layout: &str, from_date: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !data_layout.is_empty() { query_args.push(("data_layout".to_string(), data_layout.to_string())); diff --git a/docusign/src/power_forms.rs b/docusign/src/power_forms.rs index b56ac92e..7843e922 100644 --- a/docusign/src/power_forms.rs +++ b/docusign/src/power_forms.rs @@ -48,7 +48,7 @@ impl PowerForms { order: &str, order_by: &str, to_date: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !from_date.is_empty() { query_args.push(("from_date".to_string(), from_date.to_string())); @@ -135,7 +135,7 @@ impl PowerForms { &self, account_id: &str, body: &crate::types::PowerForm, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/powerforms", @@ -168,7 +168,7 @@ impl PowerForms { &self, account_id: &str, body: &crate::types::PowerFormsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/powerforms", @@ -202,7 +202,7 @@ impl PowerForms { &self, account_id: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !start_position.is_empty() { query_args.push(("start_position".to_string(), start_position.to_string())); @@ -242,7 +242,7 @@ impl PowerForms { &self, account_id: &str, power_form_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/powerforms/{}", @@ -278,7 +278,7 @@ impl PowerForms { account_id: &str, power_form_id: &str, body: &crate::types::PowerForm, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/powerforms/{}", @@ -309,7 +309,11 @@ impl PowerForms { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `power_form_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn delete_form(&self, account_id: &str, power_form_id: &str) -> ClientResult<()> { + pub async fn delete_form( + &self, + account_id: &str, + power_form_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/powerforms/{}", diff --git a/docusign/src/reports.rs b/docusign/src/reports.rs index 4697ce78..5bd35660 100644 --- a/docusign/src/reports.rs +++ b/docusign/src/reports.rs @@ -12,21 +12,21 @@ impl Reports { } /** - * Gets the descriptors for all of + * Gets the descriptors for all of an account's active reports (for listings). - * - * This function performs a `GET` to the `/v2.1/accounts/{accountId}/reports` endpoint. - * - * - * - * **Parameters:** - * - * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. - */ + * + * This function performs a `GET` to the `/v2.1/accounts/{accountId}/reports` endpoint. + * + * + * + * **Parameters:** + * + * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. + */ pub async fn product_get_list( &self, account_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports", @@ -59,7 +59,7 @@ impl Reports { &self, account_id: &str, body: &crate::types::ReportInProductRunRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports", @@ -92,7 +92,7 @@ impl Reports { &self, account_id: &str, body: &crate::types::ReportInProductRunRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports/report_results", @@ -125,7 +125,7 @@ impl Reports { &self, account_id: &str, body: &crate::types::ReportInProductCsvRunRequest, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports/report_results_csv", @@ -159,7 +159,7 @@ impl Reports { &self, account_id: &str, id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports/{}", @@ -195,7 +195,7 @@ impl Reports { account_id: &str, id: &str, body: &crate::types::ReportInProductRunRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports/{}", @@ -230,7 +230,7 @@ impl Reports { &self, account_id: &str, id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/reports/{}", diff --git a/docusign/src/request_logs.rs b/docusign/src/request_logs.rs index bea606b4..b3e31ab0 100644 --- a/docusign/src/request_logs.rs +++ b/docusign/src/request_logs.rs @@ -29,7 +29,7 @@ impl RequestLogs { pub async fn api_get_log( &self, encoding: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !encoding.is_empty() { query_args.push(("encoding".to_string(), encoding.to_string())); @@ -55,7 +55,7 @@ impl RequestLogs { * * Deletes the request log files. */ - pub async fn api_delete_logs(&self) -> ClientResult<()> { + pub async fn api_delete_logs(&self) -> ClientResult> { let url = self.client.url("/v2.1/diagnostics/request_logs", None); self.client .delete( @@ -84,7 +84,10 @@ impl RequestLogs { * * * `request_log_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn api_get(&self, request_log_id: &str) -> ClientResult { + pub async fn api_get( + &self, + request_log_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/diagnostics/request_logs/{}", @@ -114,7 +117,7 @@ impl RequestLogs { */ pub async fn api_get_setting( &self, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url("/v2.1/diagnostics/settings", None); self.client .get( @@ -147,7 +150,7 @@ impl RequestLogs { pub async fn api_put_settings( &self, body: &crate::types::DiagnosticsSettingsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url("/v2.1/diagnostics/settings", None); self.client .put( diff --git a/docusign/src/resources.rs b/docusign/src/resources.rs index 6e18ad97..b78662a9 100644 --- a/docusign/src/resources.rs +++ b/docusign/src/resources.rs @@ -26,7 +26,9 @@ impl Resources { * * Example: https://demo.docusign.net/restapi/help lists the REST API operations on the DocuSign Demo system with XML and JSON request and response samples. */ - pub async fn service_information_get(&self) -> ClientResult { + pub async fn service_information_get( + &self, + ) -> ClientResult> { let url = self.client.url("/v2.1", None); self.client .get( diff --git a/docusign/src/responsive_html_preview.rs b/docusign/src/responsive_html_preview.rs index def2e829..bfad0257 100644 --- a/docusign/src/responsive_html_preview.rs +++ b/docusign/src/responsive_html_preview.rs @@ -39,7 +39,7 @@ impl ResponsiveHtmlPreview { account_id: &str, envelope_id: &str, body: &crate::types::DocumentHtmlDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/responsive_html_preview", diff --git a/docusign/src/services.rs b/docusign/src/services.rs index 765e9f4b..fec2fb19 100644 --- a/docusign/src/services.rs +++ b/docusign/src/services.rs @@ -23,7 +23,9 @@ impl Services { * * You do not need an integrator key to view the REST API versions and resources. */ - pub async fn information_get(&self) -> ClientResult { + pub async fn information_get( + &self, + ) -> ClientResult> { let url = self.client.url("/service_information", None); self.client .get( diff --git a/docusign/src/signing_group_users.rs b/docusign/src/signing_group_users.rs index d95c61ef..1a7a34df 100644 --- a/docusign/src/signing_group_users.rs +++ b/docusign/src/signing_group_users.rs @@ -29,7 +29,7 @@ impl SigningGroupUsers { &self, account_id: &str, signing_group_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups/{}/users", @@ -67,7 +67,7 @@ impl SigningGroupUsers { account_id: &str, signing_group_id: &str, body: &crate::types::SigningGroupUsersData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups/{}/users", @@ -105,7 +105,7 @@ impl SigningGroupUsers { account_id: &str, signing_group_id: &str, body: &crate::types::SigningGroupUsersData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups/{}/users", diff --git a/docusign/src/signing_groups.rs b/docusign/src/signing_groups.rs index 95153721..a578ce25 100644 --- a/docusign/src/signing_groups.rs +++ b/docusign/src/signing_groups.rs @@ -29,7 +29,7 @@ impl SigningGroups { account_id: &str, group_type: &str, include_users: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !group_type.is_empty() { query_args.push(("group_type".to_string(), group_type.to_string())); @@ -71,7 +71,7 @@ impl SigningGroups { &self, account_id: &str, body: &crate::types::SigningGroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups", @@ -110,7 +110,7 @@ impl SigningGroups { &self, account_id: &str, body: &crate::types::SigningGroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups", @@ -143,7 +143,7 @@ impl SigningGroups { &self, account_id: &str, body: &crate::types::SigningGroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups", @@ -179,7 +179,7 @@ impl SigningGroups { &self, account_id: &str, signing_group_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups/{}", @@ -217,7 +217,7 @@ impl SigningGroups { account_id: &str, signing_group_id: &str, body: &crate::types::SigningGroup, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/signing_groups/{}", diff --git a/docusign/src/tabs_blob.rs b/docusign/src/tabs_blob.rs index 2c76bf73..5f45b026 100644 --- a/docusign/src/tabs_blob.rs +++ b/docusign/src/tabs_blob.rs @@ -23,7 +23,11 @@ impl TabsBlob { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn get(&self, account_id: &str, envelope_id: &str) -> ClientResult<()> { + pub async fn get( + &self, + account_id: &str, + envelope_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/tabs_blob", @@ -54,7 +58,11 @@ impl TabsBlob { * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. * * `envelope_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn put(&self, account_id: &str, envelope_id: &str) -> ClientResult<()> { + pub async fn put( + &self, + account_id: &str, + envelope_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/envelopes/{}/tabs_blob", diff --git a/docusign/src/template_bulk_recipients.rs b/docusign/src/template_bulk_recipients.rs index 4fb919a7..042426f1 100644 --- a/docusign/src/template_bulk_recipients.rs +++ b/docusign/src/template_bulk_recipients.rs @@ -33,7 +33,7 @@ impl TemplateBulkRecipients { template_id: &str, include_tabs: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_tabs.is_empty() { query_args.push(("include_tabs".to_string(), include_tabs.to_string())); @@ -83,7 +83,7 @@ impl TemplateBulkRecipients { recipient_id: &str, template_id: &str, body: &crate::types::BulkRecipientsRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/bulk_recipients", @@ -121,7 +121,7 @@ impl TemplateBulkRecipients { account_id: &str, recipient_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/bulk_recipients", diff --git a/docusign/src/template_custom_fields.rs b/docusign/src/template_custom_fields.rs index b6462007..b00cd498 100644 --- a/docusign/src/template_custom_fields.rs +++ b/docusign/src/template_custom_fields.rs @@ -27,7 +27,7 @@ impl TemplateCustomFields { &self, account_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/custom_fields", @@ -65,7 +65,7 @@ impl TemplateCustomFields { account_id: &str, template_id: &str, body: &crate::types::TemplateCustomFieldsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/custom_fields", @@ -101,7 +101,7 @@ impl TemplateCustomFields { account_id: &str, template_id: &str, body: &crate::types::TemplateCustomFieldsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/custom_fields", @@ -137,7 +137,7 @@ impl TemplateCustomFields { account_id: &str, template_id: &str, body: &crate::types::TemplateCustomFieldsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/custom_fields", diff --git a/docusign/src/template_document_fields.rs b/docusign/src/template_document_fields.rs index 39513ba4..3103b17a 100644 --- a/docusign/src/template_document_fields.rs +++ b/docusign/src/template_document_fields.rs @@ -29,7 +29,7 @@ impl TemplateDocumentFields { account_id: &str, document_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/fields", @@ -68,7 +68,7 @@ impl TemplateDocumentFields { document_id: &str, template_id: &str, body: &crate::types::DocumentFieldsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/fields", @@ -107,7 +107,7 @@ impl TemplateDocumentFields { document_id: &str, template_id: &str, body: &crate::types::DocumentFieldsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/fields", @@ -146,7 +146,7 @@ impl TemplateDocumentFields { document_id: &str, template_id: &str, body: &crate::types::DocumentFieldsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/fields", diff --git a/docusign/src/template_document_html_definitions.rs b/docusign/src/template_document_html_definitions.rs index c5ae8d0d..fd36ef7c 100644 --- a/docusign/src/template_document_html_definitions.rs +++ b/docusign/src/template_document_html_definitions.rs @@ -29,7 +29,7 @@ impl TemplateDocumentHtmlDefinitions { account_id: &str, document_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/html_definitions", diff --git a/docusign/src/template_document_responsive_html_preview.rs b/docusign/src/template_document_responsive_html_preview.rs index d56a971f..7d2bd411 100644 --- a/docusign/src/template_document_responsive_html_preview.rs +++ b/docusign/src/template_document_responsive_html_preview.rs @@ -40,7 +40,7 @@ impl TemplateDocumentResponsiveHtmlPreview { document_id: &str, template_id: &str, body: &crate::types::DocumentHtmlDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/responsive_html_preview", diff --git a/docusign/src/template_document_tabs.rs b/docusign/src/template_document_tabs.rs index 3cb0a371..dbf00acb 100644 --- a/docusign/src/template_document_tabs.rs +++ b/docusign/src/template_document_tabs.rs @@ -31,7 +31,7 @@ impl TemplateDocumentTabs { document_id: &str, page_number: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/pages/{}/tabs", @@ -74,7 +74,7 @@ impl TemplateDocumentTabs { document_id: &str, template_id: &str, page_numbers: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !page_numbers.is_empty() { query_args.push(("page_numbers".to_string(), page_numbers.to_string())); @@ -119,7 +119,7 @@ impl TemplateDocumentTabs { document_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/tabs", @@ -158,7 +158,7 @@ impl TemplateDocumentTabs { document_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/tabs", @@ -197,7 +197,7 @@ impl TemplateDocumentTabs { document_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/tabs", diff --git a/docusign/src/template_document_visibility.rs b/docusign/src/template_document_visibility.rs index dbcf1f6a..ae1427e5 100644 --- a/docusign/src/template_document_visibility.rs +++ b/docusign/src/template_document_visibility.rs @@ -31,7 +31,7 @@ impl TemplateDocumentVisibility { account_id: &str, template_id: &str, body: &crate::types::TemplateDocumentVisibilityList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/document_visibility", @@ -68,7 +68,7 @@ impl TemplateDocumentVisibility { account_id: &str, recipient_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/document_visibility", @@ -109,7 +109,7 @@ impl TemplateDocumentVisibility { recipient_id: &str, template_id: &str, body: &crate::types::TemplateDocumentVisibilityList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/document_visibility", diff --git a/docusign/src/template_documents.rs b/docusign/src/template_documents.rs index db34c67e..6e8a6c93 100644 --- a/docusign/src/template_documents.rs +++ b/docusign/src/template_documents.rs @@ -29,7 +29,7 @@ impl TemplateDocuments { account_id: &str, template_id: &str, include_tabs: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_tabs.is_empty() { query_args.push(("include_tabs".to_string(), include_tabs.to_string())); @@ -71,7 +71,7 @@ impl TemplateDocuments { account_id: &str, template_id: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents", @@ -121,7 +121,7 @@ impl TemplateDocuments { account_id: &str, template_id: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents", @@ -164,7 +164,7 @@ impl TemplateDocuments { template_id: &str, encrypt: &str, show_changes: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !encrypt.is_empty() { query_args.push(("encrypt".to_string(), encrypt.to_string())); @@ -214,7 +214,7 @@ impl TemplateDocuments { template_id: &str, is_envelope_definition: &str, body: &crate::types::EnvelopeDefinition, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !is_envelope_definition.is_empty() { query_args.push(( diff --git a/docusign/src/template_html_definitions.rs b/docusign/src/template_html_definitions.rs index 13e783f8..f9cbab9a 100644 --- a/docusign/src/template_html_definitions.rs +++ b/docusign/src/template_html_definitions.rs @@ -27,7 +27,7 @@ impl TemplateHtmlDefinitions { &self, account_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/html_definitions", diff --git a/docusign/src/template_locks.rs b/docusign/src/template_locks.rs index c77d7d73..e9abab2c 100644 --- a/docusign/src/template_locks.rs +++ b/docusign/src/template_locks.rs @@ -40,7 +40,7 @@ impl TemplateLocks { &self, account_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/lock", @@ -98,7 +98,7 @@ impl TemplateLocks { account_id: &str, template_id: &str, body: &crate::types::LockRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/lock", @@ -190,7 +190,7 @@ impl TemplateLocks { account_id: &str, template_id: &str, body: &crate::types::LockRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/lock", @@ -243,7 +243,7 @@ impl TemplateLocks { account_id: &str, template_id: &str, body: &crate::types::LockRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/lock", diff --git a/docusign/src/template_recipient_tabs.rs b/docusign/src/template_recipient_tabs.rs index d0205d29..e0129c55 100644 --- a/docusign/src/template_recipient_tabs.rs +++ b/docusign/src/template_recipient_tabs.rs @@ -33,7 +33,7 @@ impl TemplateRecipientTabs { template_id: &str, include_anchor_tab_locations: &str, include_metadata: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_anchor_tab_locations.is_empty() { query_args.push(( @@ -84,7 +84,7 @@ impl TemplateRecipientTabs { recipient_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/tabs", @@ -123,7 +123,7 @@ impl TemplateRecipientTabs { recipient_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/tabs", @@ -162,7 +162,7 @@ impl TemplateRecipientTabs { recipient_id: &str, template_id: &str, body: &crate::types::TemplateTabs, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}/tabs", diff --git a/docusign/src/template_recipients.rs b/docusign/src/template_recipients.rs index 6fa1ee77..0e03b162 100644 --- a/docusign/src/template_recipients.rs +++ b/docusign/src/template_recipients.rs @@ -33,7 +33,7 @@ impl TemplateRecipients { include_anchor_tab_locations: &str, include_extended: &str, include_tabs: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_anchor_tab_locations.is_empty() { query_args.push(( @@ -90,7 +90,7 @@ impl TemplateRecipients { template_id: &str, resend_envelope: &str, body: &crate::types::TemplateRecipientsData, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !resend_envelope.is_empty() { query_args.push(("resend_envelope".to_string(), resend_envelope.to_string())); @@ -136,7 +136,7 @@ impl TemplateRecipients { template_id: &str, resend_envelope: &str, body: &crate::types::TemplateRecipientsData, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !resend_envelope.is_empty() { query_args.push(("resend_envelope".to_string(), resend_envelope.to_string())); @@ -178,7 +178,7 @@ impl TemplateRecipients { account_id: &str, template_id: &str, body: &crate::types::TemplateRecipientsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients", @@ -216,7 +216,7 @@ impl TemplateRecipients { recipient_id: &str, template_id: &str, body: &crate::types::TemplateRecipientsData, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/recipients/{}", @@ -255,7 +255,7 @@ impl TemplateRecipients { account_id: &str, template_id: &str, body: &crate::types::RecipientPreviewRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/views/recipient_preview", diff --git a/docusign/src/template_responsive_html_preview.rs b/docusign/src/template_responsive_html_preview.rs index 89e430b7..f8b9c043 100644 --- a/docusign/src/template_responsive_html_preview.rs +++ b/docusign/src/template_responsive_html_preview.rs @@ -38,7 +38,7 @@ impl TemplateResponsiveHtmlPreview { account_id: &str, template_id: &str, body: &crate::types::DocumentHtmlDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/responsive_html_preview", diff --git a/docusign/src/template_views.rs b/docusign/src/template_views.rs index 45bfcb8e..94dc9c51 100644 --- a/docusign/src/template_views.rs +++ b/docusign/src/template_views.rs @@ -28,7 +28,7 @@ impl TemplateViews { account_id: &str, template_id: &str, body: &crate::types::ReturnUrlRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/views/edit", diff --git a/docusign/src/templates.rs b/docusign/src/templates.rs index 33363f68..c9c135b6 100644 --- a/docusign/src/templates.rs +++ b/docusign/src/templates.rs @@ -116,7 +116,7 @@ impl Templates { used_to_date: &str, user_filter: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -280,7 +280,7 @@ impl Templates { &self, account_id: &str, body: &crate::types::EnvelopeTemplate, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates", @@ -324,7 +324,7 @@ impl Templates { account_id: &str, template_id: &str, include: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include.is_empty() { query_args.push(("include".to_string(), include.to_string())); @@ -366,7 +366,7 @@ impl Templates { account_id: &str, template_id: &str, body: &crate::types::EnvelopeTemplate, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}", @@ -417,7 +417,7 @@ impl Templates { nocache: &str, show_changes: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -482,7 +482,7 @@ impl Templates { page_number: &str, template_id: &str, body: &crate::types::PageRequest, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/pages/{}", @@ -531,7 +531,7 @@ impl Templates { max_height: &str, max_width: &str, show_changes: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !dpi.is_empty() { query_args.push(("dpi".to_string(), dpi.to_string())); @@ -588,7 +588,7 @@ impl Templates { page_number: &str, template_id: &str, body: &crate::types::PageRequest, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/documents/{}/pages/{}/page_image", @@ -625,7 +625,7 @@ impl Templates { &self, account_id: &str, template_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/notification", @@ -661,7 +661,7 @@ impl Templates { account_id: &str, template_id: &str, body: &crate::types::TemplateNotificationRequest, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/notification", @@ -701,7 +701,7 @@ impl Templates { template_id: &str, template_part: &str, body: &crate::types::GroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/{}", @@ -740,7 +740,7 @@ impl Templates { template_id: &str, template_part: &str, body: &crate::types::GroupInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/templates/{}/{}", diff --git a/docusign/src/user_custom_settings.rs b/docusign/src/user_custom_settings.rs index f11fca6a..709b9a08 100644 --- a/docusign/src/user_custom_settings.rs +++ b/docusign/src/user_custom_settings.rs @@ -42,7 +42,7 @@ impl UserCustomSettings { &self, account_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/custom_settings", @@ -99,7 +99,7 @@ impl UserCustomSettings { account_id: &str, user_id: &str, body: &crate::types::CustomSettingsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/custom_settings", @@ -146,7 +146,7 @@ impl UserCustomSettings { account_id: &str, user_id: &str, body: &crate::types::CustomSettingsInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/custom_settings", diff --git a/docusign/src/user_profiles.rs b/docusign/src/user_profiles.rs index 998f5593..08fe7078 100644 --- a/docusign/src/user_profiles.rs +++ b/docusign/src/user_profiles.rs @@ -30,7 +30,7 @@ impl UserProfiles { &self, account_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/profile", @@ -69,7 +69,7 @@ impl UserProfiles { account_id: &str, user_id: &str, body: &crate::types::UserProfile, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/profile", diff --git a/docusign/src/user_signatures.rs b/docusign/src/user_signatures.rs index 627a8964..095dcebf 100644 --- a/docusign/src/user_signatures.rs +++ b/docusign/src/user_signatures.rs @@ -40,7 +40,7 @@ impl UserSignatures { account_id: &str, user_id: &str, stamp_type: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !stamp_type.is_empty() { query_args.push(("stamp_type".to_string(), stamp_type.to_string())); @@ -83,7 +83,7 @@ impl UserSignatures { account_id: &str, user_id: &str, body: &crate::types::UserSignaturesInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/signatures", @@ -138,7 +138,7 @@ impl UserSignatures { account_id: &str, user_id: &str, body: &crate::types::UserSignaturesInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/signatures", @@ -182,7 +182,7 @@ impl UserSignatures { account_id: &str, signature_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/signatures/{}", @@ -232,7 +232,7 @@ impl UserSignatures { user_id: &str, close_existing_signature: &str, body: &crate::types::UserSignatureDefinition, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !close_existing_signature.is_empty() { query_args.push(( @@ -286,7 +286,7 @@ impl UserSignatures { account_id: &str, signature_id: &str, user_id: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/signatures/{}", @@ -340,7 +340,7 @@ impl UserSignatures { signature_id: &str, user_id: &str, include_chrome: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !include_chrome.is_empty() { query_args.push(("include_chrome".to_string(), include_chrome.to_string())); @@ -400,7 +400,7 @@ impl UserSignatures { signature_id: &str, user_id: &str, transparent_png: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !transparent_png.is_empty() { query_args.push(("transparent_png".to_string(), transparent_png.to_string())); @@ -459,7 +459,7 @@ impl UserSignatures { image_type: &str, signature_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/signatures/{}/{}", diff --git a/docusign/src/users.rs b/docusign/src/users.rs index 8f81a7e0..69df8d22 100644 --- a/docusign/src/users.rs +++ b/docusign/src/users.rs @@ -62,7 +62,7 @@ impl Users { start_position: &str, status: &str, user_name_substring: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !additional_info.is_empty() { query_args.push(("additional_info".to_string(), additional_info.to_string())); @@ -137,7 +137,7 @@ impl Users { &self, account_id: &str, body: &crate::types::UserInformationList, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users", @@ -228,7 +228,7 @@ impl Users { &self, account_id: &str, body: &crate::types::NewUsersDefinition, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users", @@ -265,7 +265,7 @@ impl Users { account_id: &str, delete: &str, body: &crate::types::UserInfoList, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !delete.is_empty() { query_args.push(("delete".to_string(), delete.to_string())); @@ -312,7 +312,7 @@ impl Users { user_id: &str, additional_info: &str, email: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !additional_info.is_empty() { query_args.push(("additional_info".to_string(), additional_info.to_string())); @@ -358,7 +358,7 @@ impl Users { account_id: &str, user_id: &str, body: &crate::types::UserInformation, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}", @@ -400,7 +400,7 @@ impl Users { account_id: &str, user_id: &str, encoding: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !encoding.is_empty() { query_args.push(("encoding".to_string(), encoding.to_string())); @@ -440,7 +440,11 @@ impl Users { * * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing. * . */ - pub async fn profile_image_put(&self, account_id: &str, user_id: &str) -> ClientResult<()> { + pub async fn profile_image_put( + &self, + account_id: &str, + user_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/profile/image", @@ -474,7 +478,11 @@ impl Users { * * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing. * . */ - pub async fn profile_image_delete(&self, account_id: &str, user_id: &str) -> ClientResult<()> { + pub async fn profile_image_delete( + &self, + account_id: &str, + user_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/profile/image", @@ -520,7 +528,7 @@ impl Users { &self, account_id: &str, user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/settings", @@ -557,7 +565,7 @@ impl Users { account_id: &str, user_id: &str, body: &crate::types::UserSettingsInformation, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/users/{}/settings", diff --git a/docusign/src/utils.rs b/docusign/src/utils.rs index 87d66b11..8ec9b604 100644 --- a/docusign/src/utils.rs +++ b/docusign/src/utils.rs @@ -81,7 +81,7 @@ pub mod date_time_format { Ok(d) => Ok(Some(DateTime::::from_utc( chrono::NaiveDateTime::new( d, - chrono::NaiveTime::from_hms(0, 0, 0), + chrono::NaiveTime::from_hms_opt(0, 0, 0).unwrap(), ), Utc, ))), diff --git a/docusign/src/workspace_items.rs b/docusign/src/workspace_items.rs index 84b68cf6..fa0889dd 100644 --- a/docusign/src/workspace_items.rs +++ b/docusign/src/workspace_items.rs @@ -43,7 +43,7 @@ impl WorkspaceItems { include_user_detail: &str, start_position: &str, workspace_user_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); @@ -120,7 +120,7 @@ impl WorkspaceItems { folder_id: &str, workspace_id: &str, body: &crate::types::WorkspaceItemList, - ) -> ClientResult<()> { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}/folders/{}", @@ -158,7 +158,7 @@ impl WorkspaceItems { account_id: &str, folder_id: &str, workspace_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}/folders/{}/files", @@ -202,7 +202,7 @@ impl WorkspaceItems { workspace_id: &str, is_download: &str, pdf_version: &str, - ) -> ClientResult<()> { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !is_download.is_empty() { query_args.push(("is_download".to_string(), is_download.to_string())); @@ -252,7 +252,7 @@ impl WorkspaceItems { file_id: &str, folder_id: &str, workspace_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}/folders/{}/files/{}", @@ -303,7 +303,7 @@ impl WorkspaceItems { max_height: &str, max_width: &str, start_position: &str, - ) -> ClientResult { + ) -> ClientResult> { let mut query_args: Vec<(String, String)> = Default::default(); if !count.is_empty() { query_args.push(("count".to_string(), count.to_string())); diff --git a/docusign/src/workspaces.rs b/docusign/src/workspaces.rs index 603b3db7..b44dd85a 100644 --- a/docusign/src/workspaces.rs +++ b/docusign/src/workspaces.rs @@ -22,7 +22,10 @@ impl Workspaces { * * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set. */ - pub async fn get(&self, account_id: &str) -> ClientResult { + pub async fn get( + &self, + account_id: &str, + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces", @@ -55,7 +58,7 @@ impl Workspaces { &self, account_id: &str, body: &crate::types::Workspace, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces", @@ -89,7 +92,7 @@ impl Workspaces { &self, account_id: &str, workspace_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}", @@ -125,7 +128,7 @@ impl Workspaces { account_id: &str, workspace_id: &str, body: &crate::types::Workspace, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}", @@ -160,7 +163,7 @@ impl Workspaces { &self, account_id: &str, workspace_id: &str, - ) -> ClientResult { + ) -> ClientResult> { let url = self.client.url( &format!( "/v2.1/accounts/{}/workspaces/{}", diff --git a/generator/src/client.rs b/generator/src/client.rs index d5ab2532..d3a1de4b 100644 --- a/generator/src/client.rs +++ b/generator/src/client.rs @@ -23,7 +23,7 @@ impl Client { A: Into, C: Into>, { - let http = reqwest::Client::builder().build()?; + let http = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build()?; let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); let client = reqwest_middleware::ClientBuilder::new(http) // Trace HTTP requests. See the tracing crate to make use of these traces. @@ -181,10 +181,10 @@ impl Client { ) .await?; *token_guard = Some(crate::auth::ExpiringInstallationToken::new( - token.token.clone(), + token.body.token.clone(), created_at, )); - token.token + token.body.token } }; let auth = format!("token {}", token); @@ -194,47 +194,24 @@ impl Client { } } - async fn request( + async fn make_request( &self, method: http::Method, uri: &str, message: Message, media_type: crate::utils::MediaType, authentication: crate::auth::AuthenticationConstraint, - ) -> ClientResult<(Option, Out)> - where - Out: serde::de::DeserializeOwned + 'static + Send, - { - #[cfg(feature = "httpcache")] - let uri2 = uri.to_string(); - + ) -> ClientResult { let (url, auth) = self.url_and_auth(uri, authentication).await?; - let instance = <&Client>::clone(&self); - - #[cfg(not(feature = "httpcache"))] - let mut req = instance.client.request(method, url); - - #[cfg(feature = "httpcache")] - let mut req = { - let mut req = instance.client.request(method.clone(), url); - if method == http::Method::GET { - if let Ok(etag) = instance.http_cache.lookup_etag(&uri2) { - req = req.header(http::header::IF_NONE_MATCH, etag); - } - } - req - }; + let mut req = self.client.request(method, url); if let Some(content_type) = &message.content_type { req = req.header(http::header::CONTENT_TYPE, content_type.clone()); } - req = req.header(http::header::USER_AGENT, &*instance.agent); - req = req.header( - http::header::ACCEPT, - &media_type.to_string() - ); + req = req.header(http::header::USER_AGENT, &*self.agent); + req = req.header(http::header::ACCEPT, &media_type.to_string()); if let Some(auth_str) = auth { req = req.header(http::header::AUTHORIZATION, &*auth_str); @@ -243,13 +220,38 @@ impl Client { if let Some(body) = message.body { req = req.body(body); } - let response = req.send().await?; - #[cfg(feature = "httpcache")] - let instance2 = <&Client>::clone(&self); + Ok(req) + } + + async fn request( + &self, + method: http::Method, + uri: &str, + message: Message, + media_type: crate::utils::MediaType, + authentication: crate::auth::AuthenticationConstraint, + ) -> ClientResult<(Option, crate::Response)> + where + Out: serde::de::DeserializeOwned + 'static + Send, + { + #[cfg(not(feature = "httpcache"))] + let req = self.make_request(method.clone(), uri, message, media_type, authentication).await?; #[cfg(feature = "httpcache")] - let uri3 = uri.to_string(); + let req = { + let mut req = self.make_request(method.clone(), uri, message, media_type, authentication).await?; + + if method == http::Method::GET { + if let Ok(etag) = self.http_cache.lookup_etag(&uri) { + req = req.header(http::header::IF_NONE_MATCH, etag); + } + } + + req + }; + + let response = req.send().await?; #[cfg(not(feature = "httpcache"))] let (remaining, reset) = crate::utils::get_header_values(response.headers()); @@ -258,6 +260,7 @@ impl Client { let (remaining, reset, etag) = crate::utils::get_header_values(response.headers()); let status = response.status(); + let headers = response.headers().clone(); let link = response .headers() .get(http::header::LINK) @@ -272,8 +275,8 @@ impl Client { #[cfg(feature = "httpcache")] { if let Some(etag) = etag { - if let Err(e) = instance2.http_cache.cache_response( - &uri3, + if let Err(e) = self.http_cache.cache_response( + &uri, &response_body, &etag, &next_link.as_ref().map(|n| n.0.clone()), @@ -289,25 +292,43 @@ impl Client { } else { serde_json::from_slice::(&response_body)? }; - Ok((next_link, parsed_response)) - } else if status == http::StatusCode::NOT_MODIFIED { - // only supported case is when client provides if-none-match - // header when cargo builds with --cfg feature="httpcache" - #[cfg(feature = "httpcache")] - { - let body = instance2.http_cache.lookup_body(&uri3).unwrap(); - let out = serde_json::from_str::(&body).unwrap(); - let link = match next_link { - Some(next_link) => Ok(Some(next_link)), - None => instance2.http_cache.lookup_next_link(&uri3) - .map(|next_link| next_link.map(crate::utils::NextLink)) - }; - link.map(|link| (link, out)) + Ok((next_link, crate::Response::new(status, headers, parsed_response))) + } else if status.is_redirection() { + match status { + http::StatusCode::NOT_MODIFIED => { + // only supported case is when client provides if-none-match + // header when cargo builds with --cfg feature="httpcache" + #[cfg(feature = "httpcache")] + { + let body = self.http_cache.lookup_body(&uri).unwrap(); + let out = serde_json::from_str::(&body).unwrap(); + let link = match next_link { + Some(next_link) => Ok(Some(next_link)), + None => self + .http_cache + .lookup_next_link(&uri) + .map(|next_link| next_link.map(crate::utils::NextLink)), + }; + link.map(|link| (link, Response::new(status, headers, out))) + } + #[cfg(not(feature = "httpcache"))] + { + unreachable!("this should not be reachable without the httpcache feature enabled") + } } - #[cfg(not(feature = "httpcache"))] - { - unreachable!("this should not be reachable without the httpcache feature enabled") + _ => { + // The body still needs to be parsed. Except in the case of 304 (handled above), + // returning a body in the response is allowed. + let body = if std::any::TypeId::of::() == std::any::TypeId::of::<()>() + { + serde_json::from_str("null")? + } else { + serde_json::from_slice::(&response_body)? + }; + + Ok((None, crate::Response::new(status, headers, body))) } + } } else { let error = match (remaining, reset) { (Some(remaining), Some(reset)) if remaining == 0 => { @@ -319,9 +340,9 @@ impl Client { }, _ => { if response_body.is_empty() { - ClientError::HttpError{status: status, error: "empty response".into()} + ClientError::HttpError{status, headers, error: "empty response".into()} } else { - ClientError::HttpError{status: status, error: String::from_utf8_lossy(&response_body).into()} + ClientError::HttpError{status, headers, error: String::from_utf8_lossy(&response_body).into()} } } }; @@ -336,7 +357,7 @@ impl Client { message: Message, media_type: crate::utils::MediaType, authentication: crate::auth::AuthenticationConstraint, - ) -> ClientResult + ) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -344,14 +365,14 @@ impl Client { Ok(r) } - async fn get(&self, uri: &str, message: Message) -> ClientResult + async fn get(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { self.get_media(uri, crate::utils::MediaType::Json, message).await } - async fn get_media(&self, uri: &str, media: crate::utils::MediaType, message: Message) -> ClientResult + async fn get_media(&self, uri: &str, media: crate::utils::MediaType, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -364,14 +385,14 @@ impl Client { ).await } - async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult> + async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, { self.unfold(uri).await } - async fn get_pages(&self, uri: &str) -> ClientResult<(Option, Vec)> + async fn get_pages(&self, uri: &str) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -384,7 +405,7 @@ impl Client { ).await } - async fn get_pages_url(&self, url: &reqwest::Url) -> ClientResult<(Option, Vec)> + async fn get_pages_url(&self, url: &reqwest::Url) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -397,7 +418,7 @@ impl Client { ).await } - async fn post(&self, uri: &str, message: Message) -> ClientResult + async fn post(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -415,7 +436,7 @@ impl Client { message: Message, media: crate::utils::MediaType, authentication: crate::auth::AuthenticationConstraint, - ) -> ClientResult + ) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -428,7 +449,7 @@ impl Client { ).await } - async fn patch_media(&self, uri: &str, message: Message, media: crate::utils::MediaType) -> ClientResult + async fn patch_media(&self, uri: &str, message: Message, media: crate::utils::MediaType) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -441,21 +462,21 @@ impl Client { ).await } - async fn patch(&self, uri: &str, message: Message) -> ClientResult + async fn patch(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { self.patch_media(uri, message, crate::utils::MediaType::Json).await } - async fn put(&self, uri: &str, message: Message) -> ClientResult + async fn put(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { self.put_media(uri, message, crate::utils::MediaType::Json).await } - async fn put_media(&self, uri: &str, message: Message, media: crate::utils::MediaType) -> ClientResult + async fn put_media(&self, uri: &str, message: Message, media: crate::utils::MediaType) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -468,7 +489,7 @@ impl Client { ).await } - async fn delete(&self, uri: &str, message: Message) -> ClientResult + async fn delete(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, { @@ -485,25 +506,25 @@ impl Client { async fn unfold( &self, uri: &str, - ) -> ClientResult> + ) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, { let mut global_items = Vec::new(); - let (new_link, mut items) = self.get_pages(uri).await?; + let (new_link, mut response) = self.get_pages(uri).await?; let mut link = new_link; - while !items.is_empty() { - global_items.append(&mut items); + while !response.body.is_empty() { + global_items.append(&mut response.body); // We need to get the next link. if let Some(url) = &link { let url = reqwest::Url::parse(&url.0)?; - let (new_link, new_items) = self.get_pages_url(&url).await?; + let (new_link, new_response) = self.get_pages_url(&url).await?; link = new_link; - items = new_items; + response = new_response; } } - Ok(global_items) + Ok(Response::new(response.status, response.headers, global_items)) }"#; pub fn generate_client_generic_token( @@ -606,9 +627,11 @@ struct InnerToken {{ }} impl Client {{ - /// Create a new Client struct. It takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key your requests will work. + /// Create a new Client struct. Requires OAuth2 configuration values as well as an access and refresh token. + /// + /// # Panics + /// + /// This function will panic if the internal http client fails to create pub fn new( client_id: I, client_secret: K, @@ -628,7 +651,7 @@ impl Client {{ {{ // Retry up to 3 times with increasing intervals between attempts. let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); - let client = reqwest::Client::builder().build(); + let client = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build(); match client {{ Ok(c) => {{ let client = reqwest_middleware::ClientBuilder::new(c) @@ -797,12 +820,16 @@ fn basic_new_from_env( format!( r#" -/// Create a new Client struct from environment variables. It -/// takes a type that can convert into -/// an &str (`String` or `Vec` for example). As long as the function is -/// given a valid API key and your requests will work. -/// We pass in the token and refresh token to the client so if you are storing -/// it in a database, you can get it first. +/// Create a new Client struct from environment variables. Requires an existing access and refresh token. +/// +/// The following environment variables are expected to be set: +/// * `{}_CLIENT_ID` +/// * `{}_CLIENT_SECRET` +/// * `{}_REDIRECT_URI` +/// +/// # Panics +/// +/// This function will panic if the expected environment variables can not be found pub fn new_from_env(token: T, refresh_token: R{}, {server_arg}) -> Self where T: ToString, @@ -823,6 +850,9 @@ where {server_param} ) }}"#, + proper_name.to_uppercase().replace('.', ""), + proper_name.to_uppercase().replace('.', ""), + proper_name.to_uppercase().replace('.', ""), add_post_header_type, add_post_header_args, add_post_header_args_where, @@ -837,23 +867,29 @@ where } const GOOGLE_NEW_FROM_ENV_TEMPLATE: &str = r#" -/// Create a new Client struct from environment variables. It -/// takes a type that can convert into -/// an &str (`String` or `Vec` for example). As long as the function is -/// given a valid API key and your requests will work. -/// We pass in the token and refresh token to the client so if you are storing -/// it in a database, you can get it first. +/// Create a new Client struct from environment variables. Requires an existing access and refresh token +/// +/// The following environment variables are expected to be set: +/// * `GOOGLE_KEY_ENCODED` - A base64 encoded version of JSON formatted application secret +/// +/// # Panics +/// +/// This function will panic if an application secret can not be parsed from the encoded key +/// +/// This function will panic if the internal http client fails to create pub async fn new_from_env(token: T, refresh_token: R) -> Self where T: ToString, R: ToString, { + use base64::{Engine, engine::general_purpose::STANDARD}; + let google_key = env::var("GOOGLE_KEY_ENCODED").unwrap_or_default(); - let decoded_google_key = base64::decode(google_key).unwrap(); + let decoded_google_key = STANDARD.decode(google_key).unwrap(); let secret = yup_oauth2::parse_application_secret(decoded_google_key) .expect("failed to read from google credential env var"); - let client = reqwest::Client::builder().build(); + let client = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build(); let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); match client { @@ -922,9 +958,11 @@ pub struct Client {{ }} impl Client {{ - /// Create a new Client struct. It takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key your requests will work. + /// Create a new Client struct. + /// + /// # Panics + /// + /// This function will panic if the internal http client fails to create pub fn new( token: T, {server_arg} @@ -932,7 +970,7 @@ impl Client {{ where T: ToString, {{ - let client = reqwest::Client::builder().build(); + let client = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build(); let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); match client {{ Ok(c) => {{ @@ -986,12 +1024,14 @@ impl Client {{ format!("{{}}{{}}", self.get_host_override().or(host).unwrap_or(self.host.as_str()), path) }} - /// Create a new Client struct from environment variables. It - /// takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key and your requests will work. - /// We pass in the token and refresh token to the client so if you are storing - /// it in a database, you can get it first. + /// Create a new Client struct from environment variables. + /// + /// The following environment variables are expected to be set: + /// * `{}_API_KEY` + /// + /// # Panics + /// + /// This function will panic if the expected environment variables can not be found pub fn new_from_env() -> Self {{ let token = env::var("{}_API_KEY").expect("must set {}_API_KEY"); @@ -1002,6 +1042,7 @@ impl Client {{ }} {}"#, + proper_name.to_uppercase().replace('.', ""), proper_name.to_uppercase().replace('.', ""), proper_name.to_uppercase().replace('.', ""), get_shared_functions(proper_name, add_post_header) @@ -1054,13 +1095,14 @@ async fn request( method: reqwest::Method, uri: &str, message: Message, -) -> ClientResult +) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, {{ let response = self.request_raw(method, uri, message).await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -1071,12 +1113,12 @@ async fn request( }} else {{ serde_json::from_slice::(&response_body)? }}; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) }} else {{ let error = if response_body.is_empty() {{ - ClientError::HttpError{{status: status, error: "empty response".into()}} + ClientError::HttpError{{status, headers, error: "empty response".into()}} }} else {{ - ClientError::HttpError{{status: status, error: String::from_utf8_lossy(&response_body).into()}} + ClientError::HttpError{{status, headers, error: String::from_utf8_lossy(&response_body).into()}} }}; Err(error) @@ -1088,13 +1130,14 @@ async fn request_with_links( method: http::Method, uri: &str, message: Message, -) -> ClientResult<(Option, Out)> +) -> ClientResult<(Option, crate::Response)> where Out: serde::de::DeserializeOwned + 'static + Send, {{ let response = self.request_raw(method, uri, message).await?; let status = response.status(); + let headers = response.headers().clone(); let link = response .headers() .get(http::header::LINK) @@ -1113,12 +1156,12 @@ where }} else {{ serde_json::from_slice::(&response_body)? }}; - Ok((link, parsed_response)) + Ok((link, crate::Response::new(status, headers, parsed_response))) }} else {{ let error = if response_body.is_empty() {{ - ClientError::HttpError{{status: status, error: "empty response".into()}} + ClientError::HttpError{{status, headers, error: "empty response".into()}} }} else {{ - ClientError::HttpError{{status: status, error: String::from_utf8_lossy(&response_body).into()}} + ClientError::HttpError{{status, headers, error: String::from_utf8_lossy(&response_body).into()}} }}; Err(error) }} @@ -1130,7 +1173,7 @@ async fn post_form( &self, uri: &str, form: reqwest::multipart::Form, -) -> ClientResult +) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1155,6 +1198,7 @@ async fn post_form( let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -1169,12 +1213,12 @@ async fn post_form( }} else {{ serde_json::from_slice::(&response_body)? }}; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) }} else {{ let error = if response_body.is_empty() {{ - ClientError::HttpError{{status: status, error: "empty response".into()}} + ClientError::HttpError{{status, headers, error: "empty response".into()}} }} else {{ - ClientError::HttpError{{status: status, error: String::from_utf8_lossy(&response_body).into()}} + ClientError::HttpError{{status, headers, error: String::from_utf8_lossy(&response_body).into()}} }}; Err(error) @@ -1188,7 +1232,7 @@ async fn request_with_accept_mime( method: reqwest::Method, uri: &str, accept_mime_type: &str, -) -> ClientResult +) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1211,6 +1255,7 @@ async fn request_with_accept_mime( let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -1225,12 +1270,12 @@ async fn request_with_accept_mime( }} else {{ serde_json::from_slice::(&response_body)? }}; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) }} else {{ let error = if response_body.is_empty() {{ - ClientError::HttpError{{status: status, error: "empty response".into()}} + ClientError::HttpError{{status, headers, error: "empty response".into()}} }} else {{ - ClientError::HttpError{{status: status, error: String::from_utf8_lossy(&response_body).into()}} + ClientError::HttpError{{status, headers, error: String::from_utf8_lossy(&response_body).into()}} }}; Err(error) @@ -1245,7 +1290,7 @@ async fn request_with_mime( uri: &str, content: &[u8], mime_type: &str, -) -> ClientResult +) -> ClientResult> where Out: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1287,6 +1332,7 @@ async fn request_with_mime( let response = req.send().await?; let status = response.status(); + let headers = response.headers().clone(); let response_body = response.bytes().await?; @@ -1297,12 +1343,12 @@ async fn request_with_mime( }} else {{ serde_json::from_slice::(&response_body)? }}; - Ok(parsed_response) + Ok(crate::Response::new(status, headers, parsed_response)) }} else {{ let error = if response_body.is_empty() {{ - ClientError::HttpError{{status: status, error: "empty response".into()}} + ClientError::HttpError{{status, headers, error: "empty response".into()}} }} else {{ - ClientError::HttpError{{status: status, error: String::from_utf8_lossy(&response_body).into()}} + ClientError::HttpError{{status, headers, error: String::from_utf8_lossy(&response_body).into()}} }}; Err(error) @@ -1314,7 +1360,7 @@ async fn request_entity( method: http::Method, uri: &str, message: Message, -) -> ClientResult +) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1325,7 +1371,7 @@ where }} #[allow(dead_code)] -async fn get(&self, uri: &str, message: Message) -> ClientResult +async fn get(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1337,7 +1383,7 @@ where }} #[allow(dead_code)] -async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult> +async fn get_all_pages(&self, uri: &str, _message: Message) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1350,29 +1396,29 @@ where async fn unfold( &self, uri: &str, -) -> ClientResult> +) -> ClientResult>> where D: serde::de::DeserializeOwned + 'static + Send, {{ let mut global_items = Vec::new(); - let (new_link, mut items) = self.get_pages(uri).await?; + let (new_link, mut response) = self.get_pages(uri).await?; let mut link = new_link; - while !items.is_empty() {{ - global_items.append(&mut items); + while !response.body.is_empty() {{ + global_items.append(&mut response.body); // We need to get the next link. - if let Some(url) = link.as_ref() {{ + if let Some(url) = &link {{ let url = reqwest::Url::parse(&url.0)?; - let (new_link, new_items) = self.get_pages_url(&url).await?; + let (new_link, new_response) = self.get_pages_url(&url).await?; link = new_link; - items = new_items; + response = new_response; }} }} - Ok(global_items) + Ok(Response::new(response.status, response.headers, global_items)) }} #[allow(dead_code)] -async fn get_pages(&self, uri: &str) -> ClientResult<(Option, Vec)> +async fn get_pages(&self, uri: &str) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1384,7 +1430,7 @@ where }} #[allow(dead_code)] -async fn get_pages_url(&self, url: &reqwest::Url) -> ClientResult<(Option, Vec)> +async fn get_pages_url(&self, url: &reqwest::Url) -> ClientResult<(Option, crate::Response>)> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1396,7 +1442,7 @@ where }} #[allow(dead_code)] -async fn post(&self, uri: &str, message: Message) -> ClientResult +async fn post(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1408,7 +1454,7 @@ where }} #[allow(dead_code)] -async fn patch(&self, uri: &str, message: Message) -> ClientResult +async fn patch(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1420,7 +1466,7 @@ where }} #[allow(dead_code)] -async fn put(&self, uri: &str, message: Message) -> ClientResult +async fn put(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1432,7 +1478,7 @@ where }} #[allow(dead_code)] -async fn delete(&self, uri: &str, message: Message) -> ClientResult +async fn delete(&self, uri: &str, message: Message) -> ClientResult> where D: serde::de::DeserializeOwned + 'static + Send, {{ @@ -1775,9 +1821,12 @@ pub struct Client {{ {} impl Client {{ - /// Create a new Client struct. It takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key your requests will work. + /// Create a new Client struct. Requires OAuth2 configuration values as well as + /// an access token. + /// + /// # Panics + /// + /// This function will panic if the internal http client fails to create pub fn new( client_id: I, client_secret: K, @@ -1789,7 +1838,7 @@ impl Client {{ K: ToString, T: ToString, {{ - let client = reqwest::Client::builder().build(); + let client = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build(); let retry_policy = reqwest_retry::policies::ExponentialBackoff::builder().build_with_max_retries(3); match client {{ Ok(c) => {{ @@ -1845,12 +1894,15 @@ impl Client {{ format!("{{}}{{}}", self.get_host_override().or(host).unwrap_or(self.host.as_str()), path) }} - /// Create a new Client struct from environment variables. It - /// takes a type that can convert into - /// an &str (`String` or `Vec` for example). As long as the function is - /// given a valid API key and your requests will work. - /// We pass in the token and refresh token to the client so if you are storing - /// it in a database, you can get it first. + /// Create a new Client struct from environment variables. + /// + /// The following environment variables are expected to be set: + /// * `{}_CLIENT_ID` + /// * `{}_CLIENT_SECRET` + /// + /// # Panics + /// + /// This function will panic if the expected environment variables can not be found pub fn new_from_env(token: T) -> Self where T: ToString, @@ -1874,6 +1926,8 @@ impl Client {{ proper_name.to_uppercase().replace('.', ""), proper_name.to_uppercase().replace('.', ""), proper_name.to_uppercase().replace('.', ""), + proper_name.to_uppercase().replace('.', ""), + proper_name.to_uppercase().replace('.', ""), CLIENT_AUTH_TEMPLATE, get_shared_functions(proper_name, add_post_header) ) @@ -1950,89 +2004,89 @@ impl GeneratedServers { } pub fn host_from_server(&self) -> String { - if self.count > 1 { - String::from("let host = server.into().default_url().to_string();") - } else if self.count == 1 { - format!( + match self.count { + 0 => String::from("let host = FALLBACK_HOST.to_string();"), + 1 => format!( "let host = {}::default().default_url().to_string();", self.top_level_type.as_ref().unwrap() - ) - } else { - String::from("let host = FALLBACK_HOST.to_string();") + ), + _ => String::from("let host = server.into().default_url().to_string();"), } } } pub fn generate_servers(servers: &[openapiv3::Server], server_prefix: &str) -> GeneratedServers { - if servers.len() > 1 { - let mut server_variants = String::new(); - let mut server_branches = String::new(); - let mut server_structs = String::new(); - let mut server_into = String::new(); + match servers.len() { + 0 => GeneratedServers::default(), + 1 => { + let server = &servers[0]; + let server_struct_name = format!("{server_prefix}DefaultServer"); + let server_struct = generate_server(&server_struct_name, server); + + GeneratedServers { + count: servers.len() as u64, + output: Some(server_struct), + top_level_type: Some(server_struct_name), + } + } + _ => { + let mut server_variants = String::new(); + let mut server_branches = String::new(); + let mut server_structs = String::new(); + let mut server_into = String::new(); - let server_enum = format!("{server_prefix}DefaultServers"); + let server_enum = format!("{server_prefix}DefaultServers"); - for server in servers { - if let Some(description) = &server.description { - let server_name = struct_name(&format!("{server_prefix}{}Server", description)); - let server_struct = generate_server(&server_name, server); + for server in servers { + if let Some(description) = &server.description { + let server_name = struct_name(&format!("{server_prefix}{}Server", description)); + let server_struct = generate_server(&server_name, server); - server_variants.push_str(&format!("{server_name}({server_name}),\n")); + server_variants.push_str(&format!("{server_name}({server_name}),\n")); - server_branches.push_str(&format!( - "Self::{server_name}(inner) => inner.default_url(),\n" - )); + server_branches.push_str(&format!( + "Self::{server_name}(inner) => inner.default_url(),\n" + )); - server_structs.push_str(&format!("{server_struct}\n")); + server_structs.push_str(&format!("{server_struct}\n")); - server_into.push_str(&format!( - r#"impl From<{server_name}> for {server_enum} {{ - fn from(server: {server_name}) -> Self {{ - Self::{server_name}(server) + server_into.push_str(&format!( + r#"impl From<{server_name}> for {server_enum} {{ + fn from(server: {server_name}) -> Self {{ + Self::{server_name}(server) + }} }} -}} -"# - )); - } else { - panic!("If multiple servers are present, they must have descriptions") + "# + )); + } else { + panic!("If multiple servers are present, they must have descriptions") + } } - } - GeneratedServers { - count: servers.len() as u64, - output: Some(format!( - r#" -pub enum {server_enum} {{ - {server_variants} -}} + GeneratedServers { + count: servers.len() as u64, + output: Some(format!( + r#" + pub enum {server_enum} {{ + {server_variants} + }} -impl {server_enum} {{ - pub fn default_url(&self) -> &str {{ - match self {{ - {server_branches} + impl {server_enum} {{ + pub fn default_url(&self) -> &str {{ + match self {{ + {server_branches} + }} }} }} -}} -{server_structs} + {server_structs} -{server_into} -"# - )), - top_level_type: Some(server_enum), - } - } else if servers.len() == 1 { - let server = &servers[0]; - let server_struct_name = format!("{server_prefix}DefaultServer"); - let server_struct = generate_server(&server_struct_name, server); - - GeneratedServers { - count: servers.len() as u64, - output: Some(server_struct), - top_level_type: Some(server_struct_name), + {server_into} + "# + )), + top_level_type: Some(server_enum), + } } - } else { - GeneratedServers::default() } } diff --git a/generator/src/functions.rs b/generator/src/functions.rs index 591e73e4..04600ca6 100644 --- a/generator/src/functions.rs +++ b/generator/src/functions.rs @@ -126,7 +126,10 @@ pub fn generate_files( content.push_str(&format!("body: {}", bp)); } - content.push_str(&format!(") -> ClientResult<{}> {{", response_type)); + content.push_str(&format!( + ") -> ClientResult> {{", + response_type + )); content.push_str(template); @@ -856,10 +859,10 @@ fn get_fn_inner( } else if all_pages && proper_name.starts_with("Stripe") { // We will do a custom function here. let inner = format!( - r#"let mut resp: {} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; + r#"let crate::Response::<{}> {{ mut status, mut headers, mut body }} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; - let mut {} = resp.{}; - let mut has_more = resp.has_more; + let mut {} = body.{}; + let mut has_more = body.has_more; let mut page = "".to_string(); // Paginate if we should. @@ -875,19 +878,19 @@ fn get_fn_inner( }} if !url.contains('?') {{ - resp = self.client.{}(&format!("{{}}?startng_after={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}?startng_after={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} else {{ - resp = self.client.{}(&format!("{{}}&starting_after={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}&starting_after={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} - {}.append(&mut resp.{}); + {}.append(&mut body.{}); - has_more = resp.has_more; + has_more = body.has_more; }} // Return our response data. - Ok({}.to_vec())"#, + Ok(crate::Response::new(status, headers, {}.to_vec()))"#, response_type, m.to_lowercase(), body, @@ -895,8 +898,10 @@ fn get_fn_inner( pagination_property, pagination_property, pagination_property, + response_type, m.to_lowercase(), body, + response_type, m.to_lowercase(), body, pagination_property, @@ -908,38 +913,40 @@ fn get_fn_inner( } else if all_pages && proper_name.starts_with("Google") { // We will do a custom function here. let inner = format!( - r#"let mut resp: {} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; + r#"let crate::Response::<{}> {{ mut status, mut headers, mut body }} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; - let mut {} = resp.{}; - let mut page = resp.next_page_token; + let mut {} = body.{}; + let mut page = body.next_page_token; // Paginate if we should. while !page.is_empty() {{ if !url.contains('?') {{ - resp = self.client.{}(&format!("{{}}?pageToken={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}?pageToken={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} else {{ - resp = self.client.{}(&format!("{{}}&pageToken={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}&pageToken={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} - {}.append(&mut resp.{}); + {}.append(&mut body.{}); - if !resp.next_page_token.is_empty() && resp.next_page_token != page {{ - page = resp.next_page_token.to_string(); + if !body.next_page_token.is_empty() && body.next_page_token != page {{ + page = body.next_page_token.to_string(); }} else {{ page = "".to_string(); }} }} // Return our response data. - Ok({})"#, + Ok(crate::Response::new(status, headers, {}))"#, response_type, m.to_lowercase(), body, pagination_property, pagination_property, + response_type, m.to_lowercase(), body, + response_type, m.to_lowercase(), body, pagination_property, @@ -951,19 +958,21 @@ fn get_fn_inner( } else if all_pages && proper_name == "Ramp" { // We will do a custom function here. let inner = format!( - r#"let resp: {} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; + r#"let crate::Response::<{}> {{ mut status, mut headers, body }} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; - let mut {} = resp.{}; - let mut page = resp.page.next.to_string(); + let mut {} = body.{}; + let mut page = body.page.next.to_string(); // Paginate if we should. while !page.is_empty() {{ match self.client.{}::<{}>(page.trim_start_matches(&self.client.host), crate::Message {{ body: {}, content_type: None }}).await {{ Ok(mut resp) => {{ - {}.append(&mut resp.{}); + {}.append(&mut resp.body.{}); + status = resp.status; + headers = resp.headers; - page = if resp.page.next != page {{ - resp.page.next.to_string() + page = if body.page.next != page {{ + body.page.next.to_string() }} else {{ "".to_string() }}; @@ -979,7 +988,7 @@ fn get_fn_inner( }} // Return our response data. - Ok({})"#, + Ok(crate::Response::new(status, headers, {}))"#, response_type, m.to_lowercase(), body, @@ -998,30 +1007,30 @@ fn get_fn_inner( // We will do a custom function here. let inner = format!( r#" - let mut resp: {} = if !url.contains('?') {{ + let crate::Response::<{}> {{ mut status, mut headers, mut body }} = if !url.contains('?') {{ self.client.{}(&format!("{{}}?page=0&size=100", url), crate::Message {{ body: {}, content_type: None }}).await? }} else {{ self.client.{}(&format!("{{}}&page=0&size=100", url), crate::Message {{ body: {}, content_type: None }}).await? }}; - let mut {} = resp.{}; - let mut page = resp.page.current_page + 1; + let mut {} = body.{}; + let mut page = body.page.current_page + 1; // Paginate if we should. - while page <= (resp.page.total_pages - 1) {{ + while page <= (body.page.total_pages - 1) {{ if !url.contains('?') {{ - resp = self.client.{}(&format!("{{}}?page={{}}&size=100", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}?page={{}}&size=100", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} else {{ - resp = self.client.{}(&format!("{{}}&page={{}}&size=100", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}&page={{}}&size=100", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} - {}.append(&mut resp.{}); + {}.append(&mut body.{}); - page = resp.page.current_page + 1; + page = body.page.current_page + 1; }} // Return our response data. - Ok({})"#, + Ok(crate::Response::new(status, headers, {}))"#, response_type, m.to_lowercase(), body, @@ -1029,8 +1038,10 @@ fn get_fn_inner( body, pagination_property, pagination_property, + response_type, m.to_lowercase(), body, + response_type, m.to_lowercase(), body, pagination_property, @@ -1042,38 +1053,40 @@ fn get_fn_inner( } else if all_pages && proper_name == "Zoom" { // We will do a custom function here. let inner = format!( - r#"let mut resp: {} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; + r#"let crate::Response::<{}> {{ mut status, mut headers, mut body }} = self.client.{}(&url, crate::Message {{ body: {}, content_type: None }}).await?; - let mut {} = resp.{}; - let mut page = resp.next_page_token; + let mut {} = body.{}; + let mut page = body.next_page_token; // Paginate if we should. while !page.is_empty() {{ // Check if we already have URL params and need to concat the token. if !url.contains('?') {{ - resp = self.client.{}(&format!("{{}}?next_page_token={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}?next_page_token={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} else {{ - resp = self.client.{}(&format!("{{}}&next_page_token={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; + crate::Response::<{}> {{ status, headers, body }} = self.client.{}(&format!("{{}}&next_page_token={{}}", url, page), crate::Message {{ body: {}, content_type: None }}).await?; }} - {}.append(&mut resp.{}); + {}.append(&mut body.{}); - if !resp.next_page_token.is_empty() && resp.next_page_token != page {{ - page = resp.next_page_token.to_string(); + if !body.next_page_token.is_empty() && body.next_page_token != page {{ + page = body.next_page_token.to_string(); }} else {{ page = "".to_string(); }} }} // Return our response data. - Ok({})"#, + Ok(crate::Response::new(status, headers, {}))"#, response_type, m.to_lowercase(), body, pagination_property, pagination_property, + response_type, m.to_lowercase(), body, + response_type, m.to_lowercase(), body, pagination_property, @@ -1113,10 +1126,10 @@ fn get_fn_inner( // Okay we have an inner response type, let's return that instead. return Ok(format!( - r#"let resp: {} = self.client.{}(&url, crate::Message {{ body: {}, content_type: {content_type} }}).await?; + r#"let resp: crate::Response<{}> = self.client.{}(&url, crate::Message {{ body: {}, content_type: {content_type} }}).await?; // Return our response data. - Ok(resp.{}{})"#, + Ok(crate::Response::new(resp.status, resp.headers, resp.body.{}{}))"#, response_type, m.to_lowercase(), body, @@ -1158,25 +1171,25 @@ fn get_fn_docs( a("/**"); if let Some(summary) = &o.summary { - a(&format!("* {}.", summary.trim_end_matches('.'))); - a("*"); + a(&format!(" * {}.", summary.trim_end_matches('.'))); + a(" *"); } a(&format!( - "* This function performs a `{}` to the `{}` endpoint.", + " * This function performs a `{}` to the `{}` endpoint.", m, p )); if let Some(description) = &o.description { - a("*"); - a(&format!("* {}", description.replace('\n', "\n* "))); + a(" *"); + a(&format!(" * {}", description.replace('\n', "\n * "))); } if let Some(external_docs) = &o.external_docs { - a("*"); - a(&format!("* FROM: <{}>", external_docs.url)); + a(" *"); + a(&format!(" * FROM: <{}>", external_docs.url)); } if !o.parameters.is_empty() { - a("*"); - a("* **Parameters:**"); - a("*"); + a(" *"); + a(" * **Parameters:**"); + a(" *"); } // Iterate over the function parameters and add any data those had as well. for par in o.parameters.iter() { @@ -1200,7 +1213,7 @@ fn get_fn_docs( let mut docs = ts.render_docs(&pid); if let Some(d) = ¶meter_data.description { if !d.is_empty() && d.len() > docs.len() { - docs = format!(" -- {}.", d.trim_end_matches('.').replace('\n', "\n* ")); + docs = format!(" -- {}.", d.trim_end_matches('.').replace('\n', "\n * ")); } else if !docs.is_empty() { docs = format!( " -- {}.", @@ -1224,12 +1237,12 @@ fn get_fn_docs( || nam == "const" || nam == "use" { - a(&format!("* * `{}_: {}`{}", nam, typ, docs)); + a(&format!(" * * `{}_: {}`{}", nam, typ, docs)); } else { - a(&format!("* * `{}: {}`{}", nam, typ, docs)); + a(&format!(" * * `{}: {}`{}", nam, typ, docs)); } } - a("*/"); + a(" */"); Ok(out.trim().to_string()) } @@ -1244,27 +1257,27 @@ fn get_fn_docs_all(o: &openapiv3::Operation, m: &str, p: &str, fn_name: &str) -> a("/**"); if let Some(summary) = &o.summary { - a(&format!("* {}.", summary.trim_end_matches('.'))); - a("*"); + a(&format!(" * {}.", summary.trim_end_matches('.'))); + a(" *"); } a(&format!( - "* This function performs a `{}` to the `{}` endpoint.", + " * This function performs a `{}` to the `{}` endpoint.", m, p )); - a("*"); + a(" *"); a(&format!( - "* As opposed to `{}`, this function returns all the pages of the request at once.", + " * As opposed to `{}`, this function returns all the pages of the request at once.", fn_name )); if let Some(description) = &o.description { - a("*"); - a(&format!("* {}", description.replace('\n', "\n* "))); + a(" *"); + a(&format!(" * {}", description.replace('\n', "\n * "))); } if let Some(external_docs) = &o.external_docs { - a("*"); - a(&format!("* FROM: <{}>", external_docs.url)); + a(" *"); + a(&format!(" * FROM: <{}>", external_docs.url)); } - a("*/"); + a(" */"); Ok(out.trim().to_string()) } diff --git a/generator/src/main.rs b/generator/src/main.rs index bbacbc4c..082aca1f 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -895,13 +895,13 @@ impl TypeSpace { if let Some(s) = schema { if let Some(description) = &s.description { a(&format!( - "* {}", - description.replace('*', "\\*").replace('\n', "\n* ") + " * {}", + description.replace('*', "\\*").replace('\n', "\n * ") )); } if let Some(external_docs) = &s.external_docs { - a("*"); - a(&format!("* FROM: <{}>", external_docs.url)); + a(" *"); + a(&format!(" * FROM: <{}>", external_docs.url)); } } @@ -2195,8 +2195,8 @@ fn render_param( if !description.is_empty() { a("/**"); - a(&format!("* {}", description.replace('\n', "\n* "))); - a("*/"); + a(&format!(" * {}", description.replace('\n', "\n * "))); + a(" */"); } a("#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, JsonSchema)]"); @@ -2281,6 +2281,7 @@ fn render_param( out.to_string() } +#[allow(clippy::too_many_arguments)] fn gen( api: &OpenAPI, proper_name: &str, @@ -2372,9 +2373,32 @@ fn gen( a(""); - a("use thiserror::Error;"); + a(r#" +pub use reqwest::{StatusCode, header::HeaderMap}; + +#[derive(Debug)] +pub struct Response { + pub status: reqwest::StatusCode, + pub headers: reqwest::header::HeaderMap, + pub body: T +} + +impl Response { + pub fn new(status: reqwest::StatusCode, headers: reqwest::header::HeaderMap, body: T) -> Self { + Self { + status, + headers, + body, + } + } +}"#); + a(""); + a("type ClientResult = Result;"); a(""); + + a("use thiserror::Error;"); + a(""); a(r#" /// Errors returned by the client #[derive(Debug, Error)] @@ -2443,6 +2467,7 @@ pub enum ClientError {"#); #[error("HTTP Error. Code: {status}, message: {error}")] HttpError { status: http::StatusCode, + headers: reqwest::header::HeaderMap, error: String, }, } @@ -3317,15 +3342,13 @@ fn main() -> Result<()> { /* * Write the Cargo.toml file: */ - let mut uuid_lib = "".to_string(); let mut yup_oauth2_lib = "".to_string(); - if proper_name != "GitHub" { - uuid_lib = r#" + + let uuid_lib = r#" bytes = { version = "1", features = ["serde"] } async-trait = "^0.1.51" uuid = { version = "1.1", features = ["serde", "v4"] }"# - .to_string(); - } + .to_string(); if proper_name.starts_with("Google") { yup_oauth2_lib = r#" @@ -3348,7 +3371,7 @@ edition = "2021" license = "MIT" [features] -default = ["rustls-tls", "reqwest-tracing/opentelemetry_0_17"] +default = ["rustls-tls"] # enable etag-based http_cache functionality httpcache = ["dirs"] native-tls = ["reqwest/default-tls", "openssl"] @@ -3367,10 +3390,10 @@ parse_link_header = "0.3.3" pem = {{ version = "1.1.0", default-features = false, optional = true }} percent-encoding = "2.2" reqwest = {{ version = "0.11.14", default-features = false, features = ["json", "multipart"] }} -reqwest-conditional-middleware = "0.1.0" -reqwest-middleware = "0.1.5" -reqwest-retry = "0.1.4" -reqwest-tracing = "0.3.0" +reqwest-conditional-middleware = "0.2.1" +reqwest-middleware = "0.2.2" +reqwest-retry = "0.2.2" +reqwest-tracing = "0.4.4" ring = {{ version = "0.16", default-features = false, optional = true }} schemars = {{ version = "0.8", features = ["bytes", "chrono", "url", "uuid1"] }} serde = {{ version = "1", features = ["derive"] }} @@ -3378,15 +3401,15 @@ serde_json = "1" serde_urlencoded = "^0.7" url = {{ version = "2", features = ["serde"] }}{}{} thiserror = "1" -tokio = {{ version = "1.25.0", features = ["full"] }} +tokio = {{ version = "1.25.0", default-features = false }} [dev-dependencies] -base64 = "^0.13" +base64 = "^0.21" dirs = "^3.0.2" nom_pem = "4" rand = "0.8.5" rsa = "0.8.1" -tokio = {{ version = "1.25.0", features = ["test-util"] }} +tokio = {{ version = "1.25.0", features = ["full", "test-util"] }} wiremock = "0.5.17" [package.metadata.docs.rs] @@ -3425,14 +3448,29 @@ rustdoc-args = ["--cfg", "docsrs"] &spec_link, ) } - TemplateType::GenericToken => template::generate_docs_generic_token( - &api, - &to_snake_case(&name), - &version, - &proper_name, - &spec_link, - &add_post_header, - ), + TemplateType::GenericToken => { + if proper_name == "Gusto" { + template::generate_docs_generic_token( + &api, + &to_snake_case(&name), + &version, + &proper_name, + &spec_link, + &add_post_header, + &format!("{}::RootProductionServer", to_snake_case(&name)), + ) + } else { + template::generate_docs_generic_token( + &api, + &to_snake_case(&name), + &version, + &proper_name, + &spec_link, + &add_post_header, + "", + ) + } + } }; let mut readme = root.clone(); diff --git a/generator/src/template.rs b/generator/src/template.rs index e0aa23d3..f333027c 100644 --- a/generator/src/template.rs +++ b/generator/src/template.rs @@ -9,6 +9,15 @@ enum Component { Parameter(String), } +impl Component { + fn is_command(&self) -> bool { + match self { + Self::Constant(c) => c.starts_with(':'), + _ => false, + } + } +} + #[derive(Eq, PartialEq, Clone, Debug)] pub struct Template { components: Vec, @@ -121,7 +130,10 @@ impl Template { out.push_str("&format!(\""); for c in self.components.iter() { - out.push('/'); + if !c.is_command() { + out.push('/'); + } + match c { Component::Constant(n) => out.push_str(n), Component::Parameter(_) => { @@ -176,7 +188,7 @@ fn parse_inner(t: &str) -> Result