aptxv1

package
v0.0.0-...-4e1f151 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package aptxv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	AptxErrorCode_name = map[int32]string{
		0: "UNKNOWN",
		1: "INTERNAL",
		2: "EMPTY_URL",
		3: "ALREADY_EXISTS",
		4: "NOT_FOUND",
		5: "URL_TOO_LONG",
	}
	AptxErrorCode_value = map[string]int32{
		"UNKNOWN":        0,
		"INTERNAL":       1,
		"EMPTY_URL":      2,
		"ALREADY_EXISTS": 3,
		"NOT_FOUND":      4,
		"URL_TOO_LONG":   5,
	}
)

Enum value maps for AptxErrorCode.

View Source
var AptxService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.indrasaputra.aptx.v1.AptxService",
	HandlerType: (*AptxServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ShortenURL",
			Handler:    _AptxService_ShortenURL_Handler,
		},
		{
			MethodName: "GetAllURL",
			Handler:    _AptxService_GetAllURL_Handler,
		},
		{
			MethodName: "GetURLDetail",
			Handler:    _AptxService_GetURLDetail_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamAllURL",
			Handler:       _AptxService_StreamAllURL_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proto/indrasaputra/aptx/v1/aptx.proto",
}

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

View Source
var File_proto_indrasaputra_aptx_v1_aptx_proto protoreflect.FileDescriptor

Functions

func RegisterAptxServiceHandler

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

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

func RegisterAptxServiceHandlerClient

func RegisterAptxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AptxServiceClient) error

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

func RegisterAptxServiceHandlerFromEndpoint

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

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

func RegisterAptxServiceHandlerServer

func RegisterAptxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AptxServiceServer) error

RegisterAptxServiceHandlerServer registers the http handlers for service AptxService to "mux". UnaryRPC :call AptxServiceServer 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 RegisterAptxServiceHandlerFromEndpoint instead.

func RegisterAptxServiceServer

func RegisterAptxServiceServer(s grpc.ServiceRegistrar, srv AptxServiceServer)

Types

type AptxError

