shortcuts

package
v0.0.0-...-3f4c8ed Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 13 Imported by: 1

Documentation

Overview

Package shortcuts is about the .url shortcuts. They are files and, as such, can be manipulated via the /files API. But the stack also offer some routes to make it easier to create and open them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c echo.Context) error

Create is the API handler for POST /shortcuts. It can be used to create a shortcut from a JSON description.

func FromJSONAPI

func FromJSONAPI(c echo.Context) (*vfs.FileDoc, []byte, error)

FromJSONAPI parses a JSON-API payload for a shortcut and returns a FileDoc and body for it.

func Get

func Get(c echo.Context) error

Get is the API handler for GET /shortcuts/:id. It follows the link or send a JSON-API response with information about the shortcut, depending on the Accept header.

func Routes

func Routes(router *echo.Group)

Routes set the routing for the shortcuts.

Types

type Shortcut

type Shortcut struct {
	DocID    string       `json:"_id"`
	DocRev   string       `json:"_rev,omitempty"`
	Name     string       `json:"name"`
	DirID    string       `json:"dir_id"`
	URL      string       `json:"url"`
	Metadata vfs.Metadata `json:"metadata"`
}

Shortcut is a struct with the high-level information about a .url file.

func (*Shortcut) Clone

func (s *Shortcut) Clone() couchdb.Doc

Clone implements couchdb.Doc

func (*Shortcut) DocType

func (s *Shortcut) DocType() string

DocType returns the shortcut type

func (*Shortcut) ID

func (s *Shortcut) ID() string

ID returns the shortcut qualified identifier

func (*Shortcut) Included

func (s *Shortcut) Included() []jsonapi.Object

Included is a method of the jsonapi.Document interface

func (s *Shortcut) Links() *jsonapi.LinksList

Links is a method of the jsonapi.Document interface

func (*Shortcut) Relationships

func (s *Shortcut) Relationships() jsonapi.RelationshipMap

Relationships is a method of the jsonapi.Document interface

func (*Shortcut) Rev

func (s *Shortcut) Rev() string

Rev returns the shortcut revision

func (*Shortcut) SetID

func (s *Shortcut) SetID(id string)

SetID changes the shortcut qualified identifier

func (*Shortcut) SetRev

func (s *Shortcut) SetRev(rev string)

SetRev changes the shortcut revision

Jump to

Keyboard shortcuts

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