|
8 | 8 | * Generated by: https://openapi-generator.tech |
9 | 9 | */ |
10 | 10 |
|
11 | | - |
12 | | -use reqwest; |
13 | | -use serde::{Deserialize, Serialize, de::Error as _}; |
| 11 | +use super::{configuration, ContentType, Error}; |
14 | 12 | use crate::{apis::ResponseContent, models}; |
15 | | -use super::{Error, configuration, ContentType}; |
16 | | - |
| 13 | +use reqwest; |
| 14 | +use serde::{de::Error as _, Deserialize, Serialize}; |
17 | 15 |
|
18 | 16 | /// struct for typed errors of method [`delete_database_context`] |
19 | 17 | #[derive(Debug, Clone, Serialize, Deserialize)] |
@@ -50,15 +48,25 @@ pub enum UpsertDatabaseContextError { |
50 | 48 | UnknownValue(serde_json::Value), |
51 | 49 | } |
52 | 50 |
|
53 | | - |
54 | 51 | /// Removes a named context document from a database. |
55 | | -pub async fn delete_database_context(configuration: &configuration::Configuration, database_id: &str, name: &str) -> Result<(), Error<DeleteDatabaseContextError>> { |
| 52 | +pub async fn delete_database_context( |
| 53 | + configuration: &configuration::Configuration, |
| 54 | + database_id: &str, |
| 55 | + name: &str, |
| 56 | +) -> Result<(), Error<DeleteDatabaseContextError>> { |
56 | 57 | // add a prefix to parameters to efficiently prevent name collisions |
57 | 58 | let p_path_database_id = database_id; |
58 | 59 | let p_path_name = name; |
59 | 60 |
|
60 | | - let uri_str = format!("{}/v1/databases/{database_id}/context/{name}", configuration.base_path, database_id=crate::apis::urlencode(p_path_database_id), name=crate::apis::urlencode(p_path_name)); |
61 | | - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); |
| 61 | + let uri_str = format!( |
| 62 | + "{}/v1/databases/{database_id}/context/{name}", |
| 63 | + configuration.base_path, |
| 64 | + database_id = crate::apis::urlencode(p_path_database_id), |
| 65 | + name = crate::apis::urlencode(p_path_name) |
| 66 | + ); |
| 67 | + let mut req_builder = configuration |
| 68 | + .client |
| 69 | + .request(reqwest::Method::DELETE, &uri_str); |
62 | 70 |
|
63 | 71 | if let Some(ref user_agent) = configuration.user_agent { |
64 | 72 | req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); |
@@ -88,16 +96,29 @@ pub async fn delete_database_context(configuration: &configuration::Configuratio |
88 | 96 | let content = resp.text().await?; |
89 | 97 | crate::http_log::log_response_body(&content); |
90 | 98 | let entity: Option<DeleteDatabaseContextError> = serde_json::from_str(&content).ok(); |
91 | | - Err(Error::ResponseError(ResponseContent { status, content, entity })) |
| 99 | + Err(Error::ResponseError(ResponseContent { |
| 100 | + status, |
| 101 | + content, |
| 102 | + entity, |
| 103 | + })) |
92 | 104 | } |
93 | 105 | } |
94 | 106 |
|
95 | | -pub async fn get_database_context(configuration: &configuration::Configuration, database_id: &str, name: &str) -> Result<models::GetDatabaseContextResponse, Error<GetDatabaseContextError>> { |
| 107 | +pub async fn get_database_context( |
| 108 | + configuration: &configuration::Configuration, |
| 109 | + database_id: &str, |
| 110 | + name: &str, |
| 111 | +) -> Result<models::GetDatabaseContextResponse, Error<GetDatabaseContextError>> { |
96 | 112 | // add a prefix to parameters to efficiently prevent name collisions |
97 | 113 | let p_path_database_id = database_id; |
98 | 114 | let p_path_name = name; |
99 | 115 |
|
100 | | - let uri_str = format!("{}/v1/databases/{database_id}/context/{name}", configuration.base_path, database_id=crate::apis::urlencode(p_path_database_id), name=crate::apis::urlencode(p_path_name)); |
| 116 | + let uri_str = format!( |
| 117 | + "{}/v1/databases/{database_id}/context/{name}", |
| 118 | + configuration.base_path, |
| 119 | + database_id = crate::apis::urlencode(p_path_database_id), |
| 120 | + name = crate::apis::urlencode(p_path_name) |
| 121 | + ); |
101 | 122 | let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); |
102 | 123 |
|
103 | 124 | if let Some(ref user_agent) = configuration.user_agent { |
@@ -140,15 +161,26 @@ pub async fn get_database_context(configuration: &configuration::Configuration, |
140 | 161 | let content = resp.text().await?; |
141 | 162 | crate::http_log::log_response_body(&content); |
142 | 163 | let entity: Option<GetDatabaseContextError> = serde_json::from_str(&content).ok(); |
143 | | - Err(Error::ResponseError(ResponseContent { status, content, entity })) |
| 164 | + Err(Error::ResponseError(ResponseContent { |
| 165 | + status, |
| 166 | + content, |
| 167 | + entity, |
| 168 | + })) |
144 | 169 | } |
145 | 170 | } |
146 | 171 |
|
147 | | -pub async fn list_database_contexts(configuration: &configuration::Configuration, database_id: &str) -> Result<models::ListDatabaseContextsResponse, Error<ListDatabaseContextsError>> { |
| 172 | +pub async fn list_database_contexts( |
| 173 | + configuration: &configuration::Configuration, |
| 174 | + database_id: &str, |
| 175 | +) -> Result<models::ListDatabaseContextsResponse, Error<ListDatabaseContextsError>> { |
148 | 176 | // add a prefix to parameters to efficiently prevent name collisions |
149 | 177 | let p_path_database_id = database_id; |
150 | 178 |
|
151 | | - let uri_str = format!("{}/v1/databases/{database_id}/context", configuration.base_path, database_id=crate::apis::urlencode(p_path_database_id)); |
| 179 | + let uri_str = format!( |
| 180 | + "{}/v1/databases/{database_id}/context", |
| 181 | + configuration.base_path, |
| 182 | + database_id = crate::apis::urlencode(p_path_database_id) |
| 183 | + ); |
152 | 184 | let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); |
153 | 185 |
|
154 | 186 | if let Some(ref user_agent) = configuration.user_agent { |
@@ -191,18 +223,32 @@ pub async fn list_database_contexts(configuration: &configuration::Configuration |
191 | 223 | let content = resp.text().await?; |
192 | 224 | crate::http_log::log_response_body(&content); |
193 | 225 | let entity: Option<ListDatabaseContextsError> = serde_json::from_str(&content).ok(); |
194 | | - Err(Error::ResponseError(ResponseContent { status, content, entity })) |
| 226 | + Err(Error::ResponseError(ResponseContent { |
| 227 | + status, |
| 228 | + content, |
| 229 | + entity, |
| 230 | + })) |
195 | 231 | } |
196 | 232 | } |
197 | 233 |
|
198 | 234 | /// Stores a named document (for example Markdown) scoped to a database. Reuses the same name to replace content. |
199 | | -pub async fn upsert_database_context(configuration: &configuration::Configuration, database_id: &str, upsert_database_context_request: models::UpsertDatabaseContextRequest) -> Result<models::UpsertDatabaseContextResponse, Error<UpsertDatabaseContextError>> { |
| 235 | +pub async fn upsert_database_context( |
| 236 | + configuration: &configuration::Configuration, |
| 237 | + database_id: &str, |
| 238 | + upsert_database_context_request: models::UpsertDatabaseContextRequest, |
| 239 | +) -> Result<models::UpsertDatabaseContextResponse, Error<UpsertDatabaseContextError>> { |
200 | 240 | // add a prefix to parameters to efficiently prevent name collisions |
201 | 241 | let p_path_database_id = database_id; |
202 | 242 | let p_body_upsert_database_context_request = upsert_database_context_request; |
203 | 243 |
|
204 | | - let uri_str = format!("{}/v1/databases/{database_id}/context", configuration.base_path, database_id=crate::apis::urlencode(p_path_database_id)); |
205 | | - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); |
| 244 | + let uri_str = format!( |
| 245 | + "{}/v1/databases/{database_id}/context", |
| 246 | + configuration.base_path, |
| 247 | + database_id = crate::apis::urlencode(p_path_database_id) |
| 248 | + ); |
| 249 | + let mut req_builder = configuration |
| 250 | + .client |
| 251 | + .request(reqwest::Method::POST, &uri_str); |
206 | 252 |
|
207 | 253 | if let Some(ref user_agent) = configuration.user_agent { |
208 | 254 | req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); |
@@ -245,7 +291,10 @@ pub async fn upsert_database_context(configuration: &configuration::Configuratio |
245 | 291 | let content = resp.text().await?; |
246 | 292 | crate::http_log::log_response_body(&content); |
247 | 293 | let entity: Option<UpsertDatabaseContextError> = serde_json::from_str(&content).ok(); |
248 | | - Err(Error::ResponseError(ResponseContent { status, content, entity })) |
| 294 | + Err(Error::ResponseError(ResponseContent { |
| 295 | + status, |
| 296 | + content, |
| 297 | + entity, |
| 298 | + })) |
249 | 299 | } |
250 | 300 | } |
251 | | - |
|
0 commit comments