node_service.module in Services 6
Same filename and directory in other branches
@author Services Dev Team
Link general node functionalities to services module.
File
services/node_service/node_service.moduleView source
<?php
/**
* @author Services Dev Team
* @file
* Link general node functionalities to services module.
*/
/**
* Implementation of hook_help().
*/
function node_service_help($path, $arg) {
switch ($path) {
case 'admin/help#services_node':
return '<p>' . t('Provides node methods to services applications. Requires services.module.') . '</p>';
case 'admin/modules#description':
return t('Provides node methods to services applications. Requires services.module.');
}
}
/**
* Implementation of hook_perm().
*/
function node_service_perm() {
return array(
'load any node data',
'load own 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',
),
'#key' => FALSE,
'#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.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' => 'struct',
'#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
Name | Description |
---|---|
node_service_help | Implementation of hook_help(). |
node_service_perm | Implementation of hook_perm(). |
node_service_service | Implementation of hook_service(). |