Skip to content

Latest commit

 

History

History
717 lines (475 loc) · 21.5 KB

File metadata and controls

717 lines (475 loc) · 21.5 KB

\NodeAPI

All URIs are relative to https://api.fvpn.io

Method HTTP request Description
CreateNode Post /v1/nodes/ Create a new node
CreateNodeCondition Post /v1/nodes/{node_id}/conditions/ Create a new node condition
CreateNodeDataUsageReport Post /v1/nodes/{node_id}/data-usage-report/ Create a new node data usage
DeleteNode Delete /v1/nodes/{node_id}/ Delete a node
GetNode Get /v1/nodes/{node_id}/ Retrieve a node
GetNodeConditions Get /v1/nodes/{node_id}/conditions/ List node conditions
GetNodeDevices Get /v1/nodes/{node_id}/devices/ List node devices
GetNodes Get /v1/nodes/ List nodes
PartialUpdateNode Patch /v1/nodes/{node_id}/ Partially update a device
UpdateNode Put /v1/nodes/{node_id}/ Update a node

CreateNode

Node CreateNode(ctx).NodeRequest(nodeRequest).Execute()

Create a new node

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeRequest := *openapiclient.NewNodeRequest("Hostname_example", []string{"IpAddresses_example"}, []string{"Tags_example"}, "PubKey_example", []string{"Ports_example"}) // NodeRequest | 

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

Path Parameters

Other Parameters

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

Name Type Description Notes
nodeRequest NodeRequest

Return type

Node

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: application/json, multipart/form-data, application/x-www-form-urlencoded
  • Accept: application/json

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

CreateNodeCondition

CreateNodeCondition(ctx, nodeId).NodeConditionsRequest(nodeConditionsRequest).Execute()

Create a new node condition

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | 
	nodeConditionsRequest := *openapiclient.NewNodeConditionsRequest([]openapiclient.NodeConditionRequest{*openapiclient.NewNodeConditionRequest(openapiclient.Condition("ready"), false)}) // NodeConditionsRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.NodeAPI.CreateNodeCondition(context.Background(), nodeId).NodeConditionsRequest(nodeConditionsRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `NodeAPI.CreateNodeCondition``: %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.
nodeId string

Other Parameters

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

Name Type Description Notes

nodeConditionsRequest | NodeConditionsRequest | |

Return type

(empty response body)

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: application/json, multipart/form-data, application/x-www-form-urlencoded
  • Accept: Not defined

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

CreateNodeDataUsageReport

CreateNodeDataUsageReport(ctx, nodeId).NodeDataUsageReportRequest(nodeDataUsageReportRequest).Execute()

Create a new node data usage

Example

package main

