InternalThe config object for configuring the Rettiwt instance.
Get the list affiliates of a user.
Optionalid: stringThe ID of the target user. If no id is provided, the logged-in user's id is used.
Optionalcount: numberThe number of affiliates to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of affiliates to fetch.
The list of users affiliated to the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 affiliates of the User with id '1234567890'
rettiwt.user.affiliates('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the analytics overview of the logged in user.
OptionalfromTime: DateThe start time of the analytics period. Defaults to 7 days ago.
OptionaltoTime: DateThe end time of the analytics period. Defaults to now.
Optionalgranularity: RawAnalyticsGranularityThe granularity of the analytics data. Defaults to daily.
Optionalmetrics: RawAnalyticsMetric[]The metrics to include in the analytics data. Defaults to all available metrics available.
OptionalshowVerifiedFollowers: booleanWhether to include verified follower count and relationship counts in the response. Defaults to true.
The raw analytics data of the user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the analytics overview of the logged in user
rettiwt.user.analytics().then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of bookmark folders of the logged in user.
Optionalcursor: stringThe cursor to the batch of bookmark folders to fetch.
The list of bookmark folders.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching all bookmark folders of the logged in user
rettiwt.user.bookmarkFolders()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of tweets in a specific bookmark folder of the logged in user.
The ID of the bookmark folder.
Optionalcount: numberThe number of tweets to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of tweets to fetch.
The list of tweets in the bookmark folder.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 tweets from bookmark folder with ID '2001752149647049173'
rettiwt.user.bookmarkFolderTweets('2001752149647049173')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of bookmarks of the logged in user.
Optionalcount: numberThe number of bookmakrs to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of bookmarks to fetch.
The list of tweets bookmarked by the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the most recent 100 liked Tweets of the logged in User
rettiwt.user.bookmarks()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the details of a user.
The ID/username of the target user.
The details of the user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the details of the User with username 'user1' or '@user1'
rettiwt.user.details('user1') // or @user1
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the details of the User with id '1234567890'
rettiwt.user.details('1234567890')
.then(res => {
console.log(res); # 'res' is a single tweet
})
.catch(err => {
console.log(err);
});
Get the details of multiple users in bulk.
The list of IDs of the target users.
The details of the users.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the details of the users with IDs '123', '456', '789'
rettiwt.user.details(['123', '456', '789'])
.then(res => {
console.log(res); # 'res' is an array of users
})
.catch(err => {
console.log(err);
});
Follow a user.
The ID the user to be followed.
Whether following was successful or not.
Get the followed feed of the logged in user.
Optionalcursor: stringThe cursor to the batch of feed items to fetch.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 35 followed feed items of the logged-in user
rettiwt.user.followed()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list followers of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of followers to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of followers to fetch.
The list of users following the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 followers of the User with id '1234567890'
rettiwt.user.followers('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of users who are followed by a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of following to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of following to fetch.
The list of users followed by the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 following of the User with id '1234567890'
rettiwt.user.following('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the highlighted tweets of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of followers to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of followers to fetch.
The list of highlighted tweets of the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the top 100 highlights of the User with id '1234567890'
rettiwt.user.highlights('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of tweets liked by the logged in user.
Optionalcount: numberThe number of likes to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of likes to fetch.
The list of tweets liked by the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the most recent 100 liked Tweets of the logged in User
rettiwt.user.likes()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of of the the logged in user. Includes both followed and owned.
Optionalcount: numberThe number of lists to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of likes to fetch.
The list of tweets liked by the target user.
Get the media timeline of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of media to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of media to fetch
The media timeline of the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 timeline media tweets of the User with id '1234567890'
rettiwt.user.timeline('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Stream notifications of the logged in user in pseudo real-time.
The interval in milliseconds to poll for new tweets. Default interval is 60000 ms.
An async generator that yields new notifications as they are received.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Creating a function that streams all new notifications
async function streamNotifications() {
try {
// Awaiting for the notifications returned by the AsyncGenerator returned by the method
for await (const notification of rettiwt.user.notifications(5000)) {
console.log(notification.message);
}
}
catch (err) {
console.log(err);
}
}
// Calling the function
streamNotifications();
Get the recommended feed of the logged in user.
Optionalcursor: stringThe cursor to the batch of feed items to fetch.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 35 recommended feed items of the logged-in user
rettiwt.user.recommended()
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the reply timeline of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of replies to fetch, must be <= 20.
Optionalcursor: stringThe cursor to the batch of replies to fetch.
The reply timeline of the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 timeline replies of the User with id '1234567890'
rettiwt.user.replies('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Makes an HTTP request according to the given parameters.
The requested resource.
The raw data response received.
import { FetcherService, ResourceType } from 'rettiwt-api';
// Creating a new FetcherService instance using the given 'API_KEY'
const fetcher = new FetcherService({ apiKey: API_KEY });
// Fetching the details of the User with username 'user1'
fetcher.request(ResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the list of subscriptions of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of subscriptions to fetch, must be <= 100.
Optionalcursor: stringThe cursor to the batch of subscriptions to fetch.
The list of subscriptions by the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 100 subscriptions of the User with id '1234567890'
rettiwt.user.subscriptions('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Get the tweet timeline of a user.
Optionalid: stringThe ID of the target user. If no ID is provided, the logged-in user's ID is used.
Optionalcount: numberThe number of timeline items to fetch, must be <= 20.
Optionalcursor: stringThe cursor to the batch of timeline items to fetch.
The timeline of the target user.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the first 20 timeline tweets of the User with id '1234567890'
rettiwt.user.timeline('1234567890')
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Unfollow a user.
The ID the user to be unfollowed.
Whether unfollowing was successful or not.
Update the logged in user's profile.
The profile update options.
Whether the profile update was successful or not.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Updating the display name of the logged in user
rettiwt.user.updateProfile({ name: 'New Display Name' })
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Updating multiple profile fields
rettiwt.user.updateProfile({
name: 'New Display Name',
location: 'Istanbul',
description: 'Hello world!',
url: 'https://example.com'
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Handles interacting with resources related to user account