You are here

function file_service_service in Services 6.2

Same name and namespace in other branches
  1. 6 services/file_service/file_service.module \file_service_service()
  2. 7 services/file_service/file_service.module \file_service_service()

Implementation of hook_service().

File

services/file_service/file_service.module, line 17
Link general file functionalities to services module.

Code

function file_service_service() {
  return array(
    // file.get
    array(
      '#method' => 'file.get',
      '#callback' => 'file_service_get',
      '#access callback' => 'file_service_get_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'file_service',
      ),
      '#args' => array(
        array(
          '#name' => 'fid',
          '#type' => 'int',
          '#description' => t('A file ID.'),
        ),
      ),
      '#return' => 'array',
      '#help' => t('The file data.'),
    ),
    // file.getNodeFiles
    array(
      '#method' => 'file.getNodeFiles',
      '#callback' => 'file_service_get_node_files',
      '#access callback' => 'file_service_get_node_files_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'file_service',
      ),
      '#args' => array(
        array(
          '#name' => 'nid',
          '#type' => 'int',
          '#description' => t('A node ID.'),
        ),
      ),
      '#return' => 'array',
      '#help' => t('Returns the files attached to a node.'),
    ),
    // file.save
    array(
      '#method' => 'file.save',
      '#callback' => 'file_service_save',
      '#access callback' => 'file_service_save_access',
      '#file' => array(
        'file' => 'inc',
        'module' => 'file_service',
      ),
      '#args' => array(
        array(
          '#name' => 'file',
          '#type' => 'struct',
          '#description' => t('An object representing a file.'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('Saves information about a specific file. Note this does not save files themselves, just the information as stored in the files table. Returns the fid of the new/updated file.'),
    ),
  );
}