protomodel

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	errorhandling.Accumulator
	ProtoInfo pbinfo.Info
	Services  []*Service
}

Model is a data model encapsulating the relevant information for a REST-proto transcoding for various services defined via annotated protocol buffers.

func (*Model) AddService

func (model *Model) AddService(service *Service) *Service

AddService adds `service` to this Service.

func (*Model) String

func (model *Model) String() string

String returns a string representation of this Model.

type RESTBinding

type RESTBinding struct {
	// Index of the binding for this method. Since methods could contain multiple bindings, we
	// will need a way to identify each binding uniquely.
	Index int

	// The name of the method for which this is a binding.
	ProtoMethod string

	// The URL pattern of the binding.
	RESTPattern *RESTRequestPattern

	// The fields in the request body: either none (empty string), a single field (top-level
	// request field, non-dotted), or all not captured in the URL ("*").
	BodyField string
}

RESTBinding encapsulates the information contained in a protocol buffer HTTP annotation.

func (*RESTBinding) String

func (binding *RESTBinding) String() string

String returns a string representation of this RESTBinding.

type RESTRequestPattern

type RESTRequestPattern struct {
	HTTPMethod string // HTTP verb
	Pattern    string // the URL pattern
}

RESTRequestPattern encapsulates the information in an individual REST binding within an HTTP annotation.

func (*RESTRequestPattern) String

func (binding *RESTRequestPattern) String() string

String returns a string representation of this RESTRequestPattern.

type Service

type Service struct {
	Descriptor   *descriptorpb.ServiceDescriptorProto // maybe not needed
	Name         string
	TypeName     string
	RESTBindings []*RESTBinding
}

Service is a data model encapsulating the information relevant to REST-proto transcoding about a proto-defined service.

func (*Service) AddBinding

func (service *Service) AddBinding(binding *RESTBinding)

AddBinding adds a RESTBinding to this Service.

func (*Service) String

func (service *Service) String() string

String returns a string representation of this Service.

Jump to

Keyboard shortcuts

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