1+ use reqwest:: Proxy ;
2+
13use crate :: sdk:: authentication:: Authenticate ;
24
35/// A builder for the options
@@ -17,6 +19,8 @@ pub struct OptionsBuilder {
1719 logging_enabled : bool ,
1820 headers : Vec < ( String , String ) > ,
1921 authentication : Option < Box < dyn Authenticate > > ,
22+
23+ proxy : Option < Proxy > ,
2024}
2125
2226// Allowing this because it is a builder pattern
@@ -30,6 +34,8 @@ impl OptionsBuilder {
3034 logging_enabled : false ,
3135 headers : vec ! [ ] ,
3236 authentication,
37+
38+ proxy : None ,
3339 }
3440 }
3541
@@ -42,6 +48,8 @@ impl OptionsBuilder {
4248 logging_enabled : self . logging_enabled ,
4349 headers : self . headers ,
4450 authentication : self . authentication ,
51+
52+ proxy : self . proxy ,
4553 }
4654 }
4755
@@ -68,6 +76,12 @@ impl OptionsBuilder {
6876 self . headers = headers;
6977 self
7078 }
79+
80+ /// Adds a custom proxy for the request to point to.
81+ pub fn with_proxy ( mut self , proxy : Proxy ) -> Self {
82+ self . proxy = Some ( proxy) ;
83+ self
84+ }
7185}
7286
7387/// Options that can be passed into a new client
@@ -89,6 +103,9 @@ pub struct Options {
89103
90104 // Authentication
91105 pub ( crate ) authentication : Option < Box < dyn Authenticate > > ,
106+
107+ // Proxy
108+ pub ( crate ) proxy : Option < Proxy > ,
92109}
93110
94111impl Clone for Options {
@@ -99,6 +116,7 @@ impl Clone for Options {
99116 logging_enabled : self . logging_enabled ,
100117 headers : self . headers . clone ( ) ,
101118 authentication : self . authentication . as_ref ( ) . map ( |x| x. clone_box ( ) ) ,
119+ proxy : self . proxy . clone ( ) ,
102120 }
103121 }
104122}
0 commit comments