You are here

node_service.module in Services 6.2

Link general node functionalities to services module.

File

services/node_service/node_service.module
View source
<?php

/**
 * @file
 *  Link general node functionalities to services module.
 */

/**
 * Implementation of hook_perm().
 */
function node_service_perm() {
  return array(
    'load node data',
  );
}

/**
 * Implementation of hook_service().
 */
function node_service_service() {
  return array(
    // node.get
    array(
      '#method' => 'node.get',
      '#callback' => 'node_service_get',
      '#access callback' => 'node_service_get_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'node_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node ID.'),
        ),
        array(
          '#name' => 'fields',
          '#type' => 'array',
          '#optional' => TRUE,
          '#description' => t('A list of fields to return.'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Returns a node data.'),
    ),
    // node.view
    array(
      '#method' => 'node.view',
      '#callback' => 'node_service_view',
      '#access callback' => 'node_service_view_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'node_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node id.'),
        ),
        array(
          '#name' => 'fields',
          '#type' => 'array',
          '#optional' => TRUE,
          '#description' => t('A list of fields to return.'),
        ),
        array(
          '#name' => 'teaser',
          '#type' => 'boolean',
          '#optional' => TRUE,
          '#description' => t('Is this a teaser version of the node?'),
        ),
        array(
          '#name' => 'page',
          '#type' => 'boolean',
          '#optional' => TRUE,
          '#description' => t('Is this a page version of the node?'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Returns a node data.'),
    ),
    // node.save
    array(
      '#method' => 'node.save',
      '#callback' => 'node_service_save',
      '#access callback' => 'node_service_save_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'node_service',
      ),
      '#args' => array(
        array(
          '#name' => 'node',
          '#type' => 'array',
          '#description' => t('A node object. Upon creation, node object must include "type". Upon update, node object must include "nid" and "changed".'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Save a node object into the database.'),
    ),
    // node.delete
    array(
      '#method' => 'node.delete',
      '#callback' => 'node_delete',
      '#access callback' => 'node_service_delete_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'node_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node ID.'),
        ),
      ),
      '#help' => t('Delete a node.'),
    ),
  );
}

Functions

Namesort descending Description
node_service_perm Implementation of hook_perm().
node_service_service Implementation of hook_service().