Skip to content

forestvpn/fvpn-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for fvpn

ForestVPN API Documentation

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 3.0.0
  • Package version: 1.0.0
  • Generator version: 7.13.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://forestvpn.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import fvpn "github.com/forestvpn/fvpn-api-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value fvpn.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), fvpn.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value fvpn.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), fvpn.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using fvpn.ContextOperationServerIndices and fvpn.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), fvpn.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), fvpn.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

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

Class Method HTTP request Description
AccountAPI ApproveDeviceCode Post /v1/account/codes/{code}/approve/ Approve a device authentication code
AccountAPI CreateAccount Post /v1/accounts/ Create a new account
AccountAPI CreateDeviceCode Post /v1/account/codes/ Create a device authentication code
AccountAPI DeleteCurrentAccount Delete /v1/account/ Delete the current account
AccountAPI GetAccountTokenPair Post /v1/account/token/ Get account token pair
AccountAPI GetCurrentAccount Get /v1/account/ Retrieve the current account
AccountAPI GetCurrentAccountBillingUsage Get /v1/account/billing-usage/ Retrieve current account billing usage
AccountAPI GetDeviceCode Get /v1/account/codes/{code}/ Check device code
AccountAPI RefreshAccountToken Post /v1/account/token/refresh/ Refresh account token
BillingAPI CancelSubscription Delete /v1/billing/subscriptions/{subscription_id}/ Cancel subscription
BillingAPI ChangeSubscriptionPlan Post /v1/billing/subscriptions/{subscription_id}/change-plan/ Change subscription plan
BillingAPI DeletePaymentMethod Delete /v1/billing/payment-methods/{payment_method_id}/ Delete a payment method
BillingAPI GetBillingAccount Get /v1/billing/account/ Retrieve the current account
BillingAPI GetBillingOptions Get /v1/billing/options/ Retrieve billing options
BillingAPI GetCurrencies Get /v1/billing/currencies/ Retrieve all available currencies
BillingAPI GetCurrentSubscription Get /v1/billing/current-subscription/ Retrieve the current subscription
BillingAPI GetCurrentWallet Get /v1/billing/current-wallet/ Retrieve the current wallet
BillingAPI GetEntitlement Get /v1/billing/entitlements/{entitlement_id}/ Retrieve a specific entitlement
BillingAPI GetEntitlements Get /v1/billing/entitlements/ List account entitlements
BillingAPI GetPaymentMethod Get /v1/billing/payment-methods/{payment_method_id}/ Retrieve a payment method
BillingAPI GetPaymentMethods Get /v1/billing/payment-methods/ List all payment methods
BillingAPI GetPlanBySlug Get /v1/billing/plans/{slug}/ Retrieve a plan
BillingAPI GetPlanTimeline Get /v1/billing/plans/timeline/ Get billing timeline for a plan
BillingAPI GetPlans Get /v1/billing/plans/ List all plans
BillingAPI GetSubscription Get /v1/billing/subscriptions/{subscription_id}/ Retrieve subscription
BillingAPI GetSubscriptions Get /v1/billing/subscriptions/ List subscriptions
BillingAPI GetWallet Get /v1/billing/wallets/{wallet_id}/ Retrieve wallet details
BillingAPI GetWalletTransaction Get /v1/billing/transactions/{transaction_id}/ Retrieve transaction details
BillingAPI GetWalletTransactions Get /v1/billing/transactions/ List wallet transactions
BillingAPI GetWallets Get /v1/billing/wallets/ List wallets
BillingAPI ReactivateSubscription Post /v1/billing/subscriptions/{subscription_id}/reactivate/ Reactivate subscription
BillingAPI SetDefaultPaymentMethod Post /v1/billing/account/set-default-payment-method/ Set the default payment method for the account
BillingAPI SubscribeToPlan Post /v1/billing/subscriptions/ Subscribe to a plan
CloudpaymentsAPI CompleteCloudpaymentsPaymentMethodThreeDs Post /v1/billing/cloudpayments/payment-methods/{payment_method_id}/complete-3ds/ Complete 3D Secure authentication
CloudpaymentsAPI CreateCloudpaymentsPaymentMethod Post /v1/billing/cloudpayments/payment-methods/ Create a new payment method
CloudpaymentsAPI GetCloudpaymentsPaymentMethod Get /v1/billing/cloudpayments/payment-methods/{payment_method_id}/ Retrieve a payment method
DeviceAPI CreateDevice Post /v1/devices/ Create a new account
DeviceAPI DeleteDevice Delete /v1/devices/{device_id}/ Delete a device
DeviceAPI GetDashboardAnalytics Get /v1/devices/analytics/dashboard/ Get device data usage analytics for dashboard
DeviceAPI GetDevice Get /v1/devices/{device_id}/ Retrieve a device
DeviceAPI GetDeviceAnalytics Get /v1/devices/{device_id}/analytics/ Get data usage analytics for a specific device
DeviceAPI GetDeviceNode Get /v1/devices/{device_id}/node/ Get the node of a device
DeviceAPI GetDevices Get /v1/devices/ List all devices
DeviceAPI PartialUpdateDevice Patch /v1/devices/{device_id}/ Partially update a device
DeviceAPI SetDeviceNode Post /v1/devices/{device_id}/set-node/ Set a node on a device
DeviceAPI UpdateDevice Put /v1/devices/{device_id}/ Update a device
GeoAPI GetCountries Get /v1/countries/ List countries
GeoAPI GetCountry Get /v1/countries/{country_id}/ Retrieve country
GeoAPI GetLocation Get /v1/locations/{place_id}/ Retrieve location
GeoAPI GetLocations Get /v1/locations/ List locations
GeoAPI GetRegion Get /v1/regions/{region_id}/ Retrieve region
GeoAPI GetRegions Get /v1/regions/ List regions
NodeAPI CreateNode Post /v1/nodes/ Create a new node
NodeAPI CreateNodeCondition Post /v1/nodes/{node_id}/conditions/ Create a new node condition
NodeAPI CreateNodeDataUsageReport Post /v1/nodes/{node_id}/data-usage-report/ Create a new node data usage
NodeAPI DeleteNode Delete /v1/nodes/{node_id}/ Delete a node
NodeAPI GetNode Get /v1/nodes/{node_id}/ Retrieve a node
NodeAPI GetNodeConditions Get /v1/nodes/{node_id}/conditions/ List node conditions
NodeAPI GetNodeDevices Get /v1/nodes/{node_id}/devices/ List node devices
NodeAPI GetNodes Get /v1/nodes/ List nodes
NodeAPI PartialUpdateNode Patch /v1/nodes/{node_id}/ Partially update a device
NodeAPI UpdateNode Put /v1/nodes/{node_id}/ Update a node
ProviderAPI GetProvider Get /v1/providers/{provider_id}/ Retrieve a provider
ProviderAPI GetProviders Get /v1/providers/ List all providers
StripeAPI CreateStripeSetupIntent Post /v1/billing/stripe/setup-intents/ Create a new stripe setup intent

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

apiKey

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: apiKey and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		fvpn.ContextAPIKeys,
		map[string]fvpn.APIKey{
			"apiKey": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

bearerToken

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), fvpn.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

A Go library for the ForestVPN API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published