client

package
v0.0.0-...-84d5eb4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyticsShortnerPath

func AnalyticsShortnerPath(path string) string

AnalyticsShortnerPath computes a request path to the analytics action of shortner.

func CreateShortnerPath

func CreateShortnerPath() string

CreateShortnerPath computes a request path to the create action of shortner.

func DeleteShortnerPath

func DeleteShortnerPath(path string) string

DeleteShortnerPath computes a request path to the delete action of shortner.

func GetShortnerPath

func GetShortnerPath(path string) string

GetShortnerPath computes a request path to the get action of shortner.

func UpdateShortnerPath

func UpdateShortnerPath(path string) string

UpdateShortnerPath computes a request path to the update action of shortner.

Types

type Analytics

type Analytics struct {
	Hits *int `form:"hits,omitempty" json:"hits,omitempty" yaml:"hits,omitempty" xml:"hits,omitempty"`
}

Url analytics (default view)

Identifier: application/vnd.analytics+json; view=default

type Client

type Client struct {
	*goaclient.Client
	Encoder *goa.HTTPEncoder
	Decoder *goa.HTTPDecoder
}

Client is the URL shortner API service client.

func New

func New(c goaclient.Doer) *Client

New instantiates the client.

func (*Client) AnalyticsShortner

func (c *Client) AnalyticsShortner(ctx context.Context, path string) (*http.Response, error)

Get analytics for a URL

func (*Client) CreateShortner

func (c *Client) CreateShortner(ctx context.Context, path string, payload *CreateLinkPayload) (*http.Response, error)

Create a url

func (*Client) DecodeAnalytics

func (c *Client) DecodeAnalytics(resp *http.Response) (*Analytics, error)

DecodeAnalytics decodes the Analytics instance encoded in resp body.

func (*Client) DecodeURL

func (c *Client) DecodeURL(resp *http.Response) (*URL, error)

DecodeURL decodes the URL instance encoded in resp body.

func (*Client) DeleteShortner

func (c *Client) DeleteShortner(ctx context.Context, path string) (*http.Response, error)

Delete a url

func (*Client) GetShortner

func (c *Client) GetShortner(ctx context.Context, path string) (*http.Response, error)

Get a URL

func (*Client) NewAnalyticsShortnerRequest

func (c *Client) NewAnalyticsShortnerRequest(ctx context.Context, path string) (*http.Request, error)

NewAnalyticsShortnerRequest create the request corresponding to the analytics action endpoint of the shortner resource.

func (*Client) NewCreateShortnerRequest

func (c *Client) NewCreateShortnerRequest(ctx context.Context, path string, payload *CreateLinkPayload) (*http.Request, error)

NewCreateShortnerRequest create the request corresponding to the create action endpoint of the shortner resource.

func (*Client) NewDeleteShortnerRequest

func (c *Client) NewDeleteShortnerRequest(ctx context.Context, path string) (*http.Request, error)

NewDeleteShortnerRequest create the request corresponding to the delete action endpoint of the shortner resource.

func (*Client) NewGetShortnerRequest

func (c *Client) NewGetShortnerRequest(ctx context.Context, path string) (*http.Request, error)

NewGetShortnerRequest create the request corresponding to the get action endpoint of the shortner resource.

func (*Client) NewUpdateShortnerRequest

func (c *Client) NewUpdateShortnerRequest(ctx context.Context, path string, payload *UpdateLinkPayload) (*http.Request, error)

NewUpdateShortnerRequest create the request corresponding to the update action endpoint of the shortner resource.

func (*Client) UpdateShortner

func (c *Client) UpdateShortner(ctx context.Context, path string, payload *UpdateLinkPayload) (*http.Response, error)

Update a url

type CreateLinkPayload

type CreateLinkPayload struct {
	Path string `form:"path" json:"path" yaml:"path" xml:"path"`
	URL  string `form:"url" json:"url" yaml:"url" xml:"url"`
}

CreateLinkPayload user type.

func (*CreateLinkPayload) Validate

func (ut *CreateLinkPayload) Validate() (err error)

Validate validates the CreateLinkPayload type instance.

type URL

type URL struct {
	// URL ID
	ID *int `form:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" xml:"id,omitempty"`
	// URL path key
	Path *string `form:"path,omitempty" json:"path,omitempty" yaml:"path,omitempty" xml:"path,omitempty"`
	// External URL
	URL *string `form:"url,omitempty" json:"url,omitempty" yaml:"url,omitempty" xml:"url,omitempty"`
}

A URL (default view)

Identifier: application/vnd.url+json; view=default

type UpdateLinkPayload

type UpdateLinkPayload struct {
	Path string `form:"path" json:"path" yaml:"path" xml:"path"`
	URL  string `form:"url" json:"url" yaml:"url" xml:"url"`
}

UpdateLinkPayload user type.

func (*UpdateLinkPayload) Validate

func (ut *UpdateLinkPayload) Validate() (err error)

Validate validates the UpdateLinkPayload type instance.

Jump to

Keyboard shortcuts

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