import (
	"context"
	"fmt"
	"os"
    "time"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.
	nodeDataUsageReportRequest := *openapiclient.NewNodeDataUsageReportRequest(time.Now(), []openapiclient.NodeDataUsageItemRequest{*openapiclient.NewNodeDataUsageItemRequest("Id_example", "Proto_example")}) // NodeDataUsageReportRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.NodeAPI.CreateNodeDataUsageReport(context.Background(), nodeId).NodeDataUsageReportRequest(nodeDataUsageReportRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `NodeAPI.CreateNodeDataUsageReport``: %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.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

nodeDataUsageReportRequest | NodeDataUsageReportRequest | |

Return type

(empty response body)

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: application/json, multipart/form-data, application/x-www-form-urlencoded
  • Accept: Not defined

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

DeleteNode

DeleteNode(ctx, nodeId).Execute()

Delete a node

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.NodeAPI.DeleteNode(context.Background(), nodeId).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `NodeAPI.DeleteNode``: %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.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

Return type

(empty response body)

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

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

GetNode

Node GetNode(ctx, nodeId).Execute()

Retrieve a node

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

Return type

Node

Authorization

bearerToken, apiKey

HTTP request headers

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

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

GetNodeConditions

[]NodeCondition GetNodeConditions(ctx, nodeId).Status(status).Execute()

List node conditions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | 
	status := true // bool | Filter by status: true (active), false (inactive), or all (both). Default is to show active and recently failed.  * `true` - True * `false` - False * `all` - All (optional)

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
nodeId string

Other Parameters

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

Name Type Description Notes

status | bool | Filter by status: true (active), false (inactive), or all (both). Default is to show active and recently failed. * `true` - True * `false` - False * `all` - All |

Return type

[]NodeCondition

Authorization

bearerToken, apiKey

HTTP request headers

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

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

GetNodeDevices

[]NodeDevice GetNodeDevices(ctx, nodeId).Execute()

List node devices

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

Return type

[]NodeDevice

Authorization

bearerToken, apiKey

HTTP request headers

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

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

GetNodes

PaginatedNodeList GetNodes(ctx).Countries(countries).Cursor(cursor).Distance(distance).IsExitNode(isExitNode).Lat(lat).Limit(limit).Lon(lon).OrderByDistance(orderByDistance).Q(q).Status(status).Tags(tags).Types(types).Execute()

List nodes

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	countries := []string{"Inner_example"} // []string | Filter by country codes (optional)
	cursor := "cursor_example" // string | The pagination cursor value. (optional)
	distance := "distance_example" // string | Maximum distance (format: 10km, 5mi) (optional)
	isExitNode := true // bool | Filter by exit node status (optional)
	lat := float64(1.2) // float64 | Latitude for location search (optional)
	limit := int32(56) // int32 | Number of results to return per page. (optional)
	lon := float64(1.2) // float64 | Longitude for location search (optional)
	orderByDistance := true // bool | Order by distance (optional)
	q := "q_example" // string | Search nodes by hostname, tags, OS, OS arch, distro, distro codename, or public key (optional)
	status := "status_example" // string | Filter nodes by status: all (default), online, or offline (optional)
	tags := "tags_example" // string | Filter nodes by tags (comma-separated list of tag names) (optional)
	types := []string{"Types_example"} // []string | Filter nodes by type: all, wireguard, quantum, bridge, or proxy. Multiple values can be selected. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.NodeAPI.GetNodes(context.Background()).Countries(countries).Cursor(cursor).Distance(distance).IsExitNode(isExitNode).Lat(lat).Limit(limit).Lon(lon).OrderByDistance(orderByDistance).Q(q).Status(status).Tags(tags).Types(types).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `NodeAPI.GetNodes``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetNodes`: PaginatedNodeList
	fmt.Fprintf(os.Stdout, "Response from `NodeAPI.GetNodes`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
countries []string Filter by country codes
cursor string The pagination cursor value.
distance string Maximum distance (format: 10km, 5mi)
isExitNode bool Filter by exit node status
lat float64 Latitude for location search
limit int32 Number of results to return per page.
lon float64 Longitude for location search
orderByDistance bool Order by distance
q string Search nodes by hostname, tags, OS, OS arch, distro, distro codename, or public key
status string Filter nodes by status: all (default), online, or offline
tags string Filter nodes by tags (comma-separated list of tag names)
types []string Filter nodes by type: all, wireguard, quantum, bridge, or proxy. Multiple values can be selected.

Return type

PaginatedNodeList

Authorization

bearerToken, apiKey

HTTP request headers

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

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

PartialUpdateNode

Node PartialUpdateNode(ctx, nodeId).PatchedNodeRequest(patchedNodeRequest).Execute()

Partially update a device

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.
	patchedNodeRequest := *openapiclient.NewPatchedNodeRequest() // PatchedNodeRequest |  (optional)

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

patchedNodeRequest | PatchedNodeRequest | |

Return type

Node

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: application/json, multipart/form-data, application/x-www-form-urlencoded
  • Accept: application/json

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

UpdateNode

Node UpdateNode(ctx, nodeId).NodeRequest(nodeRequest).Execute()

Update a node

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/forestvpn/fvpn-api-go"
)

func main() {
	nodeId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | A UUID string identifying this Node.
	nodeRequest := *openapiclient.NewNodeRequest("Hostname_example", []string{"IpAddresses_example"}, []string{"Tags_example"}, "PubKey_example", []string{"Ports_example"}) // NodeRequest | 

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
nodeId string A UUID string identifying this Node.

Other Parameters

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

Name Type Description Notes

nodeRequest | NodeRequest | |

Return type

Node

Authorization

bearerToken, apiKey

HTTP request headers

  • Content-Type: application/json, multipart/form-data, application/x-www-form-urlencoded
  • Accept: application/json

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