Skip to content

Commit

Permalink
Merge pull request #21 from BuxOrg/update-metadata-2
Browse files Browse the repository at this point in the history
Fixed graphql return types when updating metadata
  • Loading branch information
mergify[bot] authored Mar 29, 2022
2 parents 4115ec9 + 2e6768a commit 16539ea
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions transports/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ type XPubData struct {
XPub *bux.Xpub `json:"xpub"`
}

// XPubMetadataData is the xpub data for the metadata mutation
type XPubMetadataData struct {
XPub *bux.Xpub `json:"xpub_metadata"`
}

// AccessKeyData is the access key data
type AccessKeyData struct {
AccessKey *bux.AccessKey `json:"access_key"`
Expand All @@ -50,6 +55,11 @@ type DestinationData struct {
Destination *bux.Destination `json:"destination"`
}

// DestinationMetadataData is the destination data for the metadata mutation
type DestinationMetadataData struct {
Destination *bux.Destination `json:"destination_metadata"`
}

// DestinationsData is a slice of destination data
type DestinationsData struct {
Destinations []*bux.Destination `json:"destinations"`
Expand All @@ -65,6 +75,11 @@ type TransactionData struct {
Transaction *bux.Transaction `json:"transaction"`
}

// TransactionMetadataData is a transaction for the metadata mutation
type TransactionMetadataData struct {
Transaction *bux.Transaction `json:"transaction_metadata"`
}

// TransactionsData is a slice of transactions
type TransactionsData struct {
Transactions []*bux.Transaction `json:"transactions"`
Expand Down Expand Up @@ -205,7 +220,7 @@ func (g *TransportGraphQL) UpdateXPubMetadata(ctx context.Context, metadata *bux
FieldMetadata: processMetadata(metadata),
}

var respData XPubData
var respData XPubMetadataData
if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil {
return nil, err
}
Expand Down Expand Up @@ -458,7 +473,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByID(ctx context.Context, id
FieldMetadata: processMetadata(metadata),
}

var respData DestinationData
var respData DestinationMetadataData
if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil {
return nil, err
}
Expand Down Expand Up @@ -493,7 +508,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByAddress(ctx context.Contex
FieldMetadata: processMetadata(metadata),
}

var respData DestinationData
var respData DestinationMetadataData
if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil {
return nil, err
}
Expand Down Expand Up @@ -528,7 +543,7 @@ func (g *TransportGraphQL) UpdateDestinationMetadataByLockingScript(ctx context.
FieldMetadata: processMetadata(metadata),
}

var respData DestinationData
var respData DestinationMetadataData
if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil {
return nil, err
}
Expand Down Expand Up @@ -835,7 +850,7 @@ func (g *TransportGraphQL) UpdateTransactionMetadata(ctx context.Context, txID s
FieldMetadata: processMetadata(metadata),
}

var respData TransactionData
var respData TransactionMetadataData
if err := g.doGraphQLQuery(ctx, reqBody, variables, &respData); err != nil {
return nil, err
}
Expand Down

0 comments on commit 16539ea

Please sign in to comment.