Skip to content

Commit

Permalink
Force expand PaymentsForInvoice fields. Rerun generator. (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
jklein24 authored Feb 23, 2024
2 parents 0d33727 + 24713e5 commit 7e2708b
Show file tree
Hide file tree
Showing 24 changed files with 553 additions and 103 deletions.
2 changes: 2 additions & 0 deletions objects/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ func (obj Account) GetTransactions(requester *requester.Requester, first *int64,
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
incoming_payment_transaction_hash: transaction_hash
incoming_payment_is_uma: is_uma
incoming_payment_destination: destination {
id
}
Expand Down Expand Up @@ -920,6 +921,7 @@ func (obj Account) GetTransactions(requester *requester.Requester, first *int64,
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
outgoing_payment_transaction_hash: transaction_hash
outgoing_payment_is_uma: is_uma
outgoing_payment_origin: origin {
id
}
Expand Down
4 changes: 4 additions & 0 deletions objects/all_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const (
... on ChannelOpeningTransaction {
...ChannelOpeningTransactionFragment
}
... on ChannelSnapshot {
...ChannelSnapshotFragment
}
... on Deposit {
...DepositFragment
}
Expand Down Expand Up @@ -78,6 +81,7 @@ const (
ChannelFragment +
ChannelClosingTransactionFragment +
ChannelOpeningTransactionFragment +
ChannelSnapshotFragment +
DepositFragment +
GraphNodeFragment +
HopFragment +
Expand Down
38 changes: 38 additions & 0 deletions objects/audit_log_actor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
package objects

import (
"encoding/json"
"fmt"
)

// AuditLogActor Audit log actor who called the GraphQL mutation
type AuditLogActor interface {
Entity

// GetTypename The typename of the object
GetTypename() string
}

func AuditLogActorUnmarshal(data map[string]interface{}) (AuditLogActor, error) {
if data == nil {
return nil, nil
}

dataJSON, err := json.Marshal(data)
if err != nil {
return nil, err
}

switch data["__typename"].(string) {
case "ApiToken":
var apiToken ApiToken
if err := json.Unmarshal(dataJSON, &apiToken); err != nil {
return nil, err
}
return apiToken, nil

default:
return nil, fmt.Errorf("unknown AuditLogActor type: %s", data["__typename"])
}
}
1 change: 1 addition & 0 deletions objects/cancel_invoice_input.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
package objects

// CancelInvoiceInput The unique identifier of the Invoice that should be cancelled. The invoice is supposed to be open, not settled and not expired.
type CancelInvoiceInput struct {
InvoiceId string `json:"cancel_invoice_input_invoice_id"`
}
1 change: 1 addition & 0 deletions objects/cancel_invoice_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package objects

import "github.com/lightsparkdev/go-sdk/types"

// CancelInvoiceOutput The Invoice that was cancelled. If the invoice was already cancelled, the same invoice is returned.
type CancelInvoiceOutput struct {
Invoice types.EntityWrapper `json:"cancel_invoice_output_invoice"`
}
Expand Down
59 changes: 48 additions & 11 deletions objects/channel_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,43 @@ import (
)

type ChannelSnapshot struct {
Channel types.EntityWrapper `json:"channel_snapshot_channel"`

Timestamp time.Time `json:"channel_snapshot_timestamp"`
// Id The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque string.
Id string `json:"channel_snapshot_id"`

// CreatedAt The date and time when the entity was first created.
CreatedAt time.Time `json:"channel_snapshot_created_at"`

// UpdatedAt The date and time when the entity was last updated.
UpdatedAt time.Time `json:"channel_snapshot_updated_at"`

LocalBalance *CurrencyAmount `json:"channel_snapshot_local_balance"`

LocalUnsettledBalance *CurrencyAmount `json:"channel_snapshot_local_unsettled_balance"`

LocalChannelReserve *CurrencyAmount `json:"channel_snapshot_local_channel_reserve"`

RemoteBalance *CurrencyAmount `json:"channel_snapshot_remote_balance"`

RemoteUnsettledBalance *CurrencyAmount `json:"channel_snapshot_remote_unsettled_balance"`

Channel types.EntityWrapper `json:"channel_snapshot_channel"`

// Deprecated: Use channel.local_channel_reserve instead.
LocalChannelReserve *CurrencyAmount `json:"channel_snapshot_local_channel_reserve"`

// Timestamp The timestamp that was used to query the snapshot of the channel
Timestamp time.Time `json:"channel_snapshot_timestamp"`

// Typename The typename of the object
Typename string `json:"__typename"`
}

const (
ChannelSnapshotFragment = `
fragment ChannelSnapshotFragment on ChannelSnapshot {
__typename
channel_snapshot_channel: channel {
id
}
channel_snapshot_timestamp: timestamp
channel_snapshot_id: id
channel_snapshot_created_at: created_at
channel_snapshot_updated_at: updated_at
channel_snapshot_local_balance: local_balance {
__typename
currency_amount_original_value: original_value
Expand All @@ -47,30 +61,53 @@ fragment ChannelSnapshotFragment on ChannelSnapshot {
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
channel_snapshot_local_channel_reserve: local_channel_reserve {
channel_snapshot_remote_balance: remote_balance {
__typename
currency_amount_original_value: original_value
currency_amount_original_unit: original_unit
currency_amount_preferred_currency_unit: preferred_currency_unit
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
channel_snapshot_remote_balance: remote_balance {
channel_snapshot_remote_unsettled_balance: remote_unsettled_balance {
__typename
currency_amount_original_value: original_value
currency_amount_original_unit: original_unit
currency_amount_preferred_currency_unit: preferred_currency_unit
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
channel_snapshot_remote_unsettled_balance: remote_unsettled_balance {
channel_snapshot_channel: channel {
id
}
channel_snapshot_local_channel_reserve: local_channel_reserve {
__typename
currency_amount_original_value: original_value
currency_amount_original_unit: original_unit
currency_amount_preferred_currency_unit: preferred_currency_unit
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
channel_snapshot_timestamp: timestamp
}
`
)

// GetId The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque string.
func (obj ChannelSnapshot) GetId() string {
return obj.Id
}

// GetCreatedAt The date and time when the entity was first created.
func (obj ChannelSnapshot) GetCreatedAt() time.Time {
return obj.CreatedAt
}

// GetUpdatedAt The date and time when the entity was last updated.
func (obj ChannelSnapshot) GetUpdatedAt() time.Time {
return obj.UpdatedAt
}

func (obj ChannelSnapshot) GetTypename() string {
return obj.Typename
}
3 changes: 3 additions & 0 deletions objects/claim_uma_invitation_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
package objects

type ClaimUmaInvitationInput struct {

// InvitationCode The unique code that identifies this invitation and was shared by the inviter.
InvitationCode string `json:"claim_uma_invitation_input_invitation_code"`

// InviteeUma The UMA of the user claiming the invitation. It will be sent to the inviter so that they can start transacting with the invitee.
InviteeUma string `json:"claim_uma_invitation_input_invitee_uma"`
}
2 changes: 2 additions & 0 deletions objects/claim_uma_invitation_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package objects
import "github.com/lightsparkdev/go-sdk/types"

type ClaimUmaInvitationOutput struct {

// Invitation An UMA.ME invitation object.
Invitation types.EntityWrapper `json:"claim_uma_invitation_output_invitation"`
}

Expand Down
5 changes: 5 additions & 0 deletions objects/claim_uma_invitation_with_incentives_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
package objects

type ClaimUmaInvitationWithIncentivesInput struct {

// InvitationCode The unique code that identifies this invitation and was shared by the inviter.
InvitationCode string `json:"claim_uma_invitation_with_incentives_input_invitation_code"`

// InviteeUma The UMA of the user claiming the invitation. It will be sent to the inviter so that they can start transacting with the invitee.
InviteeUma string `json:"claim_uma_invitation_with_incentives_input_invitee_uma"`

// InviteePhoneHash The phone hash of the user getting the invitation.
InviteePhoneHash string `json:"claim_uma_invitation_with_incentives_input_invitee_phone_hash"`

// InviteeRegion The region of the user getting the invitation.
InviteeRegion RegionCode `json:"claim_uma_invitation_with_incentives_input_invitee_region"`
}
2 changes: 2 additions & 0 deletions objects/claim_uma_invitation_with_incentives_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package objects
import "github.com/lightsparkdev/go-sdk/types"

type ClaimUmaInvitationWithIncentivesOutput struct {

// Invitation An UMA.ME invitation object.
Invitation types.EntityWrapper `json:"claim_uma_invitation_with_incentives_output_invitation"`
}

Expand Down
4 changes: 4 additions & 0 deletions objects/create_invitation_with_incentives_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
package objects

type CreateInvitationWithIncentivesInput struct {

// InviterUma The UMA of the user creating the invitation. It will be used to identify the inviter when receiving the invitation.
InviterUma string `json:"create_invitation_with_incentives_input_inviter_uma"`

// InviterPhoneHash The phone hash of the user creating the invitation.
InviterPhoneHash string `json:"create_invitation_with_incentives_input_inviter_phone_hash"`

// InviterRegion The region of the user creating the invitation.
InviterRegion RegionCode `json:"create_invitation_with_incentives_input_inviter_region"`
}
2 changes: 2 additions & 0 deletions objects/create_invitation_with_incentives_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package objects
import "github.com/lightsparkdev/go-sdk/types"

type CreateInvitationWithIncentivesOutput struct {

// Invitation The created invitation in the form of a string identifier.
Invitation types.EntityWrapper `json:"create_invitation_with_incentives_output_invitation"`
}

Expand Down
2 changes: 2 additions & 0 deletions objects/create_uma_invitation_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
package objects

type CreateUmaInvitationInput struct {

// InviterUma The UMA of the user creating the invitation. It will be used to identify the inviter when receiving the invitation.
InviterUma string `json:"create_uma_invitation_input_inviter_uma"`
}
2 changes: 2 additions & 0 deletions objects/create_uma_invitation_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package objects
import "github.com/lightsparkdev/go-sdk/types"

type CreateUmaInvitationOutput struct {

// Invitation The created invitation in the form of a string identifier.
Invitation types.EntityWrapper `json:"create_uma_invitation_output_invitation"`
}

Expand Down
6 changes: 6 additions & 0 deletions objects/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ func EntityUnmarshal(data map[string]interface{}) (Entity, error) {
return nil, err
}
return channelOpeningTransaction, nil
case "ChannelSnapshot":
var channelSnapshot ChannelSnapshot
if err := json.Unmarshal(dataJSON, &channelSnapshot); err != nil {
return nil, err
}
return channelSnapshot, nil
case "Deposit":
var deposit Deposit
if err := json.Unmarshal(dataJSON, &deposit); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions objects/incoming_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type IncomingPayment struct {
// TransactionHash The hash of this transaction, so it can be uniquely identified on the Lightning Network.
TransactionHash *string `json:"incoming_payment_transaction_hash"`

// IsUma Whether this payment is an UMA payment or not. NOTE: this field is only set if the invoice that is being paid has been created using the recommended `create_uma_invoice` function.
IsUma bool `json:"incoming_payment_is_uma"`

// Destination The recipient Lightspark node this payment was sent to.
Destination types.EntityWrapper `json:"incoming_payment_destination"`

Expand Down Expand Up @@ -64,6 +67,7 @@ fragment IncomingPaymentFragment on IncomingPayment {
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
incoming_payment_transaction_hash: transaction_hash
incoming_payment_is_uma: is_uma
incoming_payment_destination: destination {
id
}
Expand Down
9 changes: 9 additions & 0 deletions objects/incoming_payments_for_invoice_query_input.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
package objects

type IncomingPaymentsForInvoiceQueryInput struct {
InvoiceId string `json:"incoming_payments_for_invoice_query_input_invoice_id"`

// Statuses An optional filter to only query outgoing payments of given statuses.
Statuses *[]TransactionStatus `json:"incoming_payments_for_invoice_query_input_statuses"`
}
50 changes: 50 additions & 0 deletions objects/incoming_payments_for_invoice_query_output.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
package objects

type IncomingPaymentsForInvoiceQueryOutput struct {
Payments []IncomingPayment `json:"incoming_payments_for_invoice_query_output_payments"`
}

const (
IncomingPaymentsForInvoiceQueryOutputFragment = `
fragment IncomingPaymentsForInvoiceQueryOutputFragment on IncomingPaymentsForInvoiceQueryOutput {
__typename
incoming_payments_for_invoice_query_output_payments: payments {
__typename
incoming_payment_id: id
incoming_payment_created_at: created_at
incoming_payment_updated_at: updated_at
incoming_payment_status: status
incoming_payment_resolved_at: resolved_at
incoming_payment_amount: amount {
__typename
currency_amount_original_value: original_value
currency_amount_original_unit: original_unit
currency_amount_preferred_currency_unit: preferred_currency_unit
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
incoming_payment_transaction_hash: transaction_hash
incoming_payment_is_uma: is_uma
incoming_payment_destination: destination {
id
}
incoming_payment_payment_request: payment_request {
id
}
incoming_payment_uma_post_transaction_data: uma_post_transaction_data {
__typename
post_transaction_data_utxo: utxo
post_transaction_data_amount: amount {
__typename
currency_amount_original_value: original_value
currency_amount_original_unit: original_unit
currency_amount_preferred_currency_unit: preferred_currency_unit
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
}
}
}
}
`
)
Loading

0 comments on commit 7e2708b

Please sign in to comment.