Skip to content

Commit 5b3b9af

Browse files
committed
cargo fmt post code generation
1 parent 2bbff6e commit 5b3b9af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+701
-634
lines changed

typesense_codegen/src/apis/collections_api.rs

Lines changed: 183 additions & 65 deletions
Large diffs are not rendered by default.

typesense_codegen/src/apis/configuration.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
* An open source search engine for building delightful search experiences.
55
*
66
* The version of the OpenAPI document: 0.23.0
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

11-
1211
use reqwest;
1312

14-
1513
#[derive(Debug, Clone)]
1614
pub struct Configuration {
1715
pub base_path: String,
@@ -32,7 +30,6 @@ pub struct ApiKey {
3230
pub key: String,
3331
}
3432

35-
3633
impl Configuration {
3734
pub fn new() -> Configuration {
3835
Configuration::default()
@@ -49,7 +46,6 @@ impl Default for Configuration {
4946
oauth_access_token: None,
5047
bearer_access_token: None,
5148
api_key: None,
52-
5349
}
5450
}
5551
}

typesense_codegen/src/apis/debug_api.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
* An open source search engine for building delightful search experiences.
55
*
66
* The version of the OpenAPI document: 0.23.0
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

11-
1211
use reqwest;
1312

13+
use super::{configuration, Error};
1414
use crate::apis::ResponseContent;
15-
use super::{Error, configuration};
16-
1715

1816
/// struct for typed errors of method [`debug`]
1917
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -22,26 +20,30 @@ pub enum DebugError {
2220
UnknownValue(serde_json::Value),
2321
}
2422

25-
2623
/// Print debugging information
27-
pub async fn debug(configuration: &configuration::Configuration, ) -> Result<crate::models::Debug200Response, Error<DebugError>> {
24+
pub async fn debug(
25+
configuration: &configuration::Configuration,
26+
) -> Result<crate::models::Debug200Response, Error<DebugError>> {
2827
let local_var_configuration = configuration;
2928

3029
let local_var_client = &local_var_configuration.client;
3130

3231
let local_var_uri_str = format!("{}/debug", local_var_configuration.base_path);
33-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
32+
let mut local_var_req_builder =
33+
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3434

3535
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
36-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
36+
local_var_req_builder =
37+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3738
}
3839
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3940
let local_var_key = local_var_apikey.key.clone();
4041
let local_var_value = match local_var_apikey.prefix {
4142
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
4243
None => local_var_key,
4344
};
44-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
45+
local_var_req_builder =
46+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
4547
};
4648

4749
let local_var_req = local_var_req_builder.build()?;
@@ -54,8 +56,11 @@ pub async fn debug(configuration: &configuration::Configuration, ) -> Result<cra
5456
serde_json::from_str(&local_var_content).map_err(Error::from)
5557
} else {
5658
let local_var_entity: Option<DebugError> = serde_json::from_str(&local_var_content).ok();
57-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
59+
let local_var_error = ResponseContent {
60+
status: local_var_status,
61+
content: local_var_content,
62+
entity: local_var_entity,
63+
};
5864
Err(Error::ResponseError(local_var_error))
5965
}
6066
}
61-

typesense_codegen/src/apis/health_api.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
* An open source search engine for building delightful search experiences.
55
*
66
* The version of the OpenAPI document: 0.23.0
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

11-
1211
use reqwest;
1312

13+
use super::{configuration, Error};
1414
use crate::apis::ResponseContent;
15-
use super::{Error, configuration};
16-
1715

1816
/// struct for typed errors of method [`health`]
1917
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -22,26 +20,30 @@ pub enum HealthError {
2220
UnknownValue(serde_json::Value),
2321
}
2422

25-
2623
/// Checks if Typesense server is ready to accept requests.
27-
pub async fn health(configuration: &configuration::Configuration, ) -> Result<crate::models::HealthStatus, Error<HealthError>> {
24+
pub async fn health(
25+
configuration: &configuration::Configuration,
26+
) -> Result<crate::models::HealthStatus, Error<HealthError>> {
2827
let local_var_configuration = configuration;
2928

3029
let local_var_client = &local_var_configuration.client;
3130

3231
let local_var_uri_str = format!("{}/health", local_var_configuration.base_path);
33-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
32+
let mut local_var_req_builder =
33+
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
3434

3535
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
36-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
36+
local_var_req_builder =
37+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3738
}
3839
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
3940
let local_var_key = local_var_apikey.key.clone();
4041
let local_var_value = match local_var_apikey.prefix {
4142
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
4243
None => local_var_key,
4344
};
44-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
45+
local_var_req_builder =
46+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
4547
};
4648