type AptxError struct {
	ErrorCode AptxErrorCode `` /* 135-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*AptxError) Descriptor deprecated

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

Deprecated: Use AptxError.ProtoReflect.Descriptor instead.

func (*AptxError) GetErrorCode

func (x *AptxError) GetErrorCode() AptxErrorCode

func (*AptxError) ProtoMessage

func (*AptxError) ProtoMessage()

func (*AptxError) ProtoReflect

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

func (*AptxError) Reset

func (x *AptxError) Reset()

func (*AptxError) String

func (x *AptxError) String() string

type AptxErrorCode

type AptxErrorCode int32
const (
	// Default enum code according to
	// https://medium.com/@akhaku/protobuf-definition-best-practices-87f281576f31.
	AptxErrorCode_UNKNOWN AptxErrorCode = 0
	// Unexpected behavior occured in system.
	AptxErrorCode_INTERNAL AptxErrorCode = 1
	// URL instance is empty or nil.
	AptxErrorCode_EMPTY_URL AptxErrorCode = 2
	// Short URL already exists.
	// The uniqueness of a short URL is represented by code or short URL.
	AptxErrorCode_ALREADY_EXISTS AptxErrorCode = 3
	// URL not found in system.
	AptxErrorCode_NOT_FOUND AptxErrorCode = 4
	// Original URL's length is too long.
	// It exceeds 65535 bytes.
	AptxErrorCode_URL_TOO_LONG AptxErrorCode = 5
)

func (AptxErrorCode) Descriptor

func (AptxErrorCode) Enum

func (x AptxErrorCode) Enum() *AptxErrorCode

func (AptxErrorCode) EnumDescriptor deprecated

func (AptxErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use AptxErrorCode.Descriptor instead.

func (AptxErrorCode) Number

func (AptxErrorCode) String

func (x AptxErrorCode) String() string

func (AptxErrorCode) Type

type AptxServiceClient

type AptxServiceClient interface {
	ShortenURL(ctx context.Context, in *ShortenURLRequest, opts ...grpc.CallOption) (*ShortenURLResponse, error)
	GetAllURL(ctx context.Context, in *GetAllURLRequest, opts ...grpc.CallOption) (*GetAllURLResponse, error)
	StreamAllURL(ctx context.Context, in *StreamAllURLRequest, opts ...grpc.CallOption) (AptxService_StreamAllURLClient, error)
	GetURLDetail(ctx context.Context, in *GetURLDetailRequest, opts ...grpc.CallOption) (*GetURLDetailResponse, error)
}

AptxServiceClient is the client API for AptxService 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 AptxServiceServer

type AptxServiceServer interface {
	ShortenURL(context.Context, *ShortenURLRequest) (*ShortenURLResponse, error)
	GetAllURL(context.Context, *GetAllURLRequest) (*GetAllURLResponse, error)
	StreamAllURL(*StreamAllURLRequest, AptxService_StreamAllURLServer) error
	GetURLDetail(context.Context, *GetURLDetailRequest) (*GetURLDetailResponse, error)
	// contains filtered or unexported methods
}

AptxServiceServer is the server API for AptxService service. All implementations must embed UnimplementedAptxServiceServer for forward compatibility

type AptxService_StreamAllURLClient

type AptxService_StreamAllURLClient interface {
	Recv() (*StreamAllURLResponse, error)
	grpc.ClientStream
}

type AptxService_StreamAllURLServer

type AptxService_StreamAllURLServer interface {
	Send(*StreamAllURLResponse) error
	grpc.ServerStream
}

type GetAllURLRequest

type GetAllURLRequest struct {
	// contains filtered or unexported fields
}

func (*GetAllURLRequest) Descriptor deprecated

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

Deprecated: Use GetAllURLRequest.ProtoReflect.Descriptor instead.

func (*GetAllURLRequest) ProtoMessage

func (*GetAllURLRequest) ProtoMessage()

func (*GetAllURLRequest) ProtoReflect

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

func (*GetAllURLRequest) Reset

func (x *GetAllURLRequest) Reset()

func (*GetAllURLRequest) String

func (x *GetAllURLRequest) String() string

type GetAllURLResponse

type GetAllURLResponse struct {
	Urls []*URL `protobuf:"bytes,1,rep,name=urls,proto3" json:"urls,omitempty"`
	// contains filtered or unexported fields
}

func (*GetAllURLResponse) Descriptor deprecated

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

Deprecated: Use GetAllURLResponse.ProtoReflect.Descriptor instead.

func (*GetAllURLResponse) GetUrls

func (x *GetAllURLResponse) GetUrls() []*URL

func (*GetAllURLResponse) ProtoMessage

func (*GetAllURLResponse) ProtoMessage()

func (*GetAllURLResponse) ProtoReflect

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

func (*GetAllURLResponse) Reset

func (x *GetAllURLResponse) Reset()

func (*GetAllURLResponse) String

func (x *GetAllURLResponse) String() string

type GetURLDetailRequest

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

func (*GetURLDetailRequest) Descriptor deprecated

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

Deprecated: Use GetURLDetailRequest.ProtoReflect.Descriptor instead.

func (*GetURLDetailRequest) GetCode

func (x *GetURLDetailRequest) GetCode() string

func (*GetURLDetailRequest) ProtoMessage

func (*GetURLDetailRequest) ProtoMessage()

func (*GetURLDetailRequest) ProtoReflect

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

func (*GetURLDetailRequest) Reset

func (x *GetURLDetailRequest) Reset()

func (*GetURLDetailRequest) String

func (x *GetURLDetailRequest) String() string

type GetURLDetailResponse

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

func (*GetURLDetailResponse) Descriptor deprecated

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

Deprecated: Use GetURLDetailResponse.ProtoReflect.Descriptor instead.

func (*GetURLDetailResponse) GetUrl

func (x *GetURLDetailResponse) GetUrl() *URL

func (*GetURLDetailResponse) ProtoMessage

func (*GetURLDetailResponse) ProtoMessage()

func (*GetURLDetailResponse) ProtoReflect

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

func (*GetURLDetailResponse) Reset

func (x *GetURLDetailResponse) Reset()

func (*GetURLDetailResponse) String

func (x *GetURLDetailResponse) String() string

type ShortenURLRequest

type ShortenURLRequest struct {
	OriginalUrl string `protobuf:"bytes,1,opt,name=original_url,json=originalUrl,proto3" json:"original_url,omitempty"`
	// contains filtered or unexported fields
}

func (*ShortenURLRequest) Descriptor deprecated

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

Deprecated: Use ShortenURLRequest.ProtoReflect.Descriptor instead.

func (*ShortenURLRequest) GetOriginalUrl

func (x *ShortenURLRequest) GetOriginalUrl() string

func (*ShortenURLRequest) ProtoMessage

func (*ShortenURLRequest) ProtoMessage()

func (*ShortenURLRequest) ProtoReflect

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

func (*ShortenURLRequest) Reset

func (x *ShortenURLRequest) Reset()

func (*ShortenURLRequest) String

func (x *ShortenURLRequest) String() string

type ShortenURLResponse

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

func (*ShortenURLResponse) Descriptor deprecated

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

Deprecated: Use ShortenURLResponse.ProtoReflect.Descriptor instead.

func (*ShortenURLResponse) GetUrl

func (x *ShortenURLResponse) GetUrl() *URL

func (*ShortenURLResponse) ProtoMessage

func (*ShortenURLResponse) ProtoMessage()

func (*ShortenURLResponse) ProtoReflect

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

func (*ShortenURLResponse) Reset

func (x *ShortenURLResponse) Reset()

func (*ShortenURLResponse) String

func (x *ShortenURLResponse) String() string

type StreamAllURLRequest

type StreamAllURLRequest struct {
	// contains filtered or unexported fields
}

func (*StreamAllURLRequest) Descriptor deprecated

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

Deprecated: Use StreamAllURLRequest.ProtoReflect.Descriptor instead.

func (*StreamAllURLRequest) ProtoMessage

func (*StreamAllURLRequest) ProtoMessage()

func (*StreamAllURLRequest) ProtoReflect

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

func (*StreamAllURLRequest) Reset

func (x *StreamAllURLRequest) Reset()

func (*StreamAllURLRequest) String

func (x *StreamAllURLRequest) String() string

type StreamAllURLResponse

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

func (*StreamAllURLResponse) Descriptor deprecated

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

Deprecated: Use StreamAllURLResponse.ProtoReflect.Descriptor instead.

func (*StreamAllURLResponse) GetUrl

func (x *StreamAllURLResponse) GetUrl() *URL

func (*StreamAllURLResponse) ProtoMessage

func (*StreamAllURLResponse) ProtoMessage()

func (*StreamAllURLResponse) ProtoReflect

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

func (*StreamAllURLResponse) Reset

func (x *StreamAllURLResponse) Reset()

func (*StreamAllURLResponse) String

func (x *StreamAllURLResponse) String() string

type URL

type URL struct {
	Code        string                 `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	ShortUrl    string                 `protobuf:"bytes,2,opt,name=short_url,json=shortUrl,proto3" json:"short_url,omitempty"`
	OriginalUrl string                 `protobuf:"bytes,3,opt,name=original_url,json=originalUrl,proto3" json:"original_url,omitempty"`
	ExpiredAt   *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"`
	CreatedAt   *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

func (*URL) Descriptor deprecated

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

Deprecated: Use URL.ProtoReflect.Descriptor instead.

func (*URL) GetCode

func (x *URL) GetCode() string

func (*URL) GetCreatedAt

func (x *URL) GetCreatedAt() *timestamppb.Timestamp

func (*URL) GetExpiredAt

func (x *URL) GetExpiredAt() *timestamppb.Timestamp

func (*URL) GetOriginalUrl

func (x *URL) GetOriginalUrl() string

func (*URL) GetShortUrl

func (x *URL) GetShortUrl() string

func (*URL) ProtoMessage

func (*URL) ProtoMessage()

func (*URL) ProtoReflect

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

func (*URL) Reset

func (x *URL) Reset()

func (*URL) String

func (x *URL) String() string

type UnimplementedAptxServiceServer

type UnimplementedAptxServiceServer struct {
}

UnimplementedAptxServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedAptxServiceServer) GetAllURL

func (UnimplementedAptxServiceServer) GetURLDetail

func (UnimplementedAptxServiceServer) ShortenURL

func (UnimplementedAptxServiceServer) StreamAllURL

type UnsafeAptxServiceServer

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

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

Jump to

Keyboard shortcuts

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