use gtw_rs_sdk::models::DataModelCreateRequest;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut gtw_sdk = GtwSDK::new().build().await?;
let model = DataModelCreateRequest {
title: "Employee Profile".to_string(),
description: "Standard employee information schema".to_string(),
schema: json!({
"type": "object",
"required": ["firstName", "email", "department"],
"properties": {
"firstName": {
"type": "string",
"minLength": 2
},
"lastName": {
"type": "string",
"minLength": 2
},
"email": {
"type": "string",
"format": "email"
},
"department": {
"type": "string",
"enum": ["Engineering", "Marketing", "Sales", "HR"]
},
"skills": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"startDate": {
"type": "string",
"format": "date"
}
},
"additionalProperties": false
}),
tags: Some(vec![
"employee".to_string(),
"hr".to_string(),
"profile".to_string()
]),
};
match gtw_sdk.data_model.create(model).await {
Ok(response) => println!("Data model created with ID: {}", response.id),
Err(e) => eprintln!("Error creating data model: {}", e),
}
Ok(())
}