inet

package
v2.0.0-...-8e500b6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package inet implements the Connector interface using an HTTP REST API.

Index

Constants

This section is empty.

Variables

View Source
var ErrVehicleNotAwake = protocol.NewError("vehicle not awake", false, false)

Functions

func SendFleetAPICommand

func SendFleetAPICommand(ctx context.Context, client *http.Client, userAgent, authHeader string, url string, command interface{}) ([]byte, error)

Types

type Connection

type Connection struct {
	UserAgent string
	// contains filtered or unexported fields
}

Connection implements the connector.Connector interface by POSTing commands to a server.

func NewConnection

func NewConnection(vin string, authHeader, serverURL, userAgent string) *Connection

NewConnection creates a Connection.

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) PreferredAuthMethod

func (c *Connection) PreferredAuthMethod() connector.AuthMethod

func (*Connection) Receive

func (c *Connection) Receive() <-chan []byte

func (*Connection) RetryInterval

func (c *Connection) RetryInterval() time.Duration

func (*Connection) Send

func (c *Connection) Send(ctx context.Context, buffer []byte) error

func (*Connection) SendFleetAPICommand

func (c *Connection) SendFleetAPICommand(ctx context.Context, endpoint string, command interface{}) ([]byte, error)

Sends a command to a Fleet API REST endpoint. Returns the response body and an error. The response body is not necessarily nil if the error is set.

func (*Connection) VIN

func (c *Connection) VIN() string

func (*Connection) Wakeup

func (c *Connection) Wakeup(ctx context.Context) error

type HttpError

type HttpError struct {
	Code    int
	Message string
}

func (*HttpError) Error

func (e *HttpError) Error() string

func (*HttpError) MayHaveSucceeded

func (e *HttpError) MayHaveSucceeded() bool

func (*HttpError) Temporary

func (e *HttpError) Temporary() bool

Jump to

Keyboard shortcuts

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