Skip to content

Commit 60e2b1e

Browse files
authored
Regenerate the sdk to pick up internal payment field (#30)
2 parents c769b44 + 8d54e28 commit 60e2b1e

30 files changed

+692
-4
lines changed

lightspark/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
AccountToWithdrawalRequestsConnection,
1818
)
1919
from lightspark.objects.ApiToken import ApiToken
20+
from lightspark.objects.AuditLogActor import AuditLogActor
2021
from lightspark.objects.Balances import Balances
2122
from lightspark.objects.BitcoinNetwork import BitcoinNetwork
2223
from lightspark.objects.BlockchainBalance import BlockchainBalance
@@ -86,6 +87,12 @@
8687
from lightspark.objects.IncomingPayment import IncomingPayment
8788
from lightspark.objects.IncomingPaymentAttempt import IncomingPaymentAttempt
8889
from lightspark.objects.IncomingPaymentAttemptStatus import IncomingPaymentAttemptStatus
90+
from lightspark.objects.IncomingPaymentsForInvoiceQueryInput import (
91+
IncomingPaymentsForInvoiceQueryInput,
92+
)
93+
from lightspark.objects.IncomingPaymentsForInvoiceQueryOutput import (
94+
IncomingPaymentsForInvoiceQueryOutput,
95+
)
8996
from lightspark.objects.IncomingPaymentToAttemptsConnection import (
9097
IncomingPaymentToAttemptsConnection,
9198
)
@@ -114,6 +121,9 @@
114121
from lightspark.objects.LightsparkNodeWithRemoteSigning import (
115122
LightsparkNodeWithRemoteSigning,
116123
)
124+
from lightspark.objects.MultiSigAddressValidationParameters import (
125+
MultiSigAddressValidationParameters,
126+
)
117127
from lightspark.objects.Node import Node
118128
from lightspark.objects.NodeAddress import NodeAddress
119129
from lightspark.objects.NodeAddressType import NodeAddressType

lightspark/objects/Account.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def get_api_tokens(
9090
api_token_client_id: client_id
9191
api_token_name: name
9292
api_token_permissions: permissions
93+
api_token_is_deleted: is_deleted
9394
}
9495
}
9596
}
@@ -917,6 +918,7 @@ def get_transactions(
917918
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
918919
}
919920
}
921+
incoming_payment_is_internal_payment: is_internal_payment
920922
}
921923
... on OutgoingPayment {
922924
__typename
@@ -1261,6 +1263,7 @@ def get_transactions(
12611263
}
12621264
}
12631265
outgoing_payment_payment_preimage: payment_preimage
1266+
outgoing_payment_is_internal_payment: is_internal_payment
12641267
}
12651268
... on RoutingTransaction {
12661269
__typename

lightspark/objects/ApiToken.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
from lightspark.requests.requester import Requester
88
from lightspark.utils.enums import parse_enum_list
99

10+
from .AuditLogActor import AuditLogActor
1011
from .Entity import Entity
1112
from .Permission import Permission
1213

1314

1415
@dataclass
15-
class ApiToken(Entity):
16+
class ApiToken(AuditLogActor, Entity):
1617
"""This is an object representing a Lightspark API token, that can be used to authenticate this account when making API calls or using our SDKs. See the “Authentication” section of our API docs for more details on its usage."""
1718

1819
requester: Requester
@@ -34,6 +35,9 @@ class ApiToken(Entity):
3435

3536
permissions: List[Permission]
3637
"""A list of permissions granted to the token."""
38+
39+
is_deleted: bool
40+
"""Whether the api token has been deleted."""
3741
typename: str
3842

3943
def to_json(self) -> Mapping[str, Any]:
@@ -45,6 +49,7 @@ def to_json(self) -> Mapping[str, Any]:
4549
"api_token_client_id": self.client_id,
4650
"api_token_name": self.name,
4751
"api_token_permissions": [e.value for e in self.permissions],
52+
"api_token_is_deleted": self.is_deleted,
4853
}
4954

5055

