Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPrerequisites(prereq ...*Prerequisite) bool
- func CompletePathFlag(toComplete string, completeAll bool) ([]cobra.Completion, cobra.ShellCompDirective)
- func DeleteJsonString(baseUrl, path, jsonString, bearerToken string) (string, error)
- func DuplicateEntryExists(baseUrl, jsonString, bearerToken string) (bool, error)
- func DuplicateEntryId(baseUrl, jsonString, bearerToken string) (string, error)
- func DuplicateFolderExists(baseUrl, jsonString, bearerToken string) (bool, error)
- func DuplicateFolderId(baseUrl, jsonString, bearerToken string) (string, error)
- func Exit(msg ...any)
- func ExitFatal(msg ...any)
- func GetIdByResourcePath(baseUrl, resourcePath, resourceType, bearerToken string) (string, error)
- func GetJsonBody(baseUrl, path, bearerToken string) (string, error)
- func GetParentIdByResourcePath(baseUrl, resourcePath, bearerToken string) (string, error)
- func GetValidPaths(baseUrl, resourcePath string, completeAll bool, bearerToken string) ([]string, []string, error)
- func LoadConfig() (string, string)
- func MarshalEntry(entry *Entry) (string, error)
- func MarshalFolder(folder *Folder) (string, error)
- func PasswordPrompt(label string) string
- func PatchJsonString(baseUrl, path, jsonString, bearerToken string) (string, error)
- func PathAndNameMatching(resourcePath, name string) bool
- func PostJsonString(baseUrl, path, jsonString, bearerToken string) (string, error)
- func PostSearch(baseUrl, query, bearerToken string) (string, error)
- func PrettyPrintJson(jsonString string) (string, error)
- func StringPrompt(label string) string
- func TrimDoubleQuotes(str string) string
- func Unescape(str string) string
- func WriteConfigFile(file, key string, value string) error
- func WriteTokenFile(file, accessToken string, expiresAt int64) error
- type BearerToken
- type ConfigFile
- type Entry
- type Folder
- type FolderOutput
- type Prerequisite
- type SearchEntry
- type SearchGroup
- type SearchOutput
- type Tag
- type Token
- type TokenFile
Constants ¶
View Source
const ( PathRootFolder = "/api/v5/rest/folders/root" PathEntry = "/api/v5/rest/entries" PathFolders = "/api/v5/rest/folders" PathAccessLevels = "/api/v5/rest/accesslevels" PathSearch = "/api/v5/rest/search" PathServerInfo = "/api/v5/rest/GetServerInfo" PathPwStr = "/api/v5/rest/passwordstrength" )
Variables ¶
View Source
var ( ErrPrereqNotMet = errors.New("error: not all prerequisites met") ErrNotFound = errors.New("error: the requested resource was not found") ErrBadRequest = errors.New("error: bad request") ErrInvalidCredentials = errors.New("error: invalid or incomplete credentials") ErrPathStartIncorrect = errors.New("error: path must start with 'Root/'") ErrInvalidResourceType = errors.New("error: invalid resource type, must be 'entry' or 'folder'") ErrNoResult = errors.New("error: no matching entries or folders") ErrParentNotFound = errors.New("error: parent folder not found") ErrAmbiguousResult = errors.New("error: ambiguous result, multiple matching entries or folders") ErrLastPathComp = errors.New("error: last path component is empty") ErrDuplicateEntry = errors.New("error: duplicate entry found, skipping creation") ErrDuplicateFolder = errors.New("error: duplicate folder found, skipping creation") ErrArchiveNotEnabled = errors.New("error: entry/folder/accessrowid does not exist or archiving is possibly disabled") )
Functions ¶
func CheckPrerequisites ¶
func CheckPrerequisites(prereq ...*Prerequisite) bool
func CompletePathFlag ¶ added in v0.9.0
func CompletePathFlag(toComplete string, completeAll bool) ([]cobra.Completion, cobra.ShellCompDirective)
func DeleteJsonString ¶ added in v0.2.0
func DuplicateEntryExists ¶ added in v0.0.2
func DuplicateEntryId ¶ added in v0.1.0
func DuplicateFolderExists ¶ added in v0.0.2
func DuplicateFolderId ¶ added in v0.1.0
func GetIdByResourcePath ¶
func GetJsonBody ¶
func GetValidPaths ¶ added in v0.9.0
func LoadConfig ¶ added in v0.5.0
func MarshalEntry ¶ added in v0.0.2
func MarshalFolder ¶ added in v0.0.2
func PasswordPrompt ¶
func PatchJsonString ¶ added in v0.1.0
func PathAndNameMatching ¶
func PostJsonString ¶
func PostSearch ¶
func PrettyPrintJson ¶ added in v0.2.0
func StringPrompt ¶
func TrimDoubleQuotes ¶ added in v0.3.0
func WriteConfigFile ¶
func WriteTokenFile ¶
Types ¶
type BearerToken ¶
type BearerToken struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
}
func GetBearerToken ¶
func GetBearerToken(baseUrl, username, password string) (*BearerToken, error)
type ConfigFile ¶
type Entry ¶ added in v0.0.2
type Entry struct {
Tags []Tag `json:"Tags,omitempty"`
Id string `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
Username string `json:"Username,omitempty"`
Password string `json:"Password,omitempty"`
Url string `json:"Url,omitempty"`
Notes string `json:"Notes,omitempty"`
GroupId string `json:"GroupId,omitempty"`
Expires string `json:"Expires,omitempty"`
}
func UnmarshalEntry ¶ added in v0.0.2
type Folder ¶ added in v0.0.2
type Folder struct {
Children []Entry `json:"Children,omitempty"`
Tags []Tag `json:"Tags,omitempty"`
Id string `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
ParentId string `json:"ParentId,omitempty"`
Notes string `json:"Notes,omitempty"`
Expires string `json:"Expires,omitempty"`
}
func UnmarshalFolder ¶ added in v0.0.2
type FolderOutput ¶ added in v0.0.2
func UnmarshalFolderOutput ¶ added in v0.0.2
func UnmarshalFolderOutput(jsonString string) (*FolderOutput, error)
type Prerequisite ¶ added in v0.8.1
func IsServerUrlSet ¶
func IsServerUrlSet() *Prerequisite
func IsTokenValid ¶
func IsTokenValid() *Prerequisite
type SearchEntry ¶ added in v0.0.2
type SearchGroup ¶ added in v0.0.2
type SearchOutput ¶ added in v0.0.2
type SearchOutput struct {
Credentials []SearchEntry
Groups []SearchGroup
}
Click to show internal directories.
Click to hide internal directories.