From c5cb976b62b336c0ce9edb3b03cfd2b5c9af3450 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 7 Jan 2019 12:24:01 -0500 Subject: [PATCH] Update PHPDoc in include/ --- include/api.php | 393 +++++++++++++++++++++++++++++++++++++++++++----- mod/view.php | 2 +- 2 files changed, 356 insertions(+), 39 deletions(-) diff --git a/include/api.php b/include/api.php index 86fd106f5e..329b49f609 100644 --- a/include/api.php +++ b/include/api.php @@ -86,7 +86,8 @@ function api_user() * @brief Get source name from API client * * @return string - * Client source name, default to "api" if unset/unknown + * Client source name, default to "api" if unset/unknown + * @throws Exception */ function api_source() { @@ -113,6 +114,7 @@ function api_source() * * @param string $str Source date, as UTC * @return string Date in UTC formatted as "D M d H:i:s +0000 Y" + * @throws Exception */ function api_date($str) { @@ -158,15 +160,17 @@ function api_register_func($path, $func, $auth = false, $method = API_METHOD_ANY * * @brief Login API user * - * @param object $a App - * @hook 'authenticate' - * array $addon_auth - * 'username' => username from login form - * 'password' => password from login form - * 'authenticated' => return status, - * 'user_record' => return authenticated user record - * @hook 'logged_in' - * array $user logged user record + * @param App $a App + * @throws InternalServerErrorException + * @throws UnauthorizedException + * @hook 'authenticate' + * array $addon_auth + * 'username' => username from login form + * 'password' => password from login form + * 'authenticated' => return status, + * 'user_record' => return authenticated user record + * @hook 'logged_in' + * array $user logged user record */ function api_login(App $a) { @@ -276,8 +280,9 @@ function api_check_method($method) * * @brief Main API entry point * - * @param object $a App + * @param App $a App * @return string|array API call result + * @throws Exception */ function api_call(App $a) { @@ -468,11 +473,15 @@ function api_error($type, $e) /** * @brief Set values for RSS template * - * @param App $a + * @param App $a * @param array $arr Array to be passed to template * @param array $user_info User info * @return array - * @todo find proper type-hints + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException + * @todo find proper type-hints */ function api_rss_extra(App $a, $arr, $user_info) { @@ -500,7 +509,8 @@ function api_rss_extra(App $a, $arr, $user_info) * * @param int $id Contact id * @return bool|string - * Contact url or False if contact id is unknown + * Contact url or False if contact id is unknown + * @throws Exception */ function api_unique_id_to_nurl($id) { @@ -516,8 +526,13 @@ function api_unique_id_to_nurl($id) /** * @brief Get user info array. * - * @param object $a App + * @param App $a App * @param int|string $contact_id Contact ID or URL + * @return array + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_get_user(App $a, $contact_id = null) { @@ -810,9 +825,13 @@ function api_get_user(App $a, $contact_id = null) /** * @brief return api-formatted array for item's author and owner * - * @param object $a App - * @param array $item item from db + * @param App $a App + * @param array $item item from db * @return array(array:author, array:owner) + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_item_get_user(App $a, $item) { @@ -832,8 +851,8 @@ function api_item_get_user(App $a, $item) /** * @brief walks recursively through an array with the possibility to change value and key * - * @param array $array The array to walk through - * @param string $callback The callback function + * @param array $array The array to walk through + * @param callable $callback The callback function * * @return array the transformed array */ @@ -935,7 +954,7 @@ function api_create_xml(array $data, $root_element) * @param string $type Return type (atom, rss, xml, json) * @param array $data JSON style array * - * @return (string|array) XML data or JSON data + * @return array|string (string|array) XML data or JSON data */ function api_format_data($root_element, $type, $data) { @@ -960,9 +979,16 @@ function api_format_data($root_element, $type, $data) /** * Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; * returns a 401 status code and an error message if not. + * * @see https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials * * @param string $type Return type (atom, rss, xml, json) + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_account_verify_credentials($type) { @@ -1010,6 +1036,7 @@ api_register_func('api/account/verify_credentials', 'api_account_verify_credenti * Get data from $_POST or $_GET * * @param string $k + * @return null */ function requestdata($k) { @@ -1028,6 +1055,11 @@ function requestdata($k) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_statuses_mediap($type) { @@ -1075,6 +1107,12 @@ api_register_func('api/statuses/mediap', 'api_statuses_mediap', true, API_METHOD * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws TooManyRequestsException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update */ function api_statuses_update($type) @@ -1217,6 +1255,11 @@ api_register_func('api/statuses/update_with_media', 'api_statuses_update', true, * Uploads an image to Friendica. * * @return array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload */ function api_media_upload() @@ -1262,7 +1305,12 @@ api_register_func('api/media/upload', 'api_media_upload', true, API_METHOD_POST) * * @param string $type Return type (atom, rss, xml, json) * + * @param int $item_id * @return array|string + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_status_show($type, $item_id = 0) { @@ -1361,6 +1409,11 @@ function api_status_show($type, $item_id = 0) * The author's most recent status will be returned inline. * * @param string $type Return type (atom, rss, xml, json) + * @return array|string + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show */ function api_users_show($type) @@ -1437,6 +1490,10 @@ api_register_func('api/externalprofile/show', 'api_users_show'); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search */ function api_users_search($type) @@ -1485,7 +1542,11 @@ api_register_func('api/users/search', 'api_users_search'); * @param string $type Return format: json or xml * * @return array|string + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException * @throws NotFoundException if the results are empty. + * @throws UnauthorizedException */ function api_users_lookup($type) { @@ -1518,6 +1579,10 @@ api_register_func('api/users/lookup', 'api_users_lookup', true); * * @return array|string * @throws BadRequestException if the "q" parameter is missing. + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_search($type) { @@ -1600,10 +1665,16 @@ api_register_func('api/search', 'api_search', true); /** * Returns the most recent statuses posted by the user and the users they follow. * - * @see https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline + * @see https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @todo Optional parameters * @todo Add reply info */ @@ -1697,6 +1768,11 @@ api_register_func('api/statuses/friends_timeline', 'api_statuses_home_timeline', * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_statuses_public_timeline($type) { @@ -1780,7 +1856,11 @@ api_register_func('api/statuses/public_timeline', 'api_statuses_public_timeline' * * @param string $type Return format: json, xml, atom, rss * @return array|string + * @throws BadRequestException * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_statuses_networkpublic_timeline($type) { @@ -1837,6 +1917,12 @@ api_register_func('api/statuses/networkpublic_timeline', 'api_statuses_networkpu * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id */ function api_statuses_show($type) @@ -1910,6 +1996,12 @@ api_register_func('api/statuses/show', 'api_statuses_show', true); * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @todo nothing to say? */ function api_conversation_show($type) @@ -1987,6 +2079,12 @@ api_register_func('api/statusnet/conversation', 'api_conversation_show', true); * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id */ function api_statuses_repeat($type) @@ -2054,6 +2152,12 @@ api_register_func('api/statuses/retweet', 'api_statuses_repeat', true, API_METHO * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id */ function api_statuses_destroy($type) @@ -2095,6 +2199,12 @@ api_register_func('api/statuses/destroy', 'api_statuses_destroy', true, API_METH * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see http://developer.twitter.com/doc/get/statuses/mentions */ function api_statuses_mentions($type) @@ -2162,8 +2272,12 @@ api_register_func('api/statuses/replies', 'api_statuses_mentions', true); * * @param string $type Either "json" or "xml" * @return string|array + * @throws BadRequestException * @throws ForbiddenException - * @see https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException + * @see https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline */ function api_statuses_user_timeline($type) { @@ -2243,6 +2357,12 @@ api_register_func('api/statuses/user_timeline', 'api_statuses_user_timeline', tr * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://web.archive.org/web/20131019055350/https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid */ function api_favorites_create_destroy($type) @@ -2320,6 +2440,11 @@ api_register_func('api/favorites/destroy', 'api_favorites_create_destroy', true, * @param string $type Return type (atom, rss, xml, json) * * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_favorites($type) { @@ -2391,6 +2516,7 @@ api_register_func('api/favorites', 'api_favorites', true); * @param array $sender * * @return array + * @throws InternalServerErrorException */ function api_format_messages($item, $recipient, $sender) { @@ -2448,6 +2574,7 @@ function api_format_messages($item, $recipient, $sender) * @param array $item * * @return array + * @throws InternalServerErrorException */ function api_convert_item($item) { @@ -2523,6 +2650,7 @@ function api_convert_item($item) * @param string $body * * @return array + * @throws InternalServerErrorException */ function api_get_attachments(&$body) { @@ -2561,6 +2689,7 @@ function api_get_attachments(&$body) * @param string $bbcode * * @return array + * @throws InternalServerErrorException * @todo Links at the first character of the post */ function api_get_entitities(&$text, $bbcode) @@ -2771,12 +2900,16 @@ function api_contactlink_to_array($txt) /** * @brief return likes, dislikes and attend status for item * - * @param array $item array + * @param array $item array * @param string $type Return type (atom, rss, xml, json) * * @return array - * likes => int count, - * dislikes => int count + * likes => int count, + * dislikes => int count + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_format_items_activities($item, $type = "json") { @@ -2843,8 +2976,9 @@ function api_format_items_activities($item, $type = "json") /** * @brief return data from profiles * - * @param array $profile_row array containing data from db table 'profile' + * @param array $profile_row array containing data from db table 'profile' * @return array + * @throws InternalServerErrorException */ function api_format_items_profiles($profile_row) { @@ -2895,10 +3029,15 @@ function api_format_items_profiles($profile_row) /** * @brief format items to be returned by api * - * @param array $r array of items + * @param array $r array of items * @param array $user_info * @param bool $filter_user filter items by $user_info - * @param string $type Return type (atom, rss, xml, json) + * @param string $type Return type (atom, rss, xml, json) + * @return array + * @throws BadRequestException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_format_items($r, $user_info, $filter_user = false, $type = "json") { @@ -3013,6 +3152,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws Exception */ function api_account_rate_limit_status($type) { @@ -3088,6 +3228,11 @@ api_register_func('api/lists/subscriptions', 'api_lists_list', true); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships */ function api_lists_ownerships($type) @@ -3132,6 +3277,11 @@ api_register_func('api/lists/ownerships', 'api_lists_ownerships', true); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships */ function api_lists_statuses($type) @@ -3209,7 +3359,11 @@ api_register_func('api/lists/statuses', 'api_lists_statuses', true); * * @param string $qtype Either "friends" or "followers" * @return boolean|array + * @throws BadRequestException * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_statuses_f($qtype) { @@ -3293,12 +3447,14 @@ function api_statuses_f($qtype) /** * Returns the user's friends. * - * @brief Returns the list of friends of the provided user + * @brief Returns the list of friends of the provided user * * @deprecated By Twitter API in favor of friends/list * * @param string $type Either "json" or "xml" * @return boolean|string|array + * @throws BadRequestException + * @throws ForbiddenException */ function api_statuses_friends($type) { @@ -3312,12 +3468,14 @@ function api_statuses_friends($type) /** * Returns the user's followers. * - * @brief Returns the list of followers of the provided user + * @brief Returns the list of followers of the provided user * * @deprecated By Twitter API in favor of friends/list * * @param string $type Either "json" or "xml" * @return boolean|string|array + * @throws BadRequestException + * @throws ForbiddenException */ function api_statuses_followers($type) { @@ -3340,6 +3498,8 @@ api_register_func('api/statuses/followers', 'api_statuses_followers', true); * @param string $type Either "json" or "xml" * * @return boolean|string|array + * @throws BadRequestException + * @throws ForbiddenException */ function api_blocks_list($type) { @@ -3361,6 +3521,8 @@ api_register_func('api/blocks/list', 'api_blocks_list', true); * @param string $type Either "json" or "xml" * * @return boolean|string|array + * @throws BadRequestException + * @throws ForbiddenException */ function api_friendships_incoming($type) { @@ -3386,6 +3548,7 @@ api_register_func('api/friendships/incoming', 'api_friendships_incoming', true); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws InternalServerErrorException */ function api_statusnet_config($type) { @@ -3445,6 +3608,12 @@ api_register_func('api/statusnet/version', 'api_statusnet_version', false); * * @param string $type Return type (atom, rss, xml, json) * + * @return array|string|void + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @todo use api_format_data() to return data */ function api_ff_ids($type) @@ -3487,6 +3656,8 @@ function api_ff_ids($type) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids */ function api_friends_ids($type) @@ -3500,6 +3671,8 @@ function api_friends_ids($type) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids */ function api_followers_ids($type) @@ -3517,6 +3690,12 @@ api_register_func('api/followers/ids', 'api_followers_ids', true); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message */ function api_direct_messages_new($type) @@ -3605,7 +3784,12 @@ api_register_func('api/direct_messages/new', 'api_direct_messages_new', true, AP * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array - * @see https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException + * @see https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message */ function api_direct_messages_destroy($type) { @@ -3686,7 +3870,12 @@ api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy', * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array - * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy.html + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException + * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy.html */ function api_friendships_destroy($type) { @@ -3764,6 +3953,11 @@ api_register_func('api/friendships/destroy', 'api_friendships_destroy', true, AP * @param string $verbose * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_direct_messages_box($type, $box, $verbose) { @@ -3869,6 +4063,8 @@ function api_direct_messages_box($type, $box, $verbose) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException * @see https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-sent-message */ function api_direct_messages_sentbox($type) @@ -3883,6 +4079,8 @@ function api_direct_messages_sentbox($type) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException * @see https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-messages */ function api_direct_messages_inbox($type) @@ -3896,6 +4094,8 @@ function api_direct_messages_inbox($type) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException */ function api_direct_messages_all($type) { @@ -3908,6 +4108,8 @@ function api_direct_messages_all($type) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException */ function api_direct_messages_conversation($type) { @@ -3968,6 +4170,9 @@ api_register_func('api/oauth/access_token', 'api_oauth_access_token', false); * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws InternalServerErrorException */ function api_fr_photoalbum_delete($type) { @@ -4020,6 +4225,9 @@ function api_fr_photoalbum_delete($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws InternalServerErrorException */ function api_fr_photoalbum_update($type) { @@ -4059,6 +4267,8 @@ function api_fr_photoalbum_update($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws ForbiddenException + * @throws InternalServerErrorException */ function api_fr_photos_list($type) { @@ -4105,6 +4315,11 @@ function api_fr_photos_list($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException */ function api_fr_photo_create_update($type) { @@ -4239,6 +4454,9 @@ function api_fr_photo_create_update($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws InternalServerErrorException */ function api_fr_photo_delete($type) { @@ -4287,6 +4505,10 @@ function api_fr_photo_delete($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws InternalServerErrorException + * @throws NotFoundException */ function api_fr_photo_detail($type) { @@ -4315,7 +4537,12 @@ function api_fr_photo_detail($type) * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * * @return string|array - * @see https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException + * @see https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image */ function api_account_update_profile_image($type) { @@ -4411,6 +4638,11 @@ api_register_func('api/account/update_profile_image', 'api_account_update_profil * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_account_update_profile($type) { @@ -4445,6 +4677,8 @@ api_register_func('api/account/update_profile', 'api_account_update_profile', tr /** * * @param string $acl_string + * @return bool + * @throws Exception */ function check_acl_input($acl_string) { @@ -4481,6 +4715,12 @@ function check_acl_input($acl_string) * @param integer $profile * @param boolean $visibility * @param string $photo_id + * @return array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException */ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $desc, $profile = 0, $visibility = false, $photo_id = null) { @@ -4639,6 +4879,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $ * @param string $deny_gid * @param string $filetype * @param boolean $visibility + * @throws InternalServerErrorException */ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $filetype, $visibility = false) { @@ -4691,6 +4932,12 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f * @param string $photo_id * * @return array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws NotFoundException + * @throws UnauthorizedException */ function prepare_photo_data($type, $scale, $photo_id) { @@ -4858,6 +5105,8 @@ api_register_func('api/friendica/remoteauth', 'api_friendica_remoteauth', true); * * @param array $item Sharer item * @return array|false Shared item or false if not a reshare + * @throws ImagickException + * @throws InternalServerErrorException */ function api_share_as_retweet(&$item) { @@ -4969,6 +5218,7 @@ function api_share_as_retweet(&$item) * @param string $profile * * @return string|false + * @throws InternalServerErrorException * @todo remove trailing junk from profile url * @todo pump.io check has to check the website */ @@ -5053,6 +5303,7 @@ function api_get_nick($profile) * @param array $item * * @return array + * @throws Exception */ function api_in_reply_to($item) { @@ -5108,6 +5359,7 @@ function api_in_reply_to($item) * @param string $text * * @return string + * @throws InternalServerErrorException */ function api_clean_plain_items($text) { @@ -5134,6 +5386,7 @@ function api_clean_plain_items($text) * @param string $body The original body * * @return string Cleaned body + * @throws InternalServerErrorException */ function api_clean_attachments($body) { @@ -5162,7 +5415,7 @@ function api_clean_attachments($body) * * @param array $contacts * - * @return array + * @return void */ function api_best_nickname(&$contacts) { @@ -5232,6 +5485,11 @@ function api_best_nickname(&$contacts) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_group_show($type) { @@ -5297,6 +5555,11 @@ api_register_func('api/friendica/group_show', 'api_friendica_group_show', true); * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_group_delete($type) { @@ -5358,6 +5621,11 @@ api_register_func('api/friendica/group_delete', 'api_friendica_group_delete', tr * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy */ function api_lists_destroy($type) @@ -5402,10 +5670,11 @@ api_register_func('api/lists/destroy', 'api_lists_destroy', true, API_METHOD_DEL * Add a new group to the database. * * @param string $name Group name - * @param int $uid User ID + * @param int $uid User ID * @param array $users List of users to add to the group * * @return array + * @throws BadRequestException */ function group_create($name, $uid, $users = []) { @@ -5475,6 +5744,11 @@ function group_create($name, $uid, $users = []) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_group_create($type) { @@ -5503,6 +5777,11 @@ api_register_func('api/friendica/group_create', 'api_friendica_group_create', tr * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create */ function api_lists_create($type) @@ -5538,6 +5817,11 @@ api_register_func('api/lists/create', 'api_lists_create', true, API_METHOD_POST) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_group_update($type) { @@ -5611,6 +5895,11 @@ api_register_func('api/friendica/group_update', 'api_friendica_group_update', tr * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException * @see https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update */ function api_lists_update($type) @@ -5658,6 +5947,10 @@ api_register_func('api/lists/update', 'api_lists_update', true, API_METHOD_POST) * @param string $type Return type (atom, rss, xml, json) * * @return array|string + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException */ function api_friendica_activity($type) { @@ -5702,7 +5995,10 @@ api_register_func('api/friendica/activity/unattendmaybe', 'api_friendica_activit * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array -*/ + * @throws BadRequestException + * @throws ForbiddenException + * @throws InternalServerErrorException + */ function api_friendica_notification($type) { $a = \get_app(); @@ -5737,6 +6033,11 @@ function api_friendica_notification($type) * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_notification_seen($type) { @@ -5782,6 +6083,11 @@ api_register_func('api/friendica/notification', 'api_friendica_notification', tr * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array (success result=ok, error result=error with error message) + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_direct_messages_setseen($type) { @@ -5826,11 +6132,16 @@ api_register_func('api/friendica/direct_messages_setseen', 'api_friendica_direct /** * @brief search for direct_messages containing a searchstring through api * - * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' + * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @param string $box * @return string|array (success: success=true if found and search_result contains found messages, * success=false if nothing was found, search_result='nothing found', - * error: result=error with error message) + * error: result=error with error message) + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_direct_messages_search($type, $box = "") { @@ -5894,6 +6205,11 @@ api_register_func('api/friendica/direct_messages_search', 'api_friendica_direct_ * * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' * @return string|array + * @throws BadRequestException + * @throws ForbiddenException + * @throws ImagickException + * @throws InternalServerErrorException + * @throws UnauthorizedException */ function api_friendica_profile_show($type) { @@ -5975,6 +6291,7 @@ api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', tr * @param string $type Return format: json or xml * * @return string|array + * @throws Exception */ function api_saved_searches_list($type) { diff --git a/mod/view.php b/mod/view.php index 1b2e379a93..94d1263f7c 100644 --- a/mod/view.php +++ b/mod/view.php @@ -1,6 +1,6 @@