shiori

package module
v0.0.0-...-9a80737 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 6 Imported by: 0

README

shiori is a web application to simply store, manage and search through links by meta variables like description or tags. MeiliSearch is used therefore as high-performance full-text search database to provide blazingly fast search results even in huge datasets. The dataset will be accessable over a REST API via web or CLI application.


shiori-go

This go package provides REST request bindings to access the shiori REST API gateway instance.

$ go get github.com/shiori-ex/shiori-go

Documentation

Overview

Package shiori wraps REST API request bindings to the shiori gateway.

Index

Constants

View Source
const (
	// Package version
	VERSION = "1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides a request client to execute REST API requests with.

func NewClient

func NewClient(token string, endpoint string) (c *Client)

NewClient returns a new instance of client with the passed authorization token which connects to the passed endpoint URL of the siori gateway instance.

func (c *Client) CreateLink(link *Link) (res *Link, err error)

CreateLink creates a new link object and returns it.

func (c *Client) Link(id int) (link *Link, err error)

Link returns the info of the pased links ID.

func (c *Client) Links(limit, offset int) (links []*Link, err error)

Links returns a list of links limited by the passed limit and offset by the passed offset.

func (c *Client) RemoveLink(id int) (err error)

RemoveLink removes a link by passed ID of the link.

func (*Client) Search

func (c *Client) Search(query string, limit, offset int) (sr *SearchResult, err error)

Search executes a search request with the passed query string and returns the search result. The hits are capped by the passed limit and offset by the passed offset.

func (c *Client) UpdateLink(link *Link) (res *Link, err error)

UpdateLink replaces the link object (by ID) passed.

`nil` or empty fields are interpreted as to be reset.

type Link struct {
	Description string   `json:"description"`
	Id          int      `json:"id,omitempty"`
	IdStr       string   `json:"id_str,omitempty"`
	Tags        []string `json:"tags"`
	Url         string   `json:"url"`
}

Link request and response model.

type SearchResult

type SearchResult struct {
	Hits             []*Link `json:"hits"`
	ProcessingTimeMs int     `json:"processing_time_ms"`
	Query            string  `json:"query"`
}

SearchResult response model.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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