Documentation
¶
Index ¶
- Variables
- func NewUrlEndpoints() []*api.Endpoint
- func RegisterUrlHandler(s server.Server, hdlr UrlHandler, opts ...server.HandlerOption) error
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateRequest) GetDestinationURL() string
- func (x *CreateRequest) GetId() string
- func (*CreateRequest) ProtoMessage()
- func (x *CreateRequest) ProtoReflect() protoreflect.Message
- func (x *CreateRequest) Reset()
- func (x *CreateRequest) String() string
- type CreateResponse
- type DeleteRequest
- func (*DeleteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteRequest) GetId() string
- func (x *DeleteRequest) GetShortURL() string
- func (*DeleteRequest) ProtoMessage()
- func (x *DeleteRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteRequest) Reset()
- func (x *DeleteRequest) String() string
- type DeleteResponse
- type ListRequest
- type ListResponse
- type ResolveRequest
- func (*ResolveRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ResolveRequest) GetId() string
- func (x *ResolveRequest) GetShortURL() string
- func (*ResolveRequest) ProtoMessage()
- func (x *ResolveRequest) ProtoReflect() protoreflect.Message
- func (x *ResolveRequest) Reset()
- func (x *ResolveRequest) String() string
- type ResolveResponse
- 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) GetId() string
- func (x *URLPair) GetShortURL() string
- func (*URLPair) ProtoMessage()
- func (x *URLPair) ProtoReflect() protoreflect.Message
- func (x *URLPair) Reset()
- func (x *URLPair) String() string
- type UpdateRequest
- func (*UpdateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateRequest) GetDestinationURL() string
- func (x *UpdateRequest) GetId() string
- func (x *UpdateRequest) GetShortURL() string
- func (*UpdateRequest) ProtoMessage()
- func (x *UpdateRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateRequest) Reset()
- func (x *UpdateRequest) String() string
- type UpdateResponse
- type UrlHandler
- type UrlService
Constants ¶
This section is empty.
Variables ¶
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 CreateRequest ¶
type CreateRequest struct { // a unique id e.g uuid or my-url Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // destination url DestinationURL string `protobuf:"bytes,2,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"` // contains filtered or unexported fields }
Create a URL
func (*CreateRequest) Descriptor
deprecated
func (*CreateRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.
func (*CreateRequest) GetDestinationURL ¶
func (x *CreateRequest) GetDestinationURL() string
func (*CreateRequest) GetId ¶
func (x *CreateRequest) GetId() string
func (*CreateRequest) ProtoMessage ¶
func (*CreateRequest) ProtoMessage()
func (*CreateRequest) ProtoReflect ¶
func (x *CreateRequest) ProtoReflect() protoreflect.Message
func (*CreateRequest) Reset ¶
func (x *CreateRequest) Reset()
func (*CreateRequest) String ¶
func (x *CreateRequest) String() string
type CreateResponse ¶
type CreateResponse struct { Url *URLPair `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // contains filtered or unexported fields }
func (*CreateResponse) Descriptor
deprecated
func (*CreateResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.
func (*CreateResponse) GetUrl ¶
func (x *CreateResponse) GetUrl() *URLPair
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) ProtoReflect ¶
func (x *CreateResponse) ProtoReflect() protoreflect.Message
func (*CreateResponse) Reset ¶
func (x *CreateResponse) Reset()
func (*CreateResponse) String ¶
func (x *CreateResponse) String() string
type DeleteRequest ¶
type DeleteRequest struct { // delete by id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // delete by shortURL ShortURL string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"` // contains filtered or unexported fields }
Delete a URL
func (*DeleteRequest) Descriptor
deprecated
func (*DeleteRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
func (*DeleteRequest) GetId ¶
func (x *DeleteRequest) GetId() string
func (*DeleteRequest) GetShortURL ¶
func (x *DeleteRequest) GetShortURL() string
func (*DeleteRequest) ProtoMessage ¶
func (*DeleteRequest) ProtoMessage()
func (*DeleteRequest) ProtoReflect ¶
func (x *DeleteRequest) ProtoReflect() protoreflect.Message
func (*DeleteRequest) Reset ¶
func (x *DeleteRequest) Reset()
func (*DeleteRequest) String ¶
func (x *DeleteRequest) String() string
type DeleteResponse ¶
type DeleteResponse struct {
// contains filtered or unexported fields
}
func (*DeleteResponse) Descriptor
deprecated
func (*DeleteResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) ProtoMessage ¶
func (*DeleteResponse) ProtoMessage()
func (*DeleteResponse) ProtoReflect ¶
func (x *DeleteResponse) ProtoReflect() protoreflect.Message
func (*DeleteResponse) Reset ¶
func (x *DeleteResponse) Reset()
func (*DeleteResponse) String ¶
func (x *DeleteResponse) String() string
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 ResolveRequest ¶
type ResolveRequest struct { // resolve by id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // short url to resolve ShortURL string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"` // contains filtered or unexported fields }
Resolve returns the destination URL of a short URL.
func (*ResolveRequest) Descriptor
deprecated
func (*ResolveRequest) Descriptor() ([]byte, []int)
Deprecated: Use ResolveRequest.ProtoReflect.Descriptor instead.
func (*ResolveRequest) GetId ¶
func (x *ResolveRequest) GetId() string
func (*ResolveRequest) GetShortURL ¶
func (x *ResolveRequest) GetShortURL() string
func (*ResolveRequest) ProtoMessage ¶
func (*ResolveRequest) ProtoMessage()
func (*ResolveRequest) ProtoReflect ¶
func (x *ResolveRequest) ProtoReflect() protoreflect.Message
func (*ResolveRequest) Reset ¶
func (x *ResolveRequest) Reset()
func (*ResolveRequest) String ¶
func (x *ResolveRequest) String() string
type ResolveResponse ¶
type ResolveResponse struct { DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"` // contains filtered or unexported fields }
func (*ResolveResponse) Descriptor
deprecated
func (*ResolveResponse) Descriptor() ([]byte, []int)
Deprecated: Use ResolveResponse.ProtoReflect.Descriptor instead.
func (*ResolveResponse) GetDestinationURL ¶
func (x *ResolveResponse) GetDestinationURL() string
func (*ResolveResponse) ProtoMessage ¶
func (*ResolveResponse) ProtoMessage()
func (*ResolveResponse) ProtoReflect ¶
func (x *ResolveResponse) ProtoReflect() protoreflect.Message
func (*ResolveResponse) Reset ¶
func (x *ResolveResponse) Reset()
func (*ResolveResponse) String ¶
func (x *ResolveResponse) 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 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 { // url id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // destination url DestinationURL string `protobuf:"bytes,2,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"` // shortened url ShortURL string `protobuf:"bytes,3,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 UpdateRequest ¶
type UpdateRequest struct { // update by id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // update by short url ShortURL string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"` // the destination to update to DestinationURL string `protobuf:"bytes,3,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"` // contains filtered or unexported fields }
Update the destination for a short URL
func (*UpdateRequest) Descriptor
deprecated
func (*UpdateRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) GetDestinationURL ¶
func (x *UpdateRequest) GetDestinationURL() string
func (*UpdateRequest) GetId ¶
func (x *UpdateRequest) GetId() string
func (*UpdateRequest) GetShortURL ¶
func (x *UpdateRequest) GetShortURL() string
func (*UpdateRequest) ProtoMessage ¶
func (*UpdateRequest) ProtoMessage()
func (*UpdateRequest) ProtoReflect ¶
func (x *UpdateRequest) ProtoReflect() protoreflect.Message
func (*UpdateRequest) Reset ¶
func (x *UpdateRequest) Reset()
func (*UpdateRequest) String ¶
func (x *UpdateRequest) String() string
type UpdateResponse ¶
type UpdateResponse struct {
// contains filtered or unexported fields
}
func (*UpdateResponse) Descriptor
deprecated
func (*UpdateResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) ProtoMessage ¶
func (*UpdateResponse) ProtoMessage()
func (*UpdateResponse) ProtoReflect ¶
func (x *UpdateResponse) ProtoReflect() protoreflect.Message
func (*UpdateResponse) Reset ¶
func (x *UpdateResponse) Reset()
func (*UpdateResponse) String ¶
func (x *UpdateResponse) String() string
type UrlHandler ¶
type UrlHandler interface { Create(context.Context, *CreateRequest, *CreateResponse) error Shorten(context.Context, *ShortenRequest, *ShortenResponse) error List(context.Context, *ListRequest, *ListResponse) error Resolve(context.Context, *ResolveRequest, *ResolveResponse) error Update(context.Context, *UpdateRequest, *UpdateResponse) error Delete(context.Context, *DeleteRequest, *DeleteResponse) error }
type UrlService ¶
type UrlService interface { Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) Shorten(ctx context.Context, in *ShortenRequest, opts ...client.CallOption) (*ShortenResponse, error) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) Resolve(ctx context.Context, in *ResolveRequest, opts ...client.CallOption) (*ResolveResponse, error) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) }
func NewUrlService ¶
func NewUrlService(name string, c client.Client) UrlService