function _services_raw_services_resources in Services Client 7
Same name and namespace in other branches
- 7.2 services_raw/services_raw.inc \_services_raw_services_resources()
Provides API definition of provided services objects and operations.
1 call to _services_raw_services_resources()
- services_raw_services_resources in services_raw/
services_raw.module - Implements services_resources().
File
- services_raw/
services_raw.inc, line 11 - Custom services definition and implementation of all callbacks.
Code
function _services_raw_services_resources() {
$services = array();
// Node
$services['node_raw'] = array(
'create' => array(
'help' => 'Creates a node using direct node_save call.',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_node_create',
'args' => array(
array(
'name' => 'node',
'type' => 'struct',
'description' => 'The node object',
'source' => 'data',
'optional' => FALSE,
),
),
'access callback' => '_services_raw_node_access',
'access arguments' => array(
'create',
),
'access arguments append' => TRUE,
),
'update' => array(
'help' => 'Update a node using direct node_save call.',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_node_update',
'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' => 'array',
),
),
'access callback' => '_services_raw_node_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
),
'targeted_actions' => array(
'attach_file' => array(
'help' => 'Attach file to the specific node field.',
'file' => array(
'type' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_node_attach_file',
'args' => array(
array(
'name' => 'nid',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'int',
'description' => 'The nid of the node to attach a file to',
),
array(
'name' => 'field_name',
'optional' => TRUE,
'source' => array(
'data' => 'field_name',
),
'description' => 'Field name for attached files',
'type' => 'string',
),
array(
'name' => 'fid',
'optional' => TRUE,
'source' => array(
'data' => 'fid',
),
'description' => 'File fid of the file to be attached',
'type' => 'int',
),
),
'access callback' => '_services_raw_node_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
),
),
);
// Field
$services['field'] = array(
'update' => array(
'help' => 'Update a field using entity-appropriate functions.',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_field_update',
'args' => array(
'uuid' => array(
'name' => 'uuid',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'string',
'description' => 'The UUID of the object to update',
),
'field' => array(
'name' => 'field',
'optional' => FALSE,
'source' => array(
'data' => 'field',
),
'description' => 'The field name to update (will use current node/field lang)',
'type' => 'string',
),
'entity_type' => array(
'name' => 'entity_type',
'optional' => FALSE,
'source' => array(
'data' => 'entity_type',
),
'description' => 'The entity type to update (node, user, etc.)',
'type' => 'string',
),
'value' => array(
'name' => 'value',
'optional' => FALSE,
'source' => array(
'data' => 'value',
),
'description' => 'The field value to update.',
'type' => 'array',
),
),
'access callback' => '_services_raw_field_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
),
);
// Fields
$services['fields'] = array(
'update' => array(
'help' => 'Update a set of fields using entity-appropriate functions.',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_fields_update',
'args' => array(
'uuid' => array(
'name' => 'uuid',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'string',
'description' => 'The UUID of the object to update',
),
'entity_type' => array(
'name' => 'entity_type',
'optional' => FALSE,
'source' => array(
'data' => 'entity_type',
),
'description' => 'The entity type to update (node, user, etc.)',
'type' => 'string',
),
'data' => array(
'name' => 'data',
'optional' => FALSE,
'source' => array(
'data' => 'data',
),
'description' => 'An array with the field name as key and the value as array value',
'type' => 'array',
),
),
'access callback' => '_services_raw_field_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
),
);
// User
$services['user_raw'] = array(
'retrieve' => array(
'help' => 'Retrieves a user',
'callback' => '_services_raw_user_retrieve',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'access callback' => '_services_raw_user_access',
'access arguments' => array(
'view',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'The uid of the user to retrieve.',
'source' => array(
'path' => '0',
),
'optional' => FALSE,
),
),
),
'create' => array(
'help' => 'Creates a user using direct user_save',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_user_create',
'access callback' => '_services_raw_user_access',
'access arguments' => array(
'create',
),
'access arguments append' => FALSE,
'args' => array(
array(
'name' => 'account',
'type' => 'array',
'description' => 'The user object',
'source' => 'data',
'optional' => FALSE,
),
),
),
'update' => array(
'help' => 'Updates a user using direct user_save',
'file' => array(
'file' => 'inc',
'module' => 'services_raw',
),
'callback' => '_services_raw_user_update',
'access callback' => '_services_raw_user_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'Unique identifier for this user',
'source' => array(
'path' => 0,
),
'optional' => FALSE,
),
array(
'name' => 'data',
'type' => 'array',
'description' => 'The user object with updated information',
'source' => 'data',
'optional' => FALSE,
),
),
),
);
return $services;
}