Builds a request towards the `Client`'s endpoint
(
&self,
method: Method,
path: P,
query: Option<&[(&str, &str)]>,
mut domain: Url,
headers: Option<HeaderMap>,
)
| 98 | |
| 99 | /// Builds a request towards the `Client`'s endpoint |
| 100 | async fn build_request<P>( |
| 101 | &self, |
| 102 | method: Method, |
| 103 | path: P, |
| 104 | query: Option<&[(&str, &str)]>, |
| 105 | mut domain: Url, |
| 106 | headers: Option<HeaderMap>, |
| 107 | ) -> Result<RequestBuilder, Error> |
| 108 | where |
| 109 | P: IntoIterator, |
| 110 | P::Item: AsRef<str>, |
| 111 | { |
| 112 | domain |
| 113 | .path_segments_mut() |
| 114 | .or(Err(Error::UrlBaseError))? |
| 115 | .clear() |
| 116 | .extend(path); |
| 117 | |
| 118 | let mut req = self.inner.request(method, domain); |
| 119 | if let Some(header_map) = headers { |
| 120 | req = req.headers(header_map); |
| 121 | } |
| 122 | if let Some(query_params) = query { |
| 123 | req = req.query(&query_params); |
| 124 | } |
| 125 | let token = self.auth_client.auth().await?; |
| 126 | |
| 127 | Ok(req.bearer_auth(token)) |
| 128 | } |
| 129 | |
| 130 | async fn send_request<T>(&self, req: RequestBuilder) -> Result<T, Error> |
| 131 | where |