swagger

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package swagger is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Pattern_SwaggerService_Json_0 = pattern_SwaggerService_Json_0
	Pattern_SwaggerService_Yaml_0 = pattern_SwaggerService_Yaml_0
	Pattern_SwaggerService_UI_0   = pattern_SwaggerService_UI_0
	Pattern_SwaggerService_UI_1   = pattern_SwaggerService_UI_1
)

export some private fields

View Source
var File_v1_doc_swagger_swagger_proto protoreflect.FileDescriptor
View Source
var SwaggerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sole.api.v1.doc.swagger.SwaggerService",
	HandlerType: (*SwaggerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Json",
			Handler:    _SwaggerService_Json_Handler,
		},
		{
			MethodName: "Yaml",
			Handler:    _SwaggerService_Yaml_Handler,
		},
		{
			MethodName: "UI",
			Handler:    _SwaggerService_UI_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/doc/swagger/swagger.proto",
}

SwaggerService_ServiceDesc is the grpc.ServiceDesc for SwaggerService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSwaggerServiceHandler

func RegisterSwaggerServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSwaggerServiceHandler registers the http handlers for service SwaggerService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSwaggerServiceHandlerClient

func RegisterSwaggerServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SwaggerServiceClient) error

RegisterSwaggerServiceHandlerClient registers the http handlers for service SwaggerService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SwaggerServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SwaggerServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SwaggerServiceClient" to call the correct interceptors.

func RegisterSwaggerServiceHandlerFromEndpoint

func RegisterSwaggerServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSwaggerServiceHandlerFromEndpoint is same as RegisterSwaggerServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSwaggerServiceHandlerServer

func RegisterSwaggerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SwaggerServiceServer) error

RegisterSwaggerServiceHandlerServer registers the http handlers for service SwaggerService to "mux". UnaryRPC :call SwaggerServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSwaggerServiceHandlerFromEndpoint instead.

func RegisterSwaggerServiceServer

func RegisterSwaggerServiceServer(s grpc.ServiceRegistrar, srv SwaggerServiceServer)

Types

type SwaggerServiceClient

type SwaggerServiceClient interface {
	// 静态Swagger JSON
	Json(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	// 静态Swagger YAML
	Yaml(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
	// 静态Swagger UI
	UI(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
}

SwaggerServiceClient is the client API for SwaggerService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type SwaggerServiceServer

type SwaggerServiceServer interface {
	// 静态Swagger JSON
	Json(context.Context, *emptypb.Empty) (*httpbody.HttpBody, error)
	// 静态Swagger YAML
	Yaml(context.Context, *emptypb.Empty) (*httpbody.HttpBody, error)
	// 静态Swagger UI
	UI(context.Context, *emptypb.Empty) (*httpbody.HttpBody, error)
	// contains filtered or unexported methods
}

SwaggerServiceServer is the server API for SwaggerService service. All implementations must embed UnimplementedSwaggerServiceServer for forward compatibility

type UnimplementedSwaggerServiceServer

type UnimplementedSwaggerServiceServer struct {
}

UnimplementedSwaggerServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedSwaggerServiceServer) Json

func (UnimplementedSwaggerServiceServer) UI

func (UnimplementedSwaggerServiceServer) Yaml

type UnsafeSwaggerServiceServer

type UnsafeSwaggerServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeSwaggerServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SwaggerServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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