4749
let local_var_req = local_var_req_builder.build()?;
@@ -54,8 +56,11 @@ pub async fn health(configuration: &configuration::Configuration, ) -> Result<cr
5456
serde_json::from_str(&local_var_content).map_err(Error::from)
5557
} else {
5658
let local_var_entity: Option<HealthError> = serde_json::from_str(&local_var_content).ok();
57-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
59+
let local_var_error = ResponseContent {
60+
status: local_var_status,
61+
content: local_var_content,
62+
entity: local_var_entity,
63+
};
5864
Err(Error::ResponseError(local_var_error))
5965
}
6066
}
61-

typesense_codegen/src/apis/keys_api.rs

Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
* An open source search engine for building delightful search experiences.
55
*
66
* The version of the OpenAPI document: 0.23.0
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

11-
1211
use reqwest;
1312

13+
use super::{configuration, Error};
1414
use crate::apis::ResponseContent;
15-
use super::{Error, configuration};
16-
1715

1816
/// struct for typed errors of method [`create_key`]
1917
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -43,26 +41,31 @@ pub enum GetKeysError {
4341
UnknownValue(serde_json::Value),
4442
}
4543

46-
4744
/// Create an API Key with fine-grain access control. You can restrict access on both a per-collection and per-action level. The generated key is returned only during creation. You want to store this key carefully in a secure place.
48-
pub async fn create_key(configuration: &configuration::Configuration, api_key_schema: Option<crate::models::ApiKeySchema>) -> Result<crate::models::ApiKey, Error<CreateKeyError>> {
45+
pub async fn create_key(
46+
configuration: &configuration::Configuration,
47+
api_key_schema: Option<crate::models::ApiKeySchema>,
48+
) -> Result<crate::models::ApiKey, Error<CreateKeyError>> {
4949
let local_var_configuration = configuration;
5050

5151
let local_var_client = &local_var_configuration.client;
5252

5353
let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
54-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
54+
let mut local_var_req_builder =
55+
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
5556

5657
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
57-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
58+
local_var_req_builder =
59+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
5860
}
5961
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
6062
let local_var_key = local_var_apikey.key.clone();
6163
let local_var_value = match local_var_apikey.prefix {
6264
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
6365
None => local_var_key,
6466
};
65-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
67+
local_var_req_builder =
68+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
6669
};
6770
local_var_req_builder = local_var_req_builder.json(&api_key_schema);
6871

@@ -75,30 +78,45 @@ pub async fn create_key(configuration: &configuration::Configuration, api_key_sc
7578
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
7679
serde_json::from_str(&local_var_content).map_err(Error::from)
7780
} else {
78-
let local_var_entity: Option<CreateKeyError> = serde_json::from_str(&local_var_content).ok();
79-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
81+
let local_var_entity: Option<CreateKeyError> =
82+
serde_json::from_str(&local_var_content).ok();
83+
let local_var_error = ResponseContent {
84+
status: local_var_status,
85+
content: local_var_content,
86+
entity: local_var_entity,
87+
};
8088
Err(Error::ResponseError(local_var_error))
8189
}
8290
}
8391

84-
pub async fn delete_key(configuration: &configuration::Configuration, key_id: i64) -> Result<crate::models::ApiKey, Error<DeleteKeyError>> {
92+
pub async fn delete_key(
93+
configuration: &configuration::Configuration,
94+
key_id: i64,
95+
) -> Result<crate::models::ApiKey, Error<DeleteKeyError>> {
8596
let local_var_configuration = configuration;
8697

8798
let local_var_client = &local_var_configuration.client;
8899

89-
let local_var_uri_str = format!("{}/keys/{keyId}", local_var_configuration.base_path, keyId=key_id);
90-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
100+
let local_var_uri_str = format!(
101+
"{}/keys/{keyId}",
102+
local_var_configuration.base_path,
103+
keyId = key_id
104+
);
105+
let mut local_var_req_builder =
106+
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
91107

92108
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
93-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
109+
local_var_req_builder =
110+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
94111
}
95112
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
96113
let local_var_key = local_var_apikey.key.clone();
97114
let local_var_value = match local_var_apikey.prefix {
98115
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
99116
None => local_var_key,
100117
};
101-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
118+
local_var_req_builder =
119+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
102120
};
103121

