You are here

function voting_service_service in MediaFront 6

Same name and namespace in other branches
  1. 6.2 services/voting_service/voting_service.module \voting_service_service()

Implementation of hook_service()

File

services/voting_service/voting_service.module, line 22

Code

function voting_service_service() {
  return array(
    // vote.get
    array(
      '#method' => 'vote.getVote',
      '#callback' => 'voting_service_get_vote',
      '#access arguments' => array(
        'access content',
      ),
      '#key' => FALSE,
      '#args' => array(
        array(
          '#name' => 'content_type',
          '#type' => 'string',
          '#description' => t('The type of content which you are voting for.'),
        ),
        array(
          '#name' => 'content_id',
          '#type' => 'int',
          '#description' => t('The ID of the content which you are voting for.'),
        ),
        array(
          '#name' => 'tag',
          '#type' => 'string',
          '#description' => t('The category of the vote within the content type.'),
          '#optional' => TRUE,
        ),
      ),
      '#return' => 'array',
      '#help' => t('Returns a vote.'),
    ),
    array(
      '#method' => 'vote.getUserVote',
      '#callback' => 'voting_service_get_user_vote',
      '#access arguments' => array(
        'access content',
      ),
      '#key' => FALSE,
      '#args' => array(
        array(
          '#name' => 'content_type',
          '#type' => 'string',
          '#description' => t('The type of content which you are voting for.'),
        ),
        array(
          '#name' => 'content_id',
          '#type' => 'int',
          '#description' => t('The ID of the content which you are voting for.'),
        ),
        array(
          '#name' => 'tag',
          '#type' => 'string',
          '#description' => t('The category of the vote within the content type.'),
          '#optional' => TRUE,
        ),
      ),
      '#return' => 'array',
      '#help' => t('Returns a vote.'),
    ),
    // vote.set
    array(
      '#method' => 'vote.setVote',
      '#callback' => 'voting_service_set_vote',
      '#access arguments' => array(
        'allow remote voting',
      ),
      '#args' => array(
        array(
          '#name' => 'content_type',
          '#type' => 'string',
          '#description' => t('The type of content which you are voting for.'),
        ),
        array(
          '#name' => 'content_id',
          '#type' => 'int',
          '#description' => t('The ID of the content which you are voting for.'),
        ),
        array(
          '#name' => 'vote_value',
          '#type' => 'int',
          '#description' => t('The value of the vote.'),
        ),
        array(
          '#name' => 'tag',
          '#type' => 'string',
          '#description' => t('The category of the vote within the content type.'),
          '#optional' => TRUE,
        ),
      ),
      '#return' => 'array',
      '#help' => t('Submit a new vote.'),
    ),
    // vote.delete
    array(
      '#method' => 'vote.deleteVote',
      '#callback' => 'voting_service_delete_vote',
      '#access arguments' => array(
        'allow remote voting',
      ),
      '#args' => array(
        array(
          '#name' => 'content_type',
          '#type' => 'string',
          '#description' => t('The type of content which you are deleting.'),
        ),
        array(
          '#name' => 'content_id',
          '#type' => 'int',
          '#description' => t('The ID of the content which you are deleting.'),
        ),
        array(
          '#name' => 'tag',
          '#type' => 'string',
          '#description' => t('The category of the vote within the content type.'),
          '#optional' => TRUE,
        ),
      ),
      '#return' => 'array',
      '#help' => t('Delete a vote.'),
    ),
  );
}