conformancev1connect

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ConformanceServiceUnaryProcedure is the fully-qualified name of the ConformanceService's Unary
	// RPC.
	ConformanceServiceUnaryProcedure = "/connectrpc.conformance.v1.ConformanceService/Unary"
	// ConformanceServiceServerStreamProcedure is the fully-qualified name of the ConformanceService's
	// ServerStream RPC.
	ConformanceServiceServerStreamProcedure = "/connectrpc.conformance.v1.ConformanceService/ServerStream"
	// ConformanceServiceClientStreamProcedure is the fully-qualified name of the ConformanceService's
	// ClientStream RPC.
	ConformanceServiceClientStreamProcedure = "/connectrpc.conformance.v1.ConformanceService/ClientStream"
	// ConformanceServiceBidiStreamProcedure is the fully-qualified name of the ConformanceService's
	// BidiStream RPC.
	ConformanceServiceBidiStreamProcedure = "/connectrpc.conformance.v1.ConformanceService/BidiStream"
	// ConformanceServiceUnimplementedProcedure is the fully-qualified name of the ConformanceService's
	// Unimplemented RPC.
	ConformanceServiceUnimplementedProcedure = "/connectrpc.conformance.v1.ConformanceService/Unimplemented"
	// ConformanceServiceIdempotentUnaryProcedure is the fully-qualified name of the
	// ConformanceService's IdempotentUnary RPC.
	ConformanceServiceIdempotentUnaryProcedure = "/connectrpc.conformance.v1.ConformanceService/IdempotentUnary"
)

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 (
	// ConformanceServiceName is the fully-qualified name of the ConformanceService service.
	ConformanceServiceName = "connectrpc.conformance.v1.ConformanceService"
)

Variables

This section is empty.

Functions

func NewConformanceServiceHandler

