diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c07a3a..46d7b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/). Releases prior to `1.0.0` were published before this changelog was added and are not documented here. -## [Unreleased] +## [1.1.0] ### Added -- `AddLedgerEntries` commits a batch of Ledger Entries in one atomic, - strongly-consistent transaction. +- `AddLedgerEntries` posts a batch of Ledger Entries atomically. - Strongly-typed batch payloads. Codegen now emits a `typed_entries` module with one model per Ledger Entry type, derived from the per-entry-type `addLedgerEntry` operations in the codegen input directory. Because a batch diff --git a/README.md b/README.md index 130c621..c9abd71 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ print(get_schema_result.schema_.json()) ### Post a Ledger Entry -To [post](https://fragment.dev/docs#post-ledger-entries-post-to-the-api) a Ledger Entry defined in your Schema: +To [post](https://fragment.dev/guides/post-ledger-entries#post-to-the-api) a Ledger Entry defined in your Schema: ```python await graphql_client.add_ledger_entry( @@ -83,9 +83,38 @@ await graphql_client.add_ledger_entry( ) ``` +### Post a batch of Ledger Entries + +To [post](https://fragment.dev/guides/post-ledger-entries#batch-ledger-entries) a batch of Ledger Entries atomically: + +```python +from fragment.sdk.typed_entries import UserFundsAccountV1 + +await graphql_client.add_ledger_entries( + entries=[ + UserFundsAccountV1( + ik="some-ik-1", + ledger_ik="your-ledger-ik", + posted="1968-01-01T16:45:00Z", + user_id="user-1", + funding_amount="20000", + ), + UserFundsAccountV1( + ik="some-ik-2", + ledger_ik="your-ledger-ik", + posted="1968-01-01T16:45:00Z", + user_id="user-2", + funding_amount="20000", + ), + ] +) +``` + +Construct the entries in the batch using the strongly-typed models for your Schema in the `typed_entries` module of your generated client. + ### Read a Ledger Account's Balance -To read a Ledger Account's [balance](https://fragment.dev/docs#read-balances-latest): +To read a Ledger Account's [balance](https://fragment.dev/guides/read-balances#latest): ```python from fragment.sdk.enums import CurrencyCode diff --git a/pyproject.toml b/pyproject.toml index 8c2547a..1b10f23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ target_package_name = "fragment_graphql_client" [tool.poetry] name = "fragment-python" -version = "1.0.0" +version = "1.1.0" description = "Python SDK for https://fragment.dev/" authors = ["Fragment Foundries Inc"] license = "Apache 2.0"