function bat_api_services_resources in Booking and Availability Management API 7
Same name and namespace in other branches
- 7.2 bat_api.module \bat_api_services_resources()
Implements hook_services_resources().
File
- ./
bat_api.module, line 79
Code
function bat_api_services_resources() {
$resources = array();
$resources['units'] = array(
'operations' => array(
'index' => array(
'callback' => 'bat_api_services_units_index',
'help' => t('Returns an object containing bookable unit 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' => 'rooms_unit',
'type' => 'array',
'description' => t('The rooms 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' => 'default_state',
'type' => 'integer',
'description' => t('Default availability'),
'source' => array(
'data' => 'default_state',
),
'optional' => FALSE,
),
array(
'name' => 'bookable',
'type' => 'integer',
'description' => t('Bookable'),
'source' => array(
'data' => 'bookable',
),
'optional' => FALSE,
),
array(
'name' => 'status',
'type' => 'integer',
'description' => t('Published'),
'source' => array(
'data' => 'status',
),
'optional' => FALSE,
),
),
),
),
);
$resources['availability'] = array(
'operations' => array(
'index' => array(
'callback' => 'bat_api_services_availability_index',
'help' => t('Returns an object containing availability information.'),
'access arguments' => array(
'access availability index service',
),
'args' => array(
array(
'name' => 'units',
'type' => 'string',
'description' => t('Unit IDs'),
'source' => array(
'param' => 'units',
),
'optional' => FALSE,
),
array(
'name' => 'start_date',
'type' => 'string',
'description' => t('Start date'),
'source' => array(
'param' => 'start_date',
),
'optional' => FALSE,
),
array(
'name' => 'duration',
'type' => 'string',
'description' => t('Duration'),
'source' => array(
'param' => 'duration',
),
'optional' => FALSE,
),
),
),
'update' => array(
'callback' => 'bat_api_services_update_availability',
'access arguments' => array(
'access update availability service',
),
'help' => t('Update the availability for a given unit.'),
'args' => array(
array(
'name' => 'unit_id',
'type' => 'integer',
'description' => t('Unit ID'),
'source' => array(
'path' => 0,
),
'optional' => FALSE,
),
array(
'name' => 'availability_info',
'type' => 'array',
'description' => t('Availability information'),
'source' => 'data',
'optional' => FALSE,
),
),
),
),
);
$resources['pricing'] = array(
'operations' => array(
'index' => array(
'callback' => 'bat_api_services_pricing_index',
'help' => t('Returns an object containing pricing information.'),
'access arguments' => array(
'access pricing index service',
),
'args' => array(
array(
'name' => 'units',
'type' => 'string',
'description' => t('Unit IDs'),
'source' => array(
'param' => 'units',
),
'optional' => FALSE,
),
array(
'name' => 'start_date',
'type' => 'string',
'description' => t('Start date'),
'source' => array(
'param' => 'start_date',
),
'optional' => FALSE,
),
array(
'name' => 'duration',
'type' => 'string',
'description' => t('Duration'),
'source' => array(
'param' => 'duration',
),
'optional' => FALSE,
),
),
),
'update' => array(
'callback' => 'bat_api_services_update_pricing',
'access arguments' => array(
'access update pricing service',
),
'help' => t('Update the pricing for a given unit.'),
'args' => array(
array(
'name' => 'unit_id',
'type' => 'integer',
'description' => t('Unit ID'),
'source' => array(
'path' => 0,
),
'optional' => FALSE,
),
array(
'name' => 'pricing_info',
'type' => 'array',
'description' => t('Pricing information'),
'source' => 'data',
'optional' => FALSE,
),
),
),
),
);
$resources['booking'] = array(
'operations' => array(
'index' => array(
'callback' => 'bat_api_services_booking_index',
'help' => t('Returns an object containing booking information.'),
'access arguments' => array(
'access booking index service',
),
'args' => array(
array(
'name' => 'units',
'type' => 'string',
'description' => t('Unit IDs'),
'source' => array(
'param' => 'units',
),
'optional' => FALSE,
),
array(
'name' => 'start_date',
'type' => 'string',
'description' => t('Start date'),
'source' => array(
'param' => 'start_date',
),
'optional' => FALSE,
),
array(
'name' => 'duration',
'type' => 'string',
'description' => t('Duration'),
'source' => array(
'param' => 'duration',
),
'optional' => FALSE,
),
),
),
),
'actions' => array(
'add' => array(
'callback' => 'bat_api_services_add_booking',
'access arguments' => array(
'access add booking service',
),
'help' => t('Add a new Rooms Unit.'),
'args' => array(
array(
'name' => 'type',
'type' => 'string',
'description' => t('Type'),
'source' => array(
'data' => 'type',
),
'optional' => FALSE,
),
array(
'name' => 'start_date',
'type' => 'string',
'description' => t('Start date'),
'source' => array(
'data' => 'start_date',
),
'optional' => FALSE,
),
array(
'name' => 'end_date',
'type' => 'string',
'description' => t('End date'),
'source' => array(
'data' => 'end_date',
),
'optional' => FALSE,
),
array(
'name' => 'unit_id',
'type' => 'string',
'description' => t('Unit ID'),
'source' => array(
'data' => 'unit_id',
),
'optional' => FALSE,
),
),
),
),
);
return $resources;
}