@@ -57,6 +62,7 @@ def to_json(self) -> Mapping[str, Any]:
5762
api_token_client_id: client_id
5863
api_token_name: name
5964
api_token_permissions: permissions
65+
api_token_is_deleted: is_deleted
6066
}
6167
"""
6268

@@ -71,4 +77,5 @@ def from_json(requester: Requester, obj: Mapping[str, Any]) -> ApiToken:
7177
client_id=obj["api_token_client_id"],
7278
name=obj["api_token_name"],
7379
permissions=parse_enum_list(Permission, obj["api_token_permissions"]),
80+
is_deleted=obj["api_token_is_deleted"],
7481
)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright ©, 2022-present, Lightspark Group, Inc. - All Rights Reserved
2+
3+
from dataclasses import dataclass
4+
from datetime import datetime
5+
from typing import Any, Mapping
6+
7+
from lightspark.exceptions import LightsparkException
8+
from lightspark.requests.requester import Requester
9+
from lightspark.utils.enums import parse_enum_list
10+
11+
from .Entity import Entity
12+
from .Permission import Permission
13+
14+
15+
@dataclass
16+
class AuditLogActor(Entity):
17+
"""Audit log actor who called the GraphQL mutation"""
18+
19+
requester: Requester
20+
21+
id: str
22+
"""The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque string."""
23+
24+
created_at: datetime
25+
"""The date and time when the entity was first created."""
26+
27+
updated_at: datetime
28+
"""The date and time when the entity was last updated."""
29+
typename: str
30+
31+
def to_json(self) -> Mapping[str, Any]:
32+
return {
33+
"__typename": self.typename,
34+
"audit_log_actor_id": self.id,
35+
"audit_log_actor_created_at": self.created_at.isoformat(),
36+
"audit_log_actor_updated_at": self.updated_at.isoformat(),
37+
}
38+
39+
40+
FRAGMENT = """
41+
fragment AuditLogActorFragment on AuditLogActor {
42+
__typename
43+
... on ApiToken {
44+
__typename
45+
api_token_id: id
46+
api_token_created_at: created_at
47+
api_token_updated_at: updated_at
48+
api_token_client_id: client_id
49+
api_token_name: name
50+
api_token_permissions: permissions
51+
api_token_is_deleted: is_deleted
52+
}
53+
}
54+
"""
55+
56+
57+
def from_json(requester: Requester, obj: Mapping[str, Any]) -> AuditLogActor:
58+
if obj["__typename"] == "ApiToken":
59+
# pylint: disable=import-outside-toplevel
60+
from lightspark.objects.ApiToken import ApiToken
61+
62+
return ApiToken(
63+
requester=requester,
64+
typename="ApiToken",
65+
id=obj["api_token_id"],
66+
created_at=datetime.fromisoformat(obj["api_token_created_at"]),
67+
updated_at=datetime.fromisoformat(obj["api_token_updated_at"]),
68+
client_id=obj["api_token_client_id"],
69+
name=obj["api_token_name"],
70+
permissions=parse_enum_list(Permission, obj["api_token_permissions"]),
71+
is_deleted=obj["api_token_is_deleted"],
72+
)
73+
graphql_typename = obj["__typename"]
74+
raise LightsparkException(
75+
"UNKNOWN_INTERFACE",
76+
f"Couldn't find a concrete type for interface AuditLogActor corresponding to the typename={graphql_typename}",
77+
)

lightspark/objects/ChannelSnapshot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class ChannelSnapshot(Entity):
3232

3333
remote_unsettled_balance: Optional[CurrencyAmount]
3434

35+
status: Optional[str]
36+
3537
channel_id: str
3638

3739
local_channel_reserve: Optional[CurrencyAmount]
@@ -58,6 +60,7 @@ def to_json(self) -> Mapping[str, Any]:
5860
"channel_snapshot_remote_unsettled_balance": self.remote_unsettled_balance.to_json()
5961
if self.remote_unsettled_balance
6062
else None,
63+
"channel_snapshot_status": self.status,
6164
"channel_snapshot_channel": {"id": self.channel_id},
6265
"channel_snapshot_local_channel_reserve": self.local_channel_reserve.to_json()
6366
if self.local_channel_reserve
@@ -104,6 +107,7 @@ def to_json(self) -> Mapping[str, Any]:
104107
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
105108
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
106109
}
110+
channel_snapshot_status: status
107111
channel_snapshot_channel: channel {
108112
id
109113
}
@@ -147,6 +151,7 @@ def from_json(requester: Requester, obj: Mapping[str, Any]) -> ChannelSnapshot:
147151
)
148152
if obj["channel_snapshot_remote_unsettled_balance"]
149153
else None,
154+
status=obj["channel_snapshot_status"],
150155
channel_id=obj["channel_snapshot_channel"]["id"],
151156
local_channel_reserve=CurrencyAmount_from_json(
152157
requester, obj["channel_snapshot_local_channel_reserve"]

lightspark/objects/ClaimUmaInvitationInput.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
@dataclass
88
class ClaimUmaInvitationInput:
99
invitation_code: str
10+
"""The unique code that identifies this invitation and was shared by the inviter."""
1011

1112
invitee_uma: str
13+
"""The UMA of the user claiming the invitation. It will be sent to the inviter so that they can start transacting with the invitee."""
1214

1315
def to_json(self) -> Mapping[str, Any]:
1416
return {

lightspark/objects/ClaimUmaInvitationOutput.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ClaimUmaInvitationOutput:
1111
requester: Requester
1212

1313
invitation_id: str
14+
"""An UMA.ME invitation object."""
1415

1516
def to_json(self) -> Mapping[str, Any]:
1617
return {

lightspark/objects/ClaimUmaInvitationWithIncentivesInput.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
@dataclass
1313
class ClaimUmaInvitationWithIncentivesInput:
1414
invitation_code: str
15+
"""The unique code that identifies this invitation and was shared by the inviter."""
1516

1617
invitee_uma: str
18+
"""The UMA of the user claiming the invitation. It will be sent to the inviter so that they can start transacting with the invitee."""
1719

1820
invitee_phone_hash: str
21+
"""The phone hash of the user getting the invitation."""
1922

2023
invitee_region: RegionCode
24+
"""The region of the user getting the invitation."""
2125

2226
def to_json(self) -> Mapping[str, Any]:
2327
return {

lightspark/objects/ClaimUmaInvitationWithIncentivesOutput.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ClaimUmaInvitationWithIncentivesOutput:
1111
requester: Requester
1212

1313
invitation_id: str
14+
"""An UMA.ME invitation object."""
1415

1516
def to_json(self) -> Mapping[str, Any]:
1617
return {

lightspark/objects/CreateApiTokenOutput.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def to_json(self) -> Mapping[str, Any]:
3838
api_token_client_id: client_id
3939
api_token_name: name
4040
api_token_permissions: permissions
41+
api_token_is_deleted: is_deleted
4142
}
4243
create_api_token_output_client_secret: client_secret
4344
}

0 commit comments

Comments
 (0)