v1

package
v0.0.0-...-c30d74c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlShortenerService_CreateShortUrl_FullMethodName = "/url_shorter.v1.UrlShortenerService/CreateShortUrl"
	UrlShortenerService_GetRedirectURL_FullMethodName = "/url_shorter.v1.UrlShortenerService/GetRedirectURL"
)
View Source
const OperationUrlShortenerServiceCreateShortUrl = "/url_shorter.v1.UrlShortenerService/CreateShortUrl"
View Source
const OperationUrlShortenerServiceGetRedirectURL = "/url_shorter.v1.UrlShortenerService/GetRedirectURL"

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "SUCCESS",
		1: "USER_NOT_FOUND",
	}
	ErrorReason_value = map[string]int32{
		"SUCCESS":        0,
		"USER_NOT_FOUND": 1,
	}
)

Enum value maps for ErrorReason.

View Source
var File_url_shorter_v1_error_reason_proto protoreflect.FileDescriptor
View Source
var File_url_shorter_v1_url_shorter_proto protoreflect.FileDescriptor
View Source
var UrlShortenerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "url_shorter.v1.UrlShortenerService",
	HandlerType: (*UrlShortenerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateShortUrl",
			Handler:    _UrlShortenerService_CreateShortUrl_Handler,
		},
		{
			MethodName: "GetRedirectURL",
			Handler:    _UrlShortenerService_GetRedirectURL_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "url_shorter/v1/url_shorter.proto",
}

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

Functions

func RegisterUrlShortenerServiceHTTPServer

func RegisterUrlShortenerServiceHTTPServer(s *http.Server, srv UrlShortenerServiceHTTPServer)

func RegisterUrlShortenerServiceServer

func RegisterUrlShortenerServiceServer(s grpc.ServiceRegistrar, srv UrlShortenerServiceServer)

Types

type CreateUrlReply

type CreateUrlReply struct {

	// The created short URL.
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

CreateUrlReply contains the generated short URL as a response.

func (*CreateUrlReply) Descriptor deprecated

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

Deprecated: Use CreateUrlReply.ProtoReflect.Descriptor instead.

func (*CreateUrlReply) GetUrl

func (x *CreateUrlReply) GetUrl() string

func (*CreateUrlReply) ProtoMessage

func (*CreateUrlReply) ProtoMessage()

func (*CreateUrlReply) ProtoReflect

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

func (*CreateUrlReply) Reset

func (x *CreateUrlReply) Reset()

func (*CreateUrlReply) String

func (x *CreateUrlReply) String() string

type CreateUrlRequest

type CreateUrlRequest struct {

	// The original long URL to be shortened (required).
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// The custom short key for the short URL (optional).
	ShortKey string `protobuf:"bytes,2,opt,name=short_key,proto3" json:"short_key,omitempty"`
	// The business ID associated with the short URL (optional).
	BizId int64 `protobuf:"varint,3,opt,name=biz_id,proto3" json:"biz_id,omitempty"`
	// The expiration timestamp for the short URL (optional).
	ExpiredAt int64 `protobuf:"varint,4,opt,name=expired_at,proto3" json:"expired_at,omitempty"`
	// contains filtered or unexported fields
}

CreateUrlRequest represents the input parameters required to create a new short URL.

func (*CreateUrlRequest) Descriptor deprecated

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

Deprecated: Use CreateUrlRequest.ProtoReflect.Descriptor instead.

func (*CreateUrlRequest) GetBizId

func (x *CreateUrlRequest) GetBizId() int64

func (*CreateUrlRequest) GetExpiredAt

func (x *CreateUrlRequest) GetExpiredAt() int64

func (*CreateUrlRequest) GetShortKey

func (x *CreateUrlRequest) GetShortKey() string

func (*CreateUrlRequest) GetUrl

func (x *CreateUrlRequest) GetUrl() string

func (*CreateUrlRequest) ProtoMessage

func (*CreateUrlRequest) ProtoMessage()

func (*CreateUrlRequest) ProtoReflect

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

func (*CreateUrlRequest) Reset

func (x *CreateUrlRequest) Reset()

func (*CreateUrlRequest) String

func (x *CreateUrlRequest) String() string

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_SUCCESS        ErrorReason = 0
	ErrorReason_USER_NOT_FOUND ErrorReason = 1
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

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

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

type JumpReply

type JumpReply struct {

	// The ID associated with the short URL.
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// The original long URL associated with the short URL.
	Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

JumpReply contains the retrieved long URL as a response.

func (*JumpReply) Descriptor deprecated

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

Deprecated: Use JumpReply.ProtoReflect.Descriptor instead.

func (*JumpReply) GetId

func (x *JumpReply) GetId() int64

func (*JumpReply) GetUrl

func (x *JumpReply) GetUrl() string

func (*JumpReply) ProtoMessage

func (*JumpReply) ProtoMessage()

func (*JumpReply) ProtoReflect

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

func (*JumpReply) Reset

func (x *JumpReply) Reset()

func (*JumpReply) String

func (x *JumpReply) String() string

type JumpRequest

type JumpRequest struct {

	// The short URL to be used for the lookup (required)..
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

JumpRequest represents the input parameters required to retrieve the long URL associated with a short URL.

func (*JumpRequest) Descriptor deprecated

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

Deprecated: Use JumpRequest.ProtoReflect.Descriptor instead.

func (*JumpRequest) GetUrl

func (x *JumpRequest) GetUrl() string

func (*JumpRequest) ProtoMessage

func (*JumpRequest) ProtoMessage()

func (*JumpRequest) ProtoReflect

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

func (*JumpRequest) Reset

func (x *JumpRequest) Reset()

func (*JumpRequest) String

func (x *JumpRequest) String() string

type UnimplementedUrlShortenerServiceServer

type UnimplementedUrlShortenerServiceServer struct {
}

UnimplementedUrlShortenerServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUrlShortenerServiceServer) CreateShortUrl

func (UnimplementedUrlShortenerServiceServer) GetRedirectURL

type UnsafeUrlShortenerServiceServer

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

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

type UrlShortenerServiceClient

type UrlShortenerServiceClient interface {
	// CreateUrlShortener creates a new short URL based on the provided long URL, short key, and biz tag.
	CreateShortUrl(ctx context.Context, in *CreateUrlRequest, opts ...grpc.CallOption) (*CreateUrlReply, error)
	// GetRedirectURL retrieves the long URL associated with the given short URL and returns it to the client.
	GetRedirectURL(ctx context.Context, in *JumpRequest, opts ...grpc.CallOption) (*JumpReply, error)
}

UrlShortenerServiceClient is the client API for UrlShortenerService 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 UrlShortenerServiceHTTPClient

type UrlShortenerServiceHTTPClient interface {
	CreateShortUrl(ctx context.Context, req *CreateUrlRequest, opts ...http.CallOption) (rsp *CreateUrlReply, err error)
	GetRedirectURL(ctx context.Context, req *JumpRequest, opts ...http.CallOption) (rsp *JumpReply, err error)
}

func NewUrlShortenerServiceHTTPClient

func NewUrlShortenerServiceHTTPClient(client *http.Client) UrlShortenerServiceHTTPClient

type UrlShortenerServiceHTTPClientImpl

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

func (*UrlShortenerServiceHTTPClientImpl) CreateShortUrl

func (*UrlShortenerServiceHTTPClientImpl) GetRedirectURL

type UrlShortenerServiceHTTPServer

type UrlShortenerServiceHTTPServer interface {
	// CreateShortUrl CreateUrlShortener creates a new short URL based on the provided long URL, short key, and biz tag.
	CreateShortUrl(context.Context, *CreateUrlRequest) (*CreateUrlReply, error)
	// GetRedirectURL GetRedirectURL retrieves the long URL associated with the given short URL and returns it to the client.
	GetRedirectURL(context.Context, *JumpRequest) (*JumpReply, error)
}

type UrlShortenerServiceServer

type UrlShortenerServiceServer interface {
	// CreateUrlShortener creates a new short URL based on the provided long URL, short key, and biz tag.
	CreateShortUrl(context.Context, *CreateUrlRequest) (*CreateUrlReply, error)
	// GetRedirectURL retrieves the long URL associated with the given short URL and returns it to the client.
	GetRedirectURL(context.Context, *JumpRequest) (*JumpReply, error)
	// contains filtered or unexported methods
}

UrlShortenerServiceServer is the server API for UrlShortenerService service. All implementations must embed UnimplementedUrlShortenerServiceServer for forward compatibility

Jump to

Keyboard shortcuts

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