talea_core/api/
requests.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4use crate::types::{Direction, ExternalRef, Seq};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
8pub struct WireAmount {
9 pub minor: i64,
10 pub asset: String,
11}
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
15pub struct AssetDraft {
16 pub id: String,
17 pub class: String,
20 pub network: Option<String>, pub native_id: Option<String>, pub precision: u8,
23 pub name: String,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
28pub struct AccountDraft {
29 pub book: String,
30 pub path: String,
31 pub asset: String,
32 pub kind: String,
34 pub normal_side: Option<Direction>, pub min_balance: Option<i64>, }
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
40pub struct PostingDraft {
41 pub account: String,
42 pub amount: WireAmount,
43 pub direction: Direction,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
48pub struct TransactionDraft {
49 pub book: String,
50 pub idempotency_key: String,
51 pub postings: Vec<PostingDraft>,
52 #[serde(default)]
53 pub external_refs: Vec<ExternalRef>,
54 #[serde(default)]
55 pub metadata: serde_json::Value,
56 #[serde(default)]
58 pub occurred_at: Option<DateTime<Utc>>,
59}
60
61#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
62pub struct Page {
63 pub after_seq: Option<Seq>,
64 pub limit: u32,
65}