A wrapper around reqwest to make working with Pocketbase a breeze

Add first version of the reqwest wrapper crate for pocketbase

dekker.one 8993706a

+2463
+1
.gitignore
··· 1 + /target
+1614
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "addr2line" 7 + version = "0.24.2" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" 10 + dependencies = [ 11 + "gimli", 12 + ] 13 + 14 + [[package]] 15 + name = "adler2" 16 + version = "2.0.0" 17 + source = "registry+https://github.com/rust-lang/crates.io-index" 18 + checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 19 + 20 + [[package]] 21 + name = "atomic-waker" 22 + version = "1.1.2" 23 + source = "registry+https://github.com/rust-lang/crates.io-index" 24 + checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 25 + 26 + [[package]] 27 + name = "autocfg" 28 + version = "1.4.0" 29 + source = "registry+https://github.com/rust-lang/crates.io-index" 30 + checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 31 + 32 + [[package]] 33 + name = "backtrace" 34 + version = "0.3.74" 35 + source = "registry+https://github.com/rust-lang/crates.io-index" 36 + checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" 37 + dependencies = [ 38 + "addr2line", 39 + "cfg-if", 40 + "libc", 41 + "miniz_oxide", 42 + "object", 43 + "rustc-demangle", 44 + "windows-targets 0.52.6", 45 + ] 46 + 47 + [[package]] 48 + name = "base64" 49 + version = "0.22.1" 50 + source = "registry+https://github.com/rust-lang/crates.io-index" 51 + checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 52 + 53 + [[package]] 54 + name = "bitflags" 55 + version = "2.9.0" 56 + source = "registry+https://github.com/rust-lang/crates.io-index" 57 + checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" 58 + 59 + [[package]] 60 + name = "bumpalo" 61 + version = "3.17.0" 62 + source = "registry+https://github.com/rust-lang/crates.io-index" 63 + checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" 64 + 65 + [[package]] 66 + name = "bytes" 67 + version = "1.10.1" 68 + source = "registry+https://github.com/rust-lang/crates.io-index" 69 + checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" 70 + 71 + [[package]] 72 + name = "cc" 73 + version = "1.2.17" 74 + source = "registry+https://github.com/rust-lang/crates.io-index" 75 + checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" 76 + dependencies = [ 77 + "shlex", 78 + ] 79 + 80 + [[package]] 81 + name = "cfg-if" 82 + version = "1.0.0" 83 + source = "registry+https://github.com/rust-lang/crates.io-index" 84 + checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 85 + 86 + [[package]] 87 + name = "core-foundation" 88 + version = "0.9.4" 89 + source = "registry+https://github.com/rust-lang/crates.io-index" 90 + checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 91 + dependencies = [ 92 + "core-foundation-sys", 93 + "libc", 94 + ] 95 + 96 + [[package]] 97 + name = "core-foundation-sys" 98 + version = "0.8.7" 99 + source = "registry+https://github.com/rust-lang/crates.io-index" 100 + checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 101 + 102 + [[package]] 103 + name = "displaydoc" 104 + version = "0.2.5" 105 + source = "registry+https://github.com/rust-lang/crates.io-index" 106 + checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" 107 + dependencies = [ 108 + "proc-macro2", 109 + "quote", 110 + "syn", 111 + ] 112 + 113 + [[package]] 114 + name = "encoding_rs" 115 + version = "0.8.35" 116 + source = "registry+https://github.com/rust-lang/crates.io-index" 117 + checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 118 + dependencies = [ 119 + "cfg-if", 120 + ] 121 + 122 + [[package]] 123 + name = "equivalent" 124 + version = "1.0.2" 125 + source = "registry+https://github.com/rust-lang/crates.io-index" 126 + checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 127 + 128 + [[package]] 129 + name = "errno" 130 + version = "0.3.10" 131 + source = "registry+https://github.com/rust-lang/crates.io-index" 132 + checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 133 + dependencies = [ 134 + "libc", 135 + "windows-sys 0.59.0", 136 + ] 137 + 138 + [[package]] 139 + name = "fastrand" 140 + version = "2.3.0" 141 + source = "registry+https://github.com/rust-lang/crates.io-index" 142 + checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 143 + 144 + [[package]] 145 + name = "fnv" 146 + version = "1.0.7" 147 + source = "registry+https://github.com/rust-lang/crates.io-index" 148 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 149 + 150 + [[package]] 151 + name = "foreign-types" 152 + version = "0.3.2" 153 + source = "registry+https://github.com/rust-lang/crates.io-index" 154 + checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 155 + dependencies = [ 156 + "foreign-types-shared", 157 + ] 158 + 159 + [[package]] 160 + name = "foreign-types-shared" 161 + version = "0.1.1" 162 + source = "registry+https://github.com/rust-lang/crates.io-index" 163 + checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 164 + 165 + [[package]] 166 + name = "form_urlencoded" 167 + version = "1.2.1" 168 + source = "registry+https://github.com/rust-lang/crates.io-index" 169 + checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 170 + dependencies = [ 171 + "percent-encoding", 172 + ] 173 + 174 + [[package]] 175 + name = "futures-channel" 176 + version = "0.3.31" 177 + source = "registry+https://github.com/rust-lang/crates.io-index" 178 + checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 179 + dependencies = [ 180 + "futures-core", 181 + ] 182 + 183 + [[package]] 184 + name = "futures-core" 185 + version = "0.3.31" 186 + source = "registry+https://github.com/rust-lang/crates.io-index" 187 + checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 188 + 189 + [[package]] 190 + name = "futures-sink" 191 + version = "0.3.31" 192 + source = "registry+https://github.com/rust-lang/crates.io-index" 193 + checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 194 + 195 + [[package]] 196 + name = "futures-task" 197 + version = "0.3.31" 198 + source = "registry+https://github.com/rust-lang/crates.io-index" 199 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 200 + 201 + [[package]] 202 + name = "futures-util" 203 + version = "0.3.31" 204 + source = "registry+https://github.com/rust-lang/crates.io-index" 205 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 206 + dependencies = [ 207 + "futures-core", 208 + "futures-task", 209 + "pin-project-lite", 210 + "pin-utils", 211 + ] 212 + 213 + [[package]] 214 + name = "getrandom" 215 + version = "0.2.15" 216 + source = "registry+https://github.com/rust-lang/crates.io-index" 217 + checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 218 + dependencies = [ 219 + "cfg-if", 220 + "libc", 221 + "wasi 0.11.0+wasi-snapshot-preview1", 222 + ] 223 + 224 + [[package]] 225 + name = "getrandom" 226 + version = "0.3.2" 227 + source = "registry+https://github.com/rust-lang/crates.io-index" 228 + checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" 229 + dependencies = [ 230 + "cfg-if", 231 + "libc", 232 + "r-efi", 233 + "wasi 0.14.2+wasi-0.2.4", 234 + ] 235 + 236 + [[package]] 237 + name = "gimli" 238 + version = "0.31.1" 239 + source = "registry+https://github.com/rust-lang/crates.io-index" 240 + checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" 241 + 242 + [[package]] 243 + name = "h2" 244 + version = "0.4.8" 245 + source = "registry+https://github.com/rust-lang/crates.io-index" 246 + checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" 247 + dependencies = [ 248 + "atomic-waker", 249 + "bytes", 250 + "fnv", 251 + "futures-core", 252 + "futures-sink", 253 + "http", 254 + "indexmap", 255 + "slab", 256 + "tokio", 257 + "tokio-util", 258 + "tracing", 259 + ] 260 + 261 + [[package]] 262 + name = "hashbrown" 263 + version = "0.15.2" 264 + source = "registry+https://github.com/rust-lang/crates.io-index" 265 + checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" 266 + 267 + [[package]] 268 + name = "http" 269 + version = "1.3.1" 270 + source = "registry+https://github.com/rust-lang/crates.io-index" 271 + checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" 272 + dependencies = [ 273 + "bytes", 274 + "fnv", 275 + "itoa", 276 + ] 277 + 278 + [[package]] 279 + name = "http-body" 280 + version = "1.0.1" 281 + source = "registry+https://github.com/rust-lang/crates.io-index" 282 + checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" 283 + dependencies = [ 284 + "bytes", 285 + "http", 286 + ] 287 + 288 + [[package]] 289 + name = "http-body-util" 290 + version = "0.1.3" 291 + source = "registry+https://github.com/rust-lang/crates.io-index" 292 + checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" 293 + dependencies = [ 294 + "bytes", 295 + "futures-core", 296 + "http", 297 + "http-body", 298 + "pin-project-lite", 299 + ] 300 + 301 + [[package]] 302 + name = "httparse" 303 + version = "1.10.1" 304 + source = "registry+https://github.com/rust-lang/crates.io-index" 305 + checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" 306 + 307 + [[package]] 308 + name = "hyper" 309 + version = "1.6.0" 310 + source = "registry+https://github.com/rust-lang/crates.io-index" 311 + checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" 312 + dependencies = [ 313 + "bytes", 314 + "futures-channel", 315 + "futures-util", 316 + "h2", 317 + "http", 318 + "http-body", 319 + "httparse", 320 + "itoa", 321 + "pin-project-lite", 322 + "smallvec", 323 + "tokio", 324 + "want", 325 + ] 326 + 327 + [[package]] 328 + name = "hyper-rustls" 329 + version = "0.27.5" 330 + source = "registry+https://github.com/rust-lang/crates.io-index" 331 + checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" 332 + dependencies = [ 333 + "futures-util", 334 + "http", 335 + "hyper", 336 + "hyper-util", 337 + "rustls", 338 + "rustls-pki-types", 339 + "tokio", 340 + "tokio-rustls", 341 + "tower-service", 342 + ] 343 + 344 + [[package]] 345 + name = "hyper-tls" 346 + version = "0.6.0" 347 + source = "registry+https://github.com/rust-lang/crates.io-index" 348 + checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 349 + dependencies = [ 350 + "bytes", 351 + "http-body-util", 352 + "hyper", 353 + "hyper-util", 354 + "native-tls", 355 + "tokio", 356 + "tokio-native-tls", 357 + "tower-service", 358 + ] 359 + 360 + [[package]] 361 + name = "hyper-util" 362 + version = "0.1.10" 363 + source = "registry+https://github.com/rust-lang/crates.io-index" 364 + checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" 365 + dependencies = [ 366 + "bytes", 367 + "futures-channel", 368 + "futures-util", 369 + "http", 370 + "http-body", 371 + "hyper", 372 + "pin-project-lite", 373 + "socket2", 374 + "tokio", 375 + "tower-service", 376 + "tracing", 377 + ] 378 + 379 + [[package]] 380 + name = "icu_collections" 381 + version = "1.5.0" 382 + source = "registry+https://github.com/rust-lang/crates.io-index" 383 + checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" 384 + dependencies = [ 385 + "displaydoc", 386 + "yoke", 387 + "zerofrom", 388 + "zerovec", 389 + ] 390 + 391 + [[package]] 392 + name = "icu_locid" 393 + version = "1.5.0" 394 + source = "registry+https://github.com/rust-lang/crates.io-index" 395 + checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" 396 + dependencies = [ 397 + "displaydoc", 398 + "litemap", 399 + "tinystr", 400 + "writeable", 401 + "zerovec", 402 + ] 403 + 404 + [[package]] 405 + name = "icu_locid_transform" 406 + version = "1.5.0" 407 + source = "registry+https://github.com/rust-lang/crates.io-index" 408 + checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" 409 + dependencies = [ 410 + "displaydoc", 411 + "icu_locid", 412 + "icu_locid_transform_data", 413 + "icu_provider", 414 + "tinystr", 415 + "zerovec", 416 + ] 417 + 418 + [[package]] 419 + name = "icu_locid_transform_data" 420 + version = "1.5.0" 421 + source = "registry+https://github.com/rust-lang/crates.io-index" 422 + checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" 423 + 424 + [[package]] 425 + name = "icu_normalizer" 426 + version = "1.5.0" 427 + source = "registry+https://github.com/rust-lang/crates.io-index" 428 + checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" 429 + dependencies = [ 430 + "displaydoc", 431 + "icu_collections", 432 + "icu_normalizer_data", 433 + "icu_properties", 434 + "icu_provider", 435 + "smallvec", 436 + "utf16_iter", 437 + "utf8_iter", 438 + "write16", 439 + "zerovec", 440 + ] 441 + 442 + [[package]] 443 + name = "icu_normalizer_data" 444 + version = "1.5.0" 445 + source = "registry+https://github.com/rust-lang/crates.io-index" 446 + checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" 447 + 448 + [[package]] 449 + name = "icu_properties" 450 + version = "1.5.1" 451 + source = "registry+https://github.com/rust-lang/crates.io-index" 452 + checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" 453 + dependencies = [ 454 + "displaydoc", 455 + "icu_collections", 456 + "icu_locid_transform", 457 + "icu_properties_data", 458 + "icu_provider", 459 + "tinystr", 460 + "zerovec", 461 + ] 462 + 463 + [[package]] 464 + name = "icu_properties_data" 465 + version = "1.5.0" 466 + source = "registry+https://github.com/rust-lang/crates.io-index" 467 + checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" 468 + 469 + [[package]] 470 + name = "icu_provider" 471 + version = "1.5.0" 472 + source = "registry+https://github.com/rust-lang/crates.io-index" 473 + checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" 474 + dependencies = [ 475 + "displaydoc", 476 + "icu_locid", 477 + "icu_provider_macros", 478 + "stable_deref_trait", 479 + "tinystr", 480 + "writeable", 481 + "yoke", 482 + "zerofrom", 483 + "zerovec", 484 + ] 485 + 486 + [[package]] 487 + name = "icu_provider_macros" 488 + version = "1.5.0" 489 + source = "registry+https://github.com/rust-lang/crates.io-index" 490 + checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" 491 + dependencies = [ 492 + "proc-macro2", 493 + "quote", 494 + "syn", 495 + ] 496 + 497 + [[package]] 498 + name = "idna" 499 + version = "1.0.3" 500 + source = "registry+https://github.com/rust-lang/crates.io-index" 501 + checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" 502 + dependencies = [ 503 + "idna_adapter", 504 + "smallvec", 505 + "utf8_iter", 506 + ] 507 + 508 + [[package]] 509 + name = "idna_adapter" 510 + version = "1.2.0" 511 + source = "registry+https://github.com/rust-lang/crates.io-index" 512 + checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" 513 + dependencies = [ 514 + "icu_normalizer", 515 + "icu_properties", 516 + ] 517 + 518 + [[package]] 519 + name = "indexmap" 520 + version = "2.8.0" 521 + source = "registry+https://github.com/rust-lang/crates.io-index" 522 + checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" 523 + dependencies = [ 524 + "equivalent", 525 + "hashbrown", 526 + ] 527 + 528 + [[package]] 529 + name = "ipnet" 530 + version = "2.11.0" 531 + source = "registry+https://github.com/rust-lang/crates.io-index" 532 + checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" 533 + 534 + [[package]] 535 + name = "itoa" 536 + version = "1.0.15" 537 + source = "registry+https://github.com/rust-lang/crates.io-index" 538 + checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" 539 + 540 + [[package]] 541 + name = "js-sys" 542 + version = "0.3.77" 543 + source = "registry+https://github.com/rust-lang/crates.io-index" 544 + checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" 545 + dependencies = [ 546 + "once_cell", 547 + "wasm-bindgen", 548 + ] 549 + 550 + [[package]] 551 + name = "libc" 552 + version = "0.2.171" 553 + source = "registry+https://github.com/rust-lang/crates.io-index" 554 + checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" 555 + 556 + [[package]] 557 + name = "linux-raw-sys" 558 + version = "0.9.3" 559 + source = "registry+https://github.com/rust-lang/crates.io-index" 560 + checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" 561 + 562 + [[package]] 563 + name = "litemap" 564 + version = "0.7.5" 565 + source = "registry+https://github.com/rust-lang/crates.io-index" 566 + checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" 567 + 568 + [[package]] 569 + name = "log" 570 + version = "0.4.26" 571 + source = "registry+https://github.com/rust-lang/crates.io-index" 572 + checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" 573 + 574 + [[package]] 575 + name = "memchr" 576 + version = "2.7.4" 577 + source = "registry+https://github.com/rust-lang/crates.io-index" 578 + checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 579 + 580 + [[package]] 581 + name = "mime" 582 + version = "0.3.17" 583 + source = "registry+https://github.com/rust-lang/crates.io-index" 584 + checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 585 + 586 + [[package]] 587 + name = "miniz_oxide" 588 + version = "0.8.5" 589 + source = "registry+https://github.com/rust-lang/crates.io-index" 590 + checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" 591 + dependencies = [ 592 + "adler2", 593 + ] 594 + 595 + [[package]] 596 + name = "mio" 597 + version = "1.0.3" 598 + source = "registry+https://github.com/rust-lang/crates.io-index" 599 + checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" 600 + dependencies = [ 601 + "libc", 602 + "wasi 0.11.0+wasi-snapshot-preview1", 603 + "windows-sys 0.52.0", 604 + ] 605 + 606 + [[package]] 607 + name = "native-tls" 608 + version = "0.2.14" 609 + source = "registry+https://github.com/rust-lang/crates.io-index" 610 + checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" 611 + dependencies = [ 612 + "libc", 613 + "log", 614 + "openssl", 615 + "openssl-probe", 616 + "openssl-sys", 617 + "schannel", 618 + "security-framework", 619 + "security-framework-sys", 620 + "tempfile", 621 + ] 622 + 623 + [[package]] 624 + name = "object" 625 + version = "0.36.7" 626 + source = "registry+https://github.com/rust-lang/crates.io-index" 627 + checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" 628 + dependencies = [ 629 + "memchr", 630 + ] 631 + 632 + [[package]] 633 + name = "once_cell" 634 + version = "1.21.1" 635 + source = "registry+https://github.com/rust-lang/crates.io-index" 636 + checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" 637 + 638 + [[package]] 639 + name = "openssl" 640 + version = "0.10.71" 641 + source = "registry+https://github.com/rust-lang/crates.io-index" 642 + checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" 643 + dependencies = [ 644 + "bitflags", 645 + "cfg-if", 646 + "foreign-types", 647 + "libc", 648 + "once_cell", 649 + "openssl-macros", 650 + "openssl-sys", 651 + ] 652 + 653 + [[package]] 654 + name = "openssl-macros" 655 + version = "0.1.1" 656 + source = "registry+https://github.com/rust-lang/crates.io-index" 657 + checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 658 + dependencies = [ 659 + "proc-macro2", 660 + "quote", 661 + "syn", 662 + ] 663 + 664 + [[package]] 665 + name = "openssl-probe" 666 + version = "0.1.6" 667 + source = "registry+https://github.com/rust-lang/crates.io-index" 668 + checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" 669 + 670 + [[package]] 671 + name = "openssl-sys" 672 + version = "0.9.106" 673 + source = "registry+https://github.com/rust-lang/crates.io-index" 674 + checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" 675 + dependencies = [ 676 + "cc", 677 + "libc", 678 + "pkg-config", 679 + "vcpkg", 680 + ] 681 + 682 + [[package]] 683 + name = "percent-encoding" 684 + version = "2.3.1" 685 + source = "registry+https://github.com/rust-lang/crates.io-index" 686 + checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 687 + 688 + [[package]] 689 + name = "pin-project-lite" 690 + version = "0.2.16" 691 + source = "registry+https://github.com/rust-lang/crates.io-index" 692 + checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 693 + 694 + [[package]] 695 + name = "pin-utils" 696 + version = "0.1.0" 697 + source = "registry+https://github.com/rust-lang/crates.io-index" 698 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 699 + 700 + [[package]] 701 + name = "pkg-config" 702 + version = "0.3.32" 703 + source = "registry+https://github.com/rust-lang/crates.io-index" 704 + checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" 705 + 706 + [[package]] 707 + name = "pocketbase-reqwest" 708 + version = "0.1.0" 709 + dependencies = [ 710 + "base64", 711 + "reqwest", 712 + "serde", 713 + "serde_json", 714 + "thiserror", 715 + "url", 716 + "web-time", 717 + ] 718 + 719 + [[package]] 720 + name = "proc-macro2" 721 + version = "1.0.94" 722 + source = "registry+https://github.com/rust-lang/crates.io-index" 723 + checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" 724 + dependencies = [ 725 + "unicode-ident", 726 + ] 727 + 728 + [[package]] 729 + name = "quote" 730 + version = "1.0.40" 731 + source = "registry+https://github.com/rust-lang/crates.io-index" 732 + checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 733 + dependencies = [ 734 + "proc-macro2", 735 + ] 736 + 737 + [[package]] 738 + name = "r-efi" 739 + version = "5.2.0" 740 + source = "registry+https://github.com/rust-lang/crates.io-index" 741 + checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" 742 + 743 + [[package]] 744 + name = "reqwest" 745 + version = "0.12.15" 746 + source = "registry+https://github.com/rust-lang/crates.io-index" 747 + checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" 748 + dependencies = [ 749 + "base64", 750 + "bytes", 751 + "encoding_rs", 752 + "futures-core", 753 + "futures-util", 754 + "h2", 755 + "http", 756 + "http-body", 757 + "http-body-util", 758 + "hyper", 759 + "hyper-rustls", 760 + "hyper-tls", 761 + "hyper-util", 762 + "ipnet", 763 + "js-sys", 764 + "log", 765 + "mime", 766 + "native-tls", 767 + "once_cell", 768 + "percent-encoding", 769 + "pin-project-lite", 770 + "rustls-pemfile", 771 + "serde", 772 + "serde_json", 773 + "serde_urlencoded", 774 + "sync_wrapper", 775 + "system-configuration", 776 + "tokio", 777 + "tokio-native-tls", 778 + "tower", 779 + "tower-service", 780 + "url", 781 + "wasm-bindgen", 782 + "wasm-bindgen-futures", 783 + "web-sys", 784 + "windows-registry", 785 + ] 786 + 787 + [[package]] 788 + name = "ring" 789 + version = "0.17.14" 790 + source = "registry+https://github.com/rust-lang/crates.io-index" 791 + checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" 792 + dependencies = [ 793 + "cc", 794 + "cfg-if", 795 + "getrandom 0.2.15", 796 + "libc", 797 + "untrusted", 798 + "windows-sys 0.52.0", 799 + ] 800 + 801 + [[package]] 802 + name = "rustc-demangle" 803 + version = "0.1.24" 804 + source = "registry+https://github.com/rust-lang/crates.io-index" 805 + checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 806 + 807 + [[package]] 808 + name = "rustix" 809 + version = "1.0.3" 810 + source = "registry+https://github.com/rust-lang/crates.io-index" 811 + checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" 812 + dependencies = [ 813 + "bitflags", 814 + "errno", 815 + "libc", 816 + "linux-raw-sys", 817 + "windows-sys 0.59.0", 818 + ] 819 + 820 + [[package]] 821 + name = "rustls" 822 + version = "0.23.25" 823 + source = "registry+https://github.com/rust-lang/crates.io-index" 824 + checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" 825 + dependencies = [ 826 + "once_cell", 827 + "rustls-pki-types", 828 + "rustls-webpki", 829 + "subtle", 830 + "zeroize", 831 + ] 832 + 833 + [[package]] 834 + name = "rustls-pemfile" 835 + version = "2.2.0" 836 + source = "registry+https://github.com/rust-lang/crates.io-index" 837 + checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" 838 + dependencies = [ 839 + "rustls-pki-types", 840 + ] 841 + 842 + [[package]] 843 + name = "rustls-pki-types" 844 + version = "1.11.0" 845 + source = "registry+https://github.com/rust-lang/crates.io-index" 846 + checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" 847 + 848 + [[package]] 849 + name = "rustls-webpki" 850 + version = "0.103.0" 851 + source = "registry+https://github.com/rust-lang/crates.io-index" 852 + checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" 853 + dependencies = [ 854 + "ring", 855 + "rustls-pki-types", 856 + "untrusted", 857 + ] 858 + 859 + [[package]] 860 + name = "rustversion" 861 + version = "1.0.20" 862 + source = "registry+https://github.com/rust-lang/crates.io-index" 863 + checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" 864 + 865 + [[package]] 866 + name = "ryu" 867 + version = "1.0.20" 868 + source = "registry+https://github.com/rust-lang/crates.io-index" 869 + checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" 870 + 871 + [[package]] 872 + name = "schannel" 873 + version = "0.1.27" 874 + source = "registry+https://github.com/rust-lang/crates.io-index" 875 + checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" 876 + dependencies = [ 877 + "windows-sys 0.59.0", 878 + ] 879 + 880 + [[package]] 881 + name = "security-framework" 882 + version = "2.11.1" 883 + source = "registry+https://github.com/rust-lang/crates.io-index" 884 + checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" 885 + dependencies = [ 886 + "bitflags", 887 + "core-foundation", 888 + "core-foundation-sys", 889 + "libc", 890 + "security-framework-sys", 891 + ] 892 + 893 + [[package]] 894 + name = "security-framework-sys" 895 + version = "2.14.0" 896 + source = "registry+https://github.com/rust-lang/crates.io-index" 897 + checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" 898 + dependencies = [ 899 + "core-foundation-sys", 900 + "libc", 901 + ] 902 + 903 + [[package]] 904 + name = "serde" 905 + version = "1.0.219" 906 + source = "registry+https://github.com/rust-lang/crates.io-index" 907 + checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" 908 + dependencies = [ 909 + "serde_derive", 910 + ] 911 + 912 + [[package]] 913 + name = "serde_derive" 914 + version = "1.0.219" 915 + source = "registry+https://github.com/rust-lang/crates.io-index" 916 + checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" 917 + dependencies = [ 918 + "proc-macro2", 919 + "quote", 920 + "syn", 921 + ] 922 + 923 + [[package]] 924 + name = "serde_json" 925 + version = "1.0.140" 926 + source = "registry+https://github.com/rust-lang/crates.io-index" 927 + checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" 928 + dependencies = [ 929 + "itoa", 930 + "memchr", 931 + "ryu", 932 + "serde", 933 + ] 934 + 935 + [[package]] 936 + name = "serde_urlencoded" 937 + version = "0.7.1" 938 + source = "registry+https://github.com/rust-lang/crates.io-index" 939 + checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 940 + dependencies = [ 941 + "form_urlencoded", 942 + "itoa", 943 + "ryu", 944 + "serde", 945 + ] 946 + 947 + [[package]] 948 + name = "shlex" 949 + version = "1.3.0" 950 + source = "registry+https://github.com/rust-lang/crates.io-index" 951 + checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 952 + 953 + [[package]] 954 + name = "slab" 955 + version = "0.4.9" 956 + source = "registry+https://github.com/rust-lang/crates.io-index" 957 + checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 958 + dependencies = [ 959 + "autocfg", 960 + ] 961 + 962 + [[package]] 963 + name = "smallvec" 964 + version = "1.14.0" 965 + source = "registry+https://github.com/rust-lang/crates.io-index" 966 + checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" 967 + 968 + [[package]] 969 + name = "socket2" 970 + version = "0.5.8" 971 + source = "registry+https://github.com/rust-lang/crates.io-index" 972 + checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" 973 + dependencies = [ 974 + "libc", 975 + "windows-sys 0.52.0", 976 + ] 977 + 978 + [[package]] 979 + name = "stable_deref_trait" 980 + version = "1.2.0" 981 + source = "registry+https://github.com/rust-lang/crates.io-index" 982 + checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 983 + 984 + [[package]] 985 + name = "subtle" 986 + version = "2.6.1" 987 + source = "registry+https://github.com/rust-lang/crates.io-index" 988 + checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 989 + 990 + [[package]] 991 + name = "syn" 992 + version = "2.0.100" 993 + source = "registry+https://github.com/rust-lang/crates.io-index" 994 + checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" 995 + dependencies = [ 996 + "proc-macro2", 997 + "quote", 998 + "unicode-ident", 999 + ] 1000 + 1001 + [[package]] 1002 + name = "sync_wrapper" 1003 + version = "1.0.2" 1004 + source = "registry+https://github.com/rust-lang/crates.io-index" 1005 + checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 1006 + dependencies = [ 1007 + "futures-core", 1008 + ] 1009 + 1010 + [[package]] 1011 + name = "synstructure" 1012 + version = "0.13.1" 1013 + source = "registry+https://github.com/rust-lang/crates.io-index" 1014 + checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" 1015 + dependencies = [ 1016 + "proc-macro2", 1017 + "quote", 1018 + "syn", 1019 + ] 1020 + 1021 + [[package]] 1022 + name = "system-configuration" 1023 + version = "0.6.1" 1024 + source = "registry+https://github.com/rust-lang/crates.io-index" 1025 + checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" 1026 + dependencies = [ 1027 + "bitflags", 1028 + "core-foundation", 1029 + "system-configuration-sys", 1030 + ] 1031 + 1032 + [[package]] 1033 + name = "system-configuration-sys" 1034 + version = "0.6.0" 1035 + source = "registry+https://github.com/rust-lang/crates.io-index" 1036 + checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" 1037 + dependencies = [ 1038 + "core-foundation-sys", 1039 + "libc", 1040 + ] 1041 + 1042 + [[package]] 1043 + name = "tempfile" 1044 + version = "3.19.1" 1045 + source = "registry+https://github.com/rust-lang/crates.io-index" 1046 + checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" 1047 + dependencies = [ 1048 + "fastrand", 1049 + "getrandom 0.3.2", 1050 + "once_cell", 1051 + "rustix", 1052 + "windows-sys 0.59.0", 1053 + ] 1054 + 1055 + [[package]] 1056 + name = "thiserror" 1057 + version = "2.0.12" 1058 + source = "registry+https://github.com/rust-lang/crates.io-index" 1059 + checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" 1060 + dependencies = [ 1061 + "thiserror-impl", 1062 + ] 1063 + 1064 + [[package]] 1065 + name = "thiserror-impl" 1066 + version = "2.0.12" 1067 + source = "registry+https://github.com/rust-lang/crates.io-index" 1068 + checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" 1069 + dependencies = [ 1070 + "proc-macro2", 1071 + "quote", 1072 + "syn", 1073 + ] 1074 + 1075 + [[package]] 1076 + name = "tinystr" 1077 + version = "0.7.6" 1078 + source = "registry+https://github.com/rust-lang/crates.io-index" 1079 + checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" 1080 + dependencies = [ 1081 + "displaydoc", 1082 + "zerovec", 1083 + ] 1084 + 1085 + [[package]] 1086 + name = "tokio" 1087 + version = "1.44.1" 1088 + source = "registry+https://github.com/rust-lang/crates.io-index" 1089 + checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" 1090 + dependencies = [ 1091 + "backtrace", 1092 + "bytes", 1093 + "libc", 1094 + "mio", 1095 + "pin-project-lite", 1096 + "socket2", 1097 + "windows-sys 0.52.0", 1098 + ] 1099 + 1100 + [[package]] 1101 + name = "tokio-native-tls" 1102 + version = "0.3.1" 1103 + source = "registry+https://github.com/rust-lang/crates.io-index" 1104 + checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1105 + dependencies = [ 1106 + "native-tls", 1107 + "tokio", 1108 + ] 1109 + 1110 + [[package]] 1111 + name = "tokio-rustls" 1112 + version = "0.26.2" 1113 + source = "registry+https://github.com/rust-lang/crates.io-index" 1114 + checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" 1115 + dependencies = [ 1116 + "rustls", 1117 + "tokio", 1118 + ] 1119 + 1120 + [[package]] 1121 + name = "tokio-util" 1122 + version = "0.7.14" 1123 + source = "registry+https://github.com/rust-lang/crates.io-index" 1124 + checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" 1125 + dependencies = [ 1126 + "bytes", 1127 + "futures-core", 1128 + "futures-sink", 1129 + "pin-project-lite", 1130 + "tokio", 1131 + ] 1132 + 1133 + [[package]] 1134 + name = "tower" 1135 + version = "0.5.2" 1136 + source = "registry+https://github.com/rust-lang/crates.io-index" 1137 + checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" 1138 + dependencies = [ 1139 + "futures-core", 1140 + "futures-util", 1141 + "pin-project-lite", 1142 + "sync_wrapper", 1143 + "tokio", 1144 + "tower-layer", 1145 + "tower-service", 1146 + ] 1147 + 1148 + [[package]] 1149 + name = "tower-layer" 1150 + version = "0.3.3" 1151 + source = "registry+https://github.com/rust-lang/crates.io-index" 1152 + checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" 1153 + 1154 + [[package]] 1155 + name = "tower-service" 1156 + version = "0.3.3" 1157 + source = "registry+https://github.com/rust-lang/crates.io-index" 1158 + checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" 1159 + 1160 + [[package]] 1161 + name = "tracing" 1162 + version = "0.1.41" 1163 + source = "registry+https://github.com/rust-lang/crates.io-index" 1164 + checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 1165 + dependencies = [ 1166 + "pin-project-lite", 1167 + "tracing-core", 1168 + ] 1169 + 1170 + [[package]] 1171 + name = "tracing-core" 1172 + version = "0.1.33" 1173 + source = "registry+https://github.com/rust-lang/crates.io-index" 1174 + checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" 1175 + dependencies = [ 1176 + "once_cell", 1177 + ] 1178 + 1179 + [[package]] 1180 + name = "try-lock" 1181 + version = "0.2.5" 1182 + source = "registry+https://github.com/rust-lang/crates.io-index" 1183 + checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1184 + 1185 + [[package]] 1186 + name = "unicode-ident" 1187 + version = "1.0.18" 1188 + source = "registry+https://github.com/rust-lang/crates.io-index" 1189 + checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 1190 + 1191 + [[package]] 1192 + name = "untrusted" 1193 + version = "0.9.0" 1194 + source = "registry+https://github.com/rust-lang/crates.io-index" 1195 + checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 1196 + 1197 + [[package]] 1198 + name = "url" 1199 + version = "2.5.4" 1200 + source = "registry+https://github.com/rust-lang/crates.io-index" 1201 + checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" 1202 + dependencies = [ 1203 + "form_urlencoded", 1204 + "idna", 1205 + "percent-encoding", 1206 + ] 1207 + 1208 + [[package]] 1209 + name = "utf16_iter" 1210 + version = "1.0.5" 1211 + source = "registry+https://github.com/rust-lang/crates.io-index" 1212 + checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" 1213 + 1214 + [[package]] 1215 + name = "utf8_iter" 1216 + version = "1.0.4" 1217 + source = "registry+https://github.com/rust-lang/crates.io-index" 1218 + checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 1219 + 1220 + [[package]] 1221 + name = "vcpkg" 1222 + version = "0.2.15" 1223 + source = "registry+https://github.com/rust-lang/crates.io-index" 1224 + checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1225 + 1226 + [[package]] 1227 + name = "want" 1228 + version = "0.3.1" 1229 + source = "registry+https://github.com/rust-lang/crates.io-index" 1230 + checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1231 + dependencies = [ 1232 + "try-lock", 1233 + ] 1234 + 1235 + [[package]] 1236 + name = "wasi" 1237 + version = "0.11.0+wasi-snapshot-preview1" 1238 + source = "registry+https://github.com/rust-lang/crates.io-index" 1239 + checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1240 + 1241 + [[package]] 1242 + name = "wasi" 1243 + version = "0.14.2+wasi-0.2.4" 1244 + source = "registry+https://github.com/rust-lang/crates.io-index" 1245 + checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" 1246 + dependencies = [ 1247 + "wit-bindgen-rt", 1248 + ] 1249 + 1250 + [[package]] 1251 + name = "wasm-bindgen" 1252 + version = "0.2.100" 1253 + source = "registry+https://github.com/rust-lang/crates.io-index" 1254 + checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" 1255 + dependencies = [ 1256 + "cfg-if", 1257 + "once_cell", 1258 + "rustversion", 1259 + "wasm-bindgen-macro", 1260 + ] 1261 + 1262 + [[package]] 1263 + name = "wasm-bindgen-backend" 1264 + version = "0.2.100" 1265 + source = "registry+https://github.com/rust-lang/crates.io-index" 1266 + checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" 1267 + dependencies = [ 1268 + "bumpalo", 1269 + "log", 1270 + "proc-macro2", 1271 + "quote", 1272 + "syn", 1273 + "wasm-bindgen-shared", 1274 + ] 1275 + 1276 + [[package]] 1277 + name = "wasm-bindgen-futures" 1278 + version = "0.4.50" 1279 + source = "registry+https://github.com/rust-lang/crates.io-index" 1280 + checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" 1281 + dependencies = [ 1282 + "cfg-if", 1283 + "js-sys", 1284 + "once_cell", 1285 + "wasm-bindgen", 1286 + "web-sys", 1287 + ] 1288 + 1289 + [[package]] 1290 + name = "wasm-bindgen-macro" 1291 + version = "0.2.100" 1292 + source = "registry+https://github.com/rust-lang/crates.io-index" 1293 + checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" 1294 + dependencies = [ 1295 + "quote", 1296 + "wasm-bindgen-macro-support", 1297 + ] 1298 + 1299 + [[package]] 1300 + name = "wasm-bindgen-macro-support" 1301 + version = "0.2.100" 1302 + source = "registry+https://github.com/rust-lang/crates.io-index" 1303 + checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" 1304 + dependencies = [ 1305 + "proc-macro2", 1306 + "quote", 1307 + "syn", 1308 + "wasm-bindgen-backend", 1309 + "wasm-bindgen-shared", 1310 + ] 1311 + 1312 + [[package]] 1313 + name = "wasm-bindgen-shared" 1314 + version = "0.2.100" 1315 + source = "registry+https://github.com/rust-lang/crates.io-index" 1316 + checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" 1317 + dependencies = [ 1318 + "unicode-ident", 1319 + ] 1320 + 1321 + [[package]] 1322 + name = "web-sys" 1323 + version = "0.3.77" 1324 + source = "registry+https://github.com/rust-lang/crates.io-index" 1325 + checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" 1326 + dependencies = [ 1327 + "js-sys", 1328 + "wasm-bindgen", 1329 + ] 1330 + 1331 + [[package]] 1332 + name = "web-time" 1333 + version = "1.1.0" 1334 + source = "registry+https://github.com/rust-lang/crates.io-index" 1335 + checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" 1336 + dependencies = [ 1337 + "js-sys", 1338 + "wasm-bindgen", 1339 + ] 1340 + 1341 + [[package]] 1342 + name = "windows-link" 1343 + version = "0.1.1" 1344 + source = "registry+https://github.com/rust-lang/crates.io-index" 1345 + checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" 1346 + 1347 + [[package]] 1348 + name = "windows-registry" 1349 + version = "0.4.0" 1350 + source = "registry+https://github.com/rust-lang/crates.io-index" 1351 + checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" 1352 + dependencies = [ 1353 + "windows-result", 1354 + "windows-strings", 1355 + "windows-targets 0.53.0", 1356 + ] 1357 + 1358 + [[package]] 1359 + name = "windows-result" 1360 + version = "0.3.2" 1361 + source = "registry+https://github.com/rust-lang/crates.io-index" 1362 + checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" 1363 + dependencies = [ 1364 + "windows-link", 1365 + ] 1366 + 1367 + [[package]] 1368 + name = "windows-strings" 1369 + version = "0.3.1" 1370 + source = "registry+https://github.com/rust-lang/crates.io-index" 1371 + checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" 1372 + dependencies = [ 1373 + "windows-link", 1374 + ] 1375 + 1376 + [[package]] 1377 + name = "windows-sys" 1378 + version = "0.52.0" 1379 + source = "registry+https://github.com/rust-lang/crates.io-index" 1380 + checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1381 + dependencies = [ 1382 + "windows-targets 0.52.6", 1383 + ] 1384 + 1385 + [[package]] 1386 + name = "windows-sys" 1387 + version = "0.59.0" 1388 + source = "registry+https://github.com/rust-lang/crates.io-index" 1389 + checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 1390 + dependencies = [ 1391 + "windows-targets 0.52.6", 1392 + ] 1393 + 1394 + [[package]] 1395 + name = "windows-targets" 1396 + version = "0.52.6" 1397 + source = "registry+https://github.com/rust-lang/crates.io-index" 1398 + checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1399 + dependencies = [ 1400 + "windows_aarch64_gnullvm 0.52.6", 1401 + "windows_aarch64_msvc 0.52.6", 1402 + "windows_i686_gnu 0.52.6", 1403 + "windows_i686_gnullvm 0.52.6", 1404 + "windows_i686_msvc 0.52.6", 1405 + "windows_x86_64_gnu 0.52.6", 1406 + "windows_x86_64_gnullvm 0.52.6", 1407 + "windows_x86_64_msvc 0.52.6", 1408 + ] 1409 + 1410 + [[package]] 1411 + name = "windows-targets" 1412 + version = "0.53.0" 1413 + source = "registry+https://github.com/rust-lang/crates.io-index" 1414 + checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" 1415 + dependencies = [ 1416 + "windows_aarch64_gnullvm 0.53.0", 1417 + "windows_aarch64_msvc 0.53.0", 1418 + "windows_i686_gnu 0.53.0", 1419 + "windows_i686_gnullvm 0.53.0", 1420 + "windows_i686_msvc 0.53.0", 1421 + "windows_x86_64_gnu 0.53.0", 1422 + "windows_x86_64_gnullvm 0.53.0", 1423 + "windows_x86_64_msvc 0.53.0", 1424 + ] 1425 + 1426 + [[package]] 1427 + name = "windows_aarch64_gnullvm" 1428 + version = "0.52.6" 1429 + source = "registry+https://github.com/rust-lang/crates.io-index" 1430 + checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1431 + 1432 + [[package]] 1433 + name = "windows_aarch64_gnullvm" 1434 + version = "0.53.0" 1435 + source = "registry+https://github.com/rust-lang/crates.io-index" 1436 + checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" 1437 + 1438 + [[package]] 1439 + name = "windows_aarch64_msvc" 1440 + version = "0.52.6" 1441 + source = "registry+https://github.com/rust-lang/crates.io-index" 1442 + checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1443 + 1444 + [[package]] 1445 + name = "windows_aarch64_msvc" 1446 + version = "0.53.0" 1447 + source = "registry+https://github.com/rust-lang/crates.io-index" 1448 + checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" 1449 + 1450 + [[package]] 1451 + name = "windows_i686_gnu" 1452 + version = "0.52.6" 1453 + source = "registry+https://github.com/rust-lang/crates.io-index" 1454 + checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1455 + 1456 + [[package]] 1457 + name = "windows_i686_gnu" 1458 + version = "0.53.0" 1459 + source = "registry+https://github.com/rust-lang/crates.io-index" 1460 + checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" 1461 + 1462 + [[package]] 1463 + name = "windows_i686_gnullvm" 1464 + version = "0.52.6" 1465 + source = "registry+https://github.com/rust-lang/crates.io-index" 1466 + checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1467 + 1468 + [[package]] 1469 + name = "windows_i686_gnullvm" 1470 + version = "0.53.0" 1471 + source = "registry+https://github.com/rust-lang/crates.io-index" 1472 + checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" 1473 + 1474 + [[package]] 1475 + name = "windows_i686_msvc" 1476 + version = "0.52.6" 1477 + source = "registry+https://github.com/rust-lang/crates.io-index" 1478 + checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1479 + 1480 + [[package]] 1481 + name = "windows_i686_msvc" 1482 + version = "0.53.0" 1483 + source = "registry+https://github.com/rust-lang/crates.io-index" 1484 + checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" 1485 + 1486 + [[package]] 1487 + name = "windows_x86_64_gnu" 1488 + version = "0.52.6" 1489 + source = "registry+https://github.com/rust-lang/crates.io-index" 1490 + checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1491 + 1492 + [[package]] 1493 + name = "windows_x86_64_gnu" 1494 + version = "0.53.0" 1495 + source = "registry+https://github.com/rust-lang/crates.io-index" 1496 + checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" 1497 + 1498 + [[package]] 1499 + name = "windows_x86_64_gnullvm" 1500 + version = "0.52.6" 1501 + source = "registry+https://github.com/rust-lang/crates.io-index" 1502 + checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1503 + 1504 + [[package]] 1505 + name = "windows_x86_64_gnullvm" 1506 + version = "0.53.0" 1507 + source = "registry+https://github.com/rust-lang/crates.io-index" 1508 + checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" 1509 + 1510 + [[package]] 1511 + name = "windows_x86_64_msvc" 1512 + version = "0.52.6" 1513 + source = "registry+https://github.com/rust-lang/crates.io-index" 1514 + checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1515 + 1516 + [[package]] 1517 + name = "windows_x86_64_msvc" 1518 + version = "0.53.0" 1519 + source = "registry+https://github.com/rust-lang/crates.io-index" 1520 + checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 1521 + 1522 + [[package]] 1523 + name = "wit-bindgen-rt" 1524 + version = "0.39.0" 1525 + source = "registry+https://github.com/rust-lang/crates.io-index" 1526 + checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" 1527 + dependencies = [ 1528 + "bitflags", 1529 + ] 1530 + 1531 + [[package]] 1532 + name = "write16" 1533 + version = "1.0.0" 1534 + source = "registry+https://github.com/rust-lang/crates.io-index" 1535 + checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" 1536 + 1537 + [[package]] 1538 + name = "writeable" 1539 + version = "0.5.5" 1540 + source = "registry+https://github.com/rust-lang/crates.io-index" 1541 + checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" 1542 + 1543 + [[package]] 1544 + name = "yoke" 1545 + version = "0.7.5" 1546 + source = "registry+https://github.com/rust-lang/crates.io-index" 1547 + checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" 1548 + dependencies = [ 1549 + "serde", 1550 + "stable_deref_trait", 1551 + "yoke-derive", 1552 + "zerofrom", 1553 + ] 1554 + 1555 + [[package]] 1556 + name = "yoke-derive" 1557 + version = "0.7.5" 1558 + source = "registry+https://github.com/rust-lang/crates.io-index" 1559 + checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" 1560 + dependencies = [ 1561 + "proc-macro2", 1562 + "quote", 1563 + "syn", 1564 + "synstructure", 1565 + ] 1566 + 1567 + [[package]] 1568 + name = "zerofrom" 1569 + version = "0.1.6" 1570 + source = "registry+https://github.com/rust-lang/crates.io-index" 1571 + checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" 1572 + dependencies = [ 1573 + "zerofrom-derive", 1574 + ] 1575 + 1576 + [[package]] 1577 + name = "zerofrom-derive" 1578 + version = "0.1.6" 1579 + source = "registry+https://github.com/rust-lang/crates.io-index" 1580 + checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" 1581 + dependencies = [ 1582 + "proc-macro2", 1583 + "quote", 1584 + "syn", 1585 + "synstructure", 1586 + ] 1587 + 1588 + [[package]] 1589 + name = "zeroize" 1590 + version = "1.8.1" 1591 + source = "registry+https://github.com/rust-lang/crates.io-index" 1592 + checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 1593 + 1594 + [[package]] 1595 + name = "zerovec" 1596 + version = "0.10.4" 1597 + source = "registry+https://github.com/rust-lang/crates.io-index" 1598 + checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" 1599 + dependencies = [ 1600 + "yoke", 1601 + "zerofrom", 1602 + "zerovec-derive", 1603 + ] 1604 + 1605 + [[package]] 1606 + name = "zerovec-derive" 1607 + version = "0.10.3" 1608 + source = "registry+https://github.com/rust-lang/crates.io-index" 1609 + checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" 1610 + dependencies = [ 1611 + "proc-macro2", 1612 + "quote", 1613 + "syn", 1614 + ]
+15
Cargo.toml
··· 1 + [package] 2 + name = "pocketbase-reqwest" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + base64 = "0.22.1" 8 + reqwest = { version = "0.12.15", features = ["json"] } 9 + serde = { version = "1.0.219", features = ["derive"] } 10 + serde_json = "1.0.140" 11 + thiserror = "2.0.12" 12 + url = "2.5.4" 13 + 14 + [target.'cfg(target_arch = "wasm32")'.dependencies] 15 + web-time = "1.1.0"
+3
rustfmt.toml
··· 1 + hard_tabs = true 2 + imports_granularity = "Crate" 3 + group_imports = "StdExternalCrate"
+191
src/auth.rs
··· 1 + use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD}; 2 + use reqwest::{Method, header::HeaderMap}; 3 + use serde::Deserialize; 4 + use serde_json::{Value, json}; 5 + 6 + use crate::{Error, JsonObject, record::RecordService}; 7 + 8 + #[derive(Debug, Clone)] 9 + pub struct AuthStore { 10 + pub(crate) token: String, 11 + record: RecordModel, 12 + } 13 + 14 + #[derive(Debug, Clone)] 15 + pub struct AuthRefreshBuilder<'a> { 16 + pub(crate) record_service: RecordService<'a>, 17 + pub(crate) expand_fields: Option<&'a str>, 18 + pub(crate) filter_fields: Option<&'a str>, 19 + } 20 + 21 + #[derive(Debug, Clone)] 22 + pub struct AuthWithPasswordBuilder<'a> { 23 + pub(crate) record_service: RecordService<'a>, 24 + pub(crate) identity: &'a str, 25 + pub(crate) password: &'a str, 26 + pub(crate) expand_fields: Option<&'a str>, 27 + pub(crate) filter_fields: Option<&'a str>, 28 + } 29 + 30 + #[derive(Debug, Deserialize, Clone)] 31 + pub struct RecordAuth { 32 + token: String, 33 + record: RecordModel, 34 + } 35 + 36 + #[derive(Debug, Deserialize, Clone)] 37 + #[serde(transparent)] 38 + pub struct RecordModel { 39 + data: JsonObject, 40 + } 41 + 42 + #[cfg(target_arch = "wasm32")] 43 + fn time_since_unix_epoch() -> u64 { 44 + use web_time::{SystemTime, UNIX_EPOCH}; 45 + 46 + SystemTime::now() 47 + .duration_since(UNIX_EPOCH) 48 + .unwrap() 49 + .as_secs() 50 + } 51 + 52 + #[cfg(not(target_arch = "wasm32"))] 53 + fn time_since_unix_epoch() -> u64 { 54 + use std::time::{SystemTime, UNIX_EPOCH}; 55 + 56 + SystemTime::now() 57 + .duration_since(UNIX_EPOCH) 58 + .unwrap() 59 + .as_secs() 60 + } 61 + 62 + impl AuthStore { 63 + pub fn is_valid(&self) -> bool { 64 + let parts: Vec<&str> = self.token.split(".").collect(); 65 + if parts.len() != 3 { 66 + return false; 67 + } 68 + 69 + let Ok(token_str) = String::from_utf8(BASE64_STANDARD_NO_PAD.decode(parts[1]).unwrap()) 70 + else { 71 + return false; 72 + }; 73 + let Ok(data) = serde_json::from_str::<JsonObject>(&token_str) else { 74 + return false; 75 + }; 76 + 77 + match data.get("exp") { 78 + Some(Value::Number(exp)) => { 79 + if let Some(exp) = exp.as_u64() { 80 + exp > time_since_unix_epoch() 81 + } else { 82 + false 83 + } 84 + } 85 + _ => false, 86 + } 87 + } 88 + } 89 + 90 + impl<'a> AuthRefreshBuilder<'a> { 91 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 92 + self.expand_fields = Some(field_expression); 93 + self 94 + } 95 + 96 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 97 + self.filter_fields = Some(field_expression); 98 + self 99 + } 100 + 101 + pub async fn send(self) -> Result<RecordAuth, Error> { 102 + let mut params = Vec::new(); 103 + if let Some(expand) = self.expand_fields { 104 + params.push(("expand", expand)); 105 + } 106 + if let Some(fields) = self.filter_fields { 107 + params.push(("fields", fields)); 108 + } 109 + 110 + let auth: RecordAuth = self 111 + .record_service 112 + .client 113 + .send( 114 + &format!( 115 + "/api/collections/{}/auth-refresh", 116 + self.record_service.collection 117 + ), 118 + Method::POST, 119 + HeaderMap::new(), 120 + &params, 121 + None::<&()>, 122 + ) 123 + .await?; 124 + self.record_service.client.with_auth_store(AuthStore { 125 + token: auth.token.clone(), 126 + record: auth.record.clone(), 127 + }); 128 + debug_assert!({ 129 + let read = self.record_service.client.inner.read().unwrap(); 130 + read.auth_store.as_ref().unwrap().is_valid() 131 + }); 132 + Ok(auth) 133 + } 134 + } 135 + 136 + impl<'a> AuthWithPasswordBuilder<'a> { 137 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 138 + self.expand_fields = Some(field_expression); 139 + self 140 + } 141 + 142 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 143 + self.filter_fields = Some(field_expression); 144 + self 145 + } 146 + 147 + pub async fn send(self) -> Result<RecordAuth, Error> { 148 + let body = json!({"identity": self.identity, "password": self.password}); 149 + let mut params = Vec::new(); 150 + if let Some(expand) = self.expand_fields { 151 + params.push(("expand", expand)); 152 + } 153 + if let Some(fields) = self.filter_fields { 154 + params.push(("fields", fields)); 155 + } 156 + 157 + let auth: RecordAuth = self 158 + .record_service 159 + .client 160 + .send( 161 + &format!( 162 + "/api/collections/{}/auth-with-password", 163 + self.record_service.collection 164 + ), 165 + Method::POST, 166 + HeaderMap::new(), 167 + &params, 168 + Some(&body), 169 + ) 170 + .await?; 171 + self.record_service.client.with_auth_store(AuthStore { 172 + token: auth.token.clone(), 173 + record: auth.record.clone(), 174 + }); 175 + debug_assert!({ 176 + let read = self.record_service.client.inner.read().unwrap(); 177 + read.auth_store.as_ref().unwrap().is_valid() 178 + }); 179 + Ok(auth) 180 + } 181 + } 182 + 183 + impl RecordModel { 184 + pub fn as_object(&self) -> &'_ JsonObject { 185 + &self.data 186 + } 187 + 188 + pub fn into_object(self) -> JsonObject { 189 + self.data 190 + } 191 + }
+35
src/health.rs
··· 1 + use reqwest::{Method, header::HeaderMap}; 2 + use serde::Deserialize; 3 + use serde_json::{Map, Value}; 4 + 5 + use crate::{Error, PocketBase}; 6 + 7 + #[derive(Clone, Debug)] 8 + pub struct HealthService<'a> { 9 + pub(super) client: &'a PocketBase, 10 + pub(super) fields: Option<String>, 11 + } 12 + 13 + #[derive(Clone, Debug, Deserialize)] 14 + pub struct HealthCheck { 15 + pub message: String, 16 + pub data: Map<String, Value>, 17 + } 18 + 19 + impl HealthService<'_> { 20 + pub async fn check(self) -> Result<HealthCheck, Error> { 21 + let mut params = Vec::new(); 22 + if let Some(fields) = self.fields { 23 + params.push(("fields", fields)); 24 + } 25 + self.client 26 + .send( 27 + "/api/health", 28 + Method::GET, 29 + HeaderMap::new(), 30 + &params, 31 + None::<&()>, 32 + ) 33 + .await 34 + } 35 + }
+140
src/lib.rs
··· 1 + use std::sync::{Arc, RwLock}; 2 + 3 + use reqwest::{ 4 + Client, Method, 5 + header::{HeaderMap, HeaderValue}, 6 + }; 7 + use serde::{Serialize, de::DeserializeOwned}; 8 + use serde_json::{Map, Value}; 9 + use thiserror::Error; 10 + use url::{ParseError, Url}; 11 + 12 + pub mod auth; 13 + pub mod health; 14 + pub mod record; 15 + 16 + use crate::{auth::AuthStore, health::HealthService, record::RecordService}; 17 + 18 + pub type Error = reqwest::Error; 19 + 20 + pub type JsonObject = Map<String, Value>; 21 + 22 + #[derive(Clone, Debug)] 23 + pub struct PocketBase { 24 + inner: Arc<RwLock<PocketBaseInner>>, 25 + } 26 + 27 + #[derive(Clone, Debug)] 28 + struct PocketBaseInner { 29 + reqwest: Client, 30 + auth_store: Option<AuthStore>, 31 + base_url: Url, 32 + lang: String, 33 + } 34 + 35 + impl PocketBase { 36 + pub fn auth_clear<'a>(&'a self) { 37 + let mut write = self.inner.write().unwrap(); 38 + write.auth_store = None; 39 + } 40 + 41 + pub fn collection<'a>(&'a self, collection: &'a str) -> RecordService<'a> { 42 + RecordService { 43 + client: self, 44 + collection, 45 + } 46 + } 47 + 48 + pub fn health(&self) -> HealthService { 49 + HealthService { 50 + client: self, 51 + fields: None, 52 + } 53 + } 54 + 55 + pub fn lang(&self) -> String { 56 + self.inner.read().unwrap().lang.clone() 57 + } 58 + 59 + pub fn new(base_url: &str) -> Result<Self, ParseError> { 60 + let base_url = Url::parse(base_url)?; 61 + let inner = PocketBaseInner { 62 + reqwest: Client::new(), 63 + base_url, 64 + lang: "en_US".to_owned(), 65 + auth_store: None, 66 + }; 67 + Ok(Self { 68 + inner: Arc::new(RwLock::new(inner)), 69 + }) 70 + } 71 + 72 + async fn send<Q, B, T>( 73 + &self, 74 + path: &str, 75 + method: Method, 76 + headers: HeaderMap, 77 + query: &Q, 78 + body: Option<&B>, 79 + ) -> Result<T, Error> 80 + where 81 + Q: Serialize + ?Sized, 82 + B: Serialize + ?Sized, 83 + T: DeserializeOwned, 84 + { 85 + // Get a reading lock on the inner data 86 + let request = { 87 + let read = self.inner.read().unwrap(); 88 + 89 + // Create the full URL 90 + let mut url = read.base_url.clone(); 91 + url.set_path(path); 92 + 93 + let mut headers = headers; 94 + if !headers.contains_key("Authorization") && read.auth_store.is_some() { 95 + headers.insert( 96 + "Authorization", 97 + HeaderValue::from_str(&read.auth_store.as_ref().unwrap().token).unwrap(), 98 + ); 99 + } 100 + if !headers.contains_key("Accept-Language") { 101 + headers.insert( 102 + "Accept-Language", 103 + HeaderValue::from_str(&read.lang).unwrap(), 104 + ); 105 + } 106 + 107 + // Create the request to the PocketBase API 108 + read.reqwest 109 + .request(method, url) 110 + .headers(headers) 111 + .query(query) 112 + }; 113 + 114 + // Add the body (as JSON) only if it's not None 115 + let response = if let Some(body) = body { 116 + request.json(body) 117 + } else { 118 + request 119 + } 120 + // Send the request and await the response 121 + .send() 122 + .await?; 123 + 124 + // Parse the response body or return an error if something went wrong 125 + response.error_for_status()?.json().await 126 + } 127 + 128 + fn with_auth_store(&self, auth: AuthStore) { 129 + let mut write = self.inner.write().unwrap(); 130 + write.auth_store = Some(auth); 131 + } 132 + 133 + pub fn with_lang(self, lang: String) -> Self { 134 + { 135 + let mut write = self.inner.write().unwrap(); 136 + write.lang = lang; 137 + } 138 + self 139 + } 140 + }
+464
src/record.rs
··· 1 + use reqwest::{Method, header::HeaderMap}; 2 + use serde::{Deserialize, Serialize, de::DeserializeOwned}; 3 + use serde_json::{Map, Value}; 4 + 5 + use crate::{ 6 + Error, JsonObject, PocketBase, 7 + auth::{AuthRefreshBuilder, AuthWithPasswordBuilder}, 8 + }; 9 + 10 + pub struct CreateRequestBuilder<'a, T: Serialize = JsonObject> { 11 + record_service: RecordService<'a>, 12 + body: T, 13 + } 14 + 15 + pub struct DeleteRequestBuilder<'a> { 16 + record_service: RecordService<'a>, 17 + id: &'a str, 18 + } 19 + 20 + #[derive(Clone, Debug)] 21 + pub struct ListRequestBuilder<'a> { 22 + record_service: RecordService<'a>, 23 + expand_fields: Option<&'a str>, 24 + filter_fields: Option<&'a str>, 25 + filter_records: Option<&'a str>, 26 + page: usize, 27 + per_page: usize, 28 + skip_total: Option<bool>, 29 + sort: Option<&'a str>, 30 + } 31 + 32 + #[derive(Clone, Debug)] 33 + pub struct FullListRequestBuilder<'a> { 34 + record_service: RecordService<'a>, 35 + batch: Option<usize>, 36 + expand_fields: Option<&'a str>, 37 + filter_fields: Option<&'a str>, 38 + filter_records: Option<&'a str>, 39 + skip_total: Option<bool>, 40 + order_by: Option<&'a str>, 41 + } 42 + 43 + #[derive(Clone, Debug)] 44 + pub struct RecordService<'a> { 45 + pub(super) client: &'a PocketBase, 46 + pub(super) collection: &'a str, 47 + } 48 + 49 + #[derive(Clone, Debug, Default, Deserialize, Eq, Serialize, PartialEq)] 50 + #[serde(rename_all = "camelCase")] 51 + pub struct ResultList<T> { 52 + items: Vec<T>, 53 + page: usize, 54 + per_page: usize, 55 + total_items: isize, 56 + total_pages: isize, 57 + } 58 + 59 + #[derive(Clone, Debug)] 60 + pub struct ViewRequestBuilder<'a> { 61 + record_service: RecordService<'a>, 62 + expand_fields: Option<&'a str>, 63 + filter_fields: Option<&'a str>, 64 + id: &'a str, 65 + } 66 + 67 + #[derive(Clone, Debug)] 68 + pub struct UpdateRequestBuilder<'a, T: Serialize = JsonObject> { 69 + record_service: RecordService<'a>, 70 + body: T, 71 + expand_fields: Option<&'a str>, 72 + filter_fields: Option<&'a str>, 73 + id: &'a str, 74 + } 75 + 76 + impl<'a, T: Serialize + Clone> CreateRequestBuilder<'a, T> { 77 + pub fn object<X: Serialize + Clone>(self, obj: X) -> CreateRequestBuilder<'a, X> { 78 + CreateRequestBuilder { 79 + record_service: self.record_service, 80 + body: obj, 81 + } 82 + } 83 + 84 + pub async fn send<R: DeserializeOwned>(self) -> Result<R, Error> { 85 + let params: &[()] = &[]; 86 + 87 + self.record_service 88 + .client 89 + .send( 90 + &format!( 91 + "/api/collections/{}/records", 92 + self.record_service.collection 93 + ), 94 + Method::POST, 95 + HeaderMap::new(), 96 + &params, 97 + Some(&self.body), 98 + ) 99 + .await 100 + } 101 + } 102 + 103 + impl CreateRequestBuilder<'_, JsonObject> { 104 + pub fn fields<Iter: IntoIterator<Item = (String, Value)>>(mut self, patch: Iter) -> Self { 105 + self.body.extend(patch); 106 + self 107 + } 108 + } 109 + 110 + impl DeleteRequestBuilder<'_> { 111 + pub async fn send<T: DeserializeOwned>(self) -> Result<T, Error> { 112 + let params: &[()] = &[]; 113 + self.record_service 114 + .client 115 + .send( 116 + &format!( 117 + "/api/collections/{}/records/{}", 118 + self.record_service.collection, self.id 119 + ), 120 + Method::DELETE, 121 + HeaderMap::new(), 122 + &params, 123 + None::<&()>, 124 + ) 125 + .await 126 + } 127 + } 128 + 129 + impl<'a> FullListRequestBuilder<'a> { 130 + pub fn batch_size(mut self, batch: usize) -> Self { 131 + self.batch = Some(batch); 132 + self 133 + } 134 + 135 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 136 + self.expand_fields = Some(field_expression); 137 + self 138 + } 139 + 140 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 141 + self.filter_fields = Some(field_expression); 142 + self 143 + } 144 + 145 + pub fn filter_records(mut self, filter_expression: &'a str) -> Self { 146 + self.filter_records = Some(filter_expression); 147 + self 148 + } 149 + 150 + pub fn skip_total(mut self, skip_total: bool) -> Self { 151 + self.skip_total = Some(skip_total); 152 + self 153 + } 154 + 155 + pub fn order_by(mut self, sort_expression: &'a str) -> Self { 156 + self.order_by = Some(sort_expression); 157 + self 158 + } 159 + 160 + pub async fn send<T: DeserializeOwned>(self) -> Result<Vec<T>, Error> { 161 + let mut list = ListRequestBuilder { 162 + record_service: self.record_service, 163 + expand_fields: self.expand_fields, 164 + filter_fields: self.filter_fields, 165 + filter_records: self.filter_records, 166 + page: 1, 167 + per_page: self.batch.unwrap_or(500), 168 + skip_total: Some(true), 169 + sort: self.order_by, 170 + }; 171 + 172 + let mut ret = Vec::new(); 173 + loop { 174 + let page = list.clone().send().await?; 175 + let persist = page.items.len() == list.per_page; 176 + ret.extend(page.items); 177 + if !persist { 178 + break; 179 + } 180 + list.page += 1; 181 + } 182 + Ok(ret) 183 + } 184 + } 185 + 186 + impl<'a> ListRequestBuilder<'a> { 187 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 188 + self.expand_fields = Some(field_expression); 189 + self 190 + } 191 + 192 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 193 + self.filter_fields = Some(field_expression); 194 + self 195 + } 196 + 197 + pub fn filter(mut self, filter: &'a str) -> Self { 198 + self.filter_records = Some(filter); 199 + self 200 + } 201 + 202 + pub fn skip_total(mut self, skip_total: bool) -> Self { 203 + self.skip_total = Some(skip_total); 204 + self 205 + } 206 + 207 + pub fn sort(mut self, sort: &'a str) -> Self { 208 + self.sort = Some(sort); 209 + self 210 + } 211 + 212 + pub async fn send<T: DeserializeOwned>(self) -> Result<ResultList<T>, Error> { 213 + let mut storage = vec![self.page.to_string(), self.per_page.to_string()]; 214 + if let Some(skip_total) = self.skip_total { 215 + storage.push(skip_total.to_string()); 216 + } 217 + let mut params: Vec<(&str, &str)> = vec![("page", &storage[0]), ("perPage", &storage[1])]; 218 + if let Some(filter) = self.filter_records { 219 + params.push(("filter", filter)); 220 + } 221 + if let Some(sort) = self.sort { 222 + params.push(("sort", sort)); 223 + } 224 + if let Some(expand) = self.expand_fields { 225 + params.push(("expand", expand)); 226 + } 227 + if let Some(fields) = self.filter_fields { 228 + params.push(("fields", fields)); 229 + } 230 + if self.skip_total.is_some() { 231 + params.push(("skipTotal", &storage[2])); 232 + } 233 + 234 + self.record_service 235 + .client 236 + .send( 237 + &format!( 238 + "/api/collections/{}/records", 239 + self.record_service.collection 240 + ), 241 + Method::GET, 242 + HeaderMap::new(), 243 + &params, 244 + None::<&()>, 245 + ) 246 + .await 247 + } 248 + } 249 + 250 + impl<'a> RecordService<'a> { 251 + pub fn auth_refresh(&self) -> AuthRefreshBuilder<'a> { 252 + AuthRefreshBuilder { 253 + record_service: self.clone(), 254 + expand_fields: None, 255 + filter_fields: None, 256 + } 257 + } 258 + 259 + pub fn auth_with_password( 260 + &self, 261 + identity: &'a str, 262 + password: &'a str, 263 + ) -> AuthWithPasswordBuilder<'a> { 264 + AuthWithPasswordBuilder { 265 + record_service: self.clone(), 266 + identity, 267 + password, 268 + expand_fields: None, 269 + filter_fields: None, 270 + } 271 + } 272 + 273 + pub fn create(&self) -> CreateRequestBuilder<'a> { 274 + CreateRequestBuilder { 275 + record_service: self.clone(), 276 + body: Map::new(), 277 + } 278 + } 279 + 280 + pub fn delete(&self, id: &'a str) -> DeleteRequestBuilder<'a> { 281 + DeleteRequestBuilder { 282 + record_service: self.clone(), 283 + id, 284 + } 285 + } 286 + 287 + pub fn get_full_list(&self) -> FullListRequestBuilder<'a> { 288 + FullListRequestBuilder { 289 + record_service: self.clone(), 290 + batch: None, 291 + filter_records: None, 292 + order_by: None, 293 + expand_fields: None, 294 + filter_fields: None, 295 + skip_total: None, 296 + } 297 + } 298 + 299 + pub fn get_list(&self, page: usize, per_page: usize) -> ListRequestBuilder<'a> { 300 + ListRequestBuilder { 301 + record_service: self.clone(), 302 + page, 303 + per_page, 304 + filter_records: None, 305 + sort: None, 306 + expand_fields: None, 307 + filter_fields: None, 308 + skip_total: None, 309 + } 310 + } 311 + 312 + pub fn get_one(&'a self, id: &'a str) -> ViewRequestBuilder<'a> { 313 + ViewRequestBuilder { 314 + record_service: self.clone(), 315 + id, 316 + expand_fields: None, 317 + filter_fields: None, 318 + } 319 + } 320 + 321 + pub fn update(&self, id: &'a str) -> UpdateRequestBuilder<'a> { 322 + UpdateRequestBuilder { 323 + record_service: self.clone(), 324 + id, 325 + expand_fields: None, 326 + filter_fields: None, 327 + body: Map::new(), 328 + } 329 + } 330 + } 331 + 332 + impl<T> ResultList<T> { 333 + pub fn items(&self) -> &[T] { 334 + &self.items 335 + } 336 + 337 + pub fn into_vec(self) -> Vec<T> { 338 + self.items 339 + } 340 + 341 + pub fn page(&self) -> usize { 342 + self.page 343 + } 344 + 345 + pub fn per_page(&self) -> usize { 346 + self.per_page 347 + } 348 + } 349 + 350 + impl<T> IntoIterator for ResultList<T> { 351 + type Item = T; 352 + type IntoIter = std::vec::IntoIter<T>; 353 + 354 + fn into_iter(self) -> Self::IntoIter { 355 + self.items.into_iter() 356 + } 357 + } 358 + 359 + impl<'a, T> IntoIterator for &'a ResultList<T> { 360 + type Item = &'a T; 361 + type IntoIter = std::slice::Iter<'a, T>; 362 + 363 + fn into_iter(self) -> Self::IntoIter { 364 + self.items.iter() 365 + } 366 + } 367 + 368 + impl<'a, T> IntoIterator for &'a mut ResultList<T> { 369 + type Item = &'a mut T; 370 + type IntoIter = std::slice::IterMut<'a, T>; 371 + 372 + fn into_iter(self) -> Self::IntoIter { 373 + self.items.iter_mut() 374 + } 375 + } 376 + 377 + impl<'a> ViewRequestBuilder<'a> { 378 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 379 + self.expand_fields = Some(field_expression); 380 + self 381 + } 382 + 383 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 384 + self.filter_fields = Some(field_expression); 385 + self 386 + } 387 + 388 + pub async fn send<T: DeserializeOwned>(self) -> Result<T, Error> { 389 + let mut params = Vec::new(); 390 + if let Some(expand) = self.expand_fields { 391 + params.push(("expand", expand)); 392 + } 393 + if let Some(fields) = self.filter_fields { 394 + params.push(("fields", fields)); 395 + } 396 + 397 + self.record_service 398 + .client 399 + .send( 400 + &format!( 401 + "/api/collections/{}/records/{}", 402 + self.record_service.collection, self.id 403 + ), 404 + Method::GET, 405 + HeaderMap::new(), 406 + &params, 407 + None::<&()>, 408 + ) 409 + .await 410 + } 411 + } 412 + 413 + impl<'a, T: Serialize> UpdateRequestBuilder<'a, T> { 414 + pub fn expand_fields(mut self, field_expression: &'a str) -> Self { 415 + self.expand_fields = Some(field_expression); 416 + self 417 + } 418 + 419 + pub fn filter_fields(mut self, field_expression: &'a str) -> Self { 420 + self.filter_fields = Some(field_expression); 421 + self 422 + } 423 + 424 + pub fn object<X: Serialize>(self, obj: X) -> UpdateRequestBuilder<'a, X> { 425 + UpdateRequestBuilder { 426 + record_service: self.record_service, 427 + body: obj, 428 + expand_fields: self.expand_fields, 429 + filter_fields: self.filter_fields, 430 + id: self.id, 431 + } 432 + } 433 + 434 + pub async fn send<R: DeserializeOwned>(self) -> Result<R, Error> { 435 + let mut params = Vec::new(); 436 + if let Some(expand) = self.expand_fields { 437 + params.push(("expand", expand)); 438 + } 439 + if let Some(fields) = self.filter_fields { 440 + params.push(("fields", fields)); 441 + } 442 + 443 + self.record_service 444 + .client 445 + .send( 446 + &format!( 447 + "/api/collections/{}/records/{}", 448 + self.record_service.collection, self.id 449 + ), 450 + Method::PATCH, 451 + HeaderMap::new(), 452 + &params, 453 + Some(&self.body), 454 + ) 455 + .await 456 + } 457 + } 458 + 459 + impl UpdateRequestBuilder<'_, JsonObject> { 460 + pub fn fields<Iter: IntoIterator<Item = (String, Value)>>(mut self, patch: Iter) -> Self { 461 + self.body.extend(patch); 462 + self 463 + } 464 + }