func NewConformanceServiceHandler(svc ConformanceServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewConformanceServiceHandler 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 ConformanceServiceClient

type ConformanceServiceClient interface {
	// A unary operation. The request indicates the response headers and trailers
	// and also indicates either a response message or an error to send back.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties in the ConformancePayload and then include the message
	// data in the data field.
	//
	// If the response_delay_ms duration is specified, the server should wait the
	// given duration after reading the request before sending the corresponding
	// response.
	//
	// Servers should allow the response definition to be unset in the request and
	// if it is, set no response headers or trailers and return no response data.
	// The returned payload should only contain the request info.
	Unary(context.Context, *connect.Request[v1.UnaryRequest]) (*connect.Response[v1.UnaryResponse], error)
	// A server-streaming operation. The request indicates the response headers,
	// response messages, trailers, and an optional error to send back. The
	// response data should be sent in the order indicated, and the server should
	// wait between sending response messages as indicated.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties in the first ConformancePayload, and then include the
	// message data in the data field. Subsequent messages after the first one
	// should contain only the data field.
	//
	// Servers should immediately send response headers on the stream before sleeping
	// for any specified response delay and/or sending the first message so that
	// clients can be unblocked reading response headers.
	//
	// If a response definition is not specified OR is specified, but response data
	// is empty, the server should skip sending anything on the stream. When there
	// are no responses to send, servers should throw an error if one is provided
	// and return without error if one is not. Stream headers and trailers should
	// still be set on the stream if provided regardless of whether a response is
	// sent or an error is thrown.
	ServerStream(context.Context, *connect.Request[v1.ServerStreamRequest]) (*connect.ServerStreamForClient[v1.ServerStreamResponse], error)
	// A client-streaming operation. The first request indicates the response
	// headers and trailers and also indicates either a response message or an
	// error to send back.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties, including all request messages in the order they were
	// received, in the ConformancePayload and then include the message data in
	// the data field.
	//
	// If the input stream is empty, the server's response will include no data,
	// only the request properties (headers, timeout).
	//
	// Servers should only read the response definition from the first message in
	// the stream and should ignore any definition set in subsequent messages.
	//
	// Servers should allow the response definition to be unset in the request and
	// if it is, set no response headers or trailers and return no response data.
	// The returned payload should only contain the request info.
	ClientStream(context.Context) *connect.ClientStreamForClient[v1.ClientStreamRequest, v1.ClientStreamResponse]
	// A bidirectional-streaming operation. The first request indicates the response
	// headers, response messages, trailers, and an optional error to send back.
	// The response data should be sent in the order indicated, and the server
	// should wait between sending response messages as indicated.
	//
	// Response message data is specified as bytes and should be included in the
	// data field of the ConformancePayload in each response.
	//
	// Servers should send responses indicated according to the rules of half duplex
	// vs. full duplex streams. Once all responses are sent, the server should either
	// return an error if specified or close the stream without error.
	//
	// Servers should immediately send response headers on the stream before sleeping
	// for any specified response delay and/or sending the first message so that
	// clients can be unblocked reading response headers.
	//
	// If a response definition is not specified OR is specified, but response data
	// is empty, the server should skip sending anything on the stream. Stream
	// headers and trailers should always be set on the stream if provided
	// regardless of whether a response is sent or an error is thrown.
	//
	// If the full_duplex field is true:
	//   - the handler should read one request and then send back one response, and
	//     then alternate, reading another request and then sending back another response, etc.
	//
	//   - if the server receives a request and has no responses to send, it
	//     should throw the error specified in the request.
	//
	//   - the service should echo back all request properties in the first response
	//     including the last received request. Subsequent responses should only
	//     echo back the last received request.
	//
	//   - if the response_delay_ms duration is specified, the server should wait the given
	//     duration after reading the request before sending the corresponding
	//     response.
	//
	// If the full_duplex field is false:
	//   - the handler should read all requests until the client is done sending.
	//     Once all requests are read, the server should then send back any responses
	//     specified in the response definition.
	//
	//   - the server should echo back all request properties, including all request
	//     messages in the order they were received, in the first response. Subsequent
	//     responses should only include the message data in the data field.
	//
	//   - if the response_delay_ms duration is specified, the server should wait that
	//     long in between sending each response message.
	BidiStream(context.Context) *connect.BidiStreamForClient[v1.BidiStreamRequest, v1.BidiStreamResponse]
	// A unary endpoint that the server should not implement and should instead
	// return an unimplemented error when invoked.
	Unimplemented(context.Context, *connect.Request[v1.UnimplementedRequest]) (*connect.Response[v1.UnimplementedResponse], error)
	// A unary endpoint denoted as having no side effects (i.e. idempotent).
	// Implementations should use an HTTP GET when invoking this endpoint and
	// leverage query parameters to send data.
	IdempotentUnary(context.Context, *connect.Request[v1.IdempotentUnaryRequest]) (*connect.Response[v1.IdempotentUnaryResponse], error)
}

ConformanceServiceClient is a client for the connectrpc.conformance.v1.ConformanceService service.

func NewConformanceServiceClient

func NewConformanceServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ConformanceServiceClient

NewConformanceServiceClient constructs a client for the connectrpc.conformance.v1.ConformanceService 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 ConformanceServiceHandler

type ConformanceServiceHandler interface {
	// A unary operation. The request indicates the response headers and trailers
	// and also indicates either a response message or an error to send back.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties in the ConformancePayload and then include the message
	// data in the data field.
	//
	// If the response_delay_ms duration is specified, the server should wait the
	// given duration after reading the request before sending the corresponding
	// response.
	//
	// Servers should allow the response definition to be unset in the request and
	// if it is, set no response headers or trailers and return no response data.
	// The returned payload should only contain the request info.
	Unary(context.Context, *connect.Request[v1.UnaryRequest]) (*connect.Response[v1.UnaryResponse], error)
	// A server-streaming operation. The request indicates the response headers,
	// response messages, trailers, and an optional error to send back. The
	// response data should be sent in the order indicated, and the server should
	// wait between sending response messages as indicated.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties in the first ConformancePayload, and then include the
	// message data in the data field. Subsequent messages after the first one
	// should contain only the data field.
	//
	// Servers should immediately send response headers on the stream before sleeping
	// for any specified response delay and/or sending the first message so that
	// clients can be unblocked reading response headers.
	//
	// If a response definition is not specified OR is specified, but response data
	// is empty, the server should skip sending anything on the stream. When there
	// are no responses to send, servers should throw an error if one is provided
	// and return without error if one is not. Stream headers and trailers should
	// still be set on the stream if provided regardless of whether a response is
	// sent or an error is thrown.
	ServerStream(context.Context, *connect.Request[v1.ServerStreamRequest], *connect.ServerStream[v1.ServerStreamResponse]) error
	// A client-streaming operation. The first request indicates the response
	// headers and trailers and also indicates either a response message or an
	// error to send back.
	//
	// Response message data is specified as bytes. The service should echo back
	// request properties, including all request messages in the order they were
	// received, in the ConformancePayload and then include the message data in
	// the data field.
	//
	// If the input stream is empty, the server's response will include no data,
	// only the request properties (headers, timeout).
	//
	// Servers should only read the response definition from the first message in
	// the stream and should ignore any definition set in subsequent messages.
	//
	// Servers should allow the response definition to be unset in the request and
	// if it is, set no response headers or trailers and return no response data.
	// The returned payload should only contain the request info.
	ClientStream(context.Context, *connect.ClientStream[v1.ClientStreamRequest]) (*connect.Response[v1.ClientStreamResponse], error)
	// A bidirectional-streaming operation. The first request indicates the response
	// headers, response messages, trailers, and an optional error to send back.
	// The response data should be sent in the order indicated, and the server
	// should wait between sending response messages as indicated.
	//
	// Response message data is specified as bytes and should be included in the
	// data field of the ConformancePayload in each response.
	//
	// Servers should send responses indicated according to the rules of half duplex
	// vs. full duplex streams. Once all responses are sent, the server should either
	// return an error if specified or close the stream without error.
	//
	// Servers should immediately send response headers on the stream before sleeping
	// for any specified response delay and/or sending the first message so that
	// clients can be unblocked reading response headers.
	//
	// If a response definition is not specified OR is specified, but response data
	// is empty, the server should skip sending anything on the stream. Stream
	// headers and trailers should always be set on the stream if provided
	// regardless of whether a response is sent or an error is thrown.
	//
	// If the full_duplex field is true:
	//   - the handler should read one request and then send back one response, and
	//     then alternate, reading another request and then sending back another response, etc.
	//
	//   - if the server receives a request and has no responses to send, it
	//     should throw the error specified in the request.
	//
	//   - the service should echo back all request properties in the first response
	//     including the last received request. Subsequent responses should only
	//     echo back the last received request.
	//
	//   - if the response_delay_ms duration is specified, the server should wait the given
	//     duration after reading the request before sending the corresponding
	//     response.
	//
	// If the full_duplex field is false:
	//   - the handler should read all requests until the client is done sending.
	//     Once all requests are read, the server should then send back any responses
	//     specified in the response definition.
	//
	//   - the server should echo back all request properties, including all request
	//     messages in the order they were received, in the first response. Subsequent
	//     responses should only include the message data in the data field.
	//
	//   - if the response_delay_ms duration is specified, the server should wait that
	//     long in between sending each response message.
	BidiStream(context.Context, *connect.BidiStream[v1.BidiStreamRequest, v1.BidiStreamResponse]) error
	// A unary endpoint that the server should not implement and should instead
	// return an unimplemented error when invoked.
	Unimplemented(context.Context, *connect.Request[v1.UnimplementedRequest]) (*connect.Response[v1.UnimplementedResponse], error)
	// A unary endpoint denoted as having no side effects (i.e. idempotent).
	// Implementations should use an HTTP GET when invoking this endpoint and
	// leverage query parameters to send data.
	IdempotentUnary(context.Context, *connect.Request[v1.IdempotentUnaryRequest]) (*connect.Response[v1.IdempotentUnaryResponse], error)
}

ConformanceServiceHandler is an implementation of the connectrpc.conformance.v1.ConformanceService service.

type UnimplementedConformanceServiceHandler

type UnimplementedConformanceServiceHandler struct{}

UnimplementedConformanceServiceHandler returns CodeUnimplemented from all methods.

func (UnimplementedConformanceServiceHandler) Unary

Jump to

Keyboard shortcuts

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