protohttp

package
v0.10.25 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 11 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 struct {
	HTTPClient
	// URL of a proto server endpoint
	URL string
}

Client implements driver by using Protocol Buffers over HTTP

func NewClient

func NewClient(config Config) Client

NewClient creates a a new client

func (*Client) Authorize

func (c *Client) Authorize(input driver.AuthorizeInput) driver.AuthorizeOutput

Authorize over http

func (*Client) FieldResolve

func (c *Client) FieldResolve(input driver.FieldResolveInput) driver.FieldResolveOutput

FieldResolve over http

func (*Client) InterfaceResolveType

InterfaceResolveType over http

func (*Client) ScalarParse

func (c *Client) ScalarParse(input driver.ScalarParseInput) driver.ScalarParseOutput

ScalarParse over http

func (*Client) ScalarSerialize

ScalarSerialize over http

func (*Client) SetSecrets

func (c *Client) SetSecrets(input driver.SetSecretsInput) driver.SetSecretsOutput

SetSecrets using http

func (*Client) Stream

Stream implements driver.Stream. Currently protocol buffer streaming is not supported over HTTP

func (*Client) SubscriptionConnection

SubscriptionConnection implements driver.SubscriptionConnection over HTTP

func (*Client) SubscriptionListen

SubscriptionListen implements driver.SubscriptionListen. Currently protocol buffer subscription listening is not supported over HTTP

func (*Client) UnionResolveType

UnionResolveType over http

type Config

type Config struct {
	Client *http.Client
	URL    string
}

Config for new .Client

type ErrorLogger

type ErrorLogger interface {
	Error(err error)
}

ErrorLogger logs unrecoverable errors while handling request

type HTTPClient

type HTTPClient interface {
	Post(url, contentType string, body io.Reader) (*http.Response, error)
}

HTTPClient for protocol buffer

type Handler

type Handler struct {
	Muxer
	ErrorLogger
}

Handler is a http.Handler for Protocol Buffers server

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface for Protocol Buffer server

type Muxer

type Muxer interface {
	Authorize(driver.AuthorizeInput) (bool, error)
	FieldResolve(driver.FieldResolveInput) (interface{}, error)
	InterfaceResolveType(driver.InterfaceResolveTypeInput) (string, error)
	SetSecrets(driver.SetSecretsInput) error
	ScalarParse(driver.ScalarParseInput) (interface{}, error)
	ScalarSerialize(driver.ScalarSerializeInput) (interface{}, error)
	UnionResolveType(driver.UnionResolveTypeInput) (string, error)
	SubscriptionConnection(driver.SubscriptionConnectionInput) (interface{}, error)
}

Muxer for Protocol Buffer handler

Jump to

Keyboard shortcuts

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