Documentation

Mnemo_Api extends Horde_Registry_Api
in package

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.

Tags
category

Horde

Table of Contents

$_links  : array<string|int, mixed>
Links.
addNotepad()  : string
Create a new notepad.
browse()  : array<string|int, mixed>
Browse through Mnemo's object tree.
delete()  : mixed
Delete a memo identified by UID.
deleteNotepad()  : mixed
Delete notepad.
export()  : mixed
Export a memo, identified by UID, in the requested contentType.
getActionTimestamp()  : int
Returns the timestamp of an operation for a given uid an action.
getChanges()  : array<string|int, mixed>
Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.
getChangesByModSeq()  : array<string|int, mixed>
Return all changes occuring between the specified modification sequences.
getDefaultShare()  : string
Retrieve the UID for the current user's default notepad.
getHighestModSeq()  : int
Return the largest modification sequence from the history backend.
import()  : string
Import a memo represented in the specified contentType.
listBy()  : array<string|int, mixed>
Returns an array of UIDs for notes that have had $action happen since $timestamp.
listNotepads()  : array<string|int, mixed>
listTagInfo()  : array<string|int, mixed>
Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.
listUids()  : array<string|int, mixed>
Returns an array of UIDs for all notes that the current user is authorized to see.
path_delete()  : string
Deletes a file from the Mnemo tree.
put()  : array<string|int, mixed>
Saves a file into the Mnemo tree.
removeUserData()  : mixed
Removes user data.
replace()  : mixed
Replace the memo identified by UID with the content represented in the specified contentType.
searchTags()  : array<string|int, mixed>
SearchTags API: Returns an application-agnostic array (useful for when doing a tag search across multiple applications)
sources()  : array<string|int, mixed>
Returns a list of available sources.
updateNotepad()  : mixed
Update a notepad's title and/or description.
_modified()  : int
Returns the last modification timestamp of a note.

Properties

Links.

protected array<string|int, mixed> $_links = array('show' => '%application%/view.php?memo=|memo|&memolist=|memolist|&uid=|uid|')

Methods

addNotepad()

Create a new notepad.

public addNotepad(string $name[, array<string|int, mixed> $params = array() ]) : string
Parameters
$name : string

The notepad display name.

$params : array<string|int, mixed> = array()

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
Tags
since
4.2.0
Return values
string

The new notepad's id.

browse()

Browse through Mnemo's object tree.

public browse([string $path = '' ][, array<string|int, mixed> $properties = array() ]) : array<string|int, mixed>
Parameters
$path : string = ''

The level of the tree to browse.

$properties : array<string|int, mixed> = array()

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

Return values
array<string|int, mixed>

The contents of $path

delete()

Delete a memo identified by UID.

public delete(mixed $uid) : mixed
Parameters
$uid : mixed
Tags
throws
Horde_Exception_PermissionDenied
Return values
mixed

deleteNotepad()

Delete notepad.

public deleteNotepad(string $id) : mixed
Parameters
$id : string

The notepad id.

Tags
since
4.2.0
Return values
mixed

export()

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

public export(string $uid, string $contentType[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$uid : string

Identify the memo to export.

$contentType : string

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

  'text/plain'
  'text/x-vnote'
  'activesync'
$options : array<string|int, mixed> = array()

Any additional options to be passed to the exporter.

Tags
throws
Mnemo_Exception
throws
Horde_Exception_PermissionDenied
Return values
mixed

The requested data

getActionTimestamp()

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

public getActionTimestamp(string $uid, string $action[, string $notepad = null ][, bool $modSeq = false ]) : int
Parameters
$uid : string

The uid to look for.

$action : string

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

$notepad : string = null

The notepad to search in.

$modSeq : bool = false

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

Tags
throws
Horde_Exception_PermissionDenied
Return values
int

The timestamp or modseq for this action.

getChanges()

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

public getChanges(int $start, int $end[, bool $isModSeq = false ][, string $notepad = null ]) : array<string|int, mixed>
Parameters
$start : int

The starting timestamp

$end : int

The ending timestamp.

$isModSeq : bool = false

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

$notepad : string = null

The source to check. @since 4.2.0

Return values
array<string|int, mixed>

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

getChangesByModSeq()

Return all changes occuring between the specified modification sequences.

public getChangesByModSeq(int $start, int $end[, string $notepad = null ]) : array<string|int, mixed>
Parameters
$start : int

The starting modseq.

$end : int

The ending modseq.

$notepad : string = null

The source to check. @since 4.2.0

Tags
since
4.1.1
Return values
array<string|int, mixed>

The changes @see getChanges()

getDefaultShare()

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

public getDefaultShare() : string
Tags
since
4.2.0
Return values
string

UID.

getHighestModSeq()

Return the largest modification sequence from the history backend.

public getHighestModSeq([string $id = null ]) : int
Parameters
$id : string = null

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

Tags
since
4.1.1
Return values
int

The modseq.

import()

Import a memo represented in the specified contentType.

public import(string $content, string $contentType[, string $notepad = null ]) : string
Parameters
$content : string

The content of the memo.

$contentType : string

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

$notepad : string = null

(optional) The notepad to save the memo on.

Tags
throws
Mnemo_Exception
throws
Horde_Exception_PermissionDenied
Return values
string

The new UID, or false on failure.

listBy()

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

public listBy(string $action, int $timestamp[, string $notepad = null ][, int $end = null ][, bool $isModSeq = false ]) : array<string|int, mixed>
Parameters
$action : string

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

$timestamp : int

The time to start the search.

$notepad : string = null

The notepad to search in.

$end : int = null

The optional ending timestamp.

$isModSeq : bool = false

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

Return values
array<string|int, mixed>

An array of UIDs matching the action and time criteria.

listNotepads()

public listNotepads(bool $owneronly, int $permission) : array<string|int, mixed>
Parameters
$owneronly : bool

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

$permission : int

The permission to filter notepads by.

Return values
array<string|int, mixed>

The notepads.

listTagInfo()

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

public listTagInfo([array<string|int, mixed> $tags = null ][, mixed $user = null ]) : array<string|int, mixed>
Parameters
$tags : array<string|int, mixed> = null

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

$user : mixed = null
Return values
array<string|int, mixed>

An array containing tag_name, and total

listUids()

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

public listUids([array<string|int, mixed>|string $notepads = null ]) : array<string|int, mixed>
Parameters
$notepads : array<string|int, mixed>|string = null

The notepad(s) to list notes from.

Tags
throws
Mnemo_Exception
throws
Horde_Exception_PermissionDenied
Return values
array<string|int, mixed>

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

path_delete()

Deletes a file from the Mnemo tree.

public path_delete(string $path) : string
Parameters
$path : string

The path to the file.

Tags
throws
Mnemo_Exception
Return values
string

The note's UID

put()

Saves a file into the Mnemo tree.

public put(string $path, string $content, string $content_type) : array<string|int, mixed>
Parameters
$path : string

The path where to PUT the file.

$content : string

The file content.

$content_type : string

The file's content type.

Return values
array<string|int, mixed>

The note UIDs

removeUserData()

Removes user data.

public removeUserData(string $user) : mixed
Parameters
$user : string

Name of user to remove data for.

Tags
deprecated

Use Horde's removeUserData API call instead.

throws
Mnemo_Exception
Return values
mixed

replace()

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

public replace(string $uid, string $content, string $contentType) : mixed
Parameters
$uid : string

Idenfity the memo to replace.

$content : string

The content of the memo.

$contentType : string

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

Tags
throws
Mnemo_Exception
throws
Horde_Exception_PermissionDenied
Return values
mixed

searchTags()

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

public searchTags(array<string|int, mixed> $names[, int $max = 10 ], int $from[, string $resource_type = '' ][, string $user = null ][, bool $raw = false ]) : array<string|int, mixed>

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

Parameters
$names : array<string|int, mixed>

An array of tag_names to search for.

$max : int = 10

The maximum number of resources to return.

$from : int

The number of the resource to start with.

$resource_type : string = ''

The resource type [bookmark, '']

$user : string = null

Restrict results to resources owned by $user.

$raw : bool = false

Return the raw data?

Return values
array<string|int, mixed>

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.

sources()

Returns a list of available sources.

public sources([bool $writeable = false ][, bool $sync_only = false ]) : array<string|int, mixed>
Parameters
$writeable : bool = false

If true, limits to writeable sources.

$sync_only : bool = false

Only include synchable notepads.

Tags
since
4.2.0
Return values
array<string|int, mixed>

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

updateNotepad()

Update a notepad's title and/or description.

public updateNotepad(string $id, array<string|int, mixed> $info) : mixed
Parameters
$id : string

The notepad id

$info : array<string|int, mixed>

The data to change:

  • name: The display name.
  • desc: The description.
Tags
since
4.2.0
Return values
mixed

_modified()

Returns the last modification timestamp of a note.

protected _modified(array<string|int, mixed> $memo) : int
Parameters
$memo : array<string|int, mixed>

The note to look in.

Return values
int

The timestamp for the last modification.

Search results