teedy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvMustExist

func GetEnvMustExist(key string) string

Types

type ACLs

type ACLs struct {
	Id   string `json:"id"`
	Perm string `json:"perm"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type Client

type Client struct {
	Tag      *TagService
	Document *DocumentService
	File     *FileService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, username, password string) (*Client, error)

func NewFakeClient

func NewFakeClient() *Client

type Contributors

type Contributors struct {
	Username string `json:"username"`
	Email    string `json:"email"`
}

type Document

type Document struct {
	Id              string           `json:"id,omitempty"`
	Highlight       string           `json:"highlight,omitempty"`
	FileID          string           `json:"file_id,omitempty"`
	Title           string           `json:"title"`
	Description     string           `json:"description,omitempty"`
	CreateDate      *Timestamp       `json:"create_date,omitempty"`
	UpdateDate      *Timestamp       `json:"update_date,omitempty"`
	Language        string           `json:"language"`
	Shared          bool             `json:"shared,omitempty"`
	ActiveRoute     bool             `json:"active_route,omitempty"`
	CurrentStepName bool             `json:"current_step_name,omitempty"`
	FileCount       int              `json:"file_count,omitempty"`
	Tags            []*Tag           `json:"tags,omitempty"`
	Subject         string           `json:"subject,omitempty"`
	Identifier      string           `json:"identifier,omitempty"`
	Publisher       string           `json:"publisher,omitempty"`
	Format          string           `json:"format,omitempty"`
	Source          string           `json:"source,omitempty"`
	Type            string           `json:"type,omitempty"`
	Coverage        string           `json:"coverage,omitempty"`
	Rights          string           `json:"rights,omitempty"`
	Creator         string           `json:"creator,omitempty"`
	Writeable       bool             `json:"writeable,omitempty"`
	ACLs            []*ACLs          `json:"acls,omitempty"`
	InheritedACLs   []*InheritedACLs `json:"inherited_acls,omitempty"`
	Contributors    []*Contributors  `json:"contributors,omitempty"`
	Relations       []*Relations     `json:"relations,omitempty"`
	RouteStep       *RouteStep       `json:"route_step,omitempty"`
}

func NewDocument

func NewDocument(title, language string) *Document

func (*Document) UpdateTagIDsByName

func (d *Document) UpdateTagIDsByName(tags []*Tag)

UpdateTagIDsByName updates the documents tag ID's if the incoming tag matches its name. This is useful when importing backups of documents

type DocumentDeleteStatus

type DocumentDeleteStatus struct {
	Status string `json:"Status"`
}

type DocumentList

type DocumentList struct {
	Documents   []*Document `json:"documents"`
	Total       int         `json:"total"`
	Suggestions []string    `json:"suggestions"`
}

type DocumentService

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

func NewDocumentService

func NewDocumentService(client *resty.Client, api string) *DocumentService

func (*DocumentService) Add

func (d *DocumentService) Add(doc *Document) (*Document, error)

func (*DocumentService) Delete

func (*DocumentService) Get

func (d *DocumentService) Get(id string) (*Document, error)

func (*DocumentService) GetAll

func (d *DocumentService) GetAll() ([]*Document, error)

func (*DocumentService) GetByTagId added in v0.1.2

func (d *DocumentService) GetByTagId(tagid string) ([]*Document, error)

func (*DocumentService) GetByTitle

func (d *DocumentService) GetByTitle(title string) (*Document, error)

type File

type File struct {
	Id         string     `json:"id"`
	Processing bool       `json:"processing"`
	Name       string     `json:"name"`
	Version    int        `json:"version"`
	MimeType   string     `json:"mimetype"`
	DocumentId string     `json:"document_id"`
	CreateDate *Timestamp `json:"create_date,omitempty"`
	Size       int        `json:"size"`
}

type FileAddStatus

type FileAddStatus struct {
	Status string `json:"status"`
	Id     string `json:"id"`
	Size   int    `json:"size"`
}

type FileList

type FileList struct {
	Files []*File `json:"files,omitempty"`
}

type FileService

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

func NewFileService

func NewFileService(client *resty.Client, api string) *FileService

func (*FileService) Add

func (f *FileService) Add(documentId, previousFileId string, file *os.File) (*FileAddStatus, error)

func (*FileService) AddReader

func (f *FileService) AddReader(documentId, previousFileId, fileName, contentType string, reader io.Reader) (*FileAddStatus, error)

func (*FileService) Get

func (f *FileService) Get(documentId string) ([]*File, error)

func (*FileService) GetAll

func (f *FileService) GetAll() ([]*File, error)

func (*FileService) GetData

func (f *FileService) GetData(id string) ([]byte, error)

func (*FileService) GetZippedFiles

func (f *FileService) GetZippedFiles(id string) ([]byte, error)

type FormValues

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

func NewFormValues

func NewFormValues() *FormValues

func (*FormValues) AddIfNotEmpty

func (f *FormValues) AddIfNotEmpty(key, value string)

func (*FormValues) AddMandatory

func (f *FormValues) AddMandatory(key, value string)

func (*FormValues) Result

func (f *FormValues) Result() (url.Values, error)

type InheritedACLs

type InheritedACLs struct {
	Name        string `json:"name"`
	Perm        string `json:"perm"`
	SourceId    string `json:"source_id"`
	SourceName  string `json:"source_name"`
	SourceColor string `json:"source_color"`
	Type        string `json:"type"`
	Id          string `json:"id"`
}

type MultiError

type MultiError map[string]error

MultiError stores multiple errors.

func (MultiError) Error

func (e MultiError) Error() string

type Relations

type Relations struct {
	Id     string `json:"id"`
	Title  string `json:"title"`
	Source string `json:"source"`
}

type RouteStep

type RouteStep struct {
	Name           string `json:"name,omitempty"`
	Type           string `json:"type,omitempty"`
	Transitionable bool   `json:"transitionable,omitempty"`
}

type Tag

type Tag struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Color  string `json:"color"`
	Parent string `json:"parent,omitempty"`
}

func NewTag

func NewTag(name, color, parent string) (*Tag, error)

type TagDeleteStatus

type TagDeleteStatus struct {
	Status string `json:"status"`
}

type TagList

type TagList struct {
	Tags []*Tag `json:"tags"`
}

type TagService

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

func NewTagService

func NewTagService(client *resty.Client, api string) *TagService

func (*TagService) Add

func (t *TagService) Add(tag *Tag) (*Tag, error)

func (*TagService) Delete

func (t *TagService) Delete(id string) (*TagDeleteStatus, error)

func (*TagService) Get

func (t *TagService) Get(id string) (*Tag, error)

func (*TagService) GetAll

func (t *TagService) GetAll() ([]*Tag, error)

func (*TagService) GetByName

func (t *TagService) GetByName(name string) (*Tag, error)

func (*TagService) Update

func (t *TagService) Update(id string, tag *Tag) (*Tag, error)

type TeedyAPIError

type TeedyAPIError struct {
	GetAll error
	Get    error
	Add    error
	Delete error
	Update error
}

func NewTeedyAPIError

func NewTeedyAPIError(api string) *TeedyAPIError

func (*TeedyAPIError) Custom

func (n *TeedyAPIError) Custom(description string) error

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp defines a timestamp encoded as epoch seconds in JSON

func (Timestamp) Marshal

func (t Timestamp) Marshal() string

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert the timestamp to JSON

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(s []byte) (err error)

UnmarshalJSON is used to convert the timestamp from JSON

type ZippedFile

type ZippedFile struct {
	Filename string
	Content  []byte
}

Jump to

Keyboard shortcuts

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