function privatemsg_service_service in Privatemsg 6.2
Implementation of hook_service().
File
- privatemsg_service/
privatemsg_service.module, line 21 - Link general privatemsg module functionalities to services module.
Code
function privatemsg_service_service() {
return array(
// privatemsg.get
array(
'#method' => 'privatemsg.get',
'#callback' => 'privatemsg_service_get',
'#access arguments' => array(
'get private messages from remote',
),
'#file' => array(
'file' => 'inc',
'module' => 'privatemsg_service',
),
'#args' => array(
array(
'#name' => 'type',
'#type' => 'string',
'#optional' => TRUE,
'#description' => t('The type of messages to retrieve. Can be inbox or sent.'),
),
array(
'#name' => 'load_full',
'#type' => 'boolean',
'#optional' => TRUE,
'#description' => t('A boolean to indicate whether to load the all messages in a thread or just the message preview. Do not pass FALSE, just leave it empty for message previews.'),
),
array(
'#name' => 'offset',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('An offset integer for paging.'),
),
array(
'#name' => 'limit',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('A limit integer for paging.'),
),
array(
'#name' => 'uid',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('Instead of receiving messages from the authenticated user, receive messages from another user. The currently authenticated user needs to have the "read all private messages" permission to get messages from another user.'),
),
),
'#return' => 'array',
'#help' => t('Get a logged-in user\'s private messages.'),
),
// privatemsg.getUnreadCount
array(
'#method' => 'privatemsg.unreadCount',
'#callback' => 'privatemsg_service_unread_count',
'#access arguments' => array(
'get private messages from remote',
),
'#file' => array(
'file' => 'inc',
'module' => 'privatemsg_service',
),
'#args' => array(
array(
'#name' => 'uid',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('Instead of receiving the count of unread messages from the authenticated user, receive the count of unread messages from another user. The currently authenticated user needs to have the "read all private messages" permission to get messages from another user.'),
),
),
'#return' => 'int',
'#help' => t('Get a users private messages unread count.'),
),
// privatemsg.send
array(
'#method' => 'privatemsg.send',
'#callback' => 'privatemsg_service_send',
'#access arguments' => array(
'send private messages from remote',
),
'#file' => array(
'file' => 'inc',
'module' => 'privatemsg_service',
),
'#args' => array(
array(
'#name' => 'recipients',
'#type' => 'string',
'#description' => t('A comma separated list of recipients usernames.'),
),
array(
'#name' => 'subject',
'#type' => 'string',
'#description' => t('A message subject.'),
),
array(
'#name' => 'body',
'#type' => 'string',
'#optional' => TRUE,
'#description' => t('A message body.'),
),
),
'#return' => 'bool',
'#help' => t('Returns TRUE if the message sending was a success.'),
),
// privatemsg.reply
array(
'#method' => 'privatemsg.reply',
'#callback' => 'privatemsg_service_reply',
'#access arguments' => array(
'send private messages from remote',
),
'#file' => array(
'file' => 'inc',
'module' => 'privatemsg_service',
),
'#args' => array(
array(
'#name' => 'body',
'#type' => 'string',
'#description' => t('A message body.'),
),
array(
'#name' => 'thread_id',
'#type' => 'int',
'#description' => t('A thread ID for an existing message.'),
),
),
'#return' => 'bool',
'#help' => t('Returns TRUE if the message reply was a success.'),
),
// privatemsg.getThread
array(
'#method' => 'privatemsg.getThread',
'#callback' => 'privatemsg_service_get_thread',
'#access arguments' => array(
'get private messages from remote',
),
'#file' => array(
'file' => 'inc',
'module' => 'privatemsg_service',
),
'#args' => array(
array(
'#name' => 'thread_id',
'#type' => 'int',
'#description' => t('The ID of the thread that should be retrieved.'),
),
array(
'#name' => 'offset',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('Message offset from the start of the thread.'),
),
),
'#return' => 'array',
'#help' => t('Get all messages in a thread. User needs to be logged in. Unless the logged-in user has the \'read all private messages\' permission, the user will only be able to get threads that he/she participated in.'),
),
);
}