Documentation
¶
Overview ¶
Copyright © 2024 Martijn Evers
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2024 Martijn Evers ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2024 Martijn Evers ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2024 Martijn Evers ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func CheckPrerequisites(prereq ...*Prerequisite) bool
- 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 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 ¶
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 ¶
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") 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 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 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 Id string Name string Username string Password string Url string Notes string GroupId string Expires string }
func UnmarshalEntry ¶ added in v0.0.2
type Folder ¶ added in v0.0.2
type Folder struct { Children []Entry Tags []Tag Id string Name string ParentId string Notes string Expires string }
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 }