client

package
v0.0.0-...-40a7325 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	AddCommand(context.Context, *proto.BotCommand) (*empty.Empty, error)
	GetCommand(context.Context, *proto.Command) (*proto.BotCommand, error)
	ListCommands(context.Context, *empty.Empty) (*proto.BotCommands, error)
	UpdateCommand(context.Context, *proto.BotCommand) (*empty.Empty, error)
	DeleteCommand(context.Context, *proto.Command) (*empty.Empty, error)
}

Client represents a gRPC BotioCLient with basic CRUD methods.

func New

func New(addr string, jwt string, connOpt ConnOption) (Client, error)

New receives and addres, a JWT token for authentication and an option to the new Client's connection that is returned. If something goes wrong while applying the connection option it returns a non-nil error.

type ConnOption

type ConnOption func() (*grpc.ClientConn, error)

ConnOption represents a connection option for a new Client.

func WithInsecureConn

func WithInsecureConn(url string) ConnOption

WithInsecureConn receives an URL and creates a new non-secured connection that it will be assigned to a new Client at the moment of its creation. If something goes wrong while creating the insecure connection it returns a non-nil error.

func WithTLSSecureConn

func WithTLSSecureConn(url, server, crt, key, ca string) ConnOption

WithTLSSecureConn receives an URL and SSL related filenames and creates a TLS secured connection that it will be assigned to a new Client at the moment of its creation. If something goes wrong while loading the TLS configuration or while reading the received certificates it will return a non-nil error.

Jump to

Keyboard shortcuts

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