You are here

function node_resource_service_resource in Services 6.2

Same name and namespace in other branches
  1. 7 services/node_service/node_resource.module \node_resource_service_resource()

File

services/node_service/node_resource.module, line 19
CRUD resource functionality for nodes.

Code

function node_resource_service_resource() {
  return array(
    'node' => array(
      '#retrieve' => array(
        '#callback' => '_node_resource_retrieve',
        '#file' => array(
          'file' => 'inc',
          'module' => 'node_resource',
        ),
        '#args' => array(
          array(
            '#name' => 'nid',
            '#optional' => FALSE,
            '#source' => array(
              'path' => 0,
            ),
            '#type' => 'int',
            '#description' => 'The nid of the node to get',
          ),
        ),
        '#models' => array(
          'ResourceFeedModel' => array(
            'class' => 'NodeResourceFeedModel',
            'arguments' => array(
              'source' => 'single',
            ),
          ),
        ),
        '#access callback' => '_node_resource_access',
        '#access arguments' => array(
          'view',
        ),
        '#access arguments append' => TRUE,
      ),
      '#create' => array(
        '#callback' => '_node_resource_create',
        '#file' => array(
          'file' => 'inc',
          'module' => 'node_resource',
        ),
        '#args' => array(
          array(
            '#name' => 'node',
            '#optional' => FALSE,
            '#source' => 'data',
            '#description' => 'The node object to create',
            '#type' => 'struct',
          ),
        ),
        '#access callback' => '_node_resource_access',
        '#access arguments' => array(
          'create',
        ),
        '#access arguments append' => TRUE,
      ),
      '#update' => array(
        '#callback' => '_node_resource_update',
        '#file' => array(
          'file' => 'inc',
          'module' => 'node_resource',
        ),
        '#args' => array(
          array(
            '#name' => 'nid',
            '#optional' => FALSE,
            '#source' => array(
              'path' => 0,
            ),
            '#type' => 'int',
            '#description' => 'The nid of the node to get',
          ),
          array(
            '#name' => 'node',
            '#optional' => FALSE,
            '#source' => 'data',
            '#description' => 'The node data to update',
            '#type' => 'struct',
          ),
        ),
        '#access callback' => '_node_resource_access',
        '#access arguments' => array(
          'update',
        ),
        '#access arguments append' => TRUE,
      ),
      '#delete' => array(
        '#callback' => '_node_resource_delete',
        '#file' => array(
          'file' => 'inc',
          'module' => 'node_resource',
        ),
        '#args' => array(
          array(
            '#name' => 'nid',
            '#optional' => FALSE,
            '#source' => array(
              'path' => 0,
            ),
          ),
        ),
        '#access callback' => '_node_resource_access',
        '#access arguments' => array(
          'delete',
        ),
        '#access arguments append' => TRUE,
      ),
      '#index' => array(
        '#callback' => '_node_resource_index',
        '#file' => array(
          'file' => 'inc',
          'module' => 'node_resource',
        ),
        '#args' => array(
          array(
            '#name' => 'page',
            '#optional' => TRUE,
            '#type' => 'int',
            '#description' => 'The zero-based index of the page to get, defaults to 0.',
            '#default value' => 0,
            '#source' => array(
              'param' => 'page',
            ),
          ),
          array(
            '#name' => 'fields',
            '#optional' => TRUE,
            '#type' => 'string',
            '#description' => 'The fields to get.',
            '#default value' => '',
            '#source' => array(
              'param' => 'fields',
            ),
          ),
          array(
            '#name' => 'parameters',
            '#optional' => TRUE,
            '#type' => 'struct',
            '#description' => 'Parameters',
            '#default value' => NULL,
            '#source' => 'param',
          ),
        ),
        '#models' => array(
          'ResourceFeedModel' => array(
            'class' => 'NodeResourceFeedModel',
          ),
          'ResourceTimeFeedModel' => array(
            'class' => 'NodeResourceFeedModel',
          ),
        ),
        '#access arguments' => array(
          'access content',
        ),
        '#access arguments append' => TRUE,
      ),
    ),
  );
}