gurl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCast       = errors.New("type cannot be casted to the desired")
	ErrNoResponse = errors.New("No response received. Has the request been ever sent?")
)

predefined errors.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to make grpc requests to remote server.

func NewClient

func NewClient(ctx context.Context, params Params) (*Client, error)

NewClient makes new instance of Client.

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, req *Request) (*FileResponse, error)

GetFile downloads file with the requested GRPC method. Requested GRPC method must have output of type google.api.HttpBody.

type ErrMethodNotFound

type ErrMethodNotFound string

ErrMethodNotFound indicates that the requested method was not found in service.

func (ErrMethodNotFound) Error

func (e ErrMethodNotFound) Error() string

Error returns the string representation of the error.

type ErrOutputNotSupported

type ErrOutputNotSupported string

ErrOutputNotSupported indicates that handling the output of the GRPC method is currently not supported.

func (ErrOutputNotSupported) Error

func (e ErrOutputNotSupported) Error() string

Error returns the string representation of the error.

type FileResponse

type FileResponse struct {
	Headers  metadata.MD
	Message  proto.Message
	Trailers metadata.MD
	Status   *status.Status
	Data     io.ReadCloser
}

FileResponse describes a GRPC response.

func (*FileResponse) FileName

func (f *FileResponse) FileName() string

FileName returns the name of file received from response headers.

type Params

type Params struct {
	Addr          string
	Insecure      bool
	ProtoSetPaths []string
}

Params describes parameters of grpc client.

type Request

type Request struct {
	MethodURI string
	Headers   []string // in form or "HeaderName: HeaderValue", see grpcurl.MetadataFromHeaders
	JSONBody  io.ReadCloser
}

Request describes a GRPC request.

Jump to

Keyboard shortcuts

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