Commit serde code

This commit is contained in:
Mark Veidemanis 2022-03-25 18:09:32 +00:00
parent ec33750c50
commit 2ca518962c
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,84 @@
from serde import Model, fields
class Amount(Model):
amount: fields.Str()
currency: fields.Str()
class Transaction(Model):
bookingDate: fields.Date()
proprietaryBankTransactionCode: fields.Optional(fields.Str())
remittanceInformationUnstructured: fields.Optional(fields.Str())
transactionAmount: fields.Nested(Amount)
transactionId: fields.Str()
class Pending(Transaction):
pass
class Booked(Transaction):
pass
class Transactions(Model):
pending: fields.List(Pending)
booked: fields.List(Booked)
class TXRoot(Model):
transactions: fields.Nested(Transactions)
class AccessToken(Model):
access: fields.Str()
class Institution(Model):
id: fields.Str()
name: fields.Str()
bic: fields.Str()
transaction_total_days: fields.Str()
countries: fields.List()
logo: fields.Url()
class Institutions(Model):
institutions: fields.List(Institution)
class Agreement(Model):
id: fields.Str()
created: fields.DateTime()
redirect: fields.Url()
status: fields.Str()
institution_id: fields.Str()
agreement: fields.Str()
reference: fields.Str()
accounts: fields.List()
link: fields.Url()
ssn: fields.Literal(None) # ?
account_selection: fields.Bool()
redirect_immediate: fields.Bool()
class Requisitions(Model):
count: fields.Int()
next: fields.Literal(None) # wrong
previous: fields.Literal(None) # wrong
results: fields.List(Agreement)
class Account(Model):
resourceId: fields.Str()
iban: fields.Str()
bban: fields.Str()
currency: fields.Str()
ownerName: fields.Str()
status: fields.Str()
details: fields.Str()
class AccountDetails(Model):
account: fields.Nested(Account)