Skip to content

Commit

Permalink
Update to latest fiberplane/fiberplane and openapi schema (#278)
Browse files Browse the repository at this point in the history
* Update to latest fiberplane/fiberplane and openapi schema

* Bump commit version of fiberplane/fiberplane

* Update Changelog
  • Loading branch information
hatchan authored Feb 26, 2024
1 parent ea59850 commit 95c4904
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 52 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ The format of this file is based on [Keep a Changelog](https://keepachangelog.co

## [2.22.0] - TBD

TBD
### Changed

- Update to latest fiberplane-client and schema. For more information see
fiberplane/fiberplane/174 (#278)

## [2.21.0] - 2024-02-26

Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 12 additions & 16 deletions src/front_matter.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
use std::{io::stdin, path::PathBuf};

use anyhow::{Context, Result};
use clap::{Parser, ValueHint};
use fiberplane::{
api_client::{
workspace_front_matter_schemas_create, workspace_front_matter_schemas_get_by_name,
},
base64uuid::Base64Uuid,
models::{
front_matter_schemas::FrontMatterSchema, names::Name,
workspaces::NewWorkspaceFrontMatterSchema,
},
use fiberplane::api_client::{
workspace_front_matter_schema_create, workspace_front_matter_schema_get_by_name,
};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::models::front_matter_schemas::FrontMatterSchema;
use fiberplane::models::names::Name;
use fiberplane::models::workspaces::NewWorkspaceFrontMatterSchema;
use std::{io::stdin, path::PathBuf};
use url::Url;

use crate::{
Expand Down Expand Up @@ -159,7 +155,7 @@ pub async fn handle_set_command(args: SetArgs) -> Result<()> {
serde_json::from_str(&content).with_context(|| "cannot parse content as schema")?
};

workspace_front_matter_schemas_create(
workspace_front_matter_schema_create(
&client,
workspace_id,
NewWorkspaceFrontMatterSchema::builder()
Expand Down Expand Up @@ -189,7 +185,7 @@ pub async fn handle_create_command(args: CreateArgs) -> Result<()> {
serde_json::from_str(&content).with_context(|| "cannot parse content as schema")?
};

workspace_front_matter_schemas_create(
workspace_front_matter_schema_create(
&client,
workspace_id,
NewWorkspaceFrontMatterSchema::builder()
Expand All @@ -208,7 +204,7 @@ pub async fn handle_get_command(args: GetArgs) -> Result<()> {
let (workspace_id, fmc_name) =
front_matter_collection_picker(&client, args.workspace_id, args.name).await?;

let fmc = workspace_front_matter_schemas_get_by_name(&client, workspace_id, &fmc_name).await?;
let fmc = workspace_front_matter_schema_get_by_name(&client, workspace_id, &fmc_name).await?;

println!(
"{}",
Expand All @@ -225,9 +221,9 @@ pub async fn handle_delete_command(args: DeleteArgs) -> Result<()> {
front_matter_collection_picker(&client, args.workspace_id, args.name).await?;

unimplemented!(
"The workspace_front_matter_schemas_delete endpoint is missing from the API for now."
"The workspace_front_matter_schema_delete endpoint is missing from the API for now."
);
// workspace_front_matter_schemas_delete(&client, workspace_id, &fmc_name).await?;
// workspace_front_matter_schema_delete(&client, workspace_id, &fmc_name).await?;

// Ok(())
}
12 changes: 6 additions & 6 deletions src/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use dialoguer::{theme, Confirm, FuzzySelect, Input, MultiSelect, Select};
use fiberplane::api_client::clients::ApiClient;
use fiberplane::api_client::{
data_source_get, data_source_list, notebook_search, proxy_list, snippet_list, template_list,
trigger_list, views_get, webhook_delivery_list, webhooks_list,
workspace_front_matter_schemas_get, workspace_list, workspace_users_list,
trigger_list, view_list, webhook_delivery_list, webhook_list,
workspace_front_matter_schema_get, workspace_list, workspace_user_list,
};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::models::data_sources::DataSource;
Expand Down Expand Up @@ -578,7 +578,7 @@ pub async fn view_picker(
pb.set_message("Fetching views");
pb.enable_steady_tick(Duration::from_millis(100));

let results = views_get(client, workspace_id, None, None, None, None).await?;
let results = view_list(client, workspace_id, None, None, None, None).await?;

pb.finish_and_clear();

Expand Down Expand Up @@ -690,7 +690,7 @@ pub async fn workspace_user_picker(
pb.set_message("Fetching workspace users");
pb.enable_steady_tick(Duration::from_millis(100));

let results = workspace_users_list(client, *workspace, Some("name"), Some("ascending")).await?;
let results = workspace_user_list(client, *workspace, Some("name"), Some("ascending")).await?;

pb.finish_and_clear();

Expand Down Expand Up @@ -740,7 +740,7 @@ pub async fn webhook_picker(
pb.enable_steady_tick(Duration::from_millis(100));

let max = Pagination::max();
let results = webhooks_list(
let results = webhook_list(
client,
workspace,
Some(max.page as i32),
Expand Down Expand Up @@ -891,7 +891,7 @@ pub async fn front_matter_collection_picker(
pb.set_message("Fetching front matter collections");
pb.enable_steady_tick(Duration::from_millis(100));

let results = workspace_front_matter_schemas_get(config, workspace_id).await?;
let results = workspace_front_matter_schema_get(config, workspace_id).await?;

pb.finish_and_clear();

Expand Down
4 changes: 2 additions & 2 deletions src/notebooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use fiberplane::api_client::{
front_matter_add_keys, front_matter_delete, front_matter_delete_key, front_matter_update,
front_matter_update_key, notebook_cells_append, notebook_create, notebook_delete,
notebook_duplicate, notebook_get, notebook_list, notebook_search, notebook_snippet_insert,
workspace_front_matter_schemas_get_by_name,
workspace_front_matter_schema_get_by_name,
};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::markdown::{markdown_to_notebook, notebook_to_markdown};
Expand Down Expand Up @@ -1112,7 +1112,7 @@ async fn handle_front_matter_add_collection_command(
front_matter_collection_picker(&client, args.workspace_id, args.name).await?;
let notebook_id = notebook_picker(&client, args.notebook_id, Some(workspace_id)).await?;

let fmc = workspace_front_matter_schemas_get_by_name(&client, workspace_id, &fmc_name).await?;
let fmc = workspace_front_matter_schema_get_by_name(&client, workspace_id, &fmc_name).await?;

let insertions: Vec<FrontMatterSchemaRow> = fmc
.iter()
Expand Down
6 changes: 3 additions & 3 deletions src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::KeyValueArgument;
use anyhow::Result;
use clap::{Parser, ValueEnum};
use cli_table::Table;
use fiberplane::api_client::{view_delete, view_update, views_create, views_get};
use fiberplane::api_client::{view_create, view_delete, view_list, view_update};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::models::labels::Label;
use fiberplane::models::names::Name;
Expand Down Expand Up @@ -133,7 +133,7 @@ async fn handle_create(args: CreateArguments) -> Result<()> {
view.sort_by = args.sort_by;
view.sort_direction = args.sort_direction;

let view = views_create(&client, workspace_id, view).await?;
let view = view_create(&client, workspace_id, view).await?;

info!("Successfully created new view");

Expand Down Expand Up @@ -184,7 +184,7 @@ async fn handle_list(args: ListArguments) -> Result<()> {

let workspace_id = workspace_picker(&client, args.workspace_id).await?;

let views = views_get(
let views = view_list(
&client,
workspace_id,
args.sort_by.map(Into::<&str>::into),
Expand Down
4 changes: 2 additions & 2 deletions src/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use clap::ValueEnum;
use cli_table::Table;
use fiberplane::api_client::{
webhook_create, webhook_delete, webhook_delivery_get, webhook_delivery_list,
webhook_delivery_resend, webhook_update, webhooks_list,
webhook_delivery_resend, webhook_list, webhook_update,
};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::models::webhooks::{
Expand Down Expand Up @@ -170,7 +170,7 @@ async fn handle_webhook_list(args: ListArgs) -> Result<()> {
let client = api_client_configuration(args.token, args.config, args.base_url).await?;
let workspace_id = workspace_picker(&client, args.workspace_id).await?;

let webhooks = webhooks_list(&client, workspace_id, args.page, args.limit).await?;
let webhooks = webhook_list(&client, workspace_id, args.page, args.limit).await?;

match args.output {
WebhookOutput::Table => {
Expand Down
18 changes: 9 additions & 9 deletions src/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use clap::{Parser, ValueEnum};
use cli_table::Table;
use dialoguer::FuzzySelect;
use fiberplane::api_client::{
workspace_create, workspace_delete, workspace_get, workspace_invite, workspace_invite_delete,
workspace_invite_get, workspace_leave, workspace_list, workspace_update, workspace_user_remove,
workspace_user_update, workspace_users_list,
workspace_create, workspace_delete, workspace_get, workspace_invite_create,
workspace_invite_delete, workspace_invite_get, workspace_leave, workspace_list,
workspace_update, workspace_user_list, workspace_user_remove, workspace_user_update,
};
use fiberplane::base64uuid::Base64Uuid;
use fiberplane::models::data_sources::{ProviderType, SelectedDataSource};
Expand All @@ -21,8 +21,8 @@ use fiberplane::models::sorting::{
WorkspaceMembershipSortFields,
};
use fiberplane::models::workspaces::{
AuthRole, Membership, NewWorkspace, NewWorkspaceInvite, UpdateWorkspace, Workspace,
WorkspaceInvite, WorkspaceInviteResponse, WorkspaceUserUpdate,
AuthRole, Membership, NewWorkspace, NewWorkspaceInvite, UpdateWorkspace, UpdateWorkspaceUser,
Workspace, WorkspaceInvite, WorkspaceInviteResponse,
};
use std::collections::BTreeMap;
use std::{fmt::Display, path::PathBuf};
Expand Down Expand Up @@ -311,7 +311,7 @@ async fn handle_invite_create(args: InviteCreateArgs) -> Result<()> {
let workspace_id = workspace_picker(&client, args.workspace_id).await?;
let email = text_req("Email", args.email, None)?;

let invite = workspace_invite(
let invite = workspace_invite_create(
&client,
workspace_id,
NewWorkspaceInvite::new(email, args.role),
Expand Down Expand Up @@ -456,7 +456,7 @@ async fn handle_user_list(args: UserListArgs) -> Result<()> {
let client = api_client_configuration(args.token, args.config, args.base_url).await?;
let workspace_id = workspace_picker(&client, args.workspace_id).await?;

let users = workspace_users_list(
let users = workspace_user_list(
&client,
workspace_id,
args.sort_by.map(Into::<&str>::into),
Expand Down Expand Up @@ -504,8 +504,8 @@ async fn handle_user_update(args: UserUpdateArgs) -> Result<()> {
let user = workspace_user_picker(&client, &workspace_id, args.user_id).await?;

let payload = match args.role {
Some(role) => WorkspaceUserUpdate::builder().role(role).build(),
None => WorkspaceUserUpdate::builder().build(),
Some(role) => UpdateWorkspaceUser::builder().role(role).build(),
None => UpdateWorkspaceUser::builder().build(),
};
workspace_user_update(&client, workspace_id, user, payload).await?;

Expand Down

0 comments on commit 95c4904

Please sign in to comment.