url

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_url_proto protoreflect.FileDescriptor

Functions

func NewUrlEndpoints

func NewUrlEndpoints() []*api.Endpoint

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 shortened URLs. It has no input parameters, as it will take the user ID from the token and list the user's (caller's) 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. Proxy resolves even URLs not owned by the token holder, unlike the List endpoint.

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 {
	DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"`
	// contains filtered or unexported fields
}

Shortens a destination URL and returns a full short 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 {
	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 {
	DestinationURL string `protobuf:"bytes,1,opt,name=destinationURL,proto3" json:"destinationURL,omitempty"`
	ShortURL       string `protobuf:"bytes,2,opt,name=shortURL,proto3" json:"shortURL,omitempty"`
	Owner          string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"`
	Created        int64  `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"`
	HitCount       int64  `protobuf:"varint,5,opt,name=hitCount,proto3" json:"hitCount,omitempty"`
	// contains filtered or unexported fields
}

func (*URLPair) Descriptor deprecated

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

Deprecated: Use URLPair.ProtoReflect.Descriptor instead.

func (*URLPair) GetCreated

func (x *URLPair) GetCreated() int64

func (*URLPair) GetDestinationURL

func (x *URLPair) GetDestinationURL() string

func (*URLPair) GetHitCount

func (x *URLPair) GetHitCount() int64

func (*URLPair) GetOwner

func (x *URLPair) GetOwner() string

func (*URLPair) GetShortURL

func (x *URLPair) GetShortURL() string

func (*URLPair) ProtoMessage

func (*URLPair) ProtoMessage()

func (*URLPair) ProtoReflect

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

func (*URLPair) Reset

func (x *URLPair) Reset()

func (*URLPair) String

func (x *URLPair) String() string

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

Jump to

Keyboard shortcuts

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