104122
let local_var_req = local_var_req_builder.build()?;
@@ -110,31 +128,46 @@ pub async fn delete_key(configuration: &configuration::Configuration, key_id: i6
110128
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
111129
serde_json::from_str(&local_var_content).map_err(Error::from)
112130
} else {
113-
let local_var_entity: Option<DeleteKeyError> = serde_json::from_str(&local_var_content).ok();
114-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
131+
let local_var_entity: Option<DeleteKeyError> =
132+
serde_json::from_str(&local_var_content).ok();
133+
let local_var_error = ResponseContent {
134+
status: local_var_status,
135+
content: local_var_content,
136+
entity: local_var_entity,
137+
};
115138
Err(Error::ResponseError(local_var_error))
116139
}
117140
}
118141

119142
/// Retrieve (metadata about) a key. Only the key prefix is returned when you retrieve a key. Due to security reasons, only the create endpoint returns the full API key.
120-
pub async fn get_key(configuration: &configuration::Configuration, key_id: i64) -> Result<crate::models::ApiKey, Error<GetKeyError>> {
143+
pub async fn get_key(
144+
configuration: &configuration::Configuration,
145+
key_id: i64,
146+
) -> Result<crate::models::ApiKey, Error<GetKeyError>> {
121147
let local_var_configuration = configuration;
122148

123149
let local_var_client = &local_var_configuration.client;
124150

125-
let local_var_uri_str = format!("{}/keys/{keyId}", local_var_configuration.base_path, keyId=key_id);
126-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
151+
let local_var_uri_str = format!(
152+
"{}/keys/{keyId}",
153+
local_var_configuration.base_path,
154+
keyId = key_id
155+
);
156+
let mut local_var_req_builder =
157+
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
127158

128159
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
129-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
160+
local_var_req_builder =
161+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
130162
}
131163
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
132164
let local_var_key = local_var_apikey.key.clone();
133165
let local_var_value = match local_var_apikey.prefix {
134166
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
135167
None => local_var_key,
136168
};
137-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
169+
local_var_req_builder =
170+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
138171
};
139172

140173
let local_var_req = local_var_req_builder.build()?;
@@ -147,29 +180,38 @@ pub async fn get_key(configuration: &configuration::Configuration, key_id: i64)
147180
serde_json::from_str(&local_var_content).map_err(Error::from)
148181
} else {
149182
let local_var_entity: Option<GetKeyError> = serde_json::from_str(&local_var_content).ok();
150-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
183+
let local_var_error = ResponseContent {
184+
status: local_var_status,
185+
content: local_var_content,
186+
entity: local_var_entity,
187+
};
151188
Err(Error::ResponseError(local_var_error))
152189
}
153190
}
154191

155-
pub async fn get_keys(configuration: &configuration::Configuration, ) -> Result<crate::models::ApiKeysResponse, Error<GetKeysError>> {
192+
pub async fn get_keys(
193+
configuration: &configuration::Configuration,
194+
) -> Result<crate::models::ApiKeysResponse, Error<GetKeysError>> {
156195
let local_var_configuration = configuration;
157196

158197
let local_var_client = &local_var_configuration.client;
159198

160199
let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
161-
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
200+
let mut local_var_req_builder =
201+
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
162202

163203
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
164-
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
204+
local_var_req_builder =
205+
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
165206
}
166207
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
167208
let local_var_key = local_var_apikey.key.clone();
168209
let local_var_value = match local_var_apikey.prefix {
169210
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
170211
None => local_var_key,
171212
};
172-
local_var_req_builder = local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
213+
local_var_req_builder =
214+
local_var_req_builder.header("X-TYPESENSE-API-KEY", local_var_value);
173215
};
174216

175217
let local_var_req = local_var_req_builder.build()?;
@@ -182,8 +224,11 @@ pub async fn get_keys(configuration: &configuration::Configuration, ) -> Result<
182224
serde_json::from_str(&local_var_content).map_err(Error::from)
183225
} else {
184226
let local_var_entity: Option<GetKeysError> = serde_json::from_str(&local_var_content).ok();
185-
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
227+
let local_var_error = ResponseContent {
228+
status: local_var_status,
229+
content: local_var_content,
230+
entity: local_var_entity,
231+
};
186232
Err(Error::ResponseError(local_var_error))
187233
}
188234
}
189-

0 commit comments

Comments
 (0)