tidbyt

package
v0.0.0-...-b132378 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tidbyt provides a helpful client to the Tidbyt API. See more at https://tidbyt.dev/

Index

Constants

View Source
const (
	// TidbytDeviceIDEnv is the environment variable that NewConfigFromEnv is looking for when setting the device ID.
	TidbytDeviceIDEnv = "TIDBYT_DEVICE_ID"

	// TidbytTokenEnv is the environment variable that NewConfigFromEnv is looking for when setting the token.
	TidbyTokenEnv = "TIDBYT_AUTH_TOKEN"
)
View Source
const (
	// APIAddress is the publicly provided API address for Tidbyt.
	APIAddress = "api.tidbyt.com"

	// APIPort is the publicly provided API port for Tidbyt.
	APIPort = "443"
)

Variables

This section is empty.

Functions

func NewTidbytAPIConn

func NewTidbytAPIConn(token string) (*grpc.ClientConn, error)

NewTidbytAPIConn creates a new connection to the Tidbyt gRPC API. This is used both to setup a new client and to use reflection in generating the client.

Types

type Config

type Config struct {
	// DeviceID is the DeviceID used to make API requests. It probably shouldn't live here in retrospect.
	DeviceID string

	// Token is the API token generated from the Tidbyt app used to communicate with the Tidbyt API.
	Token string
}

Config is a helper to provide configuration values when creating a Tidbyt client.

func NewConfigFromEnv

func NewConfigFromEnv() (*Config, error)

NewConfigFromEnv is a helper to generate a config object from environment variables.

type TidbytClient

type TidbytClient struct {
	publicapi.PublicAPIClient
	// contains filtered or unexported fields
}

TidbytClient is a wrapper around the generated PublicAPIClient so one does not have to write the boiler plate to setup a connection.

func NewTidbytClient

func NewTidbytClient(token string) (*TidbytClient, error)

NewTidbytClient setups a gRPC connection with a client to communicate with the Tidbyt API. Be sure to close the connection with the provided Close() method when you're done with it.

func (*TidbytClient) Close

func (t *TidbytClient) Close() error

Close closes the underlying connection. Please close your connections!

Jump to

Keyboard shortcuts

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