composio_sdk/models/
migration.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8pub enum MigrationResourceType {
9 ConnectedAccount,
11 AuthConfig,
13 TriggerInstance,
15}
16
17#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
19pub struct MigrationGetNanoIdParams {
20 #[serde(rename = "type")]
22 pub resource_type: MigrationResourceType,
23 pub uuid: String,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
29pub struct MigrationGetNanoIdResponse {
30 pub nanoid: String,
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37
38 #[test]
39 fn test_migration_get_nanoid_params_serialization() {
40 let params = MigrationGetNanoIdParams {
41 resource_type: MigrationResourceType::ConnectedAccount,
42 uuid: "550e8400-e29b-41d4-a716-446655440000".to_string(),
43 };
44
45 let value = serde_json::to_value(¶ms).unwrap();
46 assert_eq!(value["type"], "CONNECTED_ACCOUNT");
47 assert_eq!(value["uuid"], "550e8400-e29b-41d4-a716-446655440000");
48 }
49
50 #[test]
51 fn test_migration_get_nanoid_response_deserialization() {
52 let payload = r#"{"nanoid":"ca_abc123xyz"}"#;
53 let response: MigrationGetNanoIdResponse = serde_json::from_str(payload).unwrap();
54 assert_eq!(response.nanoid, "ca_abc123xyz");
55 }
56}