You are here

function blogapi_default_services_endpoint in Blog API 7.2

Implements hook_default_services_endpoint().

This function is enabling all resources by default, but that behavior can be overridden via hook_blogapi_default_services_alter().

File

./blogapi.module, line 207
Enable users to post using applications that support BlogAPIs.

Code

function blogapi_default_services_endpoint() {
  $export = array();
  $api_types = blogapi_get_api_types();
  foreach ($api_types as $type) {
    $endpoint = new stdClass();
    $endpoint->disabled = FALSE;
    $endpoint->api_version = 3;
    $endpoint->name = 'blogapi_' . $type;
    $endpoint->server = $type . '_server';
    $endpoint->path = 'blogapi/' . $type;
    $endpoint->authentication = array();
    $endpoint->server_settings = '';

    // Get all resources for $type APIs.
    $info = blogapi_get_info($type);
    $resources = array();
    foreach ($info as $module => $api_info) {
      $resources += module_invoke($module, 'services_resources');
    }
    $endpoint->resources = $resources;
    $endpoint->debug = 0;
    $export['blogapi_' . $type] = $endpoint;
  }
  drupal_alter('blogapi_default_services', $export);
  return $export;
}