Skip to content

Commit

Permalink
chore: enhance public connection details repose
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkr committed Nov 4, 2024
1 parent dc16d32 commit c906357
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
10 changes: 7 additions & 3 deletions integrationos-api/src/logic/connection_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use integrationos_domain::{
api_model_config::AuthMethod,
connection_definition::{
AuthSecret, ConnectionDefinition, ConnectionDefinitionType, ConnectionForm,
ConnectionStatus, FormDataItem, Frontend, Paths, PublicConnectionDetails, Spec,
ConnectionStatus, Filter, FormDataItem, Frontend, Paths, PublicConnectionDetails, Spec,
},
connection_model_definition::{ConnectionModelDefinition, CrudAction},
id::{prefix::IdPrefix, Id},
Expand Down Expand Up @@ -96,6 +96,8 @@ pub struct PublicGetConnectionDetailsResponse {
pub filtration: bool,
pub sorting: bool,
pub caveats: Vec<PublicConnectionDataCaveat>,
pub supported_filters: Option<Vec<Filter>>,
pub supported_sort_keys: Option<Vec<String>>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -286,9 +288,11 @@ pub async fn public_get_connection_details(
},
supported_actions,
pagination: model_features.pagination,
filtration: model_features.filtration,
sorting: model_features.sorting,
filtration: model_features.filtration.supported,
sorting: model_features.sorting.supported,
caveats,
supported_filters: model_features.filtration.filters.clone(),
supported_sort_keys: model_features.sorting.keys.clone(),
},
)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub struct PublicConnectionDetails {
pub struct ModelFeatures {
pub name: String,
pub pagination: bool,
pub filtration: bool,
pub sorting: bool,
pub filtration: ModelFilter,
pub sorting: ModelSorting,
}

#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq)]
Expand All @@ -64,6 +64,24 @@ pub struct Caveat {
pub comments: Vec<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ModelFilter {
pub supported: bool,
pub filters: Option<Vec<Filter>>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Filter {
pub key: String,
pub operators: Vec<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ModelSorting {
pub supported: bool,
pub keys: Option<Vec<String>>,
}

impl ConnectionDefinition {
pub fn new(
name: String,
Expand Down

0 comments on commit c906357

Please sign in to comment.