spire

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const BugoutSpireURL string = "https://spire.bugout.dev"

Default Spire URL

Variables

This section is empty.

Functions

func IsValidJournalPermission

func IsValidJournalPermission(permission string) bool

func IsValidMemberType

func IsValidMemberType(memberType string) bool

func ValidJournalPermissions

func ValidJournalPermissions() []string

func ValidMemberTypes

func ValidMemberTypes() []string

Types

type Entry

type Entry struct {
	Id          string   `json:"id,omitempty"`
	Url         string   `json:"entry_url,omitempty"`
	JournalURL  string   `json:"journal_url,omitempty"`
	Title       string   `json:"title"`
	Content     string   `json:"content"`
	Tags        []string `json:"tags"`
	CreatedAt   string   `json:"created_at"`
	UpdatedAt   string   `json:"updated_at"`
	ContextUrl  string   `json:"context_url,omitempty"`
	ContextType string   `json:"context_type,omitempty"`
	Score       float64  `json:"score,omitempty"`
}

type EntryContext

type EntryContext struct {
	ContextType string
	ContextID   string
	ContextURL  string
}

type EntryResultsPage

type EntryResultsPage struct {
	TotalResults int     `json:"total_results"`
	Offset       int     `json:"offset,omitempty"`
	NextOffset   int     `json:"next_offset,omitempty"`
	MaxScore     float64 `json:"max_score"`
	Results      []Entry `json:"results"`
}

type Journal

type Journal struct {
	Id           string   `json:"id"`
	BugoutUserID string   `json:"bugout_user_id"`
	HolderIDs    []string `json:"holder_ids"`
	Name         string   `json:"name"`
	CreatedAt    string   `json:"created_at"`
	UpdatedAt    string   `json:"updated_at"`
}

type JournalPermission

type JournalPermission struct {
	JournalID  string `json:"journal_id"`
	HolderID   string `json:"holder_id"`
	HolderType string `json:"holder_type"`
	Permission string `json:"permission"`
}

type JournalPermissionsList

type JournalPermissionsList struct {
	Scopes []JournalPermission `json:"scopes"`
}

type JournalsList

type JournalsList struct {
	Journals []Journal `json:"journals"`
}

type SpireCaller

type SpireCaller interface {
	Ping() (string, error)
	CreateJournal(token, name string) (Journal, error)
	GetJournal(token, journalID string) (Journal, error)
	ListJournals(token string) (JournalsList, error)
	UpdateJournal(token, journalID, name string) (Journal, error)
	DeleteJournal(token, journalID string) (Journal, error)
	AddJournalMember(token, journalID, memberID, memberType string, permissions []string) (JournalPermissionsList, error)
	RemoveJournalMember(token, journalID, memberID, memberType string, permissions []string) (JournalPermissionsList, error)
	CreateEntry(token, journalID, title, content string, tags []string, context EntryContext) (Entry, error)
	DeleteEntry(token, journalID, entryID string) (Entry, error)
	GetEntry(token, journalID, entryID string) (Entry, error)
	ListEntries(token, journalID string, limit, offset int) (EntryResultsPage, error)
	SearchEntries(token, journalID, searchQuery string, limit, offset int, queryParameters map[string]string) (EntryResultsPage, error)
	TagEntry(token, journalID, entryID string, tags []string) (Entry, error)
	UntagEntry(token, journalID, entryID string, tags []string) (Entry, error)
	UpdateEntry(token, journalID, entryID, title, content string) (Entry, error)
}

type SpireClient

type SpireClient struct {
	SpireURL   string
	Routes     SpireRoutes
	HTTPClient *http.Client
}

func ClientFromEnv

func ClientFromEnv() (SpireClient, error)

func NewClient

func NewClient(spireURL string, timeout time.Duration) SpireClient

func (SpireClient) AddJournalMember

func (client SpireClient) AddJournalMember(token, journalID, memberID, memberType string, permissions []string) (JournalPermissionsList, error)

func (SpireClient) CreateEntry

func (client SpireClient) CreateEntry(token, journalID, title, content string, tags []string, context EntryContext) (Entry, error)

func (SpireClient) CreateJournal

func (client SpireClient) CreateJournal(token, name string) (Journal, error)

func (SpireClient) DeleteEntry

func (client SpireClient) DeleteEntry(token, journalID, entryID string) (Entry, error)

func (SpireClient) DeleteJournal

func (client SpireClient) DeleteJournal(token, journalID string) (Journal, error)

func (SpireClient) GetEntry

func (client SpireClient) GetEntry(token, journalID, entryID string) (Entry, error)

func (SpireClient) GetJournal

func (client SpireClient) GetJournal(token, journalID string) (Journal, error)

func (SpireClient) ListEntries

func (client SpireClient) ListEntries(token, journalID string, limit, offset int) (EntryResultsPage, error)

func (SpireClient) ListJournals

func (client SpireClient) ListJournals(token string) (JournalsList, error)

func (SpireClient) Ping

func (client SpireClient) Ping() (string, error)

func (SpireClient) RemoveJournalMember

func (client SpireClient) RemoveJournalMember(token, journalID, memberID, memberType string, permissions []string) (JournalPermissionsList, error)

func (SpireClient) SearchEntries

func (client SpireClient) SearchEntries(token, journalID, searchQuery string, limit, offset int, queryParameters map[string]string) (EntryResultsPage, error)

func (SpireClient) TagEntry

func (client SpireClient) TagEntry(token, journalID, entryID string, tags []string) (Entry, error)

func (SpireClient) UntagEntry

func (client SpireClient) UntagEntry(token, journalID, entryID string, tags []string) (Entry, error)

func (SpireClient) UpdateEntry

func (client SpireClient) UpdateEntry(token, journalID, entryID, title, content string) (Entry, error)

func (SpireClient) UpdateJournal

func (client SpireClient) UpdateJournal(token, journalID, name string) (Journal, error)

type SpireRoutes

type SpireRoutes struct {
	Ping     string
	Journals string
}

func RoutesFromURL

func RoutesFromURL(spireURL string) SpireRoutes

Jump to

Keyboard shortcuts

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