gatewayv1alpha1connect

package
v1.10.0-20240111194952... Latest Latest
Warning

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

Go to latest
Published: unknown License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// KnitServiceFetchProcedure is the fully-qualified name of the KnitService's Fetch RPC.
	KnitServiceFetchProcedure = "/buf.knit.gateway.v1alpha1.KnitService/Fetch"
	// KnitServiceDoProcedure is the fully-qualified name of the KnitService's Do RPC.
	KnitServiceDoProcedure = "/buf.knit.gateway.v1alpha1.KnitService/Do"
	// KnitServiceListenProcedure is the fully-qualified name of the KnitService's Listen RPC.
	KnitServiceListenProcedure = "/buf.knit.gateway.v1alpha1.KnitService/Listen"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

View Source
const (
	// KnitServiceName is the fully-qualified name of the KnitService service.
	KnitServiceName = "buf.knit.gateway.v1alpha1.KnitService"
)

Variables

This section is empty.

Functions

func NewKnitServiceHandler

func NewKnitServiceHandler(svc KnitServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler)

NewKnitServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type KnitServiceClient

type KnitServiceClient interface {
	// Fetch is used to query methods that have no side effects (Get, List, Search).
	//
	// Only methods marked with the `idempotency_level` option `NO_SIDE_EFFECTS`
	// can be used with Fetch.
	//
	// If an error occurs during fetching an relation the entire request fails. In such cases it
	// returns the upstream error.
	//
	// `Fetch` can be cached.
	//
	// The default error handling strategy is `Throw`.
	Fetch(context.Context, *connect_go.Request[v1alpha1.FetchRequest]) (*connect_go.Response[v1alpha1.FetchResponse], error)
	// Do is used to perform operations that may have side effects (CRUD operations: Create, Replace, Update, Delete).
	//
	// Methods that are NOT marked with the `idempotency_level` option `NO_SIDE_EFFECTS`
	// can be used with `Do`.
	//
	// If an error occurs during fetching an relation the entire request fails. In such cases it returns
	// the upstream error.
	//
	// `Do` should NOT be cached.
	//
	// The default error handling strategy is `Catch`.
	Do(context.Context, *connect_go.Request[v1alpha1.DoRequest]) (*connect_go.Response[v1alpha1.DoResponse], error)
	// Listen is used to subscribe to server-only streaming methods.
	//
	// The stream is closed when upstream closes or on first error encountered. Errors can occur
	// while fetching relations.
	//
	// It is similar to `Fetch` but instead of returning a single response, it returns a stream of
	// responses. The `schema` field of the response will be present in the first response
	// message in the stream. All subsequent messages will skip the schema.
	//
	// The default error handling strategy is `Throw`. An error at the entry point will close the
	// stream.
	Listen(context.Context, *connect_go.Request[v1alpha1.ListenRequest]) (*connect_go.ServerStreamForClient[v1alpha1.ListenResponse], error)
}

KnitServiceClient is a client for the buf.knit.gateway.v1alpha1.KnitService service.

func NewKnitServiceClient

func NewKnitServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) KnitServiceClient

NewKnitServiceClient constructs a client for the buf.knit.gateway.v1alpha1.KnitService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type KnitServiceHandler

type KnitServiceHandler interface {
	// Fetch is used to query methods that have no side effects (Get, List, Search).
	//
	// Only methods marked with the `idempotency_level` option `NO_SIDE_EFFECTS`
	// can be used with Fetch.
	//
	// If an error occurs during fetching an relation the entire request fails. In such cases it
	// returns the upstream error.
	//
	// `Fetch` can be cached.
	//
	// The default error handling strategy is `Throw`.
	Fetch(context.Context, *connect_go.Request[v1alpha1.FetchRequest]) (*connect_go.Response[v1alpha1.FetchResponse], error)
	// Do is used to perform operations that may have side effects (CRUD operations: Create, Replace, Update, Delete).
	//
	// Methods that are NOT marked with the `idempotency_level` option `NO_SIDE_EFFECTS`
	// can be used with `Do`.
	//
	// If an error occurs during fetching an relation the entire request fails. In such cases it returns
	// the upstream error.
	//
	// `Do` should NOT be cached.
	//
	// The default error handling strategy is `Catch`.
	Do(context.Context, *connect_go.Request[v1alpha1.DoRequest]) (*connect_go.Response[v1alpha1.DoResponse], error)
	// Listen is used to subscribe to server-only streaming methods.
	//
	// The stream is closed when upstream closes or on first error encountered. Errors can occur
	// while fetching relations.
	//
	// It is similar to `Fetch` but instead of returning a single response, it returns a stream of
	// responses. The `schema` field of the response will be present in the first response
	// message in the stream. All subsequent messages will skip the schema.
	//
	// The default error handling strategy is `Throw`. An error at the entry point will close the
	// stream.
	Listen(context.Context, *connect_go.Request[v1alpha1.ListenRequest], *connect_go.ServerStream[v1alpha1.ListenResponse]) error
}

KnitServiceHandler is an implementation of the buf.knit.gateway.v1alpha1.KnitService service.

type UnimplementedKnitServiceHandler

type UnimplementedKnitServiceHandler struct{}

UnimplementedKnitServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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