/*
* CrowdStrike API Specification
*
* Use this API specification as a reference for the API endpoints you can use to interact with your Falcon environment. These endpoints support authentication via OAuth2 and interact with detections and network containment. For detailed usage guides and examples, see our [documentation inside the Falcon console](https://falcon.crowdstrike.com/support/documentation). To use the APIs described below, combine the base URL with the path shown for each API endpoint. For commercial cloud customers, your base URL is `https://api.crowdstrike.com`. Each API endpoint requires authorization via an OAuth2 token. Your first API request should retrieve an OAuth2 token using the `oauth2/token` endpoint, such as `https://api.crowdstrike.com/oauth2/token`. For subsequent requests, include the OAuth2 token in an HTTP authorization header. Tokens expire after 30 minutes, after which you should make a new token request to continue making API requests.
*
* The version of the OpenAPI document: rolling
*
* Generated by: https://openapi-generator.tech
*/
use super::{ContentType, Error, configuration};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::de::Error as _;
/// struct for typed errors of method [`create_saved_searches_dynamic_execute_alt_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesDynamicExecuteAltV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_saved_searches_dynamic_execute_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesDynamicExecuteV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_saved_searches_execute_alt_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesExecuteAltV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_saved_searches_execute_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesExecuteV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_saved_searches_ingest_alt_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesIngestAltV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_saved_searches_ingest_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSavedSearchesIngestV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_saved_searches_execute_alt_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSavedSearchesExecuteAltV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_saved_searches_execute_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSavedSearchesExecuteV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_saved_searches_job_results_download_alt_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSavedSearchesJobResultsDownloadAltV1Error {
Status400(models::ApiEntitiesResponse),
Status401(models::ApiEntitiesResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiEntitiesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiEntitiesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_saved_searches_job_results_download_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSavedSearchesJobResultsDownloadV1Error {
Status400(models::ApiEntitiesResponse),
Status401(models::ApiEntitiesResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiEntitiesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiEntitiesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ingest_data_async_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IngestDataAsyncV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ingest_data_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IngestDataV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_repos_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListReposV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_view_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListViewV1Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status404(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
pub async fn create_saved_searches_dynamic_execute_alt_v1(
configuration: &configuration::Configuration,
body: models::ApidomainDynamicExecuteSearchRequestV1,
app_id: Option<&str>,
include_schema_generation: Option<bool>,
include_test_data: Option<bool>,
infer_json_types: Option<bool>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
mode: Option<&str>,
x_cs_useruuid: Option<&str>,
) -> Result<
models::ApidomainQueryResponseWrapperV1,
Error<CreateSavedSearchesDynamicExecuteAltV1Error>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_app_id = app_id;
let p_query_include_schema_generation = include_schema_generation;
let p_query_include_test_data = include_test_data;
let p_query_infer_json_types = infer_json_types;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_query_mode = mode;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches-dynamic-execute/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_schema_generation {
req_builder = req_builder.query(&[("include_schema_generation", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_test_data {
req_builder = req_builder.query(&[("include_test_data", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_mode {
req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesDynamicExecuteAltV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_saved_searches_dynamic_execute_v1(
configuration: &configuration::Configuration,
body: models::ApidomainDynamicExecuteSearchRequestV1,
app_id: Option<&str>,
include_schema_generation: Option<bool>,
include_test_data: Option<bool>,
infer_json_types: Option<bool>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
mode: Option<&str>,
x_cs_useruuid: Option<&str>,
) -> Result<models::ApidomainQueryResponseWrapperV1, Error<CreateSavedSearchesDynamicExecuteV1Error>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_app_id = app_id;
let p_query_include_schema_generation = include_schema_generation;
let p_query_include_test_data = include_test_data;
let p_query_infer_json_types = infer_json_types;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_query_mode = mode;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches/execute-dynamic/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_schema_generation {
req_builder = req_builder.query(&[("include_schema_generation", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_test_data {
req_builder = req_builder.query(&[("include_test_data", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_mode {
req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesDynamicExecuteV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_saved_searches_execute_alt_v1(
configuration: &configuration::Configuration,
body: models::ApidomainSavedSearchExecuteRequestV1,
app_id: Option<&str>,
detailed: Option<bool>,
include_test_data: Option<bool>,
infer_json_types: Option<bool>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
x_cs_useruuid: Option<&str>,
) -> Result<models::ApidomainQueryResponseWrapperV1, Error<CreateSavedSearchesExecuteAltV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_app_id = app_id;
let p_query_detailed = detailed;
let p_query_include_test_data = include_test_data;
let p_query_infer_json_types = infer_json_types;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches-execute/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_detailed {
req_builder = req_builder.query(&[("detailed", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_test_data {
req_builder = req_builder.query(&[("include_test_data", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesExecuteAltV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_saved_searches_execute_v1(
configuration: &configuration::Configuration,
body: models::ApidomainSavedSearchExecuteRequestV1,
app_id: Option<&str>,
detailed: Option<bool>,
include_test_data: Option<bool>,
infer_json_types: Option<bool>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
x_cs_useruuid: Option<&str>,
) -> Result<models::ApidomainQueryResponseWrapperV1, Error<CreateSavedSearchesExecuteV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_app_id = app_id;
let p_query_detailed = detailed;
let p_query_include_test_data = include_test_data;
let p_query_infer_json_types = infer_json_types;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches/execute/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_detailed {
req_builder = req_builder.query(&[("detailed", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_include_test_data {
req_builder = req_builder.query(&[("include_test_data", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesExecuteV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_saved_searches_ingest_alt_v1(
configuration: &configuration::Configuration,
app_id: Option<&str>,
) -> Result<models::ClientDataIngestResponseWrapperV1, Error<CreateSavedSearchesIngestAltV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_app_id = app_id;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches-ingest/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesIngestAltV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_saved_searches_ingest_v1(
configuration: &configuration::Configuration,
app_id: Option<&str>,
) -> Result<models::ClientDataIngestResponseWrapperV1, Error<CreateSavedSearchesIngestV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_app_id = app_id;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches/ingest/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSavedSearchesIngestV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_saved_searches_execute_alt_v1(
configuration: &configuration::Configuration,
job_id: &str,
app_id: Option<&str>,
infer_json_types: Option<bool>,
job_status_only: Option<bool>,
limit: Option<&str>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
offset: Option<&str>,
x_cs_useruuid: Option<&str>,
) -> Result<models::ApidomainQueryResponseWrapperV1, Error<GetSavedSearchesExecuteAltV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_job_id = job_id;
let p_query_app_id = app_id;
let p_query_infer_json_types = infer_json_types;
let p_query_job_status_only = job_status_only;
let p_query_limit = limit;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_query_offset = offset;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches-execute/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("job_id", &p_query_job_id.to_string())]);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_job_status_only {
req_builder = req_builder.query(&[("job_status_only", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetSavedSearchesExecuteAltV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_saved_searches_execute_v1(
configuration: &configuration::Configuration,
job_id: &str,
app_id: Option<&str>,
infer_json_types: Option<bool>,
job_status_only: Option<bool>,
limit: Option<&str>,
match_response_schema: Option<bool>,
metadata: Option<bool>,
offset: Option<&str>,
x_cs_useruuid: Option<&str>,
) -> Result<models::ApidomainQueryResponseWrapperV1, Error<GetSavedSearchesExecuteV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_job_id = job_id;
let p_query_app_id = app_id;
let p_query_infer_json_types = infer_json_types;
let p_query_job_status_only = job_status_only;
let p_query_limit = limit;
let p_query_match_response_schema = match_response_schema;
let p_query_metadata = metadata;
let p_query_offset = offset;
let p_header_x_cs_useruuid = x_cs_useruuid;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches/execute/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("job_id", &p_query_job_id.to_string())]);
if let Some(ref param_value) = p_query_app_id {
req_builder = req_builder.query(&[("app_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_job_status_only {
req_builder = req_builder.query(&[("job_status_only", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_match_response_schema {
req_builder = req_builder.query(&[("match_response_schema", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_metadata {
req_builder = req_builder.query(&[("metadata", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_header_x_cs_useruuid {
req_builder = req_builder.header("X-CS-USERUUID", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainQueryResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetSavedSearchesExecuteV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_saved_searches_job_results_download_alt_v1(
configuration: &configuration::Configuration,
job_id: &str,
infer_json_types: Option<bool>,
result_format: Option<&str>,
) -> Result<reqwest::Response, Error<GetSavedSearchesJobResultsDownloadAltV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_job_id = job_id;
let p_query_infer_json_types = infer_json_types;
let p_query_result_format = result_format;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches-job-results-download/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("job_id", &p_query_job_id.to_string())]);
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_result_format {
req_builder = req_builder.query(&[("result_format", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(resp)
} else {
let content = resp.text().await?;
let entity: Option<GetSavedSearchesJobResultsDownloadAltV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_saved_searches_job_results_download_v1(
configuration: &configuration::Configuration,
job_id: &str,
infer_json_types: Option<bool>,
result_format: Option<&str>,
) -> Result<reqwest::Response, Error<GetSavedSearchesJobResultsDownloadV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_job_id = job_id;
let p_query_infer_json_types = infer_json_types;
let p_query_result_format = result_format;
let uri_str = format!(
"{}/loggingapi/entities/saved-searches/job-results-download/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("job_id", &p_query_job_id.to_string())]);
if let Some(ref param_value) = p_query_infer_json_types {
req_builder = req_builder.query(&[("infer_json_types", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_result_format {
req_builder = req_builder.query(&[("result_format", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(resp)
} else {
let content = resp.text().await?;
let entity: Option<GetSavedSearchesJobResultsDownloadV1Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ingest_data_async_v1(
configuration: &configuration::Configuration,
data_content: Option<&str>,
data_file: Option<std::path::PathBuf>,
repo: Option<&str>,
tag: Option<Vec<String>>,
tag_source: Option<&str>,
test_data: Option<bool>,
) -> Result<models::ClientDataIngestResponseWrapperV1, Error<IngestDataAsyncV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_form_data_content = data_content;
let _p_form_data_file = data_file;
let p_form_repo = repo;
let p_form_tag = tag;
let p_form_tag_source = tag_source;
let p_form_test_data = test_data;
let uri_str = format!(
"{}/loggingapi/entities/data-ingestion/ingest-async/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let mut multipart_form = reqwest::multipart::Form::new();
if let Some(param_value) = p_form_data_content {
multipart_form = multipart_form.text("data_content", param_value.to_string());
}
// TODO: support file upload for 'data_file' parameter
if let Some(param_value) = p_form_repo {
multipart_form = multipart_form.text("repo", param_value.to_string());
}
if let Some(param_value) = p_form_tag {
multipart_form = multipart_form.text(
"tag",
param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
);
}
if let Some(param_value) = p_form_tag_source {
multipart_form = multipart_form.text("tag_source", param_value.to_string());
}
if let Some(param_value) = p_form_test_data {
multipart_form = multipart_form.text("test_data", param_value.to_string());
}
req_builder = req_builder.multipart(multipart_form);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<IngestDataAsyncV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ingest_data_v1(
configuration: &configuration::Configuration,
data_content: Option<&str>,
data_file: Option<std::path::PathBuf>,
tag: Option<Vec<String>>,
tag_source: Option<&str>,
test_data: Option<bool>,
) -> Result<models::ClientDataIngestResponseWrapperV1, Error<IngestDataV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_form_data_content = data_content;
let _p_form_data_file = data_file;
let p_form_tag = tag;
let p_form_tag_source = tag_source;
let p_form_test_data = test_data;
let uri_str = format!(
"{}/loggingapi/entities/data-ingestion/ingest/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let mut multipart_form = reqwest::multipart::Form::new();
if let Some(param_value) = p_form_data_content {
multipart_form = multipart_form.text("data_content", param_value.to_string());
}
// TODO: support file upload for 'data_file' parameter
if let Some(param_value) = p_form_tag {
multipart_form = multipart_form.text(
"tag",
param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
);
}
if let Some(param_value) = p_form_tag_source {
multipart_form = multipart_form.text("tag_source", param_value.to_string());
}
if let Some(param_value) = p_form_test_data {
multipart_form = multipart_form.text("test_data", param_value.to_string());
}
req_builder = req_builder.multipart(multipart_form);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientDataIngestResponseWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<IngestDataV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_repos_v1(
configuration: &configuration::Configuration,
check_test_data: Option<bool>,
) -> Result<models::ApidomainRepoViewListItemWrapperV1, Error<ListReposV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_check_test_data = check_test_data;
let uri_str = format!("{}/loggingapi/combined/repos/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_check_test_data {
req_builder = req_builder.query(&[("check_test_data", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainRepoViewListItemWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainRepoViewListItemWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ListReposV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_view_v1(
configuration: &configuration::Configuration,
check_test_data: Option<bool>,
) -> Result<models::ApidomainRepoViewListItemWrapperV1, Error<ListViewV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_check_test_data = check_test_data;
let uri_str = format!("{}/loggingapi/entities/views/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_check_test_data {
req_builder = req_builder.query(&[("check_test_data", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApidomainRepoViewListItemWrapperV1`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApidomainRepoViewListItemWrapperV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ListViewV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}