From 1311b0c620292b8054bca5c0d2a7eba253d7d954 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 01/12] feat(organization_membership)!: Split organization membership operations from user_management into dedicated service --- src/resources/organization_membership.rs | 415 +++++++ tests/organization_membership_test.rs | 1382 ++++++++++++++++++++++ 2 files changed, 1797 insertions(+) create mode 100644 src/resources/organization_membership.rs create mode 100644 tests/organization_membership_test.rs diff --git a/src/resources/organization_membership.rs b/src/resources/organization_membership.rs new file mode 100644 index 00000000..5df06cd3 --- /dev/null +++ b/src/resources/organization_membership.rs @@ -0,0 +1,415 @@ +// Code generated by oagen. DO NOT EDIT. + +use crate::client::Client; +#[allow(unused_imports)] +use crate::enums::*; +use crate::error::Error; +#[allow(unused_imports)] +use crate::models::*; +use serde::Serialize; + +pub struct OrganizationMembershipApi<'a> { + pub(crate) client: &'a Client, +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(untagged)] +pub enum Role { + Single { role_slug: String }, + Multiple { role_slugs: String }, +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct CreateOrganizationMembershipParamsBody { + /// The ID of the [user](https://workos.com/docs/reference/authkit/user). + /// + /// Required. + pub user_id: String, + /// The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. + /// + /// Required. + pub organization_id: String, + #[serde(flatten)] + #[serde(skip_serializing_if = "Option::is_none")] + pub role: Option, +} + +impl CreateOrganizationMembershipParamsBody { + /// Construct a new `CreateOrganizationMembershipParamsBody` with the required fields set. + pub fn new(user_id: impl Into, organization_id: impl Into) -> Self { + Self { + user_id: user_id.into(), + organization_id: organization_id.into(), + role: Default::default(), + } + } +} + +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Default)] +pub struct UpdateOrganizationMembershipParamsBody { + #[serde(flatten)] + #[serde(skip_serializing_if = "Option::is_none")] + pub role: Option, +} + +impl UpdateOrganizationMembershipParamsBody { + /// Construct a new `UpdateOrganizationMembershipParamsBody` with the required fields set. + pub fn new() -> Self { + Self { + role: Default::default(), + } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct ListOrganizationMembershipsParams { + /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + #[serde(skip_serializing_if = "Option::is_none")] + pub before: Option, + /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + #[serde(skip_serializing_if = "Option::is_none")] + pub after: Option, + /// Upper limit on the number of objects to return, between `1` and `100`. + /// + /// Defaults to `10`. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + /// + /// Defaults to `desc`. + #[serde(skip_serializing_if = "Option::is_none")] + pub order: Option, + /// The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. + #[serde(skip_serializing_if = "Option::is_none")] + pub organization_id: Option, + /// Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(serialize_with = "crate::query::serialize_comma_separated_opt")] + pub statuses: Option>, + /// The ID of the [user](https://workos.com/docs/reference/authkit/user). + #[serde(skip_serializing_if = "Option::is_none")] + pub user_id: Option, +} + +impl Default for ListOrganizationMembershipsParams { + #[allow(deprecated)] + fn default() -> Self { + Self { + before: Default::default(), + after: Default::default(), + limit: Some(10), + order: Some(PaginationOrder::Desc), + organization_id: Default::default(), + statuses: Default::default(), + user_id: Default::default(), + } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct CreateOrganizationMembershipParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: CreateOrganizationMembershipParamsBody, +} + +impl CreateOrganizationMembershipParams { + /// Construct a new `CreateOrganizationMembershipParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: CreateOrganizationMembershipParamsBody) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct UpdateOrganizationMembershipParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: UpdateOrganizationMembershipParamsBody, +} + +impl UpdateOrganizationMembershipParams { + /// Construct a new `UpdateOrganizationMembershipParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: UpdateOrganizationMembershipParamsBody) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct ListOrganizationMembershipGroupsParams { + /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + #[serde(skip_serializing_if = "Option::is_none")] + pub before: Option, + /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + #[serde(skip_serializing_if = "Option::is_none")] + pub after: Option, + /// Upper limit on the number of objects to return, between `1` and `100`. + /// + /// Defaults to `10`. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + /// + /// Defaults to `desc`. + #[serde(skip_serializing_if = "Option::is_none")] + pub order: Option, +} + +impl Default for ListOrganizationMembershipGroupsParams { + #[allow(deprecated)] + fn default() -> Self { + Self { + before: Default::default(), + after: Default::default(), + limit: Some(10), + order: Some(PaginationOrder::Desc), + } + } +} + +impl<'a> OrganizationMembershipApi<'a> { + /// List organization memberships + /// + /// Get a list of all organization memberships matching the criteria specified. At least one of `user_id` or `organization_id` must be provided. By default only active memberships are returned. Use the `statuses` parameter to filter by other statuses. + pub async fn list_organization_memberships( + &self, + params: ListOrganizationMembershipsParams, + ) -> Result, Error> { + self.list_organization_memberships_with_options(params, None) + .await + } + + /// Variant of [`Self::list_organization_memberships`] that accepts per-request [`crate::RequestOptions`]. + pub async fn list_organization_memberships_with_options( + &self, + params: ListOrganizationMembershipsParams, + options: Option<&crate::RequestOptions>, + ) -> Result, Error> { + let path = "/user_management/organization_memberships".to_string(); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, ¶ms, options) + .await + } + + /// Create an organization membership + /// + /// Creates a new `active` organization membership for the given organization and user. + /// + /// Calling this API with an organization and user that match an `inactive` organization membership will activate the membership with the specified role(s). + pub async fn create_organization_membership( + &self, + params: CreateOrganizationMembershipParams, + ) -> Result { + self.create_organization_membership_with_options(params, None) + .await + } + + /// Variant of [`Self::create_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn create_organization_membership_with_options( + &self, + params: CreateOrganizationMembershipParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/user_management/organization_memberships".to_string(); + let method = http::Method::POST; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Get an organization membership + /// + /// Get the details of an existing organization membership. + pub async fn get_organization_membership( + &self, + id: &str, + ) -> Result { + self.get_organization_membership_with_options(id, None) + .await + } + + /// Variant of [`Self::get_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn get_organization_membership_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/user_management/organization_memberships/{id}"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// Update an organization membership + /// + /// Update the details of an existing organization membership. + pub async fn update_organization_membership( + &self, + id: &str, + params: UpdateOrganizationMembershipParams, + ) -> Result { + self.update_organization_membership_with_options(id, params, None) + .await + } + + /// Variant of [`Self::update_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn update_organization_membership_with_options( + &self, + id: &str, + params: UpdateOrganizationMembershipParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/user_management/organization_memberships/{id}"); + let method = http::Method::PUT; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Delete an organization membership + /// + /// Permanently deletes an existing organization membership. It cannot be undone. + pub async fn delete_organization_membership(&self, id: &str) -> Result<(), Error> { + self.delete_organization_membership_with_options(id, None) + .await + } + + /// Variant of [`Self::delete_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn delete_organization_membership_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result<(), Error> { + let id = crate::client::path_segment(id); + let path = format!("/user_management/organization_memberships/{id}"); + let method = http::Method::DELETE; + self.client + .request_with_query_opts_empty(method, &path, &(), options) + .await + } + + /// Deactivate an organization membership + /// + /// Deactivates an `active` organization membership. Emits an [organization_membership.updated](https://workos.com/docs/events/organization-membership) event upon successful deactivation. + /// + /// - Deactivating an `inactive` membership is a no-op and does not emit an event. + /// - Deactivating a `pending` membership returns an error. This membership should be [deleted](https://workos.com/docs/reference/authkit/organization-membership/delete) instead. + /// + /// See the [membership management documentation](https://workos.com/docs/authkit/users-organizations/organizations/membership-management) for additional details. + pub async fn deactivate_organization_membership( + &self, + id: &str, + ) -> Result { + self.deactivate_organization_membership_with_options(id, None) + .await + } + + /// Variant of [`Self::deactivate_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn deactivate_organization_membership_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/user_management/organization_memberships/{id}/deactivate"); + let method = http::Method::PUT; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// Reactivate an organization membership + /// + /// Reactivates an `inactive` organization membership, retaining the pre-existing role(s). Emits an [organization_membership.updated](https://workos.com/docs/events/organization-membership) event upon successful reactivation. + /// + /// - Reactivating an `active` membership is a no-op and does not emit an event. + /// - Reactivating a `pending` membership returns an error. The user needs to [accept the invitation](https://workos.com/docs/authkit/invitations) instead. + /// + /// See the [membership management documentation](https://workos.com/docs/authkit/users-organizations/organizations/membership-management) for additional details. + pub async fn reactivate_organization_membership( + &self, + id: &str, + ) -> Result { + self.reactivate_organization_membership_with_options(id, None) + .await + } + + /// Variant of [`Self::reactivate_organization_membership`] that accepts per-request [`crate::RequestOptions`]. + pub async fn reactivate_organization_membership_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/user_management/organization_memberships/{id}/reactivate"); + let method = http::Method::PUT; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// List groups + /// + /// Get a list of groups that an organization membership belongs to. + pub async fn list_organization_membership_groups( + &self, + om_id: &str, + params: ListOrganizationMembershipGroupsParams, + ) -> Result { + self.list_organization_membership_groups_with_options(om_id, params, None) + .await + } + + /// Variant of [`Self::list_organization_membership_groups`] that accepts per-request [`crate::RequestOptions`]. + pub async fn list_organization_membership_groups_with_options( + &self, + om_id: &str, + params: ListOrganizationMembershipGroupsParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let om_id = crate::client::path_segment(om_id); + let path = format!("/user_management/organization_memberships/{om_id}/groups"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, ¶ms, options) + .await + } + + /// Returns an async [`futures_util::Stream`] that yields every `Group` + /// across all pages, advancing the `after` cursor under the hood. + /// + /// ```ignore + /// use futures_util::TryStreamExt; + /// let all: Vec = self + /// .list_organization_membership_groups_auto_paging(om_id, params) + /// .try_collect() + /// .await?; + /// ``` + pub fn list_organization_membership_groups_auto_paging( + &self, + om_id: impl Into, + params: ListOrganizationMembershipGroupsParams, + ) -> impl futures_util::Stream> + '_ { + let om_id: String = om_id.into(); + crate::pagination::auto_paginate_pages(move |after| { + let om_id = om_id.clone(); + let mut params = params.clone(); + params.after = after; + async move { + let page = self + .list_organization_membership_groups(&om_id, params) + .await?; + Ok((page.data, page.list_metadata.after)) + } + }) + } +} diff --git a/tests/organization_membership_test.rs b/tests/organization_membership_test.rs new file mode 100644 index 00000000..67dc1b33 --- /dev/null +++ b/tests/organization_membership_test.rs @@ -0,0 +1,1382 @@ +// Code generated by oagen. DO NOT EDIT. + +mod common; + +use wiremock::matchers::{method, path as path_matcher}; +use wiremock::{Mock, MockServer, ResponseTemplate}; +use workos::Error; + +#[tokio::test] +async fn organization_membership_list_organization_memberships_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(ResponseTemplate::new(200).set_body_string("[{\"object\":\"organization_membership\",\"id\":\"om_01HXYZ123456789ABCDEFGHIJ\",\"user_id\":\"user_01E4ZCR3C56J083X43JQXF3JK5\",\"organization_id\":\"org_01EHZNVPK3SFK441A1RGBFSHRT\",\"status\":\"active\",\"directory_managed\":false,\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\",\"role\":{\"slug\":\"admin\"},\"user\":{\"object\":\"user\",\"id\":\"user_01E4ZCR3C56J083X43JQXF3JK5\",\"first_name\":\"Marcelina\",\"last_name\":\"Davis\",\"profile_picture_url\":\"https://workoscdn.com/images/v1/123abc\",\"email\":\"marcelina.davis@example.com\",\"email_verified\":true,\"external_id\":\"f1ffa2b2-c20b-4d39-be5c-212726e11222\",\"last_sign_in_at\":\"2025-06-25T19:07:33.155Z\",\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\"}}]")) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await; +} + +#[tokio::test] +async fn organization_membership_list_organization_memberships_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_list_organization_memberships_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_list_organization_memberships_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_list_organization_memberships_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_list_organization_memberships_empty_page() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(ResponseTemplate::new(200).set_body_string("[]")) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let resp = client + .organization_membership() + .list_organization_memberships( + workos::organization_membership::ListOrganizationMembershipsParams::default(), + ) + .await + .expect("expected success"); + assert!(resp.is_empty(), "expected empty data array"); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/organization_membership.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await; +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn organization_membership_create_organization_membership_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("POST")) + .and(path_matcher("/user_management/organization_memberships")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .create_organization_membership( + workos::organization_membership::CreateOrganizationMembershipParams::new( + workos::organization_membership::CreateOrganizationMembershipParamsBody::new( + "stub_user_id".to_string(), + "stub_organization_id".to_string(), + ), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn organization_membership_get_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/user_organization_membership.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .get_organization_membership("test_id") + .await; +} + +#[tokio::test] +async fn organization_membership_get_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .get_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_get_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .get_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_get_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .get_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_get_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .get_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/user_organization_membership.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await; +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn organization_membership_update_organization_membership_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .update_organization_membership( + "test_id", + workos::organization_membership::UpdateOrganizationMembershipParams::new( + workos::organization_membership::UpdateOrganizationMembershipParamsBody::new(), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(ResponseTemplate::new(200).set_body_string("{}")) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .delete_organization_membership("test_id") + .await; +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn organization_membership_delete_organization_membership_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("DELETE")) + .and(path_matcher( + "/user_management/organization_memberships/test_id", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .delete_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/organization_membership.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await; +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn organization_membership_deactivate_organization_membership_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/deactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .deactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_round_trip() { + let server = MockServer::start().await; + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/user_organization_membership.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await; +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn organization_membership_reactivate_organization_membership_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("PUT")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/reactivate", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .reactivate_organization_membership("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with( + ResponseTemplate::new(200).set_body_string(include_str!("fixtures/group_list.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await; +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn organization_membership_list_organization_membership_groups_empty_page() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher( + "/user_management/organization_memberships/test_id/groups", + )) + .respond_with(ResponseTemplate::new(200).set_body_string( + "{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}", + )) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let resp = client + .organization_membership() + .list_organization_membership_groups( + "test_id", + workos::organization_membership::ListOrganizationMembershipGroupsParams::default(), + ) + .await + .expect("expected success"); + assert!(resp.data.is_empty(), "expected empty data array"); +} From 3a3ba0b0c9139c5e97143db75822e2938bce1569 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 02/12] feat(radar)!: Remove deprecated action and control fields from Radar standalone assessment --- src/enums/radar_standalone_assess_request_action.rs | 10 ---------- src/enums/radar_standalone_response_control.rs | 6 ------ src/models/radar_standalone_assess_request.rs | 6 ------ 3 files changed, 22 deletions(-) diff --git a/src/enums/radar_standalone_assess_request_action.rs b/src/enums/radar_standalone_assess_request_action.rs index d7f3774f..cea3168d 100644 --- a/src/enums/radar_standalone_assess_request_action.rs +++ b/src/enums/radar_standalone_assess_request_action.rs @@ -7,8 +7,6 @@ use std::str::FromStr; #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum RadarStandaloneAssessRequestAction { - Login, - Signup, SignUp, SignIn, /// Wire value not recognized by this SDK version. The original @@ -24,8 +22,6 @@ impl RadarStandaloneAssessRequestAction { #[allow(deprecated)] pub fn as_str(&self) -> &str { match self { - Self::Login => "login", - Self::Signup => "signup", Self::SignUp => "sign-up", Self::SignIn => "sign-in", Self::Unknown(s) => s.as_str(), @@ -50,14 +46,8 @@ impl FromStr for RadarStandaloneAssessRequestAction { #[allow(deprecated)] fn from_str(s: &str) -> Result { Ok(match s { - "login" => Self::Login, - "signup" => Self::Signup, "sign-up" => Self::SignUp, - "sign_up" => Self::SignUp, - "sign up" => Self::SignUp, "sign-in" => Self::SignIn, - "sign_in" => Self::SignIn, - "sign in" => Self::SignIn, other => Self::Unknown(other.to_string()), }) } diff --git a/src/enums/radar_standalone_response_control.rs b/src/enums/radar_standalone_response_control.rs index 60ccf69a..ba236dcd 100644 --- a/src/enums/radar_standalone_response_control.rs +++ b/src/enums/radar_standalone_response_control.rs @@ -9,9 +9,7 @@ use std::str::FromStr; pub enum RadarStandaloneResponseControl { BotDetection, BruteForceAttack, - CredentialStuffing, DomainSignUpRateLimit, - IpSignUpRateLimit, ImpossibleTravel, RepeatSignUp, StaleAccount, @@ -32,9 +30,7 @@ impl RadarStandaloneResponseControl { match self { Self::BotDetection => "bot_detection", Self::BruteForceAttack => "brute_force_attack", - Self::CredentialStuffing => "credential_stuffing", Self::DomainSignUpRateLimit => "domain_sign_up_rate_limit", - Self::IpSignUpRateLimit => "ip_sign_up_rate_limit", Self::ImpossibleTravel => "impossible_travel", Self::RepeatSignUp => "repeat_sign_up", Self::StaleAccount => "stale_account", @@ -64,9 +60,7 @@ impl FromStr for RadarStandaloneResponseControl { Ok(match s { "bot_detection" => Self::BotDetection, "brute_force_attack" => Self::BruteForceAttack, - "credential_stuffing" => Self::CredentialStuffing, "domain_sign_up_rate_limit" => Self::DomainSignUpRateLimit, - "ip_sign_up_rate_limit" => Self::IpSignUpRateLimit, "impossible_travel" => Self::ImpossibleTravel, "repeat_sign_up" => Self::RepeatSignUp, "stale_account" => Self::StaleAccount, diff --git a/src/models/radar_standalone_assess_request.rs b/src/models/radar_standalone_assess_request.rs index 46b5b717..107a9ed9 100644 --- a/src/models/radar_standalone_assess_request.rs +++ b/src/models/radar_standalone_assess_request.rs @@ -17,10 +17,4 @@ pub struct RadarStandaloneAssessRequest { pub auth_method: RadarStandaloneAssessRequestAuthMethod, /// The action being performed. pub action: RadarStandaloneAssessRequestAction, - /// An optional device fingerprint for the request. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub device_fingerprint: Option, - /// An optional bot detection score for the request. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub bot_score: Option, } From 00eaa842fdd44c32e0e7282ba3c7b7aa6ed5649c Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 03/12] feat(vault): Add Vault service with key management and object storage APIs --- src/enums/vault_order.rs | 83 +++++ src/models/actor.rs | 15 + src/models/create_data_key_request.rs | 12 + src/models/create_data_key_response.rs | 18 ++ src/models/create_object_request.rs | 16 + src/models/decrypt_request.rs | 12 + src/models/decrypt_response.rs | 14 + src/models/delete_object_response.rs | 14 + src/models/error.rs | 13 + src/models/list_metadata.rs | 17 + src/models/object.rs | 18 ++ src/models/object_list_response.rs | 13 + src/models/object_metadata.rs | 25 ++ src/models/object_summary.rs | 18 ++ src/models/object_version.rs | 21 ++ src/models/object_without_value.rs | 16 + src/models/rekey_request.rs | 14 + src/models/update_object_request.rs | 15 + src/models/version_list_response.rs | 13 + src/resources/vault.rs | 415 +++++++++++++++++++++++++ 20 files changed, 782 insertions(+) create mode 100644 src/enums/vault_order.rs create mode 100644 src/models/actor.rs create mode 100644 src/models/create_data_key_request.rs create mode 100644 src/models/create_data_key_response.rs create mode 100644 src/models/create_object_request.rs create mode 100644 src/models/decrypt_request.rs create mode 100644 src/models/decrypt_response.rs create mode 100644 src/models/delete_object_response.rs create mode 100644 src/models/error.rs create mode 100644 src/models/list_metadata.rs create mode 100644 src/models/object.rs create mode 100644 src/models/object_list_response.rs create mode 100644 src/models/object_metadata.rs create mode 100644 src/models/object_summary.rs create mode 100644 src/models/object_version.rs create mode 100644 src/models/object_without_value.rs create mode 100644 src/models/rekey_request.rs create mode 100644 src/models/update_object_request.rs create mode 100644 src/models/version_list_response.rs create mode 100644 src/resources/vault.rs diff --git a/src/enums/vault_order.rs b/src/enums/vault_order.rs new file mode 100644 index 00000000..c1d4c3f6 --- /dev/null +++ b/src/enums/vault_order.rs @@ -0,0 +1,83 @@ +// Code generated by oagen. DO NOT EDIT. + +use serde::{Deserialize, Serialize}; +use std::fmt; +use std::str::FromStr; + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum VaultOrder { + Asc, + Desc, + /// Wire value not recognized by this SDK version. The original + /// string is preserved verbatim. WorkOS may add new enum values + /// server-side; matching on this variant lets callers handle + /// forward-compatible values without panicking. + Unknown(String), +} + +impl VaultOrder { + /// Canonical wire string for this value. For [`Self::Unknown`] returns the + /// original wire value as received from the API. + #[allow(deprecated)] + pub fn as_str(&self) -> &str { + match self { + Self::Asc => "asc", + Self::Desc => "desc", + Self::Unknown(s) => s.as_str(), + } + } +} + +impl fmt::Display for VaultOrder { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +impl AsRef for VaultOrder { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl FromStr for VaultOrder { + type Err = std::convert::Infallible; + #[allow(deprecated)] + fn from_str(s: &str) -> Result { + Ok(match s { + "asc" => Self::Asc, + "desc" => Self::Desc, + other => Self::Unknown(other.to_string()), + }) + } +} + +impl From for VaultOrder { + fn from(s: String) -> Self { + // Reuse the original `String` allocation in the fallback branch. + match Self::from_str(&s) { + Ok(Self::Unknown(_)) => Self::Unknown(s), + Ok(other) => other, + } + } +} + +impl From<&str> for VaultOrder { + fn from(s: &str) -> Self { + Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) + } +} + +impl Serialize for VaultOrder { + fn serialize(&self, serializer: S) -> Result { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de> Deserialize<'de> for VaultOrder { + fn deserialize>(deserializer: D) -> Result { + let s = String::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} diff --git a/src/models/actor.rs b/src/models/actor.rs new file mode 100644 index 00000000..dc840db1 --- /dev/null +++ b/src/models/actor.rs @@ -0,0 +1,15 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// The user or API key that performed an action. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Actor { + /// Unique identifier of the actor. + pub id: String, + /// Display name of the actor. + pub name: String, +} diff --git a/src/models/create_data_key_request.rs b/src/models/create_data_key_request.rs new file mode 100644 index 00000000..321e3152 --- /dev/null +++ b/src/models/create_data_key_request.rs @@ -0,0 +1,12 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CreateDataKeyRequest { + /// Map of values used to determine the encryption key. + pub context: std::collections::HashMap, +} diff --git a/src/models/create_data_key_response.rs b/src/models/create_data_key_response.rs new file mode 100644 index 00000000..d2df4b8f --- /dev/null +++ b/src/models/create_data_key_response.rs @@ -0,0 +1,18 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CreateDataKeyResponse { + /// Map of values used to determine the encryption key. + pub context: std::collections::HashMap, + /// Base64-encoded data encryption key. + pub data_key: crate::SecretString, + /// Base64-encoded encrypted data key blob. + pub encrypted_keys: crate::SecretString, + /// Unique identifier for the generated data key. + pub id: String, +} diff --git a/src/models/create_object_request.rs b/src/models/create_object_request.rs new file mode 100644 index 00000000..a8160d41 --- /dev/null +++ b/src/models/create_object_request.rs @@ -0,0 +1,16 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CreateObjectRequest { + /// Map of values used to determine the encryption key. + pub key_context: std::collections::HashMap, + /// Unique name for the object. + pub name: String, + /// Plaintext data to encrypt and store. + pub value: String, +} diff --git a/src/models/decrypt_request.rs b/src/models/decrypt_request.rs new file mode 100644 index 00000000..d40f2103 --- /dev/null +++ b/src/models/decrypt_request.rs @@ -0,0 +1,12 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DecryptRequest { + /// Base64-encoded encrypted data key to decrypt. + pub keys: String, +} diff --git a/src/models/decrypt_response.rs b/src/models/decrypt_response.rs new file mode 100644 index 00000000..df400d70 --- /dev/null +++ b/src/models/decrypt_response.rs @@ -0,0 +1,14 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DecryptResponse { + /// Base64-encoded decrypted data key. + pub data_key: crate::SecretString, + /// Unique identifier of the decrypted data key. + pub id: String, +} diff --git a/src/models/delete_object_response.rs b/src/models/delete_object_response.rs new file mode 100644 index 00000000..d594ee25 --- /dev/null +++ b/src/models/delete_object_response.rs @@ -0,0 +1,14 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DeleteObjectResponse { + /// Name of the deleted object. + pub name: String, + /// Whether the deletion succeeded. + pub success: bool, +} diff --git a/src/models/error.rs b/src/models/error.rs new file mode 100644 index 00000000..5699b64b --- /dev/null +++ b/src/models/error.rs @@ -0,0 +1,13 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// Error response body. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Error { + /// A human-readable description of the error. + pub error: String, +} diff --git a/src/models/list_metadata.rs b/src/models/list_metadata.rs new file mode 100644 index 00000000..61ec1d34 --- /dev/null +++ b/src/models/list_metadata.rs @@ -0,0 +1,17 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// Cursor-based pagination metadata. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ListMetadata { + /// Cursor for the next page of results. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub after: Option, + /// Cursor for the previous page of results. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub before: Option, +} diff --git a/src/models/object.rs b/src/models/object.rs new file mode 100644 index 00000000..caf2e17e --- /dev/null +++ b/src/models/object.rs @@ -0,0 +1,18 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// An encrypted object with its decrypted value and metadata. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Object { + /// Unique identifier of the object. + pub id: String, + pub metadata: ObjectMetadata, + /// Unique name of the object. + pub name: String, + /// Decrypted plaintext value. + pub value: String, +} diff --git a/src/models/object_list_response.rs b/src/models/object_list_response.rs new file mode 100644 index 00000000..f8ec6545 --- /dev/null +++ b/src/models/object_list_response.rs @@ -0,0 +1,13 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ObjectListResponse { + /// List of object summaries. + pub data: Vec, + pub list_metadata: ListMetadata, +} diff --git a/src/models/object_metadata.rs b/src/models/object_metadata.rs new file mode 100644 index 00000000..145216f1 --- /dev/null +++ b/src/models/object_metadata.rs @@ -0,0 +1,25 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// Metadata for a stored encrypted object. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ObjectMetadata { + /// Map of values used to determine the encryption key. + pub context: std::collections::HashMap, + /// Environment the object belongs to. + pub environment_id: String, + /// Unique identifier of the object. + pub id: String, + /// Encryption key identifier. + pub key_id: String, + /// Timestamp of the last update. + pub updated_at: String, + pub updated_by: Actor, + /// Current version identifier of the object. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub version_id: Option, +} diff --git a/src/models/object_summary.rs b/src/models/object_summary.rs new file mode 100644 index 00000000..c04da59e --- /dev/null +++ b/src/models/object_summary.rs @@ -0,0 +1,18 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// Summary of an encrypted object returned in list responses. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ObjectSummary { + /// Unique identifier of the object. + pub id: String, + /// Unique name of the object. + pub name: String, + /// Timestamp of the last update. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub updated_at: Option, +} diff --git a/src/models/object_version.rs b/src/models/object_version.rs new file mode 100644 index 00000000..455c8b22 --- /dev/null +++ b/src/models/object_version.rs @@ -0,0 +1,21 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// A static snapshot of an encrypted object. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ObjectVersion { + /// Timestamp when the version was created. + pub created_at: String, + /// Whether this is the active version. + pub current_version: bool, + /// Hash of the object value. + pub etag: String, + /// Unique identifier of the version. + pub id: String, + /// Number of bytes of stored data. + pub size: i64, +} diff --git a/src/models/object_without_value.rs b/src/models/object_without_value.rs new file mode 100644 index 00000000..fc60b952 --- /dev/null +++ b/src/models/object_without_value.rs @@ -0,0 +1,16 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +/// An encrypted object's metadata (value excluded). +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ObjectWithoutValue { + /// Unique identifier of the object. + pub id: String, + pub metadata: ObjectMetadata, + /// Unique name of the object. + pub name: String, +} diff --git a/src/models/rekey_request.rs b/src/models/rekey_request.rs new file mode 100644 index 00000000..a03be4d8 --- /dev/null +++ b/src/models/rekey_request.rs @@ -0,0 +1,14 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RekeyRequest { + /// Map of values used to determine the new encryption key. + pub context: std::collections::HashMap, + /// Base64-encoded encrypted data key blob to re-encrypt. + pub encrypted_keys: crate::SecretString, +} diff --git a/src/models/update_object_request.rs b/src/models/update_object_request.rs new file mode 100644 index 00000000..0cb4c893 --- /dev/null +++ b/src/models/update_object_request.rs @@ -0,0 +1,15 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct UpdateObjectRequest { + /// New plaintext value. + pub value: String, + /// ID of the expected current version for optimistic locking. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub version_check: Option, +} diff --git a/src/models/version_list_response.rs b/src/models/version_list_response.rs new file mode 100644 index 00000000..150f6eaa --- /dev/null +++ b/src/models/version_list_response.rs @@ -0,0 +1,13 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct VersionListResponse { + /// List of object versions. + pub data: Vec, + pub list_metadata: ListMetadata, +} diff --git a/src/resources/vault.rs b/src/resources/vault.rs new file mode 100644 index 00000000..752071ba --- /dev/null +++ b/src/resources/vault.rs @@ -0,0 +1,415 @@ +// Code generated by oagen. DO NOT EDIT. + +use crate::client::Client; +#[allow(unused_imports)] +use crate::enums::*; +use crate::error::Error; +#[allow(unused_imports)] +use crate::models::*; +use serde::Serialize; + +pub struct VaultApi<'a> { + pub(crate) client: &'a Client, +} + +#[derive(Debug, Clone, Serialize)] +pub struct CreateDataKeyParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: CreateDataKeyRequest, +} + +impl CreateDataKeyParams { + /// Construct a new `CreateDataKeyParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: CreateDataKeyRequest) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct CreateDecryptParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: DecryptRequest, +} + +impl CreateDecryptParams { + /// Construct a new `CreateDecryptParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: DecryptRequest) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct CreateRekeyParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: RekeyRequest, +} + +impl CreateRekeyParams { + /// Construct a new `CreateRekeyParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: RekeyRequest) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct ListKvParams { + /// Upper limit on the number of objects to return. + /// + /// Defaults to `10`. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Cursor for the previous page of results. + #[serde(skip_serializing_if = "Option::is_none")] + pub before: Option, + /// Cursor for the next page of results. + #[serde(skip_serializing_if = "Option::is_none")] + pub after: Option, + /// Sort direction for results. + #[serde(skip_serializing_if = "Option::is_none")] + pub order: Option, + /// Filter results by name or structured search JSON. + #[serde(skip_serializing_if = "Option::is_none")] + pub search: Option, + /// ISO 8601 timestamp to filter by last modified time. + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "updatedAfter")] + pub updated_after: Option, +} + +impl Default for ListKvParams { + #[allow(deprecated)] + fn default() -> Self { + Self { + limit: Some(10), + before: Default::default(), + after: Default::default(), + order: Default::default(), + search: Default::default(), + updated_after: Default::default(), + } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct CreateKvParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: CreateObjectRequest, +} + +impl CreateKvParams { + /// Construct a new `CreateKvParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: CreateObjectRequest) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct UpdateKvParams { + /// Request body sent with this call. + /// + /// Required. + #[serde(skip)] + pub body: UpdateObjectRequest, +} + +impl UpdateKvParams { + /// Construct a new `UpdateKvParams` with the required fields set. + #[allow(deprecated)] + pub fn new(body: UpdateObjectRequest) -> Self { + Self { body } + } +} + +#[derive(Debug, Clone, Default, Serialize)] +pub struct DeleteKvParams { + /// Expected current version for optimistic locking. + #[serde(skip_serializing_if = "Option::is_none")] + pub version_check: Option, +} + +impl<'a> VaultApi<'a> { + /// Create a data key + /// + /// Generate an isolated encryption key for local encryption operations. + pub async fn create_data_key( + &self, + params: CreateDataKeyParams, + ) -> Result { + self.create_data_key_with_options(params, None).await + } + + /// Variant of [`Self::create_data_key`] that accepts per-request [`crate::RequestOptions`]. + pub async fn create_data_key_with_options( + &self, + params: CreateDataKeyParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/vault/v1/keys/data-key".to_string(); + let method = http::Method::POST; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Decrypt a data key + /// + /// Decrypt a previously encrypted data key from WorkOS Vault. + pub async fn create_decrypt( + &self, + params: CreateDecryptParams, + ) -> Result { + self.create_decrypt_with_options(params, None).await + } + + /// Variant of [`Self::create_decrypt`] that accepts per-request [`crate::RequestOptions`]. + pub async fn create_decrypt_with_options( + &self, + params: CreateDecryptParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/vault/v1/keys/decrypt".to_string(); + let method = http::Method::POST; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Re-encrypt a data key + /// + /// Decrypt an existing data key and re-encrypt it under a new key context. + pub async fn create_rekey( + &self, + params: CreateRekeyParams, + ) -> Result { + self.create_rekey_with_options(params, None).await + } + + /// Variant of [`Self::create_rekey`] that accepts per-request [`crate::RequestOptions`]. + pub async fn create_rekey_with_options( + &self, + params: CreateRekeyParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/vault/v1/keys/rekey".to_string(); + let method = http::Method::POST; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// List objects + /// + /// List all encrypted objects with cursor-based pagination. + pub async fn list_kv(&self, params: ListKvParams) -> Result { + self.list_kv_with_options(params, None).await + } + + /// Variant of [`Self::list_kv`] that accepts per-request [`crate::RequestOptions`]. + pub async fn list_kv_with_options( + &self, + params: ListKvParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/vault/v1/kv".to_string(); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, ¶ms, options) + .await + } + + /// Returns an async [`futures_util::Stream`] that yields every `ObjectSummary` + /// across all pages, advancing the `after` cursor under the hood. + /// + /// ```ignore + /// use futures_util::TryStreamExt; + /// let all: Vec = self + /// .list_kv_auto_paging(params) + /// .try_collect() + /// .await?; + /// ``` + pub fn list_kv_auto_paging( + &self, + params: ListKvParams, + ) -> impl futures_util::Stream> + '_ { + crate::pagination::auto_paginate_pages(move |after| { + let mut params = params.clone(); + params.after = after; + async move { + let page = self.list_kv(params).await?; + Ok((page.data, page.list_metadata.after)) + } + }) + } + + /// Create an object + /// + /// Encrypt and store a new key-value object. + pub async fn create_kv(&self, params: CreateKvParams) -> Result { + self.create_kv_with_options(params, None).await + } + + /// Variant of [`Self::create_kv`] that accepts per-request [`crate::RequestOptions`]. + pub async fn create_kv_with_options( + &self, + params: CreateKvParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let path = "/vault/v1/kv".to_string(); + let method = http::Method::POST; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Read an object by name + /// + /// Fetch and decrypt an object by its unique name. + pub async fn get_name(&self, name: &str) -> Result { + self.get_name_with_options(name, None).await + } + + /// Variant of [`Self::get_name`] that accepts per-request [`crate::RequestOptions`]. + pub async fn get_name_with_options( + &self, + name: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let name = crate::client::path_segment(name); + let path = format!("/vault/v1/kv/name/{name}"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// Read an object by ID + /// + /// Fetch and decrypt an object by its unique identifier. + pub async fn get_kv(&self, id: &str) -> Result { + self.get_kv_with_options(id, None).await + } + + /// Variant of [`Self::get_kv`] that accepts per-request [`crate::RequestOptions`]. + pub async fn get_kv_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/vault/v1/kv/{id}"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// Update an object + /// + /// Update the value of an existing encrypted object. + pub async fn update_kv( + &self, + id: &str, + params: UpdateKvParams, + ) -> Result { + self.update_kv_with_options(id, params, None).await + } + + /// Variant of [`Self::update_kv`] that accepts per-request [`crate::RequestOptions`]. + pub async fn update_kv_with_options( + &self, + id: &str, + params: UpdateKvParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/vault/v1/kv/{id}"); + let method = http::Method::PUT; + self.client + .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) + .await + } + + /// Delete an object + /// + /// Delete an encrypted object. + pub async fn delete_kv( + &self, + id: &str, + params: DeleteKvParams, + ) -> Result { + self.delete_kv_with_options(id, params, None).await + } + + /// Variant of [`Self::delete_kv`] that accepts per-request [`crate::RequestOptions`]. + pub async fn delete_kv_with_options( + &self, + id: &str, + params: DeleteKvParams, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/vault/v1/kv/{id}"); + let method = http::Method::DELETE; + self.client + .request_with_query_opts(method, &path, ¶ms, options) + .await + } + + /// Describe an object + /// + /// Fetch metadata for an object without decrypting it. + pub async fn list_kv_metadata(&self, id: &str) -> Result { + self.list_kv_metadata_with_options(id, None).await + } + + /// Variant of [`Self::list_kv_metadata`] that accepts per-request [`crate::RequestOptions`]. + pub async fn list_kv_metadata_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/vault/v1/kv/{id}/metadata"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } + + /// List object versions + /// + /// Retrieve all versions for a specific object. + pub async fn list_kv_versions(&self, id: &str) -> Result { + self.list_kv_versions_with_options(id, None).await + } + + /// Variant of [`Self::list_kv_versions`] that accepts per-request [`crate::RequestOptions`]. + pub async fn list_kv_versions_with_options( + &self, + id: &str, + options: Option<&crate::RequestOptions>, + ) -> Result { + let id = crate::client::path_segment(id); + let path = format!("/vault/v1/kv/{id}/versions"); + let method = http::Method::GET; + self.client + .request_with_query_opts(method, &path, &(), options) + .await + } +} From 132d1cbab8aeff5c84b221c51b029f6cdf8afe1a Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 04/12] feat(api_key): Add expires_at field to API key models --- src/models/api_key.rs | 3 +++ src/models/api_key_created_data.rs | 3 +++ src/models/api_key_revoked_data.rs | 3 +++ src/models/create_organization_api_key.rs | 3 +++ src/models/create_user_api_key.rs | 3 +++ src/models/organization_api_key.rs | 3 +++ src/models/organization_api_key_with_value.rs | 3 +++ src/models/user_api_key.rs | 3 +++ src/models/user_api_key_with_value.rs | 3 +++ 9 files changed, 27 insertions(+) diff --git a/src/models/api_key.rs b/src/models/api_key.rs index e54f847c..ae600aa9 100644 --- a/src/models/api_key.rs +++ b/src/models/api_key.rs @@ -20,6 +20,9 @@ pub struct ApiKey { /// Timestamp of when the API Key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permission slugs assigned to the API Key. pub permissions: Vec, /// An ISO 8601 timestamp. diff --git a/src/models/api_key_created_data.rs b/src/models/api_key_created_data.rs index 0ed84335..2e4e1c9f 100644 --- a/src/models/api_key_created_data.rs +++ b/src/models/api_key_created_data.rs @@ -21,6 +21,9 @@ pub struct ApiKeyCreatedData { /// The timestamp when the API key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permissions granted to the API key. pub permissions: Vec, /// The timestamp when the API key was created. diff --git a/src/models/api_key_revoked_data.rs b/src/models/api_key_revoked_data.rs index abcd2ed3..233f2461 100644 --- a/src/models/api_key_revoked_data.rs +++ b/src/models/api_key_revoked_data.rs @@ -21,6 +21,9 @@ pub struct ApiKeyRevokedData { /// The timestamp when the API key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permissions granted to the API key. pub permissions: Vec, /// The timestamp when the API key was created. diff --git a/src/models/create_organization_api_key.rs b/src/models/create_organization_api_key.rs index 244c60fc..ddfe3358 100644 --- a/src/models/create_organization_api_key.rs +++ b/src/models/create_organization_api_key.rs @@ -12,4 +12,7 @@ pub struct CreateOrganizationApiKey { /// The permission slugs to assign to the API key. #[serde(skip_serializing_if = "Option::is_none", default)] pub permissions: Option>, + /// The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, } diff --git a/src/models/create_user_api_key.rs b/src/models/create_user_api_key.rs index 1a7d0054..b890eab3 100644 --- a/src/models/create_user_api_key.rs +++ b/src/models/create_user_api_key.rs @@ -14,4 +14,7 @@ pub struct CreateUserApiKey { /// The permission slugs to assign to the API key. Each permission must be enabled for user API keys. #[serde(skip_serializing_if = "Option::is_none", default)] pub permissions: Option>, + /// The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, } diff --git a/src/models/organization_api_key.rs b/src/models/organization_api_key.rs index 5ad46a1d..d9fb020b 100644 --- a/src/models/organization_api_key.rs +++ b/src/models/organization_api_key.rs @@ -20,6 +20,9 @@ pub struct OrganizationApiKey { /// Timestamp of when the API Key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permission slugs assigned to the API Key. pub permissions: Vec, /// An ISO 8601 timestamp. diff --git a/src/models/organization_api_key_with_value.rs b/src/models/organization_api_key_with_value.rs index 29afc0e9..ad1c3489 100644 --- a/src/models/organization_api_key_with_value.rs +++ b/src/models/organization_api_key_with_value.rs @@ -20,6 +20,9 @@ pub struct OrganizationApiKeyWithValue { /// Timestamp of when the API Key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permission slugs assigned to the API Key. pub permissions: Vec, /// An ISO 8601 timestamp. diff --git a/src/models/user_api_key.rs b/src/models/user_api_key.rs index c6622c3c..993c0300 100644 --- a/src/models/user_api_key.rs +++ b/src/models/user_api_key.rs @@ -20,6 +20,9 @@ pub struct UserApiKey { /// Timestamp of when the API Key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permission slugs assigned to the API Key. pub permissions: Vec, /// An ISO 8601 timestamp. diff --git a/src/models/user_api_key_with_value.rs b/src/models/user_api_key_with_value.rs index 4386b2d6..cb19ffa6 100644 --- a/src/models/user_api_key_with_value.rs +++ b/src/models/user_api_key_with_value.rs @@ -20,6 +20,9 @@ pub struct UserApiKeyWithValue { /// Timestamp of when the API Key was last used. #[serde(skip_serializing_if = "Option::is_none", default)] pub last_used_at: Option, + /// Timestamp when the API Key expires. Null means the key does not expire. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub expires_at: Option, /// The permission slugs assigned to the API Key. pub permissions: Vec, /// An ISO 8601 timestamp. From 39a2cc34357056214c12080ff84f8fd789b545d3 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 05/12] feat(webhooks): Add Pipes connected account events to webhook subscriptions --- src/enums/create_webhook_endpoint_events.rs | 13 +++ src/enums/pipe_connected_account_state.rs | 83 +++++++++++++++++++ src/enums/update_webhook_endpoint_events.rs | 13 +++ src/models/pipe_connected_account.rs | 32 +++++++ .../pipes_connected_account_connected.rs | 21 +++++ .../pipes_connected_account_disconnected.rs | 21 +++++ ...onnected_account_reauthorization_needed.rs | 21 +++++ 7 files changed, 204 insertions(+) create mode 100644 src/enums/pipe_connected_account_state.rs create mode 100644 src/models/pipe_connected_account.rs create mode 100644 src/models/pipes_connected_account_connected.rs create mode 100644 src/models/pipes_connected_account_disconnected.rs create mode 100644 src/models/pipes_connected_account_reauthorization_needed.rs diff --git a/src/enums/create_webhook_endpoint_events.rs b/src/enums/create_webhook_endpoint_events.rs index 4e61a022..837151a0 100644 --- a/src/enums/create_webhook_endpoint_events.rs +++ b/src/enums/create_webhook_endpoint_events.rs @@ -79,6 +79,9 @@ pub enum CreateWebhookEndpointEvents { PermissionCreated, PermissionDeleted, PermissionUpdated, + PipesConnectedAccountConnected, + PipesConnectedAccountDisconnected, + PipesConnectedAccountReauthorizationNeeded, SessionCreated, SessionRevoked, WaitlistUserApproved, @@ -173,6 +176,11 @@ impl CreateWebhookEndpointEvents { Self::PermissionCreated => "permission.created", Self::PermissionDeleted => "permission.deleted", Self::PermissionUpdated => "permission.updated", + Self::PipesConnectedAccountConnected => "pipes.connected_account.connected", + Self::PipesConnectedAccountDisconnected => "pipes.connected_account.disconnected", + Self::PipesConnectedAccountReauthorizationNeeded => { + "pipes.connected_account.reauthorization_needed" + } Self::SessionCreated => "session.created", Self::SessionRevoked => "session.revoked", Self::WaitlistUserApproved => "waitlist_user.approved", @@ -276,6 +284,11 @@ impl FromStr for CreateWebhookEndpointEvents { "permission.created" => Self::PermissionCreated, "permission.deleted" => Self::PermissionDeleted, "permission.updated" => Self::PermissionUpdated, + "pipes.connected_account.connected" => Self::PipesConnectedAccountConnected, + "pipes.connected_account.disconnected" => Self::PipesConnectedAccountDisconnected, + "pipes.connected_account.reauthorization_needed" => { + Self::PipesConnectedAccountReauthorizationNeeded + } "session.created" => Self::SessionCreated, "session.revoked" => Self::SessionRevoked, "waitlist_user.approved" => Self::WaitlistUserApproved, diff --git a/src/enums/pipe_connected_account_state.rs b/src/enums/pipe_connected_account_state.rs new file mode 100644 index 00000000..4ea8e2ee --- /dev/null +++ b/src/enums/pipe_connected_account_state.rs @@ -0,0 +1,83 @@ +// Code generated by oagen. DO NOT EDIT. + +use serde::{Deserialize, Serialize}; +use std::fmt; +use std::str::FromStr; + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum PipeConnectedAccountState { + Connected, + NeedsReauthorization, + /// Wire value not recognized by this SDK version. The original + /// string is preserved verbatim. WorkOS may add new enum values + /// server-side; matching on this variant lets callers handle + /// forward-compatible values without panicking. + Unknown(String), +} + +impl PipeConnectedAccountState { + /// Canonical wire string for this value. For [`Self::Unknown`] returns the + /// original wire value as received from the API. + #[allow(deprecated)] + pub fn as_str(&self) -> &str { + match self { + Self::Connected => "connected", + Self::NeedsReauthorization => "needs_reauthorization", + Self::Unknown(s) => s.as_str(), + } + } +} + +impl fmt::Display for PipeConnectedAccountState { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +impl AsRef for PipeConnectedAccountState { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl FromStr for PipeConnectedAccountState { + type Err = std::convert::Infallible; + #[allow(deprecated)] + fn from_str(s: &str) -> Result { + Ok(match s { + "connected" => Self::Connected, + "needs_reauthorization" => Self::NeedsReauthorization, + other => Self::Unknown(other.to_string()), + }) + } +} + +impl From for PipeConnectedAccountState { + fn from(s: String) -> Self { + // Reuse the original `String` allocation in the fallback branch. + match Self::from_str(&s) { + Ok(Self::Unknown(_)) => Self::Unknown(s), + Ok(other) => other, + } + } +} + +impl From<&str> for PipeConnectedAccountState { + fn from(s: &str) -> Self { + Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) + } +} + +impl Serialize for PipeConnectedAccountState { + fn serialize(&self, serializer: S) -> Result { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de> Deserialize<'de> for PipeConnectedAccountState { + fn deserialize>(deserializer: D) -> Result { + let s = String::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} diff --git a/src/enums/update_webhook_endpoint_events.rs b/src/enums/update_webhook_endpoint_events.rs index 6e1a936d..793ace76 100644 --- a/src/enums/update_webhook_endpoint_events.rs +++ b/src/enums/update_webhook_endpoint_events.rs @@ -79,6 +79,9 @@ pub enum UpdateWebhookEndpointEvents { PermissionCreated, PermissionDeleted, PermissionUpdated, + PipesConnectedAccountConnected, + PipesConnectedAccountDisconnected, + PipesConnectedAccountReauthorizationNeeded, SessionCreated, SessionRevoked, WaitlistUserApproved, @@ -173,6 +176,11 @@ impl UpdateWebhookEndpointEvents { Self::PermissionCreated => "permission.created", Self::PermissionDeleted => "permission.deleted", Self::PermissionUpdated => "permission.updated", + Self::PipesConnectedAccountConnected => "pipes.connected_account.connected", + Self::PipesConnectedAccountDisconnected => "pipes.connected_account.disconnected", + Self::PipesConnectedAccountReauthorizationNeeded => { + "pipes.connected_account.reauthorization_needed" + } Self::SessionCreated => "session.created", Self::SessionRevoked => "session.revoked", Self::WaitlistUserApproved => "waitlist_user.approved", @@ -276,6 +284,11 @@ impl FromStr for UpdateWebhookEndpointEvents { "permission.created" => Self::PermissionCreated, "permission.deleted" => Self::PermissionDeleted, "permission.updated" => Self::PermissionUpdated, + "pipes.connected_account.connected" => Self::PipesConnectedAccountConnected, + "pipes.connected_account.disconnected" => Self::PipesConnectedAccountDisconnected, + "pipes.connected_account.reauthorization_needed" => { + Self::PipesConnectedAccountReauthorizationNeeded + } "session.created" => Self::SessionCreated, "session.revoked" => Self::SessionRevoked, "waitlist_user.approved" => Self::WaitlistUserApproved, diff --git a/src/models/pipe_connected_account.rs b/src/models/pipe_connected_account.rs new file mode 100644 index 00000000..65da191d --- /dev/null +++ b/src/models/pipe_connected_account.rs @@ -0,0 +1,32 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PipeConnectedAccount { + /// The connected account object. + pub object: String, + /// The unique ID of the connected account. + pub id: String, + /// The unique ID of the data integration. + pub data_integration_id: String, + /// The provider slug for this connected account. + pub provider_slug: String, + /// The ID of the User the connected account belongs to. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub user_id: Option, + /// The ID of the Organization the connected account belongs to. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub organization_id: Option, + /// The OAuth scopes granted for this connected account. + pub scopes: Vec, + /// The state of the connected account. + pub state: PipeConnectedAccountState, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, +} diff --git a/src/models/pipes_connected_account_connected.rs b/src/models/pipes_connected_account_connected.rs new file mode 100644 index 00000000..5bb2a7f0 --- /dev/null +++ b/src/models/pipes_connected_account_connected.rs @@ -0,0 +1,21 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PipesConnectedAccountConnected { + /// Unique identifier for the event. + pub id: String, + pub event: String, + /// The event payload. + pub data: PipeConnectedAccount, + /// An ISO 8601 timestamp. + pub created_at: String, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub context: Option, + /// Distinguishes the Event object. + pub object: String, +} diff --git a/src/models/pipes_connected_account_disconnected.rs b/src/models/pipes_connected_account_disconnected.rs new file mode 100644 index 00000000..ddcaf432 --- /dev/null +++ b/src/models/pipes_connected_account_disconnected.rs @@ -0,0 +1,21 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PipesConnectedAccountDisconnected { + /// Unique identifier for the event. + pub id: String, + pub event: String, + /// The event payload. + pub data: PipeConnectedAccount, + /// An ISO 8601 timestamp. + pub created_at: String, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub context: Option, + /// Distinguishes the Event object. + pub object: String, +} diff --git a/src/models/pipes_connected_account_reauthorization_needed.rs b/src/models/pipes_connected_account_reauthorization_needed.rs new file mode 100644 index 00000000..baabf54c --- /dev/null +++ b/src/models/pipes_connected_account_reauthorization_needed.rs @@ -0,0 +1,21 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PipesConnectedAccountReauthorizationNeeded { + /// Unique identifier for the event. + pub id: String, + pub event: String, + /// The event payload. + pub data: PipeConnectedAccount, + /// An ISO 8601 timestamp. + pub created_at: String, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub context: Option, + /// Distinguishes the Event object. + pub object: String, +} From f4c35f54bdb3f7ef1c1d3a6a090eb79afd1613ac Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 06/12] fix(generated): Standardize type names and fix parameter defaults in authorization service --- src/enums/webhook_endpoint_status.rs | 83 ++++++++++++++++++++++++++++ src/models/audit_log_action.rs | 20 +++++++ src/models/audit_log_export.rs | 23 ++++++++ src/models/audit_log_schema_dto.rs | 18 ++++++ src/models/audit_logs_retention.rs | 13 +++++ src/models/webhook_endpoint.rs | 26 +++++++++ src/resources/audit_logs.rs | 27 ++++----- src/resources/authorization.rs | 24 ++++++-- src/resources/webhooks.rs | 14 ++--- 9 files changed, 222 insertions(+), 26 deletions(-) create mode 100644 src/enums/webhook_endpoint_status.rs create mode 100644 src/models/audit_log_action.rs create mode 100644 src/models/audit_log_export.rs create mode 100644 src/models/audit_log_schema_dto.rs create mode 100644 src/models/audit_logs_retention.rs create mode 100644 src/models/webhook_endpoint.rs diff --git a/src/enums/webhook_endpoint_status.rs b/src/enums/webhook_endpoint_status.rs new file mode 100644 index 00000000..4290b458 --- /dev/null +++ b/src/enums/webhook_endpoint_status.rs @@ -0,0 +1,83 @@ +// Code generated by oagen. DO NOT EDIT. + +use serde::{Deserialize, Serialize}; +use std::fmt; +use std::str::FromStr; + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum WebhookEndpointStatus { + Enabled, + Disabled, + /// Wire value not recognized by this SDK version. The original + /// string is preserved verbatim. WorkOS may add new enum values + /// server-side; matching on this variant lets callers handle + /// forward-compatible values without panicking. + Unknown(String), +} + +impl WebhookEndpointStatus { + /// Canonical wire string for this value. For [`Self::Unknown`] returns the + /// original wire value as received from the API. + #[allow(deprecated)] + pub fn as_str(&self) -> &str { + match self { + Self::Enabled => "enabled", + Self::Disabled => "disabled", + Self::Unknown(s) => s.as_str(), + } + } +} + +impl fmt::Display for WebhookEndpointStatus { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +impl AsRef for WebhookEndpointStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl FromStr for WebhookEndpointStatus { + type Err = std::convert::Infallible; + #[allow(deprecated)] + fn from_str(s: &str) -> Result { + Ok(match s { + "enabled" => Self::Enabled, + "disabled" => Self::Disabled, + other => Self::Unknown(other.to_string()), + }) + } +} + +impl From for WebhookEndpointStatus { + fn from(s: String) -> Self { + // Reuse the original `String` allocation in the fallback branch. + match Self::from_str(&s) { + Ok(Self::Unknown(_)) => Self::Unknown(s), + Ok(other) => other, + } + } +} + +impl From<&str> for WebhookEndpointStatus { + fn from(s: &str) -> Self { + Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) + } +} + +impl Serialize for WebhookEndpointStatus { + fn serialize(&self, serializer: S) -> Result { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de> Deserialize<'de> for WebhookEndpointStatus { + fn deserialize>(deserializer: D) -> Result { + let s = String::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} diff --git a/src/models/audit_log_action.rs b/src/models/audit_log_action.rs new file mode 100644 index 00000000..13756817 --- /dev/null +++ b/src/models/audit_log_action.rs @@ -0,0 +1,20 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AuditLogAction { + /// Distinguishes the Audit Log Action object. + pub object: String, + /// Identifier of what action was taken. + pub name: String, + /// The schema associated with the action. + pub schema: AuditLogSchemaJson, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, +} diff --git a/src/models/audit_log_export.rs b/src/models/audit_log_export.rs new file mode 100644 index 00000000..0bfec449 --- /dev/null +++ b/src/models/audit_log_export.rs @@ -0,0 +1,23 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AuditLogExport { + /// Distinguishes the Audit Log Export object. + pub object: String, + /// The unique ID of the Audit Log Export. + pub id: String, + /// The state of the export. Possible values: pending, ready, error. + pub state: AuditLogExportState, + /// A URL to the CSV file. Only defined when the Audit Log Export is ready. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub url: Option, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, +} diff --git a/src/models/audit_log_schema_dto.rs b/src/models/audit_log_schema_dto.rs new file mode 100644 index 00000000..990fe38f --- /dev/null +++ b/src/models/audit_log_schema_dto.rs @@ -0,0 +1,18 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AuditLogSchemaDto { + /// The metadata schema for the actor. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub actor: Option, + /// The list of targets for the schema. + pub targets: Vec, + /// Optional JSON schema for event metadata. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub metadata: Option>, +} diff --git a/src/models/audit_logs_retention.rs b/src/models/audit_logs_retention.rs new file mode 100644 index 00000000..c8522e93 --- /dev/null +++ b/src/models/audit_logs_retention.rs @@ -0,0 +1,13 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AuditLogsRetention { + /// The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub retention_period_in_days: Option, +} diff --git a/src/models/webhook_endpoint.rs b/src/models/webhook_endpoint.rs new file mode 100644 index 00000000..de254cf5 --- /dev/null +++ b/src/models/webhook_endpoint.rs @@ -0,0 +1,26 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct WebhookEndpoint { + /// Distinguishes the Webhook Endpoint object. + pub object: String, + /// Unique identifier of the Webhook Endpoint. + pub id: String, + /// The URL to which webhooks are sent. + pub endpoint_url: String, + /// The secret used to sign webhook payloads. + pub secret: crate::SecretString, + /// Whether the Webhook Endpoint is enabled or disabled. + pub status: WebhookEndpointStatus, + /// The events that the Webhook Endpoint is subscribed to. + pub events: Vec, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, +} diff --git a/src/resources/audit_logs.rs b/src/resources/audit_logs.rs index f48963ab..a012ac96 100644 --- a/src/resources/audit_logs.rs +++ b/src/resources/audit_logs.rs @@ -99,13 +99,13 @@ pub struct CreateSchemaParams { /// /// Required. #[serde(skip)] - pub body: AuditLogSchema, + pub body: AuditLogSchemaDto, } impl CreateSchemaParams { /// Construct a new `CreateSchemaParams` with the required fields set. #[allow(deprecated)] - pub fn new(body: AuditLogSchema) -> Self { + pub fn new(body: AuditLogSchemaDto) -> Self { Self { body } } } @@ -151,7 +151,7 @@ impl<'a> AuditLogsApi<'a> { pub async fn get_organization_audit_logs_retention( &self, id: &str, - ) -> Result { + ) -> Result { self.get_organization_audit_logs_retention_with_options(id, None) .await } @@ -161,7 +161,7 @@ impl<'a> AuditLogsApi<'a> { &self, id: &str, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let id = crate::client::path_segment(id); let path = format!("/organizations/{id}/audit_logs_retention"); let method = http::Method::GET; @@ -177,7 +177,7 @@ impl<'a> AuditLogsApi<'a> { &self, id: &str, params: UpdateOrganizationAuditLogsRetentionParams, - ) -> Result { + ) -> Result { self.update_organization_audit_logs_retention_with_options(id, params, None) .await } @@ -188,7 +188,7 @@ impl<'a> AuditLogsApi<'a> { id: &str, params: UpdateOrganizationAuditLogsRetentionParams, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let id = crate::client::path_segment(id); let path = format!("/organizations/{id}/audit_logs_retention"); let method = http::Method::PUT; @@ -203,7 +203,7 @@ impl<'a> AuditLogsApi<'a> { pub async fn list_actions( &self, params: ListActionsParams, - ) -> Result, Error> { + ) -> Result, Error> { self.list_actions_with_options(params, None).await } @@ -212,7 +212,7 @@ impl<'a> AuditLogsApi<'a> { &self, params: ListActionsParams, options: Option<&crate::RequestOptions>, - ) -> Result, Error> { + ) -> Result, Error> { let path = "/audit_logs/actions".to_string(); let method = http::Method::GET; self.client @@ -306,10 +306,7 @@ impl<'a> AuditLogsApi<'a> { /// Create Export /// /// Create an Audit Log Export. Exports are scoped to a single organization within a specified date range. - pub async fn create_export( - &self, - params: CreateExportParams, - ) -> Result { + pub async fn create_export(&self, params: CreateExportParams) -> Result { self.create_export_with_options(params, None).await } @@ -318,7 +315,7 @@ impl<'a> AuditLogsApi<'a> { &self, params: CreateExportParams, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let path = "/audit_logs/exports".to_string(); let method = http::Method::POST; self.client @@ -329,7 +326,7 @@ impl<'a> AuditLogsApi<'a> { /// Get Export /// /// Get an Audit Log Export. The URL will expire after 10 minutes. If the export is needed again at a later time, refetching the export will regenerate the URL. - pub async fn get_export(&self, audit_log_export_id: &str) -> Result { + pub async fn get_export(&self, audit_log_export_id: &str) -> Result { self.get_export_with_options(audit_log_export_id, None) .await } @@ -339,7 +336,7 @@ impl<'a> AuditLogsApi<'a> { &self, audit_log_export_id: &str, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let audit_log_export_id = crate::client::path_segment(audit_log_export_id); let path = format!("/audit_logs/exports/{audit_log_export_id}"); let method = http::Method::GET; diff --git a/src/resources/authorization.rs b/src/resources/authorization.rs index 055b030b..df934039 100644 --- a/src/resources/authorization.rs +++ b/src/resources/authorization.rs @@ -341,6 +341,15 @@ pub struct ListRoleAssignmentsParams { /// Defaults to `desc`. #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, + /// Filter assignments by the ID of the resource. + #[serde(skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + /// Filter assignments by the external ID of the resource. + #[serde(skip_serializing_if = "Option::is_none")] + pub resource_external_id: Option, + /// Filter assignments by the slug of the resource type. + #[serde(skip_serializing_if = "Option::is_none")] + pub resource_type_slug: Option, } impl Default for ListRoleAssignmentsParams { @@ -351,6 +360,9 @@ impl Default for ListRoleAssignmentsParams { after: Default::default(), limit: Some(10), order: Some(PaginationOrder::Desc), + resource_id: Default::default(), + resource_external_id: Default::default(), + resource_type_slug: Default::default(), } } } @@ -552,6 +564,9 @@ pub struct ListRoleAssignmentsForResourceByExternalIdParams { /// Defaults to `desc`. #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, + /// Filter assignments by the slug of the role. + #[serde(skip_serializing_if = "Option::is_none")] + pub role_slug: Option, } impl Default for ListRoleAssignmentsForResourceByExternalIdParams { @@ -562,6 +577,7 @@ impl Default for ListRoleAssignmentsForResourceByExternalIdParams { after: Default::default(), limit: Some(10), order: Some(PaginationOrder::Desc), + role_slug: Default::default(), } } } @@ -593,9 +609,6 @@ pub struct ListResourcesParams { /// Filter resources by external ID. #[serde(skip_serializing_if = "Option::is_none")] pub resource_external_id: Option, - /// Search resources by name. - #[serde(skip_serializing_if = "Option::is_none")] - pub search: Option, #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] pub parent: Option, @@ -612,7 +625,6 @@ impl Default for ListResourcesParams { organization_id: Default::default(), resource_type_slug: Default::default(), resource_external_id: Default::default(), - search: Default::default(), parent: Default::default(), } } @@ -730,6 +742,9 @@ pub struct ListRoleAssignmentsForResourceParams { /// Defaults to `desc`. #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, + /// Filter assignments by the slug of the role. + #[serde(skip_serializing_if = "Option::is_none")] + pub role_slug: Option, } impl Default for ListRoleAssignmentsForResourceParams { @@ -740,6 +755,7 @@ impl Default for ListRoleAssignmentsForResourceParams { after: Default::default(), limit: Some(10), order: Some(PaginationOrder::Desc), + role_slug: Default::default(), } } } diff --git a/src/resources/webhooks.rs b/src/resources/webhooks.rs index 8655b722..f489c2d5 100644 --- a/src/resources/webhooks.rs +++ b/src/resources/webhooks.rs @@ -102,12 +102,12 @@ impl<'a> WebhooksApi<'a> { .await } - /// Returns an async [`futures_util::Stream`] that yields every `WebhookEndpointJson` + /// Returns an async [`futures_util::Stream`] that yields every `WebhookEndpoint` /// across all pages, advancing the `after` cursor under the hood. /// /// ```ignore /// use futures_util::TryStreamExt; - /// let all: Vec = self + /// let all: Vec = self /// .list_webhook_endpoints_auto_paging(params) /// .try_collect() /// .await?; @@ -115,7 +115,7 @@ impl<'a> WebhooksApi<'a> { pub fn list_webhook_endpoints_auto_paging( &self, params: ListWebhookEndpointsParams, - ) -> impl futures_util::Stream> + '_ { + ) -> impl futures_util::Stream> + '_ { crate::pagination::auto_paginate_pages(move |after| { let mut params = params.clone(); params.after = after; @@ -132,7 +132,7 @@ impl<'a> WebhooksApi<'a> { pub async fn create_webhook_endpoint( &self, params: CreateWebhookEndpointParams, - ) -> Result { + ) -> Result { self.create_webhook_endpoint_with_options(params, None) .await } @@ -142,7 +142,7 @@ impl<'a> WebhooksApi<'a> { &self, params: CreateWebhookEndpointParams, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let path = "/webhook_endpoints".to_string(); let method = http::Method::POST; self.client @@ -157,7 +157,7 @@ impl<'a> WebhooksApi<'a> { &self, id: &str, params: UpdateWebhookEndpointParams, - ) -> Result { + ) -> Result { self.update_webhook_endpoint_with_options(id, params, None) .await } @@ -168,7 +168,7 @@ impl<'a> WebhooksApi<'a> { id: &str, params: UpdateWebhookEndpointParams, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let id = crate::client::path_segment(id); let path = format!("/webhook_endpoints/{id}"); let method = http::Method::PATCH; From 5255a432b0df57dc3337792ba645eb6087b31e15 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 07/12] fix(sso): Expand login_hint documentation to include custom SAML --- src/resources/sso.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/sso.rs b/src/resources/sso.rs index f5dcb715..6d30f953 100644 --- a/src/resources/sso.rs +++ b/src/resources/sso.rs @@ -94,7 +94,7 @@ pub struct GetAuthorizationUrlParams { /// Can be used to pre-fill the domain field when initiating authentication with Microsoft OAuth or with a Google SAML connection type. #[serde(skip_serializing_if = "Option::is_none")] pub domain_hint: Option, - /// Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, and Entra ID connections. + /// Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, Entra ID, and custom SAML connections. #[serde(skip_serializing_if = "Option::is_none")] pub login_hint: Option, /// A random string generated by the client that is used to mitigate replay attacks. From d33446240e7d68059534502e4e4f8d7d0f359563 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:15 +0000 Subject: [PATCH 08/12] chore(generated): shared regenerated files --- .last-synced-sha | 1 + .oagen-manifest.json | 172 +- ...son_state.rs => audit_log_export_state.rs} | 18 +- src/enums/mod.rs | 12 +- src/enums/webhook_endpoint_json_status.rs | 83 - src/models/audit_log_action_json.rs | 20 - src/models/audit_log_export_json.rs | 23 - src/models/audit_log_schema.rs | 18 - src/models/audit_logs_retention_json.rs | 13 - src/models/mod.rs | 64 +- src/models/webhook_endpoint_json.rs | 26 - src/models/webhook_endpoint_list.rs | 2 +- src/resources/mod.rs | 6 +- src/resources/user_management.rs | 312 --- ...nagement_organization_membership_groups.rs | 103 - src/resources_api.rs | 16 +- tests/audit_logs_test.rs | 36 +- tests/connect_test.rs | 2 +- tests/fixtures/actor.json | 4 + tests/fixtures/api_key.json | 3 +- .../fixtures/api_key_validation_response.json | 3 +- .../application_credentials_list_item.json | 2 +- tests/fixtures/audit_log_action.json | 16 + tests/fixtures/audit_log_export.json | 7 + tests/fixtures/audit_log_schema_dto.json | 7 + tests/fixtures/audit_logs_retention.json | 3 + tests/fixtures/create_data_key_request.json | 5 + tests/fixtures/create_data_key_response.json | 8 + tests/fixtures/create_object_request.json | 7 + tests/fixtures/decrypt_request.json | 3 + tests/fixtures/decrypt_response.json | 4 + tests/fixtures/delete_object_response.json | 4 + tests/fixtures/error.json | 3 + tests/fixtures/list_metadata.json | 1 + .../new_connect_application_secret.json | 2 +- tests/fixtures/object.json | 18 + tests/fixtures/object_list_response.json | 9 + tests/fixtures/object_metadata.json | 13 + tests/fixtures/object_summary.json | 4 + tests/fixtures/object_version.json | 7 + tests/fixtures/object_without_value.json | 17 + tests/fixtures/organization_api_key.json | 3 +- tests/fixtures/organization_api_key_list.json | 1 + .../organization_api_key_with_value.json | 3 +- tests/fixtures/pipe_connected_account.json | 15 + .../pipes_connected_account_connected.json | 21 + .../pipes_connected_account_disconnected.json | 21 + ...nected_account_reauthorization_needed.json | 21 + tests/fixtures/profile.json | 2 +- .../radar_standalone_assess_request.json | 2 +- tests/fixtures/rekey_request.json | 6 + tests/fixtures/sso_token_response.json | 2 +- tests/fixtures/update_object_request.json | 3 + tests/fixtures/user_api_key.json | 3 +- tests/fixtures/user_api_key_list.json | 1 + tests/fixtures/user_api_key_with_value.json | 3 +- tests/fixtures/version_list_response.json | 12 + tests/fixtures/webhook_endpoint.json | 13 + ...ent_organization_membership_groups_test.rs | 135 -- tests/user_management_test.rs | 1212 ------------ tests/vault_test.rs | 1681 +++++++++++++++++ tests/webhooks_test.rs | 4 +- 62 files changed, 2192 insertions(+), 2049 deletions(-) create mode 100644 .last-synced-sha rename src/enums/{audit_log_export_json_state.rs => audit_log_export_state.rs} (83%) delete mode 100644 src/enums/webhook_endpoint_json_status.rs delete mode 100644 src/models/audit_log_action_json.rs delete mode 100644 src/models/audit_log_export_json.rs delete mode 100644 src/models/audit_log_schema.rs delete mode 100644 src/models/audit_logs_retention_json.rs delete mode 100644 src/models/webhook_endpoint_json.rs delete mode 100644 src/resources/user_management_organization_membership_groups.rs create mode 100644 tests/fixtures/actor.json create mode 100644 tests/fixtures/audit_log_action.json create mode 100644 tests/fixtures/audit_log_export.json create mode 100644 tests/fixtures/audit_log_schema_dto.json create mode 100644 tests/fixtures/audit_logs_retention.json create mode 100644 tests/fixtures/create_data_key_request.json create mode 100644 tests/fixtures/create_data_key_response.json create mode 100644 tests/fixtures/create_object_request.json create mode 100644 tests/fixtures/decrypt_request.json create mode 100644 tests/fixtures/decrypt_response.json create mode 100644 tests/fixtures/delete_object_response.json create mode 100644 tests/fixtures/error.json create mode 100644 tests/fixtures/list_metadata.json create mode 100644 tests/fixtures/object.json create mode 100644 tests/fixtures/object_list_response.json create mode 100644 tests/fixtures/object_metadata.json create mode 100644 tests/fixtures/object_summary.json create mode 100644 tests/fixtures/object_version.json create mode 100644 tests/fixtures/object_without_value.json create mode 100644 tests/fixtures/pipe_connected_account.json create mode 100644 tests/fixtures/pipes_connected_account_connected.json create mode 100644 tests/fixtures/pipes_connected_account_disconnected.json create mode 100644 tests/fixtures/pipes_connected_account_reauthorization_needed.json create mode 100644 tests/fixtures/rekey_request.json create mode 100644 tests/fixtures/update_object_request.json create mode 100644 tests/fixtures/version_list_response.json create mode 100644 tests/fixtures/webhook_endpoint.json delete mode 100644 tests/user_management_organization_membership_groups_test.rs create mode 100644 tests/vault_test.rs diff --git a/.last-synced-sha b/.last-synced-sha new file mode 100644 index 00000000..ad25d3d1 --- /dev/null +++ b/.last-synced-sha @@ -0,0 +1 @@ +cb6857d51b453e3cbdb5bf3647d3ca229dd8af65 diff --git a/.oagen-manifest.json b/.oagen-manifest.json index e0ccdd22..d136636c 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,12 +1,12 @@ { "version": 2, "language": "rust", - "generatedAt": "2026-05-13T13:56:55.168Z", + "generatedAt": "2026-05-26T13:22:40.395Z", "files": [ "src/enums/audit_log_configuration_log_stream_state.rs", "src/enums/audit_log_configuration_log_stream_type.rs", "src/enums/audit_log_configuration_state.rs", - "src/enums/audit_log_export_json_state.rs", + "src/enums/audit_log_export_state.rs", "src/enums/authenticate_response_authentication_method.rs", "src/enums/authentication_factor_enrolled_type.rs", "src/enums/authentication_factor_type.rs", @@ -86,6 +86,7 @@ "src/enums/organization_updated_data_domain_state.rs", "src/enums/organization_updated_data_domain_verification_strategy.rs", "src/enums/pagination_order.rs", + "src/enums/pipe_connected_account_state.rs", "src/enums/profile_connection_type.rs", "src/enums/radar_action.rs", "src/enums/radar_standalone_assess_request_action.rs", @@ -123,14 +124,16 @@ "src/enums/vault_kek_created_data_actor_source.rs", "src/enums/vault_metadata_read_data_actor_source.rs", "src/enums/vault_names_listed_data_actor_source.rs", + "src/enums/vault_order.rs", "src/enums/waitlist_user_state.rs", - "src/enums/webhook_endpoint_json_status.rs", + "src/enums/webhook_endpoint_status.rs", "src/enums/widget_session_token_scopes.rs", "src/models/_unions.rs", "src/models/action_authentication_denied.rs", "src/models/action_authentication_denied_data.rs", "src/models/action_user_registration_denied.rs", "src/models/action_user_registration_denied_data.rs", + "src/models/actor.rs", "src/models/add_role_permission.rs", "src/models/api_key.rs", "src/models/api_key_created.rs", @@ -143,7 +146,7 @@ "src/models/api_key_validation_response.rs", "src/models/application_credentials_list_item.rs", "src/models/assign_role.rs", - "src/models/audit_log_action_json.rs", + "src/models/audit_log_action.rs", "src/models/audit_log_configuration.rs", "src/models/audit_log_configuration_log_stream.rs", "src/models/audit_log_event.rs", @@ -152,15 +155,15 @@ "src/models/audit_log_event_create_response.rs", "src/models/audit_log_event_ingestion.rs", "src/models/audit_log_event_target.rs", + "src/models/audit_log_export.rs", "src/models/audit_log_export_creation.rs", - "src/models/audit_log_export_json.rs", - "src/models/audit_log_schema.rs", "src/models/audit_log_schema_actor.rs", + "src/models/audit_log_schema_dto.rs", "src/models/audit_log_schema_json.rs", "src/models/audit_log_schema_json_actor.rs", "src/models/audit_log_schema_json_target.rs", "src/models/audit_log_schema_target.rs", - "src/models/audit_logs_retention_json.rs", + "src/models/audit_logs_retention.rs", "src/models/authenticate_response.rs", "src/models/authenticate_response_impersonator.rs", "src/models/authenticate_response_oauth_token.rs", @@ -264,11 +267,14 @@ "src/models/create_authorization_permission.rs", "src/models/create_authorization_resource.rs", "src/models/create_cors_origin.rs", + "src/models/create_data_key_request.rs", + "src/models/create_data_key_response.rs", "src/models/create_group.rs", "src/models/create_group_membership.rs", "src/models/create_m2m_application.rs", "src/models/create_magic_code_and_return.rs", "src/models/create_oauth_application.rs", + "src/models/create_object_request.rs", "src/models/create_organization_api_key.rs", "src/models/create_organization_domain.rs", "src/models/create_organization_role.rs", @@ -289,6 +295,9 @@ "src/models/data_integrations_list_response.rs", "src/models/data_integrations_list_response_data.rs", "src/models/data_integrations_list_response_data_connected_account.rs", + "src/models/decrypt_request.rs", + "src/models/decrypt_response.rs", + "src/models/delete_object_response.rs", "src/models/device_authorization_response.rs", "src/models/device_code_session_authenticate_request.rs", "src/models/directory.rs", @@ -335,6 +344,7 @@ "src/models/email_verification_created.rs", "src/models/email_verification_created_data.rs", "src/models/enroll_user_authentication_factor.rs", + "src/models/error.rs", "src/models/event_context.rs", "src/models/event_context_actor.rs", "src/models/event_context_google_analytics_session.rs", @@ -403,6 +413,7 @@ "src/models/jwks_response.rs", "src/models/jwks_response_keys.rs", "src/models/jwt_template_response.rs", + "src/models/list_metadata.rs", "src/models/magic_auth.rs", "src/models/magic_auth_code_session_authenticate_request.rs", "src/models/magic_auth_created.rs", @@ -410,6 +421,12 @@ "src/models/mfa_totp_session_authenticate_request.rs", "src/models/mod.rs", "src/models/new_connect_application_secret.rs", + "src/models/object.rs", + "src/models/object_list_response.rs", + "src/models/object_metadata.rs", + "src/models/object_summary.rs", + "src/models/object_version.rs", + "src/models/object_without_value.rs", "src/models/organization.rs", "src/models/organization_api_key.rs", "src/models/organization_api_key_list.rs", @@ -470,6 +487,10 @@ "src/models/permission_deleted_data.rs", "src/models/permission_updated.rs", "src/models/permission_updated_data.rs", + "src/models/pipe_connected_account.rs", + "src/models/pipes_connected_account_connected.rs", + "src/models/pipes_connected_account_disconnected.rs", + "src/models/pipes_connected_account_reauthorization_needed.rs", "src/models/portal_link_response.rs", "src/models/profile.rs", "src/models/radar_list_entry_already_present_response.rs", @@ -481,6 +502,7 @@ "src/models/redirect_uri.rs", "src/models/redirect_uri_input.rs", "src/models/refresh_token_session_authenticate_request.rs", + "src/models/rekey_request.rs", "src/models/remove_role.rs", "src/models/resend_user_invite_options.rs", "src/models/reset_password_response.rs", @@ -517,6 +539,7 @@ "src/models/update_group.rs", "src/models/update_jwt_template.rs", "src/models/update_oauth_application.rs", + "src/models/update_object_request.rs", "src/models/update_organization.rs", "src/models/update_organization_role.rs", "src/models/update_role.rs", @@ -581,11 +604,12 @@ "src/models/vault_names_listed_data.rs", "src/models/verify_email_address.rs", "src/models/verify_email_response.rs", + "src/models/version_list_response.rs", "src/models/waitlist_user.rs", "src/models/waitlist_user_approved.rs", "src/models/waitlist_user_created.rs", "src/models/waitlist_user_denied.rs", - "src/models/webhook_endpoint_json.rs", + "src/models/webhook_endpoint.rs", "src/models/webhook_endpoint_list.rs", "src/models/webhook_endpoint_list_list_metadata.rs", "src/models/widget_session_token.rs", @@ -602,12 +626,13 @@ "src/resources/mod.rs", "src/resources/multi_factor_auth.rs", "src/resources/organization_domains.rs", + "src/resources/organization_membership.rs", "src/resources/organizations.rs", "src/resources/pipes.rs", "src/resources/radar.rs", "src/resources/sso.rs", "src/resources/user_management.rs", - "src/resources/user_management_organization_membership_groups.rs", + "src/resources/vault.rs", "src/resources/webhooks.rs", "src/resources/widgets.rs", "src/resources_api.rs", @@ -624,6 +649,7 @@ "tests/fixtures/action_authentication_denied_data.json", "tests/fixtures/action_user_registration_denied.json", "tests/fixtures/action_user_registration_denied_data.json", + "tests/fixtures/actor.json", "tests/fixtures/add_role_permission.json", "tests/fixtures/api_key.json", "tests/fixtures/api_key_created.json", @@ -636,7 +662,7 @@ "tests/fixtures/api_key_validation_response.json", "tests/fixtures/application_credentials_list_item.json", "tests/fixtures/assign_role.json", - "tests/fixtures/audit_log_action_json.json", + "tests/fixtures/audit_log_action.json", "tests/fixtures/audit_log_configuration.json", "tests/fixtures/audit_log_configuration_log_stream.json", "tests/fixtures/audit_log_event.json", @@ -645,15 +671,15 @@ "tests/fixtures/audit_log_event_create_response.json", "tests/fixtures/audit_log_event_ingestion.json", "tests/fixtures/audit_log_event_target.json", + "tests/fixtures/audit_log_export.json", "tests/fixtures/audit_log_export_creation.json", - "tests/fixtures/audit_log_export_json.json", - "tests/fixtures/audit_log_schema.json", "tests/fixtures/audit_log_schema_actor.json", + "tests/fixtures/audit_log_schema_dto.json", "tests/fixtures/audit_log_schema_json.json", "tests/fixtures/audit_log_schema_json_actor.json", "tests/fixtures/audit_log_schema_json_target.json", "tests/fixtures/audit_log_schema_target.json", - "tests/fixtures/audit_logs_retention_json.json", + "tests/fixtures/audit_logs_retention.json", "tests/fixtures/authenticate_response.json", "tests/fixtures/authenticate_response_impersonator.json", "tests/fixtures/authenticate_response_oauth_token.json", @@ -756,11 +782,14 @@ "tests/fixtures/create_authorization_permission.json", "tests/fixtures/create_authorization_resource.json", "tests/fixtures/create_cors_origin.json", + "tests/fixtures/create_data_key_request.json", + "tests/fixtures/create_data_key_response.json", "tests/fixtures/create_group.json", "tests/fixtures/create_group_membership.json", "tests/fixtures/create_m2m_application.json", "tests/fixtures/create_magic_code_and_return.json", "tests/fixtures/create_oauth_application.json", + "tests/fixtures/create_object_request.json", "tests/fixtures/create_organization_api_key.json", "tests/fixtures/create_organization_domain.json", "tests/fixtures/create_organization_role.json", @@ -781,6 +810,9 @@ "tests/fixtures/data_integrations_list_response.json", "tests/fixtures/data_integrations_list_response_data.json", "tests/fixtures/data_integrations_list_response_data_connected_account.json", + "tests/fixtures/decrypt_request.json", + "tests/fixtures/decrypt_response.json", + "tests/fixtures/delete_object_response.json", "tests/fixtures/device_authorization_response.json", "tests/fixtures/device_code_session_authenticate_request.json", "tests/fixtures/directory.json", @@ -827,6 +859,7 @@ "tests/fixtures/email_verification_created.json", "tests/fixtures/email_verification_created_data.json", "tests/fixtures/enroll_user_authentication_factor.json", + "tests/fixtures/error.json", "tests/fixtures/event_context.json", "tests/fixtures/event_context_actor.json", "tests/fixtures/event_context_google_analytics_session.json", @@ -895,12 +928,19 @@ "tests/fixtures/jwks_response.json", "tests/fixtures/jwks_response_keys.json", "tests/fixtures/jwt_template_response.json", + "tests/fixtures/list_metadata.json", "tests/fixtures/magic_auth.json", "tests/fixtures/magic_auth_code_session_authenticate_request.json", "tests/fixtures/magic_auth_created.json", "tests/fixtures/magic_auth_created_data.json", "tests/fixtures/mfa_totp_session_authenticate_request.json", "tests/fixtures/new_connect_application_secret.json", + "tests/fixtures/object.json", + "tests/fixtures/object_list_response.json", + "tests/fixtures/object_metadata.json", + "tests/fixtures/object_summary.json", + "tests/fixtures/object_version.json", + "tests/fixtures/object_without_value.json", "tests/fixtures/organization.json", "tests/fixtures/organization_api_key.json", "tests/fixtures/organization_api_key_list.json", @@ -961,6 +1001,10 @@ "tests/fixtures/permission_deleted_data.json", "tests/fixtures/permission_updated.json", "tests/fixtures/permission_updated_data.json", + "tests/fixtures/pipe_connected_account.json", + "tests/fixtures/pipes_connected_account_connected.json", + "tests/fixtures/pipes_connected_account_disconnected.json", + "tests/fixtures/pipes_connected_account_reauthorization_needed.json", "tests/fixtures/portal_link_response.json", "tests/fixtures/profile.json", "tests/fixtures/radar_list_entry_already_present_response.json", @@ -972,6 +1016,7 @@ "tests/fixtures/redirect_uri.json", "tests/fixtures/redirect_uri_input.json", "tests/fixtures/refresh_token_session_authenticate_request.json", + "tests/fixtures/rekey_request.json", "tests/fixtures/remove_role.json", "tests/fixtures/resend_user_invite_options.json", "tests/fixtures/reset_password_response.json", @@ -1008,6 +1053,7 @@ "tests/fixtures/update_group.json", "tests/fixtures/update_jwt_template.json", "tests/fixtures/update_oauth_application.json", + "tests/fixtures/update_object_request.json", "tests/fixtures/update_organization.json", "tests/fixtures/update_organization_role.json", "tests/fixtures/update_role.json", @@ -1072,11 +1118,12 @@ "tests/fixtures/vault_names_listed_data.json", "tests/fixtures/verify_email_address.json", "tests/fixtures/verify_email_response.json", + "tests/fixtures/version_list_response.json", "tests/fixtures/waitlist_user.json", "tests/fixtures/waitlist_user_approved.json", "tests/fixtures/waitlist_user_created.json", "tests/fixtures/waitlist_user_denied.json", - "tests/fixtures/webhook_endpoint_json.json", + "tests/fixtures/webhook_endpoint.json", "tests/fixtures/webhook_endpoint_list.json", "tests/fixtures/webhook_endpoint_list_list_metadata.json", "tests/fixtures/widget_session_token.json", @@ -1084,12 +1131,13 @@ "tests/groups_test.rs", "tests/multi_factor_auth_test.rs", "tests/organization_domains_test.rs", + "tests/organization_membership_test.rs", "tests/organizations_test.rs", "tests/pipes_test.rs", "tests/radar_test.rs", "tests/sso_test.rs", - "tests/user_management_organization_membership_groups_test.rs", "tests/user_management_test.rs", + "tests/vault_test.rs", "tests/webhooks_test.rs", "tests/widgets_test.rs" ], @@ -1710,57 +1758,101 @@ "sdkMethod": "get_magic_auth", "service": "user_management" }, + "POST /user_management/redirect_uris": { + "sdkMethod": "create_redirect_uri", + "service": "user_management" + }, + "GET /user_management/users/{user_id}/authorized_applications": { + "sdkMethod": "list_user_authorized_applications", + "service": "user_management" + }, + "DELETE /user_management/users/{user_id}/authorized_applications/{application_id}": { + "sdkMethod": "delete_user_authorized_application", + "service": "user_management" + }, + "GET /user_management/users/{userId}/api_keys": { + "sdkMethod": "list_user_api_keys", + "service": "user_management" + }, + "POST /user_management/users/{userId}/api_keys": { + "sdkMethod": "create_user_api_key", + "service": "user_management" + }, "GET /user_management/organization_memberships": { "sdkMethod": "list_organization_memberships", - "service": "user_management" + "service": "organization_membership" }, "POST /user_management/organization_memberships": { "sdkMethod": "create_organization_membership", - "service": "user_management" + "service": "organization_membership" }, "GET /user_management/organization_memberships/{id}": { "sdkMethod": "get_organization_membership", - "service": "user_management" + "service": "organization_membership" }, "PUT /user_management/organization_memberships/{id}": { "sdkMethod": "update_organization_membership", - "service": "user_management" + "service": "organization_membership" }, "DELETE /user_management/organization_memberships/{id}": { "sdkMethod": "delete_organization_membership", - "service": "user_management" + "service": "organization_membership" }, "PUT /user_management/organization_memberships/{id}/deactivate": { "sdkMethod": "deactivate_organization_membership", - "service": "user_management" + "service": "organization_membership" }, "PUT /user_management/organization_memberships/{id}/reactivate": { "sdkMethod": "reactivate_organization_membership", - "service": "user_management" + "service": "organization_membership" }, - "POST /user_management/redirect_uris": { - "sdkMethod": "create_redirect_uri", - "service": "user_management" + "GET /user_management/organization_memberships/{omId}/groups": { + "sdkMethod": "list_organization_membership_groups", + "service": "organization_membership" }, - "GET /user_management/users/{user_id}/authorized_applications": { - "sdkMethod": "list_user_authorized_applications", - "service": "user_management" + "POST /vault/v1/keys/data-key": { + "sdkMethod": "create_data_key", + "service": "vault" }, - "DELETE /user_management/users/{user_id}/authorized_applications/{application_id}": { - "sdkMethod": "delete_user_authorized_application", - "service": "user_management" + "POST /vault/v1/keys/decrypt": { + "sdkMethod": "create_decrypt", + "service": "vault" }, - "GET /user_management/users/{userId}/api_keys": { - "sdkMethod": "list_user_api_keys", - "service": "user_management" + "POST /vault/v1/keys/rekey": { + "sdkMethod": "create_rekey", + "service": "vault" }, - "POST /user_management/users/{userId}/api_keys": { - "sdkMethod": "create_user_api_key", - "service": "user_management" + "GET /vault/v1/kv": { + "sdkMethod": "list_kv", + "service": "vault" }, - "GET /user_management/organization_memberships/{omId}/groups": { - "sdkMethod": "list_organization_membership_groups", - "service": "user_management_organization_membership_groups" + "POST /vault/v1/kv": { + "sdkMethod": "create_kv", + "service": "vault" + }, + "GET /vault/v1/kv/name/{name}": { + "sdkMethod": "get_name", + "service": "vault" + }, + "GET /vault/v1/kv/{id}": { + "sdkMethod": "get_kv", + "service": "vault" + }, + "PUT /vault/v1/kv/{id}": { + "sdkMethod": "update_kv", + "service": "vault" + }, + "DELETE /vault/v1/kv/{id}": { + "sdkMethod": "delete_kv", + "service": "vault" + }, + "GET /vault/v1/kv/{id}/metadata": { + "sdkMethod": "list_kv_metadata", + "service": "vault" + }, + "GET /vault/v1/kv/{id}/versions": { + "sdkMethod": "list_kv_versions", + "service": "vault" }, "GET /webhook_endpoints": { "sdkMethod": "list_webhook_endpoints", diff --git a/src/enums/audit_log_export_json_state.rs b/src/enums/audit_log_export_state.rs similarity index 83% rename from src/enums/audit_log_export_json_state.rs rename to src/enums/audit_log_export_state.rs index 64659fec..c5bd036e 100644 --- a/src/enums/audit_log_export_json_state.rs +++ b/src/enums/audit_log_export_state.rs @@ -6,7 +6,7 @@ use std::str::FromStr; #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[non_exhaustive] -pub enum AuditLogExportJsonState { +pub enum AuditLogExportState { Pending, Ready, Error, @@ -17,7 +17,7 @@ pub enum AuditLogExportJsonState { Unknown(String), } -impl AuditLogExportJsonState { +impl AuditLogExportState { /// Canonical wire string for this value. For [`Self::Unknown`] returns the /// original wire value as received from the API. #[allow(deprecated)] @@ -31,19 +31,19 @@ impl AuditLogExportJsonState { } } -impl fmt::Display for AuditLogExportJsonState { +impl fmt::Display for AuditLogExportState { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } -impl AsRef for AuditLogExportJsonState { +impl AsRef for AuditLogExportState { fn as_ref(&self) -> &str { self.as_str() } } -impl FromStr for AuditLogExportJsonState { +impl FromStr for AuditLogExportState { type Err = std::convert::Infallible; #[allow(deprecated)] fn from_str(s: &str) -> Result { @@ -56,7 +56,7 @@ impl FromStr for AuditLogExportJsonState { } } -impl From for AuditLogExportJsonState { +impl From for AuditLogExportState { fn from(s: String) -> Self { // Reuse the original `String` allocation in the fallback branch. match Self::from_str(&s) { @@ -66,19 +66,19 @@ impl From for AuditLogExportJsonState { } } -impl From<&str> for AuditLogExportJsonState { +impl From<&str> for AuditLogExportState { fn from(s: &str) -> Self { Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) } } -impl Serialize for AuditLogExportJsonState { +impl Serialize for AuditLogExportState { fn serialize(&self, serializer: S) -> Result { serializer.serialize_str(self.as_str()) } } -impl<'de> Deserialize<'de> for AuditLogExportJsonState { +impl<'de> Deserialize<'de> for AuditLogExportState { fn deserialize>(deserializer: D) -> Result { let s = String::deserialize(deserializer)?; Ok(Self::from(s)) diff --git a/src/enums/mod.rs b/src/enums/mod.rs index fbb77fea..42789e21 100644 --- a/src/enums/mod.rs +++ b/src/enums/mod.rs @@ -3,7 +3,7 @@ pub mod audit_log_configuration_log_stream_state; pub mod audit_log_configuration_log_stream_type; pub mod audit_log_configuration_state; -pub mod audit_log_export_json_state; +pub mod audit_log_export_state; pub mod authenticate_response_authentication_method; pub mod authentication_factor_enrolled_type; pub mod authentication_factor_type; @@ -82,6 +82,7 @@ pub mod organization_membership_updated_data_status; pub mod organization_updated_data_domain_state; pub mod organization_updated_data_domain_verification_strategy; pub mod pagination_order; +pub mod pipe_connected_account_state; pub mod profile_connection_type; pub mod radar_action; pub mod radar_standalone_assess_request_action; @@ -119,14 +120,15 @@ pub mod vault_dek_read_data_actor_source; pub mod vault_kek_created_data_actor_source; pub mod vault_metadata_read_data_actor_source; pub mod vault_names_listed_data_actor_source; +pub mod vault_order; pub mod waitlist_user_state; -pub mod webhook_endpoint_json_status; +pub mod webhook_endpoint_status; pub mod widget_session_token_scopes; pub use audit_log_configuration_log_stream_state::*; pub use audit_log_configuration_log_stream_type::*; pub use audit_log_configuration_state::*; -pub use audit_log_export_json_state::*; +pub use audit_log_export_state::*; pub use authenticate_response_authentication_method::*; pub use authentication_factor_enrolled_type::*; pub use authentication_factor_type::*; @@ -205,6 +207,7 @@ pub use organization_membership_updated_data_status::*; pub use organization_updated_data_domain_state::*; pub use organization_updated_data_domain_verification_strategy::*; pub use pagination_order::*; +pub use pipe_connected_account_state::*; pub use profile_connection_type::*; pub use radar_action::*; pub use radar_standalone_assess_request_action::*; @@ -242,6 +245,7 @@ pub use vault_dek_read_data_actor_source::*; pub use vault_kek_created_data_actor_source::*; pub use vault_metadata_read_data_actor_source::*; pub use vault_names_listed_data_actor_source::*; +pub use vault_order::*; pub use waitlist_user_state::*; -pub use webhook_endpoint_json_status::*; +pub use webhook_endpoint_status::*; pub use widget_session_token_scopes::*; diff --git a/src/enums/webhook_endpoint_json_status.rs b/src/enums/webhook_endpoint_json_status.rs deleted file mode 100644 index 72879641..00000000 --- a/src/enums/webhook_endpoint_json_status.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -use serde::{Deserialize, Serialize}; -use std::fmt; -use std::str::FromStr; - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[non_exhaustive] -pub enum WebhookEndpointJsonStatus { - Enabled, - Disabled, - /// Wire value not recognized by this SDK version. The original - /// string is preserved verbatim. WorkOS may add new enum values - /// server-side; matching on this variant lets callers handle - /// forward-compatible values without panicking. - Unknown(String), -} - -impl WebhookEndpointJsonStatus { - /// Canonical wire string for this value. For [`Self::Unknown`] returns the - /// original wire value as received from the API. - #[allow(deprecated)] - pub fn as_str(&self) -> &str { - match self { - Self::Enabled => "enabled", - Self::Disabled => "disabled", - Self::Unknown(s) => s.as_str(), - } - } -} - -impl fmt::Display for WebhookEndpointJsonStatus { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(self.as_str()) - } -} - -impl AsRef for WebhookEndpointJsonStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} - -impl FromStr for WebhookEndpointJsonStatus { - type Err = std::convert::Infallible; - #[allow(deprecated)] - fn from_str(s: &str) -> Result { - Ok(match s { - "enabled" => Self::Enabled, - "disabled" => Self::Disabled, - other => Self::Unknown(other.to_string()), - }) - } -} - -impl From for WebhookEndpointJsonStatus { - fn from(s: String) -> Self { - // Reuse the original `String` allocation in the fallback branch. - match Self::from_str(&s) { - Ok(Self::Unknown(_)) => Self::Unknown(s), - Ok(other) => other, - } - } -} - -impl From<&str> for WebhookEndpointJsonStatus { - fn from(s: &str) -> Self { - Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) - } -} - -impl Serialize for WebhookEndpointJsonStatus { - fn serialize(&self, serializer: S) -> Result { - serializer.serialize_str(self.as_str()) - } -} - -impl<'de> Deserialize<'de> for WebhookEndpointJsonStatus { - fn deserialize>(deserializer: D) -> Result { - let s = String::deserialize(deserializer)?; - Ok(Self::from(s)) - } -} diff --git a/src/models/audit_log_action_json.rs b/src/models/audit_log_action_json.rs deleted file mode 100644 index 8dff6d3e..00000000 --- a/src/models/audit_log_action_json.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -#[allow(unused_imports)] -use super::*; -#[allow(unused_imports)] -use crate::enums::*; -use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogActionJson { - /// Distinguishes the Audit Log Action object. - pub object: String, - /// Identifier of what action was taken. - pub name: String, - /// The schema associated with the action. - pub schema: AuditLogSchemaJson, - /// An ISO 8601 timestamp. - pub created_at: String, - /// An ISO 8601 timestamp. - pub updated_at: String, -} diff --git a/src/models/audit_log_export_json.rs b/src/models/audit_log_export_json.rs deleted file mode 100644 index 736f04bb..00000000 --- a/src/models/audit_log_export_json.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -#[allow(unused_imports)] -use super::*; -#[allow(unused_imports)] -use crate::enums::*; -use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogExportJson { - /// Distinguishes the Audit Log Export object. - pub object: String, - /// The unique ID of the Audit Log Export. - pub id: String, - /// The state of the export. Possible values: pending, ready, error. - pub state: AuditLogExportJsonState, - /// A URL to the CSV file. Only defined when the Audit Log Export is ready. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub url: Option, - /// An ISO 8601 timestamp. - pub created_at: String, - /// An ISO 8601 timestamp. - pub updated_at: String, -} diff --git a/src/models/audit_log_schema.rs b/src/models/audit_log_schema.rs deleted file mode 100644 index 55302c18..00000000 --- a/src/models/audit_log_schema.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -#[allow(unused_imports)] -use super::*; -#[allow(unused_imports)] -use crate::enums::*; -use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogSchema { - /// The metadata schema for the actor. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub actor: Option, - /// The list of targets for the schema. - pub targets: Vec, - /// Optional JSON schema for event metadata. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub metadata: Option>, -} diff --git a/src/models/audit_logs_retention_json.rs b/src/models/audit_logs_retention_json.rs deleted file mode 100644 index 75da4aa7..00000000 --- a/src/models/audit_logs_retention_json.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -#[allow(unused_imports)] -use super::*; -#[allow(unused_imports)] -use crate::enums::*; -use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogsRetentionJson { - /// The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365. - #[serde(skip_serializing_if = "Option::is_none", default)] - pub retention_period_in_days: Option, -} diff --git a/src/models/mod.rs b/src/models/mod.rs index 1384bdfe..e8606360 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -5,6 +5,7 @@ pub mod action_authentication_denied; pub mod action_authentication_denied_data; pub mod action_user_registration_denied; pub mod action_user_registration_denied_data; +pub mod actor; pub mod add_role_permission; pub mod api_key; pub mod api_key_created; @@ -17,7 +18,7 @@ pub mod api_key_revoked_data_owner; pub mod api_key_validation_response; pub mod application_credentials_list_item; pub mod assign_role; -pub mod audit_log_action_json; +pub mod audit_log_action; pub mod audit_log_configuration; pub mod audit_log_configuration_log_stream; pub mod audit_log_event; @@ -26,15 +27,15 @@ pub mod audit_log_event_context; pub mod audit_log_event_create_response; pub mod audit_log_event_ingestion; pub mod audit_log_event_target; +pub mod audit_log_export; pub mod audit_log_export_creation; -pub mod audit_log_export_json; -pub mod audit_log_schema; pub mod audit_log_schema_actor; +pub mod audit_log_schema_dto; pub mod audit_log_schema_json; pub mod audit_log_schema_json_actor; pub mod audit_log_schema_json_target; pub mod audit_log_schema_target; -pub mod audit_logs_retention_json; +pub mod audit_logs_retention; pub mod authenticate_response; pub mod authenticate_response_impersonator; pub mod authenticate_response_oauth_token; @@ -138,11 +139,14 @@ pub mod create_application_secret; pub mod create_authorization_permission; pub mod create_authorization_resource; pub mod create_cors_origin; +pub mod create_data_key_request; +pub mod create_data_key_response; pub mod create_group; pub mod create_group_membership; pub mod create_m2m_application; pub mod create_magic_code_and_return; pub mod create_oauth_application; +pub mod create_object_request; pub mod create_organization_api_key; pub mod create_organization_domain; pub mod create_organization_role; @@ -163,6 +167,9 @@ pub mod data_integrations_get_user_token_request; pub mod data_integrations_list_response; pub mod data_integrations_list_response_data; pub mod data_integrations_list_response_data_connected_account; +pub mod decrypt_request; +pub mod decrypt_response; +pub mod delete_object_response; pub mod device_authorization_response; pub mod device_code_session_authenticate_request; pub mod directory; @@ -209,6 +216,7 @@ pub mod email_verification_code_session_authenticate_request; pub mod email_verification_created; pub mod email_verification_created_data; pub mod enroll_user_authentication_factor; +pub mod error; pub mod event_context; pub mod event_context_actor; pub mod event_context_google_analytics_session; @@ -277,12 +285,19 @@ pub mod invitation_revoked_data; pub mod jwks_response; pub mod jwks_response_keys; pub mod jwt_template_response; +pub mod list_metadata; pub mod magic_auth; pub mod magic_auth_code_session_authenticate_request; pub mod magic_auth_created; pub mod magic_auth_created_data; pub mod mfa_totp_session_authenticate_request; pub mod new_connect_application_secret; +pub mod object; +pub mod object_list_response; +pub mod object_metadata; +pub mod object_summary; +pub mod object_version; +pub mod object_without_value; pub mod organization; pub mod organization_api_key; pub mod organization_api_key_list; @@ -343,6 +358,10 @@ pub mod permission_deleted; pub mod permission_deleted_data; pub mod permission_updated; pub mod permission_updated_data; +pub mod pipe_connected_account; +pub mod pipes_connected_account_connected; +pub mod pipes_connected_account_disconnected; +pub mod pipes_connected_account_reauthorization_needed; pub mod portal_link_response; pub mod profile; pub mod radar_list_entry_already_present_response; @@ -354,6 +373,7 @@ pub mod radar_standalone_update_radar_list_request; pub mod redirect_uri; pub mod redirect_uri_input; pub mod refresh_token_session_authenticate_request; +pub mod rekey_request; pub mod remove_role; pub mod resend_user_invite_options; pub mod reset_password_response; @@ -390,6 +410,7 @@ pub mod update_authorization_resource; pub mod update_group; pub mod update_jwt_template; pub mod update_oauth_application; +pub mod update_object_request; pub mod update_organization; pub mod update_organization_role; pub mod update_role; @@ -454,11 +475,12 @@ pub mod vault_names_listed; pub mod vault_names_listed_data; pub mod verify_email_address; pub mod verify_email_response; +pub mod version_list_response; pub mod waitlist_user; pub mod waitlist_user_approved; pub mod waitlist_user_created; pub mod waitlist_user_denied; -pub mod webhook_endpoint_json; +pub mod webhook_endpoint; pub mod webhook_endpoint_list; pub mod webhook_endpoint_list_list_metadata; pub mod widget_session_token; @@ -469,6 +491,7 @@ pub use action_authentication_denied::*; pub use action_authentication_denied_data::*; pub use action_user_registration_denied::*; pub use action_user_registration_denied_data::*; +pub use actor::*; pub use add_role_permission::*; pub use api_key::*; pub use api_key_created::*; @@ -481,7 +504,7 @@ pub use api_key_revoked_data_owner::*; pub use api_key_validation_response::*; pub use application_credentials_list_item::*; pub use assign_role::*; -pub use audit_log_action_json::*; +pub use audit_log_action::*; pub use audit_log_configuration::*; pub use audit_log_configuration_log_stream::*; pub use audit_log_event::*; @@ -490,15 +513,15 @@ pub use audit_log_event_context::*; pub use audit_log_event_create_response::*; pub use audit_log_event_ingestion::*; pub use audit_log_event_target::*; +pub use audit_log_export::*; pub use audit_log_export_creation::*; -pub use audit_log_export_json::*; -pub use audit_log_schema::*; pub use audit_log_schema_actor::*; +pub use audit_log_schema_dto::*; pub use audit_log_schema_json::*; pub use audit_log_schema_json_actor::*; pub use audit_log_schema_json_target::*; pub use audit_log_schema_target::*; -pub use audit_logs_retention_json::*; +pub use audit_logs_retention::*; pub use authenticate_response::*; pub use authenticate_response_impersonator::*; pub use authenticate_response_oauth_token::*; @@ -602,11 +625,14 @@ pub use create_application_secret::*; pub use create_authorization_permission::*; pub use create_authorization_resource::*; pub use create_cors_origin::*; +pub use create_data_key_request::*; +pub use create_data_key_response::*; pub use create_group::*; pub use create_group_membership::*; pub use create_m2m_application::*; pub use create_magic_code_and_return::*; pub use create_oauth_application::*; +pub use create_object_request::*; pub use create_organization_api_key::*; pub use create_organization_domain::*; pub use create_organization_role::*; @@ -627,6 +653,9 @@ pub use data_integrations_get_user_token_request::*; pub use data_integrations_list_response::*; pub use data_integrations_list_response_data::*; pub use data_integrations_list_response_data_connected_account::*; +pub use decrypt_request::*; +pub use decrypt_response::*; +pub use delete_object_response::*; pub use device_authorization_response::*; pub use device_code_session_authenticate_request::*; pub use directory::*; @@ -673,6 +702,7 @@ pub use email_verification_code_session_authenticate_request::*; pub use email_verification_created::*; pub use email_verification_created_data::*; pub use enroll_user_authentication_factor::*; +pub use error::*; pub use event_context::*; pub use event_context_actor::*; pub use event_context_google_analytics_session::*; @@ -741,12 +771,19 @@ pub use invitation_revoked_data::*; pub use jwks_response::*; pub use jwks_response_keys::*; pub use jwt_template_response::*; +pub use list_metadata::*; pub use magic_auth::*; pub use magic_auth_code_session_authenticate_request::*; pub use magic_auth_created::*; pub use magic_auth_created_data::*; pub use mfa_totp_session_authenticate_request::*; pub use new_connect_application_secret::*; +pub use object::*; +pub use object_list_response::*; +pub use object_metadata::*; +pub use object_summary::*; +pub use object_version::*; +pub use object_without_value::*; pub use organization::*; pub use organization_api_key::*; pub use organization_api_key_list::*; @@ -807,6 +844,10 @@ pub use permission_deleted::*; pub use permission_deleted_data::*; pub use permission_updated::*; pub use permission_updated_data::*; +pub use pipe_connected_account::*; +pub use pipes_connected_account_connected::*; +pub use pipes_connected_account_disconnected::*; +pub use pipes_connected_account_reauthorization_needed::*; pub use portal_link_response::*; pub use profile::*; pub use radar_list_entry_already_present_response::*; @@ -818,6 +859,7 @@ pub use radar_standalone_update_radar_list_request::*; pub use redirect_uri::*; pub use redirect_uri_input::*; pub use refresh_token_session_authenticate_request::*; +pub use rekey_request::*; pub use remove_role::*; pub use resend_user_invite_options::*; pub use reset_password_response::*; @@ -854,6 +896,7 @@ pub use update_authorization_resource::*; pub use update_group::*; pub use update_jwt_template::*; pub use update_oauth_application::*; +pub use update_object_request::*; pub use update_organization::*; pub use update_organization_role::*; pub use update_role::*; @@ -918,11 +961,12 @@ pub use vault_names_listed::*; pub use vault_names_listed_data::*; pub use verify_email_address::*; pub use verify_email_response::*; +pub use version_list_response::*; pub use waitlist_user::*; pub use waitlist_user_approved::*; pub use waitlist_user_created::*; pub use waitlist_user_denied::*; -pub use webhook_endpoint_json::*; +pub use webhook_endpoint::*; pub use webhook_endpoint_list::*; pub use webhook_endpoint_list_list_metadata::*; pub use widget_session_token::*; diff --git a/src/models/webhook_endpoint_json.rs b/src/models/webhook_endpoint_json.rs deleted file mode 100644 index 50a6d739..00000000 --- a/src/models/webhook_endpoint_json.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -#[allow(unused_imports)] -use super::*; -#[allow(unused_imports)] -use crate::enums::*; -use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct WebhookEndpointJson { - /// Distinguishes the Webhook Endpoint object. - pub object: String, - /// Unique identifier of the Webhook Endpoint. - pub id: String, - /// The URL to which webhooks are sent. - pub endpoint_url: String, - /// The secret used to sign webhook payloads. - pub secret: crate::SecretString, - /// Whether the Webhook Endpoint is enabled or disabled. - pub status: WebhookEndpointJsonStatus, - /// The events that the Webhook Endpoint is subscribed to. - pub events: Vec, - /// An ISO 8601 timestamp. - pub created_at: String, - /// An ISO 8601 timestamp. - pub updated_at: String, -} diff --git a/src/models/webhook_endpoint_list.rs b/src/models/webhook_endpoint_list.rs index 8bd0639a..83499eba 100644 --- a/src/models/webhook_endpoint_list.rs +++ b/src/models/webhook_endpoint_list.rs @@ -10,7 +10,7 @@ pub struct WebhookEndpointList { /// Indicates this is a list response. pub object: String, /// The list of records for the current page. - pub data: Vec, + pub data: Vec, /// Pagination cursors for navigating between pages of results. pub list_metadata: WebhookEndpointListListMetadata, } diff --git a/src/resources/mod.rs b/src/resources/mod.rs index 75f05a55..1eb54d16 100644 --- a/src/resources/mod.rs +++ b/src/resources/mod.rs @@ -11,12 +11,13 @@ pub mod feature_flags; pub mod groups; pub mod multi_factor_auth; pub mod organization_domains; +pub mod organization_membership; pub mod organizations; pub mod pipes; pub mod radar; pub mod sso; pub mod user_management; -pub mod user_management_organization_membership_groups; +pub mod vault; pub mod webhooks; pub mod widgets; @@ -31,11 +32,12 @@ pub use feature_flags::FeatureFlagsApi; pub use groups::GroupsApi; pub use multi_factor_auth::MultiFactorAuthApi; pub use organization_domains::OrganizationDomainsApi; +pub use organization_membership::OrganizationMembershipApi; pub use organizations::OrganizationsApi; pub use pipes::PipesApi; pub use radar::RadarApi; pub use sso::SSOApi; pub use user_management::UserManagementApi; -pub use user_management_organization_membership_groups::UserManagementOrganizationMembershipGroupsApi; +pub use vault::VaultApi; pub use webhooks::WebhooksApi; pub use widgets::WidgetsApi; diff --git a/src/resources/user_management.rs b/src/resources/user_management.rs index 46984a48..d2200e17 100644 --- a/src/resources/user_management.rs +++ b/src/resources/user_management.rs @@ -24,13 +24,6 @@ pub enum Password { }, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -#[serde(untagged)] -pub enum Role { - Single { role_slug: String }, - Multiple { role_slugs: String }, -} - #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct CreateUserParamsBody { /// The email address of the user. @@ -116,48 +109,6 @@ impl UpdateUserParamsBody { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -pub struct CreateOrganizationMembershipParamsBody { - /// The ID of the [user](https://workos.com/docs/reference/authkit/user). - /// - /// Required. - pub user_id: String, - /// The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. - /// - /// Required. - pub organization_id: String, - #[serde(flatten)] - #[serde(skip_serializing_if = "Option::is_none")] - pub role: Option, -} - -impl CreateOrganizationMembershipParamsBody { - /// Construct a new `CreateOrganizationMembershipParamsBody` with the required fields set. - pub fn new(user_id: impl Into, organization_id: impl Into) -> Self { - Self { - user_id: user_id.into(), - organization_id: organization_id.into(), - role: Default::default(), - } - } -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Default)] -pub struct UpdateOrganizationMembershipParamsBody { - #[serde(flatten)] - #[serde(skip_serializing_if = "Option::is_none")] - pub role: Option, -} - -impl UpdateOrganizationMembershipParamsBody { - /// Construct a new `UpdateOrganizationMembershipParamsBody` with the required fields set. - pub fn new() -> Self { - Self { - role: Default::default(), - } - } -} - #[derive(Debug, Clone, Serialize)] pub struct AuthenticateWithPasswordParams { /// The user's email address. @@ -864,85 +815,6 @@ impl CreateMagicAuthParams { } } -#[derive(Debug, Clone, Serialize)] -pub struct ListOrganizationMembershipsParams { - /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub before: Option, - /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub after: Option, - /// Upper limit on the number of objects to return, between `1` and `100`. - /// - /// Defaults to `10`. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - /// - /// Defaults to `desc`. - #[serde(skip_serializing_if = "Option::is_none")] - pub order: Option, - /// The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. - #[serde(skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - /// Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. - #[serde(skip_serializing_if = "Option::is_none")] - #[serde(serialize_with = "crate::query::serialize_comma_separated_opt")] - pub statuses: Option>, - /// The ID of the [user](https://workos.com/docs/reference/authkit/user). - #[serde(skip_serializing_if = "Option::is_none")] - pub user_id: Option, -} - -impl Default for ListOrganizationMembershipsParams { - #[allow(deprecated)] - fn default() -> Self { - Self { - before: Default::default(), - after: Default::default(), - limit: Some(10), - order: Some(PaginationOrder::Desc), - organization_id: Default::default(), - statuses: Default::default(), - user_id: Default::default(), - } - } -} - -#[derive(Debug, Clone, Serialize)] -pub struct CreateOrganizationMembershipParams { - /// Request body sent with this call. - /// - /// Required. - #[serde(skip)] - pub body: CreateOrganizationMembershipParamsBody, -} - -impl CreateOrganizationMembershipParams { - /// Construct a new `CreateOrganizationMembershipParams` with the required fields set. - #[allow(deprecated)] - pub fn new(body: CreateOrganizationMembershipParamsBody) -> Self { - Self { body } - } -} - -#[derive(Debug, Clone, Serialize)] -pub struct UpdateOrganizationMembershipParams { - /// Request body sent with this call. - /// - /// Required. - #[serde(skip)] - pub body: UpdateOrganizationMembershipParamsBody, -} - -impl UpdateOrganizationMembershipParams { - /// Construct a new `UpdateOrganizationMembershipParams` with the required fields set. - #[allow(deprecated)] - pub fn new(body: UpdateOrganizationMembershipParamsBody) -> Self { - Self { body } - } -} - #[derive(Debug, Clone, Serialize)] pub struct CreateRedirectUriParams { /// Request body sent with this call. @@ -2094,190 +1966,6 @@ impl<'a> UserManagementApi<'a> { .await } - /// List organization memberships - /// - /// Get a list of all organization memberships matching the criteria specified. At least one of `user_id` or `organization_id` must be provided. By default only active memberships are returned. Use the `statuses` parameter to filter by other statuses. - pub async fn list_organization_memberships( - &self, - params: ListOrganizationMembershipsParams, - ) -> Result, Error> { - self.list_organization_memberships_with_options(params, None) - .await - } - - /// Variant of [`Self::list_organization_memberships`] that accepts per-request [`crate::RequestOptions`]. - pub async fn list_organization_memberships_with_options( - &self, - params: ListOrganizationMembershipsParams, - options: Option<&crate::RequestOptions>, - ) -> Result, Error> { - let path = "/user_management/organization_memberships".to_string(); - let method = http::Method::GET; - self.client - .request_with_query_opts(method, &path, ¶ms, options) - .await - } - - /// Create an organization membership - /// - /// Creates a new `active` organization membership for the given organization and user. - /// - /// Calling this API with an organization and user that match an `inactive` organization membership will activate the membership with the specified role(s). - pub async fn create_organization_membership( - &self, - params: CreateOrganizationMembershipParams, - ) -> Result { - self.create_organization_membership_with_options(params, None) - .await - } - - /// Variant of [`Self::create_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn create_organization_membership_with_options( - &self, - params: CreateOrganizationMembershipParams, - options: Option<&crate::RequestOptions>, - ) -> Result { - let path = "/user_management/organization_memberships".to_string(); - let method = http::Method::POST; - self.client - .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) - .await - } - - /// Get an organization membership - /// - /// Get the details of an existing organization membership. - pub async fn get_organization_membership( - &self, - id: &str, - ) -> Result { - self.get_organization_membership_with_options(id, None) - .await - } - - /// Variant of [`Self::get_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn get_organization_membership_with_options( - &self, - id: &str, - options: Option<&crate::RequestOptions>, - ) -> Result { - let id = crate::client::path_segment(id); - let path = format!("/user_management/organization_memberships/{id}"); - let method = http::Method::GET; - self.client - .request_with_query_opts(method, &path, &(), options) - .await - } - - /// Update an organization membership - /// - /// Update the details of an existing organization membership. - pub async fn update_organization_membership( - &self, - id: &str, - params: UpdateOrganizationMembershipParams, - ) -> Result { - self.update_organization_membership_with_options(id, params, None) - .await - } - - /// Variant of [`Self::update_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn update_organization_membership_with_options( - &self, - id: &str, - params: UpdateOrganizationMembershipParams, - options: Option<&crate::RequestOptions>, - ) -> Result { - let id = crate::client::path_segment(id); - let path = format!("/user_management/organization_memberships/{id}"); - let method = http::Method::PUT; - self.client - .request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options) - .await - } - - /// Delete an organization membership - /// - /// Permanently deletes an existing organization membership. It cannot be undone. - pub async fn delete_organization_membership(&self, id: &str) -> Result<(), Error> { - self.delete_organization_membership_with_options(id, None) - .await - } - - /// Variant of [`Self::delete_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn delete_organization_membership_with_options( - &self, - id: &str, - options: Option<&crate::RequestOptions>, - ) -> Result<(), Error> { - let id = crate::client::path_segment(id); - let path = format!("/user_management/organization_memberships/{id}"); - let method = http::Method::DELETE; - self.client - .request_with_query_opts_empty(method, &path, &(), options) - .await - } - - /// Deactivate an organization membership - /// - /// Deactivates an `active` organization membership. Emits an [organization_membership.updated](https://workos.com/docs/events/organization-membership) event upon successful deactivation. - /// - /// - Deactivating an `inactive` membership is a no-op and does not emit an event. - /// - Deactivating a `pending` membership returns an error. This membership should be [deleted](https://workos.com/docs/reference/authkit/organization-membership/delete) instead. - /// - /// See the [membership management documentation](https://workos.com/docs/authkit/users-organizations/organizations/membership-management) for additional details. - pub async fn deactivate_organization_membership( - &self, - id: &str, - ) -> Result { - self.deactivate_organization_membership_with_options(id, None) - .await - } - - /// Variant of [`Self::deactivate_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn deactivate_organization_membership_with_options( - &self, - id: &str, - options: Option<&crate::RequestOptions>, - ) -> Result { - let id = crate::client::path_segment(id); - let path = format!("/user_management/organization_memberships/{id}/deactivate"); - let method = http::Method::PUT; - self.client - .request_with_query_opts(method, &path, &(), options) - .await - } - - /// Reactivate an organization membership - /// - /// Reactivates an `inactive` organization membership, retaining the pre-existing role(s). Emits an [organization_membership.updated](https://workos.com/docs/events/organization-membership) event upon successful reactivation. - /// - /// - Reactivating an `active` membership is a no-op and does not emit an event. - /// - Reactivating a `pending` membership returns an error. The user needs to [accept the invitation](https://workos.com/docs/authkit/invitations) instead. - /// - /// See the [membership management documentation](https://workos.com/docs/authkit/users-organizations/organizations/membership-management) for additional details. - pub async fn reactivate_organization_membership( - &self, - id: &str, - ) -> Result { - self.reactivate_organization_membership_with_options(id, None) - .await - } - - /// Variant of [`Self::reactivate_organization_membership`] that accepts per-request [`crate::RequestOptions`]. - pub async fn reactivate_organization_membership_with_options( - &self, - id: &str, - options: Option<&crate::RequestOptions>, - ) -> Result { - let id = crate::client::path_segment(id); - let path = format!("/user_management/organization_memberships/{id}/reactivate"); - let method = http::Method::PUT; - self.client - .request_with_query_opts(method, &path, &(), options) - .await - } - /// Create a redirect URI /// /// Creates a new redirect URI for an environment. diff --git a/src/resources/user_management_organization_membership_groups.rs b/src/resources/user_management_organization_membership_groups.rs deleted file mode 100644 index ef05ffae..00000000 --- a/src/resources/user_management_organization_membership_groups.rs +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -use crate::client::Client; -#[allow(unused_imports)] -use crate::enums::*; -use crate::error::Error; -#[allow(unused_imports)] -use crate::models::*; -use serde::Serialize; - -pub struct UserManagementOrganizationMembershipGroupsApi<'a> { - pub(crate) client: &'a Client, -} - -#[derive(Debug, Clone, Serialize)] -pub struct ListOrganizationMembershipGroupsParams { - /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub before: Option, - /// An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub after: Option, - /// Upper limit on the number of objects to return, between `1` and `100`. - /// - /// Defaults to `10`. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - /// - /// Defaults to `desc`. - #[serde(skip_serializing_if = "Option::is_none")] - pub order: Option, -} - -impl Default for ListOrganizationMembershipGroupsParams { - #[allow(deprecated)] - fn default() -> Self { - Self { - before: Default::default(), - after: Default::default(), - limit: Some(10), - order: Some(PaginationOrder::Desc), - } - } -} - -impl<'a> UserManagementOrganizationMembershipGroupsApi<'a> { - /// List groups - /// - /// Get a list of groups that an organization membership belongs to. - pub async fn list_organization_membership_groups( - &self, - om_id: &str, - params: ListOrganizationMembershipGroupsParams, - ) -> Result { - self.list_organization_membership_groups_with_options(om_id, params, None) - .await - } - - /// Variant of [`Self::list_organization_membership_groups`] that accepts per-request [`crate::RequestOptions`]. - pub async fn list_organization_membership_groups_with_options( - &self, - om_id: &str, - params: ListOrganizationMembershipGroupsParams, - options: Option<&crate::RequestOptions>, - ) -> Result { - let om_id = crate::client::path_segment(om_id); - let path = format!("/user_management/organization_memberships/{om_id}/groups"); - let method = http::Method::GET; - self.client - .request_with_query_opts(method, &path, ¶ms, options) - .await - } - - /// Returns an async [`futures_util::Stream`] that yields every `Group` - /// across all pages, advancing the `after` cursor under the hood. - /// - /// ```ignore - /// use futures_util::TryStreamExt; - /// let all: Vec = self - /// .list_organization_membership_groups_auto_paging(om_id, params) - /// .try_collect() - /// .await?; - /// ``` - pub fn list_organization_membership_groups_auto_paging( - &self, - om_id: impl Into, - params: ListOrganizationMembershipGroupsParams, - ) -> impl futures_util::Stream> + '_ { - let om_id: String = om_id.into(); - crate::pagination::auto_paginate_pages(move |after| { - let om_id = om_id.clone(); - let mut params = params.clone(); - params.after = after; - async move { - let page = self - .list_organization_membership_groups(&om_id, params) - .await?; - Ok((page.data, page.list_metadata.after)) - } - }) - } -} diff --git a/src/resources_api.rs b/src/resources_api.rs index 1e462a1f..545a6b4e 100644 --- a/src/resources_api.rs +++ b/src/resources_api.rs @@ -12,12 +12,13 @@ use crate::resources::FeatureFlagsApi; use crate::resources::GroupsApi; use crate::resources::MultiFactorAuthApi; use crate::resources::OrganizationDomainsApi; +use crate::resources::OrganizationMembershipApi; use crate::resources::OrganizationsApi; use crate::resources::PipesApi; use crate::resources::RadarApi; use crate::resources::SSOApi; use crate::resources::UserManagementApi; -use crate::resources::UserManagementOrganizationMembershipGroupsApi; +use crate::resources::VaultApi; use crate::resources::WebhooksApi; use crate::resources::WidgetsApi; @@ -77,6 +78,11 @@ impl Client { OrganizationDomainsApi { client: self } } + /// Access the `organization_membership` resource. + pub fn organization_membership(&self) -> OrganizationMembershipApi<'_> { + OrganizationMembershipApi { client: self } + } + /// Access the `organizations` resource. pub fn organizations(&self) -> OrganizationsApi<'_> { OrganizationsApi { client: self } @@ -102,11 +108,9 @@ impl Client { UserManagementApi { client: self } } - /// Access the `user_management_organization_membership_groups` resource. - pub fn user_management_organization_membership_groups( - &self, - ) -> UserManagementOrganizationMembershipGroupsApi<'_> { - UserManagementOrganizationMembershipGroupsApi { client: self } + /// Access the `vault` resource. + pub fn vault(&self) -> VaultApi<'_> { + VaultApi { client: self } } /// Access the `webhooks` resource. diff --git a/tests/audit_logs_test.rs b/tests/audit_logs_test.rs index cd058ef8..32798b21 100644 --- a/tests/audit_logs_test.rs +++ b/tests/audit_logs_test.rs @@ -13,7 +13,7 @@ async fn audit_logs_get_organization_audit_logs_retention_round_trip() { .and(path_matcher("/organizations/test_id/audit_logs_retention")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/audit_logs_retention_json.json")), + .set_body_string(include_str!("fixtures/audit_logs_retention.json")), ) .expect(1) .mount(&server) @@ -127,7 +127,7 @@ async fn audit_logs_update_organization_audit_logs_retention_round_trip() { .and(path_matcher("/organizations/test_id/audit_logs_retention")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/audit_logs_retention_json.json")), + .set_body_string(include_str!("fixtures/audit_logs_retention.json")), ) .expect(1) .mount(&server) @@ -618,8 +618,8 @@ async fn audit_logs_create_schema_round_trip() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await; @@ -641,8 +641,8 @@ async fn audit_logs_create_schema_unauthorized() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -670,8 +670,8 @@ async fn audit_logs_create_schema_not_found() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -701,8 +701,8 @@ async fn audit_logs_create_schema_rate_limited() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -731,8 +731,8 @@ async fn audit_logs_create_schema_server_error() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -761,8 +761,8 @@ async fn audit_logs_create_schema_bad_request() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -791,8 +791,8 @@ async fn audit_logs_create_schema_unprocessable() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema.json")) - .expect("parse fixture for AuditLogSchema"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) + .expect("parse fixture for AuditLogSchemaDto"), ), ) .await @@ -993,7 +993,7 @@ async fn audit_logs_create_export_round_trip() { .and(path_matcher("/audit_logs/exports")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/audit_log_export_json.json")), + .set_body_string(include_str!("fixtures/audit_log_export.json")), ) .expect(1) .mount(&server) @@ -1176,7 +1176,7 @@ async fn audit_logs_get_export_round_trip() { .and(path_matcher("/audit_logs/exports/test_id")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/audit_log_export_json.json")), + .set_body_string(include_str!("fixtures/audit_log_export.json")), ) .expect(1) .mount(&server) diff --git a/tests/connect_test.rs b/tests/connect_test.rs index b6d850c3..5c7ee863 100644 --- a/tests/connect_test.rs +++ b/tests/connect_test.rs @@ -1157,7 +1157,7 @@ async fn connect_list_application_client_secrets_round_trip() { let server = MockServer::start().await; Mock::given(method("GET")) .and(path_matcher("/connect/applications/test_id/client_secrets")) - .respond_with(ResponseTemplate::new(200).set_body_string("[{\"object\":\"connect_application_secret\",\"id\":\"secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q\",\"secret_hint\":\"abc123\",\"last_used_at\":\"test_last_used_at\",\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\"}]")) + .respond_with(ResponseTemplate::new(200).set_body_string("[{\"object\":\"connect_application_secret\",\"id\":\"secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q\",\"secret_hint\":\"abc123\",\"last_used_at\":\"2023-01-01T00:00:00.000Z\",\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\"}]")) .expect(1) .mount(&server) .await; diff --git a/tests/fixtures/actor.json b/tests/fixtures/actor.json new file mode 100644 index 00000000..51e70159 --- /dev/null +++ b/tests/fixtures/actor.json @@ -0,0 +1,4 @@ +{ + "id": "key_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "name": "My API Key" +} diff --git a/tests/fixtures/api_key.json b/tests/fixtures/api_key.json index 45fb8791..9c8e9302 100644 --- a/tests/fixtures/api_key.json +++ b/tests/fixtures/api_key.json @@ -13,5 +13,6 @@ "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z" } diff --git a/tests/fixtures/api_key_validation_response.json b/tests/fixtures/api_key_validation_response.json index 2bf1a23a..e5efe8ef 100644 --- a/tests/fixtures/api_key_validation_response.json +++ b/tests/fixtures/api_key_validation_response.json @@ -14,6 +14,7 @@ "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z" } } diff --git a/tests/fixtures/application_credentials_list_item.json b/tests/fixtures/application_credentials_list_item.json index 63fb5c6e..1d9b73fb 100644 --- a/tests/fixtures/application_credentials_list_item.json +++ b/tests/fixtures/application_credentials_list_item.json @@ -2,7 +2,7 @@ "object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", - "last_used_at": "test_last_used_at", + "last_used_at": "2023-01-01T00:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/audit_log_action.json b/tests/fixtures/audit_log_action.json new file mode 100644 index 00000000..91789634 --- /dev/null +++ b/tests/fixtures/audit_log_action.json @@ -0,0 +1,16 @@ +{ + "object": "audit_log_action", + "name": "user.viewed_invoice", + "schema": { + "object": "audit_log_schema", + "version": 1, + "targets": [ + { + "type": "invoice" + } + ], + "created_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/audit_log_export.json b/tests/fixtures/audit_log_export.json new file mode 100644 index 00000000..72ff4fc4 --- /dev/null +++ b/tests/fixtures/audit_log_export.json @@ -0,0 +1,7 @@ +{ + "object": "audit_log_export", + "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", + "state": "ready", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/audit_log_schema_dto.json b/tests/fixtures/audit_log_schema_dto.json new file mode 100644 index 00000000..33248265 --- /dev/null +++ b/tests/fixtures/audit_log_schema_dto.json @@ -0,0 +1,7 @@ +{ + "targets": [ + { + "type": "invoice" + } + ] +} diff --git a/tests/fixtures/audit_logs_retention.json b/tests/fixtures/audit_logs_retention.json new file mode 100644 index 00000000..0720427e --- /dev/null +++ b/tests/fixtures/audit_logs_retention.json @@ -0,0 +1,3 @@ +{ + "retention_period_in_days": 30 +} diff --git a/tests/fixtures/create_data_key_request.json b/tests/fixtures/create_data_key_request.json new file mode 100644 index 00000000..b3a13312 --- /dev/null +++ b/tests/fixtures/create_data_key_request.json @@ -0,0 +1,5 @@ +{ + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + } +} diff --git a/tests/fixtures/create_data_key_response.json b/tests/fixtures/create_data_key_response.json new file mode 100644 index 00000000..f5e6f427 --- /dev/null +++ b/tests/fixtures/create_data_key_response.json @@ -0,0 +1,8 @@ +{ + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "data_key": "DR9idtey9MpMrA1VRFrz30HB1yNgL2PoHZyjAkFeWgg=", + "encrypted_keys": "V09TLkVLTS52MQBiZjUxY2NlYy03OGI0LTUyMDAtYjM4My0zNTczMGU3MWVmNjEBATEBJGJmNjVlMzI2LTQzYTAtNGIyMC04OGM0LTA3ZmYzZGU1NDM0YwF0YmY2NWUzMjYtNDNhMC00YjIwLTg4YzQtMDdmZjNkZTU0MzRj", + "id": "bf51ccec-78b4-5200-b383-35730e71ef61" +} diff --git a/tests/fixtures/create_object_request.json b/tests/fixtures/create_object_request.json new file mode 100644 index 00000000..aa54cb01 --- /dev/null +++ b/tests/fixtures/create_object_request.json @@ -0,0 +1,7 @@ +{ + "key_context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "name": "my-secret", + "value": "s3cr3t-v4lu3" +} diff --git a/tests/fixtures/decrypt_request.json b/tests/fixtures/decrypt_request.json new file mode 100644 index 00000000..150ec560 --- /dev/null +++ b/tests/fixtures/decrypt_request.json @@ -0,0 +1,3 @@ +{ + "keys": "V09TLkVLTS52MQBiZjUxY2NlYy03OGI0LTUyMDAtYjM4My0zNTczMGU3MWVmNjEBATEBJGJmNjVlMzI2LTQzYTAtNGIyMC04OGM0LTA3ZmYzZGU1NDM0YwF0YmY2NWUzMjYtNDNhMC00YjIwLTg4YzQtMDdmZjNkZTU0MzRj" +} diff --git a/tests/fixtures/decrypt_response.json b/tests/fixtures/decrypt_response.json new file mode 100644 index 00000000..aab0d7f8 --- /dev/null +++ b/tests/fixtures/decrypt_response.json @@ -0,0 +1,4 @@ +{ + "data_key": "DR9idtey9MpMrA1VRFrz30HB1yNgL2PoHZyjAkFeWgg=", + "id": "bf51ccec-78b4-5200-b383-35730e71ef61" +} diff --git a/tests/fixtures/delete_object_response.json b/tests/fixtures/delete_object_response.json new file mode 100644 index 00000000..495662db --- /dev/null +++ b/tests/fixtures/delete_object_response.json @@ -0,0 +1,4 @@ +{ + "name": "my-secret", + "success": true +} diff --git a/tests/fixtures/error.json b/tests/fixtures/error.json new file mode 100644 index 00000000..ac5c385b --- /dev/null +++ b/tests/fixtures/error.json @@ -0,0 +1,3 @@ +{ + "error": "Invalid request parameters." +} diff --git a/tests/fixtures/list_metadata.json b/tests/fixtures/list_metadata.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/fixtures/list_metadata.json @@ -0,0 +1 @@ +{} diff --git a/tests/fixtures/new_connect_application_secret.json b/tests/fixtures/new_connect_application_secret.json index 4697b6e4..fcc14503 100644 --- a/tests/fixtures/new_connect_application_secret.json +++ b/tests/fixtures/new_connect_application_secret.json @@ -2,7 +2,7 @@ "object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", - "last_used_at": "test_last_used_at", + "last_used_at": "2023-01-01T00:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "secret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz" diff --git a/tests/fixtures/object.json b/tests/fixtures/object.json new file mode 100644 index 00000000..b1ee22c1 --- /dev/null +++ b/tests/fixtures/object.json @@ -0,0 +1,18 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "metadata": { + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "environment_id": "environment_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "key_id": "bf65e326-43a0-4b20-88c4-07ff3de5434c", + "updated_at": "2024-06-15T10:30:00Z", + "updated_by": { + "id": "key_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "name": "My API Key" + } + }, + "name": "my-secret", + "value": "s3cr3t-v4lu3" +} diff --git a/tests/fixtures/object_list_response.json b/tests/fixtures/object_list_response.json new file mode 100644 index 00000000..12b4eeda --- /dev/null +++ b/tests/fixtures/object_list_response.json @@ -0,0 +1,9 @@ +{ + "data": [ + { + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "name": "my-secret" + } + ], + "list_metadata": {} +} diff --git a/tests/fixtures/object_metadata.json b/tests/fixtures/object_metadata.json new file mode 100644 index 00000000..01e6f761 --- /dev/null +++ b/tests/fixtures/object_metadata.json @@ -0,0 +1,13 @@ +{ + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "environment_id": "environment_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "key_id": "bf65e326-43a0-4b20-88c4-07ff3de5434c", + "updated_at": "2024-06-15T10:30:00Z", + "updated_by": { + "id": "key_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "name": "My API Key" + } +} diff --git a/tests/fixtures/object_summary.json b/tests/fixtures/object_summary.json new file mode 100644 index 00000000..2e0d7349 --- /dev/null +++ b/tests/fixtures/object_summary.json @@ -0,0 +1,4 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "name": "my-secret" +} diff --git a/tests/fixtures/object_version.json b/tests/fixtures/object_version.json new file mode 100644 index 00000000..a85a9c6a --- /dev/null +++ b/tests/fixtures/object_version.json @@ -0,0 +1,7 @@ +{ + "created_at": "2024-06-15T10:30:00Z", + "current_version": true, + "etag": "d41d8cd98f00b204e9800998ecf8427e", + "id": "c3d4e5f6-7890-abcd-ef12-34567890abcd", + "size": 256 +} diff --git a/tests/fixtures/object_without_value.json b/tests/fixtures/object_without_value.json new file mode 100644 index 00000000..4339f009 --- /dev/null +++ b/tests/fixtures/object_without_value.json @@ -0,0 +1,17 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "metadata": { + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "environment_id": "environment_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "key_id": "bf65e326-43a0-4b20-88c4-07ff3de5434c", + "updated_at": "2024-06-15T10:30:00Z", + "updated_by": { + "id": "key_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "name": "My API Key" + } + }, + "name": "my-secret" +} diff --git a/tests/fixtures/organization_api_key.json b/tests/fixtures/organization_api_key.json index 45fb8791..9c8e9302 100644 --- a/tests/fixtures/organization_api_key.json +++ b/tests/fixtures/organization_api_key.json @@ -13,5 +13,6 @@ "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z" } diff --git a/tests/fixtures/organization_api_key_list.json b/tests/fixtures/organization_api_key_list.json index fefdfe2d..73a881e9 100644 --- a/tests/fixtures/organization_api_key_list.json +++ b/tests/fixtures/organization_api_key_list.json @@ -11,6 +11,7 @@ "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": "2023-01-01T00:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z", "permissions": [ "posts:read", "posts:write" diff --git a/tests/fixtures/organization_api_key_with_value.json b/tests/fixtures/organization_api_key_with_value.json index 9e66f5ea..39f21b46 100644 --- a/tests/fixtures/organization_api_key_with_value.json +++ b/tests/fixtures/organization_api_key_with_value.json @@ -14,5 +14,6 @@ ], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", - "value": "sk_abcdefghijklmnop123456" + "value": "sk_abcdefghijklmnop123456", + "expires_at": "2030-01-01T00:00:00.000Z" } diff --git a/tests/fixtures/pipe_connected_account.json b/tests/fixtures/pipe_connected_account.json new file mode 100644 index 00000000..cb474498 --- /dev/null +++ b/tests/fixtures/pipe_connected_account.json @@ -0,0 +1,15 @@ +{ + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/pipes_connected_account_connected.json b/tests/fixtures/pipes_connected_account_connected.json new file mode 100644 index 00000000..f318b9fc --- /dev/null +++ b/tests/fixtures/pipes_connected_account_connected.json @@ -0,0 +1,21 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.connected_account.connected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "object": "event" +} diff --git a/tests/fixtures/pipes_connected_account_disconnected.json b/tests/fixtures/pipes_connected_account_disconnected.json new file mode 100644 index 00000000..f1682426 --- /dev/null +++ b/tests/fixtures/pipes_connected_account_disconnected.json @@ -0,0 +1,21 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.connected_account.disconnected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "object": "event" +} diff --git a/tests/fixtures/pipes_connected_account_reauthorization_needed.json b/tests/fixtures/pipes_connected_account_reauthorization_needed.json new file mode 100644 index 00000000..ee0864c2 --- /dev/null +++ b/tests/fixtures/pipes_connected_account_reauthorization_needed.json @@ -0,0 +1,21 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.connected_account.reauthorization_needed", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "object": "event" +} diff --git a/tests/fixtures/profile.json b/tests/fixtures/profile.json index 61352bff..50e69c4e 100644 --- a/tests/fixtures/profile.json +++ b/tests/fixtures/profile.json @@ -3,7 +3,7 @@ "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", + "connection_type": "OktaSAML", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", diff --git a/tests/fixtures/radar_standalone_assess_request.json b/tests/fixtures/radar_standalone_assess_request.json index 201f3a87..710b5312 100644 --- a/tests/fixtures/radar_standalone_assess_request.json +++ b/tests/fixtures/radar_standalone_assess_request.json @@ -3,5 +3,5 @@ "user_agent": "Mozilla/5.0", "email": "user@example.com", "auth_method": "Password", - "action": "login" + "action": "sign-in" } diff --git a/tests/fixtures/rekey_request.json b/tests/fixtures/rekey_request.json new file mode 100644 index 00000000..61cdafca --- /dev/null +++ b/tests/fixtures/rekey_request.json @@ -0,0 +1,6 @@ +{ + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "encrypted_keys": "V09TLkVLTS52MQBiZjUxY2NlYy03OGI0LTUyMDAtYjM4My0zNTczMGU3MWVmNjEBATEBJGJmNjVlMzI2LTQzYTAtNGIyMC04OGM0LTA3ZmYzZGU1NDM0YwF0YmY2NWUzMjYtNDNhMC00YjIwLTg4YzQtMDdmZjNkZTU0MzRj" +} diff --git a/tests/fixtures/sso_token_response.json b/tests/fixtures/sso_token_response.json index b37f5ad2..261248d5 100644 --- a/tests/fixtures/sso_token_response.json +++ b/tests/fixtures/sso_token_response.json @@ -7,7 +7,7 @@ "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", + "connection_type": "OktaSAML", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", diff --git a/tests/fixtures/update_object_request.json b/tests/fixtures/update_object_request.json new file mode 100644 index 00000000..581af623 --- /dev/null +++ b/tests/fixtures/update_object_request.json @@ -0,0 +1,3 @@ +{ + "value": "upd4t3d-v4lu3" +} diff --git a/tests/fixtures/user_api_key.json b/tests/fixtures/user_api_key.json index fb070955..24a57250 100644 --- a/tests/fixtures/user_api_key.json +++ b/tests/fixtures/user_api_key.json @@ -14,5 +14,6 @@ "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z" } diff --git a/tests/fixtures/user_api_key_list.json b/tests/fixtures/user_api_key_list.json index 65e69bb9..130dcce6 100644 --- a/tests/fixtures/user_api_key_list.json +++ b/tests/fixtures/user_api_key_list.json @@ -12,6 +12,7 @@ "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": "2023-01-01T00:00:00.000Z", + "expires_at": "2023-01-01T00:00:00.000Z", "permissions": [ "posts:read", "posts:write" diff --git a/tests/fixtures/user_api_key_with_value.json b/tests/fixtures/user_api_key_with_value.json index 14fccf8e..a3f82c55 100644 --- a/tests/fixtures/user_api_key_with_value.json +++ b/tests/fixtures/user_api_key_with_value.json @@ -15,5 +15,6 @@ ], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", - "value": "sk_abcdefghijklmnop123456" + "value": "sk_abcdefghijklmnop123456", + "expires_at": "2030-01-01T00:00:00.000Z" } diff --git a/tests/fixtures/version_list_response.json b/tests/fixtures/version_list_response.json new file mode 100644 index 00000000..a378a9c4 --- /dev/null +++ b/tests/fixtures/version_list_response.json @@ -0,0 +1,12 @@ +{ + "data": [ + { + "created_at": "2024-06-15T10:30:00Z", + "current_version": true, + "etag": "d41d8cd98f00b204e9800998ecf8427e", + "id": "c3d4e5f6-7890-abcd-ef12-34567890abcd", + "size": 256 + } + ], + "list_metadata": {} +} diff --git a/tests/fixtures/webhook_endpoint.json b/tests/fixtures/webhook_endpoint.json new file mode 100644 index 00000000..3f37fa02 --- /dev/null +++ b/tests/fixtures/webhook_endpoint.json @@ -0,0 +1,13 @@ +{ + "object": "webhook_endpoint", + "id": "we_0123456789", + "endpoint_url": "https://example.com/webhooks", + "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4", + "status": "enabled", + "events": [ + "user.created", + "dsync.user.created" + ], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/user_management_organization_membership_groups_test.rs b/tests/user_management_organization_membership_groups_test.rs deleted file mode 100644 index d569690b..00000000 --- a/tests/user_management_organization_membership_groups_test.rs +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by oagen. DO NOT EDIT. - -mod common; - -use wiremock::matchers::{method, path as path_matcher}; -use wiremock::{Mock, MockServer, ResponseTemplate}; -use workos::Error; - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_round_trip() - { - let server = MockServer::start().await; - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with( - ResponseTemplate::new(200).set_body_string(include_str!("fixtures/group_list.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await; -} - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_unauthorized() - { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await.expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_not_found() - { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await.expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_rate_limited() - { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await.expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_server_error() - { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await.expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_organization_membership_groups_list_organization_membership_groups_empty_page() - { - let server = MockServer::start().await; - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/groups", - )) - .respond_with(ResponseTemplate::new(200).set_body_string( - "{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}", - )) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let resp = client.user_management_organization_membership_groups().list_organization_membership_groups("test_id", workos::user_management_organization_membership_groups::ListOrganizationMembershipGroupsParams::default()).await.expect("expected success"); - assert!(resp.data.is_empty(), "expected empty data array"); -} diff --git a/tests/user_management_test.rs b/tests/user_management_test.rs index c901a37b..7a6723d4 100644 --- a/tests/user_management_test.rs +++ b/tests/user_management_test.rs @@ -6433,1218 +6433,6 @@ async fn user_management_get_magic_auth_server_error() { assert_eq!(api.status, 500); } -#[tokio::test] -async fn user_management_list_organization_memberships_round_trip() { - let server = MockServer::start().await; - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(ResponseTemplate::new(200).set_body_string("[{\"object\":\"organization_membership\",\"id\":\"om_01HXYZ123456789ABCDEFGHIJ\",\"user_id\":\"user_01E4ZCR3C56J083X43JQXF3JK5\",\"organization_id\":\"org_01EHZNVPK3SFK441A1RGBFSHRT\",\"status\":\"active\",\"directory_managed\":false,\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\",\"role\":{\"slug\":\"admin\"},\"user\":{\"object\":\"user\",\"id\":\"user_01E4ZCR3C56J083X43JQXF3JK5\",\"first_name\":\"Marcelina\",\"last_name\":\"Davis\",\"profile_picture_url\":\"https://workoscdn.com/images/v1/123abc\",\"email\":\"marcelina.davis@example.com\",\"email_verified\":true,\"external_id\":\"f1ffa2b2-c20b-4d39-be5c-212726e11222\",\"last_sign_in_at\":\"2025-06-25T19:07:33.155Z\",\"created_at\":\"2026-01-15T12:00:00.000Z\",\"updated_at\":\"2026-01-15T12:00:00.000Z\"}}]")) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await; -} - -#[tokio::test] -async fn user_management_list_organization_memberships_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_list_organization_memberships_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_list_organization_memberships_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_list_organization_memberships_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_list_organization_memberships_empty_page() { - let server = MockServer::start().await; - Mock::given(method("GET")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(ResponseTemplate::new(200).set_body_string("[]")) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let resp = client - .user_management() - .list_organization_memberships( - workos::user_management::ListOrganizationMembershipsParams::default(), - ) - .await - .expect("expected success"); - assert!(resp.is_empty(), "expected empty data array"); -} - -#[tokio::test] -async fn user_management_create_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with( - ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/organization_membership.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await; -} - -#[tokio::test] -async fn user_management_create_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_create_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_create_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_create_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_create_organization_membership_bad_request() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(400) - .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 400); - assert_eq!(api.code.as_deref(), Some("validation_error")); -} - -#[tokio::test] -async fn user_management_create_organization_membership_unprocessable() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); - Mock::given(method("POST")) - .and(path_matcher("/user_management/organization_memberships")) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .create_organization_membership( - workos::user_management::CreateOrganizationMembershipParams::new( - workos::user_management::CreateOrganizationMembershipParamsBody::new( - "stub_user_id".to_string(), - "stub_organization_id".to_string(), - ), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 422); -} - -#[tokio::test] -async fn user_management_get_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with( - ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/user_organization_membership.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .get_organization_membership("test_id") - .await; -} - -#[tokio::test] -async fn user_management_get_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .get_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_get_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .get_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_get_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .get_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_get_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("GET")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .get_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_update_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with( - ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/user_organization_membership.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await; -} - -#[tokio::test] -async fn user_management_update_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_update_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_update_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_update_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_update_organization_membership_bad_request() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(400) - .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 400); - assert_eq!(api.code.as_deref(), Some("validation_error")); -} - -#[tokio::test] -async fn user_management_update_organization_membership_unprocessable() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .update_organization_membership( - "test_id", - workos::user_management::UpdateOrganizationMembershipParams::new( - workos::user_management::UpdateOrganizationMembershipParamsBody::new(), - ), - ) - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 422); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(ResponseTemplate::new(200).set_body_string("{}")) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .delete_organization_membership("test_id") - .await; -} - -#[tokio::test] -async fn user_management_delete_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_bad_request() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(400) - .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 400); - assert_eq!(api.code.as_deref(), Some("validation_error")); -} - -#[tokio::test] -async fn user_management_delete_organization_membership_unprocessable() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); - Mock::given(method("DELETE")) - .and(path_matcher( - "/user_management/organization_memberships/test_id", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .delete_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 422); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with( - ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/organization_membership.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .deactivate_organization_membership("test_id") - .await; -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_bad_request() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(400) - .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 400); - assert_eq!(api.code.as_deref(), Some("validation_error")); -} - -#[tokio::test] -async fn user_management_deactivate_organization_membership_unprocessable() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/deactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .deactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 422); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_round_trip() { - let server = MockServer::start().await; - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with( - ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/user_organization_membership.json")), - ) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let _ = client - .user_management() - .reactivate_organization_membership("test_id") - .await; -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_unauthorized() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 401); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_not_found() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 404); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_rate_limited() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(429) - .insert_header("retry-after", "1") - .set_body_string("{\"message\":\"Slow down\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 429); - assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_server_error() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 500); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_bad_request() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(400) - .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 400); - assert_eq!(api.code.as_deref(), Some("validation_error")); -} - -#[tokio::test] -async fn user_management_reactivate_organization_membership_unprocessable() { - let server = MockServer::start().await; - let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); - Mock::given(method("PUT")) - .and(path_matcher( - "/user_management/organization_memberships/test_id/reactivate", - )) - .respond_with(template) - .expect(1) - .mount(&server) - .await; - let client = common::test_client(&server).await; - let err = client - .user_management() - .reactivate_organization_membership("test_id") - .await - .expect_err("expected error"); - let api = match &err { - Error::Api(api) => api.as_ref(), - other => panic!("expected Error::Api, got {other:?}"), - }; - assert_eq!(api.status, 422); -} - #[tokio::test] async fn user_management_create_redirect_uri_round_trip() { let server = MockServer::start().await; diff --git a/tests/vault_test.rs b/tests/vault_test.rs new file mode 100644 index 00000000..4c42f4e1 --- /dev/null +++ b/tests/vault_test.rs @@ -0,0 +1,1681 @@ +// Code generated by oagen. DO NOT EDIT. + +mod common; + +use wiremock::matchers::{method, path as path_matcher}; +use wiremock::{Mock, MockServer, ResponseTemplate}; +use workos::Error; + +#[tokio::test] +async fn vault_create_data_key_round_trip() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/create_data_key_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await; +} + +#[tokio::test] +async fn vault_create_data_key_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_create_data_key_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_create_data_key_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_create_data_key_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_create_data_key_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_create_data_key_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/data-key")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_data_key(workos::vault::CreateDataKeyParams::new( + serde_json::from_str(include_str!("fixtures/create_data_key_request.json")) + .expect("parse fixture for CreateDataKeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_create_decrypt_round_trip() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/decrypt_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await; +} + +#[tokio::test] +async fn vault_create_decrypt_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_create_decrypt_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_create_decrypt_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_create_decrypt_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_create_decrypt_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_create_decrypt_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/decrypt")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_decrypt(workos::vault::CreateDecryptParams::new( + serde_json::from_str(include_str!("fixtures/decrypt_request.json")) + .expect("parse fixture for DecryptRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_create_rekey_round_trip() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/create_data_key_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await; +} + +#[tokio::test] +async fn vault_create_rekey_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_create_rekey_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_create_rekey_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_create_rekey_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_create_rekey_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_create_rekey_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/keys/rekey")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_rekey(workos::vault::CreateRekeyParams::new( + serde_json::from_str(include_str!("fixtures/rekey_request.json")) + .expect("parse fixture for RekeyRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_list_kv_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/object_list_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await; +} + +#[tokio::test] +async fn vault_list_kv_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_list_kv_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_list_kv_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_list_kv_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_list_kv_empty_page() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(ResponseTemplate::new(200).set_body_string( + "{\"object\":\"list\",\"data\":[],\"list_metadata\":{\"before\":null,\"after\":null}}", + )) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let resp = client + .vault() + .list_kv(workos::vault::ListKvParams::default()) + .await + .expect("expected success"); + assert!(resp.data.is_empty(), "expected empty data array"); +} + +#[tokio::test] +async fn vault_create_kv_round_trip() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/object_metadata.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await; +} + +#[tokio::test] +async fn vault_create_kv_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_create_kv_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_create_kv_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_create_kv_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_create_kv_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_create_kv_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("POST")) + .and(path_matcher("/vault/v1/kv")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .create_kv(workos::vault::CreateKvParams::new( + serde_json::from_str(include_str!("fixtures/create_object_request.json")) + .expect("parse fixture for CreateObjectRequest"), + )) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_get_name_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/name/test_id")) + .respond_with( + ResponseTemplate::new(200).set_body_string(include_str!("fixtures/object.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client.vault().get_name("test_id").await; +} + +#[tokio::test] +async fn vault_get_name_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/name/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_name("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_get_name_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/name/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_name("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_get_name_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/name/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_name("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_get_name_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/name/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_name("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_get_kv_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with( + ResponseTemplate::new(200).set_body_string(include_str!("fixtures/object.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client.vault().get_kv("test_id").await; +} + +#[tokio::test] +async fn vault_get_kv_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_kv("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_get_kv_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_kv("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_get_kv_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_kv("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_get_kv_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .get_kv("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_update_kv_round_trip() { + let server = MockServer::start().await; + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/object_without_value.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await; +} + +#[tokio::test] +async fn vault_update_kv_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_update_kv_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_update_kv_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_update_kv_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_update_kv_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_update_kv_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("PUT")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .update_kv( + "test_id", + workos::vault::UpdateKvParams::new( + serde_json::from_str(include_str!("fixtures/update_object_request.json")) + .expect("parse fixture for UpdateObjectRequest"), + ), + ) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_delete_kv_round_trip() { + let server = MockServer::start().await; + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/delete_object_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await; +} + +#[tokio::test] +async fn vault_delete_kv_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_delete_kv_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_delete_kv_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_delete_kv_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_delete_kv_bad_request() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(400) + .set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 400); + assert_eq!(api.code.as_deref(), Some("validation_error")); +} + +#[tokio::test] +async fn vault_delete_kv_unprocessable() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}"); + Mock::given(method("DELETE")) + .and(path_matcher("/vault/v1/kv/test_id")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .delete_kv("test_id", workos::vault::DeleteKvParams::default()) + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 422); +} + +#[tokio::test] +async fn vault_list_kv_metadata_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/metadata")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/object_without_value.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client.vault().list_kv_metadata("test_id").await; +} + +#[tokio::test] +async fn vault_list_kv_metadata_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/metadata")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_metadata("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_list_kv_metadata_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/metadata")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_metadata("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_list_kv_metadata_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/metadata")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_metadata("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_list_kv_metadata_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/metadata")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_metadata("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} + +#[tokio::test] +async fn vault_list_kv_versions_round_trip() { + let server = MockServer::start().await; + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/versions")) + .respond_with( + ResponseTemplate::new(200) + .set_body_string(include_str!("fixtures/version_list_response.json")), + ) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let _ = client.vault().list_kv_versions("test_id").await; +} + +#[tokio::test] +async fn vault_list_kv_versions_unauthorized() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/versions")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_versions("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 401); +} + +#[tokio::test] +async fn vault_list_kv_versions_not_found() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/versions")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_versions("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 404); +} + +#[tokio::test] +async fn vault_list_kv_versions_rate_limited() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(429) + .insert_header("retry-after", "1") + .set_body_string("{\"message\":\"Slow down\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/versions")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_versions("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 429); + assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1))); +} + +#[tokio::test] +async fn vault_list_kv_versions_server_error() { + let server = MockServer::start().await; + let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}"); + Mock::given(method("GET")) + .and(path_matcher("/vault/v1/kv/test_id/versions")) + .respond_with(template) + .expect(1) + .mount(&server) + .await; + let client = common::test_client(&server).await; + let err = client + .vault() + .list_kv_versions("test_id") + .await + .expect_err("expected error"); + let api = match &err { + Error::Api(api) => api.as_ref(), + other => panic!("expected Error::Api, got {other:?}"), + }; + assert_eq!(api.status, 500); +} diff --git a/tests/webhooks_test.rs b/tests/webhooks_test.rs index 49d70825..23c13dff 100644 --- a/tests/webhooks_test.rs +++ b/tests/webhooks_test.rs @@ -147,7 +147,7 @@ async fn webhooks_create_webhook_endpoint_round_trip() { .and(path_matcher("/webhook_endpoints")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/webhook_endpoint_json.json")), + .set_body_string(include_str!("fixtures/webhook_endpoint.json")), ) .expect(1) .mount(&server) @@ -330,7 +330,7 @@ async fn webhooks_update_webhook_endpoint_round_trip() { .and(path_matcher("/webhook_endpoints/test_id")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/webhook_endpoint_json.json")), + .set_body_string(include_str!("fixtures/webhook_endpoint.json")), ) .expect(1) .mount(&server) From 75b42d3fc3eb52e11acab5fb2d5d68ed33fa9cde Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:23 +0000 Subject: [PATCH 09/12] chore(generated): add release notes fragment --- ...0eb6fb50f020df713d0233e344a6be05739f59e.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md diff --git a/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md b/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md new file mode 100644 index 00000000..f08a5639 --- /dev/null +++ b/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md @@ -0,0 +1,42 @@ +* [#97](https://github.com/workos/workos-rust/pull/97) feat(generated)!: regenerate from spec (8 changes) + + **⚠️ Breaking** + * **organization_membership:** Split organization membership operations from user_management into dedicated service + * New `OrganizationMembershipApi` service with full CRUD and role management for organization memberships + * Moved from `UserManagementApi`: list/create/get/update/delete/deactivate/reactivate operations + * Breaking change: symbols removed from `user_management` and moved to `organization_membership` (see compat_breaking list) + * Group membership listing now accessible via `organization_membership.list_organization_membership_groups` + * **radar:** Remove deprecated action and control fields from Radar standalone assessment + * Removed deprecated enum variants: `RadarStandaloneAssessRequestAction::Login`, `RadarStandaloneAssessRequestAction::Signup`, `RadarStandaloneResponseControl::CredentialStuffing`, `RadarStandaloneResponseControl::IpSignUpRateLimit` + * Updated action enum values: `SignUp` wire value changed from `'sign up'` to `'sign-up'`, `SignIn` wire value changed from `'sign in'` to `'sign-in'` + * Removed fields from `RadarStandaloneAssessRequest`: `device_fingerprint` and `bot_score` (marked breaking in spec) + + **Features** + * **vault:** Add Vault service with key management and object storage APIs + * New `VaultApi` service providing encryption key management and encrypted object storage + * Key management: `create_data_key`, `create_decrypt`, `create_rekey` for cryptographic operations + * Object storage: `list_kv`, `create_kv`, `get_kv`, `get_name`, `update_kv`, `delete_kv` for managing encrypted key-value pairs + * Metadata operations: `list_kv_metadata` and `list_kv_versions` for inspecting object history without decryption + * **api_key:** Add expires_at field to API key models + * New optional `expires_at` field added to `ApiKey`, `OrganizationApiKey`, `OrganizationApiKeyWithValue`, `UserApiKey`, `UserApiKeyWithValue` models + * Allows setting expiration timestamps on API keys; null means no expiration + * Event data models updated: `ApiKeyCreatedData` and `ApiKeyRevokedData` now include `expires_at` + * New optional parameter `expires_at` in `CreateOrganizationApiKey` and `CreateUserApiKey` request bodies + * **webhooks:** Add Pipes connected account events to webhook subscriptions + * Three new webhook event types for Pipes integrations: `PIPES_CONNECTED_ACCOUNT_CONNECTED`, `PIPES_CONNECTED_ACCOUNT_DISCONNECTED`, `PIPES_CONNECTED_ACCOUNT_REAUTHORIZATION_NEEDED` + * New model types: `PipeConnectedAccount`, `PipesConnectedAccountConnected`, `PipesConnectedAccountDisconnected`, `PipesConnectedAccountReauthorizationNeeded` + * New enum `PipeConnectedAccountState` for connected account status tracking + + **Fixes** + * **generated:** Standardize type names and fix parameter defaults in authorization service + * Added `resource_id`, `resource_external_id`, and `resource_type_slug` filters to `ListRoleAssignmentsParams` for more granular assignment filtering + * Added `role_slug` filter to `ListRoleAssignmentsForResourceParams` and `ListRoleAssignmentsForResourceByExternalIdParams` + * Removed `search` parameter from `ListResourcesParams` (deprecated) + * Renamed audit log types: `AuditLogActionJson` → `AuditLogAction`, `AuditLogExportJson` → `AuditLogExport`, `AuditLogSchema` → `AuditLogSchemaDto`, `AuditLogsRetentionJson` → `AuditLogsRetention` + * Renamed webhook type: `WebhookEndpointJson` → `WebhookEndpoint` and `WebhookEndpointJsonStatus` → `WebhookEndpointStatus` + * **connect:** Fix last_used_at field type in application credentials + * `NewConnectApplicationSecret.last_used_at` type changed from invalid string value to ISO 8601 timestamp + * `ApplicationCredentialsListItem.last_used_at` type changed from invalid string value to ISO 8601 timestamp + * Ensures consistency with API contract for credential timestamp tracking + * **sso:** Expand login_hint documentation to include custom SAML + * Updated `GetAuthorizationUrlParams.login_hint` documentation to indicate support for custom SAML connections in addition to existing OAuth/OpenID Connect/Okta/Entra ID support From f74d49fecdc924235c3677ee0ada92a5be2db0c2 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Tue, 26 May 2026 16:12:44 -0400 Subject: [PATCH 10/12] regenerate --- .oagen-manifest.json | 37 +- src/client.rs | 15 - src/enums/mod.rs | 8 +- .../{radar_action.rs => radar_list_action.rs} | 18 +- .../{radar_type.rs => radar_list_type.rs} | 18 +- src/helpers/mod.rs | 8 +- src/helpers/vault.rs | 481 --------- src/models/action_authentication_denied.rs | 8 +- src/models/action_user_registration_denied.rs | 8 +- src/models/api_key_created.rs | 4 +- src/models/api_key_revoked.rs | 4 +- src/models/audit_log_action.rs | 2 +- ...log_schema_json.rs => audit_log_schema.rs} | 6 +- src/models/audit_log_schema_actor.rs | 3 +- ...tor.rs => audit_log_schema_actor_input.rs} | 5 +- ...chema_dto.rs => audit_log_schema_input.rs} | 6 +- src/models/audit_log_schema_target.rs | 2 +- ...et.rs => audit_log_schema_target_input.rs} | 4 +- ...uthentication_email_verification_failed.rs | 4 +- ...entication_email_verification_succeeded.rs | 4 +- .../authentication_magic_auth_failed.rs | 4 +- .../authentication_magic_auth_succeeded.rs | 4 +- src/models/authentication_mfa_failed.rs | 4 +- src/models/authentication_mfa_succeeded.rs | 4 +- src/models/authentication_oauth_failed.rs | 4 +- src/models/authentication_oauth_succeeded.rs | 4 +- src/models/authentication_passkey_failed.rs | 4 +- .../authentication_passkey_succeeded.rs | 4 +- src/models/authentication_password_failed.rs | 4 +- .../authentication_password_succeeded.rs | 4 +- .../authentication_radar_risk_detected.rs | 4 +- src/models/authentication_sso_failed.rs | 4 +- src/models/authentication_sso_started.rs | 4 +- src/models/authentication_sso_succeeded.rs | 4 +- src/models/authentication_sso_timed_out.rs | 4 +- src/models/connect_application.rs | 12 + src/models/connect_application_m2m.rs | 31 + src/models/connect_application_oauth.rs | 41 + ...connect_application_oauth_redirect_uris.rs | 14 + .../connect_application_redirect_uri.rs | 14 + src/models/connection_activated.rs | 4 +- src/models/connection_deactivated.rs | 4 +- src/models/connection_deleted.rs | 4 +- ...ction_saml_certificate_renewal_required.rs | 4 +- .../connection_saml_certificate_renewed.rs | 4 +- src/models/dsync_activated.rs | 4 +- src/models/dsync_deactivated.rs | 4 +- src/models/dsync_deleted.rs | 4 +- src/models/dsync_group_created.rs | 4 +- src/models/dsync_group_deleted.rs | 4 +- src/models/dsync_group_updated.rs | 4 +- src/models/dsync_group_user_added.rs | 4 +- src/models/dsync_group_user_removed.rs | 4 +- src/models/dsync_user_created.rs | 4 +- src/models/dsync_user_deleted.rs | 4 +- src/models/dsync_user_updated.rs | 4 +- src/models/email_verification_created.rs | 4 +- src/models/{error.rs => error_response.rs} | 2 +- src/models/flag_created.rs | 4 +- src/models/flag_deleted.rs | 4 +- src/models/flag_rule_updated.rs | 4 +- src/models/flag_updated.rs | 4 +- src/models/group_created.rs | 4 +- src/models/group_deleted.rs | 4 +- src/models/group_member_added.rs | 4 +- src/models/group_member_removed.rs | 4 +- src/models/group_updated.rs | 4 +- src/models/invitation_accepted.rs | 4 +- src/models/invitation_created.rs | 4 +- src/models/invitation_resent.rs | 4 +- src/models/invitation_revoked.rs | 4 +- src/models/magic_auth_created.rs | 4 +- src/models/mod.rs | 990 +++++++++--------- src/models/organization_created.rs | 4 +- src/models/organization_deleted.rs | 4 +- src/models/organization_domain_created.rs | 4 +- src/models/organization_domain_deleted.rs | 4 +- src/models/organization_domain_updated.rs | 4 +- ...organization_domain_verification_failed.rs | 4 +- src/models/organization_domain_verified.rs | 4 +- src/models/organization_membership_created.rs | 4 +- src/models/organization_membership_deleted.rs | 4 +- src/models/organization_membership_updated.rs | 4 +- src/models/organization_role_created.rs | 4 +- src/models/organization_role_deleted.rs | 4 +- src/models/organization_role_updated.rs | 4 +- src/models/organization_updated.rs | 4 +- src/models/password_reset_created.rs | 4 +- src/models/password_reset_succeeded.rs | 4 +- src/models/permission_created.rs | 4 +- src/models/permission_deleted.rs | 4 +- src/models/permission_updated.rs | 4 +- .../pipes_connected_account_connected.rs | 4 +- .../pipes_connected_account_disconnected.rs | 4 +- ...onnected_account_reauthorization_needed.rs | 4 +- src/models/role_created.rs | 4 +- src/models/role_deleted.rs | 4 +- src/models/role_updated.rs | 4 +- src/models/session_created.rs | 4 +- src/models/session_revoked.rs | 4 +- src/models/user_created.rs | 4 +- src/models/user_deleted.rs | 4 +- src/models/user_updated.rs | 4 +- src/models/vault_byok_key_deleted.rs | 4 +- .../vault_byok_key_verification_completed.rs | 4 +- src/models/vault_data_created.rs | 4 +- src/models/vault_data_deleted.rs | 4 +- src/models/vault_data_read.rs | 4 +- src/models/vault_data_updated.rs | 4 +- src/models/vault_dek_decrypted.rs | 4 +- src/models/vault_dek_read.rs | 4 +- src/models/vault_kek_created.rs | 4 +- src/models/vault_metadata_read.rs | 4 +- src/models/vault_names_listed.rs | 4 +- src/models/{object.rs => vault_object.rs} | 2 +- src/models/waitlist_user_approved.rs | 4 +- src/models/waitlist_user_created.rs | 4 +- src/models/waitlist_user_denied.rs | 4 +- src/resources/audit_logs.rs | 12 +- src/resources/vault.rs | 8 +- tests/audit_logs_test.rs | 30 +- tests/fixtures/audit_log_schema.json | 5 +- .../audit_log_schema_actor_input.json | 10 + tests/fixtures/audit_log_schema_input.json | 7 + .../audit_log_schema_target_input.json | 3 + .../authorized_connect_application_list.json | 11 +- ...horized_connect_application_list_data.json | 11 +- tests/fixtures/connect_application.json | 11 +- tests/fixtures/connect_application_list.json | 11 +- tests/fixtures/connect_application_m2m.json | 16 + tests/fixtures/connect_application_oauth.json | 23 + ...nnect_application_oauth_redirect_uris.json | 4 + tests/fixtures/error_response.json | 3 + tests/fixtures/event_list.json | 2 +- tests/fixtures/event_schema.json | 2 +- tests/fixtures/vault_object.json | 18 + tests/vault_test.rs | 4 +- 137 files changed, 1025 insertions(+), 1277 deletions(-) rename src/enums/{radar_action.rs => radar_list_action.rs} (85%) rename src/enums/{radar_type.rs => radar_list_type.rs} (89%) delete mode 100644 src/helpers/vault.rs rename src/models/{audit_log_schema_json.rs => audit_log_schema.rs} (86%) rename src/models/{audit_log_schema_json_actor.rs => audit_log_schema_actor_input.rs} (68%) rename src/models/{audit_log_schema_dto.rs => audit_log_schema_input.rs} (80%) rename src/models/{audit_log_schema_json_target.rs => audit_log_schema_target_input.rs} (82%) create mode 100644 src/models/connect_application_m2m.rs create mode 100644 src/models/connect_application_oauth.rs create mode 100644 src/models/connect_application_oauth_redirect_uris.rs create mode 100644 src/models/connect_application_redirect_uri.rs rename src/models/{error.rs => error_response.rs} (92%) rename src/models/{object.rs => vault_object.rs} (95%) create mode 100644 tests/fixtures/audit_log_schema_actor_input.json create mode 100644 tests/fixtures/audit_log_schema_input.json create mode 100644 tests/fixtures/audit_log_schema_target_input.json create mode 100644 tests/fixtures/connect_application_m2m.json create mode 100644 tests/fixtures/connect_application_oauth.json create mode 100644 tests/fixtures/connect_application_oauth_redirect_uris.json create mode 100644 tests/fixtures/error_response.json create mode 100644 tests/fixtures/vault_object.json diff --git a/.oagen-manifest.json b/.oagen-manifest.json index d136636c..51bc7d82 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "rust", - "generatedAt": "2026-05-26T13:22:40.395Z", + "generatedAt": "2026-05-26T20:03:09.060Z", "files": [ "src/enums/audit_log_configuration_log_stream_state.rs", "src/enums/audit_log_configuration_log_stream_type.rs", @@ -88,13 +88,13 @@ "src/enums/pagination_order.rs", "src/enums/pipe_connected_account_state.rs", "src/enums/profile_connection_type.rs", - "src/enums/radar_action.rs", + "src/enums/radar_list_action.rs", + "src/enums/radar_list_type.rs", "src/enums/radar_standalone_assess_request_action.rs", "src/enums/radar_standalone_assess_request_auth_method.rs", "src/enums/radar_standalone_response_blocklist_type.rs", "src/enums/radar_standalone_response_control.rs", "src/enums/radar_standalone_response_verdict.rs", - "src/enums/radar_type.rs", "src/enums/resend_user_invite_options_locale.rs", "src/enums/role_type.rs", "src/enums/session_created_data_auth_method.rs", @@ -157,12 +157,12 @@ "src/models/audit_log_event_target.rs", "src/models/audit_log_export.rs", "src/models/audit_log_export_creation.rs", + "src/models/audit_log_schema.rs", "src/models/audit_log_schema_actor.rs", - "src/models/audit_log_schema_dto.rs", - "src/models/audit_log_schema_json.rs", - "src/models/audit_log_schema_json_actor.rs", - "src/models/audit_log_schema_json_target.rs", + "src/models/audit_log_schema_actor_input.rs", + "src/models/audit_log_schema_input.rs", "src/models/audit_log_schema_target.rs", + "src/models/audit_log_schema_target_input.rs", "src/models/audit_logs_retention.rs", "src/models/authenticate_response.rs", "src/models/authenticate_response_impersonator.rs", @@ -240,6 +240,10 @@ "src/models/connect_application.rs", "src/models/connect_application_list.rs", "src/models/connect_application_list_list_metadata.rs", + "src/models/connect_application_m2m.rs", + "src/models/connect_application_oauth.rs", + "src/models/connect_application_oauth_redirect_uris.rs", + "src/models/connect_application_redirect_uri.rs", "src/models/connected_account.rs", "src/models/connection.rs", "src/models/connection_activated.rs", @@ -344,7 +348,7 @@ "src/models/email_verification_created.rs", "src/models/email_verification_created_data.rs", "src/models/enroll_user_authentication_factor.rs", - "src/models/error.rs", + "src/models/error_response.rs", "src/models/event_context.rs", "src/models/event_context_actor.rs", "src/models/event_context_google_analytics_session.rs", @@ -421,7 +425,6 @@ "src/models/mfa_totp_session_authenticate_request.rs", "src/models/mod.rs", "src/models/new_connect_application_secret.rs", - "src/models/object.rs", "src/models/object_list_response.rs", "src/models/object_metadata.rs", "src/models/object_summary.rs", @@ -602,6 +605,7 @@ "src/models/vault_metadata_read_data.rs", "src/models/vault_names_listed.rs", "src/models/vault_names_listed_data.rs", + "src/models/vault_object.rs", "src/models/verify_email_address.rs", "src/models/verify_email_response.rs", "src/models/version_list_response.rs", @@ -673,12 +677,12 @@ "tests/fixtures/audit_log_event_target.json", "tests/fixtures/audit_log_export.json", "tests/fixtures/audit_log_export_creation.json", + "tests/fixtures/audit_log_schema.json", "tests/fixtures/audit_log_schema_actor.json", - "tests/fixtures/audit_log_schema_dto.json", - "tests/fixtures/audit_log_schema_json.json", - "tests/fixtures/audit_log_schema_json_actor.json", - "tests/fixtures/audit_log_schema_json_target.json", + "tests/fixtures/audit_log_schema_actor_input.json", + "tests/fixtures/audit_log_schema_input.json", "tests/fixtures/audit_log_schema_target.json", + "tests/fixtures/audit_log_schema_target_input.json", "tests/fixtures/audit_logs_retention.json", "tests/fixtures/authenticate_response.json", "tests/fixtures/authenticate_response_impersonator.json", @@ -756,6 +760,9 @@ "tests/fixtures/connect_application.json", "tests/fixtures/connect_application_list.json", "tests/fixtures/connect_application_list_list_metadata.json", + "tests/fixtures/connect_application_m2m.json", + "tests/fixtures/connect_application_oauth.json", + "tests/fixtures/connect_application_oauth_redirect_uris.json", "tests/fixtures/connected_account.json", "tests/fixtures/connection.json", "tests/fixtures/connection_activated.json", @@ -859,7 +866,7 @@ "tests/fixtures/email_verification_created.json", "tests/fixtures/email_verification_created_data.json", "tests/fixtures/enroll_user_authentication_factor.json", - "tests/fixtures/error.json", + "tests/fixtures/error_response.json", "tests/fixtures/event_context.json", "tests/fixtures/event_context_actor.json", "tests/fixtures/event_context_google_analytics_session.json", @@ -935,7 +942,6 @@ "tests/fixtures/magic_auth_created_data.json", "tests/fixtures/mfa_totp_session_authenticate_request.json", "tests/fixtures/new_connect_application_secret.json", - "tests/fixtures/object.json", "tests/fixtures/object_list_response.json", "tests/fixtures/object_metadata.json", "tests/fixtures/object_summary.json", @@ -1116,6 +1122,7 @@ "tests/fixtures/vault_metadata_read_data.json", "tests/fixtures/vault_names_listed.json", "tests/fixtures/vault_names_listed_data.json", + "tests/fixtures/vault_object.json", "tests/fixtures/verify_email_address.json", "tests/fixtures/verify_email_response.json", "tests/fixtures/version_list_response.json", diff --git a/src/client.rs b/src/client.rs index d9a4f770..d429f640 100644 --- a/src/client.rs +++ b/src/client.rs @@ -195,16 +195,6 @@ impl Client { ClientBuilder::default() } - pub(crate) async fn request_with_query( - &self, - method: Method, - path: &str, - params: &P, - ) -> Result { - self.request_with_query_opts(method, path, params, None) - .await - } - pub(crate) async fn request_with_query_opts( &self, method: Method, @@ -311,11 +301,6 @@ impl Client { crate::helpers::PasswordlessApi { client: self } } - /// Vault — KV operations + local AES-GCM crypto. - pub fn vault(&self) -> crate::helpers::VaultApi<'_> { - crate::helpers::VaultApi { client: self } - } - /// AuthKit helpers (URL builder, PKCE flows, device flow). pub fn authkit(&self) -> crate::helpers::AuthKitHelper<'_> { crate::helpers::AuthKitHelper { client: self } diff --git a/src/enums/mod.rs b/src/enums/mod.rs index 42789e21..b06c5cf0 100644 --- a/src/enums/mod.rs +++ b/src/enums/mod.rs @@ -84,13 +84,13 @@ pub mod organization_updated_data_domain_verification_strategy; pub mod pagination_order; pub mod pipe_connected_account_state; pub mod profile_connection_type; -pub mod radar_action; +pub mod radar_list_action; +pub mod radar_list_type; pub mod radar_standalone_assess_request_action; pub mod radar_standalone_assess_request_auth_method; pub mod radar_standalone_response_blocklist_type; pub mod radar_standalone_response_control; pub mod radar_standalone_response_verdict; -pub mod radar_type; pub mod resend_user_invite_options_locale; pub mod role_type; pub mod session_created_data_auth_method; @@ -209,13 +209,13 @@ pub use organization_updated_data_domain_verification_strategy::*; pub use pagination_order::*; pub use pipe_connected_account_state::*; pub use profile_connection_type::*; -pub use radar_action::*; +pub use radar_list_action::*; +pub use radar_list_type::*; pub use radar_standalone_assess_request_action::*; pub use radar_standalone_assess_request_auth_method::*; pub use radar_standalone_response_blocklist_type::*; pub use radar_standalone_response_control::*; pub use radar_standalone_response_verdict::*; -pub use radar_type::*; pub use resend_user_invite_options_locale::*; pub use role_type::*; pub use session_created_data_auth_method::*; diff --git a/src/enums/radar_action.rs b/src/enums/radar_list_action.rs similarity index 85% rename from src/enums/radar_action.rs rename to src/enums/radar_list_action.rs index 434fe30f..6686b319 100644 --- a/src/enums/radar_action.rs +++ b/src/enums/radar_list_action.rs @@ -6,7 +6,7 @@ use std::str::FromStr; #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[non_exhaustive] -pub enum RadarAction { +pub enum RadarListAction { Block, Allow, /// Wire value not recognized by this SDK version. The original @@ -16,7 +16,7 @@ pub enum RadarAction { Unknown(String), } -impl RadarAction { +impl RadarListAction { /// Canonical wire string for this value. For [`Self::Unknown`] returns the /// original wire value as received from the API. #[allow(deprecated)] @@ -29,19 +29,19 @@ impl RadarAction { } } -impl fmt::Display for RadarAction { +impl fmt::Display for RadarListAction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } -impl AsRef for RadarAction { +impl AsRef for RadarListAction { fn as_ref(&self) -> &str { self.as_str() } } -impl FromStr for RadarAction { +impl FromStr for RadarListAction { type Err = std::convert::Infallible; #[allow(deprecated)] fn from_str(s: &str) -> Result { @@ -53,7 +53,7 @@ impl FromStr for RadarAction { } } -impl From for RadarAction { +impl From for RadarListAction { fn from(s: String) -> Self { // Reuse the original `String` allocation in the fallback branch. match Self::from_str(&s) { @@ -63,19 +63,19 @@ impl From for RadarAction { } } -impl From<&str> for RadarAction { +impl From<&str> for RadarListAction { fn from(s: &str) -> Self { Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) } } -impl Serialize for RadarAction { +impl Serialize for RadarListAction { fn serialize(&self, serializer: S) -> Result { serializer.serialize_str(self.as_str()) } } -impl<'de> Deserialize<'de> for RadarAction { +impl<'de> Deserialize<'de> for RadarListAction { fn deserialize>(deserializer: D) -> Result { let s = String::deserialize(deserializer)?; Ok(Self::from(s)) diff --git a/src/enums/radar_type.rs b/src/enums/radar_list_type.rs similarity index 89% rename from src/enums/radar_type.rs rename to src/enums/radar_list_type.rs index 8e6d2110..d2c5a4bb 100644 --- a/src/enums/radar_type.rs +++ b/src/enums/radar_list_type.rs @@ -6,7 +6,7 @@ use std::str::FromStr; #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[non_exhaustive] -pub enum RadarType { +pub enum RadarListType { IpAddress, Domain, Email, @@ -21,7 +21,7 @@ pub enum RadarType { Unknown(String), } -impl RadarType { +impl RadarListType { /// Canonical wire string for this value. For [`Self::Unknown`] returns the /// original wire value as received from the API. #[allow(deprecated)] @@ -39,19 +39,19 @@ impl RadarType { } } -impl fmt::Display for RadarType { +impl fmt::Display for RadarListType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } -impl AsRef for RadarType { +impl AsRef for RadarListType { fn as_ref(&self) -> &str { self.as_str() } } -impl FromStr for RadarType { +impl FromStr for RadarListType { type Err = std::convert::Infallible; #[allow(deprecated)] fn from_str(s: &str) -> Result { @@ -68,7 +68,7 @@ impl FromStr for RadarType { } } -impl From for RadarType { +impl From for RadarListType { fn from(s: String) -> Self { // Reuse the original `String` allocation in the fallback branch. match Self::from_str(&s) { @@ -78,19 +78,19 @@ impl From for RadarType { } } -impl From<&str> for RadarType { +impl From<&str> for RadarListType { fn from(s: &str) -> Self { Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string())) } } -impl Serialize for RadarType { +impl Serialize for RadarListType { fn serialize(&self, serializer: S) -> Result { serializer.serialize_str(self.as_str()) } } -impl<'de> Deserialize<'de> for RadarType { +impl<'de> Deserialize<'de> for RadarListType { fn deserialize>(deserializer: D) -> Result { let s = String::deserialize(deserializer)?; Ok(Self::from(s)) diff --git a/src/helpers/mod.rs b/src/helpers/mod.rs index aaf64f26..36bbcbd7 100644 --- a/src/helpers/mod.rs +++ b/src/helpers/mod.rs @@ -14,7 +14,7 @@ pub mod public_client; pub mod session; pub mod sso_helpers; mod util; -pub mod vault; + pub mod webhook_verification; pub use actions::{ActionSignedResponse, ActionType, ActionVerdict, ActionsHelper}; @@ -36,12 +36,6 @@ pub use sso_helpers::{ SsoAuthorizationUrlParams, SsoHelper, SsoLogoutUrlParams, SsoPkceAuthorizationUrl, SsoPkceCodeExchangeParams, }; -pub use vault::{ - DataKey, DataKeyPair, KeyContext, ObjectMetadata, VaultApi, VaultCreateDataKeyParams, - VaultCreateObjectParams, VaultDecryptDataKeyParams, VaultEncryptResult, VaultListObjectsParams, - VaultListObjectsResponse, VaultObject, VaultObjectDigest, VaultObjectVersion, - VaultUpdateObjectParams, -}; pub use webhook_verification::{ WebhookVerifier, compute_webhook_signature, parse_webhook_signature_header, }; diff --git a/src/helpers/vault.rs b/src/helpers/vault.rs deleted file mode 100644 index 2cfc869e..00000000 --- a/src/helpers/vault.rs +++ /dev/null @@ -1,481 +0,0 @@ -// @oagen-ignore-file -//! Vault — KV operations + local AES-256-GCM crypto (Cat 3, H18). -//! -//! Wire format for `LocalEncrypt` (matches workos-go): -//! `LEB128(len(encryptedKeys)) || encryptedKeys || nonce(12) || ciphertext+tag` -//! the whole thing then base64-encoded. - -use aes_gcm::aead::{Aead, KeyInit, Payload}; -use aes_gcm::{Aes256Gcm, Nonce}; -use base64::Engine; -use base64::engine::general_purpose::STANDARD as B64_STANDARD; -use rand::RngCore; -use serde::{Deserialize, Serialize}; - -use crate::client::Client; -use crate::error::Error; -use crate::helpers::util::percent_encode; - -/// Encryption context for a vault key. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct KeyContext { - #[serde(rename = "type")] - pub kind: String, - pub environment_id: String, -} - -/// Metadata about a vault object. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ObjectMetadata { - pub context: KeyContext, - pub environment_id: String, - pub id: String, - pub key_id: String, - pub updated_at: String, - pub updated_by: String, - pub version_id: String, -} - -/// A vault KV object. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct VaultObject { - pub id: String, - #[serde(skip_serializing_if = "Option::is_none", default)] - pub metadata: Option, - pub name: String, - #[serde(skip_serializing_if = "Option::is_none", default)] - pub value: Option, -} - -/// Summary of a vault object returned by listing. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct VaultObjectDigest { - pub id: String, - pub name: String, - pub environment_id: String, - pub updated_at: String, - #[serde(skip_serializing_if = "Option::is_none", default)] - pub version_id: Option, -} - -/// A specific version of a vault object. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct VaultObjectVersion { - pub version_id: String, - pub updated_at: String, - pub updated_by: String, -} - -/// Plaintext data key + its encrypted counterpart. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DataKeyPair { - pub context: KeyContext, - pub data_key: DataKey, - pub encrypted_keys: String, -} - -/// Plaintext data key (base64-encoded AES key). -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DataKey { - pub key: String, -} - -#[derive(Debug, Clone, Default, Serialize)] -pub struct VaultListObjectsParams { - #[serde(skip_serializing_if = "Option::is_none")] - pub include_values: Option, -} - -#[derive(Debug, Clone, Deserialize)] -pub struct VaultListObjectsResponse { - pub data: Vec, -} - -#[derive(Debug, Clone, Serialize)] -pub struct VaultCreateObjectParams { - pub name: String, - pub value: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub key_context: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, -} - -#[derive(Debug, Clone, Serialize)] -pub struct VaultUpdateObjectParams { - pub value: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub key_context: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, -} - -#[derive(Debug, Clone, Serialize)] -pub struct VaultCreateDataKeyParams { - pub context: KeyContext, -} - -#[derive(Debug, Clone, Serialize)] -pub struct VaultDecryptDataKeyParams { - pub context: KeyContext, - pub encrypted_keys: String, -} - -#[derive(Debug, Clone, Deserialize)] -struct VaultListObjectVersionsResponse { - data: Vec, -} - -/// Result of [`VaultApi::encrypt`]. -#[derive(Debug, Clone)] -pub struct VaultEncryptResult { - pub encrypted_data: String, - pub key_context: KeyContext, - pub encrypted_keys: String, -} - -/// Vault API handle. Obtain via [`crate::Client::vault`]. -pub struct VaultApi<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> VaultApi<'a> { - pub async fn list_objects( - &self, - params: VaultListObjectsParams, - ) -> Result { - self.client - .request_with_query(http::Method::GET, "/vault/v1/kv", ¶ms) - .await - } - - pub async fn create_object( - &self, - params: VaultCreateObjectParams, - ) -> Result { - self.client - .request_json(http::Method::POST, "/vault/v1/kv", ¶ms) - .await - } - - pub async fn read_object(&self, object_id: &str) -> Result { - let path = format!("/vault/v1/kv/{}", percent_encode(object_id)); - self.client - .request_with_query::<(), _>(http::Method::GET, &path, &()) - .await - } - - pub async fn read_object_by_name(&self, name: &str) -> Result { - let path = format!("/vault/v1/kv/name/{}", percent_encode(name)); - self.client - .request_with_query::<(), _>(http::Method::GET, &path, &()) - .await - } - - pub async fn describe_object(&self, object_id: &str) -> Result { - let path = format!("/vault/v1/kv/{}/metadata", percent_encode(object_id)); - self.client - .request_with_query::<(), _>(http::Method::GET, &path, &()) - .await - } - - pub async fn update_object( - &self, - object_id: &str, - params: VaultUpdateObjectParams, - ) -> Result { - let path = format!("/vault/v1/kv/{}", percent_encode(object_id)); - self.client - .request_json(http::Method::PUT, &path, ¶ms) - .await - } - - pub async fn delete_object(&self, object_id: &str) -> Result<(), Error> { - let path = format!("/vault/v1/kv/{}", percent_encode(object_id)); - self.client - .request_empty::<()>(http::Method::DELETE, &path, None) - .await - } - - pub async fn list_object_versions( - &self, - object_id: &str, - ) -> Result, Error> { - let path = format!("/vault/v1/kv/{}/versions", percent_encode(object_id)); - let resp: VaultListObjectVersionsResponse = self - .client - .request_with_query::<(), _>(http::Method::GET, &path, &()) - .await?; - Ok(resp.data) - } - - pub async fn create_data_key( - &self, - params: VaultCreateDataKeyParams, - ) -> Result { - self.client - .request_json(http::Method::POST, "/vault/v1/keys/data-key", ¶ms) - .await - } - - pub async fn decrypt_data_key( - &self, - params: VaultDecryptDataKeyParams, - ) -> Result { - self.client - .request_json(http::Method::POST, "/vault/v1/keys/decrypt", ¶ms) - .await - } - - /// Generates a fresh data key and locally encrypts `data` with AES-256-GCM. - /// - /// # Security - /// - /// `associated_data` is the **only** binding between the ciphertext - /// envelope and the calling application: the encrypted-key prefix - /// (`encrypted_keys` and its LEB128 length) sits **outside** the - /// AEAD-authenticated region. Callers MUST pass an `associated_data` - /// value that is unique per record and unguessable to an attacker - /// with write access to the ciphertext store (e.g., the immutable - /// record id mixed with an environment-scoped secret). A constant or - /// empty value lets an attacker who can replace stored bytes - /// substitute a separately-generated envelope — including their own - /// `encrypted_keys` and ciphertext — under the same context, and - /// `decrypt` will succeed against the attacker-controlled plaintext. - pub async fn encrypt( - &self, - data: &str, - key_context: KeyContext, - associated_data: &str, - ) -> Result { - let pair = self - .create_data_key(VaultCreateDataKeyParams { - context: key_context, - }) - .await?; - let encrypted = local_encrypt(data, &pair, associated_data)?; - Ok(VaultEncryptResult { - encrypted_data: encrypted, - key_context: pair.context, - encrypted_keys: pair.encrypted_keys, - }) - } - - /// Decrypts data previously encrypted with [`Self::encrypt`]. Calls the API to - /// decrypt the data key, then performs local AES-GCM decryption. - /// - /// # Security - /// - /// `associated_data` is the only authenticated binding between this - /// envelope and the calling application — see [`Self::encrypt`] for - /// the full requirement. If the value passed here is not unique per - /// record and unguessable, a successful return does **not** prove - /// that the stored bytes were authored by this application. - pub async fn decrypt( - &self, - encrypted_data: &str, - associated_data: &str, - ) -> Result { - let raw = B64_STANDARD - .decode(encrypted_data) - .map_err(|e| Error::VaultCrypto(format!("base64 decode: {e}")))?; - let (keys_len, bytes_read) = decode_leb128(&raw)?; - let total = bytes_read + keys_len as usize; - if raw.len() < total { - return Err(Error::VaultCrypto( - "encrypted data too short for declared key length".to_string(), - )); - } - let encrypted_keys_bytes = &raw[bytes_read..total]; - let encrypted_keys_b64 = B64_STANDARD.encode(encrypted_keys_bytes); - - let dk = self - .decrypt_data_key(VaultDecryptDataKeyParams { - context: KeyContext { - kind: String::new(), - environment_id: String::new(), - }, - encrypted_keys: encrypted_keys_b64, - }) - .await?; - local_decrypt(encrypted_data, &dk, associated_data) - } -} - -/// Locally encrypt `data` with AES-256-GCM using the data key in `pair`. -pub fn local_encrypt( - data: &str, - pair: &DataKeyPair, - associated_data: &str, -) -> Result { - let raw_key = B64_STANDARD - .decode(&pair.data_key.key) - .map_err(|e| Error::VaultCrypto(format!("decode data key: {e}")))?; - if raw_key.len() != 32 { - return Err(Error::VaultCrypto(format!( - "data key must be 32 bytes; got {}", - raw_key.len() - ))); - } - let encrypted_keys = B64_STANDARD - .decode(&pair.encrypted_keys) - .map_err(|e| Error::VaultCrypto(format!("decode encrypted keys: {e}")))?; - - let cipher = Aes256Gcm::new_from_slice(&raw_key) - .map_err(|e| Error::VaultCrypto(format!("init AES-GCM: {e}")))?; - let mut nonce_bytes = [0u8; 12]; - rand::rng().fill_bytes(&mut nonce_bytes); - let nonce = Nonce::from_slice(&nonce_bytes); - let ciphertext = cipher - .encrypt( - nonce, - Payload { - msg: data.as_bytes(), - aad: associated_data.as_bytes(), - }, - ) - .map_err(|e| Error::VaultCrypto(format!("encrypt: {e}")))?; - - let prefix = encode_leb128(encrypted_keys.len() as u32); - let mut buf = Vec::with_capacity( - prefix.len() + encrypted_keys.len() + nonce_bytes.len() + ciphertext.len(), - ); - buf.extend_from_slice(&prefix); - buf.extend_from_slice(&encrypted_keys); - buf.extend_from_slice(&nonce_bytes); - buf.extend_from_slice(&ciphertext); - Ok(B64_STANDARD.encode(buf)) -} - -/// Locally decrypt `encrypted_data` with AES-256-GCM using `data_key`. -pub fn local_decrypt( - encrypted_data: &str, - data_key: &DataKey, - associated_data: &str, -) -> Result { - let raw = B64_STANDARD - .decode(encrypted_data) - .map_err(|e| Error::VaultCrypto(format!("base64 decode: {e}")))?; - let (keys_len, bytes_read) = decode_leb128(&raw)?; - let offset = bytes_read + keys_len as usize; - if offset + 12 > raw.len() { - return Err(Error::VaultCrypto( - "encrypted data too short: missing nonce".to_string(), - )); - } - let nonce = &raw[offset..offset + 12]; - let ciphertext = &raw[offset + 12..]; - if ciphertext.is_empty() { - return Err(Error::VaultCrypto( - "encrypted data too short: missing ciphertext".to_string(), - )); - } - let raw_key = B64_STANDARD - .decode(&data_key.key) - .map_err(|e| Error::VaultCrypto(format!("decode data key: {e}")))?; - let cipher = Aes256Gcm::new_from_slice(&raw_key) - .map_err(|e| Error::VaultCrypto(format!("init AES-GCM: {e}")))?; - let plaintext = cipher - .decrypt( - Nonce::from_slice(nonce), - Payload { - msg: ciphertext, - aad: associated_data.as_bytes(), - }, - ) - .map_err(|e| Error::VaultCrypto(format!("decrypt: {e}")))?; - String::from_utf8(plaintext).map_err(|e| Error::VaultCrypto(format!("utf-8: {e}"))) -} - -fn encode_leb128(mut n: u32) -> Vec { - if n == 0 { - return vec![0]; - } - let mut out = Vec::new(); - while n > 0 { - let mut b = (n & 0x7f) as u8; - n >>= 7; - if n > 0 { - b |= 0x80; - } - out.push(b); - } - out -} - -fn decode_leb128(buf: &[u8]) -> Result<(u32, usize), Error> { - let mut result: u32 = 0; - let mut shift: u32 = 0; - for (i, &b) in buf.iter().enumerate() { - let chunk = (b & 0x7f) as u32; - // The 5th byte (`shift == 28`) of a u32 LEB128 may only set its - // lowest 4 data bits; bits 4-6 would overflow u32. Without this - // check the shift would silently drop those bits, accepting - // non-canonical encodings. - if shift == 28 && (chunk >> 4) != 0 { - return Err(Error::VaultCrypto( - "LEB128 value too large for uint32".to_string(), - )); - } - result |= chunk << shift; - if b & 0x80 == 0 { - return Ok((result, i + 1)); - } - shift += 7; - if shift >= 35 { - return Err(Error::VaultCrypto( - "LEB128 value too large for uint32".to_string(), - )); - } - } - Err(Error::VaultCrypto( - "unexpected end of LEB128 data".to_string(), - )) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn leb128_round_trip() { - for n in [0u32, 1, 127, 128, 16383, 16384, 1_234_567] { - let bytes = encode_leb128(n); - let (decoded, consumed) = decode_leb128(&bytes).unwrap(); - assert_eq!(decoded, n); - assert_eq!(consumed, bytes.len()); - } - } - - fn make_pair() -> DataKeyPair { - // Use a deterministic 32-byte key for tests. - let key = [9u8; 32]; - DataKeyPair { - context: KeyContext { - kind: "environment".to_string(), - environment_id: "env_1".to_string(), - }, - data_key: DataKey { - key: B64_STANDARD.encode(key), - }, - encrypted_keys: B64_STANDARD.encode([1u8, 2, 3, 4, 5]), - } - } - - #[test] - fn local_encrypt_decrypt_round_trip() { - let pair = make_pair(); - let plaintext = "hello world"; - let aad = "ctx:env_1"; - let sealed = local_encrypt(plaintext, &pair, aad).unwrap(); - let opened = local_decrypt(&sealed, &pair.data_key, aad).unwrap(); - assert_eq!(opened, plaintext); - } - - #[test] - fn local_decrypt_rejects_wrong_aad() { - let pair = make_pair(); - let sealed = local_encrypt("secret", &pair, "ctx-a").unwrap(); - assert!(local_decrypt(&sealed, &pair.data_key, "ctx-b").is_err()); - } -} diff --git a/src/models/action_authentication_denied.rs b/src/models/action_authentication_denied.rs index 424dcc0e..905bde1d 100644 --- a/src/models/action_authentication_denied.rs +++ b/src/models/action_authentication_denied.rs @@ -7,15 +7,15 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ActionAuthenticationDenied { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, /// The event payload. pub data: ActionAuthenticationDeniedData, - #[serde(skip_serializing_if = "Option::is_none", default)] - pub context: Option, /// An ISO 8601 timestamp. pub created_at: String, - /// Distinguishes the Event object. - pub object: String, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub context: Option, } diff --git a/src/models/action_user_registration_denied.rs b/src/models/action_user_registration_denied.rs index 42bf15dd..9aa9a48c 100644 --- a/src/models/action_user_registration_denied.rs +++ b/src/models/action_user_registration_denied.rs @@ -7,15 +7,15 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ActionUserRegistrationDenied { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, /// The event payload. pub data: ActionUserRegistrationDeniedData, - #[serde(skip_serializing_if = "Option::is_none", default)] - pub context: Option, /// An ISO 8601 timestamp. pub created_at: String, - /// Distinguishes the Event object. - pub object: String, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub context: Option, } diff --git a/src/models/api_key_created.rs b/src/models/api_key_created.rs index 4939a0e6..e61f5485 100644 --- a/src/models/api_key_created.rs +++ b/src/models/api_key_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ApiKeyCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ApiKeyCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/api_key_revoked.rs b/src/models/api_key_revoked.rs index 135419b3..755337b3 100644 --- a/src/models/api_key_revoked.rs +++ b/src/models/api_key_revoked.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ApiKeyRevoked { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ApiKeyRevoked { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/audit_log_action.rs b/src/models/audit_log_action.rs index 13756817..a08b549d 100644 --- a/src/models/audit_log_action.rs +++ b/src/models/audit_log_action.rs @@ -12,7 +12,7 @@ pub struct AuditLogAction { /// Identifier of what action was taken. pub name: String, /// The schema associated with the action. - pub schema: AuditLogSchemaJson, + pub schema: AuditLogSchema, /// An ISO 8601 timestamp. pub created_at: String, /// An ISO 8601 timestamp. diff --git a/src/models/audit_log_schema_json.rs b/src/models/audit_log_schema.rs similarity index 86% rename from src/models/audit_log_schema_json.rs rename to src/models/audit_log_schema.rs index 516c0a59..2479db6c 100644 --- a/src/models/audit_log_schema_json.rs +++ b/src/models/audit_log_schema.rs @@ -6,16 +6,16 @@ use super::*; use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogSchemaJson { +pub struct AuditLogSchema { /// Distinguishes the Audit Log Schema object. pub object: String, /// The version of the schema. pub version: i64, /// The metadata schema for the actor. #[serde(skip_serializing_if = "Option::is_none", default)] - pub actor: Option, + pub actor: Option, /// The list of targets for the schema. - pub targets: Vec, + pub targets: Vec, /// Additional data associated with the event or entity. #[serde(skip_serializing_if = "Option::is_none", default)] pub metadata: Option>, diff --git a/src/models/audit_log_schema_actor.rs b/src/models/audit_log_schema_actor.rs index 7fe33809..c80034e2 100644 --- a/src/models/audit_log_schema_actor.rs +++ b/src/models/audit_log_schema_actor.rs @@ -5,8 +5,9 @@ use super::*; #[allow(unused_imports)] use crate::enums::*; use serde::{Deserialize, Serialize}; +/// The metadata schema for the actor. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuditLogSchemaActor { - /// JSON schema for actor metadata. + /// The JSON Schema definition for actor metadata. pub metadata: std::collections::HashMap, } diff --git a/src/models/audit_log_schema_json_actor.rs b/src/models/audit_log_schema_actor_input.rs similarity index 68% rename from src/models/audit_log_schema_json_actor.rs rename to src/models/audit_log_schema_actor_input.rs index 06e3a280..1a5f5bb2 100644 --- a/src/models/audit_log_schema_json_actor.rs +++ b/src/models/audit_log_schema_actor_input.rs @@ -5,9 +5,8 @@ use super::*; #[allow(unused_imports)] use crate::enums::*; use serde::{Deserialize, Serialize}; -/// The metadata schema for the actor. #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogSchemaJsonActor { - /// The JSON Schema definition for actor metadata. +pub struct AuditLogSchemaActorInput { + /// JSON schema for actor metadata. pub metadata: std::collections::HashMap, } diff --git a/src/models/audit_log_schema_dto.rs b/src/models/audit_log_schema_input.rs similarity index 80% rename from src/models/audit_log_schema_dto.rs rename to src/models/audit_log_schema_input.rs index 990fe38f..98c6bacf 100644 --- a/src/models/audit_log_schema_dto.rs +++ b/src/models/audit_log_schema_input.rs @@ -6,12 +6,12 @@ use super::*; use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogSchemaDto { +pub struct AuditLogSchemaInput { /// The metadata schema for the actor. #[serde(skip_serializing_if = "Option::is_none", default)] - pub actor: Option, + pub actor: Option, /// The list of targets for the schema. - pub targets: Vec, + pub targets: Vec, /// Optional JSON schema for event metadata. #[serde(skip_serializing_if = "Option::is_none", default)] pub metadata: Option>, diff --git a/src/models/audit_log_schema_target.rs b/src/models/audit_log_schema_target.rs index a44f33cc..fa9e64bd 100644 --- a/src/models/audit_log_schema_target.rs +++ b/src/models/audit_log_schema_target.rs @@ -10,7 +10,7 @@ pub struct AuditLogSchemaTarget { /// The type of the target resource. #[serde(rename = "type")] pub type_: String, - /// Optional JSON schema for target metadata. + /// Additional data associated with the event or entity. #[serde(skip_serializing_if = "Option::is_none", default)] pub metadata: Option>, } diff --git a/src/models/audit_log_schema_json_target.rs b/src/models/audit_log_schema_target_input.rs similarity index 82% rename from src/models/audit_log_schema_json_target.rs rename to src/models/audit_log_schema_target_input.rs index bc512dba..8e85ef7d 100644 --- a/src/models/audit_log_schema_json_target.rs +++ b/src/models/audit_log_schema_target_input.rs @@ -6,11 +6,11 @@ use super::*; use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct AuditLogSchemaJsonTarget { +pub struct AuditLogSchemaTargetInput { /// The type of the target resource. #[serde(rename = "type")] pub type_: String, - /// Additional data associated with the event or entity. + /// Optional JSON schema for target metadata. #[serde(skip_serializing_if = "Option::is_none", default)] pub metadata: Option>, } diff --git a/src/models/authentication_email_verification_failed.rs b/src/models/authentication_email_verification_failed.rs index c848867d..0ba61223 100644 --- a/src/models/authentication_email_verification_failed.rs +++ b/src/models/authentication_email_verification_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationEmailVerificationFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationEmailVerificationFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_email_verification_succeeded.rs b/src/models/authentication_email_verification_succeeded.rs index 4a965523..6e6e98bf 100644 --- a/src/models/authentication_email_verification_succeeded.rs +++ b/src/models/authentication_email_verification_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationEmailVerificationSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationEmailVerificationSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_magic_auth_failed.rs b/src/models/authentication_magic_auth_failed.rs index 1fde0efd..0d5007cc 100644 --- a/src/models/authentication_magic_auth_failed.rs +++ b/src/models/authentication_magic_auth_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationMagicAuthFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationMagicAuthFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_magic_auth_succeeded.rs b/src/models/authentication_magic_auth_succeeded.rs index bdbc2e23..5a02d406 100644 --- a/src/models/authentication_magic_auth_succeeded.rs +++ b/src/models/authentication_magic_auth_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationMagicAuthSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationMagicAuthSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_mfa_failed.rs b/src/models/authentication_mfa_failed.rs index bc3e1d37..337b7bc4 100644 --- a/src/models/authentication_mfa_failed.rs +++ b/src/models/authentication_mfa_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationMfaFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationMfaFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_mfa_succeeded.rs b/src/models/authentication_mfa_succeeded.rs index 73c4342e..d75abdc7 100644 --- a/src/models/authentication_mfa_succeeded.rs +++ b/src/models/authentication_mfa_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationMfaSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationMfaSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_oauth_failed.rs b/src/models/authentication_oauth_failed.rs index afefc590..df535fed 100644 --- a/src/models/authentication_oauth_failed.rs +++ b/src/models/authentication_oauth_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationOAuthFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationOAuthFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_oauth_succeeded.rs b/src/models/authentication_oauth_succeeded.rs index 3eb4d028..b2f3f4a8 100644 --- a/src/models/authentication_oauth_succeeded.rs +++ b/src/models/authentication_oauth_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationOAuthSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationOAuthSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_passkey_failed.rs b/src/models/authentication_passkey_failed.rs index e22ad18e..41d6e4d2 100644 --- a/src/models/authentication_passkey_failed.rs +++ b/src/models/authentication_passkey_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationPasskeyFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationPasskeyFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_passkey_succeeded.rs b/src/models/authentication_passkey_succeeded.rs index a3943bba..8f6b5c04 100644 --- a/src/models/authentication_passkey_succeeded.rs +++ b/src/models/authentication_passkey_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationPasskeySucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationPasskeySucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_password_failed.rs b/src/models/authentication_password_failed.rs index 677cbce1..227fbd20 100644 --- a/src/models/authentication_password_failed.rs +++ b/src/models/authentication_password_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationPasswordFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationPasswordFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_password_succeeded.rs b/src/models/authentication_password_succeeded.rs index 95d4849b..ba507432 100644 --- a/src/models/authentication_password_succeeded.rs +++ b/src/models/authentication_password_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationPasswordSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationPasswordSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_radar_risk_detected.rs b/src/models/authentication_radar_risk_detected.rs index 6b3a0663..e50e641f 100644 --- a/src/models/authentication_radar_risk_detected.rs +++ b/src/models/authentication_radar_risk_detected.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationRadarRiskDetected { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationRadarRiskDetected { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_sso_failed.rs b/src/models/authentication_sso_failed.rs index e02ebc05..fb34b541 100644 --- a/src/models/authentication_sso_failed.rs +++ b/src/models/authentication_sso_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationSSOFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationSSOFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_sso_started.rs b/src/models/authentication_sso_started.rs index 27f8e31f..06172575 100644 --- a/src/models/authentication_sso_started.rs +++ b/src/models/authentication_sso_started.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationSSOStarted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationSSOStarted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_sso_succeeded.rs b/src/models/authentication_sso_succeeded.rs index 0e0ce430..faff2997 100644 --- a/src/models/authentication_sso_succeeded.rs +++ b/src/models/authentication_sso_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationSSOSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationSSOSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/authentication_sso_timed_out.rs b/src/models/authentication_sso_timed_out.rs index 9b52c6ab..0cf07d5f 100644 --- a/src/models/authentication_sso_timed_out.rs +++ b/src/models/authentication_sso_timed_out.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuthenticationSSOTimedOut { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct AuthenticationSSOTimedOut { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/connect_application.rs b/src/models/connect_application.rs index 3ba4dd13..7006360d 100644 --- a/src/models/connect_application.rs +++ b/src/models/connect_application.rs @@ -27,6 +27,18 @@ pub struct ConnectApplication { /// The type of the application. #[serde(skip_serializing_if = "Option::is_none", default)] pub application_type: Option, + /// The redirect URIs configured for this application. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub redirect_uris: Option>, + /// Whether the application uses PKCE for authorization. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub uses_pkce: Option, + /// Whether the application is a first-party application. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub is_first_party: Option, + /// Whether the application was dynamically registered. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub was_dynamically_registered: Option, /// The ID of the organization the application belongs to. #[serde(skip_serializing_if = "Option::is_none", default)] pub organization_id: Option, diff --git a/src/models/connect_application_m2m.rs b/src/models/connect_application_m2m.rs new file mode 100644 index 00000000..9779128e --- /dev/null +++ b/src/models/connect_application_m2m.rs @@ -0,0 +1,31 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ConnectApplicationM2M { + /// Distinguishes the connect application object. + pub object: String, + /// The unique ID of the connect application. + pub id: String, + /// The client ID of the connect application. + pub client_id: String, + /// A description of the connect application. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub description: Option, + /// The name of the connect application. + pub name: String, + /// The scopes available for this application. + pub scopes: Vec, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, + /// The type of the application. + pub application_type: String, + /// The ID of the organization the application belongs to. + pub organization_id: String, +} diff --git a/src/models/connect_application_oauth.rs b/src/models/connect_application_oauth.rs new file mode 100644 index 00000000..e4dd08c5 --- /dev/null +++ b/src/models/connect_application_oauth.rs @@ -0,0 +1,41 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ConnectApplicationOAuth { + /// Distinguishes the connect application object. + pub object: String, + /// The unique ID of the connect application. + pub id: String, + /// The client ID of the connect application. + pub client_id: String, + /// A description of the connect application. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub description: Option, + /// The name of the connect application. + pub name: String, + /// The scopes available for this application. + pub scopes: Vec, + /// An ISO 8601 timestamp. + pub created_at: String, + /// An ISO 8601 timestamp. + pub updated_at: String, + /// The type of the application. + pub application_type: String, + /// The redirect URIs configured for this application. + pub redirect_uris: Vec, + /// Whether the application uses PKCE for authorization. + pub uses_pkce: bool, + /// Whether the application is a first-party application. + pub is_first_party: bool, + /// Whether the application was dynamically registered. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub was_dynamically_registered: Option, + /// The ID of the organization the application belongs to. + #[serde(skip_serializing_if = "Option::is_none", default)] + pub organization_id: Option, +} diff --git a/src/models/connect_application_oauth_redirect_uris.rs b/src/models/connect_application_oauth_redirect_uris.rs new file mode 100644 index 00000000..87cc56bd --- /dev/null +++ b/src/models/connect_application_oauth_redirect_uris.rs @@ -0,0 +1,14 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ConnectApplicationOAuthRedirectUris { + /// The redirect URI for the application. + pub uri: String, + /// Whether this is the default redirect URI. + pub default: bool, +} diff --git a/src/models/connect_application_redirect_uri.rs b/src/models/connect_application_redirect_uri.rs new file mode 100644 index 00000000..d3cf07bc --- /dev/null +++ b/src/models/connect_application_redirect_uri.rs @@ -0,0 +1,14 @@ +// Code generated by oagen. DO NOT EDIT. + +#[allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::enums::*; +use serde::{Deserialize, Serialize}; +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ConnectApplicationRedirectUri { + /// The redirect URI for the application. + pub uri: String, + /// Whether this is the default redirect URI. + pub default: bool, +} diff --git a/src/models/connection_activated.rs b/src/models/connection_activated.rs index d2ed6fe1..743a90f3 100644 --- a/src/models/connection_activated.rs +++ b/src/models/connection_activated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionActivated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ConnectionActivated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/connection_deactivated.rs b/src/models/connection_deactivated.rs index 991c8959..29e49a2c 100644 --- a/src/models/connection_deactivated.rs +++ b/src/models/connection_deactivated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionDeactivated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ConnectionDeactivated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/connection_deleted.rs b/src/models/connection_deleted.rs index 1ae3f9f1..2ed67a90 100644 --- a/src/models/connection_deleted.rs +++ b/src/models/connection_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ConnectionDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/connection_saml_certificate_renewal_required.rs b/src/models/connection_saml_certificate_renewal_required.rs index ca529d59..6c69b7e7 100644 --- a/src/models/connection_saml_certificate_renewal_required.rs +++ b/src/models/connection_saml_certificate_renewal_required.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionSAMLCertificateRenewalRequired { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ConnectionSAMLCertificateRenewalRequired { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/connection_saml_certificate_renewed.rs b/src/models/connection_saml_certificate_renewed.rs index ee8abfc0..5f19229f 100644 --- a/src/models/connection_saml_certificate_renewed.rs +++ b/src/models/connection_saml_certificate_renewed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionSAMLCertificateRenewed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct ConnectionSAMLCertificateRenewed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_activated.rs b/src/models/dsync_activated.rs index aae793e6..3dc958bb 100644 --- a/src/models/dsync_activated.rs +++ b/src/models/dsync_activated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncActivated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncActivated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_deactivated.rs b/src/models/dsync_deactivated.rs index 70fe694e..3a4838f3 100644 --- a/src/models/dsync_deactivated.rs +++ b/src/models/dsync_deactivated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncDeactivated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncDeactivated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_deleted.rs b/src/models/dsync_deleted.rs index 3f3df597..1ef5ee18 100644 --- a/src/models/dsync_deleted.rs +++ b/src/models/dsync_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_group_created.rs b/src/models/dsync_group_created.rs index ad7de924..a5c41b83 100644 --- a/src/models/dsync_group_created.rs +++ b/src/models/dsync_group_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncGroupCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncGroupCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_group_deleted.rs b/src/models/dsync_group_deleted.rs index e95f88b1..1391341b 100644 --- a/src/models/dsync_group_deleted.rs +++ b/src/models/dsync_group_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncGroupDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncGroupDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_group_updated.rs b/src/models/dsync_group_updated.rs index 720e45ba..cd22e0f8 100644 --- a/src/models/dsync_group_updated.rs +++ b/src/models/dsync_group_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncGroupUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncGroupUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_group_user_added.rs b/src/models/dsync_group_user_added.rs index 87c6f9f6..9a32a43c 100644 --- a/src/models/dsync_group_user_added.rs +++ b/src/models/dsync_group_user_added.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncGroupUserAdded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncGroupUserAdded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_group_user_removed.rs b/src/models/dsync_group_user_removed.rs index de87bc38..4d79376e 100644 --- a/src/models/dsync_group_user_removed.rs +++ b/src/models/dsync_group_user_removed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncGroupUserRemoved { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncGroupUserRemoved { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_user_created.rs b/src/models/dsync_user_created.rs index d19eb3c3..a673a4f9 100644 --- a/src/models/dsync_user_created.rs +++ b/src/models/dsync_user_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncUserCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncUserCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_user_deleted.rs b/src/models/dsync_user_deleted.rs index ec1a30e7..341247cf 100644 --- a/src/models/dsync_user_deleted.rs +++ b/src/models/dsync_user_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncUserDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncUserDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/dsync_user_updated.rs b/src/models/dsync_user_updated.rs index 1eb6c152..b7e030dc 100644 --- a/src/models/dsync_user_updated.rs +++ b/src/models/dsync_user_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DsyncUserUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct DsyncUserUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/email_verification_created.rs b/src/models/email_verification_created.rs index 56e30b87..3a213491 100644 --- a/src/models/email_verification_created.rs +++ b/src/models/email_verification_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct EmailVerificationCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct EmailVerificationCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/error.rs b/src/models/error_response.rs similarity index 92% rename from src/models/error.rs rename to src/models/error_response.rs index 5699b64b..5a5c4590 100644 --- a/src/models/error.rs +++ b/src/models/error_response.rs @@ -7,7 +7,7 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; /// Error response body. #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Error { +pub struct ErrorResponse { /// A human-readable description of the error. pub error: String, } diff --git a/src/models/flag_created.rs b/src/models/flag_created.rs index 85889d77..996151d6 100644 --- a/src/models/flag_created.rs +++ b/src/models/flag_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FlagCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct FlagCreated { pub created_at: String, /// Additional context about the event. pub context: FlagCreatedContext, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/flag_deleted.rs b/src/models/flag_deleted.rs index b45b6243..d9eb60ca 100644 --- a/src/models/flag_deleted.rs +++ b/src/models/flag_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FlagDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct FlagDeleted { pub created_at: String, /// Additional context about the event. pub context: FlagDeletedContext, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/flag_rule_updated.rs b/src/models/flag_rule_updated.rs index 2d0d5e5f..0f859015 100644 --- a/src/models/flag_rule_updated.rs +++ b/src/models/flag_rule_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FlagRuleUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct FlagRuleUpdated { pub created_at: String, /// Additional context about the event. pub context: FlagRuleUpdatedContext, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/flag_updated.rs b/src/models/flag_updated.rs index ed08ddec..1519e064 100644 --- a/src/models/flag_updated.rs +++ b/src/models/flag_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FlagUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct FlagUpdated { pub created_at: String, /// Additional context about the event. pub context: FlagUpdatedContext, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/group_created.rs b/src/models/group_created.rs index 03c15b31..3bf2038c 100644 --- a/src/models/group_created.rs +++ b/src/models/group_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GroupCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct GroupCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/group_deleted.rs b/src/models/group_deleted.rs index f76d0abb..0f7e176f 100644 --- a/src/models/group_deleted.rs +++ b/src/models/group_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GroupDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct GroupDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/group_member_added.rs b/src/models/group_member_added.rs index 6a7e264a..80c0dd0d 100644 --- a/src/models/group_member_added.rs +++ b/src/models/group_member_added.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GroupMemberAdded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct GroupMemberAdded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/group_member_removed.rs b/src/models/group_member_removed.rs index 7ff0ae93..89ec94ef 100644 --- a/src/models/group_member_removed.rs +++ b/src/models/group_member_removed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GroupMemberRemoved { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct GroupMemberRemoved { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/group_updated.rs b/src/models/group_updated.rs index 397634cf..ab497174 100644 --- a/src/models/group_updated.rs +++ b/src/models/group_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GroupUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct GroupUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/invitation_accepted.rs b/src/models/invitation_accepted.rs index 15a07f2a..fc4a0f09 100644 --- a/src/models/invitation_accepted.rs +++ b/src/models/invitation_accepted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InvitationAccepted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct InvitationAccepted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/invitation_created.rs b/src/models/invitation_created.rs index fbbf2a0b..804a7035 100644 --- a/src/models/invitation_created.rs +++ b/src/models/invitation_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InvitationCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct InvitationCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/invitation_resent.rs b/src/models/invitation_resent.rs index 4017fd12..76aeef04 100644 --- a/src/models/invitation_resent.rs +++ b/src/models/invitation_resent.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InvitationResent { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct InvitationResent { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/invitation_revoked.rs b/src/models/invitation_revoked.rs index b68d608e..bd5a7c69 100644 --- a/src/models/invitation_revoked.rs +++ b/src/models/invitation_revoked.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InvitationRevoked { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct InvitationRevoked { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/magic_auth_created.rs b/src/models/magic_auth_created.rs index ce1a7e39..3dc2c057 100644 --- a/src/models/magic_auth_created.rs +++ b/src/models/magic_auth_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct MagicAuthCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct MagicAuthCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/mod.rs b/src/models/mod.rs index e8606360..66e9242a 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -1,490 +1,494 @@ // Code generated by oagen. DO NOT EDIT. -pub mod _unions; -pub mod action_authentication_denied; -pub mod action_authentication_denied_data; -pub mod action_user_registration_denied; -pub mod action_user_registration_denied_data; -pub mod actor; -pub mod add_role_permission; -pub mod api_key; -pub mod api_key_created; -pub mod api_key_created_data; -pub mod api_key_created_data_owner; -pub mod api_key_owner; -pub mod api_key_revoked; -pub mod api_key_revoked_data; -pub mod api_key_revoked_data_owner; -pub mod api_key_validation_response; -pub mod application_credentials_list_item; -pub mod assign_role; -pub mod audit_log_action; -pub mod audit_log_configuration; -pub mod audit_log_configuration_log_stream; -pub mod audit_log_event; -pub mod audit_log_event_actor; -pub mod audit_log_event_context; -pub mod audit_log_event_create_response; -pub mod audit_log_event_ingestion; -pub mod audit_log_event_target; -pub mod audit_log_export; -pub mod audit_log_export_creation; -pub mod audit_log_schema_actor; -pub mod audit_log_schema_dto; -pub mod audit_log_schema_json; -pub mod audit_log_schema_json_actor; -pub mod audit_log_schema_json_target; -pub mod audit_log_schema_target; -pub mod audit_logs_retention; -pub mod authenticate_response; -pub mod authenticate_response_impersonator; -pub mod authenticate_response_oauth_token; -pub mod authentication_challenge; -pub mod authentication_challenge_verify_response; -pub mod authentication_challenges_verify_request; -pub mod authentication_email_verification_failed; -pub mod authentication_email_verification_failed_data; -pub mod authentication_email_verification_failed_data_error; -pub mod authentication_email_verification_succeeded; -pub mod authentication_email_verification_succeeded_data; -pub mod authentication_factor; -pub mod authentication_factor_enrolled; -pub mod authentication_factor_enrolled_sms; -pub mod authentication_factor_enrolled_totp; -pub mod authentication_factor_sms; -pub mod authentication_factor_totp; -pub mod authentication_factors_create_request; -pub mod authentication_magic_auth_failed; -pub mod authentication_magic_auth_failed_data; -pub mod authentication_magic_auth_failed_data_error; -pub mod authentication_magic_auth_succeeded; -pub mod authentication_magic_auth_succeeded_data; -pub mod authentication_mfa_failed; -pub mod authentication_mfa_failed_data; -pub mod authentication_mfa_failed_data_error; -pub mod authentication_mfa_succeeded; -pub mod authentication_mfa_succeeded_data; -pub mod authentication_oauth_failed; -pub mod authentication_oauth_failed_data; -pub mod authentication_oauth_failed_data_error; -pub mod authentication_oauth_succeeded; -pub mod authentication_oauth_succeeded_data; -pub mod authentication_passkey_failed; -pub mod authentication_passkey_failed_data; -pub mod authentication_passkey_failed_data_error; -pub mod authentication_passkey_succeeded; -pub mod authentication_passkey_succeeded_data; -pub mod authentication_password_failed; -pub mod authentication_password_failed_data; -pub mod authentication_password_failed_data_error; -pub mod authentication_password_succeeded; -pub mod authentication_password_succeeded_data; -pub mod authentication_radar_risk_detected; -pub mod authentication_radar_risk_detected_data; -pub mod authentication_sso_failed; -pub mod authentication_sso_failed_data; -pub mod authentication_sso_failed_data_error; -pub mod authentication_sso_failed_data_sso; -pub mod authentication_sso_started; -pub mod authentication_sso_started_data; -pub mod authentication_sso_started_data_sso; -pub mod authentication_sso_succeeded; -pub mod authentication_sso_succeeded_data; -pub mod authentication_sso_succeeded_data_sso; -pub mod authentication_sso_timed_out; -pub mod authentication_sso_timed_out_data; -pub mod authentication_sso_timed_out_data_error; -pub mod authentication_sso_timed_out_data_sso; -pub mod authorization_check; -pub mod authorization_code_session_authenticate_request; -pub mod authorization_permission; -pub mod authorization_permission_list; -pub mod authorization_permission_list_list_metadata; -pub mod authorization_resource; -pub mod authorization_resource_list; -pub mod authorization_resource_list_list_metadata; -pub mod authorized_connect_application_list; -pub mod authorized_connect_application_list_data; -pub mod authorized_connect_application_list_list_metadata; -pub mod challenge_authentication_factor; -pub mod check_authorization; -pub mod confirm_email_change; -pub mod connect_application; -pub mod connect_application_list; -pub mod connect_application_list_list_metadata; -pub mod connected_account; -pub mod connection; -pub mod connection_activated; -pub mod connection_activated_data; -pub mod connection_activated_data_domain; -pub mod connection_deactivated; -pub mod connection_deactivated_data; -pub mod connection_deactivated_data_domain; -pub mod connection_deleted; -pub mod connection_deleted_data; -pub mod connection_domain; -pub mod connection_list; -pub mod connection_list_list_metadata; -pub mod connection_option; -pub mod connection_saml_certificate_renewal_required; -pub mod connection_saml_certificate_renewal_required_data; -pub mod connection_saml_certificate_renewal_required_data_certificate; -pub mod connection_saml_certificate_renewal_required_data_connection; -pub mod connection_saml_certificate_renewed; -pub mod connection_saml_certificate_renewed_data; -pub mod connection_saml_certificate_renewed_data_certificate; -pub mod connection_saml_certificate_renewed_data_connection; -pub mod cors_origin_response; -pub mod create_application_secret; -pub mod create_authorization_permission; -pub mod create_authorization_resource; -pub mod create_cors_origin; -pub mod create_data_key_request; -pub mod create_data_key_response; -pub mod create_group; -pub mod create_group_membership; -pub mod create_m2m_application; -pub mod create_magic_code_and_return; -pub mod create_oauth_application; -pub mod create_object_request; -pub mod create_organization_api_key; -pub mod create_organization_domain; -pub mod create_organization_role; -pub mod create_password_reset; -pub mod create_password_reset_token; -pub mod create_redirect_uri; -pub mod create_role; -pub mod create_user; -pub mod create_user_api_key; -pub mod create_user_invite_options; -pub mod create_user_organization_membership; -pub mod create_webhook_endpoint; -pub mod data_integration_access_token_response; -pub mod data_integration_access_token_response_access_token; -pub mod data_integration_authorize_url_response; -pub mod data_integrations_get_data_integration_authorize_url_request; -pub mod data_integrations_get_user_token_request; -pub mod data_integrations_list_response; -pub mod data_integrations_list_response_data; -pub mod data_integrations_list_response_data_connected_account; -pub mod decrypt_request; -pub mod decrypt_response; -pub mod delete_object_response; -pub mod device_authorization_response; -pub mod device_code_session_authenticate_request; -pub mod directory; -pub mod directory_group; -pub mod directory_group_list; -pub mod directory_group_list_list_metadata; -pub mod directory_list; -pub mod directory_list_list_metadata; -pub mod directory_metadata; -pub mod directory_metadata_user; -pub mod directory_user; -pub mod directory_user_email; -pub mod directory_user_list; -pub mod directory_user_list_list_metadata; -pub mod directory_user_with_groups; -pub mod directory_user_with_groups_email; -pub mod domain_verification_intent_options; -pub mod dsync_activated; -pub mod dsync_activated_data; -pub mod dsync_activated_data_domain; -pub mod dsync_deactivated; -pub mod dsync_deactivated_data; -pub mod dsync_deactivated_data_domain; -pub mod dsync_deleted; -pub mod dsync_deleted_data; -pub mod dsync_group_created; -pub mod dsync_group_deleted; -pub mod dsync_group_updated; -pub mod dsync_group_updated_data; -pub mod dsync_group_user_added; -pub mod dsync_group_user_added_data; -pub mod dsync_group_user_removed; -pub mod dsync_group_user_removed_data; -pub mod dsync_user_created; -pub mod dsync_user_deleted; -pub mod dsync_user_updated; -pub mod dsync_user_updated_data; -pub mod dsync_user_updated_data_email; -pub mod email_change; -pub mod email_change_confirmation; -pub mod email_change_confirmation_user; -pub mod email_verification; -pub mod email_verification_code_session_authenticate_request; -pub mod email_verification_created; -pub mod email_verification_created_data; -pub mod enroll_user_authentication_factor; -pub mod error; -pub mod event_context; -pub mod event_context_actor; -pub mod event_context_google_analytics_session; -pub mod event_list; -pub mod event_list_list_metadata; -pub mod event_schema; -pub mod external_auth_complete_response; -pub mod feature_flag; -pub mod feature_flag_owner; -pub mod flag; -pub mod flag_created; -pub mod flag_created_context; -pub mod flag_created_context_actor; -pub mod flag_created_data; -pub mod flag_created_data_owner; -pub mod flag_deleted; -pub mod flag_deleted_context; -pub mod flag_deleted_context_actor; -pub mod flag_deleted_data; -pub mod flag_deleted_data_owner; -pub mod flag_list; -pub mod flag_list_list_metadata; -pub mod flag_owner; -pub mod flag_rule_updated; -pub mod flag_rule_updated_context; -pub mod flag_rule_updated_context_actor; -pub mod flag_rule_updated_context_configured_target; -pub mod flag_rule_updated_context_configured_target_organization; -pub mod flag_rule_updated_context_configured_target_user; -pub mod flag_rule_updated_context_previous_attribute; -pub mod flag_rule_updated_context_previous_attribute_context; -pub mod flag_rule_updated_context_previous_attribute_context_configured_target; -pub mod flag_rule_updated_context_previous_attribute_context_configured_target_organization; -pub mod flag_rule_updated_context_previous_attribute_context_configured_target_user; -pub mod flag_rule_updated_context_previous_attribute_data; -pub mod flag_rule_updated_data; -pub mod flag_rule_updated_data_owner; -pub mod flag_updated; -pub mod flag_updated_context; -pub mod flag_updated_context_actor; -pub mod flag_updated_context_previous_attribute; -pub mod flag_updated_context_previous_attribute_data; -pub mod flag_updated_data; -pub mod flag_updated_data_owner; -pub mod generate_link; -pub mod group; -pub mod group_created; -pub mod group_deleted; -pub mod group_list; -pub mod group_list_list_metadata; -pub mod group_member_added; -pub mod group_member_added_data; -pub mod group_member_removed; -pub mod group_member_removed_data; -pub mod group_updated; -pub mod intent_options; -pub mod invitation; -pub mod invitation_accepted; -pub mod invitation_accepted_data; -pub mod invitation_created; -pub mod invitation_created_data; -pub mod invitation_resent; -pub mod invitation_resent_data; -pub mod invitation_revoked; -pub mod invitation_revoked_data; -pub mod jwks_response; -pub mod jwks_response_keys; -pub mod jwt_template_response; -pub mod list_metadata; -pub mod magic_auth; -pub mod magic_auth_code_session_authenticate_request; -pub mod magic_auth_created; -pub mod magic_auth_created_data; -pub mod mfa_totp_session_authenticate_request; -pub mod new_connect_application_secret; -pub mod object; -pub mod object_list_response; -pub mod object_metadata; -pub mod object_summary; -pub mod object_version; -pub mod object_without_value; -pub mod organization; -pub mod organization_api_key; -pub mod organization_api_key_list; -pub mod organization_api_key_list_list_metadata; -pub mod organization_api_key_owner; -pub mod organization_api_key_with_value; -pub mod organization_api_key_with_value_owner; -pub mod organization_created; -pub mod organization_created_data; -pub mod organization_created_data_domain; -pub mod organization_deleted; -pub mod organization_deleted_data; -pub mod organization_deleted_data_domain; -pub mod organization_domain; -pub mod organization_domain_created; -pub mod organization_domain_created_data; -pub mod organization_domain_data; -pub mod organization_domain_deleted; -pub mod organization_domain_deleted_data; -pub mod organization_domain_stand_alone; -pub mod organization_domain_updated; -pub mod organization_domain_updated_data; -pub mod organization_domain_verification_failed; -pub mod organization_domain_verification_failed_data; -pub mod organization_domain_verification_failed_data_organization_domain; -pub mod organization_domain_verified; -pub mod organization_domain_verified_data; -pub mod organization_input; -pub mod organization_list; -pub mod organization_list_list_metadata; -pub mod organization_membership; -pub mod organization_membership_created; -pub mod organization_membership_created_data; -pub mod organization_membership_deleted; -pub mod organization_membership_deleted_data; -pub mod organization_membership_updated; -pub mod organization_membership_updated_data; -pub mod organization_role_created; -pub mod organization_role_created_data; -pub mod organization_role_deleted; -pub mod organization_role_deleted_data; -pub mod organization_role_updated; -pub mod organization_role_updated_data; -pub mod organization_selection_session_authenticate_request; -pub mod organization_updated; -pub mod organization_updated_data; -pub mod organization_updated_data_domain; -pub mod password_reset; -pub mod password_reset_created; -pub mod password_reset_created_data; -pub mod password_reset_succeeded; -pub mod password_reset_succeeded_data; -pub mod password_session_authenticate_request; -pub mod permission; -pub mod permission_created; -pub mod permission_created_data; -pub mod permission_deleted; -pub mod permission_deleted_data; -pub mod permission_updated; -pub mod permission_updated_data; -pub mod pipe_connected_account; -pub mod pipes_connected_account_connected; -pub mod pipes_connected_account_disconnected; -pub mod pipes_connected_account_reauthorization_needed; -pub mod portal_link_response; -pub mod profile; -pub mod radar_list_entry_already_present_response; -pub mod radar_standalone_assess_request; -pub mod radar_standalone_delete_radar_list_entry_request; -pub mod radar_standalone_response; -pub mod radar_standalone_update_radar_attempt_request; -pub mod radar_standalone_update_radar_list_request; -pub mod redirect_uri; -pub mod redirect_uri_input; -pub mod refresh_token_session_authenticate_request; -pub mod rekey_request; -pub mod remove_role; -pub mod resend_user_invite_options; -pub mod reset_password_response; -pub mod revoke_session; -pub mod role; -pub mod role_created; -pub mod role_created_data; -pub mod role_deleted; -pub mod role_deleted_data; -pub mod role_list; -pub mod role_updated; -pub mod role_updated_data; -pub mod send_email_change; -pub mod send_verification_email_response; -pub mod session_created; -pub mod session_created_data; -pub mod session_created_data_impersonator; -pub mod session_revoked; -pub mod session_revoked_data; -pub mod session_revoked_data_impersonator; -pub mod set_role_permissions; -pub mod slim_role; -pub mod sso_authorize_url_response; -pub mod sso_device_authorization_request; -pub mod sso_intent_options; -pub mod sso_logout_authorize_request; -pub mod sso_logout_authorize_response; -pub mod sso_token_response; -pub mod sso_token_response_oauth_token; -pub mod token_query; -pub mod update_audit_logs_retention; -pub mod update_authorization_permission; -pub mod update_authorization_resource; -pub mod update_group; -pub mod update_jwt_template; -pub mod update_oauth_application; -pub mod update_object_request; -pub mod update_organization; -pub mod update_organization_role; -pub mod update_role; -pub mod update_user; -pub mod update_user_organization_membership; -pub mod update_webhook_endpoint; -pub mod user; -pub mod user_api_key; -pub mod user_api_key_created_data_owner; -pub mod user_api_key_list; -pub mod user_api_key_list_list_metadata; -pub mod user_api_key_owner; -pub mod user_api_key_revoked_data_owner; -pub mod user_api_key_with_value; -pub mod user_api_key_with_value_owner; -pub mod user_authentication_factor_enroll_response; -pub mod user_authentication_factor_list; -pub mod user_authentication_factor_list_list_metadata; -pub mod user_consent_option; -pub mod user_consent_option_choice; -pub mod user_created; -pub mod user_deleted; -pub mod user_identities_get_item; -pub mod user_invite; -pub mod user_list; -pub mod user_list_list_metadata; -pub mod user_management_login_request; -pub mod user_object; -pub mod user_organization_membership; -pub mod user_organization_membership_base_list; -pub mod user_organization_membership_base_list_data; -pub mod user_organization_membership_base_list_list_metadata; -pub mod user_role_assignment; -pub mod user_role_assignment_list; -pub mod user_role_assignment_list_list_metadata; -pub mod user_role_assignment_resource; -pub mod user_sessions_impersonator; -pub mod user_sessions_list_item; -pub mod user_updated; -pub mod validate_api_key; -pub mod vault_byok_key_deleted; -pub mod vault_byok_key_deleted_data; -pub mod vault_byok_key_verification_completed; -pub mod vault_byok_key_verification_completed_data; -pub mod vault_data_created; -pub mod vault_data_created_data; -pub mod vault_data_deleted; -pub mod vault_data_deleted_data; -pub mod vault_data_read; -pub mod vault_data_read_data; -pub mod vault_data_updated; -pub mod vault_data_updated_data; -pub mod vault_dek_decrypted; -pub mod vault_dek_decrypted_data; -pub mod vault_dek_read; -pub mod vault_dek_read_data; -pub mod vault_kek_created; -pub mod vault_kek_created_data; -pub mod vault_metadata_read; -pub mod vault_metadata_read_data; -pub mod vault_names_listed; -pub mod vault_names_listed_data; -pub mod verify_email_address; -pub mod verify_email_response; -pub mod version_list_response; -pub mod waitlist_user; -pub mod waitlist_user_approved; -pub mod waitlist_user_created; -pub mod waitlist_user_denied; -pub mod webhook_endpoint; -pub mod webhook_endpoint_list; -pub mod webhook_endpoint_list_list_metadata; -pub mod widget_session_token; -pub mod widget_session_token_response; +mod _unions; +mod action_authentication_denied; +mod action_authentication_denied_data; +mod action_user_registration_denied; +mod action_user_registration_denied_data; +mod actor; +mod add_role_permission; +mod api_key; +mod api_key_created; +mod api_key_created_data; +mod api_key_created_data_owner; +mod api_key_owner; +mod api_key_revoked; +mod api_key_revoked_data; +mod api_key_revoked_data_owner; +mod api_key_validation_response; +mod application_credentials_list_item; +mod assign_role; +mod audit_log_action; +mod audit_log_configuration; +mod audit_log_configuration_log_stream; +mod audit_log_event; +mod audit_log_event_actor; +mod audit_log_event_context; +mod audit_log_event_create_response; +mod audit_log_event_ingestion; +mod audit_log_event_target; +mod audit_log_export; +mod audit_log_export_creation; +mod audit_log_schema; +mod audit_log_schema_actor; +mod audit_log_schema_actor_input; +mod audit_log_schema_input; +mod audit_log_schema_target; +mod audit_log_schema_target_input; +mod audit_logs_retention; +mod authenticate_response; +mod authenticate_response_impersonator; +mod authenticate_response_oauth_token; +mod authentication_challenge; +mod authentication_challenge_verify_response; +mod authentication_challenges_verify_request; +mod authentication_email_verification_failed; +mod authentication_email_verification_failed_data; +mod authentication_email_verification_failed_data_error; +mod authentication_email_verification_succeeded; +mod authentication_email_verification_succeeded_data; +mod authentication_factor; +mod authentication_factor_enrolled; +mod authentication_factor_enrolled_sms; +mod authentication_factor_enrolled_totp; +mod authentication_factor_sms; +mod authentication_factor_totp; +mod authentication_factors_create_request; +mod authentication_magic_auth_failed; +mod authentication_magic_auth_failed_data; +mod authentication_magic_auth_failed_data_error; +mod authentication_magic_auth_succeeded; +mod authentication_magic_auth_succeeded_data; +mod authentication_mfa_failed; +mod authentication_mfa_failed_data; +mod authentication_mfa_failed_data_error; +mod authentication_mfa_succeeded; +mod authentication_mfa_succeeded_data; +mod authentication_oauth_failed; +mod authentication_oauth_failed_data; +mod authentication_oauth_failed_data_error; +mod authentication_oauth_succeeded; +mod authentication_oauth_succeeded_data; +mod authentication_passkey_failed; +mod authentication_passkey_failed_data; +mod authentication_passkey_failed_data_error; +mod authentication_passkey_succeeded; +mod authentication_passkey_succeeded_data; +mod authentication_password_failed; +mod authentication_password_failed_data; +mod authentication_password_failed_data_error; +mod authentication_password_succeeded; +mod authentication_password_succeeded_data; +mod authentication_radar_risk_detected; +mod authentication_radar_risk_detected_data; +mod authentication_sso_failed; +mod authentication_sso_failed_data; +mod authentication_sso_failed_data_error; +mod authentication_sso_failed_data_sso; +mod authentication_sso_started; +mod authentication_sso_started_data; +mod authentication_sso_started_data_sso; +mod authentication_sso_succeeded; +mod authentication_sso_succeeded_data; +mod authentication_sso_succeeded_data_sso; +mod authentication_sso_timed_out; +mod authentication_sso_timed_out_data; +mod authentication_sso_timed_out_data_error; +mod authentication_sso_timed_out_data_sso; +mod authorization_check; +mod authorization_code_session_authenticate_request; +mod authorization_permission; +mod authorization_permission_list; +mod authorization_permission_list_list_metadata; +mod authorization_resource; +mod authorization_resource_list; +mod authorization_resource_list_list_metadata; +mod authorized_connect_application_list; +mod authorized_connect_application_list_data; +mod authorized_connect_application_list_list_metadata; +mod challenge_authentication_factor; +mod check_authorization; +mod confirm_email_change; +mod connect_application; +mod connect_application_list; +mod connect_application_list_list_metadata; +mod connect_application_m2m; +mod connect_application_oauth; +mod connect_application_oauth_redirect_uris; +mod connect_application_redirect_uri; +mod connected_account; +mod connection; +mod connection_activated; +mod connection_activated_data; +mod connection_activated_data_domain; +mod connection_deactivated; +mod connection_deactivated_data; +mod connection_deactivated_data_domain; +mod connection_deleted; +mod connection_deleted_data; +mod connection_domain; +mod connection_list; +mod connection_list_list_metadata; +mod connection_option; +mod connection_saml_certificate_renewal_required; +mod connection_saml_certificate_renewal_required_data; +mod connection_saml_certificate_renewal_required_data_certificate; +mod connection_saml_certificate_renewal_required_data_connection; +mod connection_saml_certificate_renewed; +mod connection_saml_certificate_renewed_data; +mod connection_saml_certificate_renewed_data_certificate; +mod connection_saml_certificate_renewed_data_connection; +mod cors_origin_response; +mod create_application_secret; +mod create_authorization_permission; +mod create_authorization_resource; +mod create_cors_origin; +mod create_data_key_request; +mod create_data_key_response; +mod create_group; +mod create_group_membership; +mod create_m2m_application; +mod create_magic_code_and_return; +mod create_oauth_application; +mod create_object_request; +mod create_organization_api_key; +mod create_organization_domain; +mod create_organization_role; +mod create_password_reset; +mod create_password_reset_token; +mod create_redirect_uri; +mod create_role; +mod create_user; +mod create_user_api_key; +mod create_user_invite_options; +mod create_user_organization_membership; +mod create_webhook_endpoint; +mod data_integration_access_token_response; +mod data_integration_access_token_response_access_token; +mod data_integration_authorize_url_response; +mod data_integrations_get_data_integration_authorize_url_request; +mod data_integrations_get_user_token_request; +mod data_integrations_list_response; +mod data_integrations_list_response_data; +mod data_integrations_list_response_data_connected_account; +mod decrypt_request; +mod decrypt_response; +mod delete_object_response; +mod device_authorization_response; +mod device_code_session_authenticate_request; +mod directory; +mod directory_group; +mod directory_group_list; +mod directory_group_list_list_metadata; +mod directory_list; +mod directory_list_list_metadata; +mod directory_metadata; +mod directory_metadata_user; +mod directory_user; +mod directory_user_email; +mod directory_user_list; +mod directory_user_list_list_metadata; +mod directory_user_with_groups; +mod directory_user_with_groups_email; +mod domain_verification_intent_options; +mod dsync_activated; +mod dsync_activated_data; +mod dsync_activated_data_domain; +mod dsync_deactivated; +mod dsync_deactivated_data; +mod dsync_deactivated_data_domain; +mod dsync_deleted; +mod dsync_deleted_data; +mod dsync_group_created; +mod dsync_group_deleted; +mod dsync_group_updated; +mod dsync_group_updated_data; +mod dsync_group_user_added; +mod dsync_group_user_added_data; +mod dsync_group_user_removed; +mod dsync_group_user_removed_data; +mod dsync_user_created; +mod dsync_user_deleted; +mod dsync_user_updated; +mod dsync_user_updated_data; +mod dsync_user_updated_data_email; +mod email_change; +mod email_change_confirmation; +mod email_change_confirmation_user; +mod email_verification; +mod email_verification_code_session_authenticate_request; +mod email_verification_created; +mod email_verification_created_data; +mod enroll_user_authentication_factor; +mod error_response; +mod event_context; +mod event_context_actor; +mod event_context_google_analytics_session; +mod event_list; +mod event_list_list_metadata; +mod event_schema; +mod external_auth_complete_response; +mod feature_flag; +mod feature_flag_owner; +mod flag; +mod flag_created; +mod flag_created_context; +mod flag_created_context_actor; +mod flag_created_data; +mod flag_created_data_owner; +mod flag_deleted; +mod flag_deleted_context; +mod flag_deleted_context_actor; +mod flag_deleted_data; +mod flag_deleted_data_owner; +mod flag_list; +mod flag_list_list_metadata; +mod flag_owner; +mod flag_rule_updated; +mod flag_rule_updated_context; +mod flag_rule_updated_context_actor; +mod flag_rule_updated_context_configured_target; +mod flag_rule_updated_context_configured_target_organization; +mod flag_rule_updated_context_configured_target_user; +mod flag_rule_updated_context_previous_attribute; +mod flag_rule_updated_context_previous_attribute_context; +mod flag_rule_updated_context_previous_attribute_context_configured_target; +mod flag_rule_updated_context_previous_attribute_context_configured_target_organization; +mod flag_rule_updated_context_previous_attribute_context_configured_target_user; +mod flag_rule_updated_context_previous_attribute_data; +mod flag_rule_updated_data; +mod flag_rule_updated_data_owner; +mod flag_updated; +mod flag_updated_context; +mod flag_updated_context_actor; +mod flag_updated_context_previous_attribute; +mod flag_updated_context_previous_attribute_data; +mod flag_updated_data; +mod flag_updated_data_owner; +mod generate_link; +mod group; +mod group_created; +mod group_deleted; +mod group_list; +mod group_list_list_metadata; +mod group_member_added; +mod group_member_added_data; +mod group_member_removed; +mod group_member_removed_data; +mod group_updated; +mod intent_options; +mod invitation; +mod invitation_accepted; +mod invitation_accepted_data; +mod invitation_created; +mod invitation_created_data; +mod invitation_resent; +mod invitation_resent_data; +mod invitation_revoked; +mod invitation_revoked_data; +mod jwks_response; +mod jwks_response_keys; +mod jwt_template_response; +mod list_metadata; +mod magic_auth; +mod magic_auth_code_session_authenticate_request; +mod magic_auth_created; +mod magic_auth_created_data; +mod mfa_totp_session_authenticate_request; +mod new_connect_application_secret; +mod object_list_response; +mod object_metadata; +mod object_summary; +mod object_version; +mod object_without_value; +mod organization; +mod organization_api_key; +mod organization_api_key_list; +mod organization_api_key_list_list_metadata; +mod organization_api_key_owner; +mod organization_api_key_with_value; +mod organization_api_key_with_value_owner; +mod organization_created; +mod organization_created_data; +mod organization_created_data_domain; +mod organization_deleted; +mod organization_deleted_data; +mod organization_deleted_data_domain; +mod organization_domain; +mod organization_domain_created; +mod organization_domain_created_data; +mod organization_domain_data; +mod organization_domain_deleted; +mod organization_domain_deleted_data; +mod organization_domain_stand_alone; +mod organization_domain_updated; +mod organization_domain_updated_data; +mod organization_domain_verification_failed; +mod organization_domain_verification_failed_data; +mod organization_domain_verification_failed_data_organization_domain; +mod organization_domain_verified; +mod organization_domain_verified_data; +mod organization_input; +mod organization_list; +mod organization_list_list_metadata; +mod organization_membership; +mod organization_membership_created; +mod organization_membership_created_data; +mod organization_membership_deleted; +mod organization_membership_deleted_data; +mod organization_membership_updated; +mod organization_membership_updated_data; +mod organization_role_created; +mod organization_role_created_data; +mod organization_role_deleted; +mod organization_role_deleted_data; +mod organization_role_updated; +mod organization_role_updated_data; +mod organization_selection_session_authenticate_request; +mod organization_updated; +mod organization_updated_data; +mod organization_updated_data_domain; +mod password_reset; +mod password_reset_created; +mod password_reset_created_data; +mod password_reset_succeeded; +mod password_reset_succeeded_data; +mod password_session_authenticate_request; +mod permission; +mod permission_created; +mod permission_created_data; +mod permission_deleted; +mod permission_deleted_data; +mod permission_updated; +mod permission_updated_data; +mod pipe_connected_account; +mod pipes_connected_account_connected; +mod pipes_connected_account_disconnected; +mod pipes_connected_account_reauthorization_needed; +mod portal_link_response; +mod profile; +mod radar_list_entry_already_present_response; +mod radar_standalone_assess_request; +mod radar_standalone_delete_radar_list_entry_request; +mod radar_standalone_response; +mod radar_standalone_update_radar_attempt_request; +mod radar_standalone_update_radar_list_request; +mod redirect_uri; +mod redirect_uri_input; +mod refresh_token_session_authenticate_request; +mod rekey_request; +mod remove_role; +mod resend_user_invite_options; +mod reset_password_response; +mod revoke_session; +mod role; +mod role_created; +mod role_created_data; +mod role_deleted; +mod role_deleted_data; +mod role_list; +mod role_updated; +mod role_updated_data; +mod send_email_change; +mod send_verification_email_response; +mod session_created; +mod session_created_data; +mod session_created_data_impersonator; +mod session_revoked; +mod session_revoked_data; +mod session_revoked_data_impersonator; +mod set_role_permissions; +mod slim_role; +mod sso_authorize_url_response; +mod sso_device_authorization_request; +mod sso_intent_options; +mod sso_logout_authorize_request; +mod sso_logout_authorize_response; +mod sso_token_response; +mod sso_token_response_oauth_token; +mod token_query; +mod update_audit_logs_retention; +mod update_authorization_permission; +mod update_authorization_resource; +mod update_group; +mod update_jwt_template; +mod update_oauth_application; +mod update_object_request; +mod update_organization; +mod update_organization_role; +mod update_role; +mod update_user; +mod update_user_organization_membership; +mod update_webhook_endpoint; +mod user; +mod user_api_key; +mod user_api_key_created_data_owner; +mod user_api_key_list; +mod user_api_key_list_list_metadata; +mod user_api_key_owner; +mod user_api_key_revoked_data_owner; +mod user_api_key_with_value; +mod user_api_key_with_value_owner; +mod user_authentication_factor_enroll_response; +mod user_authentication_factor_list; +mod user_authentication_factor_list_list_metadata; +mod user_consent_option; +mod user_consent_option_choice; +mod user_created; +mod user_deleted; +mod user_identities_get_item; +mod user_invite; +mod user_list; +mod user_list_list_metadata; +mod user_management_login_request; +mod user_object; +mod user_organization_membership; +mod user_organization_membership_base_list; +mod user_organization_membership_base_list_data; +mod user_organization_membership_base_list_list_metadata; +mod user_role_assignment; +mod user_role_assignment_list; +mod user_role_assignment_list_list_metadata; +mod user_role_assignment_resource; +mod user_sessions_impersonator; +mod user_sessions_list_item; +mod user_updated; +mod validate_api_key; +mod vault_byok_key_deleted; +mod vault_byok_key_deleted_data; +mod vault_byok_key_verification_completed; +mod vault_byok_key_verification_completed_data; +mod vault_data_created; +mod vault_data_created_data; +mod vault_data_deleted; +mod vault_data_deleted_data; +mod vault_data_read; +mod vault_data_read_data; +mod vault_data_updated; +mod vault_data_updated_data; +mod vault_dek_decrypted; +mod vault_dek_decrypted_data; +mod vault_dek_read; +mod vault_dek_read_data; +mod vault_kek_created; +mod vault_kek_created_data; +mod vault_metadata_read; +mod vault_metadata_read_data; +mod vault_names_listed; +mod vault_names_listed_data; +mod vault_object; +mod verify_email_address; +mod verify_email_response; +mod version_list_response; +mod waitlist_user; +mod waitlist_user_approved; +mod waitlist_user_created; +mod waitlist_user_denied; +mod webhook_endpoint; +mod webhook_endpoint_list; +mod webhook_endpoint_list_list_metadata; +mod widget_session_token; +mod widget_session_token_response; pub use _unions::*; pub use action_authentication_denied::*; @@ -515,12 +519,12 @@ pub use audit_log_event_ingestion::*; pub use audit_log_event_target::*; pub use audit_log_export::*; pub use audit_log_export_creation::*; +pub use audit_log_schema::*; pub use audit_log_schema_actor::*; -pub use audit_log_schema_dto::*; -pub use audit_log_schema_json::*; -pub use audit_log_schema_json_actor::*; -pub use audit_log_schema_json_target::*; +pub use audit_log_schema_actor_input::*; +pub use audit_log_schema_input::*; pub use audit_log_schema_target::*; +pub use audit_log_schema_target_input::*; pub use audit_logs_retention::*; pub use authenticate_response::*; pub use authenticate_response_impersonator::*; @@ -598,6 +602,10 @@ pub use confirm_email_change::*; pub use connect_application::*; pub use connect_application_list::*; pub use connect_application_list_list_metadata::*; +pub use connect_application_m2m::*; +pub use connect_application_oauth::*; +pub use connect_application_oauth_redirect_uris::*; +pub use connect_application_redirect_uri::*; pub use connected_account::*; pub use connection::*; pub use connection_activated::*; @@ -702,7 +710,7 @@ pub use email_verification_code_session_authenticate_request::*; pub use email_verification_created::*; pub use email_verification_created_data::*; pub use enroll_user_authentication_factor::*; -pub use error::*; +pub use error_response::*; pub use event_context::*; pub use event_context_actor::*; pub use event_context_google_analytics_session::*; @@ -778,7 +786,6 @@ pub use magic_auth_created::*; pub use magic_auth_created_data::*; pub use mfa_totp_session_authenticate_request::*; pub use new_connect_application_secret::*; -pub use object::*; pub use object_list_response::*; pub use object_metadata::*; pub use object_summary::*; @@ -959,6 +966,7 @@ pub use vault_metadata_read::*; pub use vault_metadata_read_data::*; pub use vault_names_listed::*; pub use vault_names_listed_data::*; +pub use vault_object::*; pub use verify_email_address::*; pub use verify_email_response::*; pub use version_list_response::*; diff --git a/src/models/organization_created.rs b/src/models/organization_created.rs index 23c431f8..a2124caf 100644 --- a/src/models/organization_created.rs +++ b/src/models/organization_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_deleted.rs b/src/models/organization_deleted.rs index bfd2dc04..20da2802 100644 --- a/src/models/organization_deleted.rs +++ b/src/models/organization_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_domain_created.rs b/src/models/organization_domain_created.rs index 7f754645..beb99d64 100644 --- a/src/models/organization_domain_created.rs +++ b/src/models/organization_domain_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDomainCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDomainCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_domain_deleted.rs b/src/models/organization_domain_deleted.rs index d5e0c81c..98b6dde3 100644 --- a/src/models/organization_domain_deleted.rs +++ b/src/models/organization_domain_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDomainDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDomainDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_domain_updated.rs b/src/models/organization_domain_updated.rs index 78e8bde6..1d405a6d 100644 --- a/src/models/organization_domain_updated.rs +++ b/src/models/organization_domain_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDomainUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDomainUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_domain_verification_failed.rs b/src/models/organization_domain_verification_failed.rs index 96df61ad..80bf6b11 100644 --- a/src/models/organization_domain_verification_failed.rs +++ b/src/models/organization_domain_verification_failed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDomainVerificationFailed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDomainVerificationFailed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_domain_verified.rs b/src/models/organization_domain_verified.rs index c70dbbe9..dc038111 100644 --- a/src/models/organization_domain_verified.rs +++ b/src/models/organization_domain_verified.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationDomainVerified { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationDomainVerified { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_membership_created.rs b/src/models/organization_membership_created.rs index 1cc336ff..a302cf7e 100644 --- a/src/models/organization_membership_created.rs +++ b/src/models/organization_membership_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationMembershipCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationMembershipCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_membership_deleted.rs b/src/models/organization_membership_deleted.rs index 6f688870..02347421 100644 --- a/src/models/organization_membership_deleted.rs +++ b/src/models/organization_membership_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationMembershipDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationMembershipDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_membership_updated.rs b/src/models/organization_membership_updated.rs index fedd09fe..3e46ec26 100644 --- a/src/models/organization_membership_updated.rs +++ b/src/models/organization_membership_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationMembershipUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationMembershipUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_role_created.rs b/src/models/organization_role_created.rs index 9fbd921f..321610e2 100644 --- a/src/models/organization_role_created.rs +++ b/src/models/organization_role_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationRoleCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationRoleCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_role_deleted.rs b/src/models/organization_role_deleted.rs index 271cb965..2fb70ff8 100644 --- a/src/models/organization_role_deleted.rs +++ b/src/models/organization_role_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationRoleDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationRoleDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_role_updated.rs b/src/models/organization_role_updated.rs index f4914ff5..5fea0120 100644 --- a/src/models/organization_role_updated.rs +++ b/src/models/organization_role_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationRoleUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationRoleUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/organization_updated.rs b/src/models/organization_updated.rs index a525a70c..afb65b70 100644 --- a/src/models/organization_updated.rs +++ b/src/models/organization_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OrganizationUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct OrganizationUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/password_reset_created.rs b/src/models/password_reset_created.rs index e79214aa..10c35557 100644 --- a/src/models/password_reset_created.rs +++ b/src/models/password_reset_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PasswordResetCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PasswordResetCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/password_reset_succeeded.rs b/src/models/password_reset_succeeded.rs index e345b8cc..f1cc47ce 100644 --- a/src/models/password_reset_succeeded.rs +++ b/src/models/password_reset_succeeded.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PasswordResetSucceeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PasswordResetSucceeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/permission_created.rs b/src/models/permission_created.rs index d520ddd6..57d0f799 100644 --- a/src/models/permission_created.rs +++ b/src/models/permission_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PermissionCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PermissionCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/permission_deleted.rs b/src/models/permission_deleted.rs index f4207a2c..74fbdb4b 100644 --- a/src/models/permission_deleted.rs +++ b/src/models/permission_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PermissionDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PermissionDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/permission_updated.rs b/src/models/permission_updated.rs index 30f84671..e9691d10 100644 --- a/src/models/permission_updated.rs +++ b/src/models/permission_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PermissionUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PermissionUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/pipes_connected_account_connected.rs b/src/models/pipes_connected_account_connected.rs index 5bb2a7f0..4a3cecf6 100644 --- a/src/models/pipes_connected_account_connected.rs +++ b/src/models/pipes_connected_account_connected.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PipesConnectedAccountConnected { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PipesConnectedAccountConnected { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/pipes_connected_account_disconnected.rs b/src/models/pipes_connected_account_disconnected.rs index ddcaf432..b9ac4c25 100644 --- a/src/models/pipes_connected_account_disconnected.rs +++ b/src/models/pipes_connected_account_disconnected.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PipesConnectedAccountDisconnected { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PipesConnectedAccountDisconnected { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/pipes_connected_account_reauthorization_needed.rs b/src/models/pipes_connected_account_reauthorization_needed.rs index baabf54c..74ab1505 100644 --- a/src/models/pipes_connected_account_reauthorization_needed.rs +++ b/src/models/pipes_connected_account_reauthorization_needed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PipesConnectedAccountReauthorizationNeeded { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct PipesConnectedAccountReauthorizationNeeded { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/role_created.rs b/src/models/role_created.rs index 7e2045a2..40a436c5 100644 --- a/src/models/role_created.rs +++ b/src/models/role_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoleCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct RoleCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/role_deleted.rs b/src/models/role_deleted.rs index 54dc281a..b1f69ecd 100644 --- a/src/models/role_deleted.rs +++ b/src/models/role_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoleDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct RoleDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/role_updated.rs b/src/models/role_updated.rs index 870743f1..a2122288 100644 --- a/src/models/role_updated.rs +++ b/src/models/role_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoleUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct RoleUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/session_created.rs b/src/models/session_created.rs index 4be410cc..07c2b866 100644 --- a/src/models/session_created.rs +++ b/src/models/session_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SessionCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct SessionCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/session_revoked.rs b/src/models/session_revoked.rs index 929b0acd..eed0cb1a 100644 --- a/src/models/session_revoked.rs +++ b/src/models/session_revoked.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SessionRevoked { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct SessionRevoked { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/user_created.rs b/src/models/user_created.rs index 489a0b35..2064a166 100644 --- a/src/models/user_created.rs +++ b/src/models/user_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct UserCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/user_deleted.rs b/src/models/user_deleted.rs index 76e5b1e3..e14dc55d 100644 --- a/src/models/user_deleted.rs +++ b/src/models/user_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct UserDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/user_updated.rs b/src/models/user_updated.rs index 0388bb61..7e37a4bf 100644 --- a/src/models/user_updated.rs +++ b/src/models/user_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct UserUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_byok_key_deleted.rs b/src/models/vault_byok_key_deleted.rs index 46112608..55155d5f 100644 --- a/src/models/vault_byok_key_deleted.rs +++ b/src/models/vault_byok_key_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultByokKeyDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultByokKeyDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_byok_key_verification_completed.rs b/src/models/vault_byok_key_verification_completed.rs index 0070bb54..ccf9ae95 100644 --- a/src/models/vault_byok_key_verification_completed.rs +++ b/src/models/vault_byok_key_verification_completed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultByokKeyVerificationCompleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultByokKeyVerificationCompleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_data_created.rs b/src/models/vault_data_created.rs index a37b8c59..6f073b7e 100644 --- a/src/models/vault_data_created.rs +++ b/src/models/vault_data_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDataCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDataCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_data_deleted.rs b/src/models/vault_data_deleted.rs index 7a7196ff..28f9b8f2 100644 --- a/src/models/vault_data_deleted.rs +++ b/src/models/vault_data_deleted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDataDeleted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDataDeleted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_data_read.rs b/src/models/vault_data_read.rs index 6580023c..3e6f04e1 100644 --- a/src/models/vault_data_read.rs +++ b/src/models/vault_data_read.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDataRead { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDataRead { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_data_updated.rs b/src/models/vault_data_updated.rs index d8bd2e67..dfd825b4 100644 --- a/src/models/vault_data_updated.rs +++ b/src/models/vault_data_updated.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDataUpdated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDataUpdated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_dek_decrypted.rs b/src/models/vault_dek_decrypted.rs index c2726d1e..b5888646 100644 --- a/src/models/vault_dek_decrypted.rs +++ b/src/models/vault_dek_decrypted.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDekDecrypted { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDekDecrypted { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_dek_read.rs b/src/models/vault_dek_read.rs index 454ef2f0..a4d4dee5 100644 --- a/src/models/vault_dek_read.rs +++ b/src/models/vault_dek_read.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultDekRead { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultDekRead { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_kek_created.rs b/src/models/vault_kek_created.rs index f375298f..5ec9f3b5 100644 --- a/src/models/vault_kek_created.rs +++ b/src/models/vault_kek_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultKekCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultKekCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_metadata_read.rs b/src/models/vault_metadata_read.rs index b031016f..b00c24d4 100644 --- a/src/models/vault_metadata_read.rs +++ b/src/models/vault_metadata_read.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultMetadataRead { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultMetadataRead { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/vault_names_listed.rs b/src/models/vault_names_listed.rs index df18ce30..f14e0ebd 100644 --- a/src/models/vault_names_listed.rs +++ b/src/models/vault_names_listed.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VaultNamesListed { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct VaultNamesListed { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/object.rs b/src/models/vault_object.rs similarity index 95% rename from src/models/object.rs rename to src/models/vault_object.rs index caf2e17e..048a446f 100644 --- a/src/models/object.rs +++ b/src/models/vault_object.rs @@ -7,7 +7,7 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; /// An encrypted object with its decrypted value and metadata. #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Object { +pub struct VaultObject { /// Unique identifier of the object. pub id: String, pub metadata: ObjectMetadata, diff --git a/src/models/waitlist_user_approved.rs b/src/models/waitlist_user_approved.rs index 509fa04e..0ca9b18e 100644 --- a/src/models/waitlist_user_approved.rs +++ b/src/models/waitlist_user_approved.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WaitlistUserApproved { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct WaitlistUserApproved { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/waitlist_user_created.rs b/src/models/waitlist_user_created.rs index c25cc1da..802e11e8 100644 --- a/src/models/waitlist_user_created.rs +++ b/src/models/waitlist_user_created.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WaitlistUserCreated { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct WaitlistUserCreated { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/models/waitlist_user_denied.rs b/src/models/waitlist_user_denied.rs index 6979d1d2..99df464c 100644 --- a/src/models/waitlist_user_denied.rs +++ b/src/models/waitlist_user_denied.rs @@ -7,6 +7,8 @@ use crate::enums::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WaitlistUserDenied { + /// Distinguishes the Event object. + pub object: String, /// Unique identifier for the event. pub id: String, pub event: String, @@ -16,6 +18,4 @@ pub struct WaitlistUserDenied { pub created_at: String, #[serde(skip_serializing_if = "Option::is_none", default)] pub context: Option, - /// Distinguishes the Event object. - pub object: String, } diff --git a/src/resources/audit_logs.rs b/src/resources/audit_logs.rs index a012ac96..645a3c4a 100644 --- a/src/resources/audit_logs.rs +++ b/src/resources/audit_logs.rs @@ -99,13 +99,13 @@ pub struct CreateSchemaParams { /// /// Required. #[serde(skip)] - pub body: AuditLogSchemaDto, + pub body: AuditLogSchemaInput, } impl CreateSchemaParams { /// Construct a new `CreateSchemaParams` with the required fields set. #[allow(deprecated)] - pub fn new(body: AuditLogSchemaDto) -> Self { + pub fn new(body: AuditLogSchemaInput) -> Self { Self { body } } } @@ -227,7 +227,7 @@ impl<'a> AuditLogsApi<'a> { &self, action_name: &str, params: ListActionSchemasParams, - ) -> Result, Error> { + ) -> Result, Error> { self.list_action_schemas_with_options(action_name, params, None) .await } @@ -238,7 +238,7 @@ impl<'a> AuditLogsApi<'a> { action_name: &str, params: ListActionSchemasParams, options: Option<&crate::RequestOptions>, - ) -> Result, Error> { + ) -> Result, Error> { let action_name = crate::client::path_segment(action_name); let path = format!("/audit_logs/actions/{action_name}/schemas"); let method = http::Method::GET; @@ -254,7 +254,7 @@ impl<'a> AuditLogsApi<'a> { &self, action_name: &str, params: CreateSchemaParams, - ) -> Result { + ) -> Result { self.create_schema_with_options(action_name, params, None) .await } @@ -265,7 +265,7 @@ impl<'a> AuditLogsApi<'a> { action_name: &str, params: CreateSchemaParams, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let action_name = crate::client::path_segment(action_name); let path = format!("/audit_logs/actions/{action_name}/schemas"); let method = http::Method::POST; diff --git a/src/resources/vault.rs b/src/resources/vault.rs index 752071ba..891545d3 100644 --- a/src/resources/vault.rs +++ b/src/resources/vault.rs @@ -280,7 +280,7 @@ impl<'a> VaultApi<'a> { /// Read an object by name /// /// Fetch and decrypt an object by its unique name. - pub async fn get_name(&self, name: &str) -> Result { + pub async fn get_name(&self, name: &str) -> Result { self.get_name_with_options(name, None).await } @@ -289,7 +289,7 @@ impl<'a> VaultApi<'a> { &self, name: &str, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let name = crate::client::path_segment(name); let path = format!("/vault/v1/kv/name/{name}"); let method = http::Method::GET; @@ -301,7 +301,7 @@ impl<'a> VaultApi<'a> { /// Read an object by ID /// /// Fetch and decrypt an object by its unique identifier. - pub async fn get_kv(&self, id: &str) -> Result { + pub async fn get_kv(&self, id: &str) -> Result { self.get_kv_with_options(id, None).await } @@ -310,7 +310,7 @@ impl<'a> VaultApi<'a> { &self, id: &str, options: Option<&crate::RequestOptions>, - ) -> Result { + ) -> Result { let id = crate::client::path_segment(id); let path = format!("/vault/v1/kv/{id}"); let method = http::Method::GET; diff --git a/tests/audit_logs_test.rs b/tests/audit_logs_test.rs index 32798b21..b5de16e4 100644 --- a/tests/audit_logs_test.rs +++ b/tests/audit_logs_test.rs @@ -607,7 +607,7 @@ async fn audit_logs_create_schema_round_trip() { .and(path_matcher("/audit_logs/actions/test_id/schemas")) .respond_with( ResponseTemplate::new(200) - .set_body_string(include_str!("fixtures/audit_log_schema_json.json")), + .set_body_string(include_str!("fixtures/audit_log_schema.json")), ) .expect(1) .mount(&server) @@ -618,8 +618,8 @@ async fn audit_logs_create_schema_round_trip() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await; @@ -641,8 +641,8 @@ async fn audit_logs_create_schema_unauthorized() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await @@ -670,8 +670,8 @@ async fn audit_logs_create_schema_not_found() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await @@ -701,8 +701,8 @@ async fn audit_logs_create_schema_rate_limited() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await @@ -731,8 +731,8 @@ async fn audit_logs_create_schema_server_error() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await @@ -761,8 +761,8 @@ async fn audit_logs_create_schema_bad_request() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await @@ -791,8 +791,8 @@ async fn audit_logs_create_schema_unprocessable() { .create_schema( "test_id", workos::audit_logs::CreateSchemaParams::new( - serde_json::from_str(include_str!("fixtures/audit_log_schema_dto.json")) - .expect("parse fixture for AuditLogSchemaDto"), + serde_json::from_str(include_str!("fixtures/audit_log_schema_input.json")) + .expect("parse fixture for AuditLogSchemaInput"), ), ) .await diff --git a/tests/fixtures/audit_log_schema.json b/tests/fixtures/audit_log_schema.json index 33248265..3b8af7ac 100644 --- a/tests/fixtures/audit_log_schema.json +++ b/tests/fixtures/audit_log_schema.json @@ -3,5 +3,8 @@ { "type": "invoice" } - ] + ], + "object": "audit_log_schema", + "version": 1, + "created_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/audit_log_schema_actor_input.json b/tests/fixtures/audit_log_schema_actor_input.json new file mode 100644 index 00000000..cea87599 --- /dev/null +++ b/tests/fixtures/audit_log_schema_actor_input.json @@ -0,0 +1,10 @@ +{ + "metadata": { + "type": "object", + "properties": { + "role": { + "type": "string" + } + } + } +} diff --git a/tests/fixtures/audit_log_schema_input.json b/tests/fixtures/audit_log_schema_input.json new file mode 100644 index 00000000..33248265 --- /dev/null +++ b/tests/fixtures/audit_log_schema_input.json @@ -0,0 +1,7 @@ +{ + "targets": [ + { + "type": "invoice" + } + ] +} diff --git a/tests/fixtures/audit_log_schema_target_input.json b/tests/fixtures/audit_log_schema_target_input.json new file mode 100644 index 00000000..fc07a7c1 --- /dev/null +++ b/tests/fixtures/audit_log_schema_target_input.json @@ -0,0 +1,3 @@ +{ + "type": "invoice" +} diff --git a/tests/fixtures/authorized_connect_application_list.json b/tests/fixtures/authorized_connect_application_list.json index 602c056e..39f1e93a 100644 --- a/tests/fixtures/authorized_connect_application_list.json +++ b/tests/fixtures/authorized_connect_application_list.json @@ -21,7 +21,16 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "oauth", + "redirect_uris": [ + { + "uri": "https://example.com/callback", + "default": true + } + ], + "uses_pkce": true, + "is_first_party": false } } ], diff --git a/tests/fixtures/authorized_connect_application_list_data.json b/tests/fixtures/authorized_connect_application_list_data.json index bd3d6a14..459d6e74 100644 --- a/tests/fixtures/authorized_connect_application_list_data.json +++ b/tests/fixtures/authorized_connect_application_list_data.json @@ -18,6 +18,15 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "oauth", + "redirect_uris": [ + { + "uri": "https://example.com/callback", + "default": true + } + ], + "uses_pkce": true, + "is_first_party": false } } diff --git a/tests/fixtures/connect_application.json b/tests/fixtures/connect_application.json index 94258b88..80857de6 100644 --- a/tests/fixtures/connect_application.json +++ b/tests/fixtures/connect_application.json @@ -10,5 +10,14 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "oauth", + "redirect_uris": [ + { + "uri": "https://example.com/callback", + "default": true + } + ], + "uses_pkce": true, + "is_first_party": false } diff --git a/tests/fixtures/connect_application_list.json b/tests/fixtures/connect_application_list.json index 76d53a90..7cd5f87b 100644 --- a/tests/fixtures/connect_application_list.json +++ b/tests/fixtures/connect_application_list.json @@ -13,7 +13,16 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z" + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "oauth", + "redirect_uris": [ + { + "uri": "https://example.com/callback", + "default": true + } + ], + "uses_pkce": true, + "is_first_party": false } ], "list_metadata": { diff --git a/tests/fixtures/connect_application_m2m.json b/tests/fixtures/connect_application_m2m.json new file mode 100644 index 00000000..2498d8fd --- /dev/null +++ b/tests/fixtures/connect_application_m2m.json @@ -0,0 +1,16 @@ +{ + "object": "connect_application", + "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", + "client_id": "client_01HXYZ123456789ABCDEFGHIJ", + "description": "An application for managing user access", + "name": "My Application", + "scopes": [ + "openid", + "profile", + "email" + ], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "m2m", + "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT" +} diff --git a/tests/fixtures/connect_application_oauth.json b/tests/fixtures/connect_application_oauth.json new file mode 100644 index 00000000..80857de6 --- /dev/null +++ b/tests/fixtures/connect_application_oauth.json @@ -0,0 +1,23 @@ +{ + "object": "connect_application", + "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", + "client_id": "client_01HXYZ123456789ABCDEFGHIJ", + "description": "An application for managing user access", + "name": "My Application", + "scopes": [ + "openid", + "profile", + "email" + ], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + "application_type": "oauth", + "redirect_uris": [ + { + "uri": "https://example.com/callback", + "default": true + } + ], + "uses_pkce": true, + "is_first_party": false +} diff --git a/tests/fixtures/connect_application_oauth_redirect_uris.json b/tests/fixtures/connect_application_oauth_redirect_uris.json new file mode 100644 index 00000000..083dd6a8 --- /dev/null +++ b/tests/fixtures/connect_application_oauth_redirect_uris.json @@ -0,0 +1,4 @@ +{ + "uri": "https://example.com/callback", + "default": true +} diff --git a/tests/fixtures/error_response.json b/tests/fixtures/error_response.json new file mode 100644 index 00000000..ac5c385b --- /dev/null +++ b/tests/fixtures/error_response.json @@ -0,0 +1,3 @@ +{ + "error": "Invalid request parameters." +} diff --git a/tests/fixtures/event_list.json b/tests/fixtures/event_list.json index 5c0d5214..0fee8edb 100644 --- a/tests/fixtures/event_list.json +++ b/tests/fixtures/event_list.json @@ -4,7 +4,7 @@ { "object": "event", "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.created", + "event": "action.authentication.denied", "data": { "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", diff --git a/tests/fixtures/event_schema.json b/tests/fixtures/event_schema.json index 82ad881e..368191b7 100644 --- a/tests/fixtures/event_schema.json +++ b/tests/fixtures/event_schema.json @@ -1,7 +1,7 @@ { "object": "event", "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.created", + "event": "action.authentication.denied", "data": { "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", diff --git a/tests/fixtures/vault_object.json b/tests/fixtures/vault_object.json new file mode 100644 index 00000000..b1ee22c1 --- /dev/null +++ b/tests/fixtures/vault_object.json @@ -0,0 +1,18 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "metadata": { + "context": { + "organization_id": "org_01K8ZYT4AWJ6XP0E0S8CTBHE3P" + }, + "environment_id": "environment_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "key_id": "bf65e326-43a0-4b20-88c4-07ff3de5434c", + "updated_at": "2024-06-15T10:30:00Z", + "updated_by": { + "id": "key_01K8ZYT4AWJ6XP0E0S8CTBHE3P", + "name": "My API Key" + } + }, + "name": "my-secret", + "value": "s3cr3t-v4lu3" +} diff --git a/tests/vault_test.rs b/tests/vault_test.rs index 4c42f4e1..38c1ef5a 100644 --- a/tests/vault_test.rs +++ b/tests/vault_test.rs @@ -878,7 +878,7 @@ async fn vault_get_name_round_trip() { Mock::given(method("GET")) .and(path_matcher("/vault/v1/kv/name/test_id")) .respond_with( - ResponseTemplate::new(200).set_body_string(include_str!("fixtures/object.json")), + ResponseTemplate::new(200).set_body_string(include_str!("fixtures/vault_object.json")), ) .expect(1) .mount(&server) @@ -988,7 +988,7 @@ async fn vault_get_kv_round_trip() { Mock::given(method("GET")) .and(path_matcher("/vault/v1/kv/test_id")) .respond_with( - ResponseTemplate::new(200).set_body_string(include_str!("fixtures/object.json")), + ResponseTemplate::new(200).set_body_string(include_str!("fixtures/vault_object.json")), ) .expect(1) .mount(&server) From 6bd3c0efbeff2462ab190b9bf524ec04ed1eecb1 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Tue, 26 May 2026 16:21:12 -0400 Subject: [PATCH 11/12] restore old vault behavior --- src/helpers/mod.rs | 3 +- src/helpers/vault_crypto.rs | 220 ++++++++++++++++++++++++++++++++++++ src/resources/vault.rs | 69 +++++++++++ 3 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 src/helpers/vault_crypto.rs diff --git a/src/helpers/mod.rs b/src/helpers/mod.rs index 36bbcbd7..de91bdc0 100644 --- a/src/helpers/mod.rs +++ b/src/helpers/mod.rs @@ -14,7 +14,7 @@ pub mod public_client; pub mod session; pub mod sso_helpers; mod util; - +pub mod vault_crypto; pub mod webhook_verification; pub use actions::{ActionSignedResponse, ActionType, ActionVerdict, ActionsHelper}; @@ -36,6 +36,7 @@ pub use sso_helpers::{ SsoAuthorizationUrlParams, SsoHelper, SsoLogoutUrlParams, SsoPkceAuthorizationUrl, SsoPkceCodeExchangeParams, }; +pub use vault_crypto::{VaultEncryptResult, extract_encrypted_keys, local_decrypt, local_encrypt}; pub use webhook_verification::{ WebhookVerifier, compute_webhook_signature, parse_webhook_signature_header, }; diff --git a/src/helpers/vault_crypto.rs b/src/helpers/vault_crypto.rs new file mode 100644 index 00000000..6d9049c7 --- /dev/null +++ b/src/helpers/vault_crypto.rs @@ -0,0 +1,220 @@ +// @oagen-ignore-file +//! Vault — local AES-256-GCM crypto helpers. +//! +//! Wire format for `LocalEncrypt` (matches workos-go): +//! `LEB128(len(encryptedKeys)) || encryptedKeys || nonce(12) || ciphertext+tag` +//! the whole thing then base64-encoded. + +use aes_gcm::aead::{Aead, KeyInit, Payload}; +use aes_gcm::{Aes256Gcm, Nonce}; +use base64::Engine; +use base64::engine::general_purpose::STANDARD as B64_STANDARD; +use rand::RngCore; + +use crate::error::Error; + +/// Result of [`crate::resources::VaultApi::encrypt`]. +#[derive(Debug, Clone)] +pub struct VaultEncryptResult { + pub encrypted_data: String, + pub context: std::collections::HashMap, + pub encrypted_keys: String, +} + +/// Locally encrypt `data` with AES-256-GCM. +/// +/// * `data_key_b64` — base64-encoded 32-byte AES key (from `CreateDataKeyResponse.data_key`). +/// * `encrypted_keys_b64` — base64-encoded encrypted key blob (from `CreateDataKeyResponse.encrypted_keys`). +/// * `associated_data` — AAD bound into the AEAD tag. +pub fn local_encrypt( + data: &str, + data_key_b64: &str, + encrypted_keys_b64: &str, + associated_data: &str, +) -> Result { + let raw_key = B64_STANDARD + .decode(data_key_b64) + .map_err(|e| Error::VaultCrypto(format!("decode data key: {e}")))?; + if raw_key.len() != 32 { + return Err(Error::VaultCrypto(format!( + "data key must be 32 bytes; got {}", + raw_key.len() + ))); + } + let encrypted_keys = B64_STANDARD + .decode(encrypted_keys_b64) + .map_err(|e| Error::VaultCrypto(format!("decode encrypted keys: {e}")))?; + + let cipher = Aes256Gcm::new_from_slice(&raw_key) + .map_err(|e| Error::VaultCrypto(format!("init AES-GCM: {e}")))?; + let mut nonce_bytes = [0u8; 12]; + rand::rng().fill_bytes(&mut nonce_bytes); + let nonce = Nonce::from_slice(&nonce_bytes); + let ciphertext = cipher + .encrypt( + nonce, + Payload { + msg: data.as_bytes(), + aad: associated_data.as_bytes(), + }, + ) + .map_err(|e| Error::VaultCrypto(format!("encrypt: {e}")))?; + + let prefix = encode_leb128(encrypted_keys.len() as u32); + let mut buf = Vec::with_capacity( + prefix.len() + encrypted_keys.len() + nonce_bytes.len() + ciphertext.len(), + ); + buf.extend_from_slice(&prefix); + buf.extend_from_slice(&encrypted_keys); + buf.extend_from_slice(&nonce_bytes); + buf.extend_from_slice(&ciphertext); + Ok(B64_STANDARD.encode(buf)) +} + +/// Locally decrypt `encrypted_data` with AES-256-GCM. +/// +/// * `data_key_b64` — base64-encoded AES key (from `DecryptResponse.data_key`). +/// * `associated_data` — AAD that was passed to [`local_encrypt`]. +pub fn local_decrypt( + encrypted_data: &str, + data_key_b64: &str, + associated_data: &str, +) -> Result { + let raw = B64_STANDARD + .decode(encrypted_data) + .map_err(|e| Error::VaultCrypto(format!("base64 decode: {e}")))?; + let (keys_len, bytes_read) = decode_leb128(&raw)?; + let offset = bytes_read + keys_len as usize; + if offset + 12 > raw.len() { + return Err(Error::VaultCrypto( + "encrypted data too short: missing nonce".to_string(), + )); + } + let nonce = &raw[offset..offset + 12]; + let ciphertext = &raw[offset + 12..]; + if ciphertext.is_empty() { + return Err(Error::VaultCrypto( + "encrypted data too short: missing ciphertext".to_string(), + )); + } + let raw_key = B64_STANDARD + .decode(data_key_b64) + .map_err(|e| Error::VaultCrypto(format!("decode data key: {e}")))?; + let cipher = Aes256Gcm::new_from_slice(&raw_key) + .map_err(|e| Error::VaultCrypto(format!("init AES-GCM: {e}")))?; + let plaintext = cipher + .decrypt( + Nonce::from_slice(nonce), + Payload { + msg: ciphertext, + aad: associated_data.as_bytes(), + }, + ) + .map_err(|e| Error::VaultCrypto(format!("decrypt: {e}")))?; + String::from_utf8(plaintext).map_err(|e| Error::VaultCrypto(format!("utf-8: {e}"))) +} + +/// Extract the base64-encoded encrypted-keys blob from a sealed envelope. +pub fn extract_encrypted_keys(encrypted_data: &str) -> Result { + let raw = B64_STANDARD + .decode(encrypted_data) + .map_err(|e| Error::VaultCrypto(format!("base64 decode: {e}")))?; + let (keys_len, bytes_read) = decode_leb128(&raw)?; + let total = bytes_read + keys_len as usize; + if raw.len() < total { + return Err(Error::VaultCrypto( + "encrypted data too short for declared key length".to_string(), + )); + } + Ok(B64_STANDARD.encode(&raw[bytes_read..total])) +} + +fn encode_leb128(mut n: u32) -> Vec { + if n == 0 { + return vec![0]; + } + let mut out = Vec::new(); + while n > 0 { + let mut b = (n & 0x7f) as u8; + n >>= 7; + if n > 0 { + b |= 0x80; + } + out.push(b); + } + out +} + +fn decode_leb128(buf: &[u8]) -> Result<(u32, usize), Error> { + let mut result: u32 = 0; + let mut shift: u32 = 0; + for (i, &b) in buf.iter().enumerate() { + let chunk = (b & 0x7f) as u32; + if shift == 28 && (chunk >> 4) != 0 { + return Err(Error::VaultCrypto( + "LEB128 value too large for uint32".to_string(), + )); + } + result |= chunk << shift; + if b & 0x80 == 0 { + return Ok((result, i + 1)); + } + shift += 7; + if shift >= 35 { + return Err(Error::VaultCrypto( + "LEB128 value too large for uint32".to_string(), + )); + } + } + Err(Error::VaultCrypto( + "unexpected end of LEB128 data".to_string(), + )) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn leb128_round_trip() { + for n in [0u32, 1, 127, 128, 16383, 16384, 1_234_567] { + let bytes = encode_leb128(n); + let (decoded, consumed) = decode_leb128(&bytes).unwrap(); + assert_eq!(decoded, n); + assert_eq!(consumed, bytes.len()); + } + } + + fn make_key_material() -> (String, String) { + let key = [9u8; 32]; + ( + B64_STANDARD.encode(key), + B64_STANDARD.encode([1u8, 2, 3, 4, 5]), + ) + } + + #[test] + fn local_encrypt_decrypt_round_trip() { + let (data_key, encrypted_keys) = make_key_material(); + let plaintext = "hello world"; + let aad = "ctx:env_1"; + let sealed = local_encrypt(plaintext, &data_key, &encrypted_keys, aad).unwrap(); + let opened = local_decrypt(&sealed, &data_key, aad).unwrap(); + assert_eq!(opened, plaintext); + } + + #[test] + fn local_decrypt_rejects_wrong_aad() { + let (data_key, encrypted_keys) = make_key_material(); + let sealed = local_encrypt("secret", &data_key, &encrypted_keys, "ctx-a").unwrap(); + assert!(local_decrypt(&sealed, &data_key, "ctx-b").is_err()); + } + + #[test] + fn extract_encrypted_keys_round_trip() { + let (data_key, encrypted_keys) = make_key_material(); + let sealed = local_encrypt("data", &data_key, &encrypted_keys, "aad").unwrap(); + let extracted = extract_encrypted_keys(&sealed).unwrap(); + assert_eq!(extracted, encrypted_keys); + } +} diff --git a/src/resources/vault.rs b/src/resources/vault.rs index 891545d3..373a566c 100644 --- a/src/resources/vault.rs +++ b/src/resources/vault.rs @@ -392,6 +392,75 @@ impl<'a> VaultApi<'a> { .await } + // @oagen-ignore-start + /// Generates a fresh data key and locally encrypts `data` with AES-256-GCM. + /// + /// # Security + /// + /// `associated_data` is the **only** binding between the ciphertext + /// envelope and the calling application: the encrypted-key prefix + /// (`encrypted_keys` and its LEB128 length) sits **outside** the + /// AEAD-authenticated region. Callers MUST pass an `associated_data` + /// value that is unique per record and unguessable to an attacker + /// with write access to the ciphertext store (e.g., the immutable + /// record id mixed with an environment-scoped secret). A constant or + /// empty value lets an attacker who can replace stored bytes + /// substitute a separately-generated envelope — including their own + /// `encrypted_keys` and ciphertext — under the same context, and + /// `decrypt` will succeed against the attacker-controlled plaintext. + pub async fn encrypt( + &self, + data: &str, + context: std::collections::HashMap, + associated_data: &str, + ) -> Result { + let pair = self + .create_data_key(CreateDataKeyParams::new(CreateDataKeyRequest { context })) + .await?; + let encrypted = crate::helpers::vault_crypto::local_encrypt( + data, + pair.data_key.expose(), + pair.encrypted_keys.expose(), + associated_data, + )?; + Ok(crate::helpers::vault_crypto::VaultEncryptResult { + encrypted_data: encrypted, + context: pair.context, + encrypted_keys: pair.encrypted_keys.expose().to_string(), + }) + } + + /// Decrypts data previously encrypted with [`Self::encrypt`]. Calls the API to + /// decrypt the data key, then performs local AES-GCM decryption. + /// + /// # Security + /// + /// `associated_data` is the only authenticated binding between this + /// envelope and the calling application — see [`Self::encrypt`] for + /// the full requirement. If the value passed here is not unique per + /// record and unguessable, a successful return does **not** prove + /// that the stored bytes were authored by this application. + pub async fn decrypt( + &self, + encrypted_data: &str, + associated_data: &str, + ) -> Result { + let encrypted_keys_b64 = + crate::helpers::vault_crypto::extract_encrypted_keys(encrypted_data)?; + + let dk = self + .create_decrypt(CreateDecryptParams::new(DecryptRequest { + keys: encrypted_keys_b64, + })) + .await?; + crate::helpers::vault_crypto::local_decrypt( + encrypted_data, + dk.data_key.expose(), + associated_data, + ) + } + // @oagen-ignore-end + /// List object versions /// /// Retrieve all versions for a specific object. From b183056ede6917ad7a035ae4d895766fa36877c9 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Tue, 26 May 2026 16:23:09 -0400 Subject: [PATCH 12/12] fix(changelog): add missing breaking changes and features to release notes Adds vault API restructuring, type renames, connect application models, and corrects the radar wire value description. Co-Authored-By: Claude Opus 4.6 (1M context) --- ...0eb6fb50f020df713d0233e344a6be05739f59e.md | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md b/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md index f08a5639..13bcaa3f 100644 --- a/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md +++ b/.changelog-pending/2026-05-26T13-23-23-b0eb6fb50f020df713d0233e344a6be05739f59e.md @@ -5,11 +5,27 @@ * New `OrganizationMembershipApi` service with full CRUD and role management for organization memberships * Moved from `UserManagementApi`: list/create/get/update/delete/deactivate/reactivate operations * Breaking change: symbols removed from `user_management` and moved to `organization_membership` (see compat_breaking list) + * `Role` enum (`Single`/`Multiple` variants) moved from `user_management` to `organization_membership` + * `client.user_management_organization_membership_groups()` removed; use `client.organization_membership().list_organization_membership_groups()` instead * Group membership listing now accessible via `organization_membership.list_organization_membership_groups` * **radar:** Remove deprecated action and control fields from Radar standalone assessment * Removed deprecated enum variants: `RadarStandaloneAssessRequestAction::Login`, `RadarStandaloneAssessRequestAction::Signup`, `RadarStandaloneResponseControl::CredentialStuffing`, `RadarStandaloneResponseControl::IpSignUpRateLimit` - * Updated action enum values: `SignUp` wire value changed from `'sign up'` to `'sign-up'`, `SignIn` wire value changed from `'sign in'` to `'sign-in'` + * Removed lenient parsing aliases for `SignUp` (`"sign up"`, `"sign_up"`) and `SignIn` (`"sign in"`, `"sign_in"`); only canonical wire values `"sign-up"` and `"sign-in"` are accepted * Removed fields from `RadarStandaloneAssessRequest`: `device_fingerprint` and `bot_score` (marked breaking in spec) + * **vault:** Replaced hand-written `helpers::VaultApi` with generated `resources::VaultApi` + * `client.vault()` now returns `resources::VaultApi` instead of `helpers::VaultApi` + * Old custom types removed: `DataKeyPair`, `DataKey`, `KeyContext`, `ObjectMetadata`, `VaultObject`, `VaultObjectDigest`, `VaultObjectVersion`, `VaultListObjectsParams`, `VaultListObjectsResponse`, `VaultCreateDataKeyParams`, `VaultCreateObjectParams`, `VaultUpdateObjectParams`, `VaultDecryptDataKeyParams` + * Replaced by generated types: `CreateDataKeyRequest`, `CreateDataKeyResponse`, `DecryptRequest`, `DecryptResponse`, `RekeyRequest`, `CreateObjectRequest`, `UpdateObjectRequest`, `VaultObject`, `ObjectMetadata`, `ObjectSummary`, `ObjectVersion`, `ObjectListResponse`, `VersionListResponse` + * Local `encrypt`/`decrypt` convenience methods preserved on `resources::VaultApi` with the same behavior + * Crypto helpers moved from `helpers::vault` to `helpers::vault_crypto` (re-exported: `VaultEncryptResult`, `local_encrypt`, `local_decrypt`, `extract_encrypted_keys`) + * **generated:** Rename types to remove `Json` suffix and standardize naming + * `AuditLogExportJsonState` → `AuditLogExportState` + * `AuditLogActionJson` → `AuditLogAction` + * `AuditLogExportJson` → `AuditLogExport` + * `AuditLogsRetentionJson` → `AuditLogsRetention` + * `WebhookEndpointJson` → `WebhookEndpoint`, `WebhookEndpointJsonStatus` → `WebhookEndpointStatus` + * `RadarAction` → `RadarListAction`, `RadarType` → `RadarListType` + * `AuditLogSchema` renamed to `AuditLogSchemaDto`; new `AuditLogSchemaInput`, `AuditLogSchemaActorInput`, `AuditLogSchemaTargetInput` types added **Features** * **vault:** Add Vault service with key management and object storage APIs @@ -26,14 +42,21 @@ * Three new webhook event types for Pipes integrations: `PIPES_CONNECTED_ACCOUNT_CONNECTED`, `PIPES_CONNECTED_ACCOUNT_DISCONNECTED`, `PIPES_CONNECTED_ACCOUNT_REAUTHORIZATION_NEEDED` * New model types: `PipeConnectedAccount`, `PipesConnectedAccountConnected`, `PipesConnectedAccountDisconnected`, `PipesConnectedAccountReauthorizationNeeded` * New enum `PipeConnectedAccountState` for connected account status tracking + * **connect:** Add typed connect application models and new fields + * New `ConnectApplicationM2M` and `ConnectApplicationOAuth` model types for M2M and OAuth applications + * New fields on `ConnectApplication`: `redirect_uris`, `uses_pkce`, `is_first_party`, `was_dynamically_registered` + * New `ConnectApplicationRedirectUri` and `ConnectApplicationOAuthRedirectUris` types + * **generated:** Add new general-purpose models + * New `Actor` model for representing users or API keys that performed actions + * New `ErrorResponse` model for structured error response bodies + * New `ListMetadata` model for cursor-based pagination metadata + * New `VaultOrder` enum for ordering vault list results **Fixes** * **generated:** Standardize type names and fix parameter defaults in authorization service * Added `resource_id`, `resource_external_id`, and `resource_type_slug` filters to `ListRoleAssignmentsParams` for more granular assignment filtering * Added `role_slug` filter to `ListRoleAssignmentsForResourceParams` and `ListRoleAssignmentsForResourceByExternalIdParams` * Removed `search` parameter from `ListResourcesParams` (deprecated) - * Renamed audit log types: `AuditLogActionJson` → `AuditLogAction`, `AuditLogExportJson` → `AuditLogExport`, `AuditLogSchema` → `AuditLogSchemaDto`, `AuditLogsRetentionJson` → `AuditLogsRetention` - * Renamed webhook type: `WebhookEndpointJson` → `WebhookEndpoint` and `WebhookEndpointJsonStatus` → `WebhookEndpointStatus` * **connect:** Fix last_used_at field type in application credentials * `NewConnectApplicationSecret.last_used_at` type changed from invalid string value to ISO 8601 timestamp * `ApplicationCredentialsListItem.last_used_at` type changed from invalid string value to ISO 8601 timestamp