You are here

function comment_service_service in Services 7

Same name and namespace in other branches
  1. 6.2 services/comment_service/comment_service.module \comment_service_service()

Implementation of hook_service().

File

services/comment_service/comment_service.module, line 29
@author Services Dev Team

Code

function comment_service_service() {
  return array(
    // comment.save
    array(
      '#method' => 'comment.save',
      '#callback' => 'comment_service_save',
      '#access arguments' => array(
        'save comments from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'comment_service',
      ),
      '#args' => array(
        array(
          '#name' => 'comment',
          '#type' => 'struct',
          '#description' => t('A comment object.'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('This method adds a comment to a node and returns a comment id.  If the comment object contains a numeric "cid", then the comment will be updated. Required fields in the comment object: nid, comment. Optional fields: cid (comment id), pid (parent comment), subject, mail, homepage'),
    ),
    // comment.loadNodeComments
    array(
      '#method' => 'comment.loadNodeComments',
      '#callback' => 'comment_service_load_node_comments',
      '#access arguments' => array(
        'access comments from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'comment_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node id.'),
        ),
        array(
          '#name' => 'count',
          '#type' => 'int',
          '#description' => t('Number of comments to load.'),
        ),
        array(
          '#name' => 'start',
          '#type' => 'int',
          '#description' => t('If count is set to non-zero value, You can pass also non-zero value for start. For example to get comments from 5 to 15, pass count=10 and start=5.'),
        ),
      ),
      '#return' => 'array',
      '#help' => t('This method returns all or part of the comments on a given node.'),
    ),
    // comment.load
    array(
      '#method' => 'comment.load',
      '#callback' => 'comment_service_load',
      '#access arguments' => array(
        'access comments from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'comment_service',
      ),
      '#args' => array(
        array(
          '#name' => 'cid',
          '#type' => 'int',
          '#description' => t('A comment id.'),
        ),
      ),
      '#return' => 'array',
      '#help' => t('This method returns a single comment object.'),
    ),
    // node.comments.countAll
    array(
      '#method' => 'comment.countAll',
      '#callback' => 'comment_service_node_comments_count_all',
      '#access arguments' => array(
        'access comments from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'comment_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node id.'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('This method returns the number of comments on a given node.'),
    ),
    // node.comments.countNew
    array(
      '#method' => 'comment.countNew',
      '#callback' => 'comment_service_node_comments_count_new',
      '#access arguments' => array(
        'access comments from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'comment_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node id'),
        ),
        array(
          '#name' => 'since',
          '#type' => 'int',
          '#optional' => TRUE,
          '#description' => t('Time to count from (defaults to time of last user acces to node).'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('This method returns the number of new comments on a given node since a given timestamp.'),
    ),
  );
}