url

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 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 CreateRequest added in v1.1.0

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 added in v1.1.0

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetDestinationURL added in v1.1.0

func (x *CreateRequest) GetDestinationURL() string

func (*CreateRequest) GetId added in v1.1.0

func (x *CreateRequest) GetId() string

func (*CreateRequest) ProtoMessage added in v1.1.0

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect added in v1.1.0

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

func (*CreateRequest) Reset added in v1.1.0

func (x *CreateRequest) Reset()

func (*CreateRequest) String added in v1.1.0

func (x *CreateRequest) String() string

type CreateResponse added in v1.1.0

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

func (*CreateResponse) Descriptor deprecated added in v1.1.0

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetUrl added in v1.1.0

func (x *CreateResponse) GetUrl() *URLPair

func (*CreateResponse) ProtoMessage added in v1.1.0

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect added in v1.1.0

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

func (*CreateResponse) Reset added in v1.1.0

func (x *CreateResponse) Reset()

func (*CreateResponse) String added in v1.1.0

func (x *CreateResponse) String() string

type DeleteRequest added in v1.0.0

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 added in v1.0.0

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetId added in v1.1.0

func (x *DeleteRequest) GetId() string

func (*DeleteRequest) GetShortURL added in v1.0.0

func (x *DeleteRequest) GetShortURL() string

func (*DeleteRequest) ProtoMessage added in v1.0.0

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect added in v1.0.0

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

func (*DeleteRequest) Reset added in v1.0.0

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String added in v1.0.0

func (x *DeleteRequest) String() string

type DeleteResponse added in v1.0.0

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

func (*DeleteResponse) Descriptor deprecated added in v1.0.0

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) ProtoMessage added in v1.0.0

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect added in v1.0.0

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

func (*DeleteResponse) Reset added in v1.0.0

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String added in v1.0.0

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 added in v1.1.0

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 added in v1.1.0

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

Deprecated: Use ResolveRequest.ProtoReflect.Descriptor instead.

func (*ResolveRequest) GetId added in v1.3.0

func (x *ResolveRequest) GetId() string

func (*ResolveRequest) GetShortURL added in v1.1.0

func (x *ResolveRequest) GetShortURL() string

func (*ResolveRequest) ProtoMessage added in v1.1.0

func (*ResolveRequest) ProtoMessage()

func (*ResolveRequest) ProtoReflect added in v1.1.0

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

func (*ResolveRequest) Reset added in v1.1.0

func (x *ResolveRequest) Reset()

func (*ResolveRequest) String added in v1.1.0

func (x *ResolveRequest) String() string

type ResolveResponse added in v1.1.0

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

func (*ResolveResponse) Descriptor deprecated added in v1.1.0

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

Deprecated: Use ResolveResponse.ProtoReflect.Descriptor instead.

func (*ResolveResponse) GetDestinationURL added in v1.1.0

func (x *ResolveResponse) GetDestinationURL() string

func (*ResolveResponse) ProtoMessage added in v1.1.0

func (*ResolveResponse) ProtoMessage()

func (*ResolveResponse) ProtoReflect added in v1.1.0

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

func (*ResolveResponse) Reset added in v1.1.0

func (x *ResolveResponse) Reset()

func (*ResolveResponse) String added in v1.1.0

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) Descriptor() ([]byte, []int)

Deprecated: Use URLPair.ProtoReflect.Descriptor instead.

func (*URLPair) GetCreated

func (x *URLPair) GetCreated() string

func (*URLPair) GetDestinationURL

func (x *URLPair) GetDestinationURL() string

func (*URLPair) GetHitCount

func (x *URLPair) GetHitCount() int64

func (*URLPair) GetId added in v1.1.0

func (x *URLPair) GetId() 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 UpdateRequest added in v1.1.0

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 added in v1.1.0

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetDestinationURL added in v1.1.0

func (x *UpdateRequest) GetDestinationURL() string

func (*UpdateRequest) GetId added in v1.1.0

func (x *UpdateRequest) GetId() string

func (*UpdateRequest) GetShortURL added in v1.1.0

func (x *UpdateRequest) GetShortURL() string

func (*UpdateRequest) ProtoMessage added in v1.1.0

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect added in v1.1.0

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

func (*UpdateRequest) Reset added in v1.1.0

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String added in v1.1.0

func (x *UpdateRequest) String() string

type UpdateResponse added in v1.1.0

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

func (*UpdateResponse) Descriptor deprecated added in v1.1.0

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) ProtoMessage added in v1.1.0

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect added in v1.1.0

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

func (*UpdateResponse) Reset added in v1.1.0

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String added in v1.1.0

func (x *UpdateResponse) String() string

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

Jump to

Keyboard shortcuts

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