\Mnemo_Api

Mnemo external API interface.

This file defines Mnemo's external API interface. Other applications can interact with Mnemo through this API.

Copyright 2001-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (ASL). If you did not receive this file, see http://www.horde.org/licenses/apache.

Summary

Methods
Properties
Constants
removeUserData()
listNotepads()
browse()
put()
path_delete()
listUids()
getChanges()
getChangesByModSeq()
listBy()
getActionTimestamp()
getHighestModSeq()
import()
export()
delete()
replace()
sources()
getDefaultShare()
addNotepad()
deleteNotepad()
updateNotepad()
listTagInfo()
searchTags()
No public properties found
No constants found
_modified()
$_links
N/A
No private methods found
No private properties found
N/A

Properties

$_links

$_links : array

Links.

Type

array

Methods

removeUserData()

removeUserData(string  $user) 

Removes user data.

Parameters

string $user

Name of user to remove data for.

Throws

\Mnemo_Exception

listNotepads()

listNotepads(boolean  $owneronly, integer  $permission) : array

Parameters

boolean $owneronly

Only return notepads that this user owns? Defaults to false.

integer $permission

The permission to filter notepads by.

Returns

array —

The notepads.

browse()

browse(string  $path = '', array  $properties = array()) : array

Browse through Mnemo's object tree.

Parameters

string $path

The level of the tree to browse.

array $properties

The item properties to return. Defaults to 'name', 'icon', and 'browseable'.

Returns

array —

The contents of $path

put()

put(string  $path, string  $content, string  $content_type) : array

Saves a file into the Mnemo tree.

Parameters

string $path

The path where to PUT the file.

string $content

The file content.

string $content_type

The file's content type.

Returns

array —

The note UIDs

path_delete()

path_delete(string  $path) : string

Deletes a file from the Mnemo tree.

Parameters

string $path

The path to the file.

Throws

\Mnemo_Exception

Returns

string —

The note's UID

listUids()

listUids(array|string  $notepads = null) : array

Returns an array of UIDs for all notes that the current user is authorized to see.

Parameters

array|string $notepads

The notepad(s) to list notes from.

Throws

\Mnemo_Exception
\Horde_Exception_PermissionDenied

Returns

array —

An array of UIDs for all notes the user can access.

getChanges()

getChanges(integer  $start, integer  $end, boolean  $isModSeq = false, string  $notepad = null) : array

Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.

Parameters

integer $start

The starting timestamp

integer $end

The ending timestamp.

boolean $isModSeq

If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1

string $notepad

The source to check. @since 4.2.0

Returns

array —

An hash with 'add', 'modify' and 'delete' arrays.

getChangesByModSeq()

getChangesByModSeq(integer  $start, integer  $end, string  $notepad = null) : array

Return all changes occuring between the specified modification sequences.

Parameters

integer $start

The starting modseq.

integer $end

The ending modseq.

string $notepad

The source to check. @since 4.2.0

Returns

array —

The changes @see getChanges()

listBy()

listBy(string  $action, integer  $timestamp, string  $notepad = null, integer  $end = null, boolean  $isModSeq = false) : array

Returns an array of UIDs for notes that have had $action happen since $timestamp.

Parameters

string $action

The action to check for - add, modify, or delete.

integer $timestamp

The time to start the search.

string $notepad

The notepad to search in.

integer $end

The optional ending timestamp.

boolean $isModSeq

If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1

Returns

array —

An array of UIDs matching the action and time criteria.

getActionTimestamp()

getActionTimestamp(string  $uid, string  $action, string  $notepad = null, boolean  $modSeq = false) : integer

Returns the timestamp of an operation for a given uid an action.

Parameters

string $uid

The uid to look for.

string $action

The action to check for - add, modify, or delete.

string $notepad

The notepad to search in.

boolean $modSeq

Request a modification sequence instead of a timestamp. @since 4.1.1

Throws

\Horde_Exception_PermissionDenied

Returns

integer —

The timestamp or modseq for this action.

getHighestModSeq()

getHighestModSeq(string  $id = null) : integer

Return the largest modification sequence from the history backend.

Parameters

string $id

The notepad id to get the MODSEQ for. If null, the highest MODSEQ across all notepads is returned. @since 4.2.0

Returns

integer —

The modseq.

import()

import(string  $content, string  $contentType, string  $notepad = null) : string

Import a memo represented in the specified contentType.

Parameters

string $content

The content of the memo.

string $contentType

What format is the data in? Currently supports: text/plain text/x-vnote activesync

string $notepad

(optional) The notepad to save the memo on.

Throws

\Mnemo_Exception
\Horde_Exception_PermissionDenied

Returns

string —

The new UID, or false on failure.

export()

export(string  $uid, string  $contentType, array  $options = array()) : mixed

Export a memo, identified by UID, in the requested contentType.

Parameters

string $uid

Identify the memo to export.

string $contentType

What format should the data be in? A string with one of:

                              'text/plain'
                              'text/x-vnote'
                              'activesync'
                            
array $options

Any additional options to be passed to the exporter.

Throws

\Mnemo_Exception
\Horde_Exception_PermissionDenied

Returns

mixed —

The requested data

delete()

delete(  $uid) 

Delete a memo identified by UID.

Parameters

$uid

Throws

\Horde_Exception_PermissionDenied

replace()

replace(string  $uid, string  $content, string  $contentType) 

Replace the memo identified by UID with the content represented in the specified contentType.

Parameters

string $uid

Idenfity the memo to replace.

string $content

The content of the memo.

string $contentType

What format is the data in? Currently supports: text/plain text/x-vnote activesync

Throws

\Mnemo_Exception
\Horde_Exception_PermissionDenied

sources()

sources(boolean  $writeable = false, boolean  $sync_only = false) : array

Returns a list of available sources.

Parameters

boolean $writeable

If true, limits to writeable sources.

boolean $sync_only

Only include synchable notepads.

Returns

array —

An array of the available sources. Keys are source IDs, values are source titles.

getDefaultShare()

getDefaultShare() : string

Retrieve the UID for the current user's default notepad.

Returns

string —

UID.

addNotepad()

addNotepad(string  $name, array  $params = array()) : string

Create a new notepad.

Parameters

string $name

The notepad display name.

array $params

Any additional parameters needed.

  • synchronize: (boolean) If true, add notepad to the list of notepads to syncronize. DEFAULT: false (do not add to the list). @since 4.2.1

Returns

string —

The new notepad's id.

deleteNotepad()

deleteNotepad(string  $id) 

Delete notepad.

Parameters

string $id

The notepad id.

updateNotepad()

updateNotepad(string  $id, array  $info) 

Update a notepad's title and/or description.

Parameters

string $id

The notepad id

array $info

The data to change:

  • name: The display name.
  • desc: The description.

listTagInfo()

listTagInfo(array  $tags = null,   $user = null) : array

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.

Parameters

array $tags

An optional array of tag_ids. If omitted, all tags will be included.

$user

Returns

array —

An array containing tag_name, and total

searchTags()

searchTags(array  $names, integer  $max = 10, integer  $from, string  $resource_type = '', string  $user = null, boolean  $raw = false) : array

SearchTags API: Returns an application-agnostic array (useful for when doing a tag search across multiple applications)

The 'raw' results array can be returned instead by setting $raw = true.

Parameters

array $names

An array of tag_names to search for.

integer $max

The maximum number of resources to return.

integer $from

The number of the resource to start with.

string $resource_type

The resource type [bookmark, '']

string $user

Restrict results to resources owned by $user.

boolean $raw

Return the raw data?

Returns

array —

An array of results:

 'title'    - The title for this resource.
 'desc'     - A terse description of this resource.
 'view_url' - The URL to view this resource.
 'app'      - The Horde application this resource belongs to.
 'icon'     - URL to an image.

_modified()

_modified(array  $memo) : integer

Returns the last modification timestamp of a note.

Parameters

array $memo

The note to look in.

Returns

integer —

The timestamp for the last modification.