mirror of
https://github.com/callebtc/electronwall.git
synced 2025-12-17 15:14:25 +01:00
works
This commit is contained in:
@@ -4,32 +4,11 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/callebtc/electronwall/config"
|
||||
"github.com/machinebox/graphql"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type AutoGenerated struct {
|
||||
Data struct {
|
||||
GetNode struct {
|
||||
GraphInfo struct {
|
||||
Node struct {
|
||||
Alias string `json:"alias"`
|
||||
} `json:"node"`
|
||||
} `json:"graph_info"`
|
||||
} `json:"getNode"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
var simple_query = `query Node($pubkey: String!) {
|
||||
getNode(pubkey: $pubkey) {
|
||||
graph_info {
|
||||
node {
|
||||
alias
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
type Amboss_NodeInfoResponse struct {
|
||||
Socials struct {
|
||||
Info struct {
|
||||
@@ -178,7 +157,10 @@ func (c *AmbossClient) GetNodeInfo(pubkey string) (Amboss_NodeInfoResponse, erro
|
||||
graphqlRequest.Header.Set("Content-Type", "application/json")
|
||||
|
||||
var r_nested Amboss_NodeInfoResponse_Nested
|
||||
if err := graphqlClient.Run(context.Background(), graphqlRequest, &r_nested.Data); err != nil {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(config.Configuration.ApiRules.Amboss.Timeout))
|
||||
defer cancel()
|
||||
|
||||
if err := graphqlClient.Run(ctx, graphqlRequest, &r_nested.Data); err != nil {
|
||||
log.Errorf("[amboss] api error: %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user