Documentation
¶
Index ¶
- Variables
- func IsValidJsonString(s string) bool
- func JsonToReader(s any) io.Reader
- func MakeDocumentPath(document types.CreateDocumentBody) string
- func MakeFolderPath(folder types.CreateFolderBody) string
- type Config
- type Instance
- func (jsb *Instance) Authenticate() (*types.AuthenticatedData, *RequestError)
- func (jsb *Instance) Authenticated() bool
- func (jsb *Instance) CreateDocument(document types.CreateDocumentBody) (*types.NewDocument, *RequestError)
- func (jsb *Instance) CreateDocumentIfNotExists(document types.CreateDocumentBody) (*types.NewDocument, *RequestError)
- func (jsb *Instance) CreateFolder(body types.CreateFolderBody) (*types.NewFolder, *RequestError)
- func (jsb *Instance) CreateFolderIfNotExists(body types.CreateFolderBody) (*types.NewFolder, *RequestError)
- func (jsb *Instance) DeleteDocument(idOrPath string) (*types.DeletedDocument, *RequestError)
- func (jsb *Instance) GetContent(idOrPath string) (any, *RequestError)
- func (jsb *Instance) GetContentAsString(idOrPath string) (string, *RequestError)
- func (jsb *Instance) GetDocumentMeta(idOrPath string) (*types.DocumentMeta, *RequestError)
- func (jsb *Instance) GetFolder(idOrPath string) (*types.Folder, *RequestError)
- func (jsb *Instance) GetFolderWithStats(idOrPath string) (*types.Folder, *RequestError)
- func (jsb *Instance) GetGithubContent(path string) (any, *RequestError)
- func (jsb *Instance) GetGithubContentAsString(path string) (string, *RequestError)
- func (jsb *Instance) GetOwnContent(idOrPath string) (any, *RequestError)
- func (jsb *Instance) GetOwnContentAsString(idOrPath string) (string, *RequestError)
- func (jsb *Instance) GetOwnDocumentMeta(idOrPath string) (*types.DocumentMeta, *RequestError)
- func (jsb *Instance) GetUsername() string
- func (jsb *Instance) HasOwnDocument(idOrPath string) bool
- func (jsb *Instance) SetHost(host string)
- func (jsb *Instance) UpdateOwnDocument(idOrPath string, content string) (*types.UpdatedDocument, *RequestError)
- func (jsb *Instance) UploadDocument(document types.UploadDocumentBody) (*types.NewDocument, *RequestError)
- type Keys
- type RequestError
Constants ¶
This section is empty.
Variables ¶
var InvalidJsonError = RequestError{"invalid_json_content", "Content is not a valid JSON string"}
Functions ¶
func IsValidJsonString ¶
IsValidJsonString - check if a string is a valid json string
func JsonToReader ¶
JsonToReader - convert json string to io.Reader
func MakeDocumentPath ¶
func MakeDocumentPath(document types.CreateDocumentBody) string
MakeDocumentPath - generate a document full path
func MakeFolderPath ¶ added in v0.1.5
func MakeFolderPath(folder types.CreateFolderBody) string
MakeFolderPath - generate a folder full path
Types ¶
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func InitWithoutKeys ¶
func InitWithoutKeys() Instance
InitWithoutKeys - initializes the jsonbank instance without Keys
func (*Instance) Authenticate ¶
func (jsb *Instance) Authenticate() (*types.AuthenticatedData, *RequestError)
Authenticate - authenticates the jsonbank instance
func (*Instance) Authenticated ¶
Authenticated - checks if the jsonbank instance is authenticated
func (*Instance) CreateDocument ¶
func (jsb *Instance) CreateDocument(document types.CreateDocumentBody) (*types.NewDocument, *RequestError)
CreateDocument - creates a document
func (*Instance) CreateDocumentIfNotExists ¶
func (jsb *Instance) CreateDocumentIfNotExists(document types.CreateDocumentBody) (*types.NewDocument, *RequestError)
CreateDocumentIfNotExists - creates a document if it does not exist
func (*Instance) CreateFolder ¶
func (jsb *Instance) CreateFolder(body types.CreateFolderBody) (*types.NewFolder, *RequestError)
CreateFolder - creates a folder
func (*Instance) CreateFolderIfNotExists ¶ added in v0.1.5
func (jsb *Instance) CreateFolderIfNotExists(body types.CreateFolderBody) (*types.NewFolder, *RequestError)
CreateFolderIfNotExists - creates a folder if it does not exist try to create the folder, if it exists then fetch the folder
func (*Instance) DeleteDocument ¶
func (jsb *Instance) DeleteDocument(idOrPath string) (*types.DeletedDocument, *RequestError)
DeleteDocument - deletes a document
func (*Instance) GetContent ¶ added in v0.1.1
func (jsb *Instance) GetContent(idOrPath string) (any, *RequestError)
GetContent - get public content from jsonbank
func (*Instance) GetContentAsString ¶ added in v0.1.7
func (jsb *Instance) GetContentAsString(idOrPath string) (string, *RequestError)
GetContentAsString - get public content from jsonbank as string
func (*Instance) GetDocumentMeta ¶ added in v0.1.1
func (jsb *Instance) GetDocumentMeta(idOrPath string) (*types.DocumentMeta, *RequestError)
GetDocumentMeta - get public document meta
func (*Instance) GetFolder ¶ added in v0.1.5
func (jsb *Instance) GetFolder(idOrPath string) (*types.Folder, *RequestError)
GetFolder - gets a folder
func (*Instance) GetFolderWithStats ¶ added in v0.1.5
func (jsb *Instance) GetFolderWithStats(idOrPath string) (*types.Folder, *RequestError)
GetFolderWithStats - gets a folder with stats
func (*Instance) GetGithubContent ¶ added in v0.1.1
func (jsb *Instance) GetGithubContent(path string) (any, *RequestError)
GetGithubContent - get public content from GitHub
func (*Instance) GetGithubContentAsString ¶ added in v0.1.7
func (jsb *Instance) GetGithubContentAsString(path string) (string, *RequestError)
GetGithubContentAsString - get public content from GitHub as string
func (*Instance) GetOwnContent ¶
func (jsb *Instance) GetOwnContent(idOrPath string) (any, *RequestError)
GetOwnContent - gets the content of a document owned by the authenticated user
func (*Instance) GetOwnContentAsString ¶ added in v0.1.7
func (jsb *Instance) GetOwnContentAsString(idOrPath string) (string, *RequestError)
GetOwnContentAsString - gets the content of a document owned by the authenticated user as string
func (*Instance) GetOwnDocumentMeta ¶
func (jsb *Instance) GetOwnDocumentMeta(idOrPath string) (*types.DocumentMeta, *RequestError)
GetOwnDocumentMeta - gets the content meta of the authenticated user
func (*Instance) GetUsername ¶
GetUsername - gets the username of the authenticated user
func (*Instance) HasOwnDocument ¶
HasOwnDocument - tries to get the content then returns true if it exists
func (*Instance) UpdateOwnDocument ¶
func (jsb *Instance) UpdateOwnDocument(idOrPath string, content string) (*types.UpdatedDocument, *RequestError)
UpdateOwnDocument - Update document owned by the authenticated user
func (*Instance) UploadDocument ¶
func (jsb *Instance) UploadDocument(document types.UploadDocumentBody) (*types.NewDocument, *RequestError)
UploadDocument - uploads a json document
type RequestError ¶
func (*RequestError) Error ¶
func (error *RequestError) Error() string