Documentation ¶
Overview ¶
The service defined herein comes from v2 of the Petstore service, which is used as an example for Swagger/OpenAPI. The Swagger spec can be found here: https://petstore.swagger.io/v2/swagger.json A human-friendly HTML view of this API is also available at https://petstore.swagger.io.
This file defines only the "pet" service. The spec for this site also includes "store" and "user" services which are not supported via these RPC definitions.
Index ¶
- Constants
- func NewPetServiceHandler(svc PetServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type PetServiceClient
- type PetServiceHandler
- type UnimplementedPetServiceHandler
- func (UnimplementedPetServiceHandler) AddPet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error)
- func (UnimplementedPetServiceHandler) DeletePet(context.Context, *connect.Request[v2.PetID]) (*connect.Response[emptypb.Empty], error)
- func (UnimplementedPetServiceHandler) FindPetsByStatus(context.Context, *connect.Request[v2.StatusReq]) (*connect.Response[v2.Pets], error)
- func (UnimplementedPetServiceHandler) FindPetsByTag(context.Context, *connect.Request[v2.TagReq]) (*connect.Response[v2.Pets], error)
- func (UnimplementedPetServiceHandler) GetPetByID(context.Context, *connect.Request[v2.PetID]) (*connect.Response[v2.Pet], error)
- func (UnimplementedPetServiceHandler) UpdatePet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error)
- func (UnimplementedPetServiceHandler) UpdatePetWithForm(context.Context, *connect.Request[v2.UpdatePetWithFormReq]) (*connect.Response[emptypb.Empty], error)
- func (UnimplementedPetServiceHandler) UploadFile(context.Context, *connect.Request[v2.UploadFileReq]) (*connect.Response[v2.ApiResponse], error)
Constants ¶
const ( // PetServiceGetPetByIDProcedure is the fully-qualified name of the PetService's GetPetByID RPC. PetServiceGetPetByIDProcedure = "/io.swagger.petstore.v2.PetService/GetPetByID" // PetServiceUpdatePetWithFormProcedure is the fully-qualified name of the PetService's // UpdatePetWithForm RPC. PetServiceUpdatePetWithFormProcedure = "/io.swagger.petstore.v2.PetService/UpdatePetWithForm" // PetServiceDeletePetProcedure is the fully-qualified name of the PetService's DeletePet RPC. PetServiceDeletePetProcedure = "/io.swagger.petstore.v2.PetService/DeletePet" // PetServiceUploadFileProcedure is the fully-qualified name of the PetService's UploadFile RPC. PetServiceUploadFileProcedure = "/io.swagger.petstore.v2.PetService/UploadFile" // PetServiceAddPetProcedure is the fully-qualified name of the PetService's AddPet RPC. PetServiceAddPetProcedure = "/io.swagger.petstore.v2.PetService/AddPet" // PetServiceUpdatePetProcedure is the fully-qualified name of the PetService's UpdatePet RPC. PetServiceUpdatePetProcedure = "/io.swagger.petstore.v2.PetService/UpdatePet" // PetServiceFindPetsByTagProcedure is the fully-qualified name of the PetService's FindPetsByTag // RPC. PetServiceFindPetsByTagProcedure = "/io.swagger.petstore.v2.PetService/FindPetsByTag" // PetServiceFindPetsByStatusProcedure is the fully-qualified name of the PetService's // FindPetsByStatus RPC. PetServiceFindPetsByStatusProcedure = "/io.swagger.petstore.v2.PetService/FindPetsByStatus" )
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.
const (
// PetServiceName is the fully-qualified name of the PetService service.
PetServiceName = "io.swagger.petstore.v2.PetService"
)
Variables ¶
This section is empty.
Functions ¶
func NewPetServiceHandler ¶
func NewPetServiceHandler(svc PetServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewPetServiceHandler 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 PetServiceClient ¶
type PetServiceClient interface { GetPetByID(context.Context, *connect.Request[v2.PetID]) (*connect.Response[v2.Pet], error) UpdatePetWithForm(context.Context, *connect.Request[v2.UpdatePetWithFormReq]) (*connect.Response[emptypb.Empty], error) DeletePet(context.Context, *connect.Request[v2.PetID]) (*connect.Response[emptypb.Empty], error) UploadFile(context.Context, *connect.Request[v2.UploadFileReq]) (*connect.Response[v2.ApiResponse], error) AddPet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error) UpdatePet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error) // Deprecated: do not use. FindPetsByTag(context.Context, *connect.Request[v2.TagReq]) (*connect.Response[v2.Pets], error) FindPetsByStatus(context.Context, *connect.Request[v2.StatusReq]) (*connect.Response[v2.Pets], error) }
PetServiceClient is a client for the io.swagger.petstore.v2.PetService service.
func NewPetServiceClient ¶
func NewPetServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PetServiceClient
NewPetServiceClient constructs a client for the io.swagger.petstore.v2.PetService 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 PetServiceHandler ¶
type PetServiceHandler interface { GetPetByID(context.Context, *connect.Request[v2.PetID]) (*connect.Response[v2.Pet], error) UpdatePetWithForm(context.Context, *connect.Request[v2.UpdatePetWithFormReq]) (*connect.Response[emptypb.Empty], error) DeletePet(context.Context, *connect.Request[v2.PetID]) (*connect.Response[emptypb.Empty], error) UploadFile(context.Context, *connect.Request[v2.UploadFileReq]) (*connect.Response[v2.ApiResponse], error) AddPet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error) UpdatePet(context.Context, *connect.Request[v2.Pet]) (*connect.Response[v2.Pet], error) // Deprecated: do not use. FindPetsByTag(context.Context, *connect.Request[v2.TagReq]) (*connect.Response[v2.Pets], error) FindPetsByStatus(context.Context, *connect.Request[v2.StatusReq]) (*connect.Response[v2.Pets], error) }
PetServiceHandler is an implementation of the io.swagger.petstore.v2.PetService service.
type UnimplementedPetServiceHandler ¶
type UnimplementedPetServiceHandler struct{}
UnimplementedPetServiceHandler returns CodeUnimplemented from all methods.
func (UnimplementedPetServiceHandler) FindPetsByStatus ¶
func (UnimplementedPetServiceHandler) FindPetsByTag ¶
func (UnimplementedPetServiceHandler) GetPetByID ¶
func (UnimplementedPetServiceHandler) UpdatePetWithForm ¶
func (UnimplementedPetServiceHandler) UploadFile ¶
func (UnimplementedPetServiceHandler) UploadFile(context.Context, *connect.Request[v2.UploadFileReq]) (*connect.Response[v2.ApiResponse], error)