Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/apis/api_key_service_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct CreateApiKeyParams {
pub metadata: Option<serde_json::Value>,
pub user_id: Option<String>,
pub org_id: Option<String>,
pub display_name: Option<String>,
}

/// struct for passing parameters to the method [`import_api_key`]
Expand All @@ -38,6 +39,7 @@ pub struct ImportApiKeyParams {
pub metadata: Option<serde_json::Value>,
pub user_id: Option<String>,
pub org_id: Option<String>,
pub display_name: Option<String>,
}

/// struct for passing parameters to the method [`update_api_key`]
Expand Down Expand Up @@ -571,4 +573,4 @@ pub async fn validate_imported_api_key(
};
Err(Error::ResponseError(error))
}
}
}
1 change: 1 addition & 0 deletions src/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ pub mod org_service_api;
pub mod user_service_api;
pub mod employee_service_api;
pub mod mfa_service_api;
pub mod scim_service_api;

pub mod configuration;
58 changes: 58 additions & 0 deletions src/apis/org_service_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ pub enum DeleteOrgError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`set_oidc_idp_metadata`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetOidcIdpMetadataError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status404(serde_json::Value),
UnknownValue(serde_json::Value),
}

pub async fn add_user_to_org(
configuration: &configuration::Configuration,
params: AddUserToOrgParams,
Expand Down Expand Up @@ -1335,6 +1345,54 @@ pub async fn subscribe_org_to_role_mapping(
}
}

pub async fn set_oidc_idp_metadata(
configuration: &configuration::Configuration,
set_idp_request: crate::models::SetOidcIdpMetadataRequest,
) -> Result<crate::models::SuccessfulResponse, Error<SetOidcIdpMetadataError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/api/backend/v1/oidc_idp_metadata",
local_var_configuration.base_path,
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent);
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token);
};
local_var_req_builder = local_var_req_builder.header(
AUTH_HOSTNAME_HEADER,
local_var_configuration.auth_hostname.to_owned(),
);
local_var_req_builder = local_var_req_builder.json(&set_idp_request);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(SuccessfulResponse::new())
} else {
let local_var_entity: Option<SetOidcIdpMetadataError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn delete_org(
configuration: &configuration::Configuration,
params: DeleteOrgParams,
Expand Down
226 changes: 226 additions & 0 deletions src/apis/scim_service_api.rs
Comment thread
pfvatterott marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
/*
* propelauth
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/

use reqwest;

use super::{configuration, Error};
use crate::propelauth::auth::AUTH_HOSTNAME_HEADER;
use crate::apis::ResponseContent;

/// struct for passing parameters to the method [`fetch_org_scim_groups`]
#[derive(Clone, Debug, Default)]
pub struct FetchOrgScimGroupsRequest {
pub org_id: String,
pub user_id: Option<String>,
pub page_size: Option<i64>,
pub page_number: Option<i64>,
}

/// struct for passing parameters to the method [`fetch_scim_group`]
#[derive(Clone, Debug, Default)]
pub struct FetchScimGroupRequest {
pub org_id: String,
pub group_id: String,
pub members_page_size: Option<i64>,
pub members_page_number: Option<i64>,
}

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ScimGroupResult {
#[serde(rename = "group_id")]
pub group_id: String,
#[serde(rename = "display_name")]
pub display_name: String,
#[serde(rename = "external_id_from_idp")]
pub external_id_from_idp: Option<String>,
}

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ScimGroupResultPage {
#[serde(rename = "groups")]
pub groups: Vec<ScimGroupResult>,
#[serde(rename = "total_groups")]
pub total_groups: i64,
#[serde(rename = "page_number")]
pub page_number: i64,
#[serde(rename = "page_size")]
pub page_size: i64,
}

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ScimGroupMember {
#[serde(rename = "user_id")]
pub user_id: String
}

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ScimGroup {
#[serde(rename = "group_id")]
pub group_id: String,
#[serde(rename = "display_name")]
pub display_name: String,
#[serde(rename = "external_id_from_idp")]
pub external_id_from_idp: Option<String>,
#[serde(rename = "members")]
pub members: Vec<ScimGroupMember>,
}

/// struct for typed errors of method [`fetch_org_scim_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FetchOrgScimGroupsError {
Status401(serde_json::Value),
Status404(serde_json::Value),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`fetch_scim_group`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FetchScimGroupError {
Status401(serde_json::Value),
Status404(serde_json::Value),
UnknownValue(serde_json::Value),
}


pub async fn fetch_org_scim_groups(
configuration: &configuration::Configuration,
params: FetchOrgScimGroupsRequest,
) -> Result<ScimGroupResultPage, Error<FetchOrgScimGroupsError>> {
let local_var_configuration = configuration;

// unbox the parameters
let FetchOrgScimGroupsRequest {
org_id,
user_id,
page_size,
page_number,
} = params;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/api/backend/v1/scim/{org_id}/groups",
local_var_configuration.base_path,
org_id = crate::apis::urlencode(org_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

if let Some(ref local_var_str) = page_size {
local_var_req_builder =
local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page_number {
local_var_req_builder =
local_var_req_builder.query(&[("page_number", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = user_id {
local_var_req_builder =
local_var_req_builder.query(&[("user_id", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.header(
AUTH_HOSTNAME_HEADER,
local_var_configuration.auth_hostname.to_owned(),
);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<FetchOrgScimGroupsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error: crate::apis::ResponseContent<FetchOrgScimGroupsError> = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn fetch_scim_group(
configuration: &configuration::Configuration,
params: FetchScimGroupRequest,
) -> Result<ScimGroup, Error<FetchScimGroupError>> {
let local_var_configuration = configuration;

// unbox the parameters
let FetchScimGroupRequest {
org_id,
group_id,
members_page_number,
members_page_size
} = params;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/api/backend/v1/scim/{org_id}/groups/{group_id}",
local_var_configuration.base_path,
org_id = crate::apis::urlencode(org_id),
group_id = crate::apis::urlencode(group_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

if let Some(ref local_var_str) = members_page_size {
local_var_req_builder =
local_var_req_builder.query(&[("members_page_size", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = members_page_number {
local_var_req_builder =
local_var_req_builder.query(&[("members_page_number", &local_var_str.to_string())]);
}

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.header(
AUTH_HOSTNAME_HEADER,
local_var_configuration.auth_hostname.to_owned(),
);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<FetchScimGroupError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error: crate::apis::ResponseContent<FetchScimGroupError> = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
Loading
Loading