api

package
v0.2.2-post.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 3 Imported by: 0

README

api

import "github.com/forestvpn/cli/api"

api is package containg the ApiClientWrapper wich is used as wgrest client.

See https://github.com/suquant/wgrest for more information.

Index

type ApiClientWrapper

ApiClientWrapper is a structure that wraps forestvpn_api.APIClient to extend it.

See https://github.com/forestvpn/api-client-go for more information.

type ApiClientWrapper struct {
    APIClient   *forestvpn_api.APIClient
    AccessToken string
}
func GetApiClient
func GetApiClient(accessToken string, apiHost string) ApiClientWrapper

GetApiClient is a factory function that returns the ApiClientWrapper structure. It configures and wraps an instance of forestvpn_api.APIClient.

See https://github.com/forestvpn/api-client-go for more information.

func (ApiClientWrapper) CreateDevice
func (w ApiClientWrapper) CreateDevice() (*forestvpn_api.Device, error)

CreateDevice sends a POST request to create a new device on the back-end after the user successfully logged in.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#createdevice for more information.

func (ApiClientWrapper) GetBillingFeatures
func (w ApiClientWrapper) GetBillingFeatures() ([]forestvpn_api.BillingFeature, error)

GetBillingFeatures is a method for getting locations available to the user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/BillingApi.md#listbillingfeatures for more information.

func (ApiClientWrapper) GetConnectedLocation
func (w ApiClientWrapper) GetConnectedLocation() (forestvpn_api.Location, error)
func (ApiClientWrapper) GetDevice
func (w ApiClientWrapper) GetDevice(id string) (*forestvpn_api.Device, error)

GetDevice is a method to get the device created on the registraton of the user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#getdevice for more information.

func (ApiClientWrapper) GetLocations
func (w ApiClientWrapper) GetLocations() ([]forestvpn_api.Location, error)

GetLocations is a method for getting all the locations available at back-end.

See https://github.com/forestvpn/api-client-go/blob/main/docs/GeoApi.md#listlocations for more information.

func (ApiClientWrapper) GetStatus
func (w ApiClientWrapper) GetStatus() (bool, error)
func (ApiClientWrapper) UpdateDevice
func (w ApiClientWrapper) UpdateDevice(deviceID string, locationID string) (*forestvpn_api.Device, error)

UpdateDevice updates an existing device for the user on the back-end.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#updatedevice for more information.

Generated by gomarkdoc

Documentation

Overview

api is package containg the ApiClientWrapper wich is used as wgrest client.

See https://github.com/suquant/wgrest for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClientWrapper

type ApiClientWrapper struct {
	APIClient   *forestvpn_api.APIClient
	AccessToken string
}

ApiClientWrapper is a structure that wraps forestvpn_api.APIClient to extend it.

See https://github.com/forestvpn/api-client-go for more information.

func GetApiClient

func GetApiClient(accessToken string, apiHost string) ApiClientWrapper

GetApiClient is a factory function that returns the ApiClientWrapper structure. It configures and wraps an instance of forestvpn_api.APIClient.

See https://github.com/forestvpn/api-client-go for more information.

func (ApiClientWrapper) CreateDevice

func (w ApiClientWrapper) CreateDevice() (*forestvpn_api.Device, error)

CreateDevice sends a POST request to create a new device on the back-end after the user successfully logged in.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#createdevice for more information.

func (ApiClientWrapper) DeleteDevice

func (w ApiClientWrapper) DeleteDevice(id string) error

func (ApiClientWrapper) GetBillingFeatures

func (w ApiClientWrapper) GetBillingFeatures() ([]forestvpn_api.BillingFeature, error)

GetBillingFeatures is a method for getting locations available to the user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/BillingApi.md#listbillingfeatures for more information.

func (ApiClientWrapper) GetDevice

func (w ApiClientWrapper) GetDevice(id string) (*forestvpn_api.Device, error)

GetDevice is a method to get the device created on the registraton of the user.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#getdevice for more information.

func (ApiClientWrapper) GetLocations

func (w ApiClientWrapper) GetLocations() ([]forestvpn_api.Location, error)

GetLocations is a method for getting all the locations available at back-end.

See https://github.com/forestvpn/api-client-go/blob/main/docs/GeoApi.md#listlocations for more information.

func (ApiClientWrapper) UpdateDevice

func (w ApiClientWrapper) UpdateDevice(deviceID string, locationID string) (*forestvpn_api.Device, error)

UpdateDevice updates an existing device for the user on the back-end.

See https://github.com/forestvpn/api-client-go/blob/main/docs/DeviceApi.md#updatedevice for more information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL