You are here

file_service.module in Services 6

@author Services Dev Team

Link general file functionalities to services module.

File

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

/**
 * @author Services Dev Team
 * @file
 *  Link general file functionalities to services module.
 */

/**
 * Implementation of hook_perm().
 */
function file_service_perm() {
  return array(
    'get any binary files',
    'get own binary files',
  );
}

/**
 * Implementation of hook_service().
 */
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.'),
    ),
  );
}

Functions

Namesort descending Description
file_service_perm Implementation of hook_perm().
file_service_service Implementation of hook_service().