fragment-python 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fragment_python-0.2.0 → fragment_python-0.2.2}/PKG-INFO +1 -1
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/client/sync_client.py +3 -7
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/base_model.py +2 -1
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/__init__.py +2 -2
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/base_model.py +2 -1
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/client.py +46 -48
- fragment_python-0.2.2/fragment/sync_sdk/sync_client.py +65 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/pyproject.toml +1 -1
- {fragment_python-0.2.0 → fragment_python-0.2.2}/LICENSE +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/README.md +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/__init__.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/client/__init__.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/client/async_client.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/__init__.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/helpers.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/main.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/plugins/__init__.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/plugins/generate_client_method.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/plugins/get_file_comment.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/exceptions.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/logger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/__init__.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/add_ledger_entry.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/add_ledger_entry_runtime.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/async_client.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/client.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/create_custom_link.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/create_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/enums.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_ledger_account_balance.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_ledger_account_lines.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_ledger_entry.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_schema.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/get_workspace.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/input_types.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_account_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_accounts.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_entries.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_entry_group_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_multi_currency_ledger_account_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/reconcile_tx.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/reconcile_tx_runtime.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/store_schema.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/sync_custom_accounts.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/sync_custom_txs.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/update_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/update_ledger_entry.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/std_queries/queries.graphql +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/add_ledger_entry.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/add_ledger_entry_runtime.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/async_client.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/create_custom_link.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/create_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/enums.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger_account_balance.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger_account_lines.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger_entry.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_schema.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_workspace.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/input_types.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_ledger_account_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_ledger_accounts.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_ledger_entries.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_ledger_entry_group_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_multi_currency_ledger_account_balances.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/reconcile_tx.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/reconcile_tx_runtime.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/store_schema.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/sync_custom_accounts.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/sync_custom_txs.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/update_ledger.py +0 -0
- {fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/update_ledger_entry.py +0 -0
|
@@ -4,9 +4,7 @@ import time
|
|
|
4
4
|
from typing import Any, Dict, Optional
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
from ariadne_codegen.client_generators.dependencies.base_client import
|
|
8
|
-
BaseClient,
|
|
9
|
-
)
|
|
7
|
+
from ariadne_codegen.client_generators.dependencies.base_client import BaseClient
|
|
10
8
|
from authlib.integrations.httpx_client import OAuth2Client
|
|
11
9
|
|
|
12
10
|
from fragment.exceptions import MissingArgumentException, MissingTokenException
|
|
@@ -20,7 +18,7 @@ class SyncFragmentClient(BaseClient):
|
|
|
20
18
|
auth_scope: str = "",
|
|
21
19
|
client_id: str = "",
|
|
22
20
|
client_secret: str = "",
|
|
23
|
-
http_client: Optional[httpx.
|
|
21
|
+
http_client: Optional[httpx.Client] = None,
|
|
24
22
|
):
|
|
25
23
|
if api_url == "":
|
|
26
24
|
raise MissingArgumentException("api_url")
|
|
@@ -37,9 +35,7 @@ class SyncFragmentClient(BaseClient):
|
|
|
37
35
|
self.auth_url = auth_url
|
|
38
36
|
self.expiration_time = None
|
|
39
37
|
self.token = None
|
|
40
|
-
self.oauth2_client = OAuth2Client(
|
|
41
|
-
client_id, client_secret, scope=auth_scope
|
|
42
|
-
)
|
|
38
|
+
self.oauth2_client = OAuth2Client(client_id, client_secret, scope=auth_scope)
|
|
43
39
|
|
|
44
40
|
def refresh_token(self):
|
|
45
41
|
now = time.time()
|
|
@@ -18,7 +18,6 @@ from .add_ledger_entry_runtime import (
|
|
|
18
18
|
AddLedgerEntryRuntimeAddLedgerEntryBadRequestError,
|
|
19
19
|
AddLedgerEntryRuntimeAddLedgerEntryInternalError,
|
|
20
20
|
)
|
|
21
|
-
from .async_client import AsyncFragmentClient
|
|
22
21
|
from .base_model import BaseModel, Upload
|
|
23
22
|
from .client import Client
|
|
24
23
|
from .create_custom_link import (
|
|
@@ -221,6 +220,7 @@ from .store_schema import (
|
|
|
221
220
|
StoreSchemaStoreSchemaStoreSchemaResultSchema,
|
|
222
221
|
StoreSchemaStoreSchemaStoreSchemaResultSchemaVersion,
|
|
223
222
|
)
|
|
223
|
+
from .sync_client import SyncFragmentClient
|
|
224
224
|
from .sync_custom_accounts import (
|
|
225
225
|
SyncCustomAccounts,
|
|
226
226
|
SyncCustomAccountsSyncCustomAccountsBadRequestError,
|
|
@@ -271,7 +271,6 @@ __all__ = [
|
|
|
271
271
|
"AddLedgerEntryRuntimeAddLedgerEntryAddLedgerEntryResultLinesAccount",
|
|
272
272
|
"AddLedgerEntryRuntimeAddLedgerEntryBadRequestError",
|
|
273
273
|
"AddLedgerEntryRuntimeAddLedgerEntryInternalError",
|
|
274
|
-
"AsyncFragmentClient",
|
|
275
274
|
"BalanceUpdateConsistencyMode",
|
|
276
275
|
"BaseModel",
|
|
277
276
|
"ChartOfAccountsInput",
|
|
@@ -450,6 +449,7 @@ __all__ = [
|
|
|
450
449
|
"SyncCustomTxsSyncCustomTxsInternalError",
|
|
451
450
|
"SyncCustomTxsSyncCustomTxsSyncCustomTxsResult",
|
|
452
451
|
"SyncCustomTxsSyncCustomTxsSyncCustomTxsResultTxs",
|
|
452
|
+
"SyncFragmentClient",
|
|
453
453
|
"TagFilter",
|
|
454
454
|
"TagMatchInput",
|
|
455
455
|
"TxMatchInput",
|
|
@@ -5,7 +5,6 @@ from typing import Any, Dict, List, Optional
|
|
|
5
5
|
|
|
6
6
|
from .add_ledger_entry import AddLedgerEntry
|
|
7
7
|
from .add_ledger_entry_runtime import AddLedgerEntryRuntime
|
|
8
|
-
from .async_client import AsyncFragmentClient
|
|
9
8
|
from .create_custom_link import CreateCustomLink
|
|
10
9
|
from .create_ledger import CreateLedger
|
|
11
10
|
from .enums import ReadBalanceConsistencyMode
|
|
@@ -40,6 +39,7 @@ from .list_multi_currency_ledger_account_balances import (
|
|
|
40
39
|
from .reconcile_tx import ReconcileTx
|
|
41
40
|
from .reconcile_tx_runtime import ReconcileTxRuntime
|
|
42
41
|
from .store_schema import StoreSchema
|
|
42
|
+
from .sync_client import SyncFragmentClient
|
|
43
43
|
from .sync_custom_accounts import SyncCustomAccounts
|
|
44
44
|
from .sync_custom_txs import SyncCustomTxs
|
|
45
45
|
from .update_ledger import UpdateLedger
|
|
@@ -50,8 +50,8 @@ def gql(q: str) -> str:
|
|
|
50
50
|
return q
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
class Client(
|
|
54
|
-
|
|
53
|
+
class Client(SyncFragmentClient):
|
|
54
|
+
def store_schema(self, schema: SchemaInput, **kwargs: Any) -> StoreSchema:
|
|
55
55
|
query = gql(
|
|
56
56
|
"""
|
|
57
57
|
mutation storeSchema($schema: SchemaInput!) {
|
|
@@ -77,13 +77,13 @@ class Client(AsyncFragmentClient):
|
|
|
77
77
|
"""
|
|
78
78
|
)
|
|
79
79
|
variables: Dict[str, object] = {"schema": schema}
|
|
80
|
-
response =
|
|
80
|
+
response = self.execute(
|
|
81
81
|
query=query, operation_name="storeSchema", variables=variables, **kwargs
|
|
82
82
|
)
|
|
83
83
|
data = self.get_data(response)
|
|
84
84
|
return StoreSchema.model_validate(data)
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
def create_ledger(
|
|
87
87
|
self, ik: Any, ledger: CreateLedgerInput, schema_key: Any, **kwargs: Any
|
|
88
88
|
) -> CreateLedger:
|
|
89
89
|
query = gql(
|
|
@@ -117,13 +117,13 @@ class Client(AsyncFragmentClient):
|
|
|
117
117
|
"ledger": ledger,
|
|
118
118
|
"schemaKey": schema_key,
|
|
119
119
|
}
|
|
120
|
-
response =
|
|
120
|
+
response = self.execute(
|
|
121
121
|
query=query, operation_name="createLedger", variables=variables, **kwargs
|
|
122
122
|
)
|
|
123
123
|
data = self.get_data(response)
|
|
124
124
|
return CreateLedger.model_validate(data)
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
def add_ledger_entry(
|
|
127
127
|
self,
|
|
128
128
|
ik: Any,
|
|
129
129
|
ledger_ik: Any,
|
|
@@ -177,13 +177,13 @@ class Client(AsyncFragmentClient):
|
|
|
177
177
|
"tags": tags,
|
|
178
178
|
"groups": groups,
|
|
179
179
|
}
|
|
180
|
-
response =
|
|
180
|
+
response = self.execute(
|
|
181
181
|
query=query, operation_name="addLedgerEntry", variables=variables, **kwargs
|
|
182
182
|
)
|
|
183
183
|
data = self.get_data(response)
|
|
184
184
|
return AddLedgerEntry.model_validate(data)
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
def add_ledger_entry_runtime(
|
|
187
187
|
self,
|
|
188
188
|
ik: Any,
|
|
189
189
|
type: str,
|
|
@@ -237,7 +237,7 @@ class Client(AsyncFragmentClient):
|
|
|
237
237
|
"tags": tags,
|
|
238
238
|
"groups": groups,
|
|
239
239
|
}
|
|
240
|
-
response =
|
|
240
|
+
response = self.execute(
|
|
241
241
|
query=query,
|
|
242
242
|
operation_name="addLedgerEntryRuntime",
|
|
243
243
|
variables=variables,
|
|
@@ -246,7 +246,7 @@ class Client(AsyncFragmentClient):
|
|
|
246
246
|
data = self.get_data(response)
|
|
247
247
|
return AddLedgerEntryRuntime.model_validate(data)
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
def reconcile_tx(
|
|
250
250
|
self,
|
|
251
251
|
ledger_ik: Any,
|
|
252
252
|
type: str,
|
|
@@ -296,13 +296,13 @@ class Client(AsyncFragmentClient):
|
|
|
296
296
|
"tags": tags,
|
|
297
297
|
"groups": groups,
|
|
298
298
|
}
|
|
299
|
-
response =
|
|
299
|
+
response = self.execute(
|
|
300
300
|
query=query, operation_name="reconcileTx", variables=variables, **kwargs
|
|
301
301
|
)
|
|
302
302
|
data = self.get_data(response)
|
|
303
303
|
return ReconcileTx.model_validate(data)
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
def reconcile_tx_runtime(
|
|
306
306
|
self,
|
|
307
307
|
ledger_ik: Any,
|
|
308
308
|
type: str,
|
|
@@ -352,7 +352,7 @@ class Client(AsyncFragmentClient):
|
|
|
352
352
|
"tags": tags,
|
|
353
353
|
"groups": groups,
|
|
354
354
|
}
|
|
355
|
-
response =
|
|
355
|
+
response = self.execute(
|
|
356
356
|
query=query,
|
|
357
357
|
operation_name="reconcileTxRuntime",
|
|
358
358
|
variables=variables,
|
|
@@ -361,7 +361,7 @@ class Client(AsyncFragmentClient):
|
|
|
361
361
|
data = self.get_data(response)
|
|
362
362
|
return ReconcileTxRuntime.model_validate(data)
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
def update_ledger_entry(
|
|
365
365
|
self,
|
|
366
366
|
entry_ik: Any,
|
|
367
367
|
ledger_ik: Any,
|
|
@@ -415,7 +415,7 @@ class Client(AsyncFragmentClient):
|
|
|
415
415
|
"ledgerIk": ledger_ik,
|
|
416
416
|
"update": update,
|
|
417
417
|
}
|
|
418
|
-
response =
|
|
418
|
+
response = self.execute(
|
|
419
419
|
query=query,
|
|
420
420
|
operation_name="updateLedgerEntry",
|
|
421
421
|
variables=variables,
|
|
@@ -424,7 +424,7 @@ class Client(AsyncFragmentClient):
|
|
|
424
424
|
data = self.get_data(response)
|
|
425
425
|
return UpdateLedgerEntry.model_validate(data)
|
|
426
426
|
|
|
427
|
-
|
|
427
|
+
def update_ledger(
|
|
428
428
|
self, ledger_ik: Any, update: UpdateLedgerInput, **kwargs: Any
|
|
429
429
|
) -> UpdateLedger:
|
|
430
430
|
query = gql(
|
|
@@ -449,15 +449,13 @@ class Client(AsyncFragmentClient):
|
|
|
449
449
|
"""
|
|
450
450
|
)
|
|
451
451
|
variables: Dict[str, object] = {"ledgerIk": ledger_ik, "update": update}
|
|
452
|
-
response =
|
|
452
|
+
response = self.execute(
|
|
453
453
|
query=query, operation_name="updateLedger", variables=variables, **kwargs
|
|
454
454
|
)
|
|
455
455
|
data = self.get_data(response)
|
|
456
456
|
return UpdateLedger.model_validate(data)
|
|
457
457
|
|
|
458
|
-
|
|
459
|
-
self, name: str, ik: Any, **kwargs: Any
|
|
460
|
-
) -> CreateCustomLink:
|
|
458
|
+
def create_custom_link(self, name: str, ik: Any, **kwargs: Any) -> CreateCustomLink:
|
|
461
459
|
query = gql(
|
|
462
460
|
"""
|
|
463
461
|
mutation createCustomLink($name: String!, $ik: SafeString!) {
|
|
@@ -481,7 +479,7 @@ class Client(AsyncFragmentClient):
|
|
|
481
479
|
"""
|
|
482
480
|
)
|
|
483
481
|
variables: Dict[str, object] = {"name": name, "ik": ik}
|
|
484
|
-
response =
|
|
482
|
+
response = self.execute(
|
|
485
483
|
query=query,
|
|
486
484
|
operation_name="createCustomLink",
|
|
487
485
|
variables=variables,
|
|
@@ -490,7 +488,7 @@ class Client(AsyncFragmentClient):
|
|
|
490
488
|
data = self.get_data(response)
|
|
491
489
|
return CreateCustomLink.model_validate(data)
|
|
492
490
|
|
|
493
|
-
|
|
491
|
+
def sync_custom_accounts(
|
|
494
492
|
self, link_id: str, accounts: List[CustomAccountInput], **kwargs: Any
|
|
495
493
|
) -> SyncCustomAccounts:
|
|
496
494
|
query = gql(
|
|
@@ -519,7 +517,7 @@ class Client(AsyncFragmentClient):
|
|
|
519
517
|
"""
|
|
520
518
|
)
|
|
521
519
|
variables: Dict[str, object] = {"linkId": link_id, "accounts": accounts}
|
|
522
|
-
response =
|
|
520
|
+
response = self.execute(
|
|
523
521
|
query=query,
|
|
524
522
|
operation_name="syncCustomAccounts",
|
|
525
523
|
variables=variables,
|
|
@@ -528,7 +526,7 @@ class Client(AsyncFragmentClient):
|
|
|
528
526
|
data = self.get_data(response)
|
|
529
527
|
return SyncCustomAccounts.model_validate(data)
|
|
530
528
|
|
|
531
|
-
|
|
529
|
+
def sync_custom_txs(
|
|
532
530
|
self, link_id: str, txs: List[CustomTxInput], **kwargs: Any
|
|
533
531
|
) -> SyncCustomTxs:
|
|
534
532
|
query = gql(
|
|
@@ -558,13 +556,13 @@ class Client(AsyncFragmentClient):
|
|
|
558
556
|
"""
|
|
559
557
|
)
|
|
560
558
|
variables: Dict[str, object] = {"linkId": link_id, "txs": txs}
|
|
561
|
-
response =
|
|
559
|
+
response = self.execute(
|
|
562
560
|
query=query, operation_name="syncCustomTxs", variables=variables, **kwargs
|
|
563
561
|
)
|
|
564
562
|
data = self.get_data(response)
|
|
565
563
|
return SyncCustomTxs.model_validate(data)
|
|
566
564
|
|
|
567
|
-
|
|
565
|
+
def get_ledger(self, ik: Any, **kwargs: Any) -> GetLedger:
|
|
568
566
|
query = gql(
|
|
569
567
|
"""
|
|
570
568
|
query getLedger($ik: SafeString!) {
|
|
@@ -579,13 +577,13 @@ class Client(AsyncFragmentClient):
|
|
|
579
577
|
"""
|
|
580
578
|
)
|
|
581
579
|
variables: Dict[str, object] = {"ik": ik}
|
|
582
|
-
response =
|
|
580
|
+
response = self.execute(
|
|
583
581
|
query=query, operation_name="getLedger", variables=variables, **kwargs
|
|
584
582
|
)
|
|
585
583
|
data = self.get_data(response)
|
|
586
584
|
return GetLedger.model_validate(data)
|
|
587
585
|
|
|
588
|
-
|
|
586
|
+
def get_ledger_entry(
|
|
589
587
|
self, ik: Any, ledger_ik: Any, **kwargs: Any
|
|
590
588
|
) -> GetLedgerEntry:
|
|
591
589
|
query = gql(
|
|
@@ -611,13 +609,13 @@ class Client(AsyncFragmentClient):
|
|
|
611
609
|
"""
|
|
612
610
|
)
|
|
613
611
|
variables: Dict[str, object] = {"ik": ik, "ledgerIk": ledger_ik}
|
|
614
|
-
response =
|
|
612
|
+
response = self.execute(
|
|
615
613
|
query=query, operation_name="getLedgerEntry", variables=variables, **kwargs
|
|
616
614
|
)
|
|
617
615
|
data = self.get_data(response)
|
|
618
616
|
return GetLedgerEntry.model_validate(data)
|
|
619
617
|
|
|
620
|
-
|
|
618
|
+
def list_ledger_accounts(
|
|
621
619
|
self,
|
|
622
620
|
ledger_ik: Any,
|
|
623
621
|
after: Optional[str] = None,
|
|
@@ -658,7 +656,7 @@ class Client(AsyncFragmentClient):
|
|
|
658
656
|
"first": first,
|
|
659
657
|
"before": before,
|
|
660
658
|
}
|
|
661
|
-
response =
|
|
659
|
+
response = self.execute(
|
|
662
660
|
query=query,
|
|
663
661
|
operation_name="listLedgerAccounts",
|
|
664
662
|
variables=variables,
|
|
@@ -667,7 +665,7 @@ class Client(AsyncFragmentClient):
|
|
|
667
665
|
data = self.get_data(response)
|
|
668
666
|
return ListLedgerAccounts.model_validate(data)
|
|
669
667
|
|
|
670
|
-
|
|
668
|
+
def list_ledger_account_balances(
|
|
671
669
|
self,
|
|
672
670
|
ledger_ik: Any,
|
|
673
671
|
after: Optional[str] = None,
|
|
@@ -721,7 +719,7 @@ class Client(AsyncFragmentClient):
|
|
|
721
719
|
"balanceAt": balance_at,
|
|
722
720
|
"ownBalanceConsistencyMode": own_balance_consistency_mode,
|
|
723
721
|
}
|
|
724
|
-
response =
|
|
722
|
+
response = self.execute(
|
|
725
723
|
query=query,
|
|
726
724
|
operation_name="listLedgerAccountBalances",
|
|
727
725
|
variables=variables,
|
|
@@ -730,7 +728,7 @@ class Client(AsyncFragmentClient):
|
|
|
730
728
|
data = self.get_data(response)
|
|
731
729
|
return ListLedgerAccountBalances.model_validate(data)
|
|
732
730
|
|
|
733
|
-
|
|
731
|
+
def list_multi_currency_ledger_account_balances(
|
|
734
732
|
self,
|
|
735
733
|
ledger_ik: Any,
|
|
736
734
|
after: Optional[str] = None,
|
|
@@ -802,7 +800,7 @@ class Client(AsyncFragmentClient):
|
|
|
802
800
|
"balanceAt": balance_at,
|
|
803
801
|
"ownBalancesConsistencyMode": own_balances_consistency_mode,
|
|
804
802
|
}
|
|
805
|
-
response =
|
|
803
|
+
response = self.execute(
|
|
806
804
|
query=query,
|
|
807
805
|
operation_name="listMultiCurrencyLedgerAccountBalances",
|
|
808
806
|
variables=variables,
|
|
@@ -811,7 +809,7 @@ class Client(AsyncFragmentClient):
|
|
|
811
809
|
data = self.get_data(response)
|
|
812
810
|
return ListMultiCurrencyLedgerAccountBalances.model_validate(data)
|
|
813
811
|
|
|
814
|
-
|
|
812
|
+
def get_ledger_account_lines(
|
|
815
813
|
self,
|
|
816
814
|
path: str,
|
|
817
815
|
ledger_ik: Any,
|
|
@@ -854,7 +852,7 @@ class Client(AsyncFragmentClient):
|
|
|
854
852
|
"before": before,
|
|
855
853
|
"filter": filter,
|
|
856
854
|
}
|
|
857
|
-
response =
|
|
855
|
+
response = self.execute(
|
|
858
856
|
query=query,
|
|
859
857
|
operation_name="getLedgerAccountLines",
|
|
860
858
|
variables=variables,
|
|
@@ -863,7 +861,7 @@ class Client(AsyncFragmentClient):
|
|
|
863
861
|
data = self.get_data(response)
|
|
864
862
|
return GetLedgerAccountLines.model_validate(data)
|
|
865
863
|
|
|
866
|
-
|
|
864
|
+
def get_ledger_account_balance(
|
|
867
865
|
self,
|
|
868
866
|
path: str,
|
|
869
867
|
ledger_ik: Any,
|
|
@@ -894,7 +892,7 @@ class Client(AsyncFragmentClient):
|
|
|
894
892
|
"balanceAt": balance_at,
|
|
895
893
|
"ownBalanceConsistencyMode": own_balance_consistency_mode,
|
|
896
894
|
}
|
|
897
|
-
response =
|
|
895
|
+
response = self.execute(
|
|
898
896
|
query=query,
|
|
899
897
|
operation_name="getLedgerAccountBalance",
|
|
900
898
|
variables=variables,
|
|
@@ -903,7 +901,7 @@ class Client(AsyncFragmentClient):
|
|
|
903
901
|
data = self.get_data(response)
|
|
904
902
|
return GetLedgerAccountBalance.model_validate(data)
|
|
905
903
|
|
|
906
|
-
|
|
904
|
+
def get_schema(
|
|
907
905
|
self, key: Any, version: Optional[int] = None, **kwargs: Any
|
|
908
906
|
) -> GetSchema:
|
|
909
907
|
query = gql(
|
|
@@ -922,13 +920,13 @@ class Client(AsyncFragmentClient):
|
|
|
922
920
|
"""
|
|
923
921
|
)
|
|
924
922
|
variables: Dict[str, object] = {"key": key, "version": version}
|
|
925
|
-
response =
|
|
923
|
+
response = self.execute(
|
|
926
924
|
query=query, operation_name="getSchema", variables=variables, **kwargs
|
|
927
925
|
)
|
|
928
926
|
data = self.get_data(response)
|
|
929
927
|
return GetSchema.model_validate(data)
|
|
930
928
|
|
|
931
|
-
|
|
929
|
+
def list_ledger_entries(
|
|
932
930
|
self,
|
|
933
931
|
ledger_ik: Any,
|
|
934
932
|
after: Optional[str] = None,
|
|
@@ -973,7 +971,7 @@ class Client(AsyncFragmentClient):
|
|
|
973
971
|
"before": before,
|
|
974
972
|
"filter": filter,
|
|
975
973
|
}
|
|
976
|
-
response =
|
|
974
|
+
response = self.execute(
|
|
977
975
|
query=query,
|
|
978
976
|
operation_name="listLedgerEntries",
|
|
979
977
|
variables=variables,
|
|
@@ -982,7 +980,7 @@ class Client(AsyncFragmentClient):
|
|
|
982
980
|
data = self.get_data(response)
|
|
983
981
|
return ListLedgerEntries.model_validate(data)
|
|
984
982
|
|
|
985
|
-
|
|
983
|
+
def get_workspace(self, **kwargs: Any) -> GetWorkspace:
|
|
986
984
|
query = gql(
|
|
987
985
|
"""
|
|
988
986
|
query getWorkspace {
|
|
@@ -994,13 +992,13 @@ class Client(AsyncFragmentClient):
|
|
|
994
992
|
"""
|
|
995
993
|
)
|
|
996
994
|
variables: Dict[str, object] = {}
|
|
997
|
-
response =
|
|
995
|
+
response = self.execute(
|
|
998
996
|
query=query, operation_name="getWorkspace", variables=variables, **kwargs
|
|
999
997
|
)
|
|
1000
998
|
data = self.get_data(response)
|
|
1001
999
|
return GetWorkspace.model_validate(data)
|
|
1002
1000
|
|
|
1003
|
-
|
|
1001
|
+
def list_ledger_entry_group_balances(
|
|
1004
1002
|
self,
|
|
1005
1003
|
ledger_ik: Any,
|
|
1006
1004
|
group_key: Any,
|
|
@@ -1061,7 +1059,7 @@ class Client(AsyncFragmentClient):
|
|
|
1061
1059
|
"last": last,
|
|
1062
1060
|
"filter": filter,
|
|
1063
1061
|
}
|
|
1064
|
-
response =
|
|
1062
|
+
response = self.execute(
|
|
1065
1063
|
query=query,
|
|
1066
1064
|
operation_name="listLedgerEntryGroupBalances",
|
|
1067
1065
|
variables=variables,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Generated by fragment (with the help of ariadne-codegen)
|
|
2
|
+
|
|
3
|
+
# Ignore untyped authlib
|
|
4
|
+
# mypy: disable-error-code="import-untyped"
|
|
5
|
+
import time
|
|
6
|
+
from typing import Any, Dict, Optional
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
from ariadne_codegen.client_generators.dependencies.base_client import BaseClient
|
|
10
|
+
from authlib.integrations.httpx_client import OAuth2Client
|
|
11
|
+
|
|
12
|
+
from fragment.exceptions import MissingArgumentException, MissingTokenException
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SyncFragmentClient(BaseClient):
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
api_url: str = "",
|
|
19
|
+
auth_url: str = "",
|
|
20
|
+
auth_scope: str = "",
|
|
21
|
+
client_id: str = "",
|
|
22
|
+
client_secret: str = "",
|
|
23
|
+
http_client: Optional[httpx.Client] = None,
|
|
24
|
+
):
|
|
25
|
+
if api_url == "":
|
|
26
|
+
raise MissingArgumentException("api_url")
|
|
27
|
+
if auth_url == "":
|
|
28
|
+
raise MissingArgumentException("auth_url")
|
|
29
|
+
if auth_scope == "":
|
|
30
|
+
raise MissingArgumentException("auth_scope")
|
|
31
|
+
if client_id == "":
|
|
32
|
+
raise MissingArgumentException("client_id")
|
|
33
|
+
if client_secret == "":
|
|
34
|
+
raise MissingArgumentException("client_secret")
|
|
35
|
+
super().__init__(url=api_url, http_client=http_client)
|
|
36
|
+
|
|
37
|
+
self.auth_url = auth_url
|
|
38
|
+
self.expiration_time = None
|
|
39
|
+
self.token = None
|
|
40
|
+
self.oauth2_client = OAuth2Client(client_id, client_secret, scope=auth_scope)
|
|
41
|
+
|
|
42
|
+
def refresh_token(self):
|
|
43
|
+
now = time.time()
|
|
44
|
+
if self.expiration_time is None or self.expiration_time <= now:
|
|
45
|
+
self.token = self.oauth2_client.fetch_token(self.auth_url)
|
|
46
|
+
self.expiration_time = now + self.token["expires_in"]
|
|
47
|
+
|
|
48
|
+
def execute(
|
|
49
|
+
self,
|
|
50
|
+
query: str,
|
|
51
|
+
operation_name: Optional[str] = None,
|
|
52
|
+
variables: Optional[Dict[str, Any]] = None,
|
|
53
|
+
**kwargs: Any,
|
|
54
|
+
) -> httpx.Response:
|
|
55
|
+
self.refresh_token()
|
|
56
|
+
if self.token is None:
|
|
57
|
+
raise MissingTokenException()
|
|
58
|
+
headers = kwargs.get("headers", {})
|
|
59
|
+
kwargs.update(
|
|
60
|
+
headers={
|
|
61
|
+
"Authorization": f'Bearer {self.token["access_token"]}',
|
|
62
|
+
**headers,
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
return super().execute(query, operation_name, variables, **kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/plugins/generate_client_method.py
RENAMED
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/codegen/plugins/get_file_comment.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_account_balances.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sdk/list_ledger_entry_group_balances.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/add_ledger_entry_runtime.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger_account_balance.py
RENAMED
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/get_ledger_account_lines.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fragment_python-0.2.0 → fragment_python-0.2.2}/fragment/sync_sdk/list_ledger_account_balances.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|