-
Notifications
You must be signed in to change notification settings - Fork 218
Basics
Please verify that the time of your machine is correctly set up (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
- Let's code with statics
- Let's code with objects
- Static References
Now that we have properly configured our environment we can start using Twitter. Because Twitter requires credentials information for each query executed, the first thing we need to do is to set the credentials.
The credentials contains two keys for the User also called Access Token, and two keys for the Application also called Consumer Token.
// Set up your credentials
Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET");
When the credentials have been set, all operations performed with Tweetinvi will use these credentials.
Click Learn more about credentials
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 operations they can dream of.
Here are few examples:
// Publish a tweet
Tweet.PublishTweet("@TweetinviApi rocks!");
// Get the details of the Authenticated User
var authenticatedUser = User.GetAuthenticatedUser();
// Get my Home Timeline
var tweets = Timeline.GetHomeTimeline();
Static classes allow developers to get objects and information back from Twitter. Each type of object contains a set of methods that you will be able to use in order to update them or get additional information.
The best example is the AuthenticatedUser
class, which gives access to a whole set of operations that can be performed on the account.
// Get a AuthenticatedUser object from the static class User
var authenticatedUser = User.GetAuthenticatedUser();
// Get and AccountSettings object from the authenticatedUser object
var settings = authenticatedUser.GetAccountSettings();
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
Here are other static classes that you might like:
- Account
- Friendship
- Trends
- TweetList
- SavedSearch
- Geo
- Help
Here are static classes for advanced users:
- RateLimit
- TwitterAccessor
- TweetinviEvents
- TweetinviContainer
<< PREVIOUS: Introduction --- NEXT: Set up your credentials >>