Add all_following endpoint.

This commit is contained in:
Roger Braun 2017-02-13 22:55:38 +01:00
parent 038798f3f4
commit f9b3f8df84
2 changed files with 14 additions and 1 deletions

View file

@ -1,6 +1,7 @@
/* eslint-env browser */
const LOGIN_URL = '/api/account/verify_credentials.json'
const FRIENDS_TIMELINE_URL = '/api/statuses/friends_timeline.json'
const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing'
const PUBLIC_TIMELINE_URL = '/api/statuses/public_timeline.json'
const PUBLIC_AND_EXTERNAL_TIMELINE_URL = '/api/statuses/public_and_external_timeline.json'
const FAVORITE_URL = '/api/favorites/create'
@ -54,6 +55,12 @@ const fetchFriends = ({credentials}) => {
.then((data) => data.json())
}
const fetchAllFollowing = ({username, credentials}) => {
const url = `${ALL_FOLLOWING_URL}/${username}.json`
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json().users)
}
const fetchMentions = ({username, sinceId = 0, credentials}) => {
let url = `${MENTIONS_URL}?since_id=${sinceId}&screen_name=${username}`
return fetch(url, { headers: authHeaders(credentials) })
@ -169,7 +176,8 @@ const apiService = {
retweet,
postStatus,
deleteStatus,
uploadMedia
uploadMedia,
fetchAllFollowing
}
export default apiService

View file

@ -17,6 +17,10 @@ const backendInteractorService = (credentials) => {
return apiService.fetchFriends({credentials})
}
const fetchAllFollowing = ({username}) => {
return apiService.fetchAllFollowing({username, credentials})
}
const followUser = (id) => {
return apiService.followUser({credentials, id})
}
@ -32,6 +36,7 @@ const backendInteractorService = (credentials) => {
fetchFriends,
followUser,
unfollowUser,
fetchAllFollowing,
verifyCredentials: apiService.verifyCredentials
}