\Jonah_Api

Jonah external API interface.

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

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

See the enclosed file LICENSE for license information (BSD). If you did not did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.

Summary

Methods
Properties
Constants
listFeeds()
stories()
story()
publish()
commentCallback()
hasComments()
listTagInfo()
getTagIds()
searchTags()
storyCount()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

listFeeds()

listFeeds() : array

Get a list of stored channels.

Returns

array —

An array of channels

stories()

stories(integer  $channel_id, array  $filter = array()) : array

Return the requested stories

Parameters

integer $channel_id

The channel to get the stories from.

array $filter

Additional, optional filters.

    max_stories  The maximum number of stories to get.
    start_at     The story number to start retrieving.
    order        How to order the results.
  

Returns

array —

An array of story information

story()

story(integer  $channel_id, integer  $story_id, boolean  $read = true) : array

Fetches a story from a requested channel.

Parameters

integer $channel_id

The channel id to fetch.

integer $story_id

The story id to fetch.

boolean $read

Whether to update the read count.

Returns

array —

An array of story data

publish()

publish(integer  $channel_id, array  $story) 

Publish a new story

Parameters

integer $channel_id

The channel id

array $story

The story array. Can contain:

 (string)title       [REQUIRED]    The story title.
 (string)description [REQUIRED]    The short description.
 (string)body_type   [OPTIONAL]    The body type (text/html).
 (string)body        [OPTIONAL]    The story body.
 (string)url         [OPTIONAL]    The url for the story link.
 (array)tags         [OPTIONAL]    Tags

Throws

\Horde_Exception_PermissionDenied

commentCallback()

commentCallback(  $story_id) : mixed

Callback for comment API

Parameters

$story_id

Returns

mixed —

Name of object on success | false on failure

hasComments()

hasComments() : boolean

Check if comments are allowed.

Returns

boolean

listTagInfo()

listTagInfo(array  $tags = array(), array  $channel_id = 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.@deprecated and currently ignored.

array $channel_id

An optional array of channel_ids. @todo - only the first requested channel is honored.

Returns

array —

An array containing tag_name, and total

getTagIds()

getTagIds(array  $names) : Array

Return a set of tag_ids, given the tag name

Parameters

array $names

An array of names to search for

Returns

Array —

An array of tag_name => tag_ids

searchTags()

searchTags(array  $names, array  $filter = array(), boolean  $raw = false) : \An

Searches internal channels for stories tagged with all requested tags.

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

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

Parameters

array $names

An array of tag_names to search for (AND'd together).

array $filter

An array of optional filter parameters.

    max       The maximum number of stories to return.
    from      The number of the story to start with.
    channel_id  (integer) A channel_id to restrict to.
    order     How to order the results (a Jonah::ORDER_* constant)
 
boolean $raw

Return the raw story data?

Returns

\An —

array of results with the following structure:

     '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.
   

storyCount()

storyCount(integer  $channel_id) : mixed

Get the count of stories in the specified channel

Parameters

integer $channel_id

Returns

mixed —

The story count