soup/auto/
auth_negotiate.rs1use crate::{ffi, Auth};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "SoupAuthNegotiate")]
11 pub struct AuthNegotiate(Object<ffi::SoupAuthNegotiate>) @extends Auth;
12
13 match fn {
14 type_ => || ffi::soup_auth_negotiate_get_type(),
15 }
16}
17
18impl AuthNegotiate {
19 pub fn builder() -> AuthNegotiateBuilder {
24 AuthNegotiateBuilder::new()
25 }
26
27 #[doc(alias = "soup_auth_negotiate_supported")]
28 pub fn supported() -> bool {
29 assert_initialized_main_thread!();
30 unsafe { from_glib(ffi::soup_auth_negotiate_supported()) }
31 }
32}
33
34#[must_use = "The builder must be built to be used"]
39pub struct AuthNegotiateBuilder {
40 builder: glib::object::ObjectBuilder<'static, AuthNegotiate>,
41}
42
43impl AuthNegotiateBuilder {
44 fn new() -> Self {
45 Self {
46 builder: glib::object::Object::builder(),
47 }
48 }
49
50 pub fn authority(self, authority: impl Into<glib::GString>) -> Self {
51 Self {
52 builder: self.builder.property("authority", authority.into()),
53 }
54 }
55
56 pub fn is_for_proxy(self, is_for_proxy: bool) -> Self {
57 Self {
58 builder: self.builder.property("is-for-proxy", is_for_proxy),
59 }
60 }
61
62 pub fn realm(self, realm: impl Into<glib::GString>) -> Self {
63 Self {
64 builder: self.builder.property("realm", realm.into()),
65 }
66 }
67
68 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
71 pub fn build(self) -> AuthNegotiate {
72 self.builder.build()
73 }
74}