api_tinyurl

package
v0.0.0-...-73c9b43 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 17 Imported by: 3

Documentation

Overview

Package api_tinyurl is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	TinyURL_TinyURLEncode_FullMethodName = "/TinyURL/TinyURLEncode"
	TinyURL_TinyURLDecode_FullMethodName = "/TinyURL/TinyURLDecode"
)

Variables

View Source
var File_tinyurl_proto protoreflect.FileDescriptor
View Source
var TinyURL_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "TinyURL",
	HandlerType: (*TinyURLServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "TinyURLEncode",
			Handler:    _TinyURL_TinyURLEncode_Handler,
		},
		{
			MethodName: "TinyURLDecode",
			Handler:    _TinyURL_TinyURLDecode_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "tinyurl.proto",
}

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

Functions

func RegisterTinyURLHandler

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

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

func RegisterTinyURLHandlerClient

func RegisterTinyURLHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TinyURLClient) error

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

func RegisterTinyURLHandlerFromEndpoint

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

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

func RegisterTinyURLHandlerServer

func RegisterTinyURLHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TinyURLServer) error

RegisterTinyURLHandlerServer registers the http handlers for service TinyURL to "mux". UnaryRPC :call TinyURLServer 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 RegisterTinyURLHandlerFromEndpoint instead.

func RegisterTinyURLServer

func RegisterTinyURLServer(s grpc.ServiceRegistrar, srv TinyURLServer)

Types

type TinyURLClient

type TinyURLClient interface {
	TinyURLEncode(ctx context.Context, in *TinyURLEncodeReq, opts ...grpc.CallOption) (*TinyURLEncodeResp, error)
	TinyURLDecode(ctx context.Context, in *TinyURLDecodeReq, opts ...grpc.CallOption) (*TinyURLDecodeResp, error)
}

TinyURLClient is the client API for TinyURL 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.

func NewTinyURLClient

func NewTinyURLClient(cc grpc.ClientConnInterface) TinyURLClient

type TinyURLDecodeReq

type TinyURLDecodeReq struct {
	Turl string `protobuf:"bytes,1,opt,name=turl,proto3" json:"turl,omitempty"`
	// contains filtered or unexported fields
}

func (*TinyURLDecodeReq) Descriptor deprecated

func (*TinyURLDecodeReq) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLDecodeReq.ProtoReflect.Descriptor instead.

func (*TinyURLDecodeReq) GetTurl

func (x *TinyURLDecodeReq) GetTurl() string

func (*TinyURLDecodeReq) ProtoMessage

func (*TinyURLDecodeReq) ProtoMessage()

func (*TinyURLDecodeReq) ProtoReflect

func (x *TinyURLDecodeReq) ProtoReflect() protoreflect.Message

func (*TinyURLDecodeReq) Reset

func (x *TinyURLDecodeReq) Reset()

func (*TinyURLDecodeReq) String

func (x *TinyURLDecodeReq) String() string

type TinyURLDecodeResObj

type TinyURLDecodeResObj struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

TinyURLDecode

func (*TinyURLDecodeResObj) Descriptor deprecated

func (*TinyURLDecodeResObj) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLDecodeResObj.ProtoReflect.Descriptor instead.

func (*TinyURLDecodeResObj) GetUrl

func (x *TinyURLDecodeResObj) GetUrl() string

func (*TinyURLDecodeResObj) ProtoMessage

func (*TinyURLDecodeResObj) ProtoMessage()

func (*TinyURLDecodeResObj) ProtoReflect

func (x *TinyURLDecodeResObj) ProtoReflect() protoreflect.Message

func (*TinyURLDecodeResObj) Reset

func (x *TinyURLDecodeResObj) Reset()

func (*TinyURLDecodeResObj) String

func (x *TinyURLDecodeResObj) String() string

type TinyURLDecodeResp

type TinyURLDecodeResp struct {
	Code int64                `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg  string               `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Data *TinyURLDecodeResObj `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*TinyURLDecodeResp) Descriptor deprecated

func (*TinyURLDecodeResp) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLDecodeResp.ProtoReflect.Descriptor instead.

func (*TinyURLDecodeResp) GetCode

func (x *TinyURLDecodeResp) GetCode() int64

func (*TinyURLDecodeResp) GetData

func (x *TinyURLDecodeResp) GetData() *TinyURLDecodeResObj

func (*TinyURLDecodeResp) GetMsg

func (x *TinyURLDecodeResp) GetMsg() string

func (*TinyURLDecodeResp) ProtoMessage

func (*TinyURLDecodeResp) ProtoMessage()

func (*TinyURLDecodeResp) ProtoReflect

func (x *TinyURLDecodeResp) ProtoReflect() protoreflect.Message

func (*TinyURLDecodeResp) Reset

func (x *TinyURLDecodeResp) Reset()

func (*TinyURLDecodeResp) String

func (x *TinyURLDecodeResp) String() string

type TinyURLEncodeReq

type TinyURLEncodeReq struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

func (*TinyURLEncodeReq) Descriptor deprecated

func (*TinyURLEncodeReq) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLEncodeReq.ProtoReflect.Descriptor instead.

func (*TinyURLEncodeReq) GetUrl

func (x *TinyURLEncodeReq) GetUrl() string

func (*TinyURLEncodeReq) ProtoMessage

func (*TinyURLEncodeReq) ProtoMessage()

func (*TinyURLEncodeReq) ProtoReflect

func (x *TinyURLEncodeReq) ProtoReflect() protoreflect.Message

func (*TinyURLEncodeReq) Reset

func (x *TinyURLEncodeReq) Reset()

func (*TinyURLEncodeReq) String

func (x *TinyURLEncodeReq) String() string

type TinyURLEncodeResObj

type TinyURLEncodeResObj struct {
	Turl string `protobuf:"bytes,1,opt,name=turl,proto3" json:"turl,omitempty"`
	// contains filtered or unexported fields
}

TinyURLEncode

func (*TinyURLEncodeResObj) Descriptor deprecated

func (*TinyURLEncodeResObj) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLEncodeResObj.ProtoReflect.Descriptor instead.

func (*TinyURLEncodeResObj) GetTurl

func (x *TinyURLEncodeResObj) GetTurl() string

func (*TinyURLEncodeResObj) ProtoMessage

func (*TinyURLEncodeResObj) ProtoMessage()

func (*TinyURLEncodeResObj) ProtoReflect

func (x *TinyURLEncodeResObj) ProtoReflect() protoreflect.Message

func (*TinyURLEncodeResObj) Reset

func (x *TinyURLEncodeResObj) Reset()

func (*TinyURLEncodeResObj) String

func (x *TinyURLEncodeResObj) String() string

type TinyURLEncodeResp

type TinyURLEncodeResp struct {
	Code int64                `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg  string               `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Data *TinyURLEncodeResObj `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*TinyURLEncodeResp) Descriptor deprecated

func (*TinyURLEncodeResp) Descriptor() ([]byte, []int)

Deprecated: Use TinyURLEncodeResp.ProtoReflect.Descriptor instead.

func (*TinyURLEncodeResp) GetCode

func (x *TinyURLEncodeResp) GetCode() int64

func (*TinyURLEncodeResp) GetData

func (x *TinyURLEncodeResp) GetData() *TinyURLEncodeResObj

func (*TinyURLEncodeResp) GetMsg

func (x *TinyURLEncodeResp) GetMsg() string

func (*TinyURLEncodeResp) ProtoMessage

func (*TinyURLEncodeResp) ProtoMessage()

func (*TinyURLEncodeResp) ProtoReflect

func (x *TinyURLEncodeResp) ProtoReflect() protoreflect.Message

func (*TinyURLEncodeResp) Reset

func (x *TinyURLEncodeResp) Reset()

func (*TinyURLEncodeResp) String

func (x *TinyURLEncodeResp) String() string

type TinyURLServer

type TinyURLServer interface {
	TinyURLEncode(context.Context, *TinyURLEncodeReq) (*TinyURLEncodeResp, error)
	TinyURLDecode(context.Context, *TinyURLDecodeReq) (*TinyURLDecodeResp, error)
}

TinyURLServer is the server API for TinyURL service. All implementations should embed UnimplementedTinyURLServer for forward compatibility

type UnimplementedTinyURLServer

type UnimplementedTinyURLServer struct {
}

UnimplementedTinyURLServer should be embedded to have forward compatible implementations.

func (UnimplementedTinyURLServer) TinyURLDecode

func (UnimplementedTinyURLServer) TinyURLEncode

type UnsafeTinyURLServer

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

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

Jump to

Keyboard shortcuts

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