You are here

function bat_api_services_resources in Booking and Availability Management API 7.2

Same name and namespace in other branches
  1. 7 bat_api.module \bat_api_services_resources()

Implements hook_services_resources().

File

./bat_api.module, line 106
API access to booking data for BAT.

Code

function bat_api_services_resources() {
  $resources = array();
  $resources['types'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_types_index',
        'help' => t('Returns an object containing types information.'),
        'access arguments' => array(
          'access types index service',
        ),
        'args' => array(
          array(
            'name' => 'ids',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => '',
            'description' => t('IDs'),
            'source' => array(
              'param' => 'ids',
            ),
          ),
          array(
            'name' => 'offset',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 0,
            'description' => t('Result offset to start listing'),
            'source' => array(
              'param' => 'offset',
            ),
          ),
          array(
            'name' => 'limit',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 100,
            'description' => t('Number of items to return'),
            'source' => array(
              'param' => 'limit',
            ),
          ),
        ),
      ),
      'update' => array(
        'callback' => 'bat_api_services_edit_type',
        'access arguments' => array(
          'access edit type service',
        ),
        'help' => t('Edit an existing BAT Type.'),
        'args' => array(
          array(
            'name' => 'type_id',
            'type' => 'integer',
            'description' => t('Type ID'),
            'source' => array(
              'path' => 0,
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'bat_type',
            'type' => 'array',
            'description' => t('The type data to update'),
            'source' => 'data',
            'optional' => FALSE,
          ),
        ),
      ),
    ),
    'actions' => array(
      'add' => array(
        'callback' => 'bat_api_services_add_type',
        'access arguments' => array(
          'access add type service',
        ),
        'help' => t('Add a new BAT Type.'),
        'args' => array(
          array(
            'name' => 'name',
            'type' => 'string',
            'description' => t('Name'),
            'source' => array(
              'data' => 'name',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'type',
            'type' => 'string',
            'description' => t('Type'),
            'source' => array(
              'data' => 'type',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'uid',
            'type' => 'integer',
            'description' => t('UID'),
            'source' => array(
              'data' => 'uid',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'status',
            'type' => 'integer',
            'description' => t('Status'),
            'source' => array(
              'data' => 'status',
            ),
            'optional' => FALSE,
          ),
        ),
      ),
    ),
  );
  $resources['units'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_units_index',
        'help' => t('Returns an object containing units information.'),
        'access arguments' => array(
          'access units index service',
        ),
        'args' => array(
          array(
            'name' => 'ids',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => '',
            'description' => t('IDs'),
            'source' => array(
              'param' => 'ids',
            ),
          ),
          array(
            'name' => 'offset',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 0,
            'description' => t('Result offset to start listing'),
            'source' => array(
              'param' => 'offset',
            ),
          ),
          array(
            'name' => 'limit',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 100,
            'description' => t('Number of items to return'),
            'source' => array(
              'param' => 'limit',
            ),
          ),
        ),
      ),
      'update' => array(
        'callback' => 'bat_api_services_edit_unit',
        'access arguments' => array(
          'access edit unit service',
        ),
        'help' => t('Edit an existing Bookable Unit.'),
        'args' => array(
          array(
            'name' => 'unit_id',
            'type' => 'integer',
            'description' => t('Unit ID'),
            'source' => array(
              'path' => 0,
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'bat_unit',
            'type' => 'array',
            'description' => t('The unit data to update'),
            'source' => 'data',
            'optional' => FALSE,
          ),
        ),
      ),
    ),
    'actions' => array(
      'add' => array(
        'callback' => 'bat_api_services_add_unit',
        'access arguments' => array(
          'access add unit service',
        ),
        'help' => t('Add a new Bookable Unit.'),
        'args' => array(
          array(
            'name' => 'name',
            'type' => 'string',
            'description' => t('Name'),
            'source' => array(
              'data' => 'name',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'type',
            'type' => 'string',
            'description' => t('Type'),
            'source' => array(
              'data' => 'type',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'type_id',
            'type' => 'integer',
            'description' => t('Type ID'),
            'source' => array(
              'data' => 'type_id',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'uid',
            'type' => 'integer',
            'description' => t('UID'),
            'source' => array(
              'data' => 'uid',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'status',
            'type' => 'integer',
            'description' => t('Status'),
            'source' => array(
              'data' => 'status',
            ),
            'optional' => FALSE,
          ),
        ),
      ),
    ),
  );
  $resources['units-calendar'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_units_index_calendar',
        'help' => t('Returns an object containing units information.'),
        'access arguments' => array(
          'access units calendar index service',
        ),
        'args' => array(
          array(
            'name' => 'types',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => '',
            'description' => t('Types'),
            'source' => array(
              'param' => 'types',
            ),
          ),
          array(
            'name' => 'ids',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => '',
            'description' => t('IDs'),
            'source' => array(
              'param' => 'ids',
            ),
          ),
          array(
            'name' => 'event_type',
            'type' => 'string',
            'description' => t('Event Type'),
            'source' => array(
              'param' => 'event_type',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'children',
            'type' => 'boolean',
            'description' => t('Return children'),
            'source' => array(
              'param' => 'children',
            ),
            'optional' => TRUE,
            'default value' => TRUE,
          ),
          array(
            'name' => 'grouping_ids',
            'type' => 'string',
            'description' => t('Grouping ids'),
            'source' => array(
              'param' => 'grouping_ids',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'grouping_entity_type',
            'type' => 'string',
            'description' => t('Grouping entity type'),
            'source' => array(
              'param' => 'grouping_entity_type',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'collapse_childrens',
            'type' => 'boolean',
            'description' => t('Collapse childrens'),
            'source' => array(
              'param' => 'collapse_childrens',
            ),
            'optional' => TRUE,
            'default value' => FALSE,
          ),
          array(
            'name' => 'offset',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 0,
            'description' => t('Result offset to start listing'),
            'source' => array(
              'param' => 'offset',
            ),
          ),
          array(
            'name' => 'limit',
            'type' => 'string',
            'optional' => TRUE,
            'default value' => 100,
            'description' => t('Number of items to return'),
            'source' => array(
              'param' => 'limit',
            ),
          ),
        ),
      ),
    ),
  );
  $resources['events'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_events_index',
        'help' => t('Returns an object containing events information.'),
        'access arguments' => array(
          'access events index service',
        ),
        'args' => array(
          array(
            'name' => 'target_ids',
            'type' => 'string',
            'description' => t('Targe Entity IDs'),
            'source' => array(
              'param' => 'target_ids',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'target_types',
            'type' => 'string',
            'description' => t('Target Types'),
            'source' => array(
              'param' => 'target_types',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'target_entity_type',
            'type' => 'string',
            'description' => t('Target Entity Type'),
            'source' => array(
              'param' => 'target_entity_type',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'start_date',
            'type' => 'string',
            'description' => t('Start date'),
            'source' => array(
              'param' => 'start_date',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'end_date',
            'type' => 'string',
            'description' => t('End date'),
            'source' => array(
              'param' => 'end_date',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'event_types',
            'type' => 'string',
            'description' => t('Type'),
            'source' => array(
              'param' => 'event_types',
            ),
            'optional' => FALSE,
          ),
        ),
      ),
      'update' => array(
        'callback' => 'bat_api_services_edit_event',
        'access arguments' => array(
          'access edit event service',
        ),
        'help' => t('Edit an existing Event.'),
        'args' => array(
          array(
            'name' => 'event_id',
            'type' => 'integer',
            'description' => t('Event ID'),
            'source' => array(
              'path' => 0,
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'bat_event',
            'type' => 'array',
            'description' => t('The event data to update'),
            'source' => 'data',
            'optional' => FALSE,
          ),
        ),
      ),
    ),
  );
  $resources['events-calendar'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_events_index_calendar',
        'help' => t('Returns an object containing events information.'),
        'access arguments' => array(
          'access events calendar index service',
        ),
        'args' => array(
          array(
            'name' => 'unit_ids',
            'type' => 'string',
            'description' => t('Unit IDs'),
            'source' => array(
              'param' => 'unit_ids',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'unit_types',
            'type' => 'string',
            'description' => t('Unit Types'),
            'source' => array(
              'param' => 'unit_types',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'start',
            'type' => 'string',
            'description' => t('Start date'),
            'source' => array(
              'param' => 'start',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'end',
            'type' => 'string',
            'description' => t('End date'),
            'source' => array(
              'param' => 'end',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'event_types',
            'type' => 'string',
            'description' => t('Type'),
            'source' => array(
              'param' => 'event_types',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'background',
            'type' => 'boolean',
            'description' => t('Background'),
            'source' => array(
              'param' => 'background',
            ),
            'optional' => TRUE,
            'default value' => TRUE,
          ),
        ),
      ),
    ),
  );
  $resources['matching-units-calendar'] = array(
    'operations' => array(
      'index' => array(
        'callback' => 'bat_api_services_matching_units_calendar',
        'help' => t('Returns an object containing events information.'),
        'access arguments' => array(
          'access matching units calendar index service',
        ),
        'args' => array(
          array(
            'name' => 'unit_types',
            'type' => 'string',
            'description' => t('Unit Types'),
            'source' => array(
              'param' => 'unit_types',
            ),
            'optional' => TRUE,
          ),
          array(
            'name' => 'start',
            'type' => 'string',
            'description' => t('Start date'),
            'source' => array(
              'param' => 'start',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'end',
            'type' => 'string',
            'description' => t('End date'),
            'source' => array(
              'param' => 'end',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'event_type',
            'type' => 'string',
            'description' => t('Type'),
            'source' => array(
              'param' => 'event_type',
            ),
            'optional' => FALSE,
          ),
          array(
            'name' => 'event_states',
            'type' => 'string',
            'description' => t('Event States'),
            'source' => array(
              'param' => 'event_states',
            ),
            'optional' => FALSE,
          ),
        ),
      ),
    ),
  );
  return $resources;
}