Merge pull request #4110 from Rudloff/feature/saved_searches_api
Implement saved_searches/list API
This commit is contained in:
commit
6ac45d97c4
|
@ -615,6 +615,12 @@ This is an alias for `search`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### saved_searches/list (*; AUTH)
|
||||||
|
|
||||||
|
This call does not have any parameter.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### users/search (*)
|
### users/search (*)
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
|
@ -1234,7 +1240,6 @@ The following API calls from the Twitter API are not implemented in either Frien
|
||||||
* lists/subscriptions
|
* lists/subscriptions
|
||||||
* lists/members/destroy_all
|
* lists/members/destroy_all
|
||||||
* lists/ownerships
|
* lists/ownerships
|
||||||
* saved_searches/list
|
|
||||||
* saved_searches/show/:id
|
* saved_searches/show/:id
|
||||||
* saved_searches/create
|
* saved_searches/create
|
||||||
* saved_searches/destroy/:id
|
* saved_searches/destroy/:id
|
||||||
|
|
|
@ -1525,8 +1525,7 @@ api_register_func('api/users/search', 'api_users_search');
|
||||||
* @param string $type Return format: json or xml
|
* @param string $type Return format: json or xml
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
* @throws UnauthorizedException
|
* @throws NotFoundException if the results are empty.
|
||||||
* @throws NotFoundException
|
|
||||||
*/
|
*/
|
||||||
function api_users_lookup($type)
|
function api_users_lookup($type)
|
||||||
{
|
{
|
||||||
|
@ -1558,8 +1557,7 @@ api_register_func('api/users/lookup', 'api_users_lookup', true);
|
||||||
* @param string $type Return format: json, xml, atom, rss
|
* @param string $type Return format: json, xml, atom, rss
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
* @throws UnauthorizedException
|
* @throws BadRequestException if the "q" parameter is missing.
|
||||||
* @throws BadRequestException
|
|
||||||
*/
|
*/
|
||||||
function api_search($type)
|
function api_search($type)
|
||||||
{
|
{
|
||||||
|
@ -3263,7 +3261,6 @@ api_register_func('api/statuses/followers', 'api_statuses_followers', true);
|
||||||
* @param string $type Either "json" or "xml"
|
* @param string $type Either "json" or "xml"
|
||||||
*
|
*
|
||||||
* @return boolean|string|array
|
* @return boolean|string|array
|
||||||
* @throws UnauthorizedException
|
|
||||||
*/
|
*/
|
||||||
function api_blocks_list($type)
|
function api_blocks_list($type)
|
||||||
{
|
{
|
||||||
|
@ -3285,7 +3282,6 @@ api_register_func('api/blocks/list', 'api_blocks_list', true);
|
||||||
* @param string $type Either "json" or "xml"
|
* @param string $type Either "json" or "xml"
|
||||||
*
|
*
|
||||||
* @return boolean|string|array
|
* @return boolean|string|array
|
||||||
* @throws UnauthorizedException
|
|
||||||
*/
|
*/
|
||||||
function api_friendships_incoming($type)
|
function api_friendships_incoming($type)
|
||||||
{
|
{
|
||||||
|
@ -5490,6 +5486,37 @@ function api_friendica_profile_show($type)
|
||||||
}
|
}
|
||||||
api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', true, API_METHOD_GET);
|
api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', true, API_METHOD_GET);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of saved searches.
|
||||||
|
*
|
||||||
|
* @see https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list
|
||||||
|
*
|
||||||
|
* @param string $type Return format: json or xml
|
||||||
|
*
|
||||||
|
* @return string|array
|
||||||
|
*/
|
||||||
|
function api_saved_searches_list($type)
|
||||||
|
{
|
||||||
|
$terms = dba::select('search', array('id', 'term'), array('uid' => local_user()));
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
while ($term = $terms->fetch()) {
|
||||||
|
$result[] = array(
|
||||||
|
'name' => $term['term'],
|
||||||
|
'query' => $term['term'],
|
||||||
|
'id_str' => $term['id'],
|
||||||
|
'id' => intval($term['id'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
dba::close($terms);
|
||||||
|
|
||||||
|
return api_format_data("terms", $type, array('terms' => $result));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @TODO move to top of file or somwhere better
|
||||||
|
api_register_func('api/saved_searches/list', 'api_saved_searches_list', true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@TODO Maybe open to implement?
|
@TODO Maybe open to implement?
|
||||||
To.Do:
|
To.Do:
|
||||||
|
|
Loading…
Reference in a new issue