Bring me to my beloved Cheatsheet!
https://tweetinvi.codeplex.com/documentation?version=49Quick Start
In this page, we will discuss of the fundamentals concepts that you need to understand before using Tweetinvi.Before you start - IMPORTANT
Even before you start writing your first line of code, you need to verify that the time of your machine is correctly configured (both the time and the region).Twitter verifies the DateTime issued when performing a request. If the DateTime is not the same as their servers, all WebRequests to the API will result in a 401 status code (UnAuthorized). When a 401 exception is received, Tweetinvi will either throw the Exception or return null to all your operations.
Let's get it started!
Configure your credentials
Now that we have properly configured our environment we can start using Twitter.Twitter execute queries against credentials that are stored as OAuth Tokens. These tokens allow Twitter to identify the Application that want to execute an operation on behalf of a specific User.
Therefore the first thing we need to do is to set the credentials. The credentials contains 2 keys for the User also called Access Token, and 2 keys for the Application also called Consumer Token.
// Set up your credentials TwitterCredentials.SetCredentials("Access_Token", "Access_Secret", "Consumer_Key", "Consumer_Secret");
When the credentials have been set, all operation performed with Tweetinvi will use these credentials.
Click Learn more about credentials
Let's code!
Now that our credentials have been configured we are ready to use all the Twitter features!The Tweetinvi namespace (using Tweetinvi;) contains a bunch of static classes that will let the developers perform all the operation they can dream of.
Here are few examples:
// Publish a tweet Tweet.PublishTweet("@TweetinviApi rocks!"); // Get the details of the Logged Uservar loggedUser = User.GetLoggedUser(); // Get my Home Timelinevar tweets = Timeline.GetHomeTimeline();
In this documentation you will be able to learn more about the different static classes that exist.
Here is a list of the static classes you are most likely to use:
- Tweet, User, Timeline, Message, Search, Stream, TwitterCredentials, CredentialsCreator, ExceptionHandler, TweetinviConfig, Sync.
- Account, Friendship, Trends, TweetList, SavedSearch, Geo, Help.
- RateLimit, TwitterAccessor, TweetinviEvents, TweetinviContainer