You are here

function userpoints_service_service in User Points 6

Same name and namespace in other branches
  1. 5.3 userpoints_service.module \userpoints_service_service()

Implementation of hook_service().

File

./userpoints_service.module, line 19

Code

function userpoints_service_service() {
  return array(
    array(
      '#method' => 'userpoints.get',
      '#callback' => 'userpoints_service_get',
      '#args' => array(
        array(
          '#name' => 'uid',
          '#type' => 'int',
          '#description' => t('A valid Drupal User ID.'),
        ),
        array(
          '#name' => 'tid',
          '#type' => 'int',
          '#optional' => TRUE,
          '#description' => t('An optional Term ID for the category.'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Retrieves the number of points the user has.'),
    ),
    array(
      '#method' => 'userpoints.points',
      '#callback' => 'userpoints_service_points',
      '#args' => array(
        array(
          '#name' => 'uid',
          '#type' => 'int',
          '#description' => t('A valid Drupal User ID.'),
        ),
        array(
          '#name' => 'points',
          '#type' => 'int',
          '#description' => t('Number of points to add/subtract.'),
        ),
        array(
          '#name' => 'tid',
          '#type' => 'int',
          '#optional' => TRUE,
          '#description' => t('An optional Term ID for the category.'),
        ),
        array(
          '#name' => 'event',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('An optional event ID for this transaction.'),
        ),
        array(
          '#name' => 'description',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('An optional description of this transaction.'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Adds/subtracts points to a user.'),
    ),
  );
}