Skip to content

Latest commit

 

History

History
750 lines (484 loc) · 18.2 KB

NodeApi.md

File metadata and controls

750 lines (484 loc) · 18.2 KB

\NodeApi

All URIs are relative to http://localhost

Method HTTP request Description
DistrustPeer Delete /v1/node/peers/trusted/{peer} Distrust a peering node
GenerateDKS Post /v1/node/dks Generate a new distributed key
GetAllPeers Get /v1/node/peers Get basic information about all configured peers
GetConfiguration Get /v1/node/config Return the Wasp configuration
GetDKSInfo Get /v1/node/dks/{sharedAddress} Get information about the shared address DKS configuration
GetInfo Get /v1/node/info Returns private information about this node.
GetPeeringIdentity Get /v1/node/peers/identity Get basic peer info of the current node
GetTrustedPeers Get /v1/node/peers/trusted Get trusted peers
GetVersion Get /v1/node/version Returns the node version.
OwnerCertificate Get /v1/node/owner/certificate Gets the node owner
ShutdownNode Post /v1/node/shutdown Shut down the node
TrustPeer Post /v1/node/peers/trusted Trust a peering node

DistrustPeer

DistrustPeer(ctx, peer).Execute()

Distrust a peering node

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    peer := "peer_example" // string | Name or PubKey (hex) of the trusted peer

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.DistrustPeer(context.Background(), peer).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.DistrustPeer``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
peer string Name or PubKey (hex) of the trusted peer

Other Parameters

Other parameters are passed through a pointer to a apiDistrustPeerRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GenerateDKS

DKSharesInfo GenerateDKS(ctx).DKSharesPostRequest(dKSharesPostRequest).Execute()

Generate a new distributed key

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    dKSharesPostRequest := *openapiclient.NewDKSharesPostRequest([]string{"PeerIdentities_example"}, uint32(123), uint32(123)) // DKSharesPostRequest | Request parameters

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GenerateDKS(context.Background()).DKSharesPostRequest(dKSharesPostRequest).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GenerateDKS``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GenerateDKS`: DKSharesInfo
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GenerateDKS`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGenerateDKSRequest struct via the builder pattern

Name Type Description Notes
dKSharesPostRequest DKSharesPostRequest Request parameters

Return type

DKSharesInfo

Authorization

Authorization

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetAllPeers

[]PeeringNodeStatusResponse GetAllPeers(ctx).Execute()

Get basic information about all configured peers

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetAllPeers(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetAllPeers``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetAllPeers`: []PeeringNodeStatusResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetAllPeers`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetAllPeersRequest struct via the builder pattern

Return type

[]PeeringNodeStatusResponse

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetConfiguration

map[string]string GetConfiguration(ctx).Execute()

Return the Wasp configuration

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetConfiguration(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetConfiguration``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetConfiguration`: map[string]string
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetConfiguration`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetConfigurationRequest struct via the builder pattern

Return type

map[string]string

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetDKSInfo

DKSharesInfo GetDKSInfo(ctx, sharedAddress).Execute()

Get information about the shared address DKS configuration

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    sharedAddress := "sharedAddress_example" // string | SharedAddress (Bech32)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetDKSInfo(context.Background(), sharedAddress).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetDKSInfo``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetDKSInfo`: DKSharesInfo
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetDKSInfo`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
sharedAddress string SharedAddress (Bech32)

Other Parameters

Other parameters are passed through a pointer to a apiGetDKSInfoRequest struct via the builder pattern

Name Type Description Notes

Return type

DKSharesInfo

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetInfo

InfoResponse GetInfo(ctx).Execute()

Returns private information about this node.

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetInfo(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetInfo``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetInfo`: InfoResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetInfo`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetInfoRequest struct via the builder pattern

Return type

InfoResponse

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPeeringIdentity

PeeringNodeIdentityResponse GetPeeringIdentity(ctx).Execute()

Get basic peer info of the current node

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetPeeringIdentity(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetPeeringIdentity``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetPeeringIdentity`: PeeringNodeIdentityResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetPeeringIdentity`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetPeeringIdentityRequest struct via the builder pattern

Return type

PeeringNodeIdentityResponse

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTrustedPeers

[]PeeringNodeIdentityResponse GetTrustedPeers(ctx).Execute()

Get trusted peers

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetTrustedPeers(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetTrustedPeers``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetTrustedPeers`: []PeeringNodeIdentityResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetTrustedPeers`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetTrustedPeersRequest struct via the builder pattern

Return type

[]PeeringNodeIdentityResponse

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetVersion

VersionResponse GetVersion(ctx).Execute()

Returns the node version.

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.GetVersion(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetVersion``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetVersion`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetVersion`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetVersionRequest struct via the builder pattern

Return type

VersionResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

OwnerCertificate

NodeOwnerCertificateResponse OwnerCertificate(ctx).Execute()

Gets the node owner

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.OwnerCertificate(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.OwnerCertificate``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `OwnerCertificate`: NodeOwnerCertificateResponse
    fmt.Fprintf(os.Stdout, "Response from `NodeApi.OwnerCertificate`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiOwnerCertificateRequest struct via the builder pattern

Return type

NodeOwnerCertificateResponse

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ShutdownNode

ShutdownNode(ctx).Execute()

Shut down the node

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.ShutdownNode(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.ShutdownNode``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiShutdownNodeRequest struct via the builder pattern

Return type

(empty response body)

Authorization

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

TrustPeer

TrustPeer(ctx).PeeringTrustRequest(peeringTrustRequest).Execute()

Trust a peering node

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    peeringTrustRequest := *openapiclient.NewPeeringTrustRequest("Name_example", "localhost:4000", "0x0000") // PeeringTrustRequest | Info of the peer to trust

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.NodeApi.TrustPeer(context.Background()).PeeringTrustRequest(peeringTrustRequest).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.TrustPeer``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiTrustPeerRequest struct via the builder pattern

Name Type Description Notes
peeringTrustRequest PeeringTrustRequest Info of the peer to trust

Return type

(empty response body)

Authorization

Authorization

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]