Documentation
¶
Index ¶
- Variables
- func NewUrlEndpoints() []*api.Endpoint
- func RegisterUrlHandler(s server.Server, hdlr UrlHandler, opts ...server.HandlerOption) error
- type ListRequest
- type ListResponse
- type ProxyRequest
- type ProxyResponse
- type ShortenRequest
- type ShortenResponse
- type URLPair
- func (*URLPair) Descriptor() ([]byte, []int)deprecated
- func (x *URLPair) GetCreated() string
- func (x *URLPair) GetDestinationURL() string
- func (x *URLPair) GetHitCount() int64
- func (x *URLPair) GetShortURL() string
- func (*URLPair) ProtoMessage()
- func (x *URLPair) ProtoReflect() protoreflect.Message
- func (x *URLPair) Reset()
- func (x *URLPair) String() string
- type UrlHandler
- type UrlService
Constants ¶
This section is empty.
Variables ¶
View Source
var File_proto_url_proto protoreflect.FileDescriptor
Functions ¶
func NewUrlEndpoints ¶
func RegisterUrlHandler ¶
func RegisterUrlHandler(s server.Server, hdlr UrlHandler, opts ...server.HandlerOption) error
Types ¶
type ListRequest ¶
type ListRequest struct {
// filter by short URL, optional
ShortURL string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"`
// contains filtered or unexported fields
}
List all the shortened URLs
func (*ListRequest) Descriptor
deprecated
func (*ListRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.
func (*ListRequest) GetShortURL ¶
func (x *ListRequest) GetShortURL() string
func (*ListRequest) ProtoMessage ¶
func (*ListRequest) ProtoMessage()
func (*ListRequest) ProtoReflect ¶
func (x *ListRequest) ProtoReflect() protoreflect.Message
func (*ListRequest) Reset ¶
func (x *ListRequest) Reset()
func (*ListRequest) String ¶
func (x *ListRequest) String() string
type ListResponse ¶
type ListResponse struct {
UrlPairs []*URLPair `protobuf:"bytes,1,rep,name=urlPairs,proto3" json:"urlPairs,omitempty"`
// contains filtered or unexported fields
}
func (*ListResponse) Descriptor
deprecated
func (*ListResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
func (*ListResponse) GetUrlPairs ¶
func (x *ListResponse) GetUrlPairs() []*URLPair
func (*ListResponse) ProtoMessage ¶
func (*ListResponse) ProtoMessage()
func (*ListResponse) ProtoReflect ¶
func (x *ListResponse) ProtoReflect() protoreflect.Message
func (*ListResponse) Reset ¶
func (x *ListResponse) Reset()
func (*ListResponse) String ¶
func (x *ListResponse) String() string
type ProxyRequest ¶
type ProxyRequest struct {
// short url ID, without the domain, eg. if your short URL is
// `m3o.one/u/someshorturlid` then pass in `someshorturlid`
ShortURL string `protobuf:"bytes,1,opt,name=shortURL,proto3" json:"shortURL,omitempty"`
// contains filtered or unexported fields
}
Proxy returns the destination URL of a short URL.
func (*ProxyRequest) Descriptor
deprecated
func (*ProxyRequest) Descriptor() ([]byte, []int)
Deprecated: Use ProxyRequest.ProtoReflect.Descriptor instead.
func (*ProxyRequest) GetShortURL ¶
func (x *ProxyRequest) GetShortURL() string
func (*ProxyRequest) ProtoMessage ¶
func (*ProxyRequest) ProtoMessage()
func (*ProxyRequest) ProtoReflect ¶
func (x *ProxyRequest) ProtoReflect() protoreflect.Message
func (*ProxyRequest) Reset ¶
func (x *ProxyRequest) Reset()
func (*ProxyRequest) String ¶
func (x *ProxyRequest) String() string
type ProxyResponse ¶
type ProxyResponse struct {
DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"`
// contains filtered or unexported fields
}
func (*ProxyResponse) Descriptor
deprecated
func (*ProxyResponse) Descriptor() ([]byte, []int)
Deprecated: Use ProxyResponse.ProtoReflect.Descriptor instead.
func (*ProxyResponse) GetDestinationURL ¶
func (x *ProxyResponse) GetDestinationURL() string
func (*ProxyResponse) ProtoMessage ¶
func (*ProxyResponse) ProtoMessage()
func (*ProxyResponse) ProtoReflect ¶
func (x *ProxyResponse) ProtoReflect() protoreflect.Message
func (*ProxyResponse) Reset ¶
func (x *ProxyResponse) Reset()
func (*ProxyResponse) String ¶
func (x *ProxyResponse) String() string
type ShortenRequest ¶
type ShortenRequest struct {
// the url to shorten
DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"`
// contains filtered or unexported fields
}
Shorten a long URL
func (*ShortenRequest) Descriptor
deprecated
func (*ShortenRequest) Descriptor() ([]byte, []int)
Deprecated: Use ShortenRequest.ProtoReflect.Descriptor instead.
func (*ShortenRequest) GetDestinationURL ¶
func (x *ShortenRequest) GetDestinationURL() string
func (*ShortenRequest) ProtoMessage ¶
func (*ShortenRequest) ProtoMessage()
func (*ShortenRequest) ProtoReflect ¶
func (x *ShortenRequest) ProtoReflect() protoreflect.Message
func (*ShortenRequest) Reset ¶
func (x *ShortenRequest) Reset()
func (*ShortenRequest) String ¶
func (x *ShortenRequest) String() string
type ShortenResponse ¶
type ShortenResponse struct {
// the shortened url
ShortURL string `protobuf:"bytes,1,opt,name=shortURL,proto3" json:"shortURL,omitempty"`
// contains filtered or unexported fields
}
func (*ShortenResponse) Descriptor
deprecated
func (*ShortenResponse) Descriptor() ([]byte, []int)
Deprecated: Use ShortenResponse.ProtoReflect.Descriptor instead.
func (*ShortenResponse) GetShortURL ¶
func (x *ShortenResponse) GetShortURL() string
func (*ShortenResponse) ProtoMessage ¶
func (*ShortenResponse) ProtoMessage()
func (*ShortenResponse) ProtoReflect ¶
func (x *ShortenResponse) ProtoReflect() protoreflect.Message
func (*ShortenResponse) Reset ¶
func (x *ShortenResponse) Reset()
func (*ShortenResponse) String ¶
func (x *ShortenResponse) String() string
type URLPair ¶
type URLPair struct {
// destination url
DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"`
// shortened url
ShortURL string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"`
// time of creation
Created string `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"`
// The number of times the short URL has been resolved
HitCount int64 `protobuf:"varint,5,opt,name=hitCount,proto3" json:"hitCount,omitempty"`
// contains filtered or unexported fields
}
func (*URLPair) Descriptor
deprecated
func (*URLPair) GetCreated ¶
func (*URLPair) GetDestinationURL ¶
func (*URLPair) GetHitCount ¶
func (*URLPair) GetShortURL ¶
func (*URLPair) ProtoMessage ¶
func (*URLPair) ProtoMessage()
func (*URLPair) ProtoReflect ¶
func (x *URLPair) ProtoReflect() protoreflect.Message
type UrlHandler ¶
type UrlHandler interface {
Shorten(context.Context, *ShortenRequest, *ShortenResponse) error
List(context.Context, *ListRequest, *ListResponse) error
Proxy(context.Context, *ProxyRequest, *ProxyResponse) error
}
type UrlService ¶
type UrlService interface {
Shorten(ctx context.Context, in *ShortenRequest, opts ...client.CallOption) (*ShortenResponse, error)
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
Proxy(ctx context.Context, in *ProxyRequest, opts ...client.CallOption) (*ProxyResponse, error)
}
func NewUrlService ¶
func NewUrlService(name string, c client.Client) UrlService
Click to show internal directories.
Click to hide internal directories.