From 6a8eb94d051a4f6a1f1bd09362558af4c5ef28fd Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 25 Nov 2020 21:09:17 -0800 Subject: [PATCH 01/95] Set theme jekyll-theme-minimal --- _config.yml | 1 + index.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 _config.yml create mode 100644 index.md diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..2f7efbea --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file diff --git a/index.md b/index.md new file mode 100644 index 00000000..22c760fa --- /dev/null +++ b/index.md @@ -0,0 +1,37 @@ +## Welcome to GitHub Pages + +You can use the [editor on GitHub](https://github.com/JoeMayo/LinqToTwitter/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. + +Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. + +### Markdown + +Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for + +```markdown +Syntax highlighted code block + +# Header 1 +## Header 2 +### Header 3 + +- Bulleted +- List + +1. Numbered +2. List + +**Bold** and _Italic_ and `Code` text + +[Link](url) and ![Image](src) +``` + +For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). + +### Jekyll Themes + +Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/JoeMayo/LinqToTwitter/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. + +### Support or Contact + +Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. From 39ffd037c3ea6590227834a958b4087352c49b32 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 25 Nov 2020 21:09:31 -0800 Subject: [PATCH 02/95] Update index.md From f587fa07168127e39f64be3c0ac044d7bd5740d7 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 25 Nov 2020 21:24:02 -0800 Subject: [PATCH 03/95] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 22c760fa..dc7110d0 100644 --- a/index.md +++ b/index.md @@ -1,4 +1,4 @@ -## Welcome to GitHub Pages +## Welcome to LINQ to Twitter You can use the [editor on GitHub](https://github.com/JoeMayo/LinqToTwitter/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. From 3ae2c88a441fa0d811b0a547a443e2ed4f376f66 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 25 Nov 2020 21:25:39 -0800 Subject: [PATCH 04/95] Set theme jekyll-theme-slate --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 2f7efbea..c7418817 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-minimal \ No newline at end of file +theme: jekyll-theme-slate \ No newline at end of file From 365d5c6832a7ce26eaaef83856977970f3661728 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 26 Nov 2020 23:14:54 +0000 Subject: [PATCH 05/95] Update index.md --- index.md | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/index.md b/index.md index dc7110d0..08d3e7b1 100644 --- a/index.md +++ b/index.md @@ -1,37 +1,26 @@ -## Welcome to LINQ to Twitter +Welcome to LINQ to Twitter documentation. Here, you'll find the technical information you'll need to use LINQ to Twitter in your own applications. We have a FAQ, general Twitter API concepts, a Twitter API technical reference, security information, and error handling. -You can use the [editor on GitHub](https://github.com/JoeMayo/LinqToTwitter/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. +Note: The current version of LINQ to Twitter is v6.0, which tracks .NET 5+ and the Twitter API v2. It also offers Twitter API v1.1 support. Please see [[LINQ to Twitter v5.x]] for Twitter API v1.1 technical endpoint documentation. -Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. +## [[LINQ to Twitter FAQ]] -### Markdown +Frequently asked questions. -Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for +## [[Programming the Twitter API]] -```markdown -Syntax highlighted code block +Some introductory information on programming Twitter. -# Header 1 -## Header 2 -### Header 3 +## [[LINQ to Twitter v6.0]] -- Bulleted -- List +This is the main API section, where the technical descriptions of objects, methods, and other features of LINQ to Twitter are covered. -1. Numbered -2. List +## [[Securing Your Applications]] +As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. You'll learn about the various OAuth implementations you can use here. -**Bold** and _Italic_ and `Code` text +## [[Error Handling]] -[Link](url) and ![Image](src) -``` +You'll might encounter errors when working with the Twitter API. This section attempts to help you debug and figure out what the problem could be. -For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). +## To Stay Informed -### Jekyll Themes - -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/JoeMayo/LinqToTwitter/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. - -### Support or Contact - -Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. +For the latest information on LINQ to Twitter, you can watch this site or follow [@Linq2Twitr](https://twitter.com/Linq2Twitr) for the most frequent news or [@JoeMayo](https://twitter.com/JoeMayo) for highlights. From 9f59a1228faf34e4c2f4d752faca076639d1ff84 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 26 Nov 2020 23:15:20 +0000 Subject: [PATCH 06/95] Update index.md --- originalindex.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 originalindex.md diff --git a/originalindex.md b/originalindex.md new file mode 100644 index 00000000..dc7110d0 --- /dev/null +++ b/originalindex.md @@ -0,0 +1,37 @@ +## Welcome to LINQ to Twitter + +You can use the [editor on GitHub](https://github.com/JoeMayo/LinqToTwitter/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. + +Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. + +### Markdown + +Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for + +```markdown +Syntax highlighted code block + +# Header 1 +## Header 2 +### Header 3 + +- Bulleted +- List + +1. Numbered +2. List + +**Bold** and _Italic_ and `Code` text + +[Link](url) and ![Image](src) +``` + +For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). + +### Jekyll Themes + +Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/JoeMayo/LinqToTwitter/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. + +### Support or Contact + +Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. From 69c927939fb08e2e39d593eb69903e94da3db0b4 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 26 Nov 2020 23:24:15 +0000 Subject: [PATCH 07/95] Update index.md --- Error-Handling.md | 25 ++++++ LINQ-to-Twitter-FAQ.md | 152 +++++++++++++++++++++++++++++++++ Programming-the-Twitter-API.md | 13 +++ Securing-Your-Applications.md | 11 +++ index.md | 8 +- 5 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 Error-Handling.md create mode 100644 LINQ-to-Twitter-FAQ.md create mode 100644 Programming-the-Twitter-API.md create mode 100644 Securing-Your-Applications.md diff --git a/Error-Handling.md b/Error-Handling.md new file mode 100644 index 00000000..d9760864 --- /dev/null +++ b/Error-Handling.md @@ -0,0 +1,25 @@ +## Error Handling + +In a perfect world, you would build a query with LINQ to Twitter and it would work flawlessly the first time. The reality is that you might encounter errors, especially when you first get started. The nature of these errors can vary and can be confusing and this section attempts to help you find and debug problems. + +In particular, the errors that the Twitter API returns may be new to you. I'll cover a general approach to get started in understanding errors that can occur. Then I'll follow-up with some common scenarios and how you can approach them. + +### Examining Exceptions + +The most likely error you'll receive will be via an exception thrown from LINQ to Twitter. As with any other .NET library, an Exception means that the program was unable to perform it's intended purpose. Though potentially possible, It doesn't mean LINQ to Twitter or the Twitter API has an error - your program or configuration can be causing the error. The exception is the mechanism by which you are able to learn more information about what the problem could be. + +In LINQ to Twitter, you'll receive a TwitterQueryException. The Message and ErrorCode properties contain the error message and error code, respectively, from the Twitter API. You should read these to see if they indicate what the problem could be. You can visit the Twitter documentation for [Error Codes & Responses](https://dev.twitter.com/overview/api/response-codes) to see what the possible errors are. A few examples are 88/Rate Limit Exceeded, meaning that you've sent more requests during a 15 minute window than what you're allowed; 187/Status is a duplicate, meaning that you tweeted the exact same text twice; or 32/Could not authenticate you, meaning that Twitter wasn't able to verify who you are. + +Another property of TwitterQueryException that you should look at is InnerException, which is the original exception that caused the problem. Sometimes an exception is due to a network problem or something else that has nothing to do with Twitter. The inner exception is important for helping figure out the problem and you should examine all the properties of that exception too. + +### Example Scenarios + +Here are a couple potential scenarios and actions you can take to fix the problem. + +#### HTTP 401 Unauthorized + +The 401 error is one of the most frequent problems that people have. You can tell if the problem is a 401 by looking at the StatusCode on the exception. It means that you weren't able to authorize the application. There are many different reasons this can happen and figuring out the problem can be complex because there could actually be multiple things at play. Over the years, I've collected reasons why a 401 can occur and compiled the results into the [[LINQ to Twitter FAQ]]. Please visit the FAQ and review each step to resolve the problem. + +#### Rate Limits + +Twitter rate limits the API, meaning that you have _n_ queries for each 15 minutes. If you exceed those rates, you'll receive an error from Twitter. The Twitter documentation, [API Rate Limits](https://dev.twitter.com/rest/public/rate-limiting), explains how rate limiting works. You can use the LINQ to Twitter documentation, [[Getting Rate Limits]], to find out what your limits are for each API. \ No newline at end of file diff --git a/LINQ-to-Twitter-FAQ.md b/LINQ-to-Twitter-FAQ.md new file mode 100644 index 00000000..68eead2a --- /dev/null +++ b/LINQ-to-Twitter-FAQ.md @@ -0,0 +1,152 @@ +## LINQ to Twitter FAQ + +### 1. I get a _401 Unauthorized_ Exception. How to I figure out the problem? + +A _401 Unauthorized_ message means that the Twitter server is unable to authorize you. There are several causes for this problem and the following checklist should help you work through the problems: + +* Have you added credentials to an authorizer. You can obtain these credentials from your registered Twitter application. You can register a Twitter application at the Twitter developer site at https://developer.twitter.com. The following documentation explains how to add credentials to a LINQ to Twitter authorizer - [[Securing Your Applications]] + +* Are your credentials entered properly. Check for misspellings and potential copy and paste errors. Something such as a trailing space is a common gottcha. You can double-check your credentials at the Twitter developer site (https://developer.twitter.com), explained in the previous item. + +* Did you assign the right key to the right token. Make sure you didn't accidentally mix up your `ConsumerKey `and `ConsumerSecret`. You can verify your credentials at the Twitter developer site (https://developer.twitter.com). + +* Have your tokens expired? Twitter tokens generally don't expire, but you can always visit your app page and regenerate them if they do. + +* If you aren't using `SingleUserAuthorizer`, make sure the authorizing user has authorized your app by going through the authorization process at least one time. + +* Make sure you've entered a Callback URL for your Twitter application at the Twitter developer site (https://developer.twitter.com). + +* Twitter won't let you use http://localhost as your callback URL, so you may want to use http://127.0.0.1 instead. + +* Check your access level at the Twitter developers site (https://developer.twitter.com). Potential settings are Read, Write, and Direct Message. + +* Make sure your access level at the Twitter developers site (https://developer.twitter.com) is set for both Read and Write if you need it. + +* Ensure your computer time is up-to-date. The Twitter server reads your OAuth signature (LINQ to Twitter prepares for you) and verifies the time used to build the signature. This time comes from your machine. If the time is off, your OAuth signature is considered invalid. Be aware that the mobile phone emulators time may need to be reset every time the emulator boots up. + +* Has Twitter disabled your credentials? If you post a message on the Twitter forums that exposes your credentials, Twitter will invalidate your credentials to secure your account. You can re-generate credentials at any time. + +* Has Twitter revoked your application's access. If you've violated any Twitter rules, they might disable your application. + +* Ensure you have permission to perform the operation you're attempting. i.e. Some features are in Beta and require permission. Other features, such as XAuth require permission from Twitter to use. + +* Examine the API call you're trying to use and make sure you have permission to perform the action you're trying to perform. Consult the Twitter documentation (linked to from the bottom of each LINQ to Twitter API documentation page) for the latest details of how the API should be used. + +* Are you using `ApplicationOnlyAuthorizer` improperly? `ApplicationOnlyAuthorizer` only works for operations that don't operate on behalf of a user. e.g. Search works fine, but `TweetAsync` doesn't because it tweets on behalf of a user. + +* Are you using `ApplicationOnlyAuthorizer` on Streams? It doesn't work on streams and you'll need to use a different type of authorizer. + +* If using `SingleUserAuthorizer`, the mapping between LINQ to Twitter/Twitter API credentials is `OAuthToken/AccesssToken` and `AccessToken/AccessTokenSecret`. Alternatively, use the `SingleUserInMemoryCredentials` and populate `TwitterAccessToken`and `TwitterAccessTokenSecret` instead of `OAuthToken` and `AccessToken`, respectively. + +* When doing an `Account/VerifyCredentials` (see [[Managing Accounts]]) query, Twitter will return a 401 if the user's credentials aren't valid. + +* If you're using `XAuthAuthorizer`, you are required to get permission from Twitter before using `XAuth`. + +* Review additional troubleshooting tips on Twitter's site at [OAuth FAQ](https://developer.twitter.com/en/docs/basics/authentication/guides/oauth-faq) + +* Please remember to sanitize credentials before posting code or HTTP messages in the discussion forums. + +* Tip: The problem could also involve a combination of these problems. So, it's useful to keep working each item until the problem is resolved. + +### 2. I get a _400 Bad Request_ `WebException`. How to I figure out the problem? + +A LINQ to Twitter builds all of the HTTP requests for you, so there's only a limited number of scenarios where this error occurs. In Twitter API v1.0, rate limiting errors appeared as 400, but LINQ to Twitter now supports the Twitter API v1.1, which returns 429 Too Many Requests for rate limit errors. + +The most likely reason for a 400 Bad Request is that you didn't authenticate your request. Twitter API v1.1, which LINQ to Twitter supports, requires you to authorize each request. That means you need to use OAuth. For information on how to use OAuth with LINQ to Twitter, visit the [[Securing Your Applications]] page. The downloadable source code on this site has examples that use OAuth too. + +As with most errors from Twitter, a good way to debug the problem is to use Fiddler to view the HTTP response. + +* Please remember to sanitize credentials before posting code or HTTP messages in the discussion forums. + +### 3. I received an Exception with HTTP Status 429. What does that mean? + +This means you've exceeded the rate limit for an Twitter API request. Twitter API has a feature called Rate Limiting, where it only allows you to send a number of requests within a period of time. You can fix this problem by designing your algorithm so that it won't exceed the rate limit. The Rate Limit varies for each API, so you'll need to design your code accordingly. LINQ to Twitter exposes various parts of the Twitter API's Rate Limiting features, which includes response headers and queries. The response headers you can check are available via `TwitterContext` instance properties: `RateLimitCurrent`, `RateLimitRemaining`, and `RateLimitReset`. There are also separate rate limiting properties on the `TwitterContext` entity: `MediaRateLimitCurrent`, `MediaRateLimitRemaining`, and `MediaRateLimitReset`. These header values provide real-time status of rate limits that you can read right after a command or query. In addition to properties that show response headers, you can make a `Help/RateLimits` query to find rate limits on all or a filtered set of Twitter APIs. See [[Getting Rate Limits]] for more information. You can find more information on how Twitter handles rate limiting in the Twitter API documentation: https://developer.twitter.com/en/docs/basics/rate-limiting. + +### 4. Why are `ScreenName` and/or `UserID` properties `null `in the `User` entity response from Twitter? + +The `ScreenName` and `UserID` properties are input only, allowing you to see the parameters you provided in your query. + +* For v2.1.x, use the `Identifier` property, which has the `ScreenName` and `UserID` returned from Twitter. + +* For v3.0.x and later, use the `ScreenNameResponse` and `UserIDResponse` properties. + +A bit of background: Anything used as an input parameter is also looked at in the query response, so if a user omits the parameter in a query but the twitter response contains a value, it was being filtered out of the results. To fix this, I adopted a convention where any return parameters also match input parameters would have a 'Response' suffix. e.g. `ScreenName` (input) and `ScreenNameResponse` (output). To find which values are input, the docs for each API call contain the input/filter parameters. + +### 5. How do I page through `Status` and `Search` timelines? + +Please see the blog post, [Working with Timelines with LINQ to Twitter](http://geekswithblogs.net/WinAZ/archive/2012/09/02/working-with-timelines-with-linq-to-twitter.aspx), that explains how to do this. + +### 6. I'm not using `async/await` and my LINQ to Twitter code isn't working. + +You must use `async/await` with LINQ to Twitter v3.0 or later. You might see deadlocks, race conditions, or undetected unhandled exceptions if you try to use LINQ to Twitter like previous versions. LINQ to Twitter v3.0 is asynchronous. That means you need `async` methods that use `await` on queries and commands. You also need to use exception handling (aka `try/catch`), especially for queries that throw exceptions for _not found_ conditions. The downloadable source code has a set of projects with the _Linq2TwitterDemos__ prefix for several technologies to demonstrate how to use `async` and `await` with LINQ to Twitter. + +### 7. I'm receiving an error on assemblies named `System.Net.Http...` when trying to build. + +LINQ to Twitter v3.0 has dependencies on `HttpClient`, which includes `System.Net.Http`, `System.Net.Http.Extensions`, and `System.Net.Http.Primitives`. You can add references to these assemblies via NuGet: + + 1. Right-click on _References_ and select _Manage NuGet Packages_. + 2. Search for _HttpClient_. + 3. Install the _Microsoft HttpClient_ package. + +Another reason for a related error, "System.IO.FileNotFoundException: Could not load file or assembly System.Net.Http.Primitives", occurs when a different version is in the GAC. You can solve that issue by adding a binding redirection to your `*.config` file, like this: +```xml + + + + +``` +If you add LINQ to Twitter from NuGet, these dependencies should be added automatically. For more information on NuGet and versioning, David Ebbo has an excellent set of blog posts: + +* [NuGet versioning Part 1: taking on DLL Hell](http://blog.davidebbo.com/2011/01/nuget-versioning-part-1-taking-on-dll.html) +* [NuGet versioning Part 2: the core algorithm](http://blog.davidebbo.com/2011/01/nuget-versioning-part-2-core-algorithm.html) +* [NuGet versioning Part 3: unification via binding redirects](http://blog.davidebbo.com/2011/01/nuget-versioning-part-3-unification-via.html) + +### 8. How do I let a user authorize my app one time, without having to re-authorize every time. + +The `CredentialStore` property of the `IAuthorizer` has the user's tokens, after authorization. So, after the initial authorization, read the tokens from the `CredentialStore` and save them in the database. Then check to see if you have tokens for the user the next time you authorize. If you have tokens, populate the authorizer. When the authorizer has all 4 tokens, LINQ to Twitter will allow you to perform queries without authorizing the user again. + +The C# console demos code contain the following: + +```c# + await auth.AuthorizeAsync(); + + // This is how you access credentials after authorization. + // The oauthToken and oauthTokenSecret do not expire. + // You can use the userID to associate the credentials with the user. + // You can save credentials any way you want - database, isolated storage, etc. - it's up to you. + // You can retrieve and load all 4 credentials on subsequent queries to avoid the need to re-authorize. + // When you've loaded all 4 credentials, LINQ to Twitter will let you make queries without re-authorizing. + // + //var credentials = auth.CredentialStore; + //string oauthToken = credentials.OAuthToken; + //string oauthTokenSecret = credentials.OAuthTokenSecret; + //string screenName = credentials.ScreenName; + //ulong userID = credentials.UserID; + // +``` + +### 9. I'm writing an ASP.NET application and my credentials keep going away. + +IIS recycles occasionally, which also means that any in-memory state is lost. This includes Session state if you're using _InProc_, which is the default. To fix this, reconfigure your application to use State Server or SQL Server. You can do a Bing search on how to configure ASP.NET Session State. + +### 10. Can you write a sample for X? + +You can download the source code and browse the documentation on this site to find samples on how to use each API. There are an untold number of scenarios that aren't covered, but I don't have the personal time to cover them all or keep up with requests. When you ask, I probably won't have the time to work up a sample and handle follow-up questions. By that time, you probably will have either figured out the problem or moved on to something else. While I would like to help, some things aren't practical, so I'll just have to wish you good luck. + +### 11. I'm new to programming. Can you help me? + +I've written LINQ to Twitter to help developers when writing applications that work with the Twitter API. Hopefully, the software makes their jobs easier. However, attempting to make a task easy doesn't imply it's appropriate for people with no experience. You must know: (1) how to code in C#, F#, or VB, (2) how LINQ works, (3) how to write async code, and (4) have some familiarity with the technology you're using (e.g. ASP.NET, WPF, Mobile, etc.). Without these things, you'll struggle. Of course, struggling is how we learn and make steps along the way to continually improve. This is what I do every day, continuously improving my own skills. While I would like to help, I don't have the time. However, I do know you will be able to figure it out if you stay with the journey. + +### 12. How do I log into the Twitter API with Username and Password? + +The Twitter API deprecated Username/Password authentication years ago. These days, you must use OAuth. You can visit [[Securing Your Applications]] for information on using OAuth with LINQ to Twitter. Additionally, there are several examples in the downloadable source code on how to use different types of authorizers with LINQ to Twitter. This is one of the more difficult tasks you will have when working with the Twitter API, or any other REST API that uses OAuth; so reading the documentation, evaluating alternatives, and reviewing the samples is all time well spent. It also helps if you get a sample application working first to get the hard part out of the way. + +With all that said, Twitter API does have a feature named _XAuth_ that is based on _Username/Password_. However, it requires their permission to use. You will receive errors if you use `XAuthAuthorizor` and your account does not have Twitter API permission. You can visit https://developer.twitter.com and review their documentation on `XAuth` and investigate how to contact them if you want to ask for permission. + +Note: Along the way, you're likely to encounter HTTP 401 Unauthorized errors and can get help for that in FAQ #1 above. + +### 13. How do I do X, Y, or Z? + +LINQ to Twitter has documentation available. You can find it by clicking the Wiki tab at the top of the page. There are also demos in the source code. It's usually helpful to get the demos running, including OAuth, to make sure you have your account, authorization, and credentials set up properly. + + diff --git a/Programming-the-Twitter-API.md b/Programming-the-Twitter-API.md new file mode 100644 index 00000000..82db919d --- /dev/null +++ b/Programming-the-Twitter-API.md @@ -0,0 +1,13 @@ +This section explains what Twitter is, how the Twitter API works, and projects the idea of Twitter as a platform. + +### What is Twitter? +Twitter is a micro-blogging service that allows people to post messages. The maximum length of each message is 140 characters. Twitter enables social networking by allowing people to follow and communicate with each other. Over time, this has proven to be a powerful communications medium because of its real-time nature. Whenever news breaks around the world, people are tweeting that news as it happens. For more information about Twitter, visit [Twitter.com](http://twitter.com/). + +### How Does the Twitter API Work? +The Twitter API is built using [Representational state transfer](http://en.wikipedia.org/wiki/REST) (REST). Wikipedia defines REST as "a style of software architecture for distributed hypermedia systems", but to simplify it, REST is a Web service protocol built upon Hypertext Transfer Protocol (HTTP). You use the REST Web service by making an HTTP call with a URL and getting text back in JSON format. + +This process used to be as simple as typing a URL into a browser, but that has changed. You must now use the OAuth protocol to let the user authorize your application to act on their behalf. In [[Securing Your Applications]], you can read an overview of how OAuth works with Twitter. + +### What Does the Twitter API Do for Me? + +Because of all the statuses being entered 24x7 all year long throughout the world, Twitter is an incredible source of information. There are many useful applications you can write to keep people informed about your industry and to see what people are saying. There are literally thousands of applications built upon the Twitter API today. If it's any indication, as of this writing, LINQ to Twitter has over 250,000 downloads and you can imagine that even a small fraction of that is a lot of apps. The API includes dozens of URLs with many options. This API is continuously growing, as is the 3rd party ecosystem. Twitter is more than an API that returns the last 20 tweets - it is a platform to create useful applications or integrate functionality with existing applications. I invite you to inspect the [Twitter API](http://dev.twitter.com/) and peruse the changelog to get a feel for its continuous growth and improvement. diff --git a/Securing-Your-Applications.md b/Securing-Your-Applications.md new file mode 100644 index 00000000..1ba967c3 --- /dev/null +++ b/Securing-Your-Applications.md @@ -0,0 +1,11 @@ +## Securing Your Applications + +As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. + +### [[Understanding the Importance of Security]] + +Often overlooked, security is important and this section explains why. + +### [[Learning to use OAuth]] + +OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file diff --git a/index.md b/index.md index 08d3e7b1..12d23923 100644 --- a/index.md +++ b/index.md @@ -2,11 +2,11 @@ Welcome to LINQ to Twitter documentation. Here, you'll find the technical inform Note: The current version of LINQ to Twitter is v6.0, which tracks .NET 5+ and the Twitter API v2. It also offers Twitter API v1.1 support. Please see [[LINQ to Twitter v5.x]] for Twitter API v1.1 technical endpoint documentation. -## [[LINQ to Twitter FAQ]] +## [LINQ to Twitter FAQ](LINQ-to-Twitter-FAQ.md) Frequently asked questions. -## [[Programming the Twitter API]] +## [Programming the Twitter API](Programming-the-Twitter-API.md) Some introductory information on programming Twitter. @@ -14,10 +14,10 @@ Some introductory information on programming Twitter. This is the main API section, where the technical descriptions of objects, methods, and other features of LINQ to Twitter are covered. -## [[Securing Your Applications]] +## [Securing Your Applications](Securing-Your-Applications.md) As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. You'll learn about the various OAuth implementations you can use here. -## [[Error Handling]] +## [Error Handling](Error-Handling.md) You'll might encounter errors when working with the Twitter API. This section attempts to help you debug and figure out what the problem could be. From edb5e99dc514a0b75d98e70b8d22d9622ce70b18 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 26 Nov 2020 23:31:13 +0000 Subject: [PATCH 08/95] Update Securing-Your-Applications.md --- Security/Learning-to-use-OAuth.md | 47 +++++++++++++++++++ .../Securing-Your-Applications.md | 4 +- ...nderstanding-the-Importance-of-Security.md | 11 +++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Security/Learning-to-use-OAuth.md rename Securing-Your-Applications.md => Security/Securing-Your-Applications.md (83%) create mode 100644 Security/Understanding-the-Importance-of-Security.md diff --git a/Security/Learning-to-use-OAuth.md b/Security/Learning-to-use-OAuth.md new file mode 100644 index 00000000..0bc63b62 --- /dev/null +++ b/Security/Learning-to-use-OAuth.md @@ -0,0 +1,47 @@ +### Learning to use OAuth + +The links on this page lead to instructions on how to use OAuth with LINQ to Twitter. Introduction to OAuth and Configuring OAuth help you get started. Other pages are technology specific examples of how you can use OAuth with LINQ to Twitter. + +#### [[Introduction to OAuth]] + +What is OAuth and how does it help you? + +#### [[Configuring OAuth]] + +Configuring OAuth with LINQ to Twitter. + +#### [[Implementing OAuth for Desktop Applications]] + +You'll learn how to use OAuth with Console, WinForms, and WPF apps. + +#### [[Implementing PIN Authorization for Console Applications]] + +Shows you how to use PIN Authorization. + +#### [[Implementing OAuth for ASP.NET Web Forms]] + +This will show how to use OAuth with classic Web Forms. + +#### [[Implementing OAuth for ASP.NET MVC]] + +This section explains how OAuth works with ASP.NET MVC. + +#### [[Implementing OAuth for Silverlight]] + +This section shows how to use OAuth with Silverlight. + +#### [[Implementing OAuth for Windows 8]] + +This section shows how to use OAuth with Windows 8. + +#### [[Implementing XAuth]] + +This section demonstrates how to use XAuth. + +#### [[Single User Authorization]] + +This section discusses how to implement single user authorization. + +#### [[Application-Only Authorization]] + +Explains how to perform application only authorization. \ No newline at end of file diff --git a/Securing-Your-Applications.md b/Security/Securing-Your-Applications.md similarity index 83% rename from Securing-Your-Applications.md rename to Security/Securing-Your-Applications.md index 1ba967c3..b3fa8e02 100644 --- a/Securing-Your-Applications.md +++ b/Security/Securing-Your-Applications.md @@ -2,10 +2,10 @@ As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. -### [[Understanding the Importance of Security]] +### [Understanding the Importance of Security](Understanding-the-Importance-of-Security.md) Often overlooked, security is important and this section explains why. -### [[Learning to use OAuth]] +### [Learning to use OAuth](security/Learning-to-Use-OAuth.md) OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file diff --git a/Security/Understanding-the-Importance-of-Security.md b/Security/Understanding-the-Importance-of-Security.md new file mode 100644 index 00000000..71c03bbc --- /dev/null +++ b/Security/Understanding-the-Importance-of-Security.md @@ -0,0 +1,11 @@ +### Understanding the Importance of Security + +An important part of writing applications for the Twitter platform is security. In this section, we'll look at some of the potential problems you might encounter and discuss proper approaches to solving those problems. The discussion is positive and proactive, hoping that you'll secure your applications properly before you encounter any of the problems discussed here. The following paragraphs will discuss communications encryption, credential managment, and OAuth, with a focus on why these security subjects are important. Let's discuss a few problems first. + +It's obvious that Twitter runs on the Web, but this very fact highlights vulnerabilities that a typical desktop application wouldn't encounter. Every query you execute, via LINQ to Twitter, sends an HTTP request across the Internet, which streams data back to your application. Unprotected, this data is free for anyone to access. In most cases, the act of reading a tweet is not a problem because all the information will be public anyway. However, what about the information that you share via direct message with someone where your intention is for no one but you and the recipient to see? Even if you don't care if someone sees the contents of a tweet, you should care a lot about anyone reading credentials or security tokens being passed to Twitter. These are the secrets of you and the people who use your software and you don't want anyone to see this information. A hacker could use those secrets to log into your Twitter account, acting as you. What could be even worse is if many people used your application and hackers stole their secrets too. Consider how many people use the exact same password everywhere: Twitter, other social networking sites, at work, and on-line banking. An insecure application leaves all of these people vulnerable. + +One way to protect tweets is via Secure Sockets Layer (SSL), a protocol for encrypting HTTP traffic. SSL is a standard transport protocol that is used throughout the world for e-commerce and is very reliable. Encryption protects the data, including your secrets, to prevent anyone from being able to read communications to and from Twitter. Since LINQ to Twitter uses standard .NET Framework class libraries for Web communication, it's easy to use SSL. All you have to do is change the prefix of your Web addresses from http to https. While LINQ to Twitter defaults to secure URL's, it's possible to specify a custom BaseUrl or SearchUrl via TwitterContext properties. This opportunity might come up if you wanted to specify a version of the Twitter API to use or wanted to point LINQ to Twitter at another on-line service that offers a Twitter-compatible API, such as WordPress or Tumblr. Remember to encrypt your requests with SSL via https URL prefixes to prevent people from stealing your secrets. + +As of this writing, Twitter only offers OAuth: a way to give applications access to Twitter on your behalf without sharing your Twitter password. Basic authentication, via username/password, has been deprecated for years and is not an option. You'll still have Twitter passwords, but won't be able to use them with the Twitter API. With OAuth, you can visit another site that provides services (i.e. games, photo sharing, and more) and allow that site to work with Twitter on your behalf without giving that site your Twitter credentials. Your credentials are the secret that you don't want to protect and OAuth allows you to do this. You'll learn more about OAuth and how LINQ to Twitter provides built-in OAuth support in subsequent sections of this documentation. OAuth is the way forward for authentication with the Twitter API. + +Now you know some of the dangers of unprotected social networking. You've learned that you can use https URL prefixes to protect your tweets with SSL encryption. You'll also learned that basic authentication is being deprecated and replaced by OAuth. You can read more about how to use OAuth with LINQ to Twitter in subsequent sections of this documentation. \ No newline at end of file From e60d6f7387c7198ba90a065c4516149104ed1546 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 00:48:20 +0000 Subject: [PATCH 09/95] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 12d23923..4a3d1679 100644 --- a/index.md +++ b/index.md @@ -14,7 +14,7 @@ Some introductory information on programming Twitter. This is the main API section, where the technical descriptions of objects, methods, and other features of LINQ to Twitter are covered. -## [Securing Your Applications](Securing-Your-Applications.md) +## [Securing Your Applications](/Security/Securing-Your-Applications.md) As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. You'll learn about the various OAuth implementations you can use here. ## [Error Handling](Error-Handling.md) From a8eb41a35121f7448a49423354f6ad75506bc215 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 00:50:20 +0000 Subject: [PATCH 10/95] Update Securing-Your-Applications.md --- Security/Securing-Your-Applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Security/Securing-Your-Applications.md b/Security/Securing-Your-Applications.md index b3fa8e02..ec1c4573 100644 --- a/Security/Securing-Your-Applications.md +++ b/Security/Securing-Your-Applications.md @@ -6,6 +6,6 @@ As a Web API, security is very important with LINQ to Twitter and this section e Often overlooked, security is important and this section explains why. -### [Learning to use OAuth](security/Learning-to-Use-OAuth.md) +### [Learning to use OAuth](Learning-to-Use-OAuth.md) OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file From 8540b818fb542cf2ef2f14970853e87b6d4e25b3 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 00:51:18 +0000 Subject: [PATCH 11/95] Update Securing-Your-Applications.md --- Security/Securing-Your-Applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Security/Securing-Your-Applications.md b/Security/Securing-Your-Applications.md index ec1c4573..d1ae8796 100644 --- a/Security/Securing-Your-Applications.md +++ b/Security/Securing-Your-Applications.md @@ -6,6 +6,6 @@ As a Web API, security is very important with LINQ to Twitter and this section e Often overlooked, security is important and this section explains why. -### [Learning to use OAuth](Learning-to-Use-OAuth.md) +### [Learning to use OAuth](Learning-to-use-OAuth.md) OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file From d8b34b755adc5f90ee37bdb3af2148336fba05e4 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 01:02:48 +0000 Subject: [PATCH 12/95] Update Learning-to-use-OAuth.md --- ...ations.md => Securing-Your-Applications.md | 4 +- Security/Learning-to-use-OAuth.md | 24 +- .../OAuth/Application-Only-Authorization.md | 5 + Security/OAuth/Configuring-OAuth.md | 22 ++ .../Implementing-OAuth-for-ASP.NET-MVC.md | 142 +++++++++++ ...mplementing-OAuth-for-ASP.NET-Web-Forms.md | 120 +++++++++ ...ementing-OAuth-for-Desktop-Applications.md | 33 +++ .../Implementing-OAuth-for-Silverlight.md | 227 ++++++++++++++++++ .../OAuth/Implementing-OAuth-for-Windows-8.md | 3 + ...-Authorization-for-Console-Applications.md | 56 +++++ Security/OAuth/Implementing-XAuth.md | 62 +++++ Security/OAuth/Introduction-to-OAuth.md | 57 +++++ Security/OAuth/Single-User-Authorization.md | 55 +++++ index.md | 2 +- 14 files changed, 797 insertions(+), 15 deletions(-) rename Security/Securing-Your-Applications.md => Securing-Your-Applications.md (82%) create mode 100644 Security/OAuth/Application-Only-Authorization.md create mode 100644 Security/OAuth/Configuring-OAuth.md create mode 100644 Security/OAuth/Implementing-OAuth-for-ASP.NET-MVC.md create mode 100644 Security/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md create mode 100644 Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md create mode 100644 Security/OAuth/Implementing-OAuth-for-Silverlight.md create mode 100644 Security/OAuth/Implementing-OAuth-for-Windows-8.md create mode 100644 Security/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md create mode 100644 Security/OAuth/Implementing-XAuth.md create mode 100644 Security/OAuth/Introduction-to-OAuth.md create mode 100644 Security/OAuth/Single-User-Authorization.md diff --git a/Security/Securing-Your-Applications.md b/Securing-Your-Applications.md similarity index 82% rename from Security/Securing-Your-Applications.md rename to Securing-Your-Applications.md index d1ae8796..96f08957 100644 --- a/Security/Securing-Your-Applications.md +++ b/Securing-Your-Applications.md @@ -2,10 +2,10 @@ As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. -### [Understanding the Importance of Security](Understanding-the-Importance-of-Security.md) +### [Understanding the Importance of Security](/Security/Understanding-the-Importance-of-Security.md) Often overlooked, security is important and this section explains why. -### [Learning to use OAuth](Learning-to-use-OAuth.md) +### [Learning to use OAuth](/Security/Learning-to-use-OAuth.md) OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file diff --git a/Security/Learning-to-use-OAuth.md b/Security/Learning-to-use-OAuth.md index 0bc63b62..733f1cdf 100644 --- a/Security/Learning-to-use-OAuth.md +++ b/Security/Learning-to-use-OAuth.md @@ -2,46 +2,46 @@ The links on this page lead to instructions on how to use OAuth with LINQ to Twitter. Introduction to OAuth and Configuring OAuth help you get started. Other pages are technology specific examples of how you can use OAuth with LINQ to Twitter. -#### [[Introduction to OAuth]] +#### [Introduction to OAuth](/OAuth/Introduction-to-OAuth) What is OAuth and how does it help you? -#### [[Configuring OAuth]] +#### [Configuring OAuth](/OAuth/Configuring-OAuth) Configuring OAuth with LINQ to Twitter. -#### [[Implementing OAuth for Desktop Applications]] +#### [Implementing OAuth for Desktop Applications](/OAuth/Implementing-OAuth-for-Desktop-Applications) You'll learn how to use OAuth with Console, WinForms, and WPF apps. -#### [[Implementing PIN Authorization for Console Applications]] +#### [Implementing PIN Authorization for Console Applications](/OAuth/Implementing-PIN-Authorization-for-Console-Applications) Shows you how to use PIN Authorization. -#### [[Implementing OAuth for ASP.NET Web Forms]] +#### [Implementing OAuth for ASP.NET Web Forms](/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms) This will show how to use OAuth with classic Web Forms. -#### [[Implementing OAuth for ASP.NET MVC]] +#### [Implementing OAuth for ASP.NET MVC](/OAuth/Implementing-OAuth-for-ASP.NET) This section explains how OAuth works with ASP.NET MVC. -#### [[Implementing OAuth for Silverlight]] +#### [Implementing OAuth for Silverlight](/OAuth/Implementing-OAuth-for-Silverlight) This section shows how to use OAuth with Silverlight. -#### [[Implementing OAuth for Windows 8]] +#### [Implementing OAuth for Windows 8](/OAuth/Implementing-OAuth-for-Windows) This section shows how to use OAuth with Windows 8. -#### [[Implementing XAuth]] +#### [Implementing XAuth](/OAuth/Implementing-XAuth) -This section demonstrates how to use XAuth. +This-section-demonstrates-how-to-use-XAuth. -#### [[Single User Authorization]] +#### [Single User Authorization](/OAuth/Single-User-Authorization) This section discusses how to implement single user authorization. -#### [[Application-Only Authorization]] +#### [Application-Only Authorization](/OAuth/Application-Only-Authorization) Explains how to perform application only authorization. \ No newline at end of file diff --git a/Security/OAuth/Application-Only-Authorization.md b/Security/OAuth/Application-Only-Authorization.md new file mode 100644 index 00000000..ee5139b7 --- /dev/null +++ b/Security/OAuth/Application-Only-Authorization.md @@ -0,0 +1,5 @@ +#### Application-Only Authorization + +Twitter created application-only authorization to provide a type of OAuth that doesn't rely on a user logging in. A typical example of this is performing Search queries. However, if you would need to perform a query that's specific to a user, like querying Account details, application-only (as it's name implies) would not work. I answered a question about this on Stack Overflow, with a code example: + +[Application-Only Authorization](http://stackoverflow.com/questions/16387037/twitter-api-application-only-authentication-with-linq2twitter/16390303#16390303) \ No newline at end of file diff --git a/Security/OAuth/Configuring-OAuth.md b/Security/OAuth/Configuring-OAuth.md new file mode 100644 index 00000000..eab61210 --- /dev/null +++ b/Security/OAuth/Configuring-OAuth.md @@ -0,0 +1,22 @@ +#### Configuring OAuth + +The starting point of using OAuth is to visit Twitter and register an application. From there, you'll receive keys that will allow you to use OAuth with Twitter. How you manage those keys will be up to you and can differ by application type, but this section will show you a simple example that will give you at least one idea to get started with. + +##### Registering an Application + +Twitter controls who can use it's service, which enables them to minimize the bad applications that can do harm to their service. The controls in place are that you must register your application. Here are a few tips for helping you get started with Application Registration: + +1. Your application can be anything such as Joe's Test App, C# Station, or anything you want to name it. Getting started, Twitter doesn't have any (initial) restrictions on the apps you create. +2. Visit [The Twitter Developer Site](http://dev.twitter.com) to register. You should already have a Twitter account so you can log in. At this point, make sure it's a Twitter account you will either run the application on or test with; The reason being that many API calls default to the context of the logged in user. If the account you use is your own personal account, you might easily end up spamming your followers with test content as you build your application. Whichever way you decide has no impact on whether you can register an app, but this is an interesting situation to be aware of. +3. After you log in, visit Your Apps and click on Register a New App. +4. Most of the fields are self explanatory, but a couple are worth discussion because they can cause you many hours of discomfort trying to discover why your application isn't working: +5. Callback URL can be any URL you want. LINQ to Twitter defaults to using the runtime Web page URL explicitly as the callback. You should always set this, especially if you're building a Web app. +6. If you want to be able to use all APIs, set Default access type to "Read, Write, and Direct Messages". A Direct Message (DM) is a private message between users, which is supported by LINQ to Twitter. If this is not turned on, Twitter will return security errors if you use the DM APIs. If you missed setting this field, Twitter defaults to read only, which means that you can only do queries. If you want to Tweet, you need to at least set "Read & Write". Past problems associated with this materialize in the form of someone who can do queries, such as Public, Friends, and Search, but they can't do an Update. The solution is to set this value to a value that provides more access. +7. After you fill in the fields, click Register Application, and you'll have immediate access to the Twitter API. + +##### Managing Keys +After registering your application, you can obtain your OAuth keys. There are two keys you need for all OAuth scenarios, ConsumerKey and ConsumerSecret. You'll find the keys by visiting the Twitter Developer site, selecting My apps, and clicking the title of your application. You will put these keys in the appSettings section of app.config, web.config, or elsewhere depending on what type of application you're building. You could even create your own custom key store, but the goal is to make them available to your application. LINQ to Twitter will use these keys to authenticate via OAuth with Twitter. + +If you're using SingleUserAuthorizer, visit your application page on Twitter to obtain your AccessToken and AccessTokenSecret keys. There's a button to generate these keys. Then add the AccessToken and AccessTokenSecret keys to your configuration, in addition to ConsumerKey and ConsumerSecret keys. +##### Summary +Now you have a registered application and keys to help you authenticate with Twitter via OAuth using LINQ to Twitter. Subsequent sections show you how to use LINQ to Twitter to perform this authentication. The examples and discussion will assume that you've already registered your application, obtained your keys, and added your keys to a config file. diff --git a/Security/OAuth/Implementing-OAuth-for-ASP.NET-MVC.md b/Security/OAuth/Implementing-OAuth-for-ASP.NET-MVC.md new file mode 100644 index 00000000..f4d4e462 --- /dev/null +++ b/Security/OAuth/Implementing-OAuth-for-ASP.NET-MVC.md @@ -0,0 +1,142 @@ +#### Implementing OAuth for MVC Applications + +MVC authorization includes the entire OAuth authorization flow. This page will explain how you can implement OAuth in ASP.NET Model-View-Controller (MVC) using LINQ to Twitter's `MvcAuthorizer`. Before jumping into code, you'll see a high-level view of how the whole process works. + +##### High-Level Description of MVC Authorization + +You'll see the details of how MVC authorization is implemented with LINQ to Twitter soon, but it might be useful to review how the whole process works. It might help you know where you're at in the process when looking at later details. Here's what happens during MVC authorization. + +1. Some action in your code (login or a specific need to use a Twitter feature that requires authorization) initiates the authorization process. + +2. Your code tells LINQ to Twitter to begin the authorization process. + +3. LINQ to Twitter redirects the user to the Twitter authorization page. + +4. The user authorizes your application. + +5. Twitter redirects to a callback page in your application. + +6. Your code tells LINQ to Twitter to complete the authorization process. + +7. When authorization is complete, OAuth and Access tokens are available for you to store for this user. + +Of all the previous steps, #1 and #7 are less defined. That's because those are the points that depend on how you design your application. After authorization, LINQ to Twitter can be used for any supported queries or side-effects. + +Now that you have an idea of how the process works, let's look at an example of how you can code this with LINQ to Twitter. + +##### Implementing MVC Authorization + +This example is for a design that redirects the user to a unique controller, dedicated to the OAuth process, `OAuthController`. To get started, you'll need to instantiate an `MvcAuthorizer `with `CredentialStore`. `CredentialStore `must be populated with `ConsumerKey `and `ConsumerSecret`, which identify your application to Twitter. Here's how you can instantiate `MvcAuthorizer`: + +```c# + public class OAuthController : AsyncController + { + public ActionResult Index() + { + return View(); + } + + public async Task BeginAsync() + { + //var auth = new MvcSignInAuthorizer + var auth = new MvcAuthorizer + { + CredentialStore = new SessionStateCredentialStore + { + ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], + ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"] + } + }; +``` +The example above instantiates a `SessionStateCredentialStore`, which is an implementation of `ICredentialStore`. The actual credentials are being read from `web.config`, which is fine because they generally don't change for your application. + +Tip: Since `SessionStateCredentialStore` stores credentials in Session state, you'll want to ensure you've set the mode to State Server or SQL Server, but not InProc to avoid intermittent loss of credentials. + +After you have an `MvcAuthorizer `instance, begin the OAuth process by calling `BeginAuthorizationAsync`, like this: +```c# + + string twitterCallbackUrl = Request.Url.ToString().Replace("Begin", "Complete"); + return await auth.BeginAuthorizationAsync(new Uri(twitterCallbackUrl)); + } +``` +This code is under the `MvcAuthorizer` instantiation, inside of `BeginAsync`. Notice that I've taken the current URL, which points to the current controller and action method, and switched the text "Begin" for "Complete" for the `twitterCallbackUrl`. This lets LINQ to Twitter tell the Twitter API where to redirect the user after they have authorized your application. You call `BeginAuthorizationAsync` with this callback value and LINQ to Twitter will redirect the user to Twitter's authorization page, including the callback. + +`BeginAuthorizationAsync` has a second parameter, of type `Dictionary`, that allows you to send custom query string parameters. Twitter returns those values after a user authorizes your app and you can read them, via `Request.QueryString` in the `CompleteAsync` method. Here's a revised example: + +```cs + var parameters = new Dictionary { { "my_custom_param", "val" } }; + string twitterCallbackUrl = Request.GetDisplayUrl().Replace("Begin", "Complete"); + return await auth.BeginAuthorizationAsync(new Uri(twitterCallbackUrl), parameters); +``` + +Setting the callback, as done in the previous section, causes Twitter to redirect the user to the `CompleteAsync` action, instead of what the original URL was for the `BeginAsync` action. Once the redirect occurs, the code in `CompleteAsync` executes and lets you finish the OAuth process, like this: +```c# + public async Task CompleteAsync() + { + var auth = new MvcAuthorizer + { + CredentialStore = new SessionStateCredentialStore() + }; + + await auth.CompleteAuthorizeAsync(Request.Url); + + // This is how you access credentials after authorization. + // The oauthToken and oauthTokenSecret do not expire. + // You can use the userID to associate the credentials with the user. + // You can save credentials any way you want - database, + // isolated storage, etc. - it's up to you. + // You can retrieve and load all 4 credentials on subsequent + // queries to avoid the need to re-authorize. + // When you've loaded all 4 credentials, LINQ to Twitter will let + // you make queries without re-authorizing. + // + //var credentials = auth.CredentialStore; + //string oauthToken = credentials.OAuthToken; + //string oauthTokenSecret = credentials.OAuthTokenSecret; + //string screenName = credentials.ScreenName; + //ulong userID = credentials.UserID; + // + + return RedirectToAction("Index", "Home"); + } +``` +Here, you instantiate a new `MvcAuthorizer`, with a new instance of `SessionStateCredentialStore`. Since credentials are held in Session state, `SessionStateCredentialStore` automatically reads them. If all 4 credentials are available, LINQ to Twitter lets you perform queries without making the user go through the entire OAuth process again. + +However, at this point in time, you have `ConsumerKey`, `ConsumerSecret`, and OAuthToken, but you still don't have `AccessToken`. Call `CompleteAuthorizationAsync` to get the `AccessToken` and you'll have all 4 tokens available. + +As noted in the comments, after `CompleteAuthorizeAsync` is a good time to collect the data from Twitter and store it for this user. Then on subsequent queries for this user, you can load all 4 credentials to avoid making the user go through the entire OAuth process. + +This code redirects to another controller/action and you can write any code you want to redirect to the destination of your choice. After you're authorized, you can use LINQ to Twitter like normal. Here's an example that queries the user's Home timeline: + +```c# + public async Task HomeTimelineAsync() + { + var auth = new MvcAuthorizer + { + CredentialStore = new SessionStateCredentialStore() + }; + + var ctx = new TwitterContext(auth); + + var tweets = + await + (from tweet in ctx.Status + where tweet.Type == StatusType.Home + select new TweetViewModel + { + ImageUrl = tweet.User.ProfileImageUrl, + ScreenName = tweet.User.ScreenNameResponse, + Text = tweet.Text + }) + .ToListAsync(); + + return View(tweets); + } +``` +Here you can see the instantiation of `MvcAuthorizer` with a new instance of `SessionStateCredentials`. If you've already authorized, `SessionStateCredentials` will pick up credentials from Session state. If the user has just logged onto your application, check to see if you have stored credentials for them (previously, in your database) or send them to the OAuth page for the first time. If you already have their credentials, then load them into the `ConsumerKey`, `ConsumerSecret`, `AccessToken`, and `AccessTokenSecret` properties of `SessionStateCredentials`. + +Then instantiate a `TwitterContext` with the `MvcAuthorizer` instance and use LINQ to Twitter like normal. + +#### Summary + +The high-level view explained how the MVC authorization process works. The next section on implementation showed one way to write code for Web authorization. It used a separate controller to simplify the OAuth process, redirecting back to another page to perform queries. Remember to store credentials in your database after `CompleteAuthorizationAsync` so you can load those credentials on subsequent sessions to create a better user experience. \ No newline at end of file diff --git a/Security/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md b/Security/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md new file mode 100644 index 00000000..cd4e6677 --- /dev/null +++ b/Security/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md @@ -0,0 +1,120 @@ +#### Implementing OAuth for WebForms Applications + +Web authorization includes the entire OAuth authorization flow. This page will explain how you can implement OAuth in ASP.NET Web Forms (WebForms) using LINQ to Twitter's WebAuthorizer. Before jumping into code, you'll see a high-level view of how the whole process works. + +##### High-Level Description of Web Authorization + +You'll see the details of how Web authorization is implemented with LINQ to Twitter soon, but it might be useful to review how the whole process works. It might help you know where you're at in the process when looking at later details. Here's what happens during Web authorization. + +1. Some action in your code (login or a specific need to use a Twitter feature that requires authorization) initiates the authorization process. + +2. Your code tells LINQ to Twitter to begin the authorization process. + +3. LINQ to Twitter redirects the user to the Twitter authorization page. + +4. The user authorizes your application. + +5. Twitter redirects to a callback page in your application. + +6. Your code tells LINQ to Twitter to complete the authorization process. + +7. When authorization is complete, OAuth and Access tokens are available for you to store for this user. + +Of all the previous steps, #1 and #7 are less defined. That's because those are the points that depend on how you design your application. After authorization, LINQ to Twitter can be used for any supported queries or commands. + +Now that you have an idea of how the process works, let's look at an example of how you can code this with LINQ to Twitter. + +##### Implementing Web Authorization + +To get started, you'll need to instantiate an AspNetAuthorizer. This authorizer helps manage the OAuth workflow with Twitter. Here's an example: + +```c# + public partial class OAuth : System.Web.UI.Page + { + AspNetAuthorizer auth; + + protected async void Page_Load(object sender, EventArgs e) + { + auth = new AspNetAuthorizer + { + CredentialStore = new SessionStateCredentialStore + { + ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], + ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"] + }, + GoToTwitterAuthorization = + twitterUrl => Response.Redirect(twitterUrl, false) + }; +``` +GoToTwitterAuthorization is an Action, and the example assigns a lambda that specifies how to send the user to the Twitter authorization page. The twitterUrl parameter is the HTTP address of the Twitter authorization page. Calling Response.Redirect causes the browser to send the user to Twitter's authorization page, so the user can authorize your application. LINQ to Twitter will execute the lambda assigned to GoToTwitterAuthorization during the authorization process. + +Everything you've seen is happening in the {"Page_Load"} event. You'll see more activity in {"Page_Load"}, but let's take a temporary diversion. First, look at what has happened so far: Both credentials and the AspNetAuthorizer have been set up. Looking at the big picture, the next thing that should occur is to start the authorization process, as shown in the following example: + +```c# + protected async void AuthorizeButton_Click(object sender, EventArgs e) + { + await auth.BeginAuthorizeAsync(Request.Url); + } +``` +The code above is an event handler for a button click. The code starts the authorization process by calling BeginAuthorizeAsync on the AspNetAuthorizer instance shown in the previous example. Additionally, you must pass the address of a callback page. This callback page is where Twitter redirects the user's browser after the user authorizes your application. This example uses the current page, which is Request.Url. + +Now, the OAuth process has been initiated, LINQ to Twitter redirects the user to the Twitter authorization page (via GoToTwitterAuthorization on the AspNetAuthorizer instance), and Twitter redirects the user back to the callback URL. As you just saw, the callback URL is the current page. This brings us back to the {"Page_Load"} event handler, which always executes and instantiates the AspNetAuthorizer for the rest of the page, as you've already seen. Still in {"Page_Load"} and after the AspNetAuthorizer instantiation, you must complete the authorization process, like this: + +```c# + if (!Page.IsPostBack && Request.QueryString["oauth_token"] != null) + { + await auth.CompleteAuthorizeAsync(Request.Url); + + // This is how you access credentials after authorization. + // The oauthToken and oauthTokenSecret do not expire. + // You can use the userID to associate the credentials with the user. + // You can save credentials any way you want - database, isolated + // storage, etc. - it's up to you. + // You can retrieve and load all 4 credentials on subsequent queries + // to avoid the need to re-authorize. + // When you've loaded all 4 credentials, LINQ to Twitter will let you + // make queries without re-authorizing. + // + //var credentials = auth.CredentialStore; + //string oauthToken = credentials.OAuthToken; + //string oauthTokenSecret = credentials.OAuthTokenSecret; + //string screenName = credentials.ScreenName; + //ulong userID = credentials.UserID; + // + + Response.Redirect("~/Default.aspx", false); + } +``` +To finish the OAuth process, call CompleteAuthorizeAsync on the AspNetAuthorizer instance, as shown above. After CompleteAuthorizeAsync returns, you can read OAuthToken and AccessToken and store them in the database for this user. On subsequent LINQ to Twitter queries on behalf of this same user, you can retrieve the OAuthToken and AccessToken from your database and populate CredentialStore with all four tokens. By loading all four tokens, LINQ to Twitter will not redirect the user for authorization and you can simply perform queries on behalf of that user. + +This example takes a design that runs the OAuth logic on a separate page, OAuth.aspx. Notice that this example performs a re-direct to another page after CompleteAuthorizeAsync. + +To perform queries, you need to instantiate a TwitterContext with the WebAuthorizer that has all four credential tokens. After redirection to another page, you can use LINQ to Twitter, like this: + +```c# + protected async void RefreshButton_Click(object sender, EventArgs e) + { + var auth = new AspNetAuthorizer + { + CredentialStore = new SessionStateCredentialStore(), + GoToTwitterAuthorization = twitterUrl => { } + }; + + var ctx = new TwitterContext(auth); + + var tweets = + await + (from tweet in ctx.Status + where tweet.Type == StatusType.Home + select tweet) + .ToListAsync(); + + TwitterListView.DataSource = tweets; + TwitterListView.DataBind(); + } +``` +This example is a button click handler. Notice that it instantiates a new AspNetAuthorizer. The code assigns a new SessionStateCredentialStore to the CredentialStore property. Since the OAuth process has ran and the AspNetAuthorizer stored credentials in Session state, the SessionStateCredentialStore will pick up those values automatically. Since all 4 credentials are available, GoToTwitterAuthorization won't execute, and doesn't need an implementation. You can then pass the authorizer to a new instance of TwitterContext and use LINQ to Twitter as you need. + +##### Summary + +The high-level view explained how the Web authorization process works. The next section on implementation showed one way to write code for Web authorization. The AspNetAuthorizer was instantiated with CredentialStore and GoToTwitterAuthorization. In particular, remember the extensibility points with ICredentialStore and GoToTwitterAuthorization so you can customize Web authorization for your particular application. Also, pay attention to how the BeginAuthorizeAsync and CompleteAuthorizeAsync occur in different places because of browser redirection in combination with the ASP.NET page lifecycle. \ No newline at end of file diff --git a/Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md b/Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md new file mode 100644 index 00000000..08dfc0c7 --- /dev/null +++ b/Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md @@ -0,0 +1,33 @@ +#### Implementing OAuth for Desktop Applications + +With desktop applications, such as Console, Windows Forms, or Windows Presentation Foundation (WPF), you don't have the full Web-based OAuth flow for authenticating an application. Specifically, after the user authorizes the application, there isn't a Web page to redirect back to for getting the final access token. To solve this problem, Twitter offers PIN authorization, which bridges the gap between user authorization and application notification that it can get the final access token. This page explains how PIN authorization works in LINQ to Twitter. Before jumping into code, here's a high-level description of the workflow for PIN authorization: + +#### High-Level Description of PIN Authorization + +You'll see the details of how PIN authorization is implemented with LINQ to Twitter soon, but it might be useful to review how the whole process works. It might help you know where you're at in the process when looking at later details. Here's what happens during PIN authorization. + +1. Some action in your code (login or a specific need to use a Twitter feature that requires authorization) initiates the authorization process. + +2. Your code tells LINQ to Twitter to initiate the authorization process. + +3. Your code waits for a PIN to be entered. + +4. LINQ to Twitter redirects the user to the Twitter authorization page. + +5. The user authorizes your application. + +6. Twitter redirects to a page with a PIN Number. + +7. The user manually gives that PIN number to your application, which is waiting for it to be entered. + +8. When authorization is complete, OAuth and Access tokens are available for you to store for this user. + +Of all the previous steps, #1 and #8 are less defined. That's because those are the points that depend on how you design your application. After authorization, LINQ to Twitter can be used for any queries or side-effects. + +Now that you have an idea of how the process works, let's look at an examples of how you can code this with LINQ to Twitter. + +##### [[Implementing PIN Authorization for Console Applications]] + +##### Summary + +The high-level view explained how the PIN authorization process works, which is different from Web authorization. The next section on implementation showed one way to write code for PIN authorization. The PinAuthorizer instantiation is where most of the setup occurs. In particular, remember the extensibility points with IOAuthCredentails, GoToTwitterAuthorization, and GetPin so you can customize PIN authorization for your particular application. The rest of the process simply involved calling Authorize and passing the authorizer to a new TwitterContext instance. \ No newline at end of file diff --git a/Security/OAuth/Implementing-OAuth-for-Silverlight.md b/Security/OAuth/Implementing-OAuth-for-Silverlight.md new file mode 100644 index 00000000..61e5dd2c --- /dev/null +++ b/Security/OAuth/Implementing-OAuth-for-Silverlight.md @@ -0,0 +1,227 @@ +#### Implementing OAuth for Silverlight Applications + +Silverlight authorization is typically more complex because of security issues and the type of Silverlight application being built. For example, you can't communicate directly with Twitter from a Silverlight page and will need a server proxy. Also, you have a choice of Web or Out-Of-Browser (OOB) application, each with a separate OAuth authorizer. This page will explain how you can implement OAuth in Silverlight, supporting different scenarios. Before jumping into code, you'll see a high-level view of how the whole process works. + +##### High-Level Description of Silverlight Authorization + +You'll see the details of how Silverlight authorization is implemented with LINQ to Twitter soon, but it might be useful to review how the whole process works. It might help you know where you're at in the process when looking at later details. The following example shows how to perform Silverlight authorization for Web applications and will be followed by an explanation of the differences to support OOB apps: + +1. Some action in your code (login or a specific need to use a Twitter feature that requires authorization) initiates the authorization process. + +2. Your code tells LINQ to Twitter to begin the authorization process. + +3. LINQ to Twitter redirects the user to the Twitter authorization page. + +4. The user authorizes your application. + +5. Twitter redirects to a callback page in your application. + +6. Your code tells LINQ to Twitter to complete the authorization process. + +7. When authorization is complete, OAuth and Access tokens are available for you to store for this user. + +Of all the previous steps, #1 and #7 are less defined. That's because those are the points that depend on how you design your application. After authorization, LINQ to Twitter can be used for any supported queries or side-effects. + +The differences between the Web application process above and OOB occurs at step #5. Instead of redirection, Twitter will redirect the user to a page with a PIN number. Your OOB application must be designed to allow the user to enter the PIN number before continuing - details which you'll see soon. + +Now that you have an idea of how the process works, let's look at an example of how you can code this with LINQ to Twitter. + +##### Required Configuration and Setup + +Silverlight applications don't have access to communicate directly with Twitter. The way to work around this in LINQ to Twitter is via a proxy. The proxy is an ASP.NET HTTP Handler. LINQ to Twitter forwards all of it's communication to Twitter through this proxy. To use the proxy, copy LinqToTwitterProxy.ashx and LinqToTwitterProxy.ashx.cs to the root folder of your Web application that hosts your Silverlight application. You can find the proxy files in the downloadable LINQ to Twitter source code, in the Silverlight web demo project. + +Important for OOB: If you're going to support OOB, you'll need to configure properties for the Silverlight project. Open Properties, Silverlight tab, and make sure Enable running application out of the browser is checked. Then click the Out of browser settings button and ensure the Require elevated trust when running out of the browser is checked. + +##### Implementing Silverlight Authorization + +The example for this page is a Silverlight navigation application. Further, the example shows how to support both Web and OOB applications at the same time. Therefore, you can use what you learn here to support OOB, Web, or both. Navigation applications have an OnNavigatedTo override that's called whenever the user navigages to a page. This example will use this method to initiate the Silverlight authorization process. Here's the OnNavigatedTo implementation: + +```c# + public partial class FriendsStatusQuery : Page + { + private TwitterContext m_twitterCtx = null; + private PinAuthorizer m_pinAuth = null; + + protected override void OnNavigatedTo(NavigationEventArgs e) + { + if (Application.Current.IsRunningOutOfBrowser && + Application.Current.HasElevatedPermissions) + { + DoPinAuth(); + } + else + { + DoWebAuth(); + } + } +``` +The code above demonstrates how to determine whether this application is running OOB or via Web. It's important the make the settings in the previous section if the application supports running OOB. We'll discuss the Web scenario first. + +When performing authorization for a Silverlight Web application, the code calls the DoWebAuth method, above. DoWebAuth contains all of the logic for the OAuth process, including Authorizer initialization, beginning the authorization process, and completing the authorization process. The first step is to instantiate an authorizer, which requires application credentials and instructions on how the application should show the Twitter authorization page to the user. The following code shows how to instantiate the authorizer. + +```c# + private void DoWebAuth() + { + WebBrowser.Visibility = Visibility.Collapsed; + PinPanel.Visibility = Visibility.Collapsed; + + var auth = new SilverlightAuthorizer + { + Credentials = new InMemoryCredentials + { + ConsumerKey = "", + ConsumerSecret = "" + }, + PerformRedirect = authUrl => + Dispatcher.BeginInvoke(() => HtmlPage.Window.Navigate(new Uri(authUrl))) + }; +``` +In the code above, ConsumerKey and ConsumerSecret are set to blank strings, but you would load your own application credentials here. When the authorization process starts, LINQ to Twitter will show the authorization page to the user by executing the Action lambda assigned to PerformRedirect. You see, LINQ to Twitter doesn't know exactly how you want to implement this part of your application, so you have the freedom to define it as you like. In the example above, the authUrl parameter is the HTTP address of the Twitter authorization page. The lambda behavior is to redirect the browser to that page. As is common with Silverlight applications, Dispatcher.BeginInvoke marshalls the operation onto the UI thread. + +Now you have a SilverlightAuthorizer instance and are ready to begin the authorization process. The next part of the code might seem a little backwards because it calls CompleteAuthorization before BeginAuthorization, but there's a reasonable explanation for this. The true order of operations is that BeginAuthorization runs first, the application redirects to the Twitter authorization page, the user authorizes the application, Twitter redirects back to this page (back to OnNavigatedTo, which calls DoWebAuth), and CompleteAuthorization executes. Here's the code: + +```c# + Uri url = HtmlPage.Document.DocumentUri; + + auth.CompleteAuthorize(url, resp => + Dispatcher.BeginInvoke(() => + { + // you can save these in the db and add logic + // to look for credentials from db before + // doing Oauth dance. + var oauthToken = auth.Credentials.OAuthToken; + var accessToken = auth.Credentials.AccessToken; + + switch (resp.Status) + { + case TwitterErrorStatus.Success: + FriendsPanel.Visibility = Visibility.Visible; + break; + case TwitterErrorStatus.TwitterApiError: + case TwitterErrorStatus.RequestProcessingException: + MessageBox.Show( + resp.Error.ToString(), + resp.Message, + MessageBoxButton.OK); + break; + } + })); + + if (!auth.IsAuthorized && !auth.IsAuthorizing) + { + auth.BeginAuthorize(url, resp => + Dispatcher.BeginInvoke(() => + { + switch (resp.Status) + { + case TwitterErrorStatus.Success: + break; + case TwitterErrorStatus.TwitterApiError: + case TwitterErrorStatus.RequestProcessingException: + MessageBox.Show( + resp.Error.ToString(), + resp.Message, + MessageBoxButton.OK); + break; + } + })); + } +``` +Inside of CompleteAuthorization, there's a check that ensures the logic executes only if BeginAuthorization has already been called. This logic also indicates that authorization is complete, which prevents BeginAuthorization from being called again. Otherwise, it just returns. BeginAuthorize only runs if the application isn't authorized. BeginAuthorization takes a callback parameter, which is passed to Twitter to indicate where the completion process is. Authorization for this sample begins and completes on the same page, as you can see at the top of the listing where url is set to the HTTP address of the current page. + +Notice the async callbacks on both BeginAuthorization and CompleteAuthorization. Each has a switch statement for processing the results of the operation, returned via the Status property of the TwitterAsyncResponse, resp. Besides error processing, the CompleteAuthorization callback shows how to get values for OAuthToken and AccessToken when authorization is successful. You can store these tokens in the database, associated with the user, and retrieve them on subsequent calls. If you load all four credentials into SilverlightAuthorizer at one time, LINQ to Twitter allows you to bypass the authorization process and perform queries immediately. Normally, you only have to go through the authorization process one time per user. + +Once the application is authorized, pass the authorizer to a new TwitterContext instance, like this: + +```c# + m_twitterCtx = new TwitterContext(auth); + } +``` +The m_twitterCtx is a private field, allowing access via other page methods for queries. As shown by the curly brace, this is the end of the DoWebAuth method. Next, you'll learn how to support authorization of OOB apps via the DoPinAuth method. + +When running OOB, you don't have the full authorization workflow because the application is running on the desktop. After the user authorizes your application with Twitter, there isn't a way for Twitter to redirect to your desktop. Therefore, you can use PIN authorization. The first step in PIN authorization is to instantiate an authorizer, which requires application credentials and instructions on how the application should show the Twitter authorization page to the user. The following code shows how to instantiate the authorizer. + +```c# + private void DoPinAuth() + { + m_pinAuth = new PinAuthorizer + { + Credentials = new InMemoryCredentials + { + ConsumerKey = "", + ConsumerSecret = "" + }, + UseCompression = true, + GoToTwitterAuthorization = pageLink => + Dispatcher.BeginInvoke(() => WebBrowser.Navigate(new Uri(pageLink))) + }; +``` +In the code above, ConsumerKey and ConsumerSecret are set to blank strings, but you would load your own application credentials here. When the authorization process starts, LINQ to Twitter will show the authorization page to the user by executing the Action lambda assigned to GoToTwitterAuthorization. You see, LINQ to Twitter doesn't know exactly how you want to implement this part of your application, so you have the freedom to define it as you like. In the example above, the authUrl parameter is the HTTP address of the Twitter authorization page. The lambda behavior is to redirect the browser to that page. As is common with Silverlight applications, Dispatcher.BeginInvoke marshalls the operation onto the UI thread. + +The next step is to begin the authorization process by calling BeginAuthorization, shown below: + +```c# + m_pinAuth.BeginAuthorize(resp => + Dispatcher.BeginInvoke(() => + { + switch (resp.Status) + { + case TwitterErrorStatus.Success: + break; + case TwitterErrorStatus.TwitterApiError: + case TwitterErrorStatus.RequestProcessingException: + MessageBox.Show( + resp.Error.ToString(), + resp.Message, + MessageBoxButton.OK); + break; + } + })); + + m_twitterCtx = new TwitterContext(m_pinAuth, "https://api.twitter.com/1/", "https://search.twitter.com/"); + } +``` +In PIN authorization, you don't pass a URL to BeginAuthorization because there isn't a callback. BeginAuthorization executes the lambda assigned to GoToTwitter, the user authorizes your application, and Twitter redirects the user to a page that contains a PIN. The code assigns the authorizer to a new instance of TwitterContext, but you can't use it until after authorization and that occurs in a separate method. + +Because you don't have a callback, the OOB application must wait on the user to return to the application and type in the PIN that Twitter provided. Also, you can't complete the authorization process until the PIN is available, to trying to handle begin and complete in the same method doesn't work for OOB PIN authorization applications. The way this example handles this situation is to show a TextBox for the PIN and a button that the user clicks after they enter the PIN into the TextBox. Here's the event handler for that button click that completes the authorization process: + +```c# + private void PinButton_Click(object sender, RoutedEventArgs e) + { + string pin = PinTextBox.Text; + + m_pinAuth.CompleteAuthorize( + PinTextBox.Text, + completeResp => Dispatcher.BeginInvoke(() => + { + // you can save these in the db and add logic + // to look for credentials from db before + // doing Oauth dance. + var oauthToken = auth.Credentials.OAuthToken; + var accessToken = auth.Credentials.AccessToken; + + switch (completeResp.Status) + { + case TwitterErrorStatus.Success: + FriendsPanel.Visibility = Visibility.Visible; + break; + case TwitterErrorStatus.TwitterApiError: + case TwitterErrorStatus.RequestProcessingException: + MessageBox.Show( + completeResp.Error.ToString(), + completeResp.Message, + MessageBoxButton.OK); + break; + } + })); + } +``` +The code above reads the PIN from the TextBox. CompleteAuthorize takes this PIN and requests an access token from Twitter. + +Both BeginAuthorize and CompleteAuthorize have a switch statement for processing the results of the operation, returned via the Status property of the TwitterAsyncResponse, resp. Besides error processing, the CompleteAuthorization callback shows how to get values for OAuthToken and AccessToken when authorization is successful. You can store these tokens in the database, associated with the user, and retrieve them on subsequent calls. If you load all four credentials into SilverlightAuthorizer at one time, LINQ to Twitter allows you to bypass the authorization process and perform queries immediately. Normally, you only have to go through the authorization process one time per user. + +You can now pass this authorizer to an instance of TwitterContext and perform queries. + +##### Summary + +The high-level view explained how the Silverlight authorization process works. The next section on implementation showed how to perform authorization for both OOB and Web Silverlight applications. The SilverlightAuthorizer was instantiated with Credentials and PerformRedirect and the PinAuthorizer was instantiated with Credentials and GoToTwitterAuthorization. In particular, remember the extensibility points with IOAuthCredentails and PerformRedirect/GoToTwitterAuthorization so you can customize Web authorization for your particular application. Pay attention to how the BeginAuthorization and CompleteAuthorization in Web authorization occur in different places because of browser redirection and using the same method from the call to OnNavigateTo. For OOB applications, notice that BeginAuthorization occurs in DoPinAuth, but CompleteAuthorization executes in an event handler, allowing authorization to complete only after the user has provided the PIN. \ No newline at end of file diff --git a/Security/OAuth/Implementing-OAuth-for-Windows-8.md b/Security/OAuth/Implementing-OAuth-for-Windows-8.md new file mode 100644 index 00000000..6c89d5b7 --- /dev/null +++ b/Security/OAuth/Implementing-OAuth-for-Windows-8.md @@ -0,0 +1,3 @@ +#### Implementing OAuth for Windows 8 + +This blog post, [WinRtAuthorizer–A Better Way to do OAuth with LINQ to Twitter in Windows](http://geekswithblogs.net/WinAZ/archive/2013/01/19/winrtauthorizerndasha-better-way-to-do-oauth-with-linq-to-twitter.aspx), demonstrates the recommended approach to authorization with Windows 8. \ No newline at end of file diff --git a/Security/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md b/Security/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md new file mode 100644 index 00000000..f14aebbd --- /dev/null +++ b/Security/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md @@ -0,0 +1,56 @@ +#### Implementing PIN Authorization for Console Applications + +To get started, you'll need to instantiate a PinAuthorizer, which is a LINQ to Twitter type that helps you perform PIN authorization with Twitter. PinAuthorizer requires a ConsumerToken and ConsumerSecret Key pair to start the process. Additionally, you tell PinAuthorizer how to redirect to the Twitter authorization page and how you'll accept the PIN after the user authorizes. The following code shows how to do this: + +```c# + var auth = new PinAuthorizer() + { + CredentialStore = new InMemoryCredentialStore + { + ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], + ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"] + }, + GoToTwitterAuthorization = pageLink => Process.Start(pageLink), + GetPin = () => + { + Console.WriteLine( + "\nAfter authorizing this application, Twitter " + + "will give you a 7-digit PIN Number.\n"); + Console.Write("Enter the PIN number here: "); + return Console.ReadLine(); + } + }; +``` +The code above uses object initialization syntax to set up CredentialStore, GoToTwitterAuthorization, and GetPin. This example uses InMemoryCredentialStore, which is a LINQ to Twitter type that implements ICredentialStore. The example uses configuration settings to load the ConsumerKey and ConsumerSecret, which identify your application to Twitter. + +LINQ to Twitter needs to know how you want to bring the user to the Twitter authorization Web page. The example above, setting GoToTwitterAuthorization with an Action lambda to implement Process.Start is one way. The pageLink parameter is the HTTP address of Twitter's authorization page, so the effect will be to launch the user's browser and navigate to the Twitter authorization page. + +After the user authorizes your application, your application must have a way to get the PIN from the user. The example above shows how to do this through the console. + +Essentially, LINQ to Twitter will execute the lambda assigned to GoToTwitterAuthorization and then execute the lambda assigned to GetPin. These are extensibility points that allow you to provide your own implementation. + +Setting up PinAuthorizer is the most work you'll do for OAuth authorization. The rest of the code required is to kick off the authorization process and then instantiate TwitterContext. + +Here's how to kick off authorization. + +```c# + await auth.AuthorizeAsync(); +``` +As mentioned earlier, LINQ to Twitter will execute the GoToTwitterAuthorization authorizer lambda so the user can authorize your application. Then it will execute the GetPin lambda to collect the PIN number. Everything else happens behind the scenes. + +After the call to AuthorizeAsync above, you can read the OAuthToken and AccessToken from auth.CredentialStore and save them in a database, associated with the current user. On subsequent queries to LINQ to Twitter, you can read those values from the database and populate the Credentials property of PinAuthorizer ahead of time. This will prevent LINQ to Twitter from making the user perform the authorization process again and you'll be able to start making queries on behalf of that user right away. + +After AuthorizeAsync completes, instantiate a TwitterContext, like this: + +```c# + using (var twitterCtx = new TwitterContext(auth)) + { + //Log + twitterCtx.Log = Console.Out; + + // LINQ to Twitter query goes here + } +``` +The code above passes the PinAuthorizer instance, _auth_, to the TwitterContext constructor. After this, you can query Twitter as normal. + +For debugging, you can set the Log property. The code above uses Console.Out, but you're free to implement and/or assign your TextWriter of choice. \ No newline at end of file diff --git a/Security/OAuth/Implementing-XAuth.md b/Security/OAuth/Implementing-XAuth.md new file mode 100644 index 00000000..af1b2a84 --- /dev/null +++ b/Security/OAuth/Implementing-XAuth.md @@ -0,0 +1,62 @@ +#### Implementing XAuth + +When Twitter deprecated basic authorization in favor of OAuth, they created a new feature named XAuth. One way to look at XAuth is that it's a blend of OAuth and basic authentication. This page describes how to use XAuth. + +Reminder: You need permission from Twitter to use XAuth. If you don't have permission, LINQ to Twitter will return an exception based on the error generated by the Twitter API. + +To get started, you'll need to instantiate an authorizer. Credentials must be populated with ConsumerKey, ConsumerSecret, UserName and Password which identify both your application and the user to Twitter. Heres how you can instantiate an authorizer: + +```c# + var auth = new XAuthAuthorizer + { + CredentialStore = new XAuthCredentials + { + ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], + ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"], + UserName = "YourUserName", + Password = "YourPassword" + } + }; +``` +The example above instantiates a XAuthCredentials, which is an implementation of IOAuthCredentials. The ConsumerKey and ConsumerSecret credentials are being read from a config file, which is fine because they generally don't change for your application. The UserName and Password are for the Twitter account of the user the application is operating on behalf of. + +Next, you'll need to authorize the user. This allows LINQ to Twitter to get the OAuthToken and AccessToken for this user: + +```c# + Task authTask = auth.AuthorizeAsync(); +``` +After Authorize returns, you can read OAuthToken and AccessToken and store them in the database for this user. On subsequent LINQ to Twitter queries on behalf of this same user, you can retrieve OAuthToken and AccessToken from your database and populate Credentials with all four tokens. By loading all four tokens, LINQ to Twitter will not redirect the user for authorization and you can simply perform queries on behalf of that user. + +To perform queries, you need to instantiate a TwitterContext with the XAuthAuthorizer that has all four credential tokens, like this: + +```C# + using (var twitterCtx = new TwitterContext(auth, "https://api.twitter.com/1/", "https://search.twitter.com/")) + { + //Log + twitterCtx.Log = Console.Out; + + var users = + (from tweet in twitterCtx.User + where tweet.Type == UserType.Friends && + tweet.ScreenName == "JoeMayo" + select tweet) + .ToList(); + + users.ForEach(user => + { + var status = + user.Protected || user.Status == null ? + "Status Unavailable" : + user.Status.Text; + + Console.WriteLine( + "ID: {0}, Name: {1}\nLast Tweet: {2}\n", + user.Identifier.UserID, user.Identifier.ScreenName, status); + }); + } +``` +You now have a TwitterContext instance that has been properly authorized and can see how to use it to make queries. + +##### Summary + +The XAuthAuthorizer allows you to use UserName and Password to operate on behalf of a user. The process is less involved than with other authorizers, such as WebAuthorizer, because the process only involves instantiating the authorizer, calling Authorize, and then assigning the authorizer to a TwitterContext instance. \ No newline at end of file diff --git a/Security/OAuth/Introduction-to-OAuth.md b/Security/OAuth/Introduction-to-OAuth.md new file mode 100644 index 00000000..0dd98769 --- /dev/null +++ b/Security/OAuth/Introduction-to-OAuth.md @@ -0,0 +1,57 @@ +#### Introduction to OAuth + +_OAuth_ is a security protocol that allows applications to act on your behalf without requiring you to give out your password to every application. This definition is a generalization and simplification of what OAuth truly is, so this discussion will expand on what OAuth is and it's mechanics. I'll start with an example and explain why OAuth is important and what problem it solves. The real-life example I'll use is from the [C# Station Web site](http://www.csharp-station.com/), which uses OAuth to enable visitors to tweet their success upon completing the C# Tutorial. With this example in mind, you'll learn the communications flow and security information exchanged between C# Station and Twitter, allowing C# Station to post a tweet on the user's behalf. Then, I'll follow-up with a summary, reinforcement of the importance of OAuth, and references on where you can go next to continue your journey in making OAuth work for you. + +##### Why is OAuth Important? + +There is an increasing need for Web applications to communicate with each other. In the Twitter space, there are literally hundreds of 3rd party application that access Twitter on your behalf to provide functionality. Examples include posting photos, scheduling tweets, and full-featured clients. Many of these applications fill holes in Twitter's offerings and deliver value, contributing to their popularity. Without OAuth, each of these applications would need to collect your username and password to interact with Twitter on your behalf and therin lies the problem. + +Sharing secrets (credentials) with a 3rd party application requires putting trust in that application to act responsibly. This is a risky proposition because eventually some unscrupulous application will misuse your secrets for their own gain or engage in malicious behavior. Therefore, you need to minimize who you share your secrets with. Adding to the unfortunate circumstances of finding yourself in a position where an application has misused secrets, the first line of defense is to change passwords. The problem with changing passwords is that the same password has been given to multiple other applications. Therefore, after changing your Twitter password, you also need to change passwords for every other application. Giving out secrets to every application is fraught with risk and complication. + +OAuth is a way to enable the scenario of working with 3rd party applications, without giving out your secrets. Essentially, a 3rd party application that wants to access your Twitter account, using OAuth, will perform a redirection to an authorization page on Twitter, you will then tell Twitter to give them permission, and the application will be able to perform actions on your behalf. This whole sequence of events occurs without needing to share a password with the 3rd party site. Instead, Twitter has shared a token to your account that the 3rd party application uses. If later, you find that you can't trust the 3rd party application, go to Twitter and cancel their access and Twitter will no longer allow that specific application to access your account. Because access is controlled through Twitter, you don't have to do anything special for other applications because they still have access to your account. No one has your Twitter password and you don't have to encounter the pain of visiting every site. + +There was a time when you could use basic authentication (username/password). However, that capability was deprecated and no longer available. While OAuth is more challenging for the developer, it's a superior solution in the best interest of end users. + +##### Examining a Real-World Use of OAuth + +The example we'll use is from the [C# Station Web Site](http://www.csharp-station.com/). Whenever a user completes the C# Tutorial, the last page contains a link for tweeting their success. This is similar to the functionality of many 3rd party applications today that allow you to tweet some type of status related to what you're doing with that application. The following steps show you how the C# Station Tutorial success tweet works: + +1. On the page of the last C# Tutorial lesson, the user clicks on the "Tweet Your Success!" link. They'll see the following page, which explains that clicking the _Announce_ button will use OAuth to let them give C# Station permission to tweet on their behalf: + +[image:The Tweet Your Success Page where the user initiates an OAuth session|OAuthCSharpStationStart.png] + +2. Assuming the user decides they want to let the world know of their accomplishment, they will click the _Announce_ button, which will lead them to the following Twitter page to give C# Station permission to tweet their message: + +[image:The Twitter OAuth Authorization page where the user gives C# Station permission to tweet for them|OAuthCSharpStationTwitterAuth.png] + +3. As shown above, the user fills in their Twitter username and password. Notice that they are only sharing their password with Twitter, not the 3rd party application. If the user is already logged into Twitter, they will only see the _Deny_ and _Allow_ buttons. As a side note: a user should inspect the URL of the site to which they were sent to avoid a phishing attach, just in case the site isn't quite legitimate. Alternatively, a user can visit Twitter themselves to log in ahead of time, avoiding the need to provide credentials during the OAuth session. + +If the user clicks _Deny_, the site will not be able to access the user's Twitter account. Clicking Allow causes Twitter to redirect the user's browser back to the 3rd party application's site to continue whatever subsequent actions might be required. In the case of the current example, C# Station will post a success tweet to the user's account and let the user know, as shown below: + +[image:Notifying the user that the their success has been tweeted|OAuthCSharpStationTweeted.png] + +4. When the user returns to their Twitter account, they can see that their success has indeed been posted to their account, as shown in the following image: + +[image:The Tweet appearing on user's Twitter page|OAuthCSharpStationResults.png] + +Now you've seen an OAuth session in action and how the user didn't need to share their secrets with the 3rd party application. The next section shows this workflow with a sequence diagram, keeping the view at a high level. + +##### A Birds-Eye View of OAuth Workflow + +The workflow in the previous section demonstrated the user experience with OAuth. However, you'll be writing code to produce this experience yourself and need a view that is a step closer to code. The following figure is a sequence diagram that shows the flow of communication between actors: the user, 3rd party application, and Twitter. This sequence diagram is a little more detailed because it shows what information is passing between the actors in the system. The information is either OAuth tokens or username/password credentials. I'll explain more after you've taken a look at the following sequence diagram: + +[image:The OAuth Process|OAuthSequence.png] + +The sequence diagram above corresponds roughly to the description in the previous section, except you can now see the entire process altogether. As in clicking on the Announce button, you must have some action in your application that initiates the OAuth sequence. The application recognizes that command and redirects the user to the Twitter authorization page. After the user authorizes the application, Twitter redirects the user back to the application. When writing the application, you will need to recognize the fact that Twitter has redirected back to you. At that time, the application code will go to Twitter and perform whatever action it needs to and Twitter will permit the application to do so. Upon successfully completing the operation, the application will let the user know that it is done. + +##### Summary + +What you've seen in the previous sections is the application of OAuth from a user's perspective. Stepping through the process of how C# Station managed the OAuth process should give you a better idea of what the user experience is. The sequence diagram was more-or-less a description of the previous steps and served as yet another view of how the process works from a high level. + +At this point in time, you are probably curious about more of the details of how OAuth works and what does it take to write application code to make this sequence happen. For example, how does the application know what page to go to, how does the application know that the user authorized it, and how does Twitter tell the difference between an authorized and unauthorized application request? These are all important questions, which you'll learn about in the next section. + +##### References + +[The Beginner's Guide to OAuth](http://hueniverse.com/oauth/) +[The Official OAuth Site](http://oauth.net/) +[The Twitter OAuth Page](http://dev.twitter.com/pages/auth) \ No newline at end of file diff --git a/Security/OAuth/Single-User-Authorization.md b/Security/OAuth/Single-User-Authorization.md new file mode 100644 index 00000000..6ed94fe4 --- /dev/null +++ b/Security/OAuth/Single-User-Authorization.md @@ -0,0 +1,55 @@ +#### Implementing Single User Authorization + +Single User Authorization is designed for scenarios where you'll only ever have one account accessing Twitter. i.e. if your Web site does periodic Twitter updates, regardless of user or you have a server that monitors general information. You can obtain all four Single User Credentials from your application page at http://dev.twitter.com. + +To get started, you'll need to instantiate a _SingleUserAuthorizer_. Credentials must be populated with ConsumerKey, ConsumerSecret, AccessToken, and AccessTokenSecret which identify both your application and the user to Twitter. Heres how you can instantiate an authorizer: + +```c# + var auth = new SingleUserAuthorizer + { + CredentialStore = new SingleUserInMemoryCredentialStore + { + ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], + ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"], + AccessToken = ConfigurationManager.AppSettings["accessToken"], + AccessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"] + } + }; +``` +The example above instantiates a _SingleUserAuthorizer_ with an _SingleUserInMemoryCredentialStore_, which is an implementation of ICredentialStore. The credentials are being read from a config file, which is fine because they generally don't change for your application. The config file looks like this: +```xml + + + + + + + + +``` + +Unlike other authorizers, you don't need to authorize your application. Just instantiate a TwitterContext with the authorizer and use it like this: + +```c# + var twitterCtx = new TwitterContext(auth); + + var searchResponse = + await + (from search in twitterCtx.Search + where search.Type == SearchType.Search && + search.Query == "\"LINQ to Twitter\"" + select search) + .SingleOrDefaultAsync(); + + if (searchResponse != null && searchResponse.Statuses != null) + searchResponse.Statuses.ForEach(tweet => + Console.WriteLine( + "User: {0}, Tweet: {1}", + tweet.User.ScreenNameResponse, + tweet.Text)); +``` +You now have a _TwitterContext_ instance that has been properly authorized and can see how to use it to make queries. + +#### Summary + +The SingleUserAuthorizer allows you to fill in all of your credentials at one time, bypassing the user-centric authorization process. The process is less involved than with other authorizers, such as PinAuthorizer or MvcAuthorizer, because the process only involves instantiating the authorizer and then assigning the authorizer to a TwitterContext instance. \ No newline at end of file diff --git a/index.md b/index.md index 4a3d1679..12d23923 100644 --- a/index.md +++ b/index.md @@ -14,7 +14,7 @@ Some introductory information on programming Twitter. This is the main API section, where the technical descriptions of objects, methods, and other features of LINQ to Twitter are covered. -## [Securing Your Applications](/Security/Securing-Your-Applications.md) +## [Securing Your Applications](Securing-Your-Applications.md) As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. You'll learn about the various OAuth implementations you can use here. ## [Error Handling](Error-Handling.md) From f94b92efaca68c9c4b8a155e29fd3100633e467c Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 01:05:51 +0000 Subject: [PATCH 13/95] Update Learning-to-use-OAuth.md --- Security/Learning-to-use-OAuth.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Security/Learning-to-use-OAuth.md b/Security/Learning-to-use-OAuth.md index 733f1cdf..3d6a6c22 100644 --- a/Security/Learning-to-use-OAuth.md +++ b/Security/Learning-to-use-OAuth.md @@ -2,46 +2,46 @@ The links on this page lead to instructions on how to use OAuth with LINQ to Twitter. Introduction to OAuth and Configuring OAuth help you get started. Other pages are technology specific examples of how you can use OAuth with LINQ to Twitter. -#### [Introduction to OAuth](/OAuth/Introduction-to-OAuth) +#### [Introduction to OAuth](OAuth/Introduction-to-OAuth.md) What is OAuth and how does it help you? -#### [Configuring OAuth](/OAuth/Configuring-OAuth) +#### [Configuring OAuth](/OAuth/Configuring-OAuth.md) Configuring OAuth with LINQ to Twitter. -#### [Implementing OAuth for Desktop Applications](/OAuth/Implementing-OAuth-for-Desktop-Applications) +#### [Implementing OAuth for Desktop Applications](/Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md) You'll learn how to use OAuth with Console, WinForms, and WPF apps. -#### [Implementing PIN Authorization for Console Applications](/OAuth/Implementing-PIN-Authorization-for-Console-Applications) +#### [Implementing PIN Authorization for Console Applications](/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md) Shows you how to use PIN Authorization. -#### [Implementing OAuth for ASP.NET Web Forms](/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms) +#### [Implementing OAuth for ASP.NET Web Forms](/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md) This will show how to use OAuth with classic Web Forms. -#### [Implementing OAuth for ASP.NET MVC](/OAuth/Implementing-OAuth-for-ASP.NET) +#### [Implementing OAuth for ASP.NET MVC](/OAuth/Implementing-OAuth-for-ASP.NET.md) This section explains how OAuth works with ASP.NET MVC. -#### [Implementing OAuth for Silverlight](/OAuth/Implementing-OAuth-for-Silverlight) +#### [Implementing OAuth for Silverlight](/OAuth/Implementing-OAuth-for-Silverlight.md) This section shows how to use OAuth with Silverlight. -#### [Implementing OAuth for Windows 8](/OAuth/Implementing-OAuth-for-Windows) +#### [Implementing OAuth for Windows 8](/OAuth/Implementing-OAuth-for-Windows.md) This section shows how to use OAuth with Windows 8. -#### [Implementing XAuth](/OAuth/Implementing-XAuth) +#### [Implementing XAuth](/OAuth/Implementing-XAuth.md) This-section-demonstrates-how-to-use-XAuth. -#### [Single User Authorization](/OAuth/Single-User-Authorization) +#### [Single User Authorization](/OAuth/Single-User-Authorization.md) This section discusses how to implement single user authorization. -#### [Application-Only Authorization](/OAuth/Application-Only-Authorization) +#### [Application-Only Authorization](/OAuth/Application-Only-Authorization.md) Explains how to perform application only authorization. \ No newline at end of file From 305626f79353ad20bb05b97fbc0a6bb85d734c72 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 01:09:33 +0000 Subject: [PATCH 14/95] Update Securing-Your-Applications.md --- Securing-Your-Applications.md | 4 ++-- Security/Learning-to-use-OAuth.md | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Securing-Your-Applications.md b/Securing-Your-Applications.md index 96f08957..cc2f4734 100644 --- a/Securing-Your-Applications.md +++ b/Securing-Your-Applications.md @@ -2,10 +2,10 @@ As a Web API, security is very important with LINQ to Twitter and this section explains parts of the API that are available to build secure applications using LINQ to Twitter. -### [Understanding the Importance of Security](/Security/Understanding-the-Importance-of-Security.md) +### [Understanding the Importance of Security](Security/Understanding-the-Importance-of-Security.md) Often overlooked, security is important and this section explains why. -### [Learning to use OAuth](/Security/Learning-to-use-OAuth.md) +### [Learning to use OAuth](Security/Learning-to-use-OAuth.md) OAuth is the single-most difficult aspect of the Twitter API to get right. Even with a library, like LINQ to Twitter, that simplifies the task, it is still a complex feature. This section shows how to use OAuth with various technologies that LINQ to Twitter supports. It's important to select the proper authorization method because the nature of the supported technologies are different. Additionally you might have requirements that suggest one type of authorizer might be better than another. \ No newline at end of file diff --git a/Security/Learning-to-use-OAuth.md b/Security/Learning-to-use-OAuth.md index 3d6a6c22..500327b4 100644 --- a/Security/Learning-to-use-OAuth.md +++ b/Security/Learning-to-use-OAuth.md @@ -6,42 +6,42 @@ The links on this page lead to instructions on how to use OAuth with LINQ to Twi What is OAuth and how does it help you? -#### [Configuring OAuth](/OAuth/Configuring-OAuth.md) +#### [Configuring OAuth](OAuth/Configuring-OAuth.md) Configuring OAuth with LINQ to Twitter. -#### [Implementing OAuth for Desktop Applications](/Security/OAuth/Implementing-OAuth-for-Desktop-Applications.md) +#### [Implementing OAuth for Desktop Applications](OAuth/Implementing-OAuth-for-Desktop-Applications.md) You'll learn how to use OAuth with Console, WinForms, and WPF apps. -#### [Implementing PIN Authorization for Console Applications](/OAuth/Implementing-PIN-Authorization-for-Console-Applications.md) +#### [Implementing PIN Authorization for Console Applications](OAuth/Implementing-PIN-Authorization-for-Console-Applications.md) Shows you how to use PIN Authorization. -#### [Implementing OAuth for ASP.NET Web Forms](/OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md) +#### [Implementing OAuth for ASP.NET Web Forms](OAuth/Implementing-OAuth-for-ASP.NET-Web-Forms.md) This will show how to use OAuth with classic Web Forms. -#### [Implementing OAuth for ASP.NET MVC](/OAuth/Implementing-OAuth-for-ASP.NET.md) +#### [Implementing OAuth for ASP.NET MVC](OAuth/Implementing-OAuth-for-ASP.NET.md) This section explains how OAuth works with ASP.NET MVC. -#### [Implementing OAuth for Silverlight](/OAuth/Implementing-OAuth-for-Silverlight.md) +#### [Implementing OAuth for Silverlight](OAuth/Implementing-OAuth-for-Silverlight.md) This section shows how to use OAuth with Silverlight. -#### [Implementing OAuth for Windows 8](/OAuth/Implementing-OAuth-for-Windows.md) +#### [Implementing OAuth for Windows 8](OAuth/Implementing-OAuth-for-Windows.md) This section shows how to use OAuth with Windows 8. -#### [Implementing XAuth](/OAuth/Implementing-XAuth.md) +#### [Implementing XAuth](OAuth/Implementing-XAuth.md) This-section-demonstrates-how-to-use-XAuth. -#### [Single User Authorization](/OAuth/Single-User-Authorization.md) +#### [Single User Authorization](OAuth/Single-User-Authorization.md) This section discusses how to implement single user authorization. -#### [Application-Only Authorization](/OAuth/Application-Only-Authorization.md) +#### [Application-Only Authorization](OAuth/Application-Only-Authorization.md) Explains how to perform application only authorization. \ No newline at end of file From ef8bfb1274f6ec9ff75add5cf251cc92b3c8d906 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 01:20:20 +0000 Subject: [PATCH 15/95] Update Learning-to-use-OAuth.md --- Security/Learning-to-use-OAuth.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Security/Learning-to-use-OAuth.md b/Security/Learning-to-use-OAuth.md index 500327b4..7ae4d56b 100644 --- a/Security/Learning-to-use-OAuth.md +++ b/Security/Learning-to-use-OAuth.md @@ -22,7 +22,7 @@ Shows you how to use PIN Authorization. This will show how to use OAuth with classic Web Forms. -#### [Implementing OAuth for ASP.NET MVC](OAuth/Implementing-OAuth-for-ASP.NET.md) +#### [Implementing OAuth for ASP.NET MVC](OAuth/Implementing-OAuth-for-ASP.NET-MVC.md) This section explains how OAuth works with ASP.NET MVC. @@ -30,7 +30,7 @@ This section explains how OAuth works with ASP.NET MVC. This section shows how to use OAuth with Silverlight. -#### [Implementing OAuth for Windows 8](OAuth/Implementing-OAuth-for-Windows.md) +#### [Implementing OAuth for Windows 8](OAuth/Implementing-OAuth-for-Windows-8.md) This section shows how to use OAuth with Windows 8. From 82c923d920cf21bf21cf9eba34e1a60ab6b39993 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 22:05:36 +0000 Subject: [PATCH 16/95] Update index.md --- LINQ-to-Twitter-5/Blocking-Users.md | 19 ++ .../Getting-Geographical-Information.md | 19 ++ LINQ-to-Twitter-5/Getting-User-Information.md | 43 ++++ LINQ-to-Twitter-5/Handling-Friendships.md | 51 +++++ LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md | 174 ++++++++++++++++ .../Making-Status-Queries-and-Calls.md | 51 +++++ LINQ-to-Twitter-5/Managing-Accounts.md | 35 ++++ LINQ-to-Twitter-5/Managing-Lists.md | 79 +++++++ LINQ-to-Twitter-5/Managing-Saved-Searches.md | 19 ++ LINQ-to-Twitter-5/Muting-Users.md | 19 ++ .../Performing-Searches-and-Finding-Trends.md | 19 ++ LINQ-to-Twitter-5/Querying-Favorites.md | 15 ++ LINQ-to-Twitter-5/Safety-Hatch.md | 13 ++ .../Streaming-Twitter-Content.md | 23 ++ LINQ-to-Twitter-5/Twitter-API-Map.md | 196 ++++++++++++++++++ LINQ-to-Twitter-5/Uploading-Media.md | 11 + LINQ-to-Twitter-5/Using-Help-Methods.md | 23 ++ .../Working-with-Direct-Messages.md | 19 ++ LINQ-to-Twitter-v5.md | 76 +++++++ LINQ-to-Twitter-v6.md | 1 + index.md | 4 +- 21 files changed, 907 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-5/Blocking-Users.md create mode 100644 LINQ-to-Twitter-5/Getting-Geographical-Information.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists.md create mode 100644 LINQ-to-Twitter-5/Managing-Saved-Searches.md create mode 100644 LINQ-to-Twitter-5/Muting-Users.md create mode 100644 LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md create mode 100644 LINQ-to-Twitter-5/Querying-Favorites.md create mode 100644 LINQ-to-Twitter-5/Safety-Hatch.md create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content.md create mode 100644 LINQ-to-Twitter-5/Twitter-API-Map.md create mode 100644 LINQ-to-Twitter-5/Uploading-Media.md create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods.md create mode 100644 LINQ-to-Twitter-5/Working-with-Direct-Messages.md create mode 100644 LINQ-to-Twitter-v5.md create mode 100644 LINQ-to-Twitter-v6.md diff --git a/LINQ-to-Twitter-5/Blocking-Users.md b/LINQ-to-Twitter-5/Blocking-Users.md new file mode 100644 index 00000000..596c8a24 --- /dev/null +++ b/LINQ-to-Twitter-5/Blocking-Users.md @@ -0,0 +1,19 @@ +### Blocking Users + +This section shows you how to block users that you don't want to see your status. + +#### [[Blocking a User]] + +Block a user + +#### [[Unblocking a User]] + +Unblock a user + +#### [[Get Blocked Users]] + +Find out who a user is blocking + +#### [[Get Blocked IDs]] + +Get a list of IDs of the people a user is blocking \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information.md b/LINQ-to-Twitter-5/Getting-Geographical-Information.md new file mode 100644 index 00000000..66ff95ca --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information.md @@ -0,0 +1,19 @@ +### Getting Geographical Information + +You can info on places associated with geographical information + +### [[Performing Reverse Geocode Lookups]] + +Lets you provide latitude and longitude to get back location/place information + +### [[Getting Details on a Place]] + +With a place ID, returned by a Reverse Geocode lookup, you can get more details on the place + +### [[Searching for Places]] + +Search for places that can be attached to a status update + +### [[Querying Similar Places]] + +Get a list of nearby places with similar names \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information.md b/LINQ-to-Twitter-5/Getting-User-Information.md new file mode 100644 index 00000000..735c4b33 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information.md @@ -0,0 +1,43 @@ +### Getting User Information + +You can get information on users, their friends, and their followers + +#### [[Querying User Details]] + +Look up details on specified users + +#### [[Querying User Info]] + +Show information for a user + +#### [[Searching for Users]] + +Find users with a search query + +#### [[Querying User Contributees]] + +Get list of users that the specified user can contribute to + +#### [[Querying User Contributors]] + +Get list of users that can contribute to the specified user + +#### [[Querying Profile Banner Sizes]] + +Get list of allowable sizes for profile banners + +#### [[Querying Suggested Users in a Category]] + +Get list of users in suggested users category + +#### [[Querying Suggested User Categories]] + +Get list of categories for suggested users + +#### [[Getting User Statuses in a Category]] + +Get list of user statuses in a category + +#### [[Reporting Spam]] + +Report a user for SPAM \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships.md b/LINQ-to-Twitter-5/Handling-Friendships.md new file mode 100644 index 00000000..5f2e6daa --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships.md @@ -0,0 +1,51 @@ +### Handling Friendships + +This section explains how to work with friendships + +#### [[Creating a Friendship]] + +Follow another user + +#### [[Destroying a Friendship]] + +Unfollow another user + +#### [[Showing Incoming Requests]] + +Show IDs of all users requesting friendship with logged in user + +#### [[Showing Outgoing Requests]] + +Show IDs of all users for whom the logged in user has requested friendship + +#### [[Showing Friendship Details]] + +Get the details on the relationship between two users + +#### [[Updating Friendship Settings]] + +Update notification settings + +#### [[Showing No Retweet IDs]] + +Show IDs of all users for whom the logged in user doesn't want to see retweets + +#### [[Showing Friends]] + +Get a list of friend User entities + +#### [[Showing Followers]] + +Get a list of follower User entities + +#### [[Looking Up Friendships]] + +Look up friendship information. + +#### [[Listing Friends]] + +Gets IDs of people being followed by the user + +#### [[Listing Followers]] + +Gets IDs of people following the user \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md new file mode 100644 index 00000000..8664127b --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md @@ -0,0 +1,174 @@ +## LINQ to Twitter Entities + +This section lists the entities returned by LINQ to Twitter. The Twitter API returns JSON that LINQ to Twitter packages up into entities. These entities contain return properties. + +*Note:* _The term entities is overloaded. From the LINQ to Twitter perspective, entities refers to objects converted from JSON into C# types. From the Twitter perspective, entities provide details about links, hashtags, media, and mentions within the text of a tweet._ + +### [[Account Entity]] + +The account entity contains properties about accounts + +### [[BannerSize Entity]] + +Allowable size for a banner. + +### [[Blocks Entity]] + +The blocks entity contains properties about blocks + +### [[Category Entity]] + +The category entity contains properties about categories + +### [[Configuration Entity]] + +The configuration entity contains properties about help configuration information + +### [[Contributor Entity]] + +The contributor entity contains properties about contributors + +### [[Coordinate Entity]] + +The coordinate entity contains properties about coordinate information + +### [[Cursors Entity]] + +The cursors entity contains properties about cursors + +### [[DirectMessage Entity]] + +The direct message entity contains properties about direct messages + +### [[DirectMessageEvents Entity]] + +The direct message events entity contains properties about direct message events + +### [[Entities Entity]] + +Contains parsed Hashtag, Media, Url, User, and Symbol entities in a tweet + +### [[Favorites Entity]] + +The favorites entity contains properties about favorites + +### [[Friendship Entity]] + +The friendship entity contains properties about friendships + +### [[Geo Entity]] + +The geo entity contains properties about geographical information + +### [[Geometry Entity]] + +The geometry entity contains properties about bounding box geometry + +### [[Help Entity]] + +The help entity contains properties about help information + +### [[List Entity]] + +The list entity contains properties about lists + +### [[Location Entity]] + +The location entity contains properties about locations + +### [[Media Entity]] + +Details on an uploaded image + +### [[MediaImage Entity]] + +Physical aspects of an image + +### [[Mute Entity]] + +Supports Muting Users + +### [[PhotoSize Entity]] + +The photo size entity contains properties about photo sizes + +### [[Place Entity]] + +The place entity contains properties about places + +### [[RateLimitStatus Entity]] + +The rate limit status entity contains properties about rate limit status + +### [[Raw Entity]] + +Supports Raw Queries + +### [[Relationship Entity]] + +The relationship entity contains properties about relationships + +### [[RelatedResults Entity]] + +The related results entity contains properties about related results + +### [[SavedSearch Entity]] + +The saved search entity contains properties about saved searches + +### [[Search Entity]] + +The search entry entity contains properties about searches + +### [[SearchMetaData Entity]] + +Additional information associated with search results + +### [[Settings Entity]] + +The settings entity contains properties about account settings + +### [[SleepTime Entity]] + +The sleep time entity contains properties about sleep time settings + +### [[SocialGraph Entity]] + +The social graph entity contains properties about social graphs + +### [[Status Entity]] + +The status entity contains properties about tweets + +### [[Totals Entity]] + +The totals entity contains properties about account totals + +### [[Trend Entity]] + +The trend entity contains properties about trends + +### [[TwitterHashResponse Entity]] + +The Twitter hash response entity contains properties about Twitter hash responses + +### [[TZInfo Entity]] + +The time zone info entity contains properties about time zone settings + +### [[User Entity]] + +The user entity contains properties about user information + +### [[UserEntity Entity]] + +This object contains entities for the user profile, including description and url fields + +### [[UserIdentifier Entity]] + +The user identifier entity contains properties about a specific user + +### [[Vine Entity]] + +The vine entity contains properties for vine queries + diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md new file mode 100644 index 00000000..846a4baa --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md @@ -0,0 +1,51 @@ +### Making Status Queries and Calls + +The status queries match both Twitter timeline queries and working with statuses + +#### [[Querying the Mentions Timeline]] + +Gets the 20 most recent tweets where the user has been mentioned + +#### [[Querying the User Timeline]] + +Gets the 20 most recent tweets for a user (doesn't include user's friends) + +#### [[Querying the Home Timeline]] + +Gets the 20 most recent tweets, including retweets, for a user and user's friends + +#### [[Getting Statuses Retweeted About a User]] + +Gets the 20 most recent retweets about a user. + +#### [[Getting the Retweets of a Status]] + +Gets up to 100 retweets of a tweet + +#### [[Querying Statuses]] + +Gets a specific tweet + +#### [[Getting Multiple Tweets]] + +Gets a list of tweets + +#### [[Destroying Statuses]] + +Deletes a tweet + +#### [[Updating Statuses]] + +Creates a new tweet + +#### [[Retweeting a Status]] + +Performs a retweet of a tweet + +#### [[Getting Status oEmbed Information]] + +Gets embeddable status information. + +#### [[Getting Retweeter IDs]] + +Gets up to 100 IDs of users that retweeted a specific tweet \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts.md b/LINQ-to-Twitter-5/Managing-Accounts.md new file mode 100644 index 00000000..b5f2cba9 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts.md @@ -0,0 +1,35 @@ +### Managing Accounts + +The account API's allow you to manage your Twitter account + +#### [[Verifying Credentials]] + +Check to see that a user's credentials are okay + +#### [[Showing Account Settings]] + +Show account settings + +#### [[Updating Profile Colors]] + +Set color scheme for user's profile + +#### [[Updating a Profile Image]] + +Sets user's profile image + +#### [[Updating Profile Information]] + +Set various profile information items + +#### [[Updating Account Settings]] + +Update the user's account settings + +#### [[Updating the Profile Banner]] + +Update the user's profile banner image + +#### [[Removing the Profile Banner]] + +Delete the user's profile banner image diff --git a/LINQ-to-Twitter-5/Managing-Lists.md b/LINQ-to-Twitter-5/Managing-Lists.md new file mode 100644 index 00000000..95e0af44 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists.md @@ -0,0 +1,79 @@ +### Managing Lists + +Lists allow you to categorize Twitter accounts. + +#### [[Retrieving All Lists]] + +Get a list of all lists + +#### [[Reading List Statuses]] + +Read tweets from a list + +#### [[Learn what Lists a User is a Member Of]] + +Get lists a user is a member of + +#### [[Getting List Subscribers]] + +Get a list of users who subscribed to a list + +#### [[Checking if a User Subscribes to a List]] + +Determine if a user subscribes to a list + +#### [[Checking if a User is a List Member]] + +Determine if a user is a member of a list + +#### [[Getting List Members]] + +Get a list of members of a list + +#### [[Getting Info on a List]] + +Get details on a list + +#### [[Learn what Lists a User Subscribes To]] + +Get lists user has subscribed to + +#### [[Finding Owned Lists]] + +Get lists that the authenticated user owns. + +#### [[Deleting a List Member]] + +Remove a user from a list + +#### [[Subscribing a User to a List]] + +Create a subscription for a user on a list + +#### [[Deleting a List Subscription]] + +Remove a user's subscription to a list + +#### [[Adding Multiple Members to a List]] + +Add multiple users to a list at the same time + +#### [[Adding a Member to a List]] + +Add a user to a list + +#### [[Deleting a List]] + +Delete a list + +#### [[Updating a List]] + +Update a list + +#### [[Creating a List]] + +Create a new list + +#### [[Deleting Multiple List Members]] + +Remove up to 100 members from a list \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches.md b/LINQ-to-Twitter-5/Managing-Saved-Searches.md new file mode 100644 index 00000000..32dd0434 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches.md @@ -0,0 +1,19 @@ +### Managing Saved Searches + +You can save searches and reuse them later. + +#### [[Getting a List of Saved Searches]] + +Get a list of saved searches + +#### [[Getting Info on a Saved Search]] + +Get details on a saved search + +#### [[Creating a Saved Search]] + +Create a new saved search + +#### [[Destroying a Saved Search]] + +Delete a saved search diff --git a/LINQ-to-Twitter-5/Muting-Users.md b/LINQ-to-Twitter-5/Muting-Users.md new file mode 100644 index 00000000..fb019327 --- /dev/null +++ b/LINQ-to-Twitter-5/Muting-Users.md @@ -0,0 +1,19 @@ +### Muting Users + +Lets a user turn off tweets from another account without unfollowing. + +#### [[Getting Muted IDs]] + +Retrieve a list of muted user IDs. + +#### [[Getting Muted Users]] + +Retrieve a list of muted user entities. + +#### [[Mute a User]] + +Turn off user's tweets without unfollowing them. + +#### [[Unmute a User]] + +Turn a user's tweets back on. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md new file mode 100644 index 00000000..fdda33ed --- /dev/null +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md @@ -0,0 +1,19 @@ +### Performing Searches and Finding Trends + +You'll learn how LINQ to Twitter supports search and trends in this section. + +#### [[Searching Twitter]] + +Perform a search + +#### [[Getting Trend Locations]] + +Get trends for a specified place + +#### [[Retrieving Available Trend Locations]] + +Get locations where trends are occurring + +#### [[Getting Closest Trends]] + +Get trends closest to a given latitude and longitude. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Querying-Favorites.md b/LINQ-to-Twitter-5/Querying-Favorites.md new file mode 100644 index 00000000..bc154bb3 --- /dev/null +++ b/LINQ-to-Twitter-5/Querying-Favorites.md @@ -0,0 +1,15 @@ +### Querying Favorites + +Twitter lets you manage favorites, which is supported here too. + +#### [[Getting a List of Favorites]] + +Get a list of favorites. + +#### [[Creating a Favorite]] + +Favorite a tweet + +#### [[Destroying a Favorite]] + +Un-favorite a tweet. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Safety-Hatch.md b/LINQ-to-Twitter-5/Safety-Hatch.md new file mode 100644 index 00000000..6a27bdda --- /dev/null +++ b/LINQ-to-Twitter-5/Safety-Hatch.md @@ -0,0 +1,13 @@ +### [[Safety Hatch]] + +If something isn't quite right or available, you still have a work around. For example, what if the Twitter API adds a new parameter to an endpoint; an entirely new endpoint; or a new set of beta endpoints that aren't available in the latest version of LINQ to Twitter? What if LINQ to Twitter has a bug that isn't fixed in the latest release? You aren't stuck. + +The safety hatch is Raw queries and commands. While a bit more work, this approach is flexible and still helps you avoid much low-level plumbing code, such as HTTP communication and OAuth. + +#### [[Raw Queries]] + +Perform a query on any HTTP GET endpoint in the Twitter API. + +#### [[Raw Commands]] + +Communicate with any HTTP POST endpoint in the Twitter API. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md new file mode 100644 index 00000000..163167b9 --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md @@ -0,0 +1,23 @@ +### Streaming Twitter Content + +Stream Twitter content. + +#### [[Getting Filtered Statuses]] + +Return statuses matching given filters + +#### [[Getting Status Samples]] + +Return status samples + +#### [[Getting Public Statuses]] + +Return all public statuses with the firehose + +#### [[Stream User Messages]] + +Return a single user's messages as a stream + +#### [[Stream Multiple User Messages]] + +Return multiple users' messages as a stream \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Twitter-API-Map.md b/LINQ-to-Twitter-5/Twitter-API-Map.md new file mode 100644 index 00000000..d0bde7c9 --- /dev/null +++ b/LINQ-to-Twitter-5/Twitter-API-Map.md @@ -0,0 +1,196 @@ +#### Twitter API Map +LINQ to Twitter supports 100% of the Twitter API. This map will help you navigate LINQ to Twitter and the Twitter API. + +##### Accounts + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [account/settings](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings) | [[Showing Account Settings]] | +| [account/verify_credentials](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials) | [[Verifying Credentials]] | +| [account/settings](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings) | [[Updating Account Settings]] | +| [account/update_profile](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile) | [[Updating Profile Information]] | +| [account/update_profile_background_image](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image) | [[Updating a Profile Background Image]] | +| [account/update_profile_image](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image) | [[Updating a Profile Image]] | +| [account/remove_profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner) | [[Removing the Profile Banner]] | +| [account/update_profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner) | [[Updating the Profile Banner]] | + +##### Blocks + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [blocks/list](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list) | [[Get Blocked Users]] | +| [blocks/ids](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids) | [[Get Blocked IDs]] | +| [blocks/create](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create) | [[Blocking a User]] | +| [blocks/destroy](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy) | [[Unblocking a User]] | + +##### Direct Message Events + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [direct_messages/events/show](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event) | [[Showing Direct Message Events]] | +| [direct_messages/events/list](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events) | [[Listing Direct Message Events]] | +| [direct_messages/events/new](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event) | [[Sending Direct Message Events ]] | +| [direct_messages/events/destroy](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event) | [[Deleting Direct Message Events]] | + +##### Favorites + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [favorites/list](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create) | [[Getting a List of Favorites]] | +| [favorites/destroy](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy) | [[Destroying a Favorite]] | +| [favorites/create](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create) | [[Creating a Favorite]] | + +##### Friends & Followers + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [friendships/no_retweets/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create) | [[Showing No Retweet IDs]] | +| [friends/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids) | [[Listing Friends]] | +| [followers/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids) | [[Listing Followers]] | +| [friendships/lookup](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup) | [[Looking Up Friendships]] | +| [friendships/incoming](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming) | [[Showing Incoming Requests]] | +| [friendships/outgoing](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing) | [[Showing Outgoing Requests]] | +| [friendships/create](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create) | [[Creating a Friendship]] | +| [friendships/destroy](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy) | [[Destroying a Friendship]] | +| [friendships/update](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update) | [[Updating Friendship Settings]] | +| [friendships/show](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show) | [[Showing Friendship Details]] | +| [friends/list](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list) | [[Showing Friends]] | +| [followers/list](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list) | [[Showing Followers]] | + +##### Help + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [help/configuration](https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration) | [[Getting Configuration Information]] | +| [help/languages](https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages) | [[Retrieving Languages]] | +| [help/privacy](https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy) | [[Viewing Privacy]] | +| [help/tos](https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos) | [[Viewing TOS]] | +| [application/rate_limit_status](https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status) | [[Getting Rate Limits]] | + +##### Lists + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [lists/list](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list) | [[Retrieving All Lists]] | +| [lists/statuses](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses) | [[Reading List Statuses]] | +| [lists/members/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy) | [[Deleting a List Member]] | +| [lists/memberships](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships) | [[Learn what Lists a User is a Member Of]] | +| [lists/subscribers](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers) | [[Getting List Subscribers]] | +| [lists/subscribers/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create) | [[Subscribing a User to a List]] | +| [lists/subscribers/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show) | [[Checking if a User Subscribes to a List]] | +| [lists/subscribers/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy) | [[Deleting a List Subscription]] | +| [lists/members/create_all](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all) | [[Adding Multiple Members to a List]] | +| [lists/members/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show) | [[Checking if a User is a List Member]] | +| [lists/members](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members) | [[Getting List Members]] | +| [lists/members/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create) | [[Adding a Member to a List]] | +| [lists/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy) | [[Deleting a List]] | +| [lists/update](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update) | [[Updating a List]] | +| [lists/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create) | [[Creating a List]] | +| [lists/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show) | [[Getting Info on a List]] | +| [lists/subscriptions](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions) | [[Learn What Lists a User Subscribes to]] | +| [lists/members/destroy_all](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all) | [[Deleting Multiple List Members]] | +| [lists/ownerships](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships) | [[Finding Owned Lists]] | + +##### Media + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [media/upload](https://developer.twitter.com/en/docs/media/upload-media/api-reference) | [[Uploading Images and Video]] | +| [media/metadata/create](https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create) | [[Adding Alt Text]] | + +##### Mutes + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [mutes/users/ids](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids) | [[Getting Muted IDs]] | +| [mutes/users/list](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list) | [[Getting Muted Users]] | +| [mutes/users/create](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create) | [[Mute a User]] | +| [mutes/users/destroy](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy) | [[Unmute a User]] | + +##### Places & Geo + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [geo/id/:place_id](https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id) | [[Getting Details on a Place]] | +| [geo/reverse_geocode/show/:id](https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode) | [[Performing Reverse Geocode Lookups]] | +| [geo/search](https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search) | [[Searching for Places]] | +| [geo/similar_places](https://developer.twitter.com/en/docs/geo/places-near-location/overview) | [[Querying Similar Places]] | + +##### Saved Searches + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [saved_searches/list](https://developer.twitter.com/en/docs/api-reference-index) | [[Getting a List of Saved Searches]] | +| [saved_searches/show/:id](https://developer.twitter.com/en/docs/api-reference-index) | [[Getting Info on a Saved Search]] | +| [saved_searches/create](https://developer.twitter.com/en/docs/api-reference-index) | [[Creating a Saved Search]] | +| [saved_searches/destroy/:id](https://developer.twitter.com/en/docs/api-reference-index) | [[Destroying a Saved Search]] | + +##### Search + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [search/tweets](https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets) | [[Searching Twitter]] | + +##### Spam Reporting + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [users/report_spam](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam) | [[Sending a Spam Notification]] | + +##### Streaming + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [statuses/filter](https://developer.twitter.com/en/docs/tweets/filter-realtime/overview/statuses-filter) | [[Getting Filtered Statuses]] | +| [statuses/sample](https://developer.twitter.com/en/docs/tweets/sample-realtime/overview/GET_statuse_sample) | [[Getting Status Samples]] | + +##### Suggested Users + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [users/suggestions/:slug](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug) | [[Querying Suggested Users in a Category]] | +| [users/suggestions](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions) | [[Querying Suggested User Categories]] | +| [users/suggestions/:slug/members](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members) | [[Getting User Statuses in a Category]] | + +##### Timelines + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [statuses/mentions_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline) | [[Querying the Mentions Timeline]] | +| [statuses/user_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline) | [[Querying the User Timeline]] | +| [statuses/home_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline) | [[Querying the Home Timeline]] | +| [statuses/retweets_of_me](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me) | [[Getting Statuses Retweeted About a User]] | + +##### Trends + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [trends/place](https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place) | [[Getting Trend Locations]] | +| [trends/available](https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available) | [[Retrieving Available Trend Locations]] | +| [trends/closest](https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest) | [[Getting Closest Trends]] | + +##### Tweets + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [statuses/retweets/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id) | [[Getting the Retweets of a Status]] | +| [statuses/show/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id) | [[Querying Statuses]] | +| [statuses/lookup](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup) | [[Getting Multiple Tweets]] | +| [statuses/destroy/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id) | [[Destroying Statuses]] | +| [statuses/update](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update) | [[Updating Statuses]] | +| [statuses/retweet/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id) | [[Retweeting a Status]] | +| [statuses/oembed](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed) | [[Getting Status oEmbed Information]] | +| [statuses/retweeters/ids](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids) | [[Getting Retweeter IDs]] | + +##### Users + +| Twitter API | LINQ to Twitter | +|-------------|-----------------| +| [users/lookup](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup) | [[Querying User Details]] | +| [users/show](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show) | [[Querying User Info]] | +| [users/search](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search) | [[Searching for Users]] | +| [users/contributees](https://developer.twitter.com/en/docs/api-reference-index) | [[Querying User Contributees]] | +| [users/contributors](https://developer.twitter.com/en/docs/api-reference-index) | [[Querying User Contributors]] | +| [users/profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner) | [[Querying Profile Banner Sizes]] | + +*Twitter API:* [REST API v1.1](https://developer.twitter.com/en/docs/api-reference-index) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Uploading-Media.md b/LINQ-to-Twitter-5/Uploading-Media.md new file mode 100644 index 00000000..774f0e0d --- /dev/null +++ b/LINQ-to-Twitter-5/Uploading-Media.md @@ -0,0 +1,11 @@ +### Uploading Media + +Posting images and video. + +#### [[Uploading Images and Video]] + +Allows you to upload multiple images or a video. + +#### [[Adding Alt Text]] + +Lets you tag media with alt tags for accessibility. diff --git a/LINQ-to-Twitter-5/Using-Help-Methods.md b/LINQ-to-Twitter-5/Using-Help-Methods.md new file mode 100644 index 00000000..d7310730 --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods.md @@ -0,0 +1,23 @@ +### Using Help Methods + +This method is for testing Twitter connectivity. + +#### [[Getting Configuration Information]] + +Pulls general configuration information such as URL lengths, system names, and photo sizes + +#### [[Retrieving Languages]] + +Provides a list of languages supported by Twitter + +#### [[Getting Rate Limits]] + +Shows how to obtain rate limit status for each API + +#### [[Viewing Privacy]] + +Displays the Twitter privacy policy + +#### [[Viewing TOS]] + +Displays the Twitter terms of service \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages.md new file mode 100644 index 00000000..6d3817c2 --- /dev/null +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages.md @@ -0,0 +1,19 @@ +### Working with Direct Messages + +This section shows you how to send private messages between you and others + +#### [[Showing Direct Message Events]] + +Show direct message event information. + +#### [[Listing Direct Message Events]] + +List direct message event information. + +#### [[Sending Direct Message Events]] + +Send a new direct message event. + +#### [[Deleting Direct Message Events]] + +Learning how to delete a direct message event. diff --git a/LINQ-to-Twitter-v5.md b/LINQ-to-Twitter-v5.md new file mode 100644 index 00000000..d78b5c18 --- /dev/null +++ b/LINQ-to-Twitter-v5.md @@ -0,0 +1,76 @@ +## Twitter API v1.1 + +This page has all of the API endpoints for the Twitter API v1.1. Eventually, the Twitter API team will deprecate these and move them to Twitter API v2.0. To see the latest Twitter API v2.0 endpoints, visit [LINQ to Twitter v6](LINQ-to-Twitter-v6.md). + +### [LINQ to Twitter Entities](LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md) + +This section lists the entities returned by LINQ to Twitter. The Twitter API returns JSON that LINQ to Twitter packages up into entities. These entities contain return properties. + +### [Twitter API Map](LINQ-to-Twitter-5/Twitter-API-Map.md) + +LINQ to Twitter supports 100% of the Twitter API. This map will help you navigate LINQ to Twitter and the Twitter API. + +### [Managing Accounts](LINQ-to-Twitter-5/Managing-Accounts.md) + +The account API's allow you to manage your Twitter account + +### [Blocking Users](LINQ-to-Twitter-5/Blocking-Users.md) + +This section shows you how to block users that you don't want to see your status. + +### [Working with Direct Messages](LINQ-to-Twitter-5/Working-with-Direct-Messages.md) + +This section shows you how to send private messages between you and others + +### [Querying Favorites](LINQ-to-Twitter-5/Querying-Favorites.md) + +Twitter lets you manage favorites, which is supported here too. + +### [Handling Friendships](LINQ-to-Twitter-5/Handling-Friendships.md) + +This section explains how to work with friendships + +### [Getting Geographical Information](LINQ-to-Twitter-5/Getting-Geographical-Information.md) + +You can obtain info on places associated with geographical information + +### [Using Help Methods](LINQ-to-Twitter-5/Using-Help-Methods.md) + +This method is for testing Twitter connectivity. + +### [Managing Lists](LINQ-to-Twitter-5/Managing-Lists.md) + +Lists allow you to categorize Twitter accounts. + +### [Uploading Media](LINQ-to-Twitter-5/Uploading-Media.md) + +Posting images and video. + +### [Muting Users](LINQ-to-Twitter-5/Mutating-Users.md) + +Lets a user turn off tweets from another account without unfollowing. + +### [Managing Saved Searches](LINQ-to-Twitter-5/Managing-Saved-Searches.md) + +You can save searches and reuse them later. + +### [Performing Searches and Finding Trends](LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md) + +You'll learn how LINQ to Twitter supports search and trends in this section. + +### [Making Status Queries and Calls](LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md) + +The status queries match both Twitter timeline queries and working with statuses + +### [Getting User Information](LINQ-to-Twitter-5/Getting-User-Information.md) + +You can get information on users, their friends, and their followers + +### [Streaming Twitter Content](LINQ-to-Twitter-5/Streaming-Twitter-Content.md) + +Stream Twitter content + +### [Safety Hatch](LINQ-to-Twitter-5/Safety-Hatch.md) + +If something isn't quite right or available, you still have a work around. + diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md new file mode 100644 index 00000000..10b50866 --- /dev/null +++ b/LINQ-to-Twitter-v6.md @@ -0,0 +1 @@ +Work in progress... \ No newline at end of file diff --git a/index.md b/index.md index 12d23923..492232a2 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,6 @@ Welcome to LINQ to Twitter documentation. Here, you'll find the technical information you'll need to use LINQ to Twitter in your own applications. We have a FAQ, general Twitter API concepts, a Twitter API technical reference, security information, and error handling. -Note: The current version of LINQ to Twitter is v6.0, which tracks .NET 5+ and the Twitter API v2. It also offers Twitter API v1.1 support. Please see [[LINQ to Twitter v5.x]] for Twitter API v1.1 technical endpoint documentation. +Note: The current version of LINQ to Twitter is v6.0, which tracks .NET 5+ and the Twitter API v2. It also offers Twitter API v1.1 support. Please see [LINQ to Twitter v5](LINQ-to-Twitter-v5.md) for Twitter API v1.1 technical endpoint documentation. ## [LINQ to Twitter FAQ](LINQ-to-Twitter-FAQ.md) @@ -10,7 +10,7 @@ Frequently asked questions. Some introductory information on programming Twitter. -## [[LINQ to Twitter v6.0]] +## [LINQ to Twitter v6](LINQ-to-Twitter-v6.md) This is the main API section, where the technical descriptions of objects, methods, and other features of LINQ to Twitter are covered. From 356d02b866d4f84608819927ebac0821b14a90ea Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 22:09:44 +0000 Subject: [PATCH 17/95] Update Tweets.md --- LINQ-to-Twitter-6/Tweets.md | 23 +++++++++++++++++++++++ LINQ-to-Twitter-6/Users.md | 9 +++++++++ LINQ-to-Twitter-v6.md | 16 +++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Tweets.md create mode 100644 LINQ-to-Twitter-6/Users.md diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md new file mode 100644 index 00000000..13f48e3c --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets.md @@ -0,0 +1,23 @@ +## Tweets + +Queries for anything you can do with a Tweet such as Lookup, Searches, and Streams. + +### [[Lookup]] + +Get information on one or more tweets. + +### [[Recent Search]] + +Search for tweets that occurred within the last week. + +### Filtered Stream + +Read a real-time stream of tweets, based on your search criteria. Coming soon... + +### Sample Stream + +Read a real-time stream sampling around 1% of public tweets. Coming soon... + +### [[Hide Replies]] + +Hides/Unhides replies to a tweet. \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users.md b/LINQ-to-Twitter-6/Users.md new file mode 100644 index 00000000..de77a362 --- /dev/null +++ b/LINQ-to-Twitter-6/Users.md @@ -0,0 +1,9 @@ +Anything you need for looking up users, their accounts, and profile details. + +### [[Lookup by ID]] + +Search for one or more users by ID + +### [[Lookup by Username]] + +Search for one or more users by username \ No newline at end of file diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md index 10b50866..dc57143a 100644 --- a/LINQ-to-Twitter-v6.md +++ b/LINQ-to-Twitter-v6.md @@ -1 +1,15 @@ -Work in progress... \ No newline at end of file +## LINQ to Twitter v6 APIs + +This page outlines the sections that correspond to the Twitter API. It will be useful to see how to perform commands and queries with LINQ to Twitter. Additionally, you might want to review [The Official Twitter API v2 Documentation](https://developer.twitter.com/en/docs/twitter-api/early-access) for the true source of information on parameters, return values, and more. + +### Fundamentals + +Information for Data Dictionary, Fields, Expansions, Tweet Annotations, Metrics, Conversation ID, and Rate Limits. Coming soon... + +### [Tweets](LINQ-to-Twitter-6/Tweets.md) + +Queries for anything you can do with a Tweet such as Lookup, Searches, and Streams. + +### [Users](LINQ-to-Twitter-6/Users.md) + +Anything you need for looking up users, their accounts, and profile details. \ No newline at end of file From f979a7572108558b97c36fd17e8c78ad625a64bc Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 22:22:16 +0000 Subject: [PATCH 18/95] Update Users.md --- LINQ-to-Twitter-6/Tweets.md | 6 +- LINQ-to-Twitter-6/Tweets/Hide-Replies.md | 46 +++++++++++++ LINQ-to-Twitter-6/Tweets/Lookup.md | 58 +++++++++++++++++ LINQ-to-Twitter-6/Tweets/Recent-Search.md | 64 +++++++++++++++++++ LINQ-to-Twitter-6/Users.md | 4 +- LINQ-to-Twitter-6/Users/Lookup-by-ID.md | 38 +++++++++++ LINQ-to-Twitter-6/Users/Lookup-by-Username.md | 38 +++++++++++ 7 files changed, 249 insertions(+), 5 deletions(-) create mode 100644 LINQ-to-Twitter-6/Tweets/Hide-Replies.md create mode 100644 LINQ-to-Twitter-6/Tweets/Lookup.md create mode 100644 LINQ-to-Twitter-6/Tweets/Recent-Search.md create mode 100644 LINQ-to-Twitter-6/Users/Lookup-by-ID.md create mode 100644 LINQ-to-Twitter-6/Users/Lookup-by-Username.md diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index 13f48e3c..f40bc771 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -2,11 +2,11 @@ Queries for anything you can do with a Tweet such as Lookup, Searches, and Streams. -### [[Lookup]] +### [Lookup](Tweets/Lookup.md) Get information on one or more tweets. -### [[Recent Search]] +### [Recent Search](Tweets/Recent-Search.md) Search for tweets that occurred within the last week. @@ -18,6 +18,6 @@ Read a real-time stream of tweets, based on your search criteria. Coming soon... Read a real-time stream sampling around 1% of public tweets. Coming soon... -### [[Hide Replies]] +### [Hide Replies](Tweets/Hide-Replies.md) Hides/Unhides replies to a tweet. \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Hide-Replies.md b/LINQ-to-Twitter-6/Tweets/Hide-Replies.md new file mode 100644 index 00000000..b69e282a --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Hide-Replies.md @@ -0,0 +1,46 @@ +#### Hide Replies + +Hides/Unhides replies to a tweet. + +##### Signature: + +```c# +public async Task HideReplyAsync(string tweetID, CancellationToken cancelToken = default); + +public async Task UnHideReplyAsync(string tweetID, CancellationToken cancelToken = default); +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| tweetID | ID of the replying tweet | string | yes | +| cancelationToken | Optional cancellation token | CancellationToken | no | + +**Return Type:** bool - The hidden status of the tweet: `true` if not hidden or `false` if hidden + +**Note:** Will receive 403 Forbidden if tweetID is for a tweet that is not a reply. + +##### Example: + +```c# +static async Task HideReplyAsync(TwitterContext twitterCtx) +{ + const string TweetID = "1327749647515881473"; + + bool isHidden = await twitterCtx.HideReplyAsync(TweetID); + + Console.WriteLine($"Is Hidden: {isHidden}"); +} + +static async Task UnHideReplyAsync(TwitterContext twitterCtx) +{ + const string TweetID = "1327749647515881473"; + + bool isHidden = await twitterCtx.UnHideReplyAsync(TweetID); + + Console.WriteLine($"Is Hidden: {isHidden}"); +} +``` + +*Twitter API:* [tweets/hide-replies/api-reference/put-tweets-id-hidden](https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/api-reference/put-tweets-id-hidden) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Lookup.md b/LINQ-to-Twitter-6/Tweets/Lookup.md new file mode 100644 index 00000000..c70e1853 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Lookup.md @@ -0,0 +1,58 @@ +#### Querying Statuses + +Get information on one or more tweets. + +*Entity:* Tweet|Tweet Entity + +*Type:* StatusType.Lookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| Ids | Up to 100 comma-separated IDs to search for | string | yes | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +```c# +const string TweetID = "1305895383260782593"; + +// default is id and text and this also brings in created_at and geo +string tweetFields = + string.Join(",", + new string[] + { + TweetField.CreatedAt, + TweetField.ID, + TweetField.Text, + TweetField.Geo + }); + +TweetQuery? tweetResponse = + await + (from tweet in twitterCtx.Tweets + where tweet.Type == TweetType.Lookup && + tweet.Ids == TweetID && + tweet.TweetFields == TweetField.AllFieldsExceptPermissioned && + tweet.Expansions == ExpansionField.AllTweetFields && + tweet.MediaFields == MediaField.AllFieldsExceptPermissioned && + tweet.PlaceFields == PlaceField.AllFields && + tweet.PollFields == PollField.AllFields && + tweet.UserFields == UserField.AllFields + select tweet) + .SingleOrDefaultAsync(); + +if (tweetResponse?.Tweets != null) + tweetResponse.Tweets.ForEach(tweet => + Console.WriteLine( + $"\nUser: {tweet.ID}" + + $"\nTweet: {tweet.Text}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [tweets/lookup/api-reference](https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Recent-Search.md b/LINQ-to-Twitter-6/Tweets/Recent-Search.md new file mode 100644 index 00000000..07f8ed14 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Recent-Search.md @@ -0,0 +1,64 @@ +#### Recent Search + +Search for tweets that occurred within the last week. + +*Entity:* TwitterSearch|TwitterSearch Entity + +*Type:* SearchType.RecentSearch + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| EndTime | Date/Time to search to | DateTime | no | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| NextToken | Provide this, when paging, to get the next page of results | string | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| Query | Search query | string | yes | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UntilID | Return tweets whose ids are less than this | string | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +```c# +string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo"; + +// default is id and text and this also brings in created_at and geo +string tweetFields = + string.Join(",", + new string[] + { + TweetField.CreatedAt, + TweetField.ID, + TweetField.Text, + TweetField.Geo + }); + +TwitterSearch? searchResponse = + await + (from search in twitterCtx.TwitterSearch + where search.Type == SearchType.RecentSearch && + search.Query == searchTerm && + search.TweetFields == TweetField.AllFieldsExceptPermissioned && + search.Expansions == ExpansionField.AllTweetFields && + search.MediaFields == MediaField.AllFieldsExceptPermissioned && + search.PlaceFields == PlaceField.AllFields && + search.PollFields == PollField.AllFields && + search.UserFields == UserField.AllFields + select search) + .SingleOrDefaultAsync(); + +if (searchResponse?.Tweets != null) + searchResponse.Tweets.ForEach(tweet => + Console.WriteLine( + $"\nUser: {tweet.ID}" + + $"\nTweet: {tweet.Text}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [tweets/search/api-reference/get-tweets-search-recent](https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users.md b/LINQ-to-Twitter-6/Users.md index de77a362..8c149c22 100644 --- a/LINQ-to-Twitter-6/Users.md +++ b/LINQ-to-Twitter-6/Users.md @@ -1,9 +1,9 @@ Anything you need for looking up users, their accounts, and profile details. -### [[Lookup by ID]] +### [Lookup by ID](Users/Lookup-by-ID.md) Search for one or more users by ID -### [[Lookup by Username]] +### [Lookup by Username](Users/Lookup-by-Username.md) Search for one or more users by username \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users/Lookup-by-ID.md b/LINQ-to-Twitter-6/Users/Lookup-by-ID.md new file mode 100644 index 00000000..9bb2aa46 --- /dev/null +++ b/LINQ-to-Twitter-6/Users/Lookup-by-ID.md @@ -0,0 +1,38 @@ +Search for one or more users by ID. + +*Entity:* TwitterUser|TwitterUser Entity + +*Type:* UserType.IdLookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| Ids | Up to 100 comma-separated IDs to search for | string | yes | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: + +```c# +static async Task LookupByUserIDAsync(TwitterContext twitterCtx) +{ + TwitterUserQuery? userResponse = + await + (from user in twitterCtx.TwitterUser + where user.Type == UserType.IdLookup && + user.Ids == "15411837,16761255" && + user.Expansions == ExpansionField.AllUserFields && + user.TweetFields == TweetField.AllFieldsExceptPermissioned && + user.UserFields == UserField.AllFields + select user) + .SingleOrDefaultAsync(); + + if (userResponse != null) + userResponse.Users?.ForEach(user => + Console.WriteLine("Name: " + user.Username)); +} +``` + +*Twitter API:* [users](https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users/Lookup-by-Username.md b/LINQ-to-Twitter-6/Users/Lookup-by-Username.md new file mode 100644 index 00000000..99589e23 --- /dev/null +++ b/LINQ-to-Twitter-6/Users/Lookup-by-Username.md @@ -0,0 +1,38 @@ +Search for one or more users by username. + +*Entity:* TwitterUser|TwitterUser Entity + +*Type:* UserType.UsernameLookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| Usernames | Up to 100 comma-separated usernames to search for | string | yes | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: + +```c# +static async Task LookupByUsernameAsync(TwitterContext twitterCtx) +{ + TwitterUserQuery? userResponse = + await + (from user in twitterCtx.TwitterUser + where user.Type == UserType.UsernameLookup && + user.Usernames == "JoeMayo,Linq2Twitr" && + user.Expansions == ExpansionField.AllUserFields && + user.TweetFields == TweetField.AllFieldsExceptPermissioned && + user.UserFields == UserField.AllFields + select user) + .SingleOrDefaultAsync(); + + if (userResponse != null) + userResponse.Users?.ForEach(user => + Console.WriteLine("Name: " + user.Username)); +} +``` + +*Twitter API:* [users/by/username](https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by-username-username) \ No newline at end of file From 22989a9cac9513481ed959fcb3b0e2473e4efe1b Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 27 Nov 2020 22:24:14 +0000 Subject: [PATCH 19/95] Update LINQ-to-Twitter-v5.md --- LINQ-to-Twitter-v5.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-v5.md b/LINQ-to-Twitter-v5.md index d78b5c18..03959d78 100644 --- a/LINQ-to-Twitter-v5.md +++ b/LINQ-to-Twitter-v5.md @@ -46,7 +46,7 @@ Lists allow you to categorize Twitter accounts. Posting images and video. -### [Muting Users](LINQ-to-Twitter-5/Mutating-Users.md) +### [Muting Users](LINQ-to-Twitter-5/Muting-Users.md) Lets a user turn off tweets from another account without unfollowing. From 418dc77c8600f564833be48ab680b3784a2343a0 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 01:26:46 +0000 Subject: [PATCH 20/95] Update LINQ-to-Twitter-Entities.md --- LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md | 91 +++++++++---------- .../Account-Entity.md | 16 ++++ .../BannerSize-Entity.md | 14 +++ .../LINQ-to-Twitter-Entities/Blocks-Entity.md | 19 ++++ .../Category-Entity.md | 15 +++ .../Configuration-Entity.md | 17 ++++ .../Contributor-Entity.md | 13 +++ .../Coordinate-Entity.md | 14 +++ .../Cursors-Entity.md | 12 +++ .../DirectMessageEvents-Entity.md | 16 ++++ .../Entities-Entity.md | 15 +++ .../Favorites-Entity.md | 17 ++++ .../Friendship-Entity.md | 26 ++++++ .../LINQ-to-Twitter-Entities/Geo-Entity.md | 24 +++++ .../Geometry-Entity.md | 12 +++ .../LINQ-to-Twitter-Entities/Help-Entity.md | 14 +++ .../LINQ-to-Twitter-Entities/List-Entity.md | 39 ++++++++ .../Location-Entity.md | 18 ++++ .../LINQ-to-Twitter-Entities/Media-Entity.md | 14 +++ .../MediaImage-Entity.md | 13 +++ .../LINQ-to-Twitter-Entities/Mute-Entity.md | 16 ++++ .../PhotoSize-Entity.md | 14 +++ .../LINQ-to-Twitter-Entities/Place-Entity.md | 19 ++++ .../RateLimitStatus-Entity.md | 14 +++ .../LINQ-to-Twitter-Entities/Raw-Entity.md | 12 +++ .../RelatedResults-Entity.md | 33 +++++++ .../Relationship-Entity.md | 22 +++++ .../SavedSearch-Entity.md | 16 ++++ .../LINQ-to-Twitter-Entities/Search-Entity.md | 27 ++++++ .../SearchMetaData-Entity.md | 16 ++++ .../Settings-Entity.md | 17 ++++ .../SleepTime-Entity.md | 13 +++ .../SocialGraph-Entity.md | 17 ++++ .../LINQ-to-Twitter-Entities/Status-Entity.md | 42 +++++++++ .../LINQ-to-Twitter-Entities/TZInfo-Entity.md | 13 +++ .../LINQ-to-Twitter-Entities/Totals-Entity.md | 14 +++ .../LINQ-to-Twitter-Entities/Trend-Entity.md | 24 +++++ .../TwitterHashResponse-Entity.md | 12 +++ .../LINQ-to-Twitter-Entities/User-Entity.md | 62 +++++++++++++ .../UserEntity-Entity.md | 12 +++ .../UserIdentifier-Entity.md | 13 +++ 41 files changed, 798 insertions(+), 49 deletions(-) create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Account-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/BannerSize-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Blocks-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Category-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Configuration-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Contributor-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Coordinate-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Cursors-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Entities-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Favorites-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Friendship-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geo-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geometry-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Help-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/List-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Location-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Media-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/MediaImage-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Mute-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/PhotoSize-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Place-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RateLimitStatus-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Raw-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RelatedResults-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Relationship-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SavedSearch-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Search-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SearchMetaData-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Settings-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SleepTime-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SocialGraph-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Status-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TZInfo-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Totals-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Trend-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TwitterHashResponse-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/User-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserEntity-Entity.md create mode 100644 LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserIdentifier-Entity.md diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md index 8664127b..1e35b154 100644 --- a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities.md @@ -2,173 +2,166 @@ This section lists the entities returned by LINQ to Twitter. The Twitter API returns JSON that LINQ to Twitter packages up into entities. These entities contain return properties. -*Note:* _The term entities is overloaded. From the LINQ to Twitter perspective, entities refers to objects converted from JSON into C# types. From the Twitter perspective, entities provide details about links, hashtags, media, and mentions within the text of a tweet._ +*Note:* _The term `entities` is overloaded. From the LINQ to Twitter perspective, entities refers to objects converted from JSON into C# types. From the Twitter perspective, entities provide details about links, hashtags, media, and mentions within the text of a tweet._ -### [[Account Entity]] +### [Account Entity](LINQ-to-Twitter-Entities/Account-Entity.md) The account entity contains properties about accounts -### [[BannerSize Entity]] +### [BannerSize Entity](LINQ-to-Twitter-Entities/BannerSize-Entity.md) Allowable size for a banner. -### [[Blocks Entity]] +### [Blocks Entity](LINQ-to-Twitter-Entities/Blocks-Entity.md) The blocks entity contains properties about blocks -### [[Category Entity]] +### [Category Entity](LINQ-to-Twitter-Entities/Category-Entity.md) The category entity contains properties about categories -### [[Configuration Entity]] +### [Configuration Entity](LINQ-to-Twitter-Entities/Configuration-Entity.md) The configuration entity contains properties about help configuration information -### [[Contributor Entity]] +### [Contributor Entity](LINQ-to-Twitter-Entities/Contributor-Entity.md) The contributor entity contains properties about contributors -### [[Coordinate Entity]] +### [Coordinate Entity](LINQ-to-Twitter-Entities/Coordinate-Entity.md) The coordinate entity contains properties about coordinate information -### [[Cursors Entity]] +### [Cursors Entity](LINQ-to-Twitter-Entities/Cursors-Entity.md) The cursors entity contains properties about cursors -### [[DirectMessage Entity]] - -The direct message entity contains properties about direct messages - -### [[DirectMessageEvents Entity]] +### [DirectMessageEvents Entity](LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md) The direct message events entity contains properties about direct message events -### [[Entities Entity]] +### [Entities Entity](LINQ-to-Twitter-Entities/Entities-Entity.md) Contains parsed Hashtag, Media, Url, User, and Symbol entities in a tweet -### [[Favorites Entity]] +### [Favorites Entity](LINQ-to-Twitter-Entities/Favorites-Entity.md) The favorites entity contains properties about favorites -### [[Friendship Entity]] +### [Friendship Entity](LINQ-to-Twitter-Entities/Friendship-Entity.md) The friendship entity contains properties about friendships -### [[Geo Entity]] +### [Geo Entity](LINQ-to-Twitter-Entities/Geo-Entity.md) -The geo entity contains properties about geographical information +The Geo entity contains properties about geographical information -### [[Geometry Entity]] +### [Geometry Entity](LINQ-to-Twitter-Entities/Geometry-Entity.md) The geometry entity contains properties about bounding box geometry -### [[Help Entity]] +### [Help Entity](LINQ-to-Twitter-Entities/Help-Entity.md) The help entity contains properties about help information -### [[List Entity]] +### [List Entity](LINQ-to-Twitter-Entities/List-Entity.md) The list entity contains properties about lists -### [[Location Entity]] +### [Location Entity](LINQ-to-Twitter-Entities/Location-Entity.md) The location entity contains properties about locations -### [[Media Entity]] +### [Media Entity](LINQ-to-Twitter-Entities/Media-Entity.md) Details on an uploaded image -### [[MediaImage Entity]] +### [MediaImage Entity](LINQ-to-Twitter-Entities/MediaImage-Entity.md) Physical aspects of an image -### [[Mute Entity]] +### [Mute Entity](LINQ-to-Twitter-Entities/Mute-Entity.md) Supports Muting Users -### [[PhotoSize Entity]] +### [PhotoSize Entity](LINQ-to-Twitter-Entities/PhotoSize-Entity.md) The photo size entity contains properties about photo sizes -### [[Place Entity]] +### [Place Entity](LINQ-to-Twitter-Entities/Place-Entity.md) The place entity contains properties about places -### [[RateLimitStatus Entity]] +### [RateLimitStatus Entity](LINQ-to-Twitter-Entities/RateLimitStatus-Entity.md) The rate limit status entity contains properties about rate limit status -### [[Raw Entity]] +### [Raw Entity](LINQ-to-Twitter-Entities/Raw-Entity.md) Supports Raw Queries -### [[Relationship Entity]] +### [Relationship Entity](LINQ-to-Twitter-Entities/Relationship-Entity.md) The relationship entity contains properties about relationships -### [[RelatedResults Entity]] +### [RelatedResults Entity](LINQ-to-Twitter-Entities/RelatedResults-Entity.md) The related results entity contains properties about related results -### [[SavedSearch Entity]] +### [SavedSearch Entity](LINQ-to-Twitter-Entities/SavedSearch-Entity.md) The saved search entity contains properties about saved searches -### [[Search Entity]] +### [Search Entity](LINQ-to-Twitter-Entities/Search-Entity.md) The search entry entity contains properties about searches -### [[SearchMetaData Entity]] +### [SearchMetaData Entity](LINQ-to-Twitter-Entities/SearchMetaData-Entity.md) Additional information associated with search results -### [[Settings Entity]] +### [Settings Entity](LINQ-to-Twitter-Entities/Settings-Entity.md) The settings entity contains properties about account settings -### [[SleepTime Entity]] +### [SleepTime Entity](LINQ-to-Twitter-Entities/SleepTime-Entity.md) The sleep time entity contains properties about sleep time settings -### [[SocialGraph Entity]] +### [SocialGraph Entity](LINQ-to-Twitter-Entities/SocialGraph-Entity.md) The social graph entity contains properties about social graphs -### [[Status Entity]] +### [Status Entity](LINQ-to-Twitter-Entities/Status-Entity.md) The status entity contains properties about tweets -### [[Totals Entity]] +### [Totals Entity](LINQ-to-Twitter-Entities/Totals-Entity.md) The totals entity contains properties about account totals -### [[Trend Entity]] +### [Trend Entity](LINQ-to-Twitter-Entities/Trend-Entity.md) The trend entity contains properties about trends -### [[TwitterHashResponse Entity]] +### [TwitterHashResponse Entity](LINQ-to-Twitter-Entities/TwitterHashResponse-Entity.md) The Twitter hash response entity contains properties about Twitter hash responses -### [[TZInfo Entity]] +### [TZInfo Entity](LINQ-to-Twitter-Entities/TZInfo-Entity.md) The time zone info entity contains properties about time zone settings -### [[User Entity]] +### [User Entity](LINQ-to-Twitter-Entities/User-Entity.md) The user entity contains properties about user information -### [[UserEntity Entity]] +### [UserEntity Entity](LINQ-to-Twitter-Entities/UserEntity-Entity.md) This object contains entities for the user profile, including description and url fields -### [[UserIdentifier Entity]] +### [UserIdentifier Entity](LINQ-to-Twitter-Entities/UserIdentifier-Entity.md) The user identifier entity contains properties about a specific user -### [[Vine Entity]] - -The vine entity contains properties for vine queries diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Account-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Account-Entity.md new file mode 100644 index 00000000..a0b91f93 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Account-Entity.md @@ -0,0 +1,16 @@ +#### Account Entity + +The account entity contains properties about accounts. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| EndSessionStatus | Response from request to end session | string | no | +| RateLimitStatus | Rate limit status | [[RateLimitStatus|RateLimitStatus Entity]] | no | +| Settings | Account settings | [[Settings|Settings Entity]] | no | +| Totals | Current totals | [[Totals|Totals Entity]] | no | +| Type | Type of account query | AccountType | no | +| User | User returned by VerifyCredentials Queries | [User] | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/BannerSize-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/BannerSize-Entity.md new file mode 100644 index 00000000..20a0610a --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/BannerSize-Entity.md @@ -0,0 +1,14 @@ +#### BannerSize Entity + +A BannerSize contains size and identification information for a banner that displays in a user's account. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Label | Unique name of banner size type | string | no | +| Width | Width of this type of banner | int | no | +| Height | Height of this type of banner | int | no | +| Url | Location for this banner image | string | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Blocks-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Blocks-Entity.md new file mode 100644 index 00000000..0d01b252 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Blocks-Entity.md @@ -0,0 +1,19 @@ +#### Blocks Entity + +The blocks entity contains properties about blocks. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| ID | ID or screen name of user | int | yes | +| IDs | List of blocked IDs | List of string | no | +| ListedCount | Listed count | int | no | +| NoBlock | Twitter response for no block | [[TwitterHashResponse|TwitterHashResponse Entity]] | no | +| Page | Page to retrieve | string | yes | +| ScreenName | Screen name to search | string | yes | +| Type | Type of blocks request | BlocksType | no | +| User | Blocked user | [[User|User Entity]] | no | +| UserID | User ID | string | yes | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Category-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Category-Entity.md new file mode 100644 index 00000000..837eabfc --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Category-Entity.md @@ -0,0 +1,15 @@ +#### Category Entity + +The category entity contains properties about categories. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Categories | List of categories | List of [[Category|Category Entity]] | no | +| Name | Category name | string | no | +| Size | Number of users in category | int | no | +| Slug | Category description | string | no | +| Users | Users in category | List of [[User|User Entity]] | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Configuration-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Configuration-Entity.md new file mode 100644 index 00000000..33a70b8e --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Configuration-Entity.md @@ -0,0 +1,17 @@ +#### Configuration Entity + +The configuration entity contains properties about help configuration information. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| CharactersReservedPerMedia | Characters reserved per media | int | no | +| MaxMediaPerUpload | Max number of items that can be uploaded at one time | int | no | +| NonUserNamePaths | Twitter slugs that are not usernames | List of string | no | +| PhotoSizeLimit | Max photo size | int | no | +| PhotoSizes | Sizing allowances/behaviors for each type of photo | List of [[PhotoSize|PhotoSize Entity]] | no | +| ShortUrlLength | Length of a t.co short URL | int | no | +| ShortUrlLengthHttps | Length of an HTTPS t.co short URL | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Contributor-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Contributor-Entity.md new file mode 100644 index 00000000..e5fc3ad4 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Contributor-Entity.md @@ -0,0 +1,13 @@ +#### Contributor Entity + +The contributor entity contains properties about contributors. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| ID | Contributor ID | ulong | no | +| IDString | Contributor ID as string | string | no | +| ScreenName | Screen name | string | no | + +*Twitter API:* [contributors](https://dev.twitter.com/docs/platform-objects/tweets#obj-contributors) diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Coordinate-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Coordinate-Entity.md new file mode 100644 index 00000000..600717bc --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Coordinate-Entity.md @@ -0,0 +1,14 @@ +#### Coordinate Entity + +The coordinate entity contains properties about coordinate information. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Latitude | Coordinate latitude | double | no | +| Longitude | Coordinate longitude | double | no | +| Type | Coordinate type | string | no | +| IsLocationAvailable | Indicates whether tweet has a valid coordinate | bool | no | + +*Twitter API:* [coordinates](https://dev.twitter.com/docs/platform-objects/tweets#obj-coordinates) diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Cursors-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Cursors-Entity.md new file mode 100644 index 00000000..3a957e83 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Cursors-Entity.md @@ -0,0 +1,12 @@ +#### Cursors Entity + +The cursors entity contains properties about cursors. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Next | Use this value to retrieve next page | string | no | +| Previous | Use this value to go back to the previous page | string | no | + +*Twitter API:* not documented diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md new file mode 100644 index 00000000..29384d5a --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md @@ -0,0 +1,16 @@ +#### DirectMessageEvents Entity + +The direct message events entity contains properties about direct message events. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Count | (List Query): Number of items to return for a single page. | int | yes | +| Cursor | (List Query): Supports paging through results on List queries. | string | yes | +| ID | (Show Query): ID of DM. | ulong | yes | +| RecipientID | (New DM): ID of the user the DM is sent to. | ulong | yes | +| Text | (New DM): DM contents. | string | yes | +| Value | Response from Twitter. | [[DirectMessageEventsValue]] | yes | + +*Twitter API:* [direct_messages/events](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Entities-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Entities-Entity.md new file mode 100644 index 00000000..c3beec65 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Entities-Entity.md @@ -0,0 +1,15 @@ +#### Entities Entity + +Contains parsed Hashtag, Media, Url, User, and Symbol entities in a tweet + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| HashtagEntities | Hastags in the tweet | HashtagEntity | no | +| MediaEntities | Media in the tweet | MediaEntity | no | +| UrlEntities | URLs in the tweet | UrlEntity | no | +| UserEntities | Users in the tweet | UserEntity | no | +| SymbolEntities | Symbols in the tweet | SymbolEntity | no | + +*Twitter API:* N/A - LINQ to Twitter Object \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Favorites-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Favorites-Entity.md new file mode 100644 index 00000000..0412981b --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Favorites-Entity.md @@ -0,0 +1,17 @@ +#### Favorites Entity + +The favorites entity contains properties about favorites. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Count | Number of results | int | yes | +| MaxID | Results no higher than this ID | ulong | yes | +| Page | Page to retrieve | string | yes | +| ScreenName | Screen name to search | string | yes | +| SinceID | Results after this ID | ulong | yes | +| Type | Type of favorites | FavoritesType | yes | +| UserID | User ID to search | string | yes | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Friendship-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Friendship-Entity.md new file mode 100644 index 00000000..73f0c5ba --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Friendship-Entity.md @@ -0,0 +1,26 @@ +#### Friendship Entity + +The friendship entity contains properties about friendships. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Cursor | Helps in paging results | string | no | +| FollowingUser | ID or ScreenName of user to test for following | string | no | +| Friend | Information about friend | [[User|User Entity]] | no | +| IDInfo | List of IDs returned by Incoming and Outgoing queries | string | no | +| IsFriend | FollowingUser is following SubjectUser returned from Twitter | bool | no | +| Relationships | List of relationships from Lookup query | List of [[Relationship|Relationship Entity]] | no | +| ScreenName | Comma-seperated list of screen names for Lookup query | string | no | +| SourceRelationship | Relationship details returned from Twitter for the source | [[Relationship|Relationship Entity]] | no | +| SourceScreenName | ScreenName of source user | string | yes | +| SourceUserID | ID of of source user | string | no | +| SubjectUser | ID or ScreenName of subject user | string | no | +| TargetRelationship | Relationship details returned from Twitter for the target | string | no | +| TargetScreenName | ScreenName of target user | string | yes | +| TargetUserID | ID of target user | string | no | +| Type | Type of friendship | FriendshipType | no | +| Users | Users for either FollowersList FriendsList orqueries | List of [[User|User Entity]]| no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geo-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geo-Entity.md new file mode 100644 index 00000000..988152ac --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geo-Entity.md @@ -0,0 +1,24 @@ +#### Geo Entity + +The geo entity contains properties about geographical information. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Accuracy | How accurate results should be | string | yes | +| Attribute | Name/value pair separated by "=" | string | yes | +| ContainedWithin | Place ID to restrict search to | string | yes | +| Granularity | Size of place | string | yes | +| ID | Place ID |string | no | +| IP | IP address to find nearby places | string | yes | +| Latitude | Coordinate latitude | double | no | +| Longitude | Coordinate longitude | double | no | +| MaxResults | Number of places to return | int | yes | +| PlaceName | Name of place for similar places query | string | no | +| Places | Results showing places matching query | List of [[Place|Place Entity]] | no | +| Query | Search text to help find place | string | yes | +| Token | Place token from similar places used to create place | string | yes (CreatePlace) / no (SimilarPlaces) | +| Type | Type of Geo query | GeoType | no | + +*Twitter API:* not documented diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geometry-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geometry-Entity.md new file mode 100644 index 00000000..b78fce2b --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Geometry-Entity.md @@ -0,0 +1,12 @@ +#### Geometry Entity + +The geometry entity contains properties about bounding box geometry. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Coordinates | Bounding box coordinates | List of [[Coordinate|Coordinates Entity]] | no | +| Type | Type of bounding box | string | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Help-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Help-Entity.md new file mode 100644 index 00000000..fbe060d6 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Help-Entity.md @@ -0,0 +1,14 @@ +#### Help Entity + +The help entity contains properties about help information. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +#### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Configuration | Populated for Help Configuration query | [[Configuration|Configuration Entity]] | no | +| Languages | List of languages, codes, and statuses | int | no | +| OK | True if help test succeeds | bool | no | +| Type | Help type | HelpType | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/List-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/List-Entity.md new file mode 100644 index 00000000..9328f795 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/List-Entity.md @@ -0,0 +1,39 @@ +#### List Entity + +The list entity contains properties about lists. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Count | Number of statuses per page | int | yes | +| CreatedAt | List creation date | DateTime | no | +| Cursor | Helps page results | string | yes | +| CursorMovement | Cursors for current request | [[Cursors|Cursors Entity]] | no | +| Description | List description | string | yes | +| FilteredToOwnedLists | Only return lists belonging to user | bool | yes | +| Following | Whether user follows list | bool | no | +| FullName | Full list name | string | no | +| ListID | List ID | string | yes | +| ListIDResult | List ID returned from Twitter | string | no | +| MaxID | Max ID to retrieve for statuses | ulong | yes | +| MemberCount | Number of members | int | no | +| Mode | List mode | string | yes | +| Name | Short name of list | string | yes | +| OwnerID | ID of list owner | string | yes | +| OwnerScreenName | Screen name of list owner | string | yes | +| Page | Page number to return | int | no | +| ScreenName | User screen name | string | yes | +| SinceID | Statuses since this ID | string | yes | +| Slug | Catchword for list | string | yes | +| SlugResult | Catchword for list returned from Twitter | string | no | +| Statuses | Statuses for list | List of [[Status|Status Entity]] | no | +| SubscriberCount | Number of subscribers | string | no | +| TrimUser | Truncate all user infor, except for ID | string | yes | +| Type | Type of List query to perform | ListType | no | +| Uri | List URI | string | no | +| UserID | User ID | string | yes | +| Users | Users associated with list | List of [[User|User Entity]] | no | + + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Location-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Location-Entity.md new file mode 100644 index 00000000..4562a136 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Location-Entity.md @@ -0,0 +1,18 @@ +#### Location Entity + +The location entity contains properties about locations. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Country | Location country | string | no | +| CountryCode | Country code | string | no | +| Name | Name of location | string | no | +| ParentID | Parent location relative to current location | string | no | +| PlaceTypeName | Type of location | string | no | +| PlaceTypeNameCode | Code for PlaceTypeName | int | no | +| Url | Yahoo location URL | string | no | +| WoeID | Yahoo Where On Earth ID | string | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Media-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Media-Entity.md new file mode 100644 index 00000000..09bf80e5 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Media-Entity.md @@ -0,0 +1,14 @@ +#### Media Entity + +The Media entity contains information about a media upload to Twitter and is the return value from UploadMediaAsync. It helps identify the uploaded media for subsequent attachment to a tweet via TweetAsync. + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Image | Physical details on the uploaded image | [[MediaImage|MediaImage Entity]] | no | +| MediaID | Twitter identifier for the image | ulong | no | +| Size | Size in bytes of the image | int | no | +| VideoInfo | More info for "video" media types in Extended Entities | VideoInfo | no | + +*Twitter API:* [see example response from media/upload](https://dev.twitter.com/rest/reference/post/media/upload) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/MediaImage-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/MediaImage-Entity.md new file mode 100644 index 00000000..afa05758 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/MediaImage-Entity.md @@ -0,0 +1,13 @@ +#### MediaImage Entity + +The MediaImage entity contains the physical details of an Media item. + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Height | Height of image | int | no | +| Width | Width of image | int | no | +| ImageType | HTTP content type of image | string | no | + +*Twitter API:* [see example response from media/upload](https://dev.twitter.com/rest/reference/post/media/upload) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Mute-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Mute-Entity.md new file mode 100644 index 00000000..1f2850b3 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Mute-Entity.md @@ -0,0 +1,16 @@ +#### Mute Entity + +The Mute entity contains properties supporting the Mute API. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Cursor | Allows you to page through query results | long | yes | +| CursorMovement | Cursors for current request | [[Cursors|Cursors Entity]] | no | +| IDList | List of ids that are muted, populated by IDs query | List | no | +| IncludeEntitites | Set to true for Twitter to return entity metadata with users last tweet | bool | yes| +| SkipStatus | Set to true to remove tweet from user entities | bool | yes | +| Users | List of User that are muted, populated by List query | List<[[User|User Entity]]> | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/PhotoSize-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/PhotoSize-Entity.md new file mode 100644 index 00000000..e6230c96 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/PhotoSize-Entity.md @@ -0,0 +1,14 @@ +#### PhotoSize Entity + +The photo size entity contains properties about photo sizes. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Height | Photo height | int | no | +| Resize | Resize behavior | string | no | +| Type | Type of photo size | string | no | +| Width | Photo width | int | no | + +*Twitter API:* not documented diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Place-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Place-Entity.md new file mode 100644 index 00000000..fb962577 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Place-Entity.md @@ -0,0 +1,19 @@ +#### Place Entity + +The place entity contains properties about places. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Attributes | Metadata related to place | Dictionary | no | +| BoundingBox | Coordinates that enclose place | [[Geometry|Geometry Entity]] | no | +| Country | Name of country | string | no | +| CountryCode | Country code abbreviation | string | no | +| FullName | Full name of place | string | no | +| Name | Place name | string | no | +| ID | Contributor ID | ulong | no | +| PlaceType | Type of place - neighborhood, city, country, etc. | string | no | +| Url | URL to get more details on place | string | no | + +*Twitter API:* [place](https://dev.twitter.com/docs/platform-objects/places) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RateLimitStatus-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RateLimitStatus-Entity.md new file mode 100644 index 00000000..1c701bfd --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RateLimitStatus-Entity.md @@ -0,0 +1,14 @@ +#### RateStatusLimit Entity + +The rate status limit entity contains properties about rate status limits. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| HourlyLimit | Hourly limit | int | no | +| RemainingHits | Remaining hits | int | no | +| ResetTime | When limits reset | DateTime | no | +| ResetTimeInSeconds | When limits reset in second | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Raw-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Raw-Entity.md new file mode 100644 index 00000000..9f53ad71 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Raw-Entity.md @@ -0,0 +1,12 @@ +#### Raw Entity + +The Raw entity supports Raw queries. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| QueryString | URL segments + parameters | string | yes | +| Response | Raw JSON response from Twitter | string | no | + +*Twitter API:* None - LINQ to Twitter type \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RelatedResults-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RelatedResults-Entity.md new file mode 100644 index 00000000..1255c5cf --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/RelatedResults-Entity.md @@ -0,0 +1,33 @@ +#### RelatedResults Entity + +The related results entity contains properties about related results. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Contributors | List of contributors to tweet | List of [[Contributor|Contributors Entity]] | no | +| Coordinates | Latitude and longitude of tweet | [[Coordinate|Coordinates Entity]] | no | +| CreatedAt | Tweet creation date | DateTime | no | +| Favorited | Whether tweet is favorited | bool | no | +| Geo | Geographical location of result | [[Geo|Geo Entity]] | no | +| IDString | Status ID as string | string | no | +| InReplyToScreenName | Screen name of replier | string | no | +| InReplyToStatusID | Status ID pf replier | ulong | no | +| InReplyToUserID | User ID of replier | ulong | no | +| InReplyToUserIDString | User ID as string of replier | string | no | +| Kind | Kind | string | no | +| Place | Place info from where tweet originated | [[Place|Place Entity]] | no | +| ResultAnnotations | Result annotations | Annotation | no | +| RetweetCount | Number of retweets | int | no | +| Retweeted | Whether tweet has been retweeted | bool | no | +| Score | Score | double | no | +| Source | What software or application produced tweet | string | no | +| StatusID | Tweet ID | ulong | yes | +| Text | Tweet text | string | no | +| Truncated | Whether it is truncated | bool | no | +| Type | Type of result | string | no | +| User | Information on user who tweeteed | [[User|User Entity]] | no | +| ValueAnnotations | Tweet annotations | Annotation | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Relationship-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Relationship-Entity.md new file mode 100644 index 00000000..6a47c2d1 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Relationship-Entity.md @@ -0,0 +1,22 @@ +#### Relationship Entity + +The relationship entity contains properties about relationships. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| AllReplies | Whether to show all replies | string | no | +| Blocking | Whether this user is blocking the other | bool | no | +| CanDM | Allowed to send direct messages | bool | no | +| Connections | Relationships between user and other | List of string | no | +| FollowedBy | Whether user is followed by the other | bool | no | +| Following | Whether user is following the other | bool | no | +| ID | User ID | string | no | +| MarkedSpam | Marked as spam | bool | no | +| Name | User name | string | no | +| NotificationsEnabled | Whether notifications are enabled | bool | no | +| RetweetsWanted | Whether user wants retweets from person they follow | bool | no | +| ScreenName | User screen name | string | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SavedSearch-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SavedSearch-Entity.md new file mode 100644 index 00000000..e1a59b5a --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SavedSearch-Entity.md @@ -0,0 +1,16 @@ +#### SavedSearch Entity + +The saved search entity contains properties about saved searches. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| CreatedAt | When search was created | DateTime | no | +| ID | Saved search ID | string | yes | +| IDString | Saved search ID as string | string | no | +| Name | Name of search | string | no | +| Position | Position in search list | int | no | +| Query | Search query | string | yes | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Search-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Search-Entity.md new file mode 100644 index 00000000..a4ff64ad --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Search-Entity.md @@ -0,0 +1,27 @@ +#### Search Entity + +The search entity contains properties about searches. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Count | Number of tweets to retrieve for each page. Max is 100. | int | no | +| Geocode | Location specified as "latitude,longitude,radius" | string | yes | +| IncludeEntities | Omits entities when set to false. Default is true. | bool | no | +| Lang | Language to return tweets in as defined by [ISO-639-1](http://en.wikipedia.org/wiki/ISO_639-1). | string | no | +| Locale | Language of search query | string | yes | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| Query | Search query | string | yes | +| RefreshUrl | Query string to refresh this search | string | no | +| ResultType | Metadata for type of result - mixed, recent, or popular | string | yes | +| SearchLanguage | Returns tweets of specified language | string | yes | +| SearchMetadata | Additional information about query | [[SearchMetaData|SearchMetaData Entity]] | no | +| SinceID | Return tweets later than this ID | ulong | yes | +| SinceIDResult | SinceID returned from Twitter | ulong | no | +| Statuses | Tweet data returned from search | List of [[Status|Status Entity]] | no | +| Type | Type of search | SearchType | yes | +| Until | Return tweets until this date | DateTime | yes | + + +*Twitter API:* [tweets](https://dev.twitter.com/docs/platform-objects/tweets) diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SearchMetaData-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SearchMetaData-Entity.md new file mode 100644 index 00000000..886b779e --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SearchMetaData-Entity.md @@ -0,0 +1,16 @@ +#### SearchMetaData Entity + +Additional information associated with search results. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| CompletedIn | Processing time for search | decimal | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| NextResults| Url to next search page | string | no | +| Query | Original query | string | no | +| RefreshUrl | Query string to refresh this search | string | no | +| SinceID | Return tweets later than this ID | ulong | no | + +*Twitter API:* Not Documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Settings-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Settings-Entity.md new file mode 100644 index 00000000..a81454e2 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Settings-Entity.md @@ -0,0 +1,17 @@ +#### Settings Entity + +The settings entity contains properties about account settings. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| AlwaysUseHttps | Whether to always use HTTPS | bool | no | +| DiscoverableByEmail | Whether user is discoverable by email | bool | no | +| GeoEnabled | Whether Geo Tracking is on | bool | no | +| Language | User's UI language | string | no | +| SleepTime | Times not to notify | [[SleepTime|SleepTime Entity]] | no | +| TimeZone | User's timezone | [[TZInfo|TZInfo Entity]] | no | +| TrendLocation | Location to display trends for | [[Location|Location Entity]] | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SleepTime-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SleepTime-Entity.md new file mode 100644 index 00000000..338b6d5f --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SleepTime-Entity.md @@ -0,0 +1,13 @@ +#### SleepTime Entity + +The sleep time entity contains properties about sleep time settings. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Enabled | Whether sleep time is turned on | bool | no | +| EndHour | Resume sending notifications at this time | int | no | +| StartHour | Stop sending notifications at this time | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SocialGraph-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SocialGraph-Entity.md new file mode 100644 index 00000000..ffd8246c --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/SocialGraph-Entity.md @@ -0,0 +1,17 @@ +#### SocialGraph Entity + +The social graph entity contains properties about social graphs. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Cursor | Indicator for which page to get next | string | yes | +| CursorMovement | Contains Next and Previous cursors | [[Cursors|Cursors Entity]]| no | +| ID | User ID or ScreenName to retrieve lists for | string | no | +| IDs | List of IDs | List of string | no | +| ScreenName | ScreenName to retrieve lists for | string | yes | +| Type | Type of request | SocialGraphType | no | +| UserID | User ID to retrieve lists for | string | yes | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Status-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Status-Entity.md new file mode 100644 index 00000000..d640c98d --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Status-Entity.md @@ -0,0 +1,42 @@ +#### Status Entity (aka Tweet) + +The status entity contains properties about tweets. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Annotation | Meta-data applied to tweet | Annotation | no | +| CreatedAt | Tweet creation date (UTC) | DateTime | no | +| Contributors | List of contributors | List of [[Contributors|Contributors Entity]] | no | +| Coordinates | Coordinate information | [[Coordinates|Coordinates Entity]] | no | +| Count | Number of tweets to return; max is 200 | int | yes | +| CurrentUserRetweet | ID of source status of retweet if IncludeMyRetweet is true. Set to 0 if IncludeMyRetweet is false or tweet not retweeted by authenticating user | int | yes | +| Entities | Entities connected to the status | [[Entities|Entities Entity]] | no | +| ExcludeReplies | Exclude tweet replies | bool | yes | +| FavoriteCount | Number of times the tweet was favorite | int? | no | +| Favorited | Whether the status is Favorited or not | bool | no | +| ID | Tweet ID | string | yes | +| IncludeContributorDetails | Include more than just contributor ID | bool | no | +| InReplyToScreenName | Screen name of user being replied to | string | no | +| InReplyToStatusID | ID of status being replied to | string | no | +| InReplyToUserID | ID of user being replied to | string | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | yes | +| Page | Page to retrieve | int | yes | +| Place | Place where status was created | [[Place|Place Entity]] | no | +| PossiblySensitive | Whether tweet is possibly sensitive or not | bool | no | +| RetweetCount | Number of times retweeted | int | no | +| Retweeted | Whether status has been retweeted or not | bool | no | +| RetweetedStatus | Whether it was a retweet of a retweeted status | [[Status|Status Entity]] | no | +| ScreenName | Screen name | string | no | +| SinceID | Return tweets later than this ID | ulong | yes | +| Source | Source of the tweet | string | no | +| StatusID | Status ID | string | no | +| Text | Tweet text | string | no | +| TrimUser | Return only user status ID and tweet | bool | yes | +| Truncated | Whether the tweet is truncated or not | bool | no | +| User | User information | [[User|User Entity]] | no | +| Users | List of User | List of [[User|User Entity]] | no | +| UserID | User ID | string | yes | + +*Twitter API:* [tweets](https://dev.twitter.com/docs/platform-objects/tweets) diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TZInfo-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TZInfo-Entity.md new file mode 100644 index 00000000..eb2b748c --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TZInfo-Entity.md @@ -0,0 +1,13 @@ +#### TZInfo Entity + +The time zone info entity contains properties about time zone settings. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Name | Timezone name | string | no | +| TzInfoName | Rails/unix TZINFO name | string | no | +| UtcOffset | Second to subtract from UTC time | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Totals-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Totals-Entity.md new file mode 100644 index 00000000..ee082dd3 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Totals-Entity.md @@ -0,0 +1,14 @@ +#### Totals Entity + +The totals entity contains properties about account totals. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Favorites | Total favorites | int | no | +| Followers | Total followers | int | no | +| Friends | Total friends | int | no | +| Updates | Total updates | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Trend-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Trend-Entity.md new file mode 100644 index 00000000..b8172453 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/Trend-Entity.md @@ -0,0 +1,24 @@ +#### Trend Entity + +The trend entity contains properties about trends. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| AsOf | Time of request | DateTime | no | +| Date | Start date | DateTime | no | +| Events | Trend events | string | no | +| ExcludeHashtags | Exclude all trends with hashtags | bool | no | +| Latitude | Latitude | string | no | +| Location | Location where trend is occurring | [[Location|Location Entity]] | no | +| Locations | Lists locations of trending topics | List of [[Location|Location Entity]] | no | +| Longitude | Longitude | string | no | +| Name | Name of trend topic | string | no | +| PromotedContent | Flag indicating this is a promoted trend | string | no | +| Query | Twitter search query on topic | string | no | +| SearchUrl | Search URL returned from Local Trends | string | no | +| TrendDate | Date/hour of trend | DateTime | no | +| WeoID | Yahoo Where On Earth ID | int | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TwitterHashResponse-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TwitterHashResponse-Entity.md new file mode 100644 index 00000000..e5a59664 --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/TwitterHashResponse-Entity.md @@ -0,0 +1,12 @@ +#### TwitterHashResponse Entity + +The Twitter hash response entity contains properties about Twitter hash responses. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Error | Error response message | string | no | +| Request | URL action from request | string | no | + +*Twitter API:* not documented \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/User-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/User-Entity.md new file mode 100644 index 00000000..62ae958a --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/User-Entity.md @@ -0,0 +1,62 @@ +#### User Entity + +The user entity contains properties about user information. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| BannerSizes | List of banner sizes | List of [[BannerSize|BannerSize Entity]] | no | +| Categories | Twitter Suggested Users categories | List of [[Category|Category Entity]] | no | +| CreatedAt | Tweet creation date | string | no | +| ContributorsEnabled | Whether contributors is enabled | bool | no | +| Cursor | Which page to retrieve - Previous or Next | string | no | +| CursorMovement | Contains Previous and Next cursors | [[Cursors|Cursors Entity]] | no | +| DefaultProfile | User's profile has not been configured | bool | no | +| DefaultProfileImage | Whether it is default placeholder image | bool | no | +| Description | User description | string | no | +| Email | Email address | string | no | +| FavoritesCount | Number of favorites | int | no | +| FollowersCount | Number of followers | int | no | +| Following | Whether authenticated user is following this user | bool | no | +| FollowRequestSent | Whether authenticated user has sent request to follow this user | bool | no | +| FriendsCount | Number of friends | int | no | +| GeoEnabled | Whether geo track is supported | bool | no | +| ID | User's Twitter ID | string | yes | +| Identifier | Identity properties of specific user | [[UserIdentifier|UserIdentifier Entity]] | no | +| Lang | Display language | string | yes | +| LangResponse | Language to return results as | string | no | +| ListedCount | Number of lists user is a member of | int | no | +| Location | User location | string | no | +| Name | Name of user | string | no | +| Notifications | Type of device notifications | bool | no | +| Page | Page to retrieve | int | yes | +| PerPage | Number of users per page | int | yes | +| ProfileBackgroundColor | Background color of profile | string | no | +| ProfileBackgroundImageUrl | Background image URL of profile | string | no | +| ProfileBackgroundImageUrlHttps | Background profile image used on HTTPS pages | string | no | +| ProfileBackgroundTile | Whether background image tiles | bool | no | +| ProfileImageUrl | User image URL | string | no | +| ProfileImageUrlHttps | Image used on HTTPS pages | string | no | +| ProfileLinkColor | Color of profile links | string | no | +| ProfileSidebarBorderColor | Border color of sidebar | string | no | +| ProfileSidebarFillColor | Background color of profile sidebar | string | no | +| ProfileTextColor | Color of profile text | string | no | +| ProfileUseBackgroundImage | Whether background image is used | bool | no | +| Protected | Whether user is protected | bool | no | +| Query | Search query | string | yes | +| ScreenName | Screen name | string | yes | +| ShowAllInlineMedia | Whether it is enabled | bool | no | +| SkipStatus | Skip status information | bool | yes | +| Slug | Short list name used to identify suggested users category | string | yes | +| Status | User status | string | no | +| StatusCount | Number of user statuses | int | no | +| Url | User URL | string | no | +| TimeZone | Time zone | string | no | +| Translator | Whether user is a translator | bool | no | +| Type | Type of user request - Friends, Followers, Show | UserType | no | +| UserID | User ID | string | yes | +| UtcOffset | UTC offset | int | no | +| Verified | Verified account | bool | no | + +*Twitter API:* [users](https://dev.twitter.com/docs/platform-objects/users) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserEntity-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserEntity-Entity.md new file mode 100644 index 00000000..2a159a6c --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserEntity-Entity.md @@ -0,0 +1,12 @@ +#### UserEntity Entity + +This object contains entities for the user profile, including description and url fields + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Urls | URL Entity in the User profile URL | [[Entities|Entities Entity]] | no | +| Description | URL Entities in the User profile description | [[Entities|Entities Entity]] | no | + +*Twitter API:* N/A - LINQ to Twitter Object \ No newline at end of file diff --git a/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserIdentifier-Entity.md b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserIdentifier-Entity.md new file mode 100644 index 00000000..76403d6a --- /dev/null +++ b/LINQ-to-Twitter-5/LINQ-to-Twitter-Entities/UserIdentifier-Entity.md @@ -0,0 +1,13 @@ +#### UserIdentifier Entity + +The user identifier entity contains properties about a specific user. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| ID | User's Twitter ID | string | no | +| ScreenName | User's ScreenName | string | no | +| UserID | User ID for disambiguating when ID is screen name | string | no | + +*Twitter API:* not documented \ No newline at end of file From c495850d4aea8cfc6df748708dcc30765f3e0922 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 05:16:31 +0000 Subject: [PATCH 21/95] Update Managing-Accounts.md --- LINQ-to-Twitter-5/Managing-Accounts.md | 16 ++-- .../Removing-the-Profile-Banner.md | 35 +++++++++ .../Showing-Account-Settings.md | 50 +++++++++++++ .../Updating-Profile-Colors.md | 67 +++++++++++++++++ .../Updating-Profile-Information.md | 63 ++++++++++++++++ .../Updating-a-Profile-Image.md | 49 ++++++++++++ .../Verifying-Credentials.md | 75 +++++++++++++++++++ 7 files changed, 347 insertions(+), 8 deletions(-) create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Removing-the-Profile-Banner.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Showing-Account-Settings.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Colors.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Information.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Updating-a-Profile-Image.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Verifying-Credentials.md diff --git a/LINQ-to-Twitter-5/Managing-Accounts.md b/LINQ-to-Twitter-5/Managing-Accounts.md index b5f2cba9..9bd458fe 100644 --- a/LINQ-to-Twitter-5/Managing-Accounts.md +++ b/LINQ-to-Twitter-5/Managing-Accounts.md @@ -2,34 +2,34 @@ The account API's allow you to manage your Twitter account -#### [[Verifying Credentials]] +#### [Verifying Credentials](Managing-Accounts/Verifying-Credentials.md) Check to see that a user's credentials are okay -#### [[Showing Account Settings]] +#### [Showing Account Settings](Managing-Accounts/Showing-Account-Settings.md) Show account settings -#### [[Updating Profile Colors]] +#### [Updating Profile Colors](Managing-Accounts/Updating-Profile-Colors.md) Set color scheme for user's profile -#### [[Updating a Profile Image]] +#### [Updating a Profile Image](Managing-Accounts/Updating-a-Profile-Image.md) Sets user's profile image -#### [[Updating Profile Information]] +#### [Updating Profile Information](Managing-Accounts/Updating-Profile-Information.md) Set various profile information items -#### [[Updating Account Settings]] +#### [Updating Account Settings](Managing-Accounts/Updating-Account-Settings.md) Update the user's account settings -#### [[Updating the Profile Banner]] +#### [Updating the Profile Banner](Managing-Accounts/Updating-the-Profile-Banner.md) Update the user's profile banner image -#### [[Removing the Profile Banner]] +#### [Removing the Profile Banner](Managing-Accounts/Removing-the-Profile-Banner.md) Delete the user's profile banner image diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Removing-the-Profile-Banner.md b/LINQ-to-Twitter-5/Managing-Accounts/Removing-the-Profile-Banner.md new file mode 100644 index 00000000..876e025c --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Removing-the-Profile-Banner.md @@ -0,0 +1,35 @@ +#### Removing the Profile Banner + +Deletes the user's profile banner. + +##### Signature: + +```c# +public async Task RemoveProfileBannerAsync() +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| None | - | - | - | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + var user = await twitterCtx.RemoveProfileBannerAsync(); + + if (user != null) + Console.WriteLine("Profile Banner: " + user.ProfileBannerUrl ?? "None"); +``` + +##### v2.1 Example: + +```c# + var user = twitterCtx.RemoveProfileBanner(); + Console.WriteLine("Profile Banner: " + user.ProfileBannerUrl ?? "None"); +``` + +*Twitter API:* [account/remove_profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Showing-Account-Settings.md b/LINQ-to-Twitter-5/Managing-Accounts/Showing-Account-Settings.md new file mode 100644 index 00000000..89ed2a2f --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Showing-Account-Settings.md @@ -0,0 +1,50 @@ +#### Showing Account Settings + +Show account settings. + +*Entity:* [[Account|Account Entity]] +*Type:* AccountType.Settings + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var settingsResponse = + await + (from acct in twitterCtx.Account + where acct.Type == AccountType.Settings + select acct) + .SingleOrDefaultAsync(); + + if (settingsResponse?.Settings?.SleepTime != null) + { + var settings = settingsResponse.Settings; + + Console.WriteLine( + "Trend Location: {0}\nGeo Enabled: {1}\nSleep Enabled: {2}", + settings.TrendLocation.Name, + settings.GeoEnabled, + settings.SleepTime.Enabled); + } +``` + +##### v2.1 Example: + +```c# + var accountSettings = + (from acct in twitterCtx.Account + where acct.Type == AccountType.Settings + select acct.Settings) + .SingleOrDefault(); + + Console.WriteLine( + "Trend Location: {0}\nGeo Enabled: {1}\nSleep Enabled: {2}", + accountSettings.TrendLocation.Name, + accountSettings.GeoEnabled, + accountSettings.SleepTime.Enabled); +``` + +*Twitter API:* [account/settings](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Colors.md b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Colors.md new file mode 100644 index 00000000..44e35ff3 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Colors.md @@ -0,0 +1,67 @@ +#### Updating Profile Colors + +Set color scheme for user's profile. + +##### Signature: + +```c# + public async Task UpdateAccountColorsAsync( + string background, string text, string link, string sidebarFill, + string sidebarBorder, bool skipStatus) + public async Task UpdateAccountColorsAsync( + string background, string text, string link, string sidebarFill, + string sidebarBorder, bool includeEntities, bool skipStatus) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| background | Background color | string | no | +| link | Link color | string | no | +| includeEntities | Add entities to response (default: true) | bool | no | +| sidebarBorder | Sidebar border color | string | no | +| sidebarFill | Sidebar fill color | string | no | +| skipStatus | Exclude status information | bool | no | +| text | Text color | string | no | + +Note: Colors are specified as hex RGB - "#rrggbb". At least one parameter must be specified. + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + var user = await twitterCtx.UpdateAccountColorsAsync( + background: null, text: "#000000", link: "#0000ff", + sidebarFill: "#e0ff92", sidebarBorder: "#87bc44", + includeEntities: true, skipStatus: true); + + if (user != null) + { + Console.WriteLine("\nAccount Colors:\n"); + + Console.WriteLine("Background: " + user.ProfileBackgroundColor); + Console.WriteLine("Text: " + user.ProfileTextColor); + Console.WriteLine("Link: " + user.ProfileLinkColor); + Console.WriteLine("Sidebar Fill: " + user.ProfileSidebarFillColor); + Console.WriteLine("Sidebar Border: " + user.ProfileSidebarBorderColor); + } +``` + +##### v2.1 Example: + +```c# +var user = twitterCtx.UpdateAccountColors("9ae4e8", "#000000", "#0000ff", + "#e0ff92", "#87bc44"); + +Console.WriteLine("\nAccount Colors:\n"); + +Console.WriteLine("Background: " + user.ProfileBackgroundColor); +Console.WriteLine("Text: " + user.ProfileTextColor); +Console.WriteLine("Link: " + user.ProfileLinkColor); +Console.WriteLine("Sidebar Fill: " + user.ProfileSidebarFillColor); +Console.WriteLine("Sidebar Border: " + user.ProfileSidebarBorderColor); +``` + +*Twitter API:* [account/update_profile_colors](https://dev.twitter.com/docs/api/1.1/post/account/update_profile_colors) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Information.md b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Information.md new file mode 100644 index 00000000..60423e23 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Profile-Information.md @@ -0,0 +1,63 @@ +#### Updating Profile Information + +Set various profile information items. + +##### Signature: + +```c# +public async Task UpdateAccountProfileAsync( + string name, string url, string location, string description, + bool skipStatus) +public async Task UpdateAccountProfileAsync( + string name, string url, string location, string description, + bool includeEntities, bool skipStatus) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| description | Bio information | string | no | +| includeEntities | Include Twitter entities (default: true) | bool | no | +| location | Location | string | no | +| name | Full name | string | no | +| skipStatus | Exclude status information | bool | no | +| url | Web address | string | no | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + var user = await twitterCtx.UpdateAccountProfileAsync( + "Joe Mayo", + "https://github.com/JoeMayo/LinqToTwitter", + "Las Vegas, NV", + "Testing the Account Profile Update with LINQ to Twitter.", + true, + true); + + if (user != null) + Console.WriteLine( + "Name: {0}\n {1}\nLocation: {2}\nDescription: {3}", + user.Name, user.Url, user.Location, user.Description); +``` + +##### v2.1 Example: + +```c# + var user = twitterCtx.UpdateAccountProfile( + "LINQ to Tweeter", + "https://github.com/JoeMayo/LinqToTwitter", + "Anywhere In The World", + "Testing the LINQ to Twitter Account Profile Update."); + + Console.WriteLine( + "Name: {0}\n {1}\nLocation: {2}\nDescription: {3}", + user.Name, + user.Url, + user.Location, + user.Description); +``` + +*Twitter API:* [account/update_profile](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Updating-a-Profile-Image.md b/LINQ-to-Twitter-5/Managing-Accounts/Updating-a-Profile-Image.md new file mode 100644 index 00000000..4a64a34c --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Updating-a-Profile-Image.md @@ -0,0 +1,49 @@ +#### Updating a Profile Image + +Sets user's profile image. + +##### Signature: + +```c# +public async Task UpdateAccountImageAsync( + byte[] image, string fileName, + string imageType, bool skipStatus) +public async Task UpdateAccountImageAsync( + byte[] image, string fileName, + string imageType, bool includeEntities, bool skipStatus) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| fileName | Image file name | string | no | +| image | Base64-encoded image | byte[] | yes | +| imageFilePath | Image file path | string | no | +| imageType | Image file type | string | no | +| includeEntities | Include Twitter entities (default: true) | bool | no | +| skipStatus | Exclude status information (default: false) | bool | no | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + byte[] imageBytes = File.ReadAllBytes(@"..\..\Images\200xColor_2.png"); + + var user = await twitterCtx.UpdateAccountImageAsync( + imageBytes, "200xColor_2.png", "png", false); + + if (user != null) + Console.WriteLine("User Image: " + user.ProfileImageUrl); +``` + +##### v2.1 Example: + +```c# + var user = twitterCtx.UpdateAccountImage(@"..\..\images\200xColor_2.png"); + + Console.WriteLine("User Image: " + user.ProfileImageUrl); +``` + +*Twitter API:* [account/update_profile_image](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image) diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Verifying-Credentials.md b/LINQ-to-Twitter-5/Managing-Accounts/Verifying-Credentials.md new file mode 100644 index 00000000..6a28845d --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Verifying-Credentials.md @@ -0,0 +1,75 @@ +#### Verifying Credentials + +Check to see that a user's credentials are okay. + +*Entity:* [[Account|Account Entity]] +*Type:* AccountType.VerifyCredentials + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEmail | Includes email address in User entity for VerifyCredentials query (requires Twitter approval) | bool | no | +| IncludeEntities | Include Twitter entities | bool | no | +| SkipStatus | Exclude status information | bool | no | + +##### v3.0 Example: + +```c# + try + { + var verifyResponse = + await + (from acct in twitterCtx.Account + where acct.Type == AccountType.VerifyCredentials + select acct) + .SingleOrDefaultAsync(); + + if (verifyResponse != null && verifyResponse.User != null) + { + User user = verifyResponse.User; + + Console.WriteLine( + "Credentials are good for {0}.", + user.ScreenNameResponse); + } + } + catch (TwitterQueryException tqe) + { + Console.WriteLine(tqe.Message); + } +``` + +##### v2.1 Example: + +```c# + var accounts = + from acct in twitterCtx.Account + where acct.Type == AccountType.VerifyCredentials + select acct; + + try + { + Account account = accounts.SingleOrDefault(); + User user = account.User; + Status tweet = user.Status ?? new Status(); + Console.WriteLine( + "User ID: {0}\nScreen Name: {1}\nTweet: {2}\n Tweet ID: {3}", + user.Identifier.ID, + user.Identifier.ScreenName, + tweet.Text, + tweet.StatusID); + + Console.WriteLine("Account credentials are verified."); + } + catch (WebException wex) + { + Console.WriteLine( + "Twitter did not recognize the credentials. Response from Twitter: " + + wex.Message); + } +``` + +Note: Whenever credentials are okay, Twitter returns the user's Account object. Otherwise, Twitter returns an HTTP 401, which results in an Exception in .NET. + +*Twitter API:* [account/verify_credentials](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials) \ No newline at end of file From 91697c0fdccaeea03857a3e8f6e761d77dc99c28 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 05:21:38 +0000 Subject: [PATCH 22/95] Update Blocking-Users.md --- LINQ-to-Twitter-5/Blocking-Users.md | 8 +-- .../Blocking-Users/Blocking-a-User.md | 51 +++++++++++++++++ .../Blocking-Users/Get-Blocked-IDs.md | 41 ++++++++++++++ .../Blocking-Users/Get-Blocked-Users.md | 48 ++++++++++++++++ .../Blocking-Users/Unblocking-a-User.md | 50 +++++++++++++++++ .../Updating-Account-Settings.md | 55 +++++++++++++++++++ 6 files changed, 249 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md create mode 100644 LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md create mode 100644 LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md create mode 100644 LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Updating-Account-Settings.md diff --git a/LINQ-to-Twitter-5/Blocking-Users.md b/LINQ-to-Twitter-5/Blocking-Users.md index 596c8a24..af1d999a 100644 --- a/LINQ-to-Twitter-5/Blocking-Users.md +++ b/LINQ-to-Twitter-5/Blocking-Users.md @@ -2,18 +2,18 @@ This section shows you how to block users that you don't want to see your status. -#### [[Blocking a User]] +#### [Blocking a User](Blocking-Users/Blocking-a-User.md) Block a user -#### [[Unblocking a User]] +#### [Unblocking a User](Blocking-Users/Unblocking-a-User.md) Unblock a user -#### [[Get Blocked Users]] +#### [Get Blocked Users](Blocking-Users/Get-Blocked-Users.md) Find out who a user is blocking -#### [[Get Blocked IDs]] +#### [Get Blocked IDs](Blocking-Users/Get-Blocked-IDs.md) Get a list of IDs of the people a user is blocking \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md new file mode 100644 index 00000000..6c4e2c3d --- /dev/null +++ b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md @@ -0,0 +1,51 @@ +#### Blocking a User + +Block a user. + +##### Signature: + +```c# +public async Task CreateBlockAsync( + ulong userID, string screenName, bool skipStatus) +public async Task CreateBlockAsync( + ulong userID, string screenName, bool includeEntities, bool skipStatus) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| includeEntities | Include Twitter entities (default: true) | bool | no | +| screenName | Screen name of user to follow | string | only if UserID is empty | +| skipStatus | Exclude status information | bool | no | +| userID | ID of user to follow | string | only if ScreenName is empty | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + Console.Write("User Screen Name to Block: "); + string userName = Console.ReadLine(); + + var user = await twitterCtx.CreateBlockAsync(0, userName, true); + + if (user != null) + Console.WriteLine("User Name: " + user.Name); +``` + + +##### v2.1 Example: + +```c# + Console.Write("User Screen Name to Block: "); + string userName = Console.ReadLine(); + + var user = twitterCtx.CreateBlock(userName); + + if (user == null) return; + + Console.WriteLine("User Name: " + user.Name); +``` + +*Twitter API:* [blocks/create](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md new file mode 100644 index 00000000..23ee1560 --- /dev/null +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md @@ -0,0 +1,41 @@ +#### Get Blocked IDs + +Get a list of IDs of the people a user is blocking + +*Entity:* [[Blocks|Blocks Entity]] +*Type:* BlockingType.Ids + +##### Parameters/Filters: +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Separates results into pages | ulong | no | + +##### v3.0 Example: + +```c# + var result = + await + (from blockItem in twitterCtx.Blocks + where blockItem.Type == BlockingType.Ids + select blockItem) + .SingleOrDefaultAsync(); + + if (result != null && result.IDs != null) + result.IDs.ForEach(block => Console.WriteLine("ID: {0}", block)); +``` + +##### v2.1 Example: + +```c# + var result = + (from blockItem in twitterCtx.Blocks + where blockItem.Type == BlockingType.Ids + select blockItem) + .SingleOrDefault(); + + result.IDs.ForEach(block => Console.WriteLine("ID: {0}", block)); +``` + +Note: Get a single Blocks object and query the IDs collection. + +*Twitter API:* [blocks/ids](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md new file mode 100644 index 00000000..e9f5a053 --- /dev/null +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md @@ -0,0 +1,48 @@ +#### Get Blocked Users + +Find out who a user is blocking. + +*Entity:* [[Blocks|Blocks Entity]] +*Type:* BlockingType.Blocking + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Separates results into pages | ulong | no | +| PerPage | Number of results per page | int | no | +| Page | Page to return. Defaults to first page. | int | no | +| SkipStatus | Exclude status information | bool | no | + +##### v3.0 Example: + +```c# + var blockResponse = + await + (from block in twitterCtx.Blocks + where block.Type == BlockingType.List + select block) + .SingleOrDefaultAsync(); + + if (blockResponse != null && blockResponse.Users != null) + blockResponse.Users.ForEach(user => + Console.WriteLine(user.ScreenNameResponse)); +``` + + +##### v2.1 Example: + +```c# + var block = + (from blockItem in twitterCtx.Blocks + where blockItem.Type == BlockingType.Blocking + select blockItem) + .FirstOrDefault(); + + block.Users.ForEach( + user => Console.WriteLine("User, {0} is blocked.", user.Name)); +``` + +Note: Get a single Blocks object and query the Users collection. + +*Twitter API:* [blocks/list](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md new file mode 100644 index 00000000..8678d89f --- /dev/null +++ b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md @@ -0,0 +1,50 @@ +#### Unblocking a User + +Unblock a user. + +##### Signature: + +```c# +public async Task DestroyBlockAsync( + ulong userID, string screenName, bool skipStatus) +public async Task DestroyBlockAsync( + ulong userID, string screenName, bool includeEntities, bool skipStatus) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| includeEntities | Set to false to not include entities (default: true) | bool | no | +| screenName | Screen name of user to follow | string | only if UserID is empty | +| skipStatus | Exclude status information | bool | no | +| userID | ID of user to follow | string | only if ScreenName is empty | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + Console.Write("User Screen Name to Unblock: "); + string userName = Console.ReadLine(); + + var user = await twitterCtx.DestroyBlockAsync(0, userName, true); + + if (user != null) + Console.WriteLine("User Name: " + user.Name); +``` + +##### v2.1 Example: + +```c# + Console.Write("User Screen Name to Unblock: "); + string userName = Console.ReadLine(); + + var user = twitterCtx.DestroyBlock(userName); + + if (user == null) return; + + Console.WriteLine("User Name: " + user.Name); +``` + +*Twitter API:* [blocks/destroy](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Updating-Account-Settings.md b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Account-Settings.md new file mode 100644 index 00000000..67f6ff26 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Updating-Account-Settings.md @@ -0,0 +1,55 @@ +#### Updating Account Settings + +Update the user's account settings. All parameters are optional, but at least one must be passed. + +##### Signature: + +```c# +public async Task UpdateAccountSettingsAsync( + int? trendLocationWoeid, bool? sleepTimeEnabled, int? + startSleepTime, int? endSleepTime, string timeZone, string lang) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| endSleepTime | Hour to end sleep time | int | no | +| lang | Language | string | no | +| sleepTimeEnabled | Enable sleep time | bool | no | +| startSleepTime | Hour to start sleep time | int | no | +| timeZone | Timezone to display | string | no | +| trendLocationWOEID | Yahoo! Where On Earth ID | string | no | + +*Return Type:* [[Account|Account Entity]] + +##### v3.0 Example: + +```c# + Account acct = + await twitterCtx.UpdateAccountSettingsAsync( + null, true, 20, 6, null, null); + + if (acct != null && + acct.Settings != null && + acct.Settings.SleepTime != null) + { + SleepTime sleep = acct.Settings.SleepTime; + Console.WriteLine( + "Enabled: {0}, Start: {1}, End: {2}", + sleep.Enabled, sleep.StartHour, sleep.EndHour); + } +``` + +##### v2.1 Example: + +```c# +Account acct = twitterCtx.UpdateAccountSettings(null, true, 20, 6, null, null); + +SleepTime sleep = acct.Settings.SleepTime; +Console.WriteLine( + "Enabled: {0}, Start: {1}, End: {2}", + sleep.Enabled, sleep.StartHour, sleep.EndHour); +``` + +*Twitter API:* [account/settings](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings) \ No newline at end of file From 37338c99b1744a7f93f017be06d1b771bb16122d Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 05:23:11 +0000 Subject: [PATCH 23/95] Update Managing-Accounts.md --- .../Updating-the-Profile-Banner.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 LINQ-to-Twitter-5/Managing-Accounts/Updating-the-Profile-Banner.md diff --git a/LINQ-to-Twitter-5/Managing-Accounts/Updating-the-Profile-Banner.md b/LINQ-to-Twitter-5/Managing-Accounts/Updating-the-Profile-Banner.md new file mode 100644 index 00000000..de66264c --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Accounts/Updating-the-Profile-Banner.md @@ -0,0 +1,50 @@ +#### Updating the Profile Banner + +Update the user's profile banner. + +##### Signature: + +```c# +public async Task UpdateProfileBannerAsync( + byte[] banner, CancellationToken cancelToken = default(CancellationToken)) +public async Task UpdateProfileBannerAsync( + byte[] banner, int width, int height, int offsetLeft, int offsetTop, + CancellationToken cancelToken = default(CancellationToken)) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| banner | Banner image bytes | byte[] | yes | +| width | Width of banner | int | no | +| height | Height of banner | int | no | +| offsetLeft | Pixels from left to begin cropping image | int | no | +| offsetTop | Pixels from top to begin cropping image | int | no | +| cancelToken| Allows async cancellation | CancellationToken | no | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + byte[] fileBytes = File.ReadAllBytes(@"..\..\images\WP_000003.jpg"); + + var user = + await twitterCtx.UpdateProfileBannerAsync( + fileBytes, 1252, 626, 0, 0); + + if (user != null) + Console.WriteLine("User Image: " + user.ProfileBannerUrl); +``` + +##### v2.1 Example: + +```c# + byte[] fileBytes = Utilities.GetFileBytes(@"..\..\images\WP_000003.jpg"); + var user = twitterCtx.UpdateProfileBanner(fileBytes, "WP_000003.jpg", "jpg", 1252, 626, 0, 0); + + Console.WriteLine("User Image: " + user.ProfileBannerUrl); +``` + +*Twitter API:* [account/update_profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner) \ No newline at end of file From e07016a81587d297e0286f3520a24f789a7c70db Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 22:30:05 +0000 Subject: [PATCH 24/95] Update Working-with-Direct-Messages.md --- .../Working-with-Direct-Messages.md | 8 +-- .../Deleting-Direct-Message-Events.md | 43 +++++++++++ .../Listing-Direct-Message-Events.md | 71 +++++++++++++++++++ .../Sending-Direct-Message-Events.md | 40 +++++++++++ .../Showing-Direct-Message-Events.md | 35 +++++++++ 5 files changed, 193 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Working-with-Direct-Messages/Deleting-Direct-Message-Events.md create mode 100644 LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md create mode 100644 LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md create mode 100644 LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages.md index 6d3817c2..ef2fdf92 100644 --- a/LINQ-to-Twitter-5/Working-with-Direct-Messages.md +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages.md @@ -2,18 +2,18 @@ This section shows you how to send private messages between you and others -#### [[Showing Direct Message Events]] +#### [Showing Direct Message Events](Working-with-Direct-Messages/Showing-Direct-Message-Events.md) Show direct message event information. -#### [[Listing Direct Message Events]] +#### [Listing Direct Message Events](Working-with-Direct-Messages/Listing-Direct-Message-Events.md) List direct message event information. -#### [[Sending Direct Message Events]] +#### [Sending Direct Message Events](Working-with-Direct-Messages/Sending-Direct-Message-Events.md) Send a new direct message event. -#### [[Deleting Direct Message Events]] +#### [Deleting Direct Message Events](Working-with-Direct-Messages/Deleting-Direct-Message-Events.md) Learning how to delete a direct message event. diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Deleting-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Deleting-Direct-Message-Events.md new file mode 100644 index 00000000..2f1ef88c --- /dev/null +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Deleting-Direct-Message-Events.md @@ -0,0 +1,43 @@ +#### Deleting Direct Message Events + +Learning how to delete a direct message event. + +*Requires Authentication:* Yes +*Rate Limited:* Yes + +##### Signature: + +```c# +async Task DeleteDirectMessageEventAsync( + ulong directMessageID, CancellationToken cancelToken = default(CancellationToken)); +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| directMessageID | ID of direct message to delete. | ulong | yes | +| cancelToken | Async cancellation token. | bool | no | + +*Return Type:* None + +##### v4.x+ Example: + +```c# + Console.Write("Which DM would you like to delete? (please enter DM ID): "); + string dmInput = Console.ReadLine(); + + ulong.TryParse(dmInput, out ulong dmID); + + try + { + await twitterCtx.DeleteDirectMessageEventAsync(dmID); + Console.WriteLine("\nDM Deleted"); + } + catch (TwitterQueryException tqEx) + { + Console.WriteLine($"\nProblem deleting DM: ({tqEx.ErrorCode}) - {tqEx.ReasonPhrase}"); + } +``` + +*Twitter API:* [direct_messages/events/destroy](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md new file mode 100644 index 00000000..37ccb6d7 --- /dev/null +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md @@ -0,0 +1,71 @@ +#### Listing Direct Message Events + +Show direct message events information. Includes DMs to and from a user. + +*Entity:* [[DirectMessageEvents|DirectMessageEvents Entity]] +*Type:* DirectMessageEventsType.List + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of items to return for a single page. | int | no | +| Cursor| Supports paging through results on List queries. | string | no | + +##### v4.x Example: + +```c# + int count = 10; // intentionally set to a low number to demo paging + string cursor = ""; + List allDmEvents = new List(); + + // you don't have a valid cursor until after the first query + DirectMessageEvents dmResponse = + await + (from dm in twitterCtx.DirectMessageEvents + where dm.Type == DirectMessageEventsType.List && + dm.Count == count + select dm) + .SingleOrDefaultAsync(); + + allDmEvents.AddRange(dmResponse.Value.DMEvents); + cursor = dmResponse.Value.NextCursor; + + while (!string.IsNullOrWhiteSpace(cursor)) + { + dmResponse = + await + (from dm in twitterCtx.DirectMessageEvents + where dm.Type == DirectMessageEventsType.List && + dm.Count == count && + dm.Cursor == cursor + select dm) + .SingleOrDefaultAsync(); + + allDmEvents.AddRange(dmResponse.Value.DMEvents); + cursor = dmResponse.Value.NextCursor; + } + + if (!allDmEvents.Any()) + { + Console.WriteLine("No items returned"); + return; + } + + Console.WriteLine($"Response Count: {allDmEvents.Count}"); + Console.WriteLine("Responses:"); + + allDmEvents.ForEach(evt => + { + MessageCreate msgCreate = evt.MessageCreate; + + if (evt != null && msgCreate != null) + Console.WriteLine( + "From ID: {0}\nTo ID: {1}\nMessage Text: {2}", + msgCreate.SenderID ?? "None", + msgCreate.Target?.RecipientID ?? "None", + msgCreate.MessageData?.Text ?? "None"); + }); +``` + +*Twitter API:* [direct_messages/events/list](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md new file mode 100644 index 00000000..02a2d20a --- /dev/null +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md @@ -0,0 +1,40 @@ +#### Sending Direct Message Events + +Send a direct message. + +##### Signature: + +```C# +public async Task NewDirectMessageEventAsync(ulong recipientID, string text, CancellationToken cancelToken = default(CancellationToken)) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| recipientID | ID of user to send to. | ulong | yes | +| text | Direct message contents. | string | yes | + +*Return Type:* [DirectMessageEvents|DirectMessageEvents Entity] + +##### v 4.x Example: + +```C# + const ulong Linq2TwitrID = 15411837; + + DirectMessageEvents message = + await twitterCtx.NewDirectMessageEventAsync( + Linq2TwitrID, + "DM from @JoeMayo to @Linq2Twitr of $MSFT & $TSLA with #TwitterAPI #chatbot " + + "at http://bit.ly/2xSJWJk and http://amzn.to/2gD09X6 on " + DateTime.Now + "!'"); + + DMEvent dmEvent = message?.Value?.DMEvent; + if (dmEvent != null) + Console.WriteLine( + "Recipient: {0}, Message: {1}, Date: {2}", + dmEvent.MessageCreate.Target.RecipientID, + dmEvent.MessageCreate.MessageData.Text, + dmEvent.CreatedTimestamp); +``` + +*Twitter API:* [direct_messages/events/new](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md new file mode 100644 index 00000000..a986e8a1 --- /dev/null +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md @@ -0,0 +1,35 @@ +#### Showing Direct Message Events + +Show direct message events information. + +*Entity:* [[DirectMessageEvents|DirectMessageEvents Entity]] +*Type:* DirectMessageEventsType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Direct message event ID | ulong | yes | + +##### v4.x Example: + +```c# + DirectMessageEvents dmResponse = + await + (from dm in twitterCtx.DirectMessageEvents + where dm.Type == DirectMessageEventsType.Show && + dm.ID == 917929712638246916 + select dm) + .SingleOrDefaultAsync(); + + MessageCreate msgCreate = dmResponse?.Value?.DMEvent?.MessageCreate; + + if (dmResponse != null && msgCreate != null) + Console.WriteLine( + "From ID: {0}\nTo ID: {1}\nMessage Text: {2}", + msgCreate.SenderID ?? "None", + msgCreate.Target.RecipientID ?? "None", + msgCreate.MessageData.Text ?? "None"); +``` + +*Twitter API:* [direct_messages/events/show](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event) \ No newline at end of file From 0827fe23c48abd88b49a060448e2f92c7785aa37 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 22:34:07 +0000 Subject: [PATCH 25/95] Update Querying-Favorites.md --- LINQ-to-Twitter-5/Querying-Favorites.md | 6 +- .../Querying-Favorites/Creating-a-Favorite.md | 43 ++++++++++++++ .../Destroying-a-Favorite.md | 43 ++++++++++++++ .../Getting-a-List-of-Favorites.md | 57 +++++++++++++++++++ 4 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md create mode 100644 LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md create mode 100644 LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md diff --git a/LINQ-to-Twitter-5/Querying-Favorites.md b/LINQ-to-Twitter-5/Querying-Favorites.md index bc154bb3..5024bc13 100644 --- a/LINQ-to-Twitter-5/Querying-Favorites.md +++ b/LINQ-to-Twitter-5/Querying-Favorites.md @@ -2,14 +2,14 @@ Twitter lets you manage favorites, which is supported here too. -#### [[Getting a List of Favorites]] +#### [Getting a List of Favorites](Querying-Favorites/Getting-a-List-of-Favorites.md) Get a list of favorites. -#### [[Creating a Favorite]] +#### [Creating a Favorite](Querying-Favorites/Creating-a-Favorite.md) Favorite a tweet -#### [[Destroying a Favorite]] +#### [Destroying a Favorite](Querying-Favorites/Destroying-a-Favorite.md) Un-favorite a tweet. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md b/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md new file mode 100644 index 00000000..cdfff1f6 --- /dev/null +++ b/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md @@ -0,0 +1,43 @@ +#### Creating a Favorite + +Favorite a status. + +##### Signature: + +```c# +public async Task CreateFavoriteAsync( + ulong id) +public async Task CreateFavoriteAsync( + ulong id, bool includeEntities) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| id | ID of tweet to add to favorites | ulong | yes | +| includeEntities | Include Twitter entities (default: true) | bool | no | + +*Return Type:* [[Status|Status Entity]] + +##### v3.0 Example: + +```c# + var status = await twitterCtx.CreateFavoriteAsync(401033367283453953ul); + + if (status != null) + Console.WriteLine( + "User: {0}, Tweet: {1}", status.User.Name, status.Text); +``` + +##### v2.1 Example: + +```c# + var status = twitterCtx.CreateFavorite("265675496581373952"); + + Console.WriteLine( + "User: {0}, Tweet: {1}", + status.User.Name, status.Text); +``` + +*Twitter API:* [favorites/create](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md b/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md new file mode 100644 index 00000000..3aab1e90 --- /dev/null +++ b/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md @@ -0,0 +1,43 @@ +#### Destroying a Favorite + +Delete a status from favorites. + +##### Signature: + +```c# +public async Task DestroyFavoriteAsync( + ulong id) +public async Task DestroyFavoriteAsync( + ulong id, bool includeEntities) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| id | ID of tweet to remove from favorites | string | yes | +| includeEntities | Include Twitter entities (default: true) | bool | no | + +*Return Type:* [[Status|Status Entity]] + +##### v3.0 Example: + +```c# + var status = + await twitterCtx.DestroyFavoriteAsync( + 401033367283453953ul, true); + + if (status != null) + Console.WriteLine( + "User: {0}, Tweet: {1}", status.User.Name, status.Text); +``` + +##### v2.1 Example: + +```c# + var status = twitterCtx.DestroyFavorite("265675496581373952"); + + Console.WriteLine("User: {0}, Tweet: {1}", status.User.Name, status.Text); +``` + +*Twitter API:* [favorites/destroy](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md b/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md new file mode 100644 index 00000000..c6a1e7a4 --- /dev/null +++ b/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md @@ -0,0 +1,57 @@ +#### Getting a List of Favorites + +Get a list of the last 20 favorites for a user. + +*Entity:* [[Favorites|Favorites Entity]] +*Type:* FavoritesTypes.Favorites + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of tweets to return; max is 200 | int | no | +| IncludeEntities | Include Twitter entities | bool | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| SinceID | Return tweets later than this ID | ulong | no | +| UserID | ID of user | string | only if ScreenName is empty | + +##### v3.0 Example: + +```c# + var favsResponse = + await + (from fav in twitterCtx.Favorites + where fav.Type == FavoritesType.Favorites + select fav) + .ToListAsync(); + + if (favsResponse != null) + favsResponse.ForEach(fav => + { + if (fav != null && fav.User != null) + Console.WriteLine( + "Name: {0}, Tweet: {1}", + fav.User.ScreenNameResponse, fav.Text); + }); +``` + +##### v2.1 Example: + +```c# + var favorites = + (from fav in twitterCtx.Favorites + where fav.Type == FavoritesType.Favorites && + fav.IncludeEntities == true + select fav) + .ToList(); + + foreach (var fav in favorites) + { + Console.WriteLine( + "User Name: {0}, Tweet: {1}", + fav.User.Name, fav.Text); + } +``` + +*Twitter API:* [favorites/list](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create) \ No newline at end of file From e6a609bb3a15ebfe5be3a97a5b7b42eaec798b99 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 29 Nov 2020 22:40:23 +0000 Subject: [PATCH 26/95] Update Handling-Friendships.md --- LINQ-to-Twitter-5/Handling-Friendships.md | 24 +++--- .../Creating-a-Friendship.md | 47 ++++++++++++ .../Destroying-a-Friendship.md | 44 +++++++++++ .../Handling-Friendships/Listing-Followers.md | 48 ++++++++++++ .../Handling-Friendships/Listing-Friends.md | 51 +++++++++++++ .../Looking-Up-Friendships.md | 48 ++++++++++++ .../Handling-Friendships/Showing-Followers.md | 52 +++++++++++++ .../Handling-Friendships/Showing-Friends.md | 75 +++++++++++++++++++ .../Showing-Friendship-Details.md | 59 +++++++++++++++ .../Showing-Incoming-Requests.md | 46 ++++++++++++ .../Showing-No-Retweet-IDs.md | 51 +++++++++++++ .../Showing-Outgoing-Requests.md | 46 ++++++++++++ .../Updating-Friendship-Settings.md | 56 ++++++++++++++ 13 files changed, 635 insertions(+), 12 deletions(-) create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md create mode 100644 LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md diff --git a/LINQ-to-Twitter-5/Handling-Friendships.md b/LINQ-to-Twitter-5/Handling-Friendships.md index 5f2e6daa..59d491d0 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships.md +++ b/LINQ-to-Twitter-5/Handling-Friendships.md @@ -2,50 +2,50 @@ This section explains how to work with friendships -#### [[Creating a Friendship]] +#### [Creating a Friendship](Handling-Friendships/Creating-a-Friendship.md) Follow another user -#### [[Destroying a Friendship]] +#### [Destroying a Friendship](Handling-Friendships/Destroying-a-Friendship.md) Unfollow another user -#### [[Showing Incoming Requests]] +#### [Showing Incoming Requests](Handling-Friendships/Showing-Incoming-Requests.md) Show IDs of all users requesting friendship with logged in user -#### [[Showing Outgoing Requests]] +#### [Showing Outgoing Requests](Handling-Friendships/Showing-Outgoing-Requests.md) Show IDs of all users for whom the logged in user has requested friendship -#### [[Showing Friendship Details]] +#### [Showing Friendship Details](Handling-Friendships/Showing-Friendship-Details.md) Get the details on the relationship between two users -#### [[Updating Friendship Settings]] +#### [Updating Friendship Settings](Handling-Friendships/Updating-Friendship-Settings.md) Update notification settings -#### [[Showing No Retweet IDs]] +#### [Showing No Retweet IDs](Handling-Friendships/Showing-No-Retweet-IDs.md) Show IDs of all users for whom the logged in user doesn't want to see retweets -#### [[Showing Friends]] +#### [Showing Friends](Handling-Friendships/Showing-Friends.md) Get a list of friend User entities -#### [[Showing Followers]] +#### [Showing Followers](Handling-Friendships/Showing-Followers.md) Get a list of follower User entities -#### [[Looking Up Friendships]] +#### [Looking Up Friendships](Handling-Friendships/Looking-Up-Friendships.md) Look up friendship information. -#### [[Listing Friends]] +#### [Listing Friends](Handling-Friendships/Listing-Friends.md) Gets IDs of people being followed by the user -#### [[Listing Followers]] +#### [Listing Followers](Handling-Friendships/Listing-Followers.md) Gets IDs of people following the user \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md b/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md new file mode 100644 index 00000000..42aeccb8 --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md @@ -0,0 +1,47 @@ +#### Creating a Friendship + +Follow another user. + +##### Signature: + +```c# +public async Task CreateFriendshipAsync( + ulong userID, bool follow) +public async Task CreateFriendshipAsync( + string screenName, bool follow) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| follow | Receive notifications about followed user | bool | no | +| screenName | Screen name of user to follow | string | yes | +| userID | ID of user to follow | ulong | yes | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + var user = await twitterCtx.CreateFriendshipAsync("JoeMayo", true); + + if (user != null && user.Status != null) + Console.WriteLine( + "User Name: {0}, Status: {1}", + user.Name, + user.Status.Text); +``` + +##### v2.1 Example: + +```c# +var user = twitterCtx.CreateFriendship("JoeMayo", null, true); + +Console.WriteLine( + "User Name: {0}, Status: {1}", + user.Name, + user.Status.Text); +``` + +*Twitter API:* [friendships/create](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md b/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md new file mode 100644 index 00000000..9a3503fe --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md @@ -0,0 +1,44 @@ +#### Destroying a Friendship + +Unfollow another user. + +##### Signature: + +```c# +public async Task DestroyFriendshipAsync(ulong userID) +public async Task DestroyFriendshipAsync(string screenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| screenName | Screen name of user to follow | string | Yes | +| userID | ID of user to follow | ulong | Yes | + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + var user = await twitterCtx.DestroyFriendshipAsync("Linq2Tweeter"); + + if (user != null && user.Status != null) + Console.WriteLine( + "User Name: {0}, Status: {1}", + user.Name, + user.Status.Text); +``` + +##### v2.1 Example: + +```c# +var user = twitterCtx.DestroyFriendship("LinqToTweeter", null, true); + +Console.WriteLine( + "User Name: {0}, Status: {1}", + user.Name, + user.Status.Text); +``` + +*Twitter API:* [friendships/destroy](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md new file mode 100644 index 00000000..0c4c7c51 --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md @@ -0,0 +1,48 @@ +#### Listing Followers + +Gets IDs of people following the user. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.FollowerIDs + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of IDs to return | int | no | +| Cursor | Separates results into pages | long | no | +| ScreenName | Screen name of user | string | only if userID is empty | +| UserID | ID of user | string | only if screenName is empty | + +##### v3.0 Example: +```c# + var followers = + await + (from follower in twitterCtx.Friendship + where follower.Type == FriendshipType.FollowerIDs && + follower.UserID == "15411837" + select follower) + .SingleOrDefaultAsync(); + + if (followers != null && + followers.IDInfo != null && + followers.IDInfo.IDs != null) + { + followers.IDInfo.IDs.ForEach(id => + Console.WriteLine("Follower ID: " + id)); + } +``` + +##### v2.1 Example: +```c# + var followers = + (from follower in twitterCtx.SocialGraph + where follower.Type == SocialGraphType.Followers && + follower.ID == "15411837" + select follower) + .SingleOrDefault(); + + followers.IDs.ForEach(id => Console.WriteLine("Follower ID: " + id)); +``` + +*Twitter API:* [followers/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md new file mode 100644 index 00000000..c375bd8d --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md @@ -0,0 +1,51 @@ +#### Listing Friends + +Gets IDs of people being followed by the user. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType..FriendsIDs + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of IDs to return | int | no | +| Cursor | Separates results into pages | long | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| UserID | ID of user | string | only if ScreenName is empty | + +##### v3.0 Example: +```c# + var friendList = + await + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.FriendIDs && + friend.ScreenName == "JoeMayo" + select friend) + .SingleOrDefaultAsync(); + + if (friendList != null && + friendList.IDInfo != null && + friendList.IDInfo.IDs != null) + { + friendList.IDInfo.IDs.ForEach(id => + Console.WriteLine("Follower ID: " + id)); + } +``` + +##### v2.1 Example: +```c# + var friendList = + (from friend in twitterCtx.SocialGraph + where friend.Type == SocialGraphType.Friends && + friend.ScreenName == "JoeMayo" + select friend) + .SingleOrDefault(); + + foreach (var id in friendList.IDs) + { + Console.WriteLine("Friend ID: " + id); + } +``` + +*Twitter API:* [friends/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md b/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md new file mode 100644 index 00000000..a87979c8 --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md @@ -0,0 +1,48 @@ +#### Looking Up Friendships + +Look up friendship information. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.Lookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ScreenName | Comma-separated list of Twitter screen names | string | only if UserID is empty | +| UserID | Comma-separated list of Twitter user IDs | string | only if ScreenName is empty | + +##### v3.0 Example: + +```c# + var relationships = + await + (from look in twitterCtx.Friendship + where look.Type == FriendshipType.Lookup && + look.UserID == "15411837,16761255" + select look.Relationships) + .SingleOrDefaultAsync(); + + if (relationships != null) + relationships.ForEach(rel => + Console.WriteLine( + "Relationship to " + rel.ScreenName + + ", is Following: " + rel.Following + + ", Followed By: " + rel.FollowedBy)); +``` + +##### v2.1 Example: + +```c# + var relationships = + (from look in twitterCtx.Friendship + where look.Type == FriendshipType.Lookup && + look.UserID == "15411837,16761255" + select look.Relationships) + .SingleOrDefault(); + + relationships.ForEach(rel => Console.WriteLine( + "Relationship to " + rel.ScreenName + " is Following: " + rel.Following + " Followed By: " + rel.FollowedBy)); +``` + +*Twitter API:* [friendships/lookup](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md new file mode 100644 index 00000000..5d14506b --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md @@ -0,0 +1,52 @@ +#### Showing Followers + +Gets User entities for followers. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.FollowersList + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Supports paging through multiple result sets | long | no | +| IncludeUserEntities | False to leave entities out (default: true) | bool | no | +| ScreenName | Screen name of user to get friends for | string | only if userID is empty | +| SkipStatus | Don't include User's latest tweet | bool | no | +| UserID | ID of user to get friends for | string | only if screenName is empty | + +##### v3.0 Example: + +```c# + var friendship = + await + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.FollowersList && + friend.ScreenName == "JoeMayo" + select friend) + .SingleOrDefaultAsync(); + + if (friendship != null && friendship.Users != null) + friendship.Users.ForEach(friend => + Console.WriteLine( + "ID: {0} Name: {1}", + friend.UserIDResponse, friend.ScreenNameResponse)); +``` + +##### v2.1 Example: + +```c# + var friendship = + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.FollowersList && + friend.ScreenName == "JoeMayo" + select friend) + .SingleOrDefault(); + + friendship.Users.ForEach(friend => + Console.WriteLine( + "ID: {0} Name: {1}", + friend.Identifier.UserID, friend.Identifier.ScreenName)); +``` + +*Twitter API:* [followers/list](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md new file mode 100644 index 00000000..5134f16d --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md @@ -0,0 +1,75 @@ +#### Showing Friends + +Gets User entities for friends. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.FriendsList + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Max number of friends to return in one request | int | no | +| Cursor | Supports paging through multiple result sets | long | no | +| IncludeUserEntities | False to leave entities out (default: true) | bool | no | +| ScreenName | Screen name of user to get friends for | string | only if userID is empty | +| SkipStatus | Don't include User's latest tweet | bool | no | +| UserID | ID of user to get friends for | string | only if screenName is empty | + +##### v3.0 Example: + +```c# + Friendship friendship; + long cursor = -1; + do + { + friendship = + await + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.FriendsList && + friend.ScreenName == "JoeMayo" && + friend.Cursor == cursor + select friend) + .SingleOrDefaultAsync(); + + if (friendship != null && + friendship.Users != null && + friendship.CursorMovement != null) + { + cursor = friendship.CursorMovement.Next; + + friendship.Users.ForEach(friend => + Console.WriteLine( + "ID: {0} Name: {1}", + friend.UserIDResponse, friend.ScreenNameResponse)); + } + + } while (cursor != 0); +``` + +##### v2.1 Example: + +```c# + Friendship friendship; + string cursor = "-1"; + do + { + friendship = + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.FriendsList && + friend.ScreenName == "JoeMayo" && + friend.Cursor == cursor + select friend) + .SingleOrDefault(); + + cursor = friendship.CursorMovement.Next; + + friendship.Users.ForEach(friend => + Console.WriteLine( + "ID: {0} Name: {1}", + friend.Identifier.UserID, friend.Identifier.ScreenName)); + + } while (cursor != "0"); +``` + +*Twitter API:* [friends/list](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md new file mode 100644 index 00000000..6477cdeb --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md @@ -0,0 +1,59 @@ +#### Showing Friendship Details + +Gets details on the relationship between two users. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| SourceUserID | ID of source user | ulong | only if SourceScreenName is empty | +| SourceScreenName | Screen name of source user | string | only if SourceID is empty | +| TargetUserID | ID of target user | ulong | only if TargetScreenName is empty | +| TargetScreenName | Screen name of target user | string | only if TargetID is empty | + +##### v3.0 Example: + +```c# + var friendship = + await + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.Show && + friend.SourceScreenName == "Linq2Tweeter" && + friend.TargetScreenName == "JoeMayo" + select friend) + .SingleOrDefaultAsync(); + + if (friendship != null && + friendship.SourceRelationship != null && + friendship.TargetRelationship != null) + { + Console.WriteLine( + "\nJoeMayo follows LinqToTweeter: " + + friendship.SourceRelationship.FollowedBy + + "\nLinqToTweeter follows JoeMayo: " + + friendship.TargetRelationship.FollowedBy); + } +``` + +##### v2.1 Example: + +```c# + var friendship = + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.Show && + friend.SourceScreenName == "Linq2Tweeter" && + friend.TargetScreenName == "JoeMayo" + select friend) + .First(); + + Console.WriteLine( + "\nJoeMayo follows LinqToTweeter: " + + friendship.SourceRelationship.FollowedBy + + "\nLinqToTweeter follows JoeMayo: " + + friendship.TargetRelationship.FollowedBy); +``` + +*Twitter API:* [friendships/show](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md new file mode 100644 index 00000000..b3300fdf --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md @@ -0,0 +1,46 @@ +#### Showing Incoming Requests + +Show IDs of all users requesting friendship with logged in user. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.Incoming + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Separates results into pages | long | no | + +*Return Type:* User + +##### v3.0 Example: + +```c# + var request = + await + (from req in twitterCtx.Friendship + where req.Type == FriendshipType.Incoming + select req) + .SingleOrDefaultAsync(); + + if (request != null && + request.IDInfo != null && + request.IDInfo.IDs != null) + { + request.IDInfo.IDs.ForEach(req => Console.WriteLine(req)); + } +``` + +##### v2.1 Example: + +```c# + var request = + (from req in twitterCtx.Friendship + where req.Type == FriendshipType.Incoming + select req) + .FirstOrDefault(); + + request.IDInfo.IDs.ForEach(req => Console.WriteLine(req)); +``` + +*Twitter API:* [friendships/incoming](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md new file mode 100644 index 00000000..e3b79d10 --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md @@ -0,0 +1,51 @@ +#### Showing No Retweet IDs + +Show IDs of all users for whom the logged in user doesn't want to see retweets. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.NoRetweetIDs + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| None | - | - | - | + +*Return Type:* User + +##### v3.0 Example: + +```c# + var friendship = + await + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.NoRetweetIDs + select friend) + .SingleOrDefaultAsync(); + + if (friendship != null && + friendship.IDInfo != null && + friendship.IDInfo.IDs != null) + { + var ids = + (from id in friendship.IDInfo.IDs + select id.ToString()) + .ToArray(); + + Console.WriteLine("\nIDs: " + string.Join(",", ids)); + } +``` + +##### v2.1 Example: + +```c# +var friendship = + (from friend in twitterCtx.Friendship + where friend.Type == FriendshipType.NoRetweetIDs + select friend) + .First(); + +Console.WriteLine("\nIDs: " + string.Join(",", friendship.IDInfo.IDs.ToArray())); +``` + +*Twitter API:* [friendships/no_retweets/ids](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md new file mode 100644 index 00000000..b921a6a6 --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md @@ -0,0 +1,46 @@ +#### Showing Outgoing Requests + +Show IDs of all users for whom the logged in user has requested friendship. + +*Entity:* [[Friendship|Friendship Entity]] +*Type:* FriendshipType.Outgoing + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Separates results into pages | long | no | + +*Return Type:* User + +##### v3.0 Example: + +```c# + var request = + await + (from req in twitterCtx.Friendship + where req.Type == FriendshipType.Outgoing + select req) + .SingleOrDefaultAsync(); + + if (request != null && + request.IDInfo != null && + request.IDInfo.IDs != null) + { + request.IDInfo.IDs.ForEach(req => Console.WriteLine(req)); + } +``` + +##### v2.1 Example: + +```c# + var request = + (from req in twitterCtx.Friendship + where req.Type == FriendshipType.Outgoing + select req) + .FirstOrDefault(); + + request.IDInfo.IDs.ForEach(req => Console.WriteLine(req)); +``` + +*Twitter API:* [friendships/outgoing](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md b/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md new file mode 100644 index 00000000..f05d1cdc --- /dev/null +++ b/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md @@ -0,0 +1,56 @@ +#### Updating Friendship Settings + +Update notification settings. + +##### Signature: + +```c# +public async Task UpdateFriendshipSettingsAsync( + ulong userID, bool retweets, bool device) +public async Task UpdateFriendshipSettingsAsync( + string screenName, bool retweets, bool device) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| device | Receive device notifications about followed user | bool | no | +| retweets | Receive retweets from followed user | bool | no | +| screenName | Screen name of user to follow | string | yes | +| userID | ID of user to follow | ulong | yes | + +Note: userID or screenName must be provided. + +*Return Type:* [[User|User Entity]] + +##### v3.0 Example: + +```c# + Friendship friend = + await twitterCtx.UpdateFriendshipSettingsAsync( + "Linq2Tweeter", true, true); + + if (friend != null && friend.SourceRelationship != null) + Console.WriteLine( + "Settings for {0} are: Can Retweet is {1} " + + "and Can Send Device Notifications is {2}", + friend.SourceRelationship.ScreenName, + friend.SourceRelationship.RetweetsWanted, + friend.SourceRelationship.NotificationsEnabled); +``` + +##### v2.1 Example: + +```c# +Friendship friend = twitterCtx.UpdateFriendshipSettings("JoeMayo", /*retweets:*/ true, + /*device:*/ true); + +Console.WriteLine("Settings for {0} are: Can Retweet is {1}" + + "Can Send Device Notifications is {2}", + friend.SourceRelationship.ScreenName, + friend.SourceRelationship.RetweetsWanted, + friend.SourceRelationship.NotificationsEnabled); +``` + +*Twitter API:* [friendships/update](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update) \ No newline at end of file From 03d2a29ccf6095517e972afbd5f41cb17db3231b Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 1 Dec 2020 02:34:25 +0000 Subject: [PATCH 27/95] Update Getting-Geographical-Information.md --- .../Getting-Geographical-Information.md | 8 ++-- .../Getting-Details-on-a-Place.md | 35 +++++++++++++++ .../Performing-Reverse-Geocode-Lookups.md | 37 ++++++++++++++++ .../Querying-Similar-Places.md | 38 ++++++++++++++++ .../Searching-for-Places.md | 43 +++++++++++++++++++ 5 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md create mode 100644 LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md create mode 100644 LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md create mode 100644 LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information.md b/LINQ-to-Twitter-5/Getting-Geographical-Information.md index 66ff95ca..dfea66c1 100644 --- a/LINQ-to-Twitter-5/Getting-Geographical-Information.md +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information.md @@ -2,18 +2,18 @@ You can info on places associated with geographical information -### [[Performing Reverse Geocode Lookups]] +### [Performing Reverse Geocode Lookups](Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md) Lets you provide latitude and longitude to get back location/place information -### [[Getting Details on a Place]] +### [Getting Details on a Place](Getting-Geographical-Information/Getting-Details-on-a-Place.md) With a place ID, returned by a Reverse Geocode lookup, you can get more details on the place -### [[Searching for Places]] +### [Searching for Places](Getting-Geographical-Information/Searching-for-Places.md) Search for places that can be attached to a status update -### [[Querying Similar Places]] +### [Querying Similar Places](Getting-Geographical-Information/Querying-Similar-Places.md) Get a list of nearby places with similar names \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md new file mode 100644 index 00000000..d13ce009 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md @@ -0,0 +1,35 @@ +### Getting Details on a Place + +With a place ID, returned by a Reverse Geocode lookup, you can get more details on the place. + +*Entity:* [[Geo|Geo Entity]] +*Type:* GeoType.ID + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| PlaceID | ID retrieved from reverse geocode | string | yes | + +##### Example: + +```c# + var geoResponse = + await + (from g in twitterCtx.Geo + where g.Type == GeoType.ID && + g.ID == "5a110d312052166f" + select g) + .SingleOrDefaultAsync(); + + if (geoResponse != null && geoResponse.Places != null) + { + Place place = geoResponse.Places.First(); + + Console.WriteLine( + "Name: {0}, Country: {1}, Type: {2}", + place.Name, place.Country, place.PlaceType); + } +``` + +*Twitter API:* [geo/id/:place_id ](https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md new file mode 100644 index 00000000..d45c608c --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md @@ -0,0 +1,37 @@ +### Performing Reverse Geocode Lookups + +Lets you provide latitude and longitude to get back location/place information. + +*Entity:* [[Geo|Geo Entity]] +*Type:* GeoType.Reverse + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Accuracy | Radius to search | string | no | +| Granularity | Minimum granularity of place types | string | no | +| Lat | Latitude to search | dec | yes | +| Long | Longitude to search | dec | yes | +| MaxResults | Max nearby results | int | no | + +##### Example: + +```c# + var geoResponse = + await + (from g in twitterCtx.Geo + where g.Type == GeoType.Reverse && + g.Latitude == 37.78215 && + g.Longitude == -122.40060 + select g) + .SingleOrDefaultAsync(); + + if (geoResponse != null && geoResponse.Places != null) + geoResponse.Places.ForEach(place => + Console.WriteLine( + "Name: {0}, Country: {1}, Type: {2}", + place.Name, place.Country, place.PlaceType)); +``` + +*Twitter API:* [geo/reverse_geocode](https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md new file mode 100644 index 00000000..8ceaa7b6 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md @@ -0,0 +1,38 @@ +### Querying Similar Places + +Get a list of nearby places with similar names. + +*Entity:* [[Geo|Geo Entity]] +*Type:* GeoType.SimilarPlaces + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Attribute | Name/value pair separated by "=" (i.e. "street_address=123 4th Street") | string | no | +| ContainedWithin | PlaceID to restrict results to | string | no | +| Lat | Latitude to search | dec | yes | +| Long | Longitude to search | dec | yes | +| Name | Place name | string | yes | + +##### Example: + +```c# + var geoResponse = + await + (from g in twitterCtx.Geo + where g.Type == GeoType.SimilarPlaces && + g.Latitude == 37.78215 && + g.Longitude == -122.40060 && + g.PlaceName == "Twitter HQ" + select g) + .SingleOrDefaultAsync(); + + if (geoResponse != null && geoResponse.Places != null) + geoResponse.Places.ForEach(place => + Console.WriteLine( + "Name: {0}, Country: {1}, Type: {2}", + place.Name, place.Country, place.PlaceType)); +``` + +*Twitter API:* [geo/similar_places](https://developer.twitter.com/en/docs/geo/places-near-location/overview) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md new file mode 100644 index 00000000..6bcc3a24 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md @@ -0,0 +1,43 @@ +### Searching for Places + +Search for places that can be attached to a status update. + +*Entity:* [[Geo|Geo Entity]] +*Type:* GeoType.Search + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Accuracy | Radius to search | string | no | +| Attribute | Name/value pair separated by "=" (i.e. "street_address=123 4th Street") | string | no | +| ContainedWithin | PlaceID to restrict results to | string | no | +| Granularity | Minimum granularity of place types | string | no | +| IP | IP address of user | string | only if Lat, Long, and Query are empty | +| Lat | Latitude to search | dec | only if IP and Query are empty | +| Long | Longitude to search | dec | only if IP and Query are empty | +| MaxResults | Max nearby results | int | no | +| Query | URL encoded text search term | string | only if Lat, Long, and IP are empty | + +##### Example: + +```c# + var geoResponse = + await + (from geo in twitterCtx.Geo + where geo.Type == GeoType.Search && + geo.IP == "168.143.171.180" + select geo) + .SingleOrDefaultAsync(); + + if (geoResponse != null && geoResponse.Places != null) + { + Place place = geoResponse.Places.First(); + + Console.WriteLine( + "Name: {0}, Country: {1}, Type: {2}", + place.Name, place.Country, place.PlaceType); + } +``` + +*Twitter API:* [geo/search](https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search) \ No newline at end of file From 35a766ffd3a28d120a49f1c8ce2124c0b7f65181 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 1 Dec 2020 02:39:30 +0000 Subject: [PATCH 28/95] Update Using-Help-Methods.md --- LINQ-to-Twitter-5/Using-Help-Methods.md | 10 +-- .../Getting-Configuration-Information.md | 85 +++++++++++++++++++ .../Using-Help-Methods/Getting-Rate-Limits.md | 61 +++++++++++++ .../Retrieving-Languages.md | 42 +++++++++ .../Using-Help-Methods/Viewing-Privacy.md | 26 ++++++ .../Using-Help-Methods/Viewing-TOS.md | 26 ++++++ 6 files changed, 245 insertions(+), 5 deletions(-) create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md create mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md diff --git a/LINQ-to-Twitter-5/Using-Help-Methods.md b/LINQ-to-Twitter-5/Using-Help-Methods.md index d7310730..19468151 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods.md @@ -2,22 +2,22 @@ This method is for testing Twitter connectivity. -#### [[Getting Configuration Information]] +#### [Getting Configuration Information](Using-Help-Methods/Getting-Configuration-Information.md) Pulls general configuration information such as URL lengths, system names, and photo sizes -#### [[Retrieving Languages]] +#### [Retrieving Languages](Using-Help-Methods/Retrieving-Languages.md) Provides a list of languages supported by Twitter -#### [[Getting Rate Limits]] +#### [Getting Rate Limits](Using-Help-Methods/Getting-Rate-Limits.md) Shows how to obtain rate limit status for each API -#### [[Viewing Privacy]] +#### [Viewing Privacy](Using-Help-Methods/Viewing-Privacy.md) Displays the Twitter privacy policy -#### [[Viewing TOS]] +#### [Viewing TOS](Using-Help-Methods/Viewing-TOS.md) Displays the Twitter terms of service \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md new file mode 100644 index 00000000..6e157c90 --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md @@ -0,0 +1,85 @@ +#### Getting Configuration Information + +Pulls general configuration information such as URL lengths, system names, and photo sizes. + +*Entity:* [[Help|Help Entity]] +*Type:* HelpType.Configuration + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var helpResult = + await + (from test in twitterCtx.Help + where test.Type == HelpType.Configuration + select test) + .SingleOrDefaultAsync(); + + if (helpResult != null && + helpResult.Configuration != null && + helpResult.Configuration.NonUserNamePaths != null && + helpResult.Configuration.PhotoSizes != null) + { + Configuration cfg = helpResult.Configuration; + + Console.WriteLine("Short URL Length: " + cfg.ShortUrlLength); + Console.WriteLine("Short URL HTTPS Length: " + cfg.ShortUrlLengthHttps); + Console.WriteLine("Non-UserName Paths: "); + foreach (var name in cfg.NonUserNamePaths) + { + Console.WriteLine("\t" + name); + } + Console.WriteLine("Photo Size Limit: " + cfg.PhotoSizeLimit); + Console.WriteLine("Max Media Per Upload: " + cfg.MaxMediaPerUpload); + Console.WriteLine( + "Characters Reserved Per Media: " + cfg.CharactersReservedPerMedia); + Console.WriteLine("Photo Sizes"); + foreach (var photo in cfg.PhotoSizes) + { + Console.WriteLine("\t" + photo.Type); + Console.WriteLine("\t\t" + photo.Width); + Console.WriteLine("\t\t" + photo.Height); + Console.WriteLine("\t\t" + photo.Resize); + } + } +``` + +##### v2.1 Example: + +```c# +var helpResult = + (from test in twitterCtx.Help + where test.Type == HelpType.Configuration + select test) + .SingleOrDefault(); + +Configuration cfg = helpResult.Configuration; + +Console.WriteLine("Short URL Length: " + cfg.ShortUrlLength); +Console.WriteLine("Short URL HTTPS Length: " + cfg.ShortUrlLengthHttps); +Console.WriteLine("Non-UserName Paths: "); + +foreach (var name in cfg.NonUserNamePaths) +{ + Console.WriteLine("\t" + name); +} + +Console.WriteLine("Photo Size Limit: " + cfg.PhotoSizeLimit); +Console.WriteLine("Max Media Per Upload: " + cfg.MaxMediaPerUpload); +Console.WriteLine("Characters Reserved Per Media: " + cfg.CharactersReservedPerMedia); +Console.WriteLine("Photo Sizes"); + +foreach (var photo in cfg.PhotoSizes) +{ + Console.WriteLine("\t" + photo.Type); + Console.WriteLine("\t\t" + photo.Width); + Console.WriteLine("\t\t" + photo.Height); + Console.WriteLine("\t\t" + photo.Resize); +} +``` + +*Twitter API:* [help/configuration](https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md new file mode 100644 index 00000000..c181e5c9 --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md @@ -0,0 +1,61 @@ +#### Getting Rate Limits + +Provides rate limits for each API endpoint. + +*Entity:* [[Help|Help Entity]] +*Type:* HelpType.RateLimits + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Resources | Comma-separated list of endpoints to filter results on | string | no | + +##### v3.0 Example: + +```c# + var helpResponse = + await + (from help in twitterCtx.Help + where help.Type == HelpType.RateLimits + select help) + .SingleOrDefaultAsync(); + + if (helpResponse != null && helpResponse.RateLimits != null) + foreach (var category in helpResponse.RateLimits) + { + Console.WriteLine("\nCategory: {0}", category.Key); + + foreach (var limit in category.Value) + { + Console.WriteLine( + "\n Resource: {0}\n Remaining: {1}\n Reset: {2}\n Limit: {3}", + limit.Resource, limit.Remaining, limit.Reset, limit.Limit); + } + } +``` + +##### v2.1 Example: + +```c# + var helpResult = + (from help in twitterCtx.Help + where help.Type == HelpType.RateLimits //&& + //help.Resources == "search,users" + select help) + .SingleOrDefault(); + + foreach (var category in helpResult.RateLimits) + { + Console.WriteLine("\nCategory: {0}", category.Key); + + foreach (var limit in category.Value) + { + Console.WriteLine( + "\n Resource: {0}\n Remaining: {1}\n Reset: {2}\n Limit: {3}", + limit.Resource, limit.Remaining, limit.Reset, limit.Limit); + } + } +``` + +*Twitter API:* [application/rate_limit_status](https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md b/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md new file mode 100644 index 00000000..a0ff0c85 --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md @@ -0,0 +1,42 @@ +#### Retrieving Languages + +Provides a list of languages supported by Twitter. + +*Entity:* [[Help|Help Entity]] +*Type:* HelpType.Languages + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var helpResult = + await + (from test in twitterCtx.Help + where test.Type == HelpType.Languages + select test) + .SingleOrDefaultAsync(); + + if (helpResult != null && helpResult.Languages != null) + helpResult.Languages.ForEach(lang => + Console.WriteLine("{0}({1}): {2}", lang.Name, lang.Code, lang.Status)); +``` + +##### v2.1 Example: + +```c# + var helpResult = + (from test in twitterCtx.Help + where test.Type == HelpType.Languages + select test) + .SingleOrDefault(); + + foreach (var lang in helpResult.Languages) + { + Console.WriteLine("{0}({1}): {2}", lang.Name, lang.Code, lang.Status); + } +``` + +*Twitter API:* [help/languages](https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md new file mode 100644 index 00000000..df872a6f --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md @@ -0,0 +1,26 @@ +#### Viewing Privacy + +Displays the Twitter privacy policy. + +*Entity:* [[Help|Help Entity]] +*Type:* HelpType.Privacy + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var helpResult = + await + (from test in twitterCtx.Help + where test.Type == HelpType.Privacy + select test) + .SingleOrDefaultAsync(); + + if (helpResult != null) + Console.WriteLine(helpResult.Policies); +``` + +*Twitter API:* [help/privacy](https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md new file mode 100644 index 00000000..cf5e1768 --- /dev/null +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md @@ -0,0 +1,26 @@ +#### Viewing TOS + +Displays the Twitter terms of service. + +*Entity:* [[Help|Help Entity]] +*Type:* HelpType.Tos + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var helpResult = + await + (from test in twitterCtx.Help + where test.Type == HelpType.Tos + select test) + .SingleOrDefaultAsync(); + + if (helpResult != null) + Console.WriteLine(helpResult.Policies); +``` + +*Twitter API:* [help/tos](https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos) \ No newline at end of file From fe2d68c55d8c0b6b61962d29bafb16ecb7d2c96c Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 1 Dec 2020 05:13:21 +0000 Subject: [PATCH 29/95] Update Managing-Lists.md --- LINQ-to-Twitter-5/Managing-Lists.md | 38 +++--- .../Adding-Multiple-Members-to-a-List.md | 67 ++++++++++ .../Adding-a-Member-to-a-List.md | 54 ++++++++ ...Checking-if-a-User-Subscribes-to-a-List.md | 120 +++++++++++++++++ .../Checking-if-a-User-is-a-List-Member.md | 122 ++++++++++++++++++ .../Managing-Lists/Creating-a-List.md | 42 ++++++ .../Deleting-Multiple-List-Members.md | 56 ++++++++ .../Managing-Lists/Deleting-a-List-Member.md | 51 ++++++++ .../Deleting-a-List-Subscription.md | 47 +++++++ .../Managing-Lists/Deleting-a-List.md | 47 +++++++ .../Managing-Lists/Finding-Owned-Lists.md | 56 ++++++++ .../Managing-Lists/Getting-Info-on-a-List.md | 54 ++++++++ .../Managing-Lists/Getting-List-Members.md | 58 +++++++++ .../Getting-List-Subscribers.md | 58 +++++++++ .../Learn-what-Lists-a-User-Subscribes-To.md | 53 ++++++++ .../Learn-what-Lists-a-User-is-a-Member-Of.md | 53 ++++++++ .../Managing-Lists/Reading-List-Statuses.md | 112 ++++++++++++++++ .../Managing-Lists/Retrieving-All-Lists.md | 52 ++++++++ .../Subscribing-a-User-to-a-List.md | 47 +++++++ .../Managing-Lists/Updating-a-List.md | 54 ++++++++ 20 files changed, 1222 insertions(+), 19 deletions(-) create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md create mode 100644 LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md diff --git a/LINQ-to-Twitter-5/Managing-Lists.md b/LINQ-to-Twitter-5/Managing-Lists.md index 95e0af44..715d725e 100644 --- a/LINQ-to-Twitter-5/Managing-Lists.md +++ b/LINQ-to-Twitter-5/Managing-Lists.md @@ -2,78 +2,78 @@ Lists allow you to categorize Twitter accounts. -#### [[Retrieving All Lists]] +#### [Retrieving All Lists](Managing-Lists/Retrieving-All-Lists.md) Get a list of all lists -#### [[Reading List Statuses]] +#### [Reading List Statuses](Managing-Lists/Reading-List_Statuses.md) Read tweets from a list -#### [[Learn what Lists a User is a Member Of]] +#### [Learn what Lists a User is a Member Of](Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md) Get lists a user is a member of -#### [[Getting List Subscribers]] +#### [Getting List Subscribers](Managing-Lists/Getting-List-Subscribers.md) Get a list of users who subscribed to a list -#### [[Checking if a User Subscribes to a List]] +#### [Checking if a User Subscribes to a List](Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md) Determine if a user subscribes to a list -#### [[Checking if a User is a List Member]] +#### [Checking if a User is a List Member](Managing-Lists/Checking-if-a-User-is-a-List-Member.md) Determine if a user is a member of a list -#### [[Getting List Members]] +#### [Getting List Members](Managing-Lists/Getting-List-Members.md) Get a list of members of a list -#### [[Getting Info on a List]] +#### [Getting Info on a List](Managing-Lists/Getting-Info-on-a-List.md) Get details on a list -#### [[Learn what Lists a User Subscribes To]] +#### [Learn what Lists a User Subscribes To](Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md) Get lists user has subscribed to -#### [[Finding Owned Lists]] +#### [Finding Owned Lists](Managing-Lists/Finding-Owned-Lists.md) Get lists that the authenticated user owns. -#### [[Deleting a List Member]] +#### [Deleting a List Member](Managing-Lists/Deleting-a-List-Member.md) Remove a user from a list -#### [[Subscribing a User to a List]] +#### [Subscribing a User to a List](Managing-Lists/Subscribing-a-User-to-a-List.md) Create a subscription for a user on a list -#### [[Deleting a List Subscription]] +#### [Deleting a List Subscription](Managing-Lists/Deleting-a-List-Subscription.md) Remove a user's subscription to a list -#### [[Adding Multiple Members to a List]] +#### [Adding Multiple Members to a List](Managing-Lists/Adding-Multiple-Members-to-a-List.md) Add multiple users to a list at the same time -#### [[Adding a Member to a List]] +#### [Adding a Member to a List](Managing-Lists/Adding-a-Member-to-a-List.md) Add a user to a list -#### [[Deleting a List]] +#### [Deleting a List](Managing-Lists/Deleting-a-List.md) Delete a list -#### [[Updating a List]] +#### [Updating a List](Managing-Lists/Updating-a-List.md) Update a list -#### [[Creating a List]] +#### [Creating a List](Managing-Lists/Creating-a-List.md) Create a new list -#### [[Deleting Multiple List Members]] +#### [Deleting Multiple List Members](Managing-Lists/Deleting-Multiple-List-Members.md) Remove up to 100 members from a list \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md new file mode 100644 index 00000000..52e52a04 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md @@ -0,0 +1,67 @@ +#### Adding Multiple Members to a List + +Add multiple users to a list at the same time. + +##### Signature: + +```c# +public async Task AddMemberRangeToListAsync( + ulong listID, string slug, ulong ownerID, + string ownerScreenName, List screenNames) +public async Task AddMemberRangeToListAsync( + ulong listID, string slug, ulong ownerID, + string ownerScreenName, List userIDs) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong| only is slug is empty | +| ownerID | ID of user who owns list | ulong| only if slug is provided | +| ownerScreenName | Name of user to who owns list | string | only if slug is provided | +| screenNames | Screen names to add | List | only if userID is empty | +| slug | Short list name | string | only if listID is empty | +| userIDs | User IDs to add | List | only if screenName is empty | + +Note: Either userIDs or screenNames is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. Maximum users per request is 100; requiring multiple invocations if you need to add more than 100 users. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + var screenNames = new List + { + "JoeMayo", + "Linq2Tweeter" + }; + + List list = + await twitterCtx.AddMemberRangeToListAsync( + 0, "testDemo", 0, ownerScreenName, screenNames); + + if (list != null && list.Users != null) + list.Users.ForEach(user => Console.WriteLine(user.Name)); +``` + +##### v2.1 Example: + +```c# +var screenNames = new List +{ + "JoeMayo", + "Linq2Tweeter" +}; + +List list = twitterCtx.AddMemberRangeToList(null, "linq", null, "Linq2Tweeter", + screenNames); + +foreach (var user in list.Users) +{ + Console.WriteLine(user.Name); +} +``` + +*Twitter API:* [lists/members/create_all](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md new file mode 100644 index 00000000..cf4db03b --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md @@ -0,0 +1,54 @@ +#### Adding a Member to a List + +Add a user to a list. + +##### Signature: + +```c# +public async Task AddMemberToListAsync( + ulong userID, ulong listID, string slug, + ulong ownerID, string ownerScreenName) +public async Task AddMemberToListAsync( + string screenName, ulong listID, string slug, + ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | yes | +| ownerID | ID of user who owns list | ulong | only if slug is provided | +| ownerScreenName | Name of user to who owns list | string | only if slug is provided | +| screenName | ScreenName of list owner | string | only if userID is empty | +| slug | Short list name | string | yes | +| userID | User ID of list owner | ulong | only if screenName is empty | + +Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + + List list = + await twitterCtx.AddMemberToListAsync( + "Linq2Tweeter", 0, "testDemo", 0, ownerScreenName); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.AddMemberToList(null, "Linq2Tweeter", null, "test", null, + "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/members/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md new file mode 100644 index 00000000..faf1c472 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md @@ -0,0 +1,120 @@ +#### Checking if a User Subscribes to a List + +Determine if a user subscribes to a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.IsSubscriber + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Add entities to tweets (default: true) | bool | no | +| ListID | ID of list | ulong | only is Slug is empty | +| OwnerID | ID of list owner | ulong | only if Slug is provided | +| OwnerScreenName | Name of list owner | string | only if Slug is provided | +| ScreenName | ScreenName of user | string | only if UserID is empty | +| SkipStatus | Exclude status information | bool | no | +| Slug | Short list name | string | only if ListID is empty | +| UserID | ID of user | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +```c# + try + { + var subscribedList = + await + (from list in twitterCtx.List + where list.Type == ListType.IsSubscriber && + list.ScreenName == "JoeMayo" && + list.Slug == "linq" && + list.OwnerScreenName == "Linq2Tweeter" + select list) + .SingleOrDefaultAsync(); + + if (subscribedList != null && subscribedList.Users != null) + { + // list will have only one user matching ID in query + var user = subscribedList.Users.First(); + + Console.WriteLine("User: {0} is subscribed to List: {1}", + user.Name, subscribedList.ListID); + } + } + // whenever user is not subscribed to the specified list, Twitter + // returns an HTTP 404, Not Found, response. LINQ to Twitter + // intercepts the HTTP response and wraps it in a TwitterQueryException + // where you can read the error message from Twitter via the Message property. + catch (TwitterQueryException ex) + { + if (ex.StatusCode == HttpStatusCode.NotFound) + { + Console.WriteLine( + "HTTP Status Code: {0}. Twitter Error Code: {1}, Twitter Message: {2}", + ex.StatusCode.ToString(), + ex.ErrorCode, + ex.Message); + } + else + { + throw ex; + } + } +``` + +##### v2.1 Example: + +```c# + try + { + var subscribedList = + (from list in twitterCtx.List + where list.Type == ListType.IsSubscribed && + list.ScreenName == "Linq2Tweeter" && + list.Slug == "dotnettwittterdevs" && + list.OwnerScreenName == "JoeMayo" + select list) + .FirstOrDefault(); + + // list will have only one user matching ID in query + var user = subscribedList.Users.First(); + + Console.WriteLine("User: {0} is subscribed to List: {1}", + user.Name, subscribedList.ListID); + } + // whenever user is not subscribed to the specified list, Twitter + // returns an HTTP 404, Not Found, response, which results in a + // .NET exception. LINQ to Twitter intercepts the HTTP exception + // and wraps it in a TwitterQueryResponse where you can read the + // error message from Twitter via the Response property, shown below. + catch (TwitterQueryException ex) + { + // TwitterQueryException will always reference the original + // WebException, so the check is redundant but doesn't hurt + var webEx = ex.InnerException as WebException; + if (webEx == null) throw ex; + + // The response holds data from Twitter + var webResponse = webEx.Response as HttpWebResponse; + if (webResponse == null) throw ex; + + if (webResponse.StatusCode == HttpStatusCode.NotFound) + { + Console.WriteLine( + "HTTP Status Code: {0}. Response from Twitter: {1}", + webEx.Response.Headers["Status"], + ex.Response.Error); + } + else + { + throw ex; + } + } +``` + +Note: Twitter returns HTTP 404 Not Found, which becomes a .NET exception, when user is not subscribed. + +*Twitter API:* [lists/subscribers/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md new file mode 100644 index 00000000..19defb27 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md @@ -0,0 +1,122 @@ +#### Checking if a User is a List Member + +Determine if a user is a member of a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.IsMember + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Add entities to tweets (default: true) | bool | no | +| ListID | ID of list | ulong | only is Slug is empty | +| OwnerID | ID of list owner | ulong | only if Slug is provided | +| OwnerScreenName | Name of list owner | string | only if Slug is provided | +| ScreenName | ScreenName of list owner | string | only if UserID is empty | +| SkipStatus | Exclude status information | bool | no | +| Slug | Short list name | string | only if ListID is empty | +| UserID | ID of user to check | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +Note: Twitter returns 404 Not Found, which is an exception in .NET, if user is not a member. + +```c# + try + { + var subscribedList = + await + (from list in twitterCtx.List + where list.Type == ListType.IsMember && + list.ScreenName == "JoeMayo" && + list.OwnerScreenName == "Linq2Tweeter" && + list.Slug == "linq" + select list) + .SingleOrDefaultAsync(); + + if (subscribedList != null && subscribedList.Users != null) + { + // list will have only one user matching ID in query + var user = subscribedList.Users.First(); + + Console.WriteLine("User: {0} is a member of List: {1}", + user.Name, subscribedList.ListID); + } + } + // whenever user is not a member of the specified list, Twitter + // returns an HTTP 404, Not Found, response. LINQ to Twitter + // intercepts the HTTP response and wraps it in a TwitterQueryException + // where you can read the error message from Twitter via the Message property. + catch (TwitterQueryException ex) + { + if (ex.StatusCode == HttpStatusCode.NotFound) + { + Console.WriteLine( + "HTTP Status Code: {0}. Twitter Error Code: {1}, Twitter Message: {2}", + ex.StatusCode.ToString(), + ex.ErrorCode, + ex.Message); + } + else + { + throw ex; + } + } +``` + +##### v2.1 Example: + +Note: Twitter returns 404 Not Found, which is an exception in .NET, if user is not a member. + +```c# + try + { + var subscribedList = + (from list in twitterCtx.List + where list.Type == ListType.IsMember && + list.ScreenName == "Linq2Tweeter" && + list.OwnerScreenName == "JoeMayo" && + list.Slug == "dotnettwittterdevs" + select list) + .FirstOrDefault(); + + // list will have only one user matching ID in query + var user = subscribedList.Users.First(); + + Console.WriteLine("User: {0} is a member of List: {1}", + user.Name, subscribedList.ListID); + } + // whenever user is not a member of the specified list, Twitter + // returns an HTTP 404 Not Found, response, which results in a + // .NET exception. LINQ to Twitter intercepts the HTTP exception + // and wraps it in a TwitterQueryResponse where you can read the + // error message from Twitter via the Response property, shown below. + catch (TwitterQueryException ex) + { + // TwitterQueryException will always reference the original + // WebException, so the check is redundant but doesn't hurt + var webEx = ex.InnerException as WebException; + if (webEx == null) throw ex; + + // The response holds data from Twitter + var webResponse = webEx.Response as HttpWebResponse; + if (webResponse == null) throw ex; + + if (webResponse.StatusCode == HttpStatusCode.NotFound) + { + Console.WriteLine( + "HTTP Status Code: {0}. Response from Twitter: {1}", + webEx.Response.Headers["Status"], + ex.Response.Error); + } + else + { + throw ex; + } + } +``` + +*Twitter API:* [lists/members/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md new file mode 100644 index 00000000..f9aac4ff --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md @@ -0,0 +1,42 @@ +#### Creating a List + +Create a new list. + +##### Signature: + +```c# +public async Task CreateListAsync( + string listName, string mode, string description) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| description | Description of list | string | no | +| listName | Name of list | string | yes | +| mode | Public or private | string | no | + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + List list = + await twitterCtx.CreateListAsync( + "testDemo", "public", "This is a test"); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.CreateList("test", "public", "This is a test"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md new file mode 100644 index 00000000..84cd9961 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md @@ -0,0 +1,56 @@ +#### Deleting Multiple List Members + +Remove up to 100 members from a list. + +##### Signature: + +```c# +public async Task DeleteMemberRangeFromListAsync( + ulong listID, string slug, List userIDs, + ulong ownerID, string ownerScreenName) +public async Task DeleteMemberRangeFromListAsync( + ulong listID, string slug, List screenNames, + ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | yes | +| ownerID | ID of list owner | string | no | +| ownerScreenName | Name of list owner | string | no | +| screenName | List owner | string | no | +| slug | List name | string | yes | +| userID| ID of user | string | no | + +Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + var screenNames = new List { "JoeMayo", "mp2kmag" }; + + List list = + await twitterCtx.DeleteMemberRangeFromListAsync( + 0, "testDemo", screenNames, 0, ownerScreenName); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.DestroyAllFromList(null, "test", null, "JoeMayo,mp2kmag", + null, "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +*Twitter API:* [lists/members/destroy_all](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md new file mode 100644 index 00000000..5031148f --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md @@ -0,0 +1,51 @@ +#### Deleting a List Member + +Remove a user from a list + +##### Signature: + +```c# +public async Task DeleteMemberFromListAsync( + ulong userID, string screenName, ulong listID, + string slug, ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | only is slug is empty | +| ownerID | ID of list owner | ulong | only if slug is provided | +| ownerScreenName | Name of list owner | string | only if slug is provided | +| screenName | ScreenName of list owner | string | only if userID is empty | +| slug | Short list name | string | only if listID is empty | +| userID | User ID of list owner | ulong | only if screenName is empty | + +Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + + List list = + await twitterCtx.DeleteMemberFromListAsync( + 0, "Linq2Tweeter", 0, "testDemo", 0, ownerScreenName); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.DeleteMemberFromList(null, "Linq2Tweeter", null, "test", null, + "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/members/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md new file mode 100644 index 00000000..a9609af3 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md @@ -0,0 +1,47 @@ +#### Deleting a List Subscription + +Remove a user's subscription to a list. + +##### Signature: + +```c# +public async Task UnsubscribeFromListAsync( + ulong listID, string slug, ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | only is slug is empty | +| ownerID | ID of list owner | ulong | only if slug is provided | +| ownerScreenName | Name of list owner | string | only if slug is provided | +| slug | Short list name | string | only if listID is empty | + +Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + + List list = + await twitterCtx.DeleteMemberFromListAsync( + 0, "Linq2Tweeter", 0, "testDemo", 0, ownerScreenName); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.UnsubscribeFromList(null, "test", null, "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/subscribers/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md new file mode 100644 index 00000000..df4cd805 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md @@ -0,0 +1,47 @@ +#### Deleting a List + +Delete a list. + +##### Signature: + +```c# +public async Task DeleteListAsync( + ulong listID, string slug, ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | only if slug is empty | +| ownerID | ID of user who owns list | ulong | only if slug is provided | +| ownerScreenName | Name of user to who owns list | string | only is slug is provided | +| slug | Short list name | string | only if listID is empty | + +Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + ulong listID = 0; + + List list = + await twitterCtx.DeleteListAsync( + listID, "testDemo", 0, "Linq2Tweeter"); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.DeleteList(null, "test-5", null, "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/destroy](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md b/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md new file mode 100644 index 00000000..f9277779 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md @@ -0,0 +1,56 @@ +#### Finding Owned Lists + +Get lists that the authenticated user owns. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Ownerships + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Results per page | int | no | +| Cursor | Token for paging through list | long | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| UserID | ID of user | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. + +##### v3.0 Example: + +```c# + var lists = + await + (from list in twitterCtx.List + where list.Type == ListType.Ownerships && + list.ScreenName == "Linq2Tweeter" + select list) + .ToListAsync(); + + if (lists != null) + lists.ForEach(list => + Console.WriteLine( + "ID: {0} Slug: {1} Description: {2}", + list.ListIDResult, + list.SlugResult, + list.Description)); +``` + +##### v2.1 Example: + +```c# + var lists = + (from list in twitterCtx.List + where list.Type == ListType.Ownerships && + list.ScreenName == "Linq2Tweeter" + select list) + .ToList(); + + foreach (var list in lists) + { + Console.WriteLine("ID: {0} Slug: {1} Description: {2}", + list.ListIDResult, list.SlugResult, list.Description); + } +``` + +*Twitter API:* [lists/ownerships](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md new file mode 100644 index 00000000..d2ae135e --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md @@ -0,0 +1,54 @@ +#### Getting Info on a List + +Get details on a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ListID | ID of list | ulong | only if Slug is empty | +| OwnerID | ID of user who owns list | ulong | only if Slug is provided | +| OwnerScreenName | Name of user to who owns list | string | only is Slug is provided | +| Slug | Short list name | string | only if ListID is empty | + +Note: Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +```c# + var requestedList = + await + (from list in twitterCtx.List + where list.Type == ListType.Show && + list.OwnerScreenName == "Linq2Tweeter" && + list.Slug == "linq" + select list) + .SingleOrDefaultAsync(); + + if (requestedList != null) + Console.WriteLine( + "List Name: {0}, Description: {1}, # Users: {2}", + requestedList.Name, + requestedList.Description, + requestedList.Users.Count()); +``` + +##### v2.1 Example: + +```c# +var requestedList = + (from list in twitterCtx.List + where list.Type == ListType.Show && + list.OwnerScreenName == "JoeMayo" && // user who owns list + list.Slug == "dotnettwittterdevs" // list name + select list) + .FirstOrDefault(); + +Console.WriteLine("List Name: {0}, Description: {1}, # Users: {2}", + requestedList.Name, requestedList.Description, requestedList.Users.Count()); +``` + +*Twitter API:* [lists/show](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md new file mode 100644 index 00000000..d6d13024 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md @@ -0,0 +1,58 @@ +#### Getting List Members + +Get a list of members of a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Members + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Token to help page through lists | long | no | +| IncludeEntities | Add entities to tweets (default: true) | bool | no | +| ListID | ID of list | ulong | yes | +| OwnerID | ID of user who owns list | ulong | only if Slug is provided | +| OwnerScreenName | Name of user to who owns list | string | only if Slug is provided | +| SkipStatus | Exclude status information | bool | yes | +| Slug | Short list name | string | yes | + +Note: Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +```c# + var lists = + await + (from list in twitterCtx.List + where list.Type == ListType.Members && + list.OwnerScreenName == "Linq2Tweeter" && + list.Slug == "linq" && + list.SkipStatus == true + select list) + .SingleOrDefaultAsync(); + + if (lists != null && lists.Users != null) + lists.Users.ForEach(user => + Console.WriteLine("Member: " + user.Name)); +``` + +##### v2.1 Example: + +```c# + var lists = + (from list in twitterCtx.List + where list.Type == ListType.Members && + list.OwnerScreenName == "Linq2Tweeter" && + list.Slug == "linq" && + list.SkipStatus == true + select list) + .First(); + + foreach (var user in lists.Users) + { + Console.WriteLine("Member: " + user.Name); + } +``` + +*Twitter API:* [lists/members](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md new file mode 100644 index 00000000..2300d078 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md @@ -0,0 +1,58 @@ +#### Getting List Subscribers + +Get a list of users who subscribed to a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Subscribers + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Token to help page through lists | long | no | +| IncludeEntities | Add entities to tweets (default: true) | bool | no | +| ListID | ID of list | ulong | only is Slug is empty | +| OwnerID | ID of list owner | ulong | only if Slug is provided | +| OwnerScreenName | Name of user to who owns list | string | only if Slug is provided | +| ScreenName | ScreenName of list owner | string | only if UserID is empty | +| SkipStatus | Exclude status information | bool | no | +| Slug | Short list name | string | only if ListID is empty | +| UserID | User ID of list owner | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +```c# + var subscriberList = + await + (from list in twitterCtx.List + where list.Type == ListType.Subscribers && + list.Slug == "linq" && + list.OwnerScreenName == "Linq2Tweeter" + select list) + .SingleOrDefaultAsync(); + + if (subscriberList != null && subscriberList.Users != null) + subscriberList.Users.ForEach(user => + Console.WriteLine("Subscriber: " + user.Name)); +``` + +##### v2.1 Example: + +```c# + var lists = + (from list in twitterCtx.List + where list.Type == ListType.Subscribers && + list.Slug == "dotnettwittterdevs" && + list.OwnerScreenName == "JoeMayo" + select list) + .First(); + + foreach (var user in lists.Users) + { + Console.WriteLine("Subscriber: " + user.Name); + } +``` + +*Twitter API:* [lists/subscribers](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md new file mode 100644 index 00000000..7c5c2cf7 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md @@ -0,0 +1,53 @@ +#### Learn what Lists a User Subscribes To + +Get lists user has subscribed to. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Subscriptions + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Results per page | int | no | +| Cursor | Token for paging through list | long | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| UserID | ID of user | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. + +##### v3.0 Example: + +```c# + var lists = + await + (from list in twitterCtx.List + where list.Type == ListType.Subscriptions && + list.ScreenName == "Linq2Tweeter" + select list) + .ToListAsync(); + + if (lists != null) + lists.ForEach(list => + Console.WriteLine( + "List Name: {0}, Description: {1}", + list.Name, list.Description)); +``` + +##### v2.1 Example: + +```c# + var lists = + from list in twitterCtx.List + where list.Type == ListType.Subscriptions && + list.ScreenName == "Linq2Tweeter" // user to get subscriptions for + select list; + + foreach (var list in lists) + { + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); + } +``` + +*Twitter API:* [lists/subscriptions](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md new file mode 100644 index 00000000..3c0fcba1 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md @@ -0,0 +1,53 @@ +#### Learn what Lists a User is a Member Of + +Get lists a user is a member of. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Memberships + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Token for paging through list | long | no | +| FilterToOwnedLists | Only return lists the user owns | bool | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| UserID | ID of user | ulong | only if ScreenName is empty | + +Note: Either UserID or ScreenName is required. + +##### v3.0 Example: + +```c# + var lists = + await + (from list in twitterCtx.List + where list.Type == ListType.Memberships && + list.ScreenName == "JoeMayo" // user to get memberships for + select list) + .ToListAsync(); + + if (lists != null) + lists.ForEach(list => + Console.WriteLine( + "List Name: {0}, Description: {1}", + list.Name, list.Description)); +``` + +##### v2.0 Example: + +```c# + var lists = + from list in twitterCtx.List + where list.Type == ListType.Memberships && + list.ScreenName == "JoeMayo" // user to get memberships for + select list; + + foreach (var list in lists) + { + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); + } +``` + +*Twitter API:* [lists/memberships](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md b/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md new file mode 100644 index 00000000..84a411ca --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md @@ -0,0 +1,112 @@ +#### Reading List Statuses + +Read tweets from a list. + +*Entity:* [[List|List Entity]] +*Type:* ListType.Statuses + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of statuses per page | int | no | +| IncludeEntities | Add entities to tweets (default: true) | bool | no | +| IncludeRetweets | Add retweets, in addition to normal tweets | bool | no | +| ListID | ID of list | ulong | only if Slug is empty | +| MaxID | Max ID to retrieve for statuses | ulong | no | +| OwnerID | ID of user who owns list | ulong | only if Slug is provided | +| OwnerScreenName | Name of user to who owns list | string | only is Slug is provided | +| Page | Page number for statuses | int | no | +| SinceID | Statuses since status ID | ulong | no | +| Slug | Short list name | string | only if ListID is empty | +| TrimUser | Truncate all user info from result, except for ID | bool | no | + +Note: Either ListID or Slug is required. If you use Slug, you must also specify either OwnerID or OwnerScreenName. + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + string slug = "linq"; + int maxStatuses = 30; + int lastStatusCount = 0; + // last tweet processed on previous query + ulong sinceID = 204251866668871681; + ulong maxID; + int count = 10; + var statusList = new List(); + + // only count + var listResponse = + await + (from list in twitterCtx.List + where list.Type == ListType.Statuses && + list.OwnerScreenName == ownerScreenName && + list.Slug == slug && + list.Count == count + select list) + .SingleOrDefaultAsync(); + + if (listResponse != null && listResponse.Statuses != null) + { + List newStatuses = listResponse.Statuses; + // first tweet processed on current query + maxID = newStatuses.Min(status => status.StatusID) - 1; + statusList.AddRange(newStatuses); + + do + { + // now add sinceID and maxID + listResponse = + await + (from list in twitterCtx.List + where list.Type == ListType.Statuses && + list.OwnerScreenName == ownerScreenName && + list.Slug == slug && + list.Count == count && + list.SinceID == sinceID && + list.MaxID == maxID + select list) + .SingleOrDefaultAsync(); + + if (listResponse == null) + break; + + newStatuses = listResponse.Statuses; + // first tweet processed on current query + maxID = newStatuses.Min(status => status.StatusID) - 1; + statusList.AddRange(newStatuses); + + lastStatusCount = newStatuses.Count; + } + while (lastStatusCount != 0 && statusList.Count < maxStatuses); + + for (int i = 0; i < statusList.Count; i++) + { + Status status = statusList[i]; + + Console.WriteLine("{0, 4}. [{1}] User: {2}\nStatus: {3}", + i + 1, status.StatusID, status.User.Name, status.Text); + } + } +``` + +##### v2.1 Example: + +```c# + var statusList = + (from list in twitterCtx.List + where list.Type == ListType.Statuses && + list.OwnerScreenName == "JoeMayo" && + list.Slug == "dotnettwittterdevs" // name of list to get statuses for + select list) + .First(); + + foreach (var status in statusList.Statuses) + { + Console.WriteLine("User: {0}, Status: {1}", + status.User.Name, status.Text); + } +``` + +*Twitter API:* [lists/statuses](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md b/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md new file mode 100644 index 00000000..bf7783de --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md @@ -0,0 +1,52 @@ +#### Retrieving All Lists + +Get a list of all lists. + +*Entity:* [[List|List Entity]] +*Type:* ListType.List + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ScreenName | Screen name of user to return lists for | string | only if UserID is empty | +| UserID | ID of user to return lists for | ulong | only if ScreenName is empty | +| Reverse | Causes Twitter to return lists belonging to the authenticated user first | bool | no | + +Note: Either UserID or ScreenName is required. + +##### v3.0 Example: + +```c# + string screenName = "Linq2Tweeter"; + + var lists = + await + (from list in twitterCtx.List + where list.Type == ListType.List && + list.ScreenName == screenName + select list) + .ToListAsync(); + + if (lists != null) + lists.ForEach(list => Console.WriteLine("Slug: " + list.SlugResult)); +``` + +##### v2.1 Example: + +```c# + var lists = + (from list in twitterCtx.List + where list.Type == ListType.Lists && + list.ScreenName == "Linq2Tweeter" + select list) + .ToList(); + + foreach (var list in lists) + { + Console.WriteLine("ID: {0} Slug: {1} Description: {2}", + list.ListIDResult, list.SlugResult, list.Description); + } +``` + +*Twitter API:* [lists/list](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md new file mode 100644 index 00000000..37051428 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md @@ -0,0 +1,47 @@ +#### Subscribing a User to a List + +Create a subscription for a user on a list + +##### Signature: + +```c# +public async Task SubscribeToListAsync( + ulong listID, string slug, ulong ownerID, string ownerScreenName) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| listID | ID of list | ulong | only is slug is empty | +| ownerID | ID of list owner | ulong | only if slug is provided | +| ownerScreenName | Name of list owner | string | only if slug is provided | +| slug | Short list name | string | only if listID is empty | + +Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + + List list = + await twitterCtx.SubscribeToListAsync( + 0, "testDemo", 0, ownerScreenName); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.SubscribeToList(null, "test", null, "Linq2Tweeter"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/subscribers/create](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md new file mode 100644 index 00000000..1fda11ff --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md @@ -0,0 +1,54 @@ +#### Updating a List + +Update a list. + +##### Signature: + +```c# +public async Task UpdateListAsync( + ulong listID, string slug, string name, ulong ownerID, + string ownerScreenName, string mode, string description) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| description | New description of list | string | no | +| listID | ID of list | ulong | only if slug is empty | +| mode | New mode of list: public or private | string | no | +| name | New name of list | string | no | +| ownerID | ID of list owner | ulong | only if ownerScreenName is empty and slug is not empty | +| ownerScreenName | Name of list owner | string | only if ownerID is empty and slug is not empty | +| slug | Short list name | string | only if listID is empty, must have ownerID or ownerScreenName | + +Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. + +*Return Type:* [[List|List Entity]] + +##### v3.0 Example: + +```c# + string ownerScreenName = "Linq2Tweeter"; + ulong listID = 0; + + List list = + await twitterCtx.UpdateListAsync( + listID, "testDemo", "Test List", 0, + ownerScreenName, "public", "This is a test2"); + + if (list != null) + Console.WriteLine("List Name: {0}, Description: {1}", + list.Name, list.Description); +``` + +##### v2.1 Example: + +```c# +List list = twitterCtx.UpdateList(null, "test", null, "Linq2Tweeter", "public", + "This is a test2"); + +Console.WriteLine("List Name: {0}, Description: {1}", list.Name, list.Description); +``` + +*Twitter API:* [lists/update](https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update) \ No newline at end of file From a952b0e8921b3e2317d04a517f621802bd530e68 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 1 Dec 2020 05:15:09 +0000 Subject: [PATCH 30/95] Update Uploading-Media.md --- LINQ-to-Twitter-5/Uploading-Media.md | 4 +- .../Uploading-Media/Adding-Alt-Text.md | 42 ++++++++++ .../Uploading-Images-and-Video.md | 78 +++++++++++++++++++ 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md create mode 100644 LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md diff --git a/LINQ-to-Twitter-5/Uploading-Media.md b/LINQ-to-Twitter-5/Uploading-Media.md index 774f0e0d..e274b7c6 100644 --- a/LINQ-to-Twitter-5/Uploading-Media.md +++ b/LINQ-to-Twitter-5/Uploading-Media.md @@ -2,10 +2,10 @@ Posting images and video. -#### [[Uploading Images and Video]] +#### [Uploading Images and Video](Uploading-Media/Uploading-Images-and-Video.md) Allows you to upload multiple images or a video. -#### [[Adding Alt Text]] +#### [Adding Alt Text](Uploading-Media/Adding-Alt-Text.md) Lets you tag media with alt tags for accessibility. diff --git a/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md b/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md new file mode 100644 index 00000000..256e2586 --- /dev/null +++ b/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md @@ -0,0 +1,42 @@ +#### Adding Alt Text + +Lets you tag media with alt tags for accessibility. + +##### Signature: + +```c# +public virtual async Task CreateMediaMetadataAsync( + ulong mediaID, string altText, CancellationToken cancelToken = default(CancellationToken)); +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| mediaID | ID of media. | ulong | yes | +| altText | Media description. | string | yes | +| cancelToken | Allows you to cancel async operation. | CancellationToken | no | + +*Return Type:* [[Status|Status Entity]] + +##### v4.x Example: + +```c# + if (mediaID == 0) + throw new ArgumentNullException(nameof(mediaID), $"Invalid {nameof(mediaID)} parameter: {mediaID}"); + + if (string.IsNullOrWhiteSpace(altText)) + throw new ArgumentNullException(nameof(altText), $"The {nameof(altText)} parameter is empty or null and must have a value."); + + string updateUrl = UploadUrl + "media/metadata/create.json"; + + RawResult = + await TwitterExecutor.SendJsonToTwitterAsync( + HttpMethod.Post.ToString(), + updateUrl, + new MediaMetadata { MediaID = mediaID, AltText = new AltText { Text = altText } }, + cancelToken) + .ConfigureAwait(false); +``` + +*Twitter API:* [media/metadata/create](https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md b/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md new file mode 100644 index 00000000..c583d330 --- /dev/null +++ b/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md @@ -0,0 +1,78 @@ +#### Uploading Images and Video + +Allows you to upload multiple images or a video. + +##### Signature: + +```c# +public virtual async Task UploadMediaAsync( + byte[] media, string mediaType, string mediaCategory, + CancellationToken cancelToken = default(CancellationToken)); + +public virtual async Task UploadMediaAsync( + byte[] media, string mediaType, IEnumerable additionalOwners, + string mediaCategory, CancellationToken cancelToken = default(CancellationToken)); +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| additionalOwners | User IDs of accounts that can used the returned media IDs. | IEnumerable | no | +| media | Media to upload. | byte[] | yes | +| mediaType | Type of media. e.g. image/jpg, image/png, or video/mp4. | string | yes | +| mediaCategory | Media category - possible values are tweet_image, tweet_gif, tweet_video, and amplify_video. See this post on the Twitter forums: https://twittercommunity.com/t/media-category-values/64781/6 | string | sometimes | +| cancelToken | Allows you to cancel async operation | CancellationToken | no | + +*Return Type:* [[Status|Status Entity]] + +Note: The response you receive differs between images and videos. If uploading videos, the code below works well. However, if uploading images, you shouldn't iterate, waiting for processed status because that happens immediately. See this issue for more info: + +* [Cannot upload image, Sorry, that page does not exist](https://github.com/JoeMayo/LinqToTwitter/issues/180#issuecomment-618185664) + +##### v4.x Example: + +```c# + string status = + "Testing video upload tweet #Linq2Twitter £ " + + DateTime.Now.ToString(CultureInfo.InvariantCulture); + + Media media = await twitterCtx.UploadMediaAsync(File.ReadAllBytes(@"..\..\images\LinqToTwitterMediumTest.mp4"), "video/mp4", "tweet_video"); + + Media mediaStatusResponse = null; + do + { + if (mediaStatusResponse != null) + { + int checkAfterSeconds = mediaStatusResponse?.ProcessingInfo?.CheckAfterSeconds ?? 0; + Console.WriteLine($"Twitter video testing in progress - waiting {checkAfterSeconds} seconds."); + await Task.Delay(checkAfterSeconds * 1000); + } + + mediaStatusResponse = + await + (from stat in twitterCtx.Media + where stat.Type == MediaType.Status && + stat.MediaID == media.MediaID + select stat) + .SingleOrDefaultAsync(); + } while (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.InProgress); + + if (mediaStatusResponse?.ProcessingInfo?.State == MediaProcessingInfo.Succeeded) + { + Status tweet = await twitterCtx.TweetAsync(status, new ulong[] { media.MediaID }); + + if (tweet != null) + Console.WriteLine($"Tweet sent: {tweet.Text}"); + } + else + { + MediaError error = mediaStatusResponse?.ProcessingInfo?.Error; + + if (error != null) + Console.WriteLine($"Request failed - Code: {error.Code}, Name: {error.Name}, Message: {error.Message}"); + } + +``` + +*Twitter API:* [media/upload](https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload-init) \ No newline at end of file From 03f7ae5b9e549123fc68df2971399a303a2d5932 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 1 Dec 2020 05:17:51 +0000 Subject: [PATCH 31/95] Update Managing-Lists.md --- LINQ-to-Twitter-5/Managing-Lists.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Managing-Lists.md b/LINQ-to-Twitter-5/Managing-Lists.md index 715d725e..1550b628 100644 --- a/LINQ-to-Twitter-5/Managing-Lists.md +++ b/LINQ-to-Twitter-5/Managing-Lists.md @@ -6,7 +6,7 @@ Lists allow you to categorize Twitter accounts. Get a list of all lists -#### [Reading List Statuses](Managing-Lists/Reading-List_Statuses.md) +#### [Reading List Statuses](Managing-Lists/Reading-List-Statuses.md) Read tweets from a list From 9e4dfa1d1e732d4aa9797bc23a15d93218e84cee Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 02:55:11 +0000 Subject: [PATCH 32/95] Update Muting-Users.md --- LINQ-to-Twitter-5/Muting-Users.md | 8 ++--- .../Muting-Users/Getting-Muted-IDs.md | 27 +++++++++++++++ .../Muting-Users/Getting-Muted-Users.md | 30 ++++++++++++++++ LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md | 34 +++++++++++++++++++ .../Muting-Users/Unmute-a-User.md | 34 +++++++++++++++++++ 5 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md create mode 100644 LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md create mode 100644 LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md create mode 100644 LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md diff --git a/LINQ-to-Twitter-5/Muting-Users.md b/LINQ-to-Twitter-5/Muting-Users.md index fb019327..c58c2bf3 100644 --- a/LINQ-to-Twitter-5/Muting-Users.md +++ b/LINQ-to-Twitter-5/Muting-Users.md @@ -2,18 +2,18 @@ Lets a user turn off tweets from another account without unfollowing. -#### [[Getting Muted IDs]] +#### [Getting Muted IDs](Muting-Users/Getting-Muted-IDs.md) Retrieve a list of muted user IDs. -#### [[Getting Muted Users]] +#### [Getting Muted Users](Muting-Users/Getting-Muted-Users.md) Retrieve a list of muted user entities. -#### [[Mute a User]] +#### [Mute a User](Muting-Users/Mute-a-User.md) Turn off user's tweets without unfollowing them. -#### [[Unmute a User]] +#### [Unmute a User](Muting-Users/Unmute-a-User.md) Turn a user's tweets back on. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md new file mode 100644 index 00000000..a9a1aa1c --- /dev/null +++ b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md @@ -0,0 +1,27 @@ +#### Getting Muted IDs + +Retrieve a list of muted user IDs. + +*Entity:* [[Mute|Mute Entity]] +*Type:* MuteType.IDs + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Allows you to page through query results | long | no | + +##### v3.x Example: + +```c# + var muteResponse = + await + (from mute in twitterCtx.Mute + where mute.Type == MuteType.IDs + select mute) + .SingleOrDefaultAsync(); + + muteResponse.IDList.ForEach(id => Console.WriteLine(id)); +``` + +*Twitter API:* [mutes/users/ids](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md new file mode 100644 index 00000000..d7451cae --- /dev/null +++ b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md @@ -0,0 +1,30 @@ +#### Getting Muted Users + +Retrieve a list of muted user entities. + +*Entity:* [[Mute|Mute Entity]] +*Type:* MuteType.List + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Cursor | Allows you to page through query results | long | no | +| IncludeEntitites | Set to true for Twitter to return entity metadata with users last tweet | bool | no | +| SkipStatus | Set to true to remove tweet from user entities | bool | no | + +##### v3.x Example: + +```c# + var muteResponse = + await + (from mute in twitterCtx.Mute + where mute.Type == MuteType.List + select mute) + .SingleOrDefaultAsync(); + + muteResponse.Users.ForEach( + user => Console.WriteLine(user.ScreenNameResponse)); +``` + +*Twitter API:* [mutes/users/list](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md b/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md new file mode 100644 index 00000000..f4dfc9fd --- /dev/null +++ b/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md @@ -0,0 +1,34 @@ +#### Mute a User + +Turn off user's tweets without unfollowing them. + +##### Signature: + +```c# +public async Task MuteAsync( + string screenName, CancellationToken cancelToken = default(CancellationToken)); +public async Task MuteAsync( + ulong userID, CancellationToken cancelToken = default(CancellationToken)) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| cancelToken | Allows .NET cancellation framework | CancellationToken | no | +| screenName | Screen name of user to mute | string | yes (on matching overload) | +| userID | ID of user to mute | ulong | yes (on matching overload) | + +*Return Type:* [[User|User Entity]] + +##### v3.x Example: + +```c# + const string ScreenName = "justinbieber"; + + User mutedUser = await twitterCtx.MuteAsync(ScreenName); + + Console.WriteLine("You muted {0}", mutedUser.ScreenNameResponse); +``` + +*Twitter API:* [mutes/users/create](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md b/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md new file mode 100644 index 00000000..b3274692 --- /dev/null +++ b/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md @@ -0,0 +1,34 @@ +#### Unmute a User + +Turn a user's tweets back on. + +##### Signature: + +```c# +public async Task UnMuteAsync( + string screenName, CancellationToken cancelToken = default(CancellationToken)); +public async Task UnMuteAsync( + ulong userID, CancellationToken cancelToken = default(CancellationToken)) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| cancelToken | Allows .NET cancellation framework | CancellationToken | no | +| screenName | Screen name of user to mute | string | yes (on matching overload) | +| userID | ID of user to mute | ulong | yes (on matching overload) | + +*Return Type:* [[User|User Entity]] + +##### v3.x Example: + +```c# + const string ScreenName = "JoeMayo"; + + User unmutedUser = await twitterCtx.UnMuteAsync(ScreenName); + + Console.WriteLine("You un-muted {0}", unmutedUser.ScreenNameResponse); +``` + +*Twitter API:* [mutes/users/destroy](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy) \ No newline at end of file From 28f2f2553d8658d5c75bf65fbe6b3daec8be9200 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:00:23 +0000 Subject: [PATCH 33/95] Update Managing-Saved-Searches.md --- LINQ-to-Twitter-5/Managing-Saved-Searches.md | 8 ++-- .../Creating-a-Saved-Search.md | 39 +++++++++++++++ .../Destroying-a-Saved-Search.md | 41 ++++++++++++++++ .../Getting-Info-on-a-Saved-Search.md | 47 +++++++++++++++++++ .../Getting-a-List-of-Saved-Searches.md | 41 ++++++++++++++++ 5 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md create mode 100644 LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md create mode 100644 LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md create mode 100644 LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches.md b/LINQ-to-Twitter-5/Managing-Saved-Searches.md index 32dd0434..1c69b3e8 100644 --- a/LINQ-to-Twitter-5/Managing-Saved-Searches.md +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches.md @@ -2,18 +2,18 @@ You can save searches and reuse them later. -#### [[Getting a List of Saved Searches]] +#### [Getting a List of Saved Searches](Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md) Get a list of saved searches -#### [[Getting Info on a Saved Search]] +#### [Getting Info on a Saved Search](Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md) Get details on a saved search -#### [[Creating a Saved Search]] +#### [Creating a Saved Search](Managing-Saved-Searches/Creating-a-Saved-Search.md) Create a new saved search -#### [[Destroying a Saved Search]] +#### [Destroying a Saved Search](Managing-Saved-Searches/Destroying-a-Saved-Search.md) Delete a saved search diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md new file mode 100644 index 00000000..77911912 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md @@ -0,0 +1,39 @@ +#### Creating a Saved Search + +Create a new saved search. + +##### Signature: + +```c# +public async Task CreateSavedSearchAsync(string query) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| query | Text of search query | string | yes | + +*Return Type:* [[SavedSearch|SavedSearch Entity]] + +##### v3.0 Example: + +```c# + SavedSearch savedSearch = + await twitterCtx.CreateSavedSearchAsync("linq"); + + if (savedSearch != null) + Console.WriteLine( + "ID: {0}, Search: {1}", + savedSearch.IDResponse, savedSearch.Query); +``` + +##### v2.1 Example: + +```c# +var savedSearch = twitterCtx.CreateSavedSearch("#csharp"); + +Console.WriteLine("ID: {0}, Search: {1}", savedSearch.IDString, savedSearch.Query); +``` + +*Twitter API:* [saved_searches/create](https://dev.twitter.com/docs/api/1.1/post/saved_searches/create) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md new file mode 100644 index 00000000..b99e9f05 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md @@ -0,0 +1,41 @@ +#### Destroying a Saved Search + +Delete a saved search. + +##### Signature: + +```c# +public async Task DestroySavedSearchAsync(ulong id) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| id | Saved search ID | ulong | yes | + +*Return Type:* [[SavedSearch|SavedSearch Entity]] + +##### v3.0 Example: + +```c# + ulong savedSearchID = 0; + + SavedSearch savedSearch = + await twitterCtx.DestroySavedSearchAsync(savedSearchID); + + if (savedSearch != null) + Console.WriteLine( + "ID: {0}, Search: {1}", + savedSearch.ID, savedSearch.Name); +``` + +##### v2.1 Example: + +```c# + var savedSearch = twitterCtx.DestroySavedSearch(101352438); + + Console.WriteLine("ID: {0}, Search: {1}", savedSearch.ID, savedSearch.Name); +``` + +*Twitter API:* [saved_searches/destroy/:id](https://dev.twitter.com/docs/api/1.1/post/saved_searches/destroy/%3Aid) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md new file mode 100644 index 00000000..3f8301f4 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md @@ -0,0 +1,47 @@ +#### Getting Info on a Saved Search + +Get details on a saved search. + +*Entity:* [[SavedSearch|SavedSearch Entity]] +*Type:* SavedSearchType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Saved search ID | ulong | yes | + +##### v3.0 Example: + +```c# + ulong savedSearchID = 306668698; + + var savedSearch = + await + (from search in twitterCtx.SavedSearch + where search.Type == SavedSearchType.Show && + search.ID == savedSearchID + select search) + .SingleOrDefaultAsync(); + + if (savedSearch != null) + Console.WriteLine( + "ID: {0}, Search: {1}", + savedSearch.ID, savedSearch.Name); +``` + +##### v2.1 Example: + +```c# + var savedSearches = + from search in twitterCtx.SavedSearch + where search.Type == SavedSearchType.Show && + search.ID == "3275867" + select search; + + var savedSearch = savedSearches.FirstOrDefault(); + + Console.WriteLine("ID: {0}, Search: {1}", savedSearch.ID, savedSearch.Name); +``` + +*Twitter API:* [saved_searches/show/:id](https://dev.twitter.com/docs/api/1.1/get/saved_searches/show/%3Aid) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md new file mode 100644 index 00000000..1b677276 --- /dev/null +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md @@ -0,0 +1,41 @@ +#### Getting a List of Saved Searches + +Get a list of saved searches. + +*Entity:* [[SavedSearch|SavedSearch Entity]] +*Type:* SavedSearchType.Searches + +##### Parameters/Filters: + +None + +##### v3.0 Example: + +```c# + var savedSearches = + await + (from search in twitterCtx.SavedSearch + where search.Type == SavedSearchType.Searches + select search) + .ToListAsync(); + + if (savedSearches != null) + savedSearches.ForEach( + search => Console.WriteLine("Search: " + search.Query)); +``` + +##### v2.1 Example: + +```c# + var savedSearches = + from search in twitterCtx.SavedSearch + where search.Type == SavedSearchType.Searches + select search; + + foreach (var search in savedSearches) + { + Console.WriteLine("ID: {0}, Search: {1}", search.ID, search.Name); + } +``` + +*Twitter API:* [saved_searches/list](https://dev.twitter.com/docs/api/1.1/get/saved_searches/list) \ No newline at end of file From fbd561126a973aac59f643d3af20e7877dfa83ff Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:04:51 +0000 Subject: [PATCH 34/95] Update Performing-Searches-and-Finding-Trends.md --- .../Performing-Searches-and-Finding-Trends.md | 8 +- .../Getting-Closest-Trends.md | 52 +++++++ .../Getting-Trend-Locations.md | 39 +++++ .../Retrieving-Available-Trend-Locations.md | 45 ++++++ .../Searching-Twitter.md | 135 ++++++++++++++++++ 5 files changed, 275 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md create mode 100644 LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md create mode 100644 LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md create mode 100644 LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md index fdda33ed..6cf48a99 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends.md @@ -2,18 +2,18 @@ You'll learn how LINQ to Twitter supports search and trends in this section. -#### [[Searching Twitter]] +#### [Searching Twitter](Performing-Searches-and-Finding-Trends/Searching-Twitter.md) Perform a search -#### [[Getting Trend Locations]] +#### [Getting Trend Locations](Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md) Get trends for a specified place -#### [[Retrieving Available Trend Locations]] +#### [Retrieving Available Trend Locations](Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md) Get locations where trends are occurring -#### [[Getting Closest Trends]] +#### [Getting Closest Trends](Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md) Get trends closest to a given latitude and longitude. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md new file mode 100644 index 00000000..62ab9bcc --- /dev/null +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md @@ -0,0 +1,52 @@ +#### Getting Closest Trends + +Get trends closest to a given latitude and longitude. + +*Entity:* [[Trends|Trend Entity]] +*Type:* TrendType.Closest + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Latitude | Location latitude | double | yes | +| Longitude | Location longitude | double | yes | + +##### v3.0 Example: + +```c# + var trend = + await + (from trnd in twitterCtx.Trends + where trnd.Type == TrendType.Closest && + trnd.Latitude == 37.78215 && + trnd.Longitude == -122.40060 + select trnd) + .SingleOrDefaultAsync(); + + if (trend != null && trend.Locations != null) + trend.Locations.ForEach( + loc => Console.WriteLine( + "Name: {0}, Country: {1}, WoeID: {2}", + loc.Name, loc.Country, loc.WoeID)); +``` + +##### v2.1 Example: + +```c# + var trends = + from trnd in twitterCtx.Trends + where trnd.Type == TrendType.Closest && + trnd.Latitude == "37.78215" && + trnd.Longitude == "-122.40060" + select trnd; + + var trend = trends.SingleOrDefault(); + + trend.Locations.ToList().ForEach( + loc => Console.WriteLine( + "Name: {0}, Country: {1}, WoeID: {2}", + loc.Name, loc.Country, loc.WoeID)); +``` + +*Twitter API:* [trends/closest](https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md new file mode 100644 index 00000000..55bc66c0 --- /dev/null +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md @@ -0,0 +1,39 @@ +#### Getting Trend Locations + +Get trends for a specified place. + +*Entity:* [[Trends|Trend Entity]] +*Type:* TrendType.Place + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| WoeID | Yahoo! Where on Earth ID | int | yes | +##### Example: + +```c# + var trends = + await + (from trend in twitterCtx.Trends + where trend.Type == TrendType.Place && + trend.WoeID == 2486982 + select trend) + .ToListAsync(); + + if (trends != null && + trends.Any() && + trends.First().Locations != null) + { + Console.WriteLine( + "Location: {0}\n", + trends.First().Locations.First().Name); + + trends.ForEach(trnd => + Console.WriteLine( + "Name: {0}, Date: {1}, Query: {2}\nSearch {3}", + trnd.Name, trnd.CreatedAt, trnd.Query, trnd.SearchUrl)); + } +``` + +*Twitter API:* [trends/place](https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md new file mode 100644 index 00000000..a158fd34 --- /dev/null +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md @@ -0,0 +1,45 @@ +#### Retrieving Available Trend Locations + +Get locations where trends are occurring. + +*Entity:* [[Trends|Trend Entity]] +*Type:* TrendType.Available + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Lat | Latitude coordinate | dec | yes | +| Long | Longitude coordinate | dec | yes | +##### v3.0 Example: + +```c# + var trendsResponse = + await + (from trend in twitterCtx.Trends + where trend.Type == TrendType.Available + select trend) + .SingleOrDefaultAsync(); + + if (trendsResponse != null && trendsResponse.Locations != null) + trendsResponse.Locations.ForEach( + loc => Console.WriteLine("Location: " + loc.Name)); +``` + +##### v2.1 Example: + +```c# + var trends = + from trnd in twitterCtx.Trends + where trnd.Type == TrendType.Available + select trnd; + + var trend = trends.FirstOrDefault(); + + trend.Locations.ToList().ForEach( + loc => Console.WriteLine( + "Name: {0}, Country: {1}, WoeID: {2}", + loc.Name, loc.Country, loc.WoeID)); +``` + +*Twitter API:* [trends/available](https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md new file mode 100644 index 00000000..af89d822 --- /dev/null +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md @@ -0,0 +1,135 @@ +#### Searching Twitter + +Perform a search. + +*Entity:* [[Search|Search Entity]] +*Type:* SearchType.Search (optional) + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of tweets to retrieve for each page. Max is 100. | int | no | +| GeoCode | Tweets within the Radius from a specified Latitude and Longitude. Specify as "latitude,longitude,radius". | string | no | +| IncludeEntities | Omits entities when set to false. Default is true. | bool | no | +| Lang | Language to return tweets in as defined by [ISO-639-1](http://en.wikipedia.org/wiki/ISO_639-1]. | string | no | +| Locale | Language used in query. _ja_ is currently the only supported language other than _en_. Defaults to _en_. | string | no | +| MaxID | Return tweets prior to or equal to this ID. | ulong | no | +| Query | Search query. Can contain search operators defined at [Twitter Search API docs](https://dev.twitter.com/docs/api/1/get/search]. | string | yes | +| ResultType | Specify whether tweets should be Popular, Recent, or Mixed; defaults to recent. | ResultType | no | +| SearchLanguage | Language of tweets. | int | no | +| SinceID | Return tweets later than this ID. | ulong | no | +| Type | Search type. | string | no | +| Until | Tweets up to this date, YYYY-MM-DD. | string | no | +##### v3.0+ Example: + +```c# + string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo"; + //searchTerm = "кот ("; + + Search searchResponse = + await + (from search in twitterCtx.Search + where search.Type == SearchType.Search && + search.Query == searchTerm && + search.IncludeEntities == true && + search.TweetMode == TweetMode.Extended + select search) + .SingleOrDefaultAsync(); + + if (searchResponse?.Statuses != null) + searchResponse.Statuses.ForEach(tweet => + Console.WriteLine( + "\n User: {0} ({1})\n Tweet: {2}", + tweet.User.ScreenNameResponse, + tweet.User.UserIDResponse, + tweet.Text ?? tweet.FullText)); + else + Console.WriteLine("No entries found."); +``` + +##### Paging Demo: +```c# + const int MaxSearchEntriesToReturn = 10; + const int MaxTotalResults = 100; + + string searchTerm = "twitter"; + + // oldest id you already have for this search term + ulong sinceID = 1; + + // used after the first query to track current session + ulong maxID; + + var combinedSearchResults = new List(); + + List searchResponse = + await + (from search in twitterCtx.Search + where search.Type == SearchType.Search && + search.Query == searchTerm && + search.Count == MaxSearchEntriesToReturn && + search.SinceID == sinceID && + search.TweetMode == TweetMode.Extended + select search.Statuses) + .SingleOrDefaultAsync(); + + if (searchResponse != null) + { + combinedSearchResults.AddRange(searchResponse); + ulong previousMaxID = ulong.MaxValue; + do + { + // one less than the newest id you've just queried + maxID = searchResponse.Min(status => status.StatusID) - 1; + + Debug.Assert(maxID < previousMaxID); + previousMaxID = maxID; + + searchResponse = + await + (from search in twitterCtx.Search + where search.Type == SearchType.Search && + search.Query == searchTerm && + search.Count == MaxSearchEntriesToReturn && + search.MaxID == maxID && + search.SinceID == sinceID && + search.TweetMode == TweetMode.Extended + select search.Statuses) + .SingleOrDefaultAsync(); + + combinedSearchResults.AddRange(searchResponse); + } while (searchResponse.Any() && combinedSearchResults.Count < MaxTotalResults); + + combinedSearchResults.ForEach(tweet => + Console.WriteLine( + "\n User: {0} ({1})\n Tweet: {2}", + tweet.User.ScreenNameResponse, + tweet.User.UserIDResponse, + tweet.Text ?? tweet.FullText)); + } + else + { + Console.WriteLine("No entries found."); + } +``` + +##### v2.1 Example: + +```c# + var srch = + (from search in twitterCtx.Search + where search.Type == SearchType.Search && + search.Query == "LINQ to Twitter" && + search.Count == 7 + select search) + .SingleOrDefault(); + + Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query); + srch.Statuses.ForEach(entry => + Console.WriteLine( + "ID: {0, -15}, Source: {1}\nContent: {2}\n", + entry.StatusID, entry.Source, entry.Text)); +``` + +*Twitter API:* [search/tweets](https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets) \ No newline at end of file From 636ee5baa470770e49620efd93135a44adb7d29d Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:16:48 +0000 Subject: [PATCH 35/95] Update Making-Status-Queries-and-Calls.md --- .../Making-Status-Queries-and-Calls.md | 24 ++-- .../Destroying-Statuses.md | 52 ++++++++ .../Getting-Multiple-Tweets.md | 34 ++++++ .../Getting-Retweeter-IDs.md | 44 +++++++ .../Getting-Status-oEmbed-Information.md | 53 ++++++++ ...Getting-Statuses-Retweeted-About-a-User.md | 50 ++++++++ .../Getting-the-Retweets-of-a-Status.md | 61 ++++++++++ .../Querying-Statuses.md | 66 ++++++++++ .../Querying-the-Home-Timeline.md | 50 ++++++++ .../Querying-the-Mentions-Timeline.md | 47 ++++++++ .../Querying-the-User-Timeline.md | 110 +++++++++++++++++ .../Retweeting-a-Status.md | 38 ++++++ .../Updating-Statuses.md | 114 ++++++++++++++++++ 13 files changed, 731 insertions(+), 12 deletions(-) create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md create mode 100644 LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md index 846a4baa..31b8a7dd 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls.md @@ -2,50 +2,50 @@ The status queries match both Twitter timeline queries and working with statuses -#### [[Querying the Mentions Timeline]] +#### [Querying the Mentions Timeline](Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md) Gets the 20 most recent tweets where the user has been mentioned -#### [[Querying the User Timeline]] +#### [Querying the User Timeline](Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md) Gets the 20 most recent tweets for a user (doesn't include user's friends) -#### [[Querying the Home Timeline]] +#### [Querying the Home Timeline](Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md) Gets the 20 most recent tweets, including retweets, for a user and user's friends -#### [[Getting Statuses Retweeted About a User]] +#### [Getting Statuses Retweeted About a User](Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md) Gets the 20 most recent retweets about a user. -#### [[Getting the Retweets of a Status]] +#### [Getting the Retweets of a Status](Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md) Gets up to 100 retweets of a tweet -#### [[Querying Statuses]] +#### [Querying Statuses](Making-Status-Queries-and-Calls/Querying-Statuses.md) Gets a specific tweet -#### [[Getting Multiple Tweets]] +#### [Getting Multiple Tweets](Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md) Gets a list of tweets -#### [[Destroying Statuses]] +#### [Destroying Statuses](Making-Status-Queries-and-Calls/Destroying-Statuses.md) Deletes a tweet -#### [[Updating Statuses]] +#### [Updating Statuses](Making-Status-Queries-and-Calls/Updating-Statuses.md) Creates a new tweet -#### [[Retweeting a Status]] +#### [Retweeting a Status](Making-Status-Queries-and-Calls/Retweeting-a-Status.md) Performs a retweet of a tweet -#### [[Getting Status oEmbed Information]] +#### [Getting Status oEmbed Information](Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md) Gets embeddable status information. -#### [[Getting Retweeter IDs]] +#### [Getting Retweeter IDs](Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md) Gets up to 100 IDs of users that retweeted a specific tweet \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md new file mode 100644 index 00000000..3d4800e9 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md @@ -0,0 +1,52 @@ +#### Destroying Statuses + +Delete a tweet. + +##### Signature: + +```c# +public async Task DeleteTweetAsync(ulong tweetID) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| tweetID | ID of tweet to delete | ulong | yes | + +*Return Type:* [[Status|Status Entity]] + +##### v 3.0 Example: + +```c# + ulong tweetID = 280433519057068033; + + Status status = + await twitterCtx.DeleteTweetAsync(tweetID); + + if (status != null && status.User != null) + Console.WriteLine( + "(" + status.StatusID + ")" + + "[" + status.User.UserID + "]" + + status.User.ScreenNameResponse + ", " + + status.Text + ", " + + status.CreatedAt); +``` + +##### v2.1 Example: + +```c# +var message = twitterCtx.NewDirectMessage("16761255", "Direct Message Test - " + + DateTime.Now); + +if (message != null) +{ + Console.WriteLine( + "Recipient: {0}, Message: {1}, Date: {2}", + message.RecipientScreenName, + message.Text, + message.CreatedAt); +} +``` + +*Twitter API:* [statuses/destroy/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md new file mode 100644 index 00000000..e29b1c0f --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md @@ -0,0 +1,34 @@ +#### Getting Multiple Tweets + +Looks up multiple tweets by ID + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Lookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Tweet ID to retrieve | ulong | yes | +| IncludeAltText | Includes Alt Text on media entities | bool | no | +| IncludeEntities | Doesn't include entities when set to false (default: true) | bool | no | +| Map | Include tweets that can't be viewed | bool | no | +| TrimUser | Return only user status ID and tweet | bool | no | + +##### v4.x Example: + +```c# + string tweetIds = "460788892723978241,462758132448362496,460060836967768064"; + + List tweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Lookup && + tweet.TweetIDs == tweetIds + select tweet) + .ToListAsync(); + + PrintTweetsResults(tweets); +``` + +*Twitter API:* [statuses/lookup](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md new file mode 100644 index 00000000..444671da --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md @@ -0,0 +1,44 @@ +#### Getting Retweeter IDs + +Gets up to 100 IDs of users that retweeted a specific tweet. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Retweeters + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Tweet ID | ulong | yes | +| Cursor | Next page of data to return | long | no | +##### v3.0 Example: +```c# + ulong tweetID = 210591841312190464; + + var status = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Retweeters && + tweet.ID == tweetID + select tweet) + .SingleOrDefaultAsync(); + + if (status != null && status.User != null) + status.Users.ForEach( + userID => Console.WriteLine("User ID: " + userID)); +``` + +##### v2.1 Example: +```c# + var status = + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Retweeters && + tweet.ID == "210591841312190464" + select tweet) + .SingleOrDefault(); + + status.Users.ForEach( + userID => Console.WriteLine("User ID: " + userID)); +``` + +*Twitter API:* [statuses/retweeters/ids](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md new file mode 100644 index 00000000..0219dbad --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md @@ -0,0 +1,53 @@ +#### Getting Status oEmbed Information + +Gets embeddable status information. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Oembed + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Tweet ID | ulong | yes | +| OEmbedUrl | Tweet URL | string | yes | +| OEmbedAlign | Embedded tweet alignment | EmbeddedStatusAlignment | no | +| OEmbedHideMedia | Hide attached media | bool | no | +| OEmbedHideThread | Hide thread | bool | no | +| OEmbedLanguage | Language code for the embedded HTML | string | no | +| OEmbedMaxWidth | Width of embedded tweet | int | no | +| OEmbedOmitScript | Hide < script > in the returned HTML | bool | no | +| OEmbedRelated | Related parameter value | string | no | + +##### v3.0 Example: + +```c# + ulong tweetID = 305050067973312514; + + var embeddedStatus = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Oembed && + tweet.ID == tweetID + select tweet.EmbeddedStatus) + .SingleOrDefaultAsync(); + + if (embeddedStatus != null) + Console.WriteLine( + "Embedded Status Html: \n\n" + embeddedStatus.Html); +``` + +##### v2.1 Example: + +```c# + var embeddedStatus = + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Oembed && + tweet.ID == "305050067973312514" + select tweet.EmbeddedStatus) + .SingleOrDefault(); + + Console.WriteLine("Embedded Status Html: " + embeddedStatus.Html); +``` + +*Twitter API:* [statuses/oembed](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md new file mode 100644 index 00000000..d4e51606 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md @@ -0,0 +1,50 @@ +#### Getting Statuses Retweeted About a User + +Gets the 20 most recent retweets about a user. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.RetweetsOfMe + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of tweets to return; max is 200 | int | no | +| IncludeEntities | Include Twitter entities | bool | no | +| IncludeUserEntities | Include user entities | bool | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| SinceID | Return tweets later than this ID | ulong | no | +| TrimUser | Return only user status ID and tweet | bool | no | + +##### v3.0 Example: + +```c# + var myRetweets = + await + (from retweet in twitterCtx.Status + where retweet.Type == StatusType.RetweetsOfMe && + retweet.Count == 100 + select retweet) + .ToListAsync(); + + myRetweets.ForEach( + retweet => Console.WriteLine( + "Name: {0}, Tweet: {1}\n", + retweet.User.Name, retweet.Text)); +``` + +##### v2.1 Example: + +```c# + var myRetweets = + from retweet in twitterCtx.Status + where retweet.Type == StatusType.RetweetsOfMe + select retweet; + + retweets.ToList().ForEach( + retweet => Console.WriteLine( + "Name: {0}, Tweet: {1}\n", + retweet.Retweet.RetweetedUser.Name, retweet.Text)); +``` + +*Twitter API:* [statuses/retweets_of_me](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md new file mode 100644 index 00000000..844f9a39 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md @@ -0,0 +1,61 @@ +#### Getting the Retweets of a Status + +Gets up to 100 retweets of a tweet. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Retweets + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Identifies tweet to get retweets for | ulong | yes | +| Count | Number of tweets to return; max is 100 | int | no | +| TrimUser | Return only user status ID and tweet | bool | no | + +##### v3.0 Example: + +```c# + ulong tweetID = 196991337554378752; + + var publicTweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Retweets && + tweet.ID == tweetID + select tweet) + .ToListAsync(); + + if (publicTweets != null) + publicTweets.ForEach(tweet => + { + if (tweet != null && tweet.User != null) + Console.WriteLine( + "@{0} {1} ({2})", + tweet.User.ScreenNameResponse, + tweet.Text, + tweet.RetweetCount); + }); +``` + +##### v2.1 Example: + +```c# + var publicTweets = + from tweet in twitterCtx.Status + where tweet.Type == StatusType.Retweets && + tweet.ID == "196991337554378752" + select tweet; + + publicTweets.ToList().ForEach( + tweet => + { + Console.WriteLine( + "@{0} {1} ({2})", + tweet.User.Identifier.ScreenName, + tweet.Text, + tweet.RetweetCount); + }); +``` + +*Twitter API:* [statuses/retweets/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md new file mode 100644 index 00000000..c3e34dab --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md @@ -0,0 +1,66 @@ +#### Querying Statuses + +Gets a specific tweet. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | Tweet ID to retrieve | ulong | yes | +| IncludeMyRetweet | Populates CurrentUserRetweet in response if set to true | bool | no | +| IncludeEntities | Doesn't include entities when set to false (default: true) | bool | no | +| TrimUser | Return only user status ID and tweet | bool | no | +| IncludeAltText | Includes Alt Text on media entities | bool | no | + +##### v3.0+ Example: + +```c# + ulong tweetID = 806571633754284032; + + List status = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Show && + tweet.ID == tweetID && + tweet.TweetMode == TweetMode.Extended && + tweet.IncludeAltText == true + select tweet) + .ToListAsync(); + + if (status != null) + { + Console.WriteLine("\nTweets: \n"); + status.ForEach(tweet => + { + if (tweet != null && tweet.User != null) + Console.WriteLine( + "User: " + tweet.User.Name + + "\nTweet: " + tweet.Text + + "\nTweet ID: " + tweet.ID + "\n"); + }); + } +``` + +##### v2.1 Example: + +```c# + var friendTweets = + from tweet in twitterCtx.Status + where tweet.Type == StatusType.Show && + tweet.ID == "10520783556" + select tweet; + + Console.WriteLine("\nRequested Tweet: \n"); + foreach (var tweet in friendTweets) + { + Console.WriteLine( + "User: " + tweet.User.Name + + "\nTweet: " + tweet.Text + + "\nTweet ID: " + tweet.ID + "\n"); + } +``` + +*Twitter API:* [statuses/show/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md new file mode 100644 index 00000000..4cb3b840 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md @@ -0,0 +1,50 @@ +#### Querying the Home Timeline + +Gets the 20 most recent statuses, including retweets, for a user and user's friends. + +This query returns the tweets and retweets shown on a user's home page when they log into Twitter. + +The maximum number of tweets/retweets returned is 800. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Home + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeContributorDetails | Include additional user details | bool | no | +| Count | Number of tweets to return; max is 200; default is 20 | int | no | +| ExcludeReplies | Exclude tweet replies | bool | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| SinceID | Return tweets later than this ID | ulong | no | +| TrimUser | Return only user status ID and tweet | bool | no | + +##### v3.0 Example: +```c# + var tweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Home + select tweet) + .ToListAsync(); + + PrintTweetsResults(tweets); +``` + +##### v2.1 Example: +```c# + var tweets = + from tweet in twitterCtx.Status + where tweet.Type == StatusType.Home + select tweet; + + Console.WriteLine("\nTweets for " + twitterCtx.UserName + "\n"); + + tweets.ToList().ForEach( + tweet => Console.WriteLine( + "Name: {0}, Tweet: {1}\n", + tweet.User.Name, tweet.Text)); +``` + +*Twitter API:* [statuses/home_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md new file mode 100644 index 00000000..483dc0a7 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md @@ -0,0 +1,47 @@ +#### Querying the Mentions Timeline + +Gets the 20 most recent statuses where the user has been mentioned. A mention is defined as a tweet that contains the @ScreenName of the user. Only works for authorized user. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.Mentions + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of tweets to return; max is 200 | int | no | +| IncludeContributorDetails | Include additional user details | bool | no | +| IncludeEntities | Include Twitter entities | bool | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| SinceID | Return tweets later than this ID | ulong | no | +| TrimUser | Return only user status ID and tweet | bool | no | + +##### v3.0 Example: + +```c# + var tweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.Mentions && + tweet.ScreenName == "JoeMayo" + select tweet) + .ToListAsync(); + + PrintTweetsResults(tweets); +``` + +##### v2.1 Example: + +```c# + var myMentions = + from mention in twitterCtx.Status + where mention.Type == StatusType.Mentions + select mention; + + myMentions.ToList().ForEach( + mention => Console.WriteLine( + "Name: {0}, Tweet[{1}]: {2}\n", + mention.User.Name, mention.StatusID, mention.Text)); +``` + +*Twitter API:* [statuses/mentions_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md new file mode 100644 index 00000000..9501fd2b --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md @@ -0,0 +1,110 @@ +#### Querying the User Timeline + +Gets the 20 most recent statuses for the authorized user (doesn't include user's friends). The max number of tweets you can retrieve is 3200. + +*Entity:* [[Status|Status Entity]] +*Type:* StatusType.User + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeContributorDetails | Include additional user details | bool | no | +| Count | Number of tweets to return; max is 200 | int | no | +| ExcludeReplies | Exclude tweet replies | bool | no | +| ID | ID or ScreenName of user | ulong | only if UserID and ScreenName are empty | +| IncludeMyRetweet | Include retweets | bool | no | +| MaxID | Return tweets earlier than or equal to this ID | ulong | no | +| ScreenName | Screen name of user | string | only if ID and UserID are empty | +| SinceID | Return tweets later than this ID | ulong | no | +| TrimUser | Trim user details | bool | no | +| UserID | ID of user | ulong | only if ID and ScreenName are empty | + +##### v3.0 Example: + +```c# + static async Task RunUserTimelineQueryAsync(TwitterContext twitterCtx) + { + //List tweets = + // await + // (from tweet in twitterCtx.Status + // where tweet.Type == StatusType.User && + // tweet.ScreenName == "JoeMayo" + // select tweet) + // .ToListAsync(); + + const int MaxTweetsToReturn = 200; + const int MaxTotalResults = 100; + + // oldest id you already have for this search term + ulong sinceID = 1; + + // used after the first query to track current session + ulong maxID; + + var combinedSearchResults = new List(); + + List tweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.User && + tweet.ScreenName == "JoeMayo" && + tweet.Count == MaxTweetsToReturn && + tweet.SinceID == sinceID && + tweet.TweetMode == TweetMode.Extended + select tweet) + .ToListAsync(); + + if (tweets != null) + { + combinedSearchResults.AddRange(tweets); + ulong previousMaxID = ulong.MaxValue; + do + { + // one less than the newest id you've just queried + maxID = tweets.Min(status => status.StatusID) - 1; + + Debug.Assert(maxID < previousMaxID); + previousMaxID = maxID; + + tweets = + await + (from tweet in twitterCtx.Status + where tweet.Type == StatusType.User && + tweet.ScreenName == "JoeMayo" && + tweet.Count == MaxTweetsToReturn && + tweet.MaxID == maxID && + tweet.SinceID == sinceID && + tweet.TweetMode == TweetMode.Extended + select tweet) + .ToListAsync(); + + combinedSearchResults.AddRange(tweets); + + } while (tweets.Any() && combinedSearchResults.Count < MaxTotalResults); + + PrintTweetsResults(tweets); + } + else + { + Console.WriteLine("No entries found."); + } + } +``` + +##### v2.1 Example: + +```c# + var statusTweets = + from tweet in twitterCtx.Status + where tweet.Type == StatusType.User + && tweet.ScreenName == "JoeMayo" + select tweet; + + statusTweets.ToList().ForEach( + tweet => Console.WriteLine( + "Name: {0}, Tweet: {1}\n", + tweet.User.Name, tweet.Text)); +``` + +*Twitter API:* [statuses/user_timeline](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md new file mode 100644 index 00000000..23be89b1 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md @@ -0,0 +1,38 @@ +#### Retweeting a Status + +Retweets a tweet. + +##### Signature: + +```c# +public async Task RetweetAsync(ulong tweetID) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| tweetID | ID of user replied to. | ulong | yes | + +*Return Type:* [[Status|Status Entity]] + +##### Example: + +```c# + ulong tweetID = 401033367283453953; + + var retweet = await twitterCtx.RetweetAsync(tweetID); + + if (retweet != null && + retweet.RetweetedStatus != null && + retweet.RetweetedStatus.User != null) + { + Console.WriteLine("Retweeted Tweet: "); + Console.WriteLine( + "\nUser: " + retweet.RetweetedStatus.User.ScreenNameResponse + + "\nTweet: " + retweet.RetweetedStatus.Text + + "\nTweet ID: " + retweet.RetweetedStatus.ID + "\n"); + } +``` + +*Twitter API:* [statuses/retweet/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md new file mode 100644 index 00000000..1dd52f71 --- /dev/null +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md @@ -0,0 +1,114 @@ +#### Updating Statuses + +Tweet or reply to a tweet. + +##### Signature: + +```c# +public async Task ReplyAsync( + ulong tweetID, string status) +public async Task ReplyAsync( + ulong tweetID, string status, decimal latitude, + decimal longitude, bool displayCoordinates) +public async Task ReplyAsync( + ulong tweetID, string status, decimal latitude, + decimal longitude, string placeID, bool trimUser) +public async Task ReplyAsync( + ulong tweetID, string status, string placeID, + bool displayCoordinates, bool trimUser) +public async Task ReplyAsync( + ulong tweetID, string status, decimal latitude, + decimal longitude, string placeID, + bool displayCoordinates, bool trimUser) + +public async Task TweetAsync( + string status) +public async Task TweetAsync( + string status, decimal latitude, decimal longitude) +public async Task TweetAsync( + string status, decimal latitude, + decimal longitude, bool displayCoordinates) +public async Task TweetAsync( + string status, decimal latitude, decimal longitude, + string placeID, bool trimUser) +public async Task TweetAsync( + string status, decimal latitude, decimal longitude, + string placeID, bool displayCoordinates, bool trimUser) +public async Task TweetAsync( + string status, string placeID, + bool displayCoordinates, bool trimUser) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| displayCoordinates | Choose whether location info should appear in this specific tweet; defaults to false. | bool | no | +| tweetID | ID of user replied to. | ulong | no | +| latitude | Latitude location coordinate. | decimal | no | +| longitude | Logitude location coordinate. | decimal | no | +| placeID | ID of place (can be obtained via reverse geo lookup (Geo.Reverse in LINQ to Twitter). | string | no | +| status | Text for new tweet. Must be 280 characters or less in length. | string | yes | +| tweetMode | Set to TweetMode.Extended for 280 characters returned in Status.FullText. | TweetMode | no | + +**Return Type:** [[Status|Status Entity]] + +**Note:** When replying, remember to prefix the tweet with the _@UserName_ for the person you're replying to. + +##### v 3.0 Example: + +```c# + Console.Write("Enter your status update: "); + string status = Console.ReadLine(); + + Console.WriteLine("\nStatus being sent: \n\n\"{0}\"", status); + Console.Write("\nDo you want to update your status? (y or n): "); + string confirm = Console.ReadLine(); + + if (confirm.ToUpper() == "N") + { + Console.WriteLine("\nThis status is *not* being sent."); + } + else if (confirm.ToUpper() == "Y") + { + Console.WriteLine("\nPress any key to post tweet...\n"); + Console.ReadKey(true); + + var tweet = await twitterCtx.TweetAsync(status); + + if (tweet != null) + Console.WriteLine( + "Status returned: " + + "(" + tweet.StatusID + ")" + + tweet.User.Name + ", " + + tweet.Text + "\n"); + } + else + { + Console.WriteLine("Not a valid entry."); + } +``` + +##### v2.1 Example: + +```c# + var status = + " Testing LINQ to Twitter update status on \n " + + DateTime.Now.ToString() + " #linqtotwitter "; + + Console.WriteLine("\nStatus being sent: \n\n\"{0}\"", status); + Console.WriteLine("\nPress any key to post tweet...\n"); + Console.ReadKey(); + + var tweet = twitterCtx.UpdateStatus(status); + + Console.WriteLine( + "Status returned: " + + "(" + tweet.StatusID + ")" + + "[" + tweet.User.ID + "]" + + tweet.User.Name + ", " + + tweet.Text + ", " + + tweet.CreatedAt + "\n"); +``` + +*Twitter API:* [statuses/update](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update) \ No newline at end of file From 8a238f4f510108c69acf8983b285d6890236e1e7 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:23:51 +0000 Subject: [PATCH 36/95] Update Getting-User-Information.md --- LINQ-to-Twitter-5/Getting-User-Information.md | 20 +++--- .../Getting-User-Statuses-in-a-Category.md | 63 +++++++++++++++++++ .../Querying-Profile-Banner-Sizes.md | 49 +++++++++++++++ .../Querying-Suggested-User-Categories.md | 43 +++++++++++++ .../Querying-Suggested-Users-in-a-Category.md | 52 +++++++++++++++ .../Querying-User-Contributees.md | 47 ++++++++++++++ .../Querying-User-Contributors.md | 47 ++++++++++++++ .../Querying-User-Details.md | 48 ++++++++++++++ .../Querying-User-Info.md | 60 ++++++++++++++++++ .../Reporting-Spam.md | 39 ++++++++++++ .../Searching-for-Users.md | 47 ++++++++++++++ 11 files changed, 505 insertions(+), 10 deletions(-) create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md create mode 100644 LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md diff --git a/LINQ-to-Twitter-5/Getting-User-Information.md b/LINQ-to-Twitter-5/Getting-User-Information.md index 735c4b33..daeecae0 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information.md +++ b/LINQ-to-Twitter-5/Getting-User-Information.md @@ -2,42 +2,42 @@ You can get information on users, their friends, and their followers -#### [[Querying User Details]] +#### [Querying User Details](Getting-User-Information/Querying-User-Details.md) Look up details on specified users -#### [[Querying User Info]] +#### [Querying User Info](Getting-User-Information/Querying-User-Information.md) Show information for a user -#### [[Searching for Users]] +#### [Searching for Users](Getting-User-Information/Searching-for-Users.md) Find users with a search query -#### [[Querying User Contributees]] +#### [Querying User Contributees](Getting-User-Information/Querying-User-Contributees.md) Get list of users that the specified user can contribute to -#### [[Querying User Contributors]] +#### [Querying User Contributors](Getting-User-Information/Querying-User-Contributors.md) Get list of users that can contribute to the specified user -#### [[Querying Profile Banner Sizes]] +#### [Querying Profile Banner Sizes](Getting-User-Information/Querying-Profile-Banner-Sizes.md) Get list of allowable sizes for profile banners -#### [[Querying Suggested Users in a Category]] +#### [Querying Suggested Users in a Category](Getting-User-Information/Querying-Suggested-Users-in-a-Category.md) Get list of users in suggested users category -#### [[Querying Suggested User Categories]] +#### [Querying Suggested User Categories](Getting-User-Information/Querying-Suggested-User-Categories.md) Get list of categories for suggested users -#### [[Getting User Statuses in a Category]] +#### [Getting User Statuses in a Category](Getting-User-Information/Getting-User-Statuses-in-a-Category.md) Get list of user statuses in a category -#### [[Reporting Spam]] +#### [Reporting Spam](Getting-User-Information/Reporting-Spam.md) Report a user for SPAM \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md b/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md new file mode 100644 index 00000000..9257df4e --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md @@ -0,0 +1,63 @@ +#### Getting User Statuses in a Category + +Get list of user statuses in a category. + +*Entity:* [[User|User Entity]] +*Type:* UserType.CategoryStatus + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Slug | Short list name | string | yes | + +##### v3.0 Example: + +```c# + var catUsers = + await + (from user in twitterCtx.User + where user.Type == UserType.CategoryStatus && + user.Slug == "Technology" + select user) + .ToListAsync(); + + if (catUsers != null) + { + Console.WriteLine("Tweets: \n"); + + catUsers.ForEach(user => + { + if (user != null && user.Status != null) + Console.WriteLine( + "User: {0}\nTweet: {1}\n", + user.ScreenNameResponse, + user.Status == null ? + "" : + user.Status.Text); + }); + } +``` + +##### v2.1 Example: + +```c# + var catTweets = + (from user in twitterCtx.User + where user.Type == UserType.CategoryStatus && + user.Slug == "Technology" + select user) + .ToList(); + + Console.WriteLine("Tweets from Suggested Users in Technology Category: \n"); + + catTweets.ForEach(tweet => + Console.WriteLine( + "User: {0}\nTweet: {1}\n", + tweet.Name, + tweet.Status == null ? + "" : + tweet.Status.Text)); +``` + +*Twitter API:* [users/suggestions/:slug/members](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md new file mode 100644 index 00000000..31236691 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md @@ -0,0 +1,49 @@ +#### Querying Profile Banner Sizes + +Get list allowable sizes for profile banners. + +*Entity:* [[User|User Entity]] +*Type:* UserType.BannerSizes + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| UserID | ID of user | ulong | only if ScreenName is empty | +| ScreenName | Screen name of user | string | only if UserID is empty | + +##### v3.0 Example: + +```c# + var user = + await + (from usr in twitterCtx.User + where usr.Type == UserType.BannerSizes && + usr.ScreenName == "JoeMayo" + select usr) + .SingleOrDefaultAsync(); + + if (user != null && user.BannerSizes != null) + user.BannerSizes.ForEach(size => + Console.WriteLine( + "Label: {0}, W: {1} H: {2} {3}", + size.Label, size.Width, size.Height, size.Url)); +``` + +##### v2.1 Example: + +```c# + var user = + (from usr in twitterCtx.User + where usr.Type == UserType.BannerSizes && + usr.ScreenName == "Linq2Tweeter" + select usr) + .SingleOrDefault(); + + user.BannerSizes.ForEach(size => + Console.WriteLine( + "Label: {0}, W: {1} H: {2} {3}", + size.Label, size.Width, size.Height, size.Url)); +``` + +*Twitter API:* [users/profile_banner](https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md new file mode 100644 index 00000000..691405c4 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md @@ -0,0 +1,43 @@ +#### Querying Suggested User Categories + +Get list of categories for suggested users. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Categories + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Lang | Language to display | string | no | + +##### v3.0 Example: + +```c# + var user = + await + (from tweet in twitterCtx.User + where tweet.Type == UserType.Categories + select tweet) + .SingleOrDefaultAsync(); + + if (user != null && user.Categories != null) + user.Categories.ForEach(cat => + Console.WriteLine("Category: " + cat.Name)); +``` + +##### v2.1 Example: + +```c# + var users = + from tweet in twitterCtx.User + where tweet.Type == UserType.Categories + select tweet; + + var user = users.SingleOrDefault(); + + user.Categories.ForEach( + cat => Console.WriteLine("Category: " + cat.Name)); +``` + +*Twitter API:* [users/suggestions](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md new file mode 100644 index 00000000..0e449d82 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md @@ -0,0 +1,52 @@ +#### Querying Suggested Users in a Category + +Get list of users in suggested users category. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Category + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Lang | Language to display | string | no | +| Slug | Short list name | string | yes | + +##### v3.0 Example: + +```c# + var userResponse = + await + (from tweet in twitterCtx.User + where tweet.Type == UserType.Category && + tweet.Slug == "Funny" + select tweet) + .SingleOrDefaultAsync(); + + if (userResponse != null && + userResponse.Categories != null && + userResponse.Categories.Any() && + userResponse.Categories.First().Users != null) + { + List users = userResponse.Categories.First().Users; + + users.ForEach(user => + Console.WriteLine("User: " + user.ScreenNameResponse)); + } +``` + +##### v2.1 Example: + +```c# + var users = + (from tweet in twitterCtx.User + where tweet.Type == UserType.Category && + tweet.Slug == "funny" + select tweet) + .ToList(); + + users.ForEach( + user => Console.WriteLine("User: " + user.Name)); +``` + +*Twitter API:* [users/suggestions/:slug](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md new file mode 100644 index 00000000..ea2ba89a --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md @@ -0,0 +1,47 @@ +#### Querying User Contributees + +Get list of users that the specified user can contribute to. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Contributees + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Include Twitter entities | bool | no | +| UserID | ID of user | ulong | only if screenName is empty | +| ScreenName | Screen name of user | string | only if userID is empty | +| SkipStatus | Exclude status information | bool | no | + +##### v3.0 Example: + +```c# + var users = + await + (from user in twitterCtx.User + where user.Type == UserType.Contributees && + user.ScreenName == "biz" + select user) + .ToListAsync(); + + if (users != null) + users.ForEach(user => + Console.WriteLine("User: " + user.ScreenNameResponse)); +``` + +##### v2.1 Example: + +```c# + var users = + (from user in twitterCtx.User + where user.Type == UserType.Contributees && + user.ScreenName == "biz" + select user) + .ToList(); + + users.ForEach( + user => Console.WriteLine("User: " + user.Name)); +``` + +*Twitter API:* [users/contributees](https://developer.twitter.com/en/docs/api-reference-index) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md new file mode 100644 index 00000000..00003e9e --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md @@ -0,0 +1,47 @@ +#### Querying User Contributors + +Get list of users that can contribute to the specified user. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Contributors + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Include Twitter entities | bool | no | +| UserID | ID of user | ulong | only if screenName is empty | +| ScreenName | Screen name of user | string | only if userID is empty | +| SkipStatus | Exclude status information | bool | no | + +##### v3.0 Example: + +```c# + var users = + await + (from user in twitterCtx.User + where user.Type == UserType.Contributors && + user.ScreenName == "twitter" + select user) + .ToListAsync(); + + if (users != null) + users.ForEach(user => + Console.WriteLine("User: " + user.ScreenNameResponse)); +``` + +##### v2.1 Example: + +```c# + var users = + (from user in twitterCtx.User + where user.Type == UserType.Contributors && + user.ScreenName == "twitter" + select user) + .ToList(); + + users.ForEach( + user => Console.WriteLine("User: " + user.Name)); +``` + +*Twitter API:* [users/contributors](https://developer.twitter.com/en/docs/api-reference-index) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md new file mode 100644 index 00000000..2a989aea --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md @@ -0,0 +1,48 @@ +#### Querying User Details + +Look up details on specified users. Returns up to 100 users. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Lookup + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Include Twitter entities | bool | no | +| ScreenNameList | Comma-separated list of user ScreenNames | string | only if UserID is empty | +| UserIDList | Comma-separated list of user IDs | string | only if ScreenName is empty | +| tweetMode | Set to TweetMode.Extended for 280 characters returned in Status.FullText. | TweetMode | no | + +Note: Max number of users is 100 per query + +##### v3.0 Example: + +```c# + var userResponse = + await + (from user in twitterCtx.User + where user.Type == UserType.Lookup && + user.ScreenNameList == "JoeMayo,Linq2Tweeter" + select user) + .ToListAsync(); + + if (userResponse != null) + userResponse.ForEach(user => + Console.WriteLine("Name: " + user.ScreenNameResponse)); +``` + +##### v2.1 Example: + +```c# + var users = + (from user in twitterCtx.User + where user.Type == UserType.Lookup && + user.ScreenName == "JoeMayo,LinqToTweeter" + select user) + .ToList(); + + users.ForEach(user => Console.WriteLine("Name: " + user.Name)); +``` + +*Twitter API:* [users/lookup](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md new file mode 100644 index 00000000..712e4a54 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md @@ -0,0 +1,60 @@ +#### Querying User Info + +Show information for a user. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Show + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| IncludeEntities | Include Twitter entities | bool | no | +| ScreenName | Screen name of user | string | only if UserID is empty | +| UserID | ID of user | ulong | only if ScreenName is empty | +| tweetMode | Set to TweetMode.Extended for 280 characters returned in Status.FullText. | TweetMode | no | + +##### v3.0 Example: + +```c# + var user = + await + (from tweet in twitterCtx.User + where tweet.Type == UserType.Show && + tweet.ScreenName == "JoeMayo" + select tweet) + .SingleOrDefaultAsync(); + + if (user != null) + { + var name = user.ScreenNameResponse; + var lastStatus = + user.Status == null ? "No Status" : user.Status.Text; + + Console.WriteLine(); + Console.WriteLine( + "Name: {0}, Last Tweet: {1}\n", name, lastStatus); + } +``` + +##### v2.1 Example: + +```c# + var user = + await + (from tweet in twitterCtx.User + where tweet.Type == UserType.Show && + tweet.ScreenName == "JoeMayo" + select tweet) + .SingleOrDefaultAsync(); + + var name = user.ScreenNameResponse; + var lastStatus = + user.Status == null ? "No Status" : user.Status.Text; + + Console.WriteLine(); + Console.WriteLine( + "Name: {0}, Last Tweet: {1}\n", name, lastStatus); +``` + +*Twitter API:* [users/show](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md b/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md new file mode 100644 index 00000000..2a7be243 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md @@ -0,0 +1,39 @@ +#### Sending a Spam Notification + +Report a user for spam and optionally block them + +##### Signature: + +```c# +public async Task ReportSpamAsync( + string screenName, bool performBlock = false, CancellationToken cancelToken = default(CancellationToken)); +public async Task ReportSpamAsync( + ulong userID, bool performBlock = false, CancellationToken cancelToken = default(CancellationToken)); +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| performBlock | Blocks the user | bool | no | +| screenName | Screen name of user to report | string | only if userID is empty | +| userID | ID of user to report | string | only if screenName is empty | + +Note: `userID` or `screenName` must be provided. + +*Return Type:* [[User|User Entity]] + +##### Example: + +```c# +static async Task ReportSpammerAsync(TwitterContext twitterCtx) +{ + const string SpammerScreenName = "realDonaldTrump"; + + User spammer = await twitterCtx.ReportSpamAsync(SpammerScreenName); + + Console.WriteLine("You just reported {0} as a spammer.", spammer.ScreenNameResponse); +} +``` + +*Twitter API:* [users/report_spam](https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md b/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md new file mode 100644 index 00000000..dea72752 --- /dev/null +++ b/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md @@ -0,0 +1,47 @@ +#### Searching for Users + +Find users with a search query. + +*Entity:* [[User|User Entity]] +*Type:* UserType.Search + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of results to return for each page; max is 20 | int | no | +| IncludeEntities | Include Twitter entities | bool | no | +| Page | Page to return; defaults to 1 | int | no | +| Query | Search query | string | yes | +| tweetMode | Set to TweetMode.Extended for 280 characters returned in Status.FullText. | TweetMode | no | + +##### v3.0 Example: + +```c# + var foundUsers = + await + (from user in twitterCtx.User + where user.Type == UserType.Search && + user.Query == "JoeMayo" + select user) + .ToListAsync(); + + if (foundUsers != null) + foundUsers.ForEach(user => + Console.WriteLine("User: " + user.ScreenNameResponse)); +``` + +##### v2.1 Example: + +```c# + var user = + (from usr in twitterCtx.User + where usr.Type == UserType.Search && + usr.Query == "Joe Mayo" + select usr) + .FirstOrDefault(); + + Console.WriteLine("User Name: " + user.Name); +``` + +*Twitter API:* [users/search](https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search) \ No newline at end of file From 323821740532338352234b252dff0c850b3749d2 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:27:18 +0000 Subject: [PATCH 37/95] Update Streaming-Twitter-Content.md --- .../Streaming-Twitter-Content.md | 10 +-- .../Getting-Filtered-Statuses.md | 79 +++++++++++++++++++ .../Getting-Public-Statuses.md | 16 ++++ .../Getting-Status-Samples.md | 61 ++++++++++++++ .../Stream-Multiple-User-Messages.md | 41 ++++++++++ .../Stream-User-Messages.md | 72 +++++++++++++++++ 6 files changed, 274 insertions(+), 5 deletions(-) create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Filtered-Statuses.md create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Public-Statuses.md create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Status-Samples.md create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md create mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md index 163167b9..4fdcf67f 100644 --- a/LINQ-to-Twitter-5/Streaming-Twitter-Content.md +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md @@ -2,22 +2,22 @@ Stream Twitter content. -#### [[Getting Filtered Statuses]] +#### [Getting Filtered Statuses](Streaming-Twitter-Content/Getting-Filtered-Statuses.md) Return statuses matching given filters -#### [[Getting Status Samples]] +#### [Getting Status Samples](Streaming-Twitter-Content/Getting-Status-Samples.md) Return status samples -#### [[Getting Public Statuses]] +#### [Getting Public Statuses](Streaming-Twitter-Content/Getting-Public-Statuses.md) Return all public statuses with the firehose -#### [[Stream User Messages]] +#### [Stream User Messages](Streaming-Twitter-Content/Stream-User-Messages.md) Return a single user's messages as a stream -#### [[Stream Multiple User Messages]] +#### [Stream Multiple User Messages](Streaming-Twitter-Content/Stream-Multiple-User-Messages.md) Return multiple users' messages as a stream \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Filtered-Statuses.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Filtered-Statuses.md new file mode 100644 index 00000000..48588327 --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Filtered-Statuses.md @@ -0,0 +1,79 @@ +### Getting Filtered Statuses + +Return statuses matching given filters. + +*Type:* StreamingType.Filter + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Delimited | Tweets are delimited in the stream | string | no | +| Follow | Limit results to comma-separated set of users | string | no | +| Locations | Get tweets in the comma-separate list of lat/lon | string | no | +| Track | Comma-separated list of keywords to get tweets for | string | no | +| StallWarnings | Whether stall warnings should be delivered | bool | no | + +*Note:* At least one filter (Follow, Locations, or Track) must be specified. + +*Return Type:* JSON string. + +##### v3.0 Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + await + (from strm in twitterCtx.Streaming + where strm.Type == StreamingType.Filter && + strm.Track == "twitter" + select strm) + .StartAsync(async strm => + { + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 5) + strm.CloseStream(); + }); +``` + +##### v2.1 Example: + +```c# + twitterCtx.StreamingUserName = ""; + twitterCtx.StreamingPassword = ""; + + if (twitterCtx.StreamingUserName == string.Empty || + twitterCtx.StreamingPassword == string.Empty) + { + Console.WriteLine("\n*** This won't work until you set the StreamingUserName and StreamingPassword on TwitterContext to valid values.\n"); + return; + } + + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + (from strm in twitterCtx.Streaming + where strm.Type == StreamingType.Filter && + strm.Track == "twitter" + select strm) + .StreamingCallback(strm => + { + if (strm.Status != TwitterErrorStatus.Success) + { + Console.WriteLine(strm.Error.ToString()); + return; + } + + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 2) + { + strm.CloseStream(); + } + }) + .SingleOrDefault(); +``` + +*Twitter API:* [statuses/filter](https://developer.twitter.com/en/docs/tweets/filter-realtime/overview/statuses-filter) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Public-Statuses.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Public-Statuses.md new file mode 100644 index 00000000..92abd9a6 --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Public-Statuses.md @@ -0,0 +1,16 @@ +### Getting Public Statuses +Return all public statuses using the firehose. + +*Type:* StreamingType.Firehose + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Count | Number of tweets to go back to when reconnecting | int | no | +| Delimited | Tweets are delimited in the stream | string | no | +| StallWarnings | Whether stall warnings should be delivered | bool | no | + +*Return Type:* JSON string. + +*Twitter API:* [ statuses/firehose](https://dev.twitter.com/docs/api/1.1/get/statuses/firehose) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Status-Samples.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Status-Samples.md new file mode 100644 index 00000000..a9747e6a --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Getting-Status-Samples.md @@ -0,0 +1,61 @@ +### Getting Status Samples +Return status samples. + +*Type:* StreamingType.Sample + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Delimited | Tweets are delimited in the stream | string | no | +| StallWarnings | Whether stall warnings should be delivered | bool | no | + +*Return Type:* JSON string. + +##### v3.0 Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + await + (from strm in twitterCtx.Streaming + where strm.Type == StreamingType.Sample + select strm) + .StartAsync(async strm => + { + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 5) + strm.CloseStream(); + }); +``` + +##### v2.1 Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + (from strm in twitterCtx.Streaming + where strm.Type == StreamingType.Sample + select strm) + .StreamingCallback(strm => + { + if (strm.Status == TwitterErrorStatus.RequestProcessingException) + { + Console.WriteLine(strm.Error.ToString()); + return; + } + + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 10) + { + strm.CloseStream(); + } + }) + .SingleOrDefault(); +``` + +*Twitter API:* [statuses/sample](https://developer.twitter.com/en/docs/tweets/sample-realtime/overview/GET_statuse_sample) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md new file mode 100644 index 00000000..947994b6 --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md @@ -0,0 +1,41 @@ +### Stream Multiple User Messages +Return multiple users' messages as a stream. + +*Type:* UserStreamType.Site + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Delimited | Tweets are delimited in the stream | string | no | +| Follow | Comma-separated list of user IDs to return tweets for | string | no | +| Replies | Return additional replies | string | no | +| StallWarnings | Whether stall warnings should be delivered | bool | no | +| With | Include messages of accounts that the users follow | string | no | + +*Return Type:* JSON string. + +##### Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + (from strm in twitterCtx.UserStream + where strm.Type == UserStreamType.Site && + //strm.With == "followings" && + strm.Follow == "15411837"//,16761255" + select strm) + .StreamingCallback(strm => + { + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 10) + { + strm.CloseStream(); + } + }) + .SingleOrDefault(); +``` + +*Twitter API:* [site](https://dev.twitter.com/docs/api/2b/get/site) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md new file mode 100644 index 00000000..08de3a72 --- /dev/null +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md @@ -0,0 +1,72 @@ +### Stream User Messages +Return a single user's messages as a stream. + +*Type:* UserStreamType.User + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Delimited | Tweets are delimited in the stream | string | no | +| Locations | Include tweets within specified bounding box | string | no | +| Replies | Return additional replies | string | no | +| StallWarnings | Whether stall warnings should be delivered | bool | no | +| Track | Include tweets matching comma-separated list of keywords | string | no | + +*Return Type:* JSON string. + +##### v3.0 Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + await + (from strm in twitterCtx.Streaming + where strm.Type == StreamingType.User + select strm) + .StartAsync(async strm => + { + string message = + string.IsNullOrEmpty(strm.Content) ? + "Keep-Alive" : strm.Content; + Console.WriteLine( + (count + 1).ToString() + + ". " + DateTime.Now + + ": " + message + "\n"); + + if (count++ == 5) + strm.CloseStream(); + }); +``` + +##### v2.1 Example: + +```c# + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + + // the user stream is for whoever is authenticated + // via the Authenticator passed to TwitterContext + (from strm in twitterCtx.UserStream + where strm.Type == UserStreamType.User + select strm) + .StreamingCallback(strm => + { + if (strm.Status == TwitterErrorStatus.RequestProcessingException) + { + Console.WriteLine(strm.Error.ToString()); + return; + } + + Console.WriteLine(strm.Content + "\n"); + + if (count++ >= 25) + { + strm.CloseStream(); + } + }) + .SingleOrDefault(); +``` + +*Twitter API:* [ user](https://dev.twitter.com/docs/api/1.1/get/user) \ No newline at end of file From 32416ea9e577f988893ca5ec1523f2673937393e Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:28:30 +0000 Subject: [PATCH 38/95] Update Getting-User-Information.md --- LINQ-to-Twitter-5/Getting-User-Information.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Getting-User-Information.md b/LINQ-to-Twitter-5/Getting-User-Information.md index daeecae0..842e0fea 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information.md +++ b/LINQ-to-Twitter-5/Getting-User-Information.md @@ -6,7 +6,7 @@ You can get information on users, their friends, and their followers Look up details on specified users -#### [Querying User Info](Getting-User-Information/Querying-User-Information.md) +#### [Querying User Info](Getting-User-Information/Querying-User-Info.md) Show information for a user From caeb36cc650102529a3865df08948bce528b9032 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:30:51 +0000 Subject: [PATCH 39/95] Update Safety-Hatch.md --- LINQ-to-Twitter-5/Safety-Hatch.md | 4 +- .../Safety-Hatch/Raw-Commands.md | 42 +++++++++++++++++++ LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md | 35 ++++++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md create mode 100644 LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md diff --git a/LINQ-to-Twitter-5/Safety-Hatch.md b/LINQ-to-Twitter-5/Safety-Hatch.md index 6a27bdda..6400c09e 100644 --- a/LINQ-to-Twitter-5/Safety-Hatch.md +++ b/LINQ-to-Twitter-5/Safety-Hatch.md @@ -4,10 +4,10 @@ If something isn't quite right or available, you still have a work around. For e The safety hatch is Raw queries and commands. While a bit more work, this approach is flexible and still helps you avoid much low-level plumbing code, such as HTTP communication and OAuth. -#### [[Raw Queries]] +#### [Raw Queries](Safety-Hatch/Raw-Queries.md) Perform a query on any HTTP GET endpoint in the Twitter API. -#### [[Raw Commands]] +#### [Raw Commands](Safety-Hatch/Raw-Commands.md) Communicate with any HTTP POST endpoint in the Twitter API. \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md new file mode 100644 index 00000000..c81561a4 --- /dev/null +++ b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md @@ -0,0 +1,42 @@ +#### Raw Commands + +A raw query lets you manually add URL segments and parameters to communicate with any HTTP POST endpoint in the Twitter API. + +##### Signature: + +```c# +public async Task ExecuteRawAsync( + string queryString, Dictionary parameters) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| queryString | URL segments | string | yes | +| parameters | Name/value pairs for post parameters | Dictionary | no | +*Return Type:* string + +##### Example: + +```c# + string status = + "Testing LINQ to Twitter Raw Interface - " + + DateTime.Now.ToString() + " #Linq2Twitter"; + var parameters = new Dictionary + { + { "status", status } + }; + + string queryString = "/statuses/update.json"; + + string result = + await twitterCtx.ExecuteRawAsync( + queryString, parameters); + + if (result != null) + Console.WriteLine( + "\nResponse from update status: \n\n\t" + result); +``` + +*Twitter API:* [Any HTTP POST endpoint in the Twitter API](https://dev.twitter.com/docs/api/1.1) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md new file mode 100644 index 00000000..6580a62d --- /dev/null +++ b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md @@ -0,0 +1,35 @@ +#### Raw Queries + +A raw query lets you manually add URL segments and parameters to execute any HTTP GET endpoint in the Twitter API. + +*Entity:* [[Raw|Raw Entity]] +*Type:* N/A + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| QueryString | URL segments + query parameters | string | yes | +Notes: +- Don't include the Base URL in the query string, as it is already set in your TwitterContext instance. +- Url Encode all parameters. + +##### Example: +```c# + string unencodedStatus = "LINQ to Twitter"; + string encodedStatus = Uri.EscapeDataString(unencodedStatus); + string queryString = "search/tweets.json?q=" + encodedStatus; + + var rawResult = + await + (from raw in twitterCtx.RawQuery + where raw.QueryString == queryString + select raw) + .SingleOrDefaultAsync(); + + if (rawResult != null) + Console.WriteLine( + "Response from Twitter: \n\n" + rawResult.Response); +``` + +*Twitter API:* [Any HTTP GET endpoint in the Twitter API](https://dev.twitter.com/docs/api/1.1) \ No newline at end of file From cb81a2923c2709e85465e9059d6334a83663d9d7 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 2 Dec 2020 03:32:43 +0000 Subject: [PATCH 40/95] Update Safety-Hatch.md --- LINQ-to-Twitter-5/Safety-Hatch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Safety-Hatch.md b/LINQ-to-Twitter-5/Safety-Hatch.md index 6400c09e..17b7f772 100644 --- a/LINQ-to-Twitter-5/Safety-Hatch.md +++ b/LINQ-to-Twitter-5/Safety-Hatch.md @@ -1,4 +1,4 @@ -### [[Safety Hatch]] +### Safety Hatch If something isn't quite right or available, you still have a work around. For example, what if the Twitter API adds a new parameter to an endpoint; an entirely new endpoint; or a new set of beta endpoints that aren't available in the latest version of LINQ to Twitter? What if LINQ to Twitter has a bug that isn't fixed in the latest release? You aren't stuck. From 1ac6282c126fc3923f8d22bb611f3af18c44fd3b Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 3 Dec 2020 03:56:49 +0000 Subject: [PATCH 41/95] Update Tweets.md --- LINQ-to-Twitter-6/Tweets.md | 4 +- LINQ-to-Twitter-6/Tweets/Filtered-Stream.md | 174 ++++++++++++++++++++ LINQ-to-Twitter-6/Tweets/Sampled-Stream.md | 77 +++++++++ 3 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-6/Tweets/Filtered-Stream.md create mode 100644 LINQ-to-Twitter-6/Tweets/Sampled-Stream.md diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index f40bc771..4065e5ce 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -10,11 +10,11 @@ Get information on one or more tweets. Search for tweets that occurred within the last week. -### Filtered Stream +### [Filtered Stream](Tweets/Filtered-Stream.md) Read a real-time stream of tweets, based on your search criteria. Coming soon... -### Sample Stream +### [Sampled Stream](Tweets/Sampled-Stream.md) Read a real-time stream sampling around 1% of public tweets. Coming soon... diff --git a/LINQ-to-Twitter-6/Tweets/Filtered-Stream.md b/LINQ-to-Twitter-6/Tweets/Filtered-Stream.md new file mode 100644 index 00000000..5ccd827f --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Filtered-Stream.md @@ -0,0 +1,174 @@ +### Filtered Stream + +Return tweets matching given filters. + +*Type:* StreamingType.Filter + +##### Parameters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +*Return Type:* StreamContent. + +*Important!:* You need to use `AddStreamingFilterRulesAsync` and `DeleteStreamingFilterRulesAsync` to set/remove stream filters. See `Managing Rules` section below: + +##### Example: + +```c# +static async Task DoFilterStreamAsync(TwitterContext twitterCtx) +{ + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + var cancelTokenSrc = new CancellationTokenSource(); + + try + { + await + (from strm in twitterCtx.Streaming + .WithCancellation(cancelTokenSrc.Token) + where strm.Type == StreamingType.Filter + select strm) + .StartAsync(async strm => + { + await HandleStreamResponse(strm); + + if (count++ >= 5) + cancelTokenSrc.Cancel(); + }); + } + catch (IOException ex) + { + // Twitter might have closed the stream, + // which they do sometimes. You should + // restart the stream, but be sure to + // read Twitter documentation on stream + // back-off strategies to prevent your + // app from being blocked. + Console.WriteLine(ex.ToString()); + } + catch (OperationCanceledException) + { + Console.WriteLine("Stream cancelled."); + } +} + +static async Task HandleStreamResponse(StreamContent strm) +{ + if (strm.HasError) + { + Console.WriteLine($"Error during streaming: {strm.ErrorMessage}"); + } + else + { + Tweet? tweet = strm?.Entity?.Tweet; + if (tweet != null) + Console.WriteLine($"\nTweet ID: {tweet.ID}, Tweet Text: {tweet.Text}"); + } + + return await Task.FromResult(0); +} +``` + +Managing Rules: + +```C# +static async Task ValidateRulesAsync(TwitterContext twitterCtx) +{ + var rules = new List + { + new StreamingAddRule { Tag = "memes with media", Value = "meme has:images" }, + new StreamingAddRule { Tag = "cats with media", Value = "cat has:media" } + }; + + Streaming? result = await twitterCtx.AddStreamingFilterRulesAsync(rules, isValidateOnly: true); + + if (result?.Meta?.Summary != null) + { + StreamingMeta meta = result.Meta; + Console.WriteLine($"\nSent: {meta.Sent}"); + + StreamingMetaSummary summary = meta.Summary; + + Console.WriteLine($"Created: {summary.Created}"); + Console.WriteLine($"!Created: {summary.NotCreated}"); + } + + if (result?.Errors != null && result.HasErrors) + result.Errors.ForEach(error => + Console.WriteLine( + $"\nTitle: {error.Title}" + + $"\nValue: {error.Value}" + + $"\nID: {error.ID}" + + $"\nType: {error.Type}")); +} + +static async Task AddRulesAsync(TwitterContext twitterCtx) +{ + var rules = new List + { + new StreamingAddRule { Tag = "funny things", Value = "meme" }, + new StreamingAddRule { Tag = "happy cats with media", Value = "cat has:media -grumpy" } + }; + + Streaming? result = await twitterCtx.AddStreamingFilterRulesAsync(rules); + + StreamingMeta? meta = result?.Meta; + + if (meta?.Summary != null) + { + Console.WriteLine($"\nSent: {meta.Sent}"); + + StreamingMetaSummary summary = meta.Summary; + + Console.WriteLine($"Created: {summary.Created}"); + Console.WriteLine($"!Created: {summary.NotCreated}"); + } + + if (result?.Errors != null && result.HasErrors) + result.Errors.ForEach(error => + Console.WriteLine( + $"\nTitle: {error.Title}" + + $"\nValue: {error.Value}" + + $"\nID: {error.ID}" + + $"\nType: {error.Type}")); +} + +static async Task DeleteRulesAsync(TwitterContext twitterCtx) +{ + var ruleIds = new List + { + "1165037377523306498", + "1165037377523306499" + }; + + Streaming? result = await twitterCtx.DeleteStreamingFilterRulesAsync(ruleIds); + + if (result?.Meta?.Summary != null) + { + StreamingMeta meta = result.Meta; + Console.WriteLine($"\nSent: {meta.Sent}"); + + StreamingMetaSummary summary = meta.Summary; + + Console.WriteLine($"Deleted: {summary.Deleted}"); + Console.WriteLine($"!Deleted: {summary.NotDeleted}"); + } + + if (result?.Errors != null && result.HasErrors) + result.Errors.ForEach(error => + Console.WriteLine( + $"\nTitle: {error.Title}" + + $"\nValue: {error.Value}" + + $"\nID: {error.ID}" + + $"\nType: {error.Type}")); +} +``` + +*Twitter API:* [tweets/search/stream](https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/get-tweets-search-stream) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Sampled-Stream.md b/LINQ-to-Twitter-6/Tweets/Sampled-Stream.md new file mode 100644 index 00000000..9b5da28d --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Sampled-Stream.md @@ -0,0 +1,77 @@ +### Sampled Stream + +Return around 1% of all tweets. + +*Type:* StreamingType.Sample + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +*Return Type:* StreamContent. + +##### Example: + +```c# +static async Task DoSampleStreamAsync(TwitterContext twitterCtx) +{ + Console.WriteLine("\nStreamed Content: \n"); + int count = 0; + var cancelTokenSrc = new CancellationTokenSource(); + + try + { + await + (from strm in twitterCtx.Streaming + .WithCancellation(cancelTokenSrc.Token) + where strm.Type == StreamingType.Sample + select strm) + .StartAsync(async strm => + { + await HandleStreamResponse(strm); + + if (count++ >= 10) + cancelTokenSrc.Cancel(); + }); + } + catch (IOException ex) + { + // Twitter might have closed the stream, + // which they do sometimes. You should + // restart the stream, but be sure to + // read Twitter documentation on stream + // back-off strategies to prevent your + // app from being blocked. + Console.WriteLine(ex.ToString()); + } + catch (OperationCanceledException) + { + Console.WriteLine("Stream cancelled."); + } +} + +static async Task HandleStreamResponse(StreamContent strm) +{ + if (strm.HasError) + { + Console.WriteLine($"Error during streaming: {strm.ErrorMessage}"); + } + else + { + Tweet? tweet = strm?.Entity?.Tweet; + if (tweet != null) + Console.WriteLine($"\nTweet ID: {tweet.ID}, Tweet Text: {tweet.Text}"); + } + + return await Task.FromResult(0); +} +``` + +*Twitter API:* [tweets/sample/stream](https://developer.twitter.com/en/docs/twitter-api/tweets/sampled-stream/api-reference/get-tweets-sample-stream) \ No newline at end of file From 0c15c728fe184ce05aefcc2d46e89c2fe85fc467 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 3 Dec 2020 17:32:08 -0800 Subject: [PATCH 42/95] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..6a783cc5 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +linqtotwitter.com \ No newline at end of file From a89cc97c55535f0723b0c3b5d51d0562d0948654 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 3 Dec 2020 18:28:14 -0800 Subject: [PATCH 43/95] Update CNAME --- CNAME | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CNAME b/CNAME index 6a783cc5..eb8ee68b 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -linqtotwitter.com \ No newline at end of file +www.linqtotwitter.com \ No newline at end of file From 0a4d212c0f8d9007ea2e3549a79ab651761333d8 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 4 Dec 2020 05:52:24 +0000 Subject: [PATCH 44/95] Update Searching-Twitter.md --- .../Searching-Twitter.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md index af89d822..0cd00d5f 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md @@ -15,12 +15,15 @@ Perform a search. | Lang | Language to return tweets in as defined by [ISO-639-1](http://en.wikipedia.org/wiki/ISO_639-1]. | string | no | | Locale | Language used in query. _ja_ is currently the only supported language other than _en_. Defaults to _en_. | string | no | | MaxID | Return tweets prior to or equal to this ID. | ulong | no | -| Query | Search query. Can contain search operators defined at [Twitter Search API docs](https://dev.twitter.com/docs/api/1/get/search]. | string | yes | +| Query | Search query. | string | yes | | ResultType | Specify whether tweets should be Popular, Recent, or Mixed; defaults to recent. | ResultType | no | | SearchLanguage | Language of tweets. | int | no | | SinceID | Return tweets later than this ID. | ulong | no | | Type | Search type. | string | no | | Until | Tweets up to this date, YYYY-MM-DD. | string | no | + +_Note:_ Can contain search operators defined at [Twitter Search API docs](https://dev.twitter.com/docs/api/1/get/search]. + ##### v3.0+ Example: ```c# From ebea7cfec7a464c24c29b62e6f066f15c4efc625 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 4 Dec 2020 05:53:54 +0000 Subject: [PATCH 45/95] Update Getting-Closest-Trends.md --- .../Retrieving-Available-Trend-Locations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md index a158fd34..187b6895 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md @@ -11,6 +11,7 @@ Get locations where trends are occurring. |------|---------|------|----------| | Lat | Latitude coordinate | dec | yes | | Long | Longitude coordinate | dec | yes | + ##### v3.0 Example: ```c# From 92c612fdc783308937b932198a9cd18780860acc Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 5 Dec 2020 03:10:11 +0000 Subject: [PATCH 46/95] Update Getting-Trend-Locations.md --- .../Getting-Trend-Locations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md index 55bc66c0..18f4bf47 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md @@ -10,6 +10,7 @@ Get trends for a specified place. | Name | Purpose | Type | Required | |------|---------|------|----------| | WoeID | Yahoo! Where on Earth ID | int | yes | + ##### Example: ```c# From 8890e3eb8e6d11b428486447073704045a6b8a6c Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 6 Dec 2020 04:08:01 +0000 Subject: [PATCH 47/95] Update Blocking-a-User.md --- LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md | 2 +- LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md | 3 ++- LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md | 3 ++- LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md index 6c4e2c3d..498e5b89 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md @@ -20,7 +20,7 @@ public async Task CreateBlockAsync( | skipStatus | Exclude status information | bool | no | | userID | ID of user to follow | string | only if ScreenName is empty | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md index 23ee1560..74a366c0 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md @@ -2,7 +2,8 @@ Get a list of IDs of the people a user is blocking -*Entity:* [[Blocks|Blocks Entity]] +*Entity:* [Blocks](LINQ-to-Twitter-Entities/Blocks-Entity) + *Type:* BlockingType.Ids ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md index e9f5a053..17138a30 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md @@ -2,7 +2,8 @@ Find out who a user is blocking. -*Entity:* [[Blocks|Blocks Entity]] +*Entity:* [Blocks](LINQ-to-Twitter-Entities/Blocks-Entity.md) + *Type:* BlockingType.Blocking ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md index 8678d89f..de931684 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md @@ -20,7 +20,7 @@ public async Task DestroyBlockAsync( | skipStatus | Exclude status information | bool | no | | userID | ID of user to follow | string | only if ScreenName is empty | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](LINQ-to-Twitter-Entities/User-Entity) ##### v3.0 Example: From 0b12d98392c6aba308eb4b139f3df795f3fd00f0 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 6 Dec 2020 04:25:30 +0000 Subject: [PATCH 48/95] Update Get-Blocked-IDs.md --- LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md | 2 +- LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md | 2 +- LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md | 2 +- LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md index 498e5b89..faf8f1ff 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Blocking-a-User.md @@ -20,7 +20,7 @@ public async Task CreateBlockAsync( | skipStatus | Exclude status information | bool | no | | userID | ID of user to follow | string | only if ScreenName is empty | -*Return Type:* [User](LINQ-to-Twitter-Entities/User-Entity.md) +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md index 74a366c0..4feb4371 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-IDs.md @@ -2,7 +2,7 @@ Get a list of IDs of the people a user is blocking -*Entity:* [Blocks](LINQ-to-Twitter-Entities/Blocks-Entity) +*Entity:* [Blocks](../LINQ-to-Twitter-Entities/Blocks-Entity.md) *Type:* BlockingType.Ids diff --git a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md index 17138a30..d51ee569 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Get-Blocked-Users.md @@ -2,7 +2,7 @@ Find out who a user is blocking. -*Entity:* [Blocks](LINQ-to-Twitter-Entities/Blocks-Entity.md) +*Entity:* [Blocks](../LINQ-to-Twitter-Entities/Blocks-Entity.md) *Type:* BlockingType.Blocking diff --git a/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md index de931684..47c5c622 100644 --- a/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md +++ b/LINQ-to-Twitter-5/Blocking-Users/Unblocking-a-User.md @@ -20,7 +20,7 @@ public async Task DestroyBlockAsync( | skipStatus | Exclude status information | bool | no | | userID | ID of user to follow | string | only if ScreenName is empty | -*Return Type:* [User](LINQ-to-Twitter-Entities/User-Entity) +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: From e657bd05d9b8f19a5e8076527fb5ce19295b255f Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 6 Dec 2020 23:00:46 +0000 Subject: [PATCH 49/95] Update Showing-Direct-Message-Events.md --- .../Listing-Direct-Message-Events.md | 3 ++- .../Sending-Direct-Message-Events.md | 2 +- .../Showing-Direct-Message-Events.md | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md index 37ccb6d7..1f838de8 100644 --- a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Listing-Direct-Message-Events.md @@ -2,7 +2,8 @@ Show direct message events information. Includes DMs to and from a user. -*Entity:* [[DirectMessageEvents|DirectMessageEvents Entity]] +*Entity:* [DirectMessageEvents](../LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md) + *Type:* DirectMessageEventsType.List ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md index 02a2d20a..1e76330e 100644 --- a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Sending-Direct-Message-Events.md @@ -15,7 +15,7 @@ public async Task NewDirectMessageEventAsync(ulong recipien | recipientID | ID of user to send to. | ulong | yes | | text | Direct message contents. | string | yes | -*Return Type:* [DirectMessageEvents|DirectMessageEvents Entity] +*Return Type:* [DirectMessageEvents](../LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md) ##### v 4.x Example: diff --git a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md index a986e8a1..0acf483b 100644 --- a/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md +++ b/LINQ-to-Twitter-5/Working-with-Direct-Messages/Showing-Direct-Message-Events.md @@ -2,7 +2,8 @@ Show direct message events information. -*Entity:* [[DirectMessageEvents|DirectMessageEvents Entity]] +*Entity:* [DirectMessageEvents](../LINQ-to-Twitter-Entities/DirectMessageEvents-Entity.md) + *Type:* DirectMessageEventsType.Show ##### Parameters/Filters: From 772ced78cf05ab3dd5a5b858a7722417dff53fc5 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 8 Dec 2020 02:38:58 +0000 Subject: [PATCH 50/95] Update Getting-a-List-of-Favorites.md --- LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md | 2 +- LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md | 2 +- .../Querying-Favorites/Getting-a-List-of-Favorites.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md b/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md index cdfff1f6..658cb117 100644 --- a/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md +++ b/LINQ-to-Twitter-5/Querying-Favorites/Creating-a-Favorite.md @@ -18,7 +18,7 @@ public async Task CreateFavoriteAsync( | id | ID of tweet to add to favorites | ulong | yes | | includeEntities | Include Twitter entities (default: true) | bool | no | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md b/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md index 3aab1e90..2b06910b 100644 --- a/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md +++ b/LINQ-to-Twitter-5/Querying-Favorites/Destroying-a-Favorite.md @@ -18,7 +18,7 @@ public async Task DestroyFavoriteAsync( | id | ID of tweet to remove from favorites | string | yes | | includeEntities | Include Twitter entities (default: true) | bool | no | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md b/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md index c6a1e7a4..f246907b 100644 --- a/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md +++ b/LINQ-to-Twitter-5/Querying-Favorites/Getting-a-List-of-Favorites.md @@ -2,7 +2,8 @@ Get a list of the last 20 favorites for a user. -*Entity:* [[Favorites|Favorites Entity]] +*Entity:* [Favorites](../LINQ-to-Twitter-Entities/Favorites-Entity.md) + *Type:* FavoritesTypes.Favorites ##### Parameters/Filters: From ad16645c38ed912b2327637453fa78c0823d846c Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 9 Dec 2020 02:32:51 +0000 Subject: [PATCH 51/95] Update Updating-Friendship-Settings.md --- .../Handling-Friendships/Creating-a-Friendship.md | 2 +- .../Handling-Friendships/Destroying-a-Friendship.md | 2 +- LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md | 3 ++- LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md | 3 ++- .../Handling-Friendships/Looking-Up-Friendships.md | 3 ++- LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md | 3 ++- LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md | 3 ++- .../Handling-Friendships/Showing-Friendship-Details.md | 3 ++- .../Handling-Friendships/Showing-Incoming-Requests.md | 3 ++- .../Handling-Friendships/Showing-No-Retweet-IDs.md | 3 ++- .../Handling-Friendships/Showing-Outgoing-Requests.md | 3 ++- .../Handling-Friendships/Updating-Friendship-Settings.md | 2 +- 12 files changed, 21 insertions(+), 12 deletions(-) diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md b/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md index 42aeccb8..680c13b3 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Creating-a-Friendship.md @@ -19,7 +19,7 @@ public async Task CreateFriendshipAsync( | screenName | Screen name of user to follow | string | yes | | userID | ID of user to follow | ulong | yes | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md b/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md index 9a3503fe..b5336afd 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Destroying-a-Friendship.md @@ -16,7 +16,7 @@ public async Task DestroyFriendshipAsync(string screenName) | screenName | Screen name of user to follow | string | Yes | | userID | ID of user to follow | ulong | Yes | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md index 0c4c7c51..8ddc5f05 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Followers.md @@ -2,7 +2,8 @@ Gets IDs of people following the user. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.FollowerIDs ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md index c375bd8d..242f8c91 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Listing-Friends.md @@ -2,7 +2,8 @@ Gets IDs of people being followed by the user. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType..FriendsIDs ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md b/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md index a87979c8..748664cd 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Looking-Up-Friendships.md @@ -2,7 +2,8 @@ Look up friendship information. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.Lookup ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md index 5d14506b..7f1f83df 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Followers.md @@ -2,7 +2,8 @@ Gets User entities for followers. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.FollowersList ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md index 5134f16d..390055e8 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friends.md @@ -2,7 +2,8 @@ Gets User entities for friends. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.FriendsList ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md index 6477cdeb..24392881 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Friendship-Details.md @@ -2,7 +2,8 @@ Gets details on the relationship between two users. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.Show ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md index b3300fdf..42c56b81 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Incoming-Requests.md @@ -2,7 +2,8 @@ Show IDs of all users requesting friendship with logged in user. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.Incoming ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md index e3b79d10..9fb1a266 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-No-Retweet-IDs.md @@ -2,7 +2,8 @@ Show IDs of all users for whom the logged in user doesn't want to see retweets. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.NoRetweetIDs ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md index b921a6a6..c323b133 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Showing-Outgoing-Requests.md @@ -2,7 +2,8 @@ Show IDs of all users for whom the logged in user has requested friendship. -*Entity:* [[Friendship|Friendship Entity]] +*Entity:* [Friendship](../LINQ-to-Twitter-Entities/Friendship-Entity.md) + *Type:* FriendshipType.Outgoing ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md b/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md index f05d1cdc..ac3514e0 100644 --- a/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md +++ b/LINQ-to-Twitter-5/Handling-Friendships/Updating-Friendship-Settings.md @@ -22,7 +22,7 @@ public async Task UpdateFriendshipSettingsAsync( Note: userID or screenName must be provided. -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.0 Example: From f6e4b36949aa471b6192ec99bf514f770f8bfdb4 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 10 Dec 2020 02:31:08 +0000 Subject: [PATCH 52/95] Update Searching-for-Places.md --- .../Getting-Details-on-a-Place.md | 3 ++- .../Performing-Reverse-Geocode-Lookups.md | 3 ++- .../Querying-Similar-Places.md | 3 ++- .../Getting-Geographical-Information/Searching-for-Places.md | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md index d13ce009..0f398d82 100644 --- a/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Getting-Details-on-a-Place.md @@ -2,7 +2,8 @@ With a place ID, returned by a Reverse Geocode lookup, you can get more details on the place. -*Entity:* [[Geo|Geo Entity]] +*Entity:* [Geo](../LINQ-to-Twitter-Entities/Geo-Entity.md) + *Type:* GeoType.ID ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md index d45c608c..e158c1bd 100644 --- a/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Performing-Reverse-Geocode-Lookups.md @@ -2,7 +2,8 @@ Lets you provide latitude and longitude to get back location/place information. -*Entity:* [[Geo|Geo Entity]] +*Entity:* [Geo](../LINQ-to-Twitter-Entities/Geo-Entity.md) + *Type:* GeoType.Reverse ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md index 8ceaa7b6..ff1d897e 100644 --- a/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Querying-Similar-Places.md @@ -2,7 +2,8 @@ Get a list of nearby places with similar names. -*Entity:* [[Geo|Geo Entity]] +*Entity:* [Geo](../LINQ-to-Twitter-Entities/Geo-Entity.md) + *Type:* GeoType.SimilarPlaces ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md b/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md index 6bcc3a24..25d55bf3 100644 --- a/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md +++ b/LINQ-to-Twitter-5/Getting-Geographical-Information/Searching-for-Places.md @@ -2,7 +2,8 @@ Search for places that can be attached to a status update. -*Entity:* [[Geo|Geo Entity]] +*Entity:* [Geo](../LINQ-to-Twitter-Entities/Geo-Entity.md) + *Type:* GeoType.Search ##### Parameters/Filters: From 4a1a16202de4e4fca35a4e330bcc0758bd11f32a Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 12 Dec 2020 02:40:12 +0000 Subject: [PATCH 53/95] Update Using-Help-Methods.md --- .../Using-Help-Methods/Getting-Configuration-Information.md | 3 ++- LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md | 3 ++- LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md | 3 ++- LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md | 3 ++- LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md index 6e157c90..4de22a4a 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md @@ -2,7 +2,8 @@ Pulls general configuration information such as URL lengths, system names, and photo sizes. -*Entity:* [[Help|Help Entity]] +*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) + *Type:* HelpType.Configuration ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md index c181e5c9..d0bd1463 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Rate-Limits.md @@ -2,7 +2,8 @@ Provides rate limits for each API endpoint. -*Entity:* [[Help|Help Entity]] +*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) + *Type:* HelpType.RateLimits ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md b/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md index a0ff0c85..3bc01162 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Retrieving-Languages.md @@ -2,7 +2,8 @@ Provides a list of languages supported by Twitter. -*Entity:* [[Help|Help Entity]] +*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) + *Type:* HelpType.Languages ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md index df872a6f..22a03946 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-Privacy.md @@ -2,7 +2,8 @@ Displays the Twitter privacy policy. -*Entity:* [[Help|Help Entity]] +*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) + *Type:* HelpType.Privacy ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md index cf5e1768..fff949ea 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods/Viewing-TOS.md @@ -2,7 +2,8 @@ Displays the Twitter terms of service. -*Entity:* [[Help|Help Entity]] +*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) + *Type:* HelpType.Tos ##### Parameters/Filters: From 45efbe0bdab80d3a5bcaff0c381492bdbda0e7ff Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 13 Dec 2020 04:05:26 +0000 Subject: [PATCH 54/95] Update Updating-a-List.md --- .../Managing-Lists/Adding-Multiple-Members-to-a-List.md | 2 +- LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md | 2 +- .../Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md | 3 ++- .../Managing-Lists/Checking-if-a-User-is-a-List-Member.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md | 2 +- .../Managing-Lists/Deleting-Multiple-List-Members.md | 2 +- LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md | 2 +- .../Managing-Lists/Deleting-a-List-Subscription.md | 2 +- LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md | 2 +- LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md | 3 ++- .../Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md | 3 ++- .../Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md | 3 ++- LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md | 3 ++- .../Managing-Lists/Subscribing-a-User-to-a-List.md | 2 +- LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md | 2 +- 19 files changed, 29 insertions(+), 19 deletions(-) diff --git a/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md index 52e52a04..038522bc 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Adding-Multiple-Members-to-a-List.md @@ -26,7 +26,7 @@ public async Task AddMemberRangeToListAsync( Note: Either userIDs or screenNames is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. Maximum users per request is 100; requiring multiple invocations if you need to add more than 100 users. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md index cf4db03b..910abb56 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Adding-a-Member-to-a-List.md @@ -26,7 +26,7 @@ public async Task AddMemberToListAsync( Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md index faf1c472..c097fb3c 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-Subscribes-to-a-List.md @@ -2,7 +2,8 @@ Determine if a user subscribes to a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.IsSubscriber ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md index 19defb27..91ad8b63 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Checking-if-a-User-is-a-List-Member.md @@ -2,7 +2,8 @@ Determine if a user is a member of a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.IsMember ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md index f9aac4ff..db8ea682 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Creating-a-List.md @@ -17,7 +17,7 @@ public async Task CreateListAsync( | listName | Name of list | string | yes | | mode | Public or private | string | no | -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md index 84cd9961..63d50b2d 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-Multiple-List-Members.md @@ -26,7 +26,7 @@ public async Task DeleteMemberRangeFromListAsync( Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md index 5031148f..5bc75bf0 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Member.md @@ -23,7 +23,7 @@ public async Task DeleteMemberFromListAsync( Note: Either userID or screenName is required. Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md index a9609af3..ff1053d2 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List-Subscription.md @@ -20,7 +20,7 @@ public async Task UnsubscribeFromListAsync( Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md index df4cd805..c3a6bf6f 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Deleting-a-List.md @@ -20,7 +20,7 @@ public async Task DeleteListAsync( Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md b/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md index f9277779..3abd317b 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Finding-Owned-Lists.md @@ -2,7 +2,8 @@ Get lists that the authenticated user owns. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Ownerships ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md index d2ae135e..1c13afb3 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-Info-on-a-List.md @@ -2,7 +2,8 @@ Get details on a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Show ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md index d6d13024..39dc41b3 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Members.md @@ -2,7 +2,8 @@ Get a list of members of a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Members ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md index 2300d078..3226198b 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Getting-List-Subscribers.md @@ -2,7 +2,8 @@ Get a list of users who subscribed to a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Subscribers ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md index 7c5c2cf7..f24dac56 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-Subscribes-To.md @@ -2,7 +2,8 @@ Get lists user has subscribed to. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Subscriptions ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md index 3c0fcba1..c45a44e5 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Learn-what-Lists-a-User-is-a-Member-Of.md @@ -2,7 +2,8 @@ Get lists a user is a member of. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Memberships ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md b/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md index 84a411ca..25b10a24 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Reading-List-Statuses.md @@ -2,7 +2,8 @@ Read tweets from a list. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.Statuses ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md b/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md index bf7783de..08dd6b29 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Retrieving-All-Lists.md @@ -2,7 +2,8 @@ Get a list of all lists. -*Entity:* [[List|List Entity]] +*Entity:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) + *Type:* ListType.List ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md index 37051428..056c9038 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Subscribing-a-User-to-a-List.md @@ -20,7 +20,7 @@ public async Task SubscribeToListAsync( Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md b/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md index 1fda11ff..99b5dccf 100644 --- a/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md +++ b/LINQ-to-Twitter-5/Managing-Lists/Updating-a-List.md @@ -24,7 +24,7 @@ public async Task UpdateListAsync( Note: Either listID or slug is required. If you use slug, you must also specify either ownerID or ownerScreenName. -*Return Type:* [[List|List Entity]] +*Return Type:* [List](../LINQ-to-Twitter-Entities/List-Entity.md) ##### v3.0 Example: From 50f23070d9657900324e50c8512a6a64a0151c18 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Mon, 14 Dec 2020 00:08:32 +0000 Subject: [PATCH 55/95] Update Uploading-Images-and-Video.md --- LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md | 2 +- LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md b/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md index 256e2586..1016f20a 100644 --- a/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md +++ b/LINQ-to-Twitter-5/Uploading-Media/Adding-Alt-Text.md @@ -17,7 +17,7 @@ public virtual async Task CreateMediaMetadataAsync( | altText | Media description. | string | yes | | cancelToken | Allows you to cancel async operation. | CancellationToken | no | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) ##### v4.x Example: diff --git a/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md b/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md index c583d330..71c6a7fd 100644 --- a/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md +++ b/LINQ-to-Twitter-5/Uploading-Media/Uploading-Images-and-Video.md @@ -24,7 +24,7 @@ public virtual async Task UploadMediaAsync( | mediaCategory | Media category - possible values are tweet_image, tweet_gif, tweet_video, and amplify_video. See this post on the Twitter forums: https://twittercommunity.com/t/media-category-values/64781/6 | string | sometimes | | cancelToken | Allows you to cancel async operation | CancellationToken | no | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) Note: The response you receive differs between images and videos. If uploading videos, the code below works well. However, if uploading images, you shouldn't iterate, waiting for processed status because that happens immediately. See this issue for more info: From 2c0fdcbf3dba6b3a513eaa78ec0058a4aa33fc12 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 15 Dec 2020 02:00:58 +0000 Subject: [PATCH 56/95] Update Unmute-a-User.md --- LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md | 3 ++- LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md | 3 ++- LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md | 2 +- LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md index a9a1aa1c..adec9169 100644 --- a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md +++ b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-IDs.md @@ -2,7 +2,8 @@ Retrieve a list of muted user IDs. -*Entity:* [[Mute|Mute Entity]] +*Entity:* [Mute](../LINQ-to-Twitter-Entities/Mute-Entity.md) + *Type:* MuteType.IDs ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md index d7451cae..b0760fd5 100644 --- a/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md +++ b/LINQ-to-Twitter-5/Muting-Users/Getting-Muted-Users.md @@ -2,7 +2,8 @@ Retrieve a list of muted user entities. -*Entity:* [[Mute|Mute Entity]] +*Entity:* [Mute](../LINQ-to-Twitter-Entities/Mute-Entity.md) + *Type:* MuteType.List ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md b/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md index f4dfc9fd..c36c9c6a 100644 --- a/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md +++ b/LINQ-to-Twitter-5/Muting-Users/Mute-a-User.md @@ -19,7 +19,7 @@ public async Task MuteAsync( | screenName | Screen name of user to mute | string | yes (on matching overload) | | userID | ID of user to mute | ulong | yes (on matching overload) | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.x Example: diff --git a/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md b/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md index b3274692..8d33521b 100644 --- a/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md +++ b/LINQ-to-Twitter-5/Muting-Users/Unmute-a-User.md @@ -19,7 +19,7 @@ public async Task UnMuteAsync( | screenName | Screen name of user to mute | string | yes (on matching overload) | | userID | ID of user to mute | ulong | yes (on matching overload) | -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### v3.x Example: From 8d5523d759acd971dcad96c6be317d02f4ffd9cd Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 16 Dec 2020 02:38:48 +0000 Subject: [PATCH 57/95] Update Getting-Info-on-a-Saved-Search.md --- .../Managing-Saved-Searches/Creating-a-Saved-Search.md | 2 +- .../Managing-Saved-Searches/Destroying-a-Saved-Search.md | 2 +- .../Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md | 3 ++- .../Getting-a-List-of-Saved-Searches.md | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md index 77911912..cdeaef78 100644 --- a/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Creating-a-Saved-Search.md @@ -14,7 +14,7 @@ public async Task CreateSavedSearchAsync(string query) |------|---------|------|----------| | query | Text of search query | string | yes | -*Return Type:* [[SavedSearch|SavedSearch Entity]] +*Return Type:* [SavedSearch](../LINQ-to-Twitter-Entities/SavedSearch-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md index b99e9f05..b38bf9a9 100644 --- a/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Destroying-a-Saved-Search.md @@ -14,7 +14,7 @@ public async Task DestroySavedSearchAsync(ulong id) |------|---------|------|----------| | id | Saved search ID | ulong | yes | -*Return Type:* [[SavedSearch|SavedSearch Entity]] +*Return Type:* [SavedSearch](../LINQ-to-Twitter-Entities/SavedSearch-Entity.md) ##### v3.0 Example: diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md index 3f8301f4..2f013da2 100644 --- a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-Info-on-a-Saved-Search.md @@ -2,7 +2,8 @@ Get details on a saved search. -*Entity:* [[SavedSearch|SavedSearch Entity]] +*Entity:* [SavedSearch](../LINQ-to-Twitter-Entities/SavedSearch-Entity.md) + *Type:* SavedSearchType.Show ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md index 1b677276..c7d87bae 100644 --- a/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md +++ b/LINQ-to-Twitter-5/Managing-Saved-Searches/Getting-a-List-of-Saved-Searches.md @@ -2,7 +2,8 @@ Get a list of saved searches. -*Entity:* [[SavedSearch|SavedSearch Entity]] +*Entity:* [SavedSearch](../LINQ-to-Twitter-Entities/SavedSearch-Entity.md) + *Type:* SavedSearchType.Searches ##### Parameters/Filters: From e1925431de443fb6d9a8617cfa381ea62a70ff38 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 17 Dec 2020 03:30:51 +0000 Subject: [PATCH 58/95] Update Searching-Twitter.md --- .../Getting-Closest-Trends.md | 3 ++- .../Getting-Trend-Locations.md | 3 ++- .../Retrieving-Available-Trend-Locations.md | 3 ++- .../Searching-Twitter.md | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md index 62ab9bcc..3ecac5dc 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Closest-Trends.md @@ -2,7 +2,8 @@ Get trends closest to a given latitude and longitude. -*Entity:* [[Trends|Trend Entity]] +*Entity:* [Trends](../LINQ-to-Twitter-Entities/Trend-Entity.md) + *Type:* TrendType.Closest ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md index 18f4bf47..c36fefaa 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Getting-Trend-Locations.md @@ -2,7 +2,8 @@ Get trends for a specified place. -*Entity:* [[Trends|Trend Entity]] +*Entity:* [Trends](../LINQ-to-Twitter-Entities/Trend-Entity.md) + *Type:* TrendType.Place ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md index 187b6895..62080320 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Retrieving-Available-Trend-Locations.md @@ -2,7 +2,8 @@ Get locations where trends are occurring. -*Entity:* [[Trends|Trend Entity]] +*Entity:* [Trends](../LINQ-to-Twitter-Entities/Trend-Entity.md) + *Type:* TrendType.Available ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md index 0cd00d5f..84d60cd4 100644 --- a/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md +++ b/LINQ-to-Twitter-5/Performing-Searches-and-Finding-Trends/Searching-Twitter.md @@ -2,7 +2,8 @@ Perform a search. -*Entity:* [[Search|Search Entity]] +*Entity:* [Search](../LINQ-to-Twitter-Entities/Search-Entity.md) + *Type:* SearchType.Search (optional) ##### Parameters/Filters: From 2380defc8ac6a399f4b9275b6656558af4d6e3f4 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 18 Dec 2020 04:13:14 +0000 Subject: [PATCH 59/95] Update Updating-Statuses.md --- .../Making-Status-Queries-and-Calls/Destroying-Statuses.md | 2 +- .../Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md | 3 ++- .../Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md | 3 ++- .../Getting-Status-oEmbed-Information.md | 3 ++- .../Getting-the-Retweets-of-a-Status.md | 3 ++- .../Making-Status-Queries-and-Calls/Querying-Statuses.md | 3 ++- .../Querying-the-Home-Timeline.md | 3 ++- .../Querying-the-Mentions-Timeline.md | 3 ++- .../Querying-the-User-Timeline.md | 3 ++- .../Making-Status-Queries-and-Calls/Retweeting-a-Status.md | 2 +- .../Making-Status-Queries-and-Calls/Updating-Statuses.md | 2 +- 11 files changed, 19 insertions(+), 11 deletions(-) diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md index 3d4800e9..3f2de005 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Destroying-Statuses.md @@ -14,7 +14,7 @@ public async Task DeleteTweetAsync(ulong tweetID) |------|---------|------|----------| | tweetID | ID of tweet to delete | ulong | yes | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) ##### v 3.0 Example: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md index e29b1c0f..8593978b 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Multiple-Tweets.md @@ -2,7 +2,8 @@ Looks up multiple tweets by ID -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Lookup ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md index 444671da..d656a2ed 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Retweeter-IDs.md @@ -2,7 +2,8 @@ Gets up to 100 IDs of users that retweeted a specific tweet. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Retweeters ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md index 0219dbad..ec2bbc97 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Status-oEmbed-Information.md @@ -2,7 +2,8 @@ Gets embeddable status information. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Oembed ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md index 844f9a39..ccdd7d96 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-the-Retweets-of-a-Status.md @@ -2,7 +2,8 @@ Gets up to 100 retweets of a tweet. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Retweets ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md index c3e34dab..1cd1f6b8 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-Statuses.md @@ -2,7 +2,8 @@ Gets a specific tweet. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Show ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md index 4cb3b840..2273d6c1 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Home-Timeline.md @@ -6,7 +6,8 @@ This query returns the tweets and retweets shown on a user's home page when they The maximum number of tweets/retweets returned is 800. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Home ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md index 483dc0a7..8903b510 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-Mentions-Timeline.md @@ -2,7 +2,8 @@ Gets the 20 most recent statuses where the user has been mentioned. A mention is defined as a tweet that contains the @ScreenName of the user. Only works for authorized user. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.Mentions ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md index 9501fd2b..5d9babb6 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Querying-the-User-Timeline.md @@ -2,7 +2,8 @@ Gets the 20 most recent statuses for the authorized user (doesn't include user's friends). The max number of tweets you can retrieve is 3200. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.User ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md index 23be89b1..64cebaef 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Retweeting-a-Status.md @@ -14,7 +14,7 @@ public async Task RetweetAsync(ulong tweetID) |------|---------|------|----------| | tweetID | ID of user replied to. | ulong | yes | -*Return Type:* [[Status|Status Entity]] +*Return Type:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) ##### Example: diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md index 1dd52f71..0ef68aec 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Updating-Statuses.md @@ -51,7 +51,7 @@ public async Task TweetAsync( | status | Text for new tweet. Must be 280 characters or less in length. | string | yes | | tweetMode | Set to TweetMode.Extended for 280 characters returned in Status.FullText. | TweetMode | no | -**Return Type:** [[Status|Status Entity]] +**Return Type:** [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) **Note:** When replying, remember to prefix the tweet with the _@UserName_ for the person you're replying to. From 2bf3e8e7a46ad6802ef9e0e43784b3ca53c954f9 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 18 Dec 2020 04:51:06 +0000 Subject: [PATCH 60/95] Update Getting-Statuses-Retweeted-About-a-User.md --- .../Getting-Statuses-Retweeted-About-a-User.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md index d4e51606..7d92d9da 100644 --- a/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md +++ b/LINQ-to-Twitter-5/Making-Status-Queries-and-Calls/Getting-Statuses-Retweeted-About-a-User.md @@ -2,7 +2,8 @@ Gets the 20 most recent retweets about a user. -*Entity:* [[Status|Status Entity]] +*Entity:* [Status](../LINQ-to-Twitter-Entities/Status-Entity.md) + *Type:* StatusType.RetweetsOfMe ##### Parameters/Filters: From c521eb74198d0a2d6411cf43f85881bbdb233d00 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 22 Dec 2020 03:58:45 +0000 Subject: [PATCH 61/95] Update Searching-for-Users.md --- .../Getting-User-Statuses-in-a-Category.md | 3 ++- .../Getting-User-Information/Querying-Profile-Banner-Sizes.md | 3 ++- .../Querying-Suggested-User-Categories.md | 3 ++- .../Querying-Suggested-Users-in-a-Category.md | 3 ++- .../Getting-User-Information/Querying-User-Contributees.md | 3 ++- .../Getting-User-Information/Querying-User-Contributors.md | 3 ++- .../Getting-User-Information/Querying-User-Details.md | 3 ++- .../Getting-User-Information/Querying-User-Info.md | 3 ++- LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md | 2 +- .../Getting-User-Information/Searching-for-Users.md | 3 ++- 10 files changed, 19 insertions(+), 10 deletions(-) diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md b/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md index 9257df4e..d491eda0 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Getting-User-Statuses-in-a-Category.md @@ -2,7 +2,8 @@ Get list of user statuses in a category. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.CategoryStatus ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md index 31236691..d92ee390 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Profile-Banner-Sizes.md @@ -2,7 +2,8 @@ Get list allowable sizes for profile banners. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.BannerSizes ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md index 691405c4..939d6f25 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-User-Categories.md @@ -2,7 +2,8 @@ Get list of categories for suggested users. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Categories ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md index 0e449d82..5cfafa67 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-Suggested-Users-in-a-Category.md @@ -2,7 +2,8 @@ Get list of users in suggested users category. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Category ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md index ea2ba89a..b331f457 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributees.md @@ -2,7 +2,8 @@ Get list of users that the specified user can contribute to. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Contributees ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md index 00003e9e..408702a4 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Contributors.md @@ -2,7 +2,8 @@ Get list of users that can contribute to the specified user. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Contributors ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md index 2a989aea..05c943e9 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Details.md @@ -2,7 +2,8 @@ Look up details on specified users. Returns up to 100 users. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Lookup ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md index 712e4a54..f5375d68 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Querying-User-Info.md @@ -2,7 +2,8 @@ Show information for a user. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Show ##### Parameters/Filters: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md b/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md index 2a7be243..4b9e19c5 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Reporting-Spam.md @@ -21,7 +21,7 @@ public async Task ReportSpamAsync( Note: `userID` or `screenName` must be provided. -*Return Type:* [[User|User Entity]] +*Return Type:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) ##### Example: diff --git a/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md b/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md index dea72752..99caba1e 100644 --- a/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md +++ b/LINQ-to-Twitter-5/Getting-User-Information/Searching-for-Users.md @@ -2,7 +2,8 @@ Find users with a search query. -*Entity:* [[User|User Entity]] +*Entity:* [User](../LINQ-to-Twitter-Entities/User-Entity.md) + *Type:* UserType.Search ##### Parameters/Filters: From 672a59d5316d0a1c79bbc1ac686ea8c25dcf0526 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 23 Dec 2020 01:59:45 +0000 Subject: [PATCH 62/95] Update Streaming-Twitter-Content.md --- .../Streaming-Twitter-Content.md | 12 ---- .../Stream-Multiple-User-Messages.md | 41 ----------- .../Stream-User-Messages.md | 72 ------------------- 3 files changed, 125 deletions(-) delete mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md delete mode 100644 LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md index 4fdcf67f..78958ed0 100644 --- a/LINQ-to-Twitter-5/Streaming-Twitter-Content.md +++ b/LINQ-to-Twitter-5/Streaming-Twitter-Content.md @@ -9,15 +9,3 @@ Return statuses matching given filters #### [Getting Status Samples](Streaming-Twitter-Content/Getting-Status-Samples.md) Return status samples - -#### [Getting Public Statuses](Streaming-Twitter-Content/Getting-Public-Statuses.md) - -Return all public statuses with the firehose - -#### [Stream User Messages](Streaming-Twitter-Content/Stream-User-Messages.md) - -Return a single user's messages as a stream - -#### [Stream Multiple User Messages](Streaming-Twitter-Content/Stream-Multiple-User-Messages.md) - -Return multiple users' messages as a stream \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md deleted file mode 100644 index 947994b6..00000000 --- a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-Multiple-User-Messages.md +++ /dev/null @@ -1,41 +0,0 @@ -### Stream Multiple User Messages -Return multiple users' messages as a stream. - -*Type:* UserStreamType.Site - -##### Parameters/Filters: - -| Name | Purpose | Type | Required | -|------|---------|------|----------| -| Delimited | Tweets are delimited in the stream | string | no | -| Follow | Comma-separated list of user IDs to return tweets for | string | no | -| Replies | Return additional replies | string | no | -| StallWarnings | Whether stall warnings should be delivered | bool | no | -| With | Include messages of accounts that the users follow | string | no | - -*Return Type:* JSON string. - -##### Example: - -```c# - Console.WriteLine("\nStreamed Content: \n"); - int count = 0; - - (from strm in twitterCtx.UserStream - where strm.Type == UserStreamType.Site && - //strm.With == "followings" && - strm.Follow == "15411837"//,16761255" - select strm) - .StreamingCallback(strm => - { - Console.WriteLine(strm.Content + "\n"); - - if (count++ >= 10) - { - strm.CloseStream(); - } - }) - .SingleOrDefault(); -``` - -*Twitter API:* [site](https://dev.twitter.com/docs/api/2b/get/site) \ No newline at end of file diff --git a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md b/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md deleted file mode 100644 index 08de3a72..00000000 --- a/LINQ-to-Twitter-5/Streaming-Twitter-Content/Stream-User-Messages.md +++ /dev/null @@ -1,72 +0,0 @@ -### Stream User Messages -Return a single user's messages as a stream. - -*Type:* UserStreamType.User - -##### Parameters/Filters: - -| Name | Purpose | Type | Required | -|------|---------|------|----------| -| Delimited | Tweets are delimited in the stream | string | no | -| Locations | Include tweets within specified bounding box | string | no | -| Replies | Return additional replies | string | no | -| StallWarnings | Whether stall warnings should be delivered | bool | no | -| Track | Include tweets matching comma-separated list of keywords | string | no | - -*Return Type:* JSON string. - -##### v3.0 Example: - -```c# - Console.WriteLine("\nStreamed Content: \n"); - int count = 0; - - await - (from strm in twitterCtx.Streaming - where strm.Type == StreamingType.User - select strm) - .StartAsync(async strm => - { - string message = - string.IsNullOrEmpty(strm.Content) ? - "Keep-Alive" : strm.Content; - Console.WriteLine( - (count + 1).ToString() + - ". " + DateTime.Now + - ": " + message + "\n"); - - if (count++ == 5) - strm.CloseStream(); - }); -``` - -##### v2.1 Example: - -```c# - Console.WriteLine("\nStreamed Content: \n"); - int count = 0; - - // the user stream is for whoever is authenticated - // via the Authenticator passed to TwitterContext - (from strm in twitterCtx.UserStream - where strm.Type == UserStreamType.User - select strm) - .StreamingCallback(strm => - { - if (strm.Status == TwitterErrorStatus.RequestProcessingException) - { - Console.WriteLine(strm.Error.ToString()); - return; - } - - Console.WriteLine(strm.Content + "\n"); - - if (count++ >= 25) - { - strm.CloseStream(); - } - }) - .SingleOrDefault(); -``` - -*Twitter API:* [ user](https://dev.twitter.com/docs/api/1.1/get/user) \ No newline at end of file From 26c1a39c16ca8a3fa7017019111ff95d61a9b357 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 23 Dec 2020 02:01:22 +0000 Subject: [PATCH 63/95] Update Raw-Commands.md --- LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md index 6580a62d..32e662ba 100644 --- a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md +++ b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md @@ -2,7 +2,8 @@ A raw query lets you manually add URL segments and parameters to execute any HTTP GET endpoint in the Twitter API. -*Entity:* [[Raw|Raw Entity]] +*Entity:* [Raw](../LINQ-to-Twitter-Entities/Raw-Entity.md) + *Type:* N/A ##### Parameters/Filters: From 274b0ad34584a06553d6b81eb816dbf02fb515b0 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 23 Dec 2020 02:02:59 +0000 Subject: [PATCH 64/95] Update Raw-Queries.md --- LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md | 1 + LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md | 1 + 2 files changed, 2 insertions(+) diff --git a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md index c81561a4..17567a85 100644 --- a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md +++ b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Commands.md @@ -15,6 +15,7 @@ public async Task ExecuteRawAsync( |------|---------|------|----------| | queryString | URL segments | string | yes | | parameters | Name/value pairs for post parameters | Dictionary | no | + *Return Type:* string ##### Example: diff --git a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md index 32e662ba..a929c453 100644 --- a/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md +++ b/LINQ-to-Twitter-5/Safety-Hatch/Raw-Queries.md @@ -11,6 +11,7 @@ A raw query lets you manually add URL segments and parameters to execute any HTT | Name | Purpose | Type | Required | |------|---------|------|----------| | QueryString | URL segments + query parameters | string | yes | + Notes: - Don't include the Base URL in the query string, as it is already set in your TwitterContext instance. - Url Encode all parameters. From 373e5dfa1b8eebd627853635ab56a0b43fca1d8e Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 24 Dec 2020 04:52:12 +0000 Subject: [PATCH 65/95] Update Raw-Commands.md --- .../LINQ-to-Twitter-Entities/Raw-Entity.md | 12 ++++++ LINQ-to-Twitter-6/Raw-Commands-And-Queries.md | 13 ++++++ .../Raw-Commands-and-Queries/Raw-Commands.md | 43 +++++++++++++++++++ .../Raw-Commands-and-Queries/Raw-Queries.md | 37 ++++++++++++++++ LINQ-to-Twitter-v6.md | 6 ++- 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md create mode 100644 LINQ-to-Twitter-6/Raw-Commands-And-Queries.md create mode 100644 LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md create mode 100644 LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md diff --git a/LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md b/LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md new file mode 100644 index 00000000..9f53ad71 --- /dev/null +++ b/LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md @@ -0,0 +1,12 @@ +#### Raw Entity + +The Raw entity supports Raw queries. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| QueryString | URL segments + parameters | string | yes | +| Response | Raw JSON response from Twitter | string | no | + +*Twitter API:* None - LINQ to Twitter type \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md b/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md new file mode 100644 index 00000000..2a859688 --- /dev/null +++ b/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md @@ -0,0 +1,13 @@ +### Raw Commands and Queries + +If something isn't quite right or available, you still have a work around. For example, what if the Twitter API adds a new parameter to an endpoint; an entirely new endpoint; or a new set of beta endpoints that aren't available in the latest version of LINQ to Twitter? What if LINQ to Twitter has a bug that isn't fixed in the latest release? You aren't stuck. + +The safety hatch is Raw queries and commands. While a bit more work, this approach is flexible and still helps you avoid much low-level plumbing code, such as HTTP communication and OAuth. + +#### [Raw Queries](Raw-Commands-and-Queries/Raw-Queries.md) + +Perform a query on any HTTP GET endpoint in the Twitter API. + +#### [Raw Commands](Raw-Commands-and-Queries/Raw-Commands.md) + +Communicate with any HTTP POST endpoint in the Twitter API. \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md new file mode 100644 index 00000000..4c7d2549 --- /dev/null +++ b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md @@ -0,0 +1,43 @@ +#### Raw Commands + +A raw query lets you manually add URL segments and parameters to communicate with any HTTP POST endpoint in the Twitter API. + +##### Signature: + +```c# +public async Task ExecuteRawAsync( + string queryString, Dictionary parameters) +``` + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| queryString | URL segments | string | yes | +| parameters | Name/value pairs for post parameters | Dictionary | no | + +*Return Type:* string (JSON response from Twitter) + +##### Example: + +```c# +string status = + "Testing LINQ to Twitter Raw Interface - " + + DateTime.Now.ToString() + " #Linq2Twitter"; +var parameters = new Dictionary +{ + { "status", status } +}; + +string queryString = "/statuses/update.json"; + +string result = + await twitterCtx.ExecuteRawAsync( + queryString, parameters); + +if (result != null) + Console.WriteLine( + "\nResponse from update status: \n\n\t" + result); +``` + +*Twitter API:* [Any HTTP POST endpoint in the Twitter API](https://developer.twitter.com/en/docs/twitter-api/early-access) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md new file mode 100644 index 00000000..246e5dfa --- /dev/null +++ b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md @@ -0,0 +1,37 @@ +#### Raw Queries + +A raw query lets you manually add URL segments and parameters to execute any HTTP GET endpoint in the Twitter API. + +*Entity:* [Raw](../LINQ-to-Twitter-Entities/Raw-Entity.md) + +*Type:* N/A + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| QueryString | URL segments + query parameters | string | yes | + +Notes: +- Don't include the Base URL in the query string, as it is already set in your `TwitterContext` instance. +- Url Encode all parameters. + +##### Example: +```c# +string unencodedStatus = "LINQ to Twitter"; +string encodedStatus = Uri.EscapeDataString(unencodedStatus); +string queryString = "search/tweets.json?q=" + encodedStatus; + +var rawResult = + await + (from raw in twitterCtx.RawQuery + where raw.QueryString == queryString + select raw) + .SingleOrDefaultAsync(); + +if (rawResult != null) + Console.WriteLine( + "Response from Twitter: \n\n" + rawResult.Response); +``` + +*Twitter API:* [Any HTTP GET endpoint in the Twitter API](https://developer.twitter.com/en/docs/twitter-api/early-access) \ No newline at end of file diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md index dc57143a..1d730221 100644 --- a/LINQ-to-Twitter-v6.md +++ b/LINQ-to-Twitter-v6.md @@ -12,4 +12,8 @@ Queries for anything you can do with a Tweet such as Lookup, Searches, and Strea ### [Users](LINQ-to-Twitter-6/Users.md) -Anything you need for looking up users, their accounts, and profile details. \ No newline at end of file +Anything you need for looking up users, their accounts, and profile details. + +### [Raw Commands and Queries](LINQ-to-Twitter-6/Raw-Commands-and-Queries.md) + +Use a Raw Command or Query any time LINQ to Twitter doesn't have specific support for a Twitter endpoint. e.g. a brand new endpoint that hasn't been implemented yet. \ No newline at end of file From 884a1d3c792ae7f288cd84d529bba05b313d405d Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 24 Dec 2020 05:34:01 +0000 Subject: [PATCH 66/95] Update Raw-Commands.md --- LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md | 2 +- LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md index 4c7d2549..bcede946 100644 --- a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md +++ b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Commands.md @@ -1,6 +1,6 @@ #### Raw Commands -A raw query lets you manually add URL segments and parameters to communicate with any HTTP POST endpoint in the Twitter API. +A raw query lets you manually add URL segments and parameters to communicate with any HTTP POST endpoint in the Twitter v2 API. ##### Signature: diff --git a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md index 246e5dfa..a1f7e52d 100644 --- a/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md +++ b/LINQ-to-Twitter-6/Raw-Commands-and-Queries/Raw-Queries.md @@ -1,6 +1,6 @@ #### Raw Queries -A raw query lets you manually add URL segments and parameters to execute any HTTP GET endpoint in the Twitter API. +A raw query lets you manually add URL segments and parameters to execute any HTTP GET endpoint in the Twitter v2 API. *Entity:* [Raw](../LINQ-to-Twitter-Entities/Raw-Entity.md) From 82ba9713fa9ad6d151c4006d9047bb154b29c833 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 24 Dec 2020 05:35:54 +0000 Subject: [PATCH 67/95] Update Raw-Commands-And-Queries.md --- LINQ-to-Twitter-6/Raw-Commands-And-Queries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md b/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md index 2a859688..bc8ce748 100644 --- a/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md +++ b/LINQ-to-Twitter-6/Raw-Commands-And-Queries.md @@ -1,6 +1,6 @@ ### Raw Commands and Queries -If something isn't quite right or available, you still have a work around. For example, what if the Twitter API adds a new parameter to an endpoint; an entirely new endpoint; or a new set of beta endpoints that aren't available in the latest version of LINQ to Twitter? What if LINQ to Twitter has a bug that isn't fixed in the latest release? You aren't stuck. +If something isn't quite right or available, you still have a work around. For example, what if the Twitter API adds a new parameter to an endpoint; an entirely new endpoint; or a new set of beta endpoints that aren't available in the latest version of LINQ to Twitter? What if LINQ to Twitter has a bug that isn't fixed in the latest release? You aren't stuck. The safety hatch is Raw queries and commands. While a bit more work, this approach is flexible and still helps you avoid much low-level plumbing code, such as HTTP communication and OAuth. From 2bd85da9b7e0d3252500e872336910a99e6d3b33 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 24 Dec 2020 05:37:04 +0000 Subject: [PATCH 68/95] Update LINQ-to-Twitter-v6.md --- LINQ-to-Twitter-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md index 1d730221..6d4dabe2 100644 --- a/LINQ-to-Twitter-v6.md +++ b/LINQ-to-Twitter-v6.md @@ -16,4 +16,4 @@ Anything you need for looking up users, their accounts, and profile details. ### [Raw Commands and Queries](LINQ-to-Twitter-6/Raw-Commands-and-Queries.md) -Use a Raw Command or Query any time LINQ to Twitter doesn't have specific support for a Twitter endpoint. e.g. a brand new endpoint that hasn't been implemented yet. \ No newline at end of file +Use a Raw Command or Query any time LINQ to Twitter doesn't have specific support for a Twitter endpoint. e.g. a brand new endpoint that hasn't been implemented yet. \ No newline at end of file From eea9d3010555ac853468f9a1f7d7a678b0b4f0a9 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 25 Dec 2020 03:23:17 +0000 Subject: [PATCH 69/95] Update Lookup.md --- LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md | 48 ++++++++++++++++++ LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md | 49 +++++++++++++++++++ LINQ-to-Twitter-v6.md | 2 +- 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md create mode 100644 LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md diff --git a/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md b/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md new file mode 100644 index 00000000..0ee79e64 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md @@ -0,0 +1,48 @@ +#### Mentions Timeline + +Read all mentions of a user. + +*Entity:* Tweet|Tweet Entity + +*Type:* StatusType.Mentions + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | ID of the user who's timeline should be read | string | EndTime | Date/Time to search to | DateTime | no | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PaginationToken | Provide this, when paging, to get the next or previous page of results | string | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UntilID | Return tweets whose ids are less than this | string | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: + +```c# +string userID = "15411837"; + +TweetQuery? tweetResponse = + await + (from tweet in twitterCtx.Tweets + where tweet.Type == TweetType.MentionsTimeline && + tweet.ID == userID + select tweet) + .SingleOrDefaultAsync(); + +if (tweetResponse?.Tweets != null) + tweetResponse.Tweets.ForEach(tweet => + Console.WriteLine( + $"\nUser: {tweet.ID}" + + $"\nTweet: {tweet.Text}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [users/:id/mentions](https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-mentions) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md b/LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md new file mode 100644 index 00000000..50701194 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md @@ -0,0 +1,49 @@ +#### Tweets Timeline + +Read all tweets from a user's home timeline. + +*Entity:* Tweet|Tweet Entity + +*Type:* StatusType.UserTimeline + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | ID of the user who's timeline should be read | string | EndTime | Date/Time to search to | DateTime | no | +| Exclude | Type of tweets to omit from results | Excludes enum | no | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PaginationToken | Provide this, when paging, to get the next or previous page of results | string | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UntilID | Return tweets whose ids are less than this | string | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: + +```c# +string userID = "15411837"; + +TweetQuery? tweetResponse = + await + (from tweet in twitterCtx.Tweets + where tweet.Type == TweetType.UserTimeline && + tweet.ID == userID + select tweet) + .SingleOrDefaultAsync(); + +if (tweetResponse?.Tweets != null) + tweetResponse.Tweets.ForEach(tweet => + Console.WriteLine( + $"\nUser: {tweet.ID}" + + $"\nTweet: {tweet.Text}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [users/:id/tweets](https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets) \ No newline at end of file diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md index 6d4dabe2..3b93a8db 100644 --- a/LINQ-to-Twitter-v6.md +++ b/LINQ-to-Twitter-v6.md @@ -14,6 +14,6 @@ Queries for anything you can do with a Tweet such as Lookup, Searches, and Strea Anything you need for looking up users, their accounts, and profile details. -### [Raw Commands and Queries](LINQ-to-Twitter-6/Raw-Commands-and-Queries.md) +### [Raw Commands and Queries](LINQ-to-Twitter-6/Raw-Commands-And-Queries.md) Use a Raw Command or Query any time LINQ to Twitter doesn't have specific support for a Twitter endpoint. e.g. a brand new endpoint that hasn't been implemented yet. \ No newline at end of file From be9dfa7a0be25408c5f13fc542f75983f628f03e Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 25 Dec 2020 03:29:57 +0000 Subject: [PATCH 70/95] Update Tweets.md --- LINQ-to-Twitter-6/Tweets.md | 8 +++++++- .../Tweets/{Tweet-Timeline.md => Tweets-Timeline.md} | 0 2 files changed, 7 insertions(+), 1 deletion(-) rename LINQ-to-Twitter-6/Tweets/{Tweet-Timeline.md => Tweets-Timeline.md} (100%) diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index 4065e5ce..da611158 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -20,4 +20,10 @@ Read a real-time stream sampling around 1% of public tweets. Coming soon... ### [Hide Replies](Tweets/Hide-Replies.md) -Hides/Unhides replies to a tweet. \ No newline at end of file +Hides/Unhides replies to a tweet. + +### [Mentions Timeline](Tweets/Mentions-Timeline.md) + +Read all mentions of a user. + +### [Tweets Timeline](Tweets/TweetsTimeline.md) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md b/LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md similarity index 100% rename from LINQ-to-Twitter-6/Tweets/Tweet-Timeline.md rename to LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md From a280ad8112b1078fd3a6985a529e47d14d311a82 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 25 Dec 2020 03:37:37 +0000 Subject: [PATCH 71/95] Update Tweets.md --- LINQ-to-Twitter-6/Tweets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index da611158..155004f1 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -26,4 +26,4 @@ Hides/Unhides replies to a tweet. Read all mentions of a user. -### [Tweets Timeline](Tweets/TweetsTimeline.md) \ No newline at end of file +### [Tweets Timeline](Tweets/Tweets-Timeline.md) \ No newline at end of file From 557c67950e73ce3c4f7980ae2809d16c33bce151 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 26 Dec 2020 00:34:58 +0000 Subject: [PATCH 72/95] Update Followers.md --- LINQ-to-Twitter-6/Users.md | 10 +++++++- LINQ-to-Twitter-6/Users/Followers.md | 37 ++++++++++++++++++++++++++++ LINQ-to-Twitter-6/Users/Following.md | 37 ++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Users/Followers.md create mode 100644 LINQ-to-Twitter-6/Users/Following.md diff --git a/LINQ-to-Twitter-6/Users.md b/LINQ-to-Twitter-6/Users.md index 8c149c22..199769ba 100644 --- a/LINQ-to-Twitter-6/Users.md +++ b/LINQ-to-Twitter-6/Users.md @@ -6,4 +6,12 @@ Search for one or more users by ID ### [Lookup by Username](Users/Lookup-by-Username.md) -Search for one or more users by username \ No newline at end of file +Search for one or more users by username + +### [Following](Users/Following.md) + +Get a list of other users that a user is following. + +### [Followers](Users/Followers.md) + +Get a list of a user's followers. \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users/Followers.md b/LINQ-to-Twitter-6/Users/Followers.md new file mode 100644 index 00000000..69247949 --- /dev/null +++ b/LINQ-to-Twitter-6/Users/Followers.md @@ -0,0 +1,37 @@ +#### Following + +Get a list of a user's followers. + +*Entity:* TwitterUser|TwitterUser Entity + +*Type:* UserType.Followers + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | ID of user to retrieve following | string | yes | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| PaginationToken | Provide this, when paging, to get the next or previous page of results | string | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: +```c# +string userID = "15411837"; + +TwitterUserQuery? userResponse = + await + (from user in twitterCtx.TwitterUser + where user.Type == UserType.Followers && + user.ID == userID + select user) + .SingleOrDefaultAsync(); + +if (userResponse != null) + userResponse.Users?.ForEach(user => + Console.WriteLine("Name: " + user.Username)); +``` + +*Twitter API:* [users/:id/followers](https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Users/Following.md b/LINQ-to-Twitter-6/Users/Following.md new file mode 100644 index 00000000..b9929ec8 --- /dev/null +++ b/LINQ-to-Twitter-6/Users/Following.md @@ -0,0 +1,37 @@ +#### Following + +Get a list of other users that a user is following. + +*Entity:* TwitterUser|TwitterUser Entity + +*Type:* UserType.Following + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | ID of user to retrieve following | string | yes | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| PaginationToken | Provide this, when paging, to get the next or previous page of results | string | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: +```c# +string userID = "15411837"; + +TwitterUserQuery? userResponse = + await + (from user in twitterCtx.TwitterUser + where user.Type == UserType.Following && + user.ID == userID + select user) + .SingleOrDefaultAsync(); + +if (userResponse != null) + userResponse.Users?.ForEach(user => + Console.WriteLine("ID: " + user.ID)); +``` + +*Twitter API:* [users/:id/following](https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-following) \ No newline at end of file From 0816a899652fd970d94233e1e7357a248abda141 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 26 Dec 2020 00:36:22 +0000 Subject: [PATCH 73/95] Update Followers.md --- LINQ-to-Twitter-6/Users/Followers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Users/Followers.md b/LINQ-to-Twitter-6/Users/Followers.md index 69247949..ff98f281 100644 --- a/LINQ-to-Twitter-6/Users/Followers.md +++ b/LINQ-to-Twitter-6/Users/Followers.md @@ -1,4 +1,4 @@ -#### Following +#### Followers Get a list of a user's followers. From 9527e3476bc3909244896796d100e290da6fca4a Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 27 Dec 2020 04:51:42 +0000 Subject: [PATCH 74/95] Update Raw-Object.md --- LINQ-to-Twitter-6/Data-Dictionary.md | 11 +++++++ .../Raw-Object.md} | 4 +-- .../Data-Dictionary/Tweet-Object.md | 30 +++++++++++++++++++ LINQ-to-Twitter-6/Fundamentals.md | 7 +++++ LINQ-to-Twitter-v6.md | 2 +- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary.md rename LINQ-to-Twitter-6/{LINQ-to-Twitter-Entities/Raw-Entity.md => Data-Dictionary/Raw-Object.md} (82%) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md create mode 100644 LINQ-to-Twitter-6/Fundamentals.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary.md b/LINQ-to-Twitter-6/Data-Dictionary.md new file mode 100644 index 00000000..90dbe125 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary.md @@ -0,0 +1,11 @@ +## Data Dictionary + +This section lists the objects that LINQ to Twitter works with. The Twitter API returns JSON that LINQ to Twitter deserializes into objects. Many object correspond directly to corresponding Twitter API objects. Other object, such as Raw or various enums, belong purely to LINQ to Twitter to make it easier to use. + +### [Tweet Object](Data-Dictionary/Tweet-Object.md) + +A user's tweet + +### [Raw Object](Data-Dictionary/Raw-Object.md) + +Response from a Raw Query \ No newline at end of file diff --git a/LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md b/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md similarity index 82% rename from LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md rename to LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md index 9f53ad71..009a91dc 100644 --- a/LINQ-to-Twitter-6/LINQ-to-Twitter-Entities/Raw-Entity.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md @@ -1,6 +1,6 @@ -#### Raw Entity +#### Raw Object -The Raw entity supports Raw queries. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). +The Raw object supports Raw queries. The input column designates whether the property is populated by the user and not Twitter (yes) or if it is a property populated by Twitter (no). ##### Properties: diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md new file mode 100644 index 00000000..e5c2c47a --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -0,0 +1,30 @@ +#### Tweet Object + +Represents a user's tweet. + +##### Properties: + +| Name | Purpose | Type | Input | +|------|---------|------|-------| +| Attachments | Attachments, such as polls, images, and videos | [Attachments]() | yes | +| AuthorID | Posting user's ID | string | no | +| ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation]()> | no | +| ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | no | +| CreatedAt | When tweeted | DateTime | no | +| Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities]() | no | +| Geo | Tweet location (if user provided) | TweetGeo | no | +| ID | ID of this tweet | string | no | +| InReplyToUserID | If replying, this is the ID of the user being replied to | string | no | +| Language | [BCP47 Language tag](https://tools.ietf.org/html/bcp47) | string | no | +| NonPublicMetrics | Non-Public Metrics | object | no | +| OrganicMetrics | Organic Metrics | object | no | +| PossiblySensitive | Media or links might reveal sensitive information | bool | no | +| PromotedMetrics | Promoted content metrics | object | no | +| PublicMetrics | Public metrics | [TweetPublicMetrics]() | no | +| ReferencedTweets | Any other tweets that this one refers to | List<[TweetReference]()> | no | +| ReplySettings | Who can reply to tweet | [TweetReplySettings]() | no | +| Source | The application sending the tweet | string | no | +| Text | User's tweet text | string | no | +| Withheld | Information regarding a request to withhold information | [TwitterWithheld]() | no | + +*Twitter API:* [Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Fundamentals.md b/LINQ-to-Twitter-6/Fundamentals.md new file mode 100644 index 00000000..7271aa21 --- /dev/null +++ b/LINQ-to-Twitter-6/Fundamentals.md @@ -0,0 +1,7 @@ +## Fundamentals + +Here, you'll find the basics and essential information you need for working with LINQ to Twitter. + +### [Data Dictionary](Data-Dictionary.md) + +Lists all objects that LINQ to Twitter works with. \ No newline at end of file diff --git a/LINQ-to-Twitter-v6.md b/LINQ-to-Twitter-v6.md index 3b93a8db..aab9cc9e 100644 --- a/LINQ-to-Twitter-v6.md +++ b/LINQ-to-Twitter-v6.md @@ -2,7 +2,7 @@ This page outlines the sections that correspond to the Twitter API. It will be useful to see how to perform commands and queries with LINQ to Twitter. Additionally, you might want to review [The Official Twitter API v2 Documentation](https://developer.twitter.com/en/docs/twitter-api/early-access) for the true source of information on parameters, return values, and more. -### Fundamentals +### [Fundamentals](LINQ-to-Twitter-6/Fundamentals.md) Information for Data Dictionary, Fields, Expansions, Tweet Annotations, Metrics, Conversation ID, and Rate Limits. Coming soon... From e0736993b555cf5c4ab01ae62688e67ef9269884 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Mon, 28 Dec 2020 03:24:19 +0000 Subject: [PATCH 75/95] Update Tweets-Timeline.md --- .../Data-Dictionary/TwitterUser-Object.md | 23 +++++++++++++++++++ LINQ-to-Twitter-6/Tweets.md | 4 +++- LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md new file mode 100644 index 00000000..92b6066d --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md @@ -0,0 +1,23 @@ +#### TwitterUser Object + +Represents a Twitter user. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| CreatedAt | Date the user signed up for Twitter | DateTime | +| Description | Profile description | string | +| Entities | Entities associated with this user's profile | [TwitterUserEntities]() | +| ID | User's Twitter ID | string | +| Location | Profile location | string | +| Name | User's entered name in profile | string | +| PinnedTweetID | ID of tweet user has pinned at the top of their timeline | +| ProfileImageUrl | URL to user's profile image | string | +| Protected | Is user account private (access by user's approval only) | bool | +| PublicMetrics | Metrics for this user | [TwitterUserPublicMetrics]() | +| URL | Profile URL | string | +| Username | Twitter assigned screen name | string | +| Verified | Is a Twitter verified account? | bool | + +*Twitter API:* [Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index 155004f1..ea6786ae 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -26,4 +26,6 @@ Hides/Unhides replies to a tweet. Read all mentions of a user. -### [Tweets Timeline](Tweets/Tweets-Timeline.md) \ No newline at end of file +### [Tweets Timeline](Tweets/Tweets-Timeline.md) + +Read all tweets from a user's home timeline. \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md b/LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md index 50701194..986abca3 100644 --- a/LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md +++ b/LINQ-to-Twitter-6/Tweets/Tweets-Timeline.md @@ -4,7 +4,7 @@ Read all tweets from a user's home timeline. *Entity:* Tweet|Tweet Entity -*Type:* StatusType.UserTimeline +*Type:* StatusType.TweetsTimeline ##### Parameters/Filters: From c78b0a5727c1c8b3d21517dbc8e75f8ca8be4a98 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Mon, 28 Dec 2020 03:50:07 +0000 Subject: [PATCH 76/95] Update Raw-Object.md --- LINQ-to-Twitter-6/Data-Dictionary.md | 4 ++ .../Data-Dictionary/Raw-Object.md | 8 ++-- .../Data-Dictionary/Tweet-Object.md | 44 +++++++++---------- .../Data-Dictionary/TwitterUser-Object.md | 1 + 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/LINQ-to-Twitter-6/Data-Dictionary.md b/LINQ-to-Twitter-6/Data-Dictionary.md index 90dbe125..af30a366 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary.md +++ b/LINQ-to-Twitter-6/Data-Dictionary.md @@ -6,6 +6,10 @@ This section lists the objects that LINQ to Twitter works with. The Twitter API A user's tweet +### [TwitterUser Object](Data-Dictionary/TwitterUser-Object.md) + +Represents a Twitter user. + ### [Raw Object](Data-Dictionary/Raw-Object.md) Response from a Raw Query \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md index 009a91dc..a4a2e241 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Raw-Object.md @@ -4,9 +4,9 @@ The Raw object supports Raw queries. The input column designates whether the pro ##### Properties: -| Name | Purpose | Type | Input | -|------|---------|------|-------| -| QueryString | URL segments + parameters | string | yes | -| Response | Raw JSON response from Twitter | string | no | +| Name | Purpose | Type | +|------|---------|------| +| QueryString | URL segments + parameters | string | +| Response | Raw JSON response from Twitter | string | *Twitter API:* None - LINQ to Twitter type \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md index e5c2c47a..8f6f4c97 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -4,27 +4,27 @@ Represents a user's tweet. ##### Properties: -| Name | Purpose | Type | Input | -|------|---------|------|-------| -| Attachments | Attachments, such as polls, images, and videos | [Attachments]() | yes | -| AuthorID | Posting user's ID | string | no | -| ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation]()> | no | -| ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | no | -| CreatedAt | When tweeted | DateTime | no | -| Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities]() | no | -| Geo | Tweet location (if user provided) | TweetGeo | no | -| ID | ID of this tweet | string | no | -| InReplyToUserID | If replying, this is the ID of the user being replied to | string | no | -| Language | [BCP47 Language tag](https://tools.ietf.org/html/bcp47) | string | no | -| NonPublicMetrics | Non-Public Metrics | object | no | -| OrganicMetrics | Organic Metrics | object | no | -| PossiblySensitive | Media or links might reveal sensitive information | bool | no | -| PromotedMetrics | Promoted content metrics | object | no | -| PublicMetrics | Public metrics | [TweetPublicMetrics]() | no | -| ReferencedTweets | Any other tweets that this one refers to | List<[TweetReference]()> | no | -| ReplySettings | Who can reply to tweet | [TweetReplySettings]() | no | -| Source | The application sending the tweet | string | no | -| Text | User's tweet text | string | no | -| Withheld | Information regarding a request to withhold information | [TwitterWithheld]() | no | +| Name | Purpose | Type | +|------|---------|------| +| Attachments | Attachments, such as polls, images, and videos | [Attachments]() | +| AuthorID | Posting user's ID | string | +| ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation]()> | +| ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | +| CreatedAt | When tweeted | DateTime | +| Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities]() | +| Geo | Tweet location (if user provided) | TweetGeo | +| ID | ID of this tweet | string | +| InReplyToUserID | If replying, this is the ID of the user being replied to | string | +| Language | [BCP47 Language tag](https://tools.ietf.org/html/bcp47) | string | +| NonPublicMetrics | Non-Public Metrics | object | +| OrganicMetrics | Organic Metrics | object | +| PossiblySensitive | Media or links might reveal sensitive information | bool | +| PromotedMetrics | Promoted content metrics | object | +| PublicMetrics | Public metrics | [TweetPublicMetrics]() | +| ReferencedTweets | Any other tweets that this one refers to | List<[TweetReference]()> | +| ReplySettings | Who can reply to tweet | [TweetReplySettings]() | +| Source | The application sending the tweet | string | +| Text | User's tweet text | string | +| Withheld | Information regarding a request to withhold information | [TwitterWithheld]() | *Twitter API:* [Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md index 92b6066d..0794aba4 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TwitterUser-Object.md @@ -19,5 +19,6 @@ Represents a Twitter user. | URL | Profile URL | string | | Username | Twitter assigned screen name | string | | Verified | Is a Twitter verified account? | bool | +| Withheld | Details on information to withhold | object | *Twitter API:* [Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From 21500f7586619e2d46d2aecc492bbdc1f5c52d69 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 29 Dec 2020 05:24:39 +0000 Subject: [PATCH 77/95] Update Data-Dictionary.md --- LINQ-to-Twitter-6/Data-Dictionary.md | 12 +++++++---- .../Data-Dictionary/TweetMedia-Object.md | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetMedia-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary.md b/LINQ-to-Twitter-6/Data-Dictionary.md index af30a366..d3aa44f5 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary.md +++ b/LINQ-to-Twitter-6/Data-Dictionary.md @@ -2,14 +2,18 @@ This section lists the objects that LINQ to Twitter works with. The Twitter API returns JSON that LINQ to Twitter deserializes into objects. Many object correspond directly to corresponding Twitter API objects. Other object, such as Raw or various enums, belong purely to LINQ to Twitter to make it easier to use. +### [Raw Object](Data-Dictionary/Raw-Object.md) + +Response from a Raw Query + ### [Tweet Object](Data-Dictionary/Tweet-Object.md) A user's tweet -### [TwitterUser Object](Data-Dictionary/TwitterUser-Object.md) +### [TweetMedia Object](Data-Dictionary/TweetMedia-Object.md) -Represents a Twitter user. +Represents a GIF, photo, or video included with a tweet. -### [Raw Object](Data-Dictionary/Raw-Object.md) +### [TwitterUser Object](Data-Dictionary/TwitterUser-Object.md) -Response from a Raw Query \ No newline at end of file +Represents a Twitter user. diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetMedia-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetMedia-Object.md new file mode 100644 index 00000000..0a6aa8fa --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetMedia-Object.md @@ -0,0 +1,20 @@ +#### TweetMedia Object + +Represents a GIF, photo, or video included with a tweet. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| DurationMS | Milliseconds duration for videos | int | +| Height | Height in pixels | int | +| MediaKey | Media ID - Matches MediaKey in TweetAttachments | string | +| NonPublicMetrics | Non-Public Metrics | object | +| OrganicMetrics | Organic Metrics | object | +| PreviewImageUrl | URL to video preview image | string | +| PromotedMetrics | Promoted Metrics | object | +| PublicMetrics | Public Metrics | object | +| Type | Type of media - e.g. gif, photo, or video | [TweetMediaType]() | +| Width | Width in pixels | int | + +*Twitter API:* [Media Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media) \ No newline at end of file From ad2ade7f7d72bce7a630dadb6fa961e1bcef72e0 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 30 Dec 2020 06:30:32 +0000 Subject: [PATCH 78/95] Update TweetPoll-Object.md --- LINQ-to-Twitter-6/Data-Dictionary.md | 5 +++++ .../Data-Dictionary/TweetPoll-Object.md | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetPoll-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary.md b/LINQ-to-Twitter-6/Data-Dictionary.md index d3aa44f5..a92ac676 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary.md +++ b/LINQ-to-Twitter-6/Data-Dictionary.md @@ -14,6 +14,11 @@ A user's tweet Represents a GIF, photo, or video included with a tweet. +### [TweetPoll Object](Data-Dictionary/TweetPoll-Object.md) + +Represents a Poll. + ### [TwitterUser Object](Data-Dictionary/TwitterUser-Object.md) Represents a Twitter user. + diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetPoll-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetPoll-Object.md new file mode 100644 index 00000000..7b3cbf4b --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetPoll-Object.md @@ -0,0 +1,15 @@ +#### TweetPoll Object + +Represents a Poll. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| ID | ID for the poll | string | +| Options | Poll options | List<[TweetPollOption]()> | +| DurationMinutes | Number of minutes to run poll | int | +| EndDatetime | Ending date and time | DateTime | +| VotingStatus | Whether poll is open or closed | string | + +*Twitter API:* [Poll Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll) \ No newline at end of file From 881537459b6b43262c99f73f23f05134c555f5d8 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 2 Jan 2021 06:20:28 +0000 Subject: [PATCH 79/95] Update TwitterPlace-Object.md --- LINQ-to-Twitter-6/Data-Dictionary.md | 4 ++++ .../Data-Dictionary/TwitterPlace-Object.md | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TwitterPlace-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary.md b/LINQ-to-Twitter-6/Data-Dictionary.md index a92ac676..9dfb4729 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary.md +++ b/LINQ-to-Twitter-6/Data-Dictionary.md @@ -18,6 +18,10 @@ Represents a GIF, photo, or video included with a tweet. Represents a Poll. +### [TwitterPlace Object](Data-Dictionary/TwitterPlace-Object.md) + +Represents a Twitter place. + ### [TwitterUser Object](Data-Dictionary/TwitterUser-Object.md) Represents a Twitter user. diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TwitterPlace-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TwitterPlace-Object.md new file mode 100644 index 00000000..1d47e6bb --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TwitterPlace-Object.md @@ -0,0 +1,18 @@ +#### TwitterPlace Object + +Represents a Twitter place. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| ContainedWithin | IDs of places containing this place | List<string> | +| Country | Full-length country name | string | +| CountryCode | ISO Alpha-2 country code | string | +| FullName | Full name of place | string | +| Geo | Place details | [Geo]() | +| ID | Unique ID for this place | string | +| Name | Short name of place | string | +| PlaceType | Type of place - e.g. city or point of interest | string | + +*Twitter API:* [Place Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place) \ No newline at end of file From 85ed9bf25fee563745cb7725accbb5efe0b3a89e Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 2 Jan 2021 23:10:28 +0000 Subject: [PATCH 80/95] Update Tweet-Object.md --- LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md | 2 +- .../Data-Dictionary/TweetAttachment-Object.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetAttachment-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md index 8f6f4c97..e9108f4f 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -6,7 +6,7 @@ Represents a user's tweet. | Name | Purpose | Type | |------|---------|------| -| Attachments | Attachments, such as polls, images, and videos | [Attachments]() | +| Attachments | Attachments, such as polls, images, and videos | [TweetAttachment](TweetAttachment-Object.md) | | AuthorID | Posting user's ID | string | | ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation]()> | | ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetAttachment-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetAttachment-Object.md new file mode 100644 index 00000000..2205a714 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetAttachment-Object.md @@ -0,0 +1,12 @@ +#### TweetAttachment Object + +Type of attachment in a tweet. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| PollIds | Poll IDs | List<string> | +| MediaKeys | Media Keys | List<string> | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From aa7675da18309f8838f254a44ccf37e6e9a5cf2d Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 5 Jan 2021 02:18:09 +0000 Subject: [PATCH 81/95] Update TweetContextAnnotation-Object.md --- LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md | 2 +- .../TweetContextAnnotation-Object.md | 12 ++++++++++++ .../TweetContextAnnotationDetails-Object.md | 13 +++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotation-Object.md create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotationDetails-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md index e9108f4f..93b0ef58 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -8,7 +8,7 @@ Represents a user's tweet. |------|---------|------| | Attachments | Attachments, such as polls, images, and videos | [TweetAttachment](TweetAttachment-Object.md) | | AuthorID | Posting user's ID | string | -| ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation]()> | +| ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation](TweetContextAnnotation-Object.md)> | | ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | | CreatedAt | When tweeted | DateTime | | Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities]() | diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotation-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotation-Object.md new file mode 100644 index 00000000..a3c96a0b --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotation-Object.md @@ -0,0 +1,12 @@ +#### TweetContextAnnotation Object + +Tweet context annotations. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Domain | Domain details | [TweetContextAnnotationDetails](TweetContextAnnotationDetails-Object.md) | +| Entity | Entity details | [TweetContextAnnotationDetails](TweetContextAnnotationDetails-Object.md) | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotationDetails-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotationDetails-Object.md new file mode 100644 index 00000000..10800093 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetContextAnnotationDetails-Object.md @@ -0,0 +1,13 @@ +#### TweetContextAnnotationDetails Object + +Details for the Tweet context annotation domains and entities. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| ID | Annotation ID | string | +| Name | Annotation Name | string | +| Description | Annotation Description | string | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From 063cac74dec946e235e652d8d46fb782d7f4610b Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 6 Jan 2021 03:22:33 +0000 Subject: [PATCH 82/95] Update TweetEntities-Object.md --- .../Data-Dictionary/TweetEntities-Object.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md new file mode 100644 index 00000000..41f7a43a --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md @@ -0,0 +1,14 @@ +#### TweetEntities Object + +Entities associated with a tweet. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Urls | URL entities | [TweetEntityUrl]() | +| Hashtags | Hashtag entities | [TweetEntityHashtag]() | +| Mentions | Mention entities | [TweetEntityMention]() | +| Annotations | Annotation entities | [TweetEntityAnnotation]() | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From 8b7c67c56d1f9141a951d07fe80b9c489c46960d Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 8 Jan 2021 05:08:35 +0000 Subject: [PATCH 83/95] Update TweetEntityUrl-Object.md --- .../Data-Dictionary/TweetEntities-Object.md | 2 +- .../TweetEntityImage-Object.md | 13 +++++++++++ .../Data-Dictionary/TweetEntityUrl-Object.md | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntityImage-Object.md create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntityUrl-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md index 41f7a43a..8f05479d 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md @@ -6,7 +6,7 @@ Entities associated with a tweet. | Name | Purpose | Type | |------|---------|------| -| Urls | URL entities | [TweetEntityUrl]() | +| Urls | URL entities | [TweetEntityUrl](TweetEntityUrl-Object.md) | | Hashtags | Hashtag entities | [TweetEntityHashtag]() | | Mentions | Mention entities | [TweetEntityMention]() | | Annotations | Annotation entities | [TweetEntityAnnotation]() | diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityImage-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityImage-Object.md new file mode 100644 index 00000000..16615cd1 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityImage-Object.md @@ -0,0 +1,13 @@ +#### TweetEntityImage Object + +Tweet image details. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Height | Image height | int | +| Url | Url where you can find and download the image | string | +| Width | Image width | int | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityUrl-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityUrl-Object.md new file mode 100644 index 00000000..28202a6b --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityUrl-Object.md @@ -0,0 +1,22 @@ +#### TweetEntityUrl Object + +Entity URL details. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Start | Starting position of URL | int | +| Description | From Twitter Card description (in HTML header) | string | +| DisplayUrl | How URL appears in the tweet | string | +| End | Ending position of URL | int | +| ExpandedUrl | URL that user typed, may or may not be shortened URL | string | +| Images | Details on images attached to tweet | List<[TweetEntityImage](TweetEntityImage-Object.md)> | +| Start | Starting position of URL | int | +| Status | HTTP status from unwind | int | +| Title | From Twitter Card title (in HTML header) | string | +| UnwoundUrl | Final destination URL, after following intermediate shorteners (if any) | string | +| Url | Twitter's t.co URL | string | + + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From 6812fefadd0de22bd8451c50d56e79030b2842aa Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Mon, 18 Jan 2021 18:22:20 +0000 Subject: [PATCH 84/95] Update TweetEntityHashtag-Object.md --- .../Data-Dictionary/TweetEntities-Object.md | 2 +- .../Data-Dictionary/TweetEntityHashtag-Object.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md index 8f05479d..c62734b5 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md @@ -7,7 +7,7 @@ Entities associated with a tweet. | Name | Purpose | Type | |------|---------|------| | Urls | URL entities | [TweetEntityUrl](TweetEntityUrl-Object.md) | -| Hashtags | Hashtag entities | [TweetEntityHashtag]() | +| Hashtags | Hashtag entities | [TweetEntityHashtag](TweetEntityHashtag-Object.md) | | Mentions | Mention entities | [TweetEntityMention]() | | Annotations | Annotation entities | [TweetEntityAnnotation]() | diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md new file mode 100644 index 00000000..f4fe5aa8 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md @@ -0,0 +1,13 @@ +#### TweetEntityUrl Object + +Represents a hashtag entity. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Start | Start of hashtag | int | +| End | End of hashtag | int | +| Tag | Hashtag text | string | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From 4b2f75c53edad114b8e4f435375707317cbb57a6 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Wed, 20 Jan 2021 03:03:16 +0000 Subject: [PATCH 85/95] Update TweetEntityMention-Object.md --- .../Data-Dictionary/TweetEntities-Object.md | 2 +- .../Data-Dictionary/TweetEntityHashtag-Object.md | 2 +- .../Data-Dictionary/TweetEntityMention-Object.md | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntityMention-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md index c62734b5..e453c433 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md @@ -8,7 +8,7 @@ Entities associated with a tweet. |------|---------|------| | Urls | URL entities | [TweetEntityUrl](TweetEntityUrl-Object.md) | | Hashtags | Hashtag entities | [TweetEntityHashtag](TweetEntityHashtag-Object.md) | -| Mentions | Mention entities | [TweetEntityMention]() | +| Mentions | Mention entities | [TweetEntityMention](TweetEntityMention-Object.md) | | Annotations | Annotation entities | [TweetEntityAnnotation]() | *Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md index f4fe5aa8..2a9aa534 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityHashtag-Object.md @@ -1,4 +1,4 @@ -#### TweetEntityUrl Object +#### TweetEntityHashtag Object Represents a hashtag entity. diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityMention-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityMention-Object.md new file mode 100644 index 00000000..55cd35eb --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityMention-Object.md @@ -0,0 +1,13 @@ +#### TweetEntityMention Object + +Represents a mention entity. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Start | Start of mention | int | +| End | End of mention | int | +| Username | Mentioned username | string | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From b189ea5585ce9b2434ed47d15f962d2353f2e0d2 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Thu, 21 Jan 2021 06:04:04 +0000 Subject: [PATCH 86/95] Update index.md --- index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.md b/index.md index 492232a2..c80e259a 100644 --- a/index.md +++ b/index.md @@ -1,5 +1,7 @@ Welcome to LINQ to Twitter documentation. Here, you'll find the technical information you'll need to use LINQ to Twitter in your own applications. We have a FAQ, general Twitter API concepts, a Twitter API technical reference, security information, and error handling. +> Please take the LINQ to Twitter Survey at [https://bit.ly/2Luzbpt](https://bit.ly/2Luzbpt). + Note: The current version of LINQ to Twitter is v6.0, which tracks .NET 5+ and the Twitter API v2. It also offers Twitter API v1.1 support. Please see [LINQ to Twitter v5](LINQ-to-Twitter-v5.md) for Twitter API v1.1 technical endpoint documentation. ## [LINQ to Twitter FAQ](LINQ-to-Twitter-FAQ.md) From 8a17d581420d1765de6f3c387e7d6c75e6e6f2d9 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 22 Jan 2021 03:38:31 +0000 Subject: [PATCH 87/95] Update TweetEntities-Object.md --- LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md | 2 +- .../Data-Dictionary/TweetEntities-Object.md | 2 +- .../TweetEntityAnnotation-Object.md | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetEntityAnnotation-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md index 93b0ef58..a90a36c1 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -11,7 +11,7 @@ Represents a user's tweet. | ContextAnnotations | Contextual metadata associated with tweet | List<[TweetContextAnnotation](TweetContextAnnotation-Object.md)> | | ConversationID | ID of conversation this tweet is part of (matches original tweet ID) | string | | CreatedAt | When tweeted | DateTime | -| Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities]() | +| Entities | Extracted parts of the tweet, like hashtags, urls, etc. | [TweetEntities](TweetEntities-Object.md) | | Geo | Tweet location (if user provided) | TweetGeo | | ID | ID of this tweet | string | | InReplyToUserID | If replying, this is the ID of the user being replied to | string | diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md index e453c433..980abd84 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntities-Object.md @@ -9,6 +9,6 @@ Entities associated with a tweet. | Urls | URL entities | [TweetEntityUrl](TweetEntityUrl-Object.md) | | Hashtags | Hashtag entities | [TweetEntityHashtag](TweetEntityHashtag-Object.md) | | Mentions | Mention entities | [TweetEntityMention](TweetEntityMention-Object.md) | -| Annotations | Annotation entities | [TweetEntityAnnotation]() | +| Annotations | Annotation entities | [TweetEntityAnnotation](TweetEntityAnnotation-Object.md) | *Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityAnnotation-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityAnnotation-Object.md new file mode 100644 index 00000000..a7d29324 --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetEntityAnnotation-Object.md @@ -0,0 +1,15 @@ +#### TweetEntityAnnotation Object + +Represents an annotation entity. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| Start | Start of hashtag | int | +| End | End of hashtag | int | +| Probability | Probability that `NormalizedText` belongs to `Type` category | float | +| Type | Category that `NormalizedText` belongs to | string | +| NormalizedText | Annotated text | string | + +*Twitter API:* [Part of Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From ff402b47361fcc3496e8f45137552cf6f2712f38 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 29 Jan 2021 04:48:08 +0000 Subject: [PATCH 88/95] Update TweetPublicMetrics-Object.md --- .../Data-Dictionary/TweetPublicMetrics-Object.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 LINQ-to-Twitter-6/Data-Dictionary/TweetPublicMetrics-Object.md diff --git a/LINQ-to-Twitter-6/Data-Dictionary/TweetPublicMetrics-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/TweetPublicMetrics-Object.md new file mode 100644 index 00000000..a617787f --- /dev/null +++ b/LINQ-to-Twitter-6/Data-Dictionary/TweetPublicMetrics-Object.md @@ -0,0 +1,14 @@ +#### TweetPublicMetrics Object + +Metrics available to the public. + +##### Properties: + +| Name | Purpose | Type | +|------|---------|------| +| RetweetCount | Number of retweets | int | +| ReplyCount | Number of replies | int | +| LikeCount | Number of Likes | int | +| QuoteCount | Number of quotes | int | + +*Twitter API:* [Tweet Object](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) \ No newline at end of file From c43a56d1a848e007c36bdda80ee4ea7e59be7409 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Fri, 29 Jan 2021 04:48:38 +0000 Subject: [PATCH 89/95] Update TweetPublicMetrics-Object.md --- LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md index a90a36c1..85cb81a9 100644 --- a/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md +++ b/LINQ-to-Twitter-6/Data-Dictionary/Tweet-Object.md @@ -20,7 +20,7 @@ Represents a user's tweet. | OrganicMetrics | Organic Metrics | object | | PossiblySensitive | Media or links might reveal sensitive information | bool | | PromotedMetrics | Promoted content metrics | object | -| PublicMetrics | Public metrics | [TweetPublicMetrics]() | +| PublicMetrics | Public metrics | [TweetPublicMetrics](TweetPublicMetrics-Object.md) | | ReferencedTweets | Any other tweets that this one refers to | List<[TweetReference]()> | | ReplySettings | Who can reply to tweet | [TweetReplySettings]() | | Source | The application sending the tweet | string | From d3565994921f541e88877d17814b92bac5bd7146 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 27 Feb 2022 05:22:24 +0000 Subject: [PATCH 90/95] TOC for Tweets Count --- LINQ-to-Twitter-6/Tweets.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index ea6786ae..aa3305a2 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -28,4 +28,13 @@ Read all mentions of a user. ### [Tweets Timeline](Tweets/Tweets-Timeline.md) -Read all tweets from a user's home timeline. \ No newline at end of file +Read all mentions of a user. + +### [Recent Tweets Count](Tweets/Tweets-Count-Recent.md) + +Get count of tweets matching a query for the last 7 days. + +### [All Tweets Count](Tweets/Tweets-Count-All.md) + +Get count of all tweets matching a query (academic only). + From 015439cc6e92cf28721b9976b15803fbcf15dbae Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 16 Jul 2022 21:46:13 +0000 Subject: [PATCH 91/95] Update Reverse-Chronological-Timeline.md --- LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md | 5 +- .../Tweets/Reverse-Chronological-Timeline.md | 50 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md diff --git a/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md b/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md index 0ee79e64..58cf771b 100644 --- a/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md +++ b/LINQ-to-Twitter-6/Tweets/Mentions-Timeline.md @@ -4,13 +4,14 @@ Read all mentions of a user. *Entity:* Tweet|Tweet Entity -*Type:* StatusType.Mentions +*Type:* TweetType.MentionsTimeline ##### Parameters/Filters: | Name | Purpose | Type | Required | |------|---------|------|----------| -| ID | ID of the user who's timeline should be read | string | EndTime | Date/Time to search to | DateTime | no | +| ID | ID of the user who's timeline should be read | string | +| EndTime | Date/Time to search to | DateTime | no | | Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | | MaxResults | Maximum number of tweets to return | int | no | | MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | diff --git a/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md b/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md new file mode 100644 index 00000000..e70aed74 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md @@ -0,0 +1,50 @@ +#### Reverse Chronological Timeline + +Recent tweets of authorized user and those they follow. + +*Entity:* Tweet|Tweet Entity + +*Type:* TweetType.ReverseChronologicalTimeline + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| ID | ID of the user who's timeline should be read | string | +| EndTime | Date/Time to search to | DateTime | no | +| Exclude | Comma-separated list of tweet types to not include ("retweets" or "replies") | string | no | +| Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | +| MaxResults | Maximum number of tweets to return | int | no | +| MediaFields | Comma-separated list of fields to return in the media object | string (MediaField) | no | +| PaginationToken | Provide this, when paging, to get the next or previous page of results | string | no | +| PlaceFields | Comma-separated list of fields to return in the place object | string (PlaceField) | no | +| PollFields | Comma-separated list of fields to return in the poll object | string (PollField) | no | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| TweetFields | Comma-separated list of fields to return in the Tweet object | string (TweetField) | no | +| UntilID | Return tweets whose ids are less than this | string | no | +| UserFields | Comma-separated list of fields to return in the User object | string (UserField) | no | + +##### Example: + +```csharp +string userID = "15411837"; + +TweetQuery? tweetResponse = + await + (from tweet in twitterCtx.Tweets + where tweet.Type == TweetType.ReverseChronologicalTimeline && + tweet.ID == userID + select tweet) + .SingleOrDefaultAsync(); + +if (tweetResponse?.Tweets != null) + tweetResponse.Tweets.ForEach(tweet => + Console.WriteLine( + $"\nID: {tweet.ID}" + + $"\nTweet: {tweet.Text}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [users/:id/timelines/reverse_chronological](https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-reverse-chronological) \ No newline at end of file From 9461fb6338cbac9ce917e6e40248af90c775a9c3 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 16 Jul 2022 21:50:12 +0000 Subject: [PATCH 92/95] Update Tweets.md --- LINQ-to-Twitter-6/Tweets.md | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/LINQ-to-Twitter-6/Tweets.md b/LINQ-to-Twitter-6/Tweets.md index aa3305a2..e63605e5 100644 --- a/LINQ-to-Twitter-6/Tweets.md +++ b/LINQ-to-Twitter-6/Tweets.md @@ -2,39 +2,43 @@ Queries for anything you can do with a Tweet such as Lookup, Searches, and Streams. -### [Lookup](Tweets/Lookup.md) - -Get information on one or more tweets. - -### [Recent Search](Tweets/Recent-Search.md) +### [All Tweets Count](Tweets/Tweets-Count-All.md) -Search for tweets that occurred within the last week. +Get count of all tweets matching a query (academic only). ### [Filtered Stream](Tweets/Filtered-Stream.md) Read a real-time stream of tweets, based on your search criteria. Coming soon... -### [Sampled Stream](Tweets/Sampled-Stream.md) - -Read a real-time stream sampling around 1% of public tweets. Coming soon... - ### [Hide Replies](Tweets/Hide-Replies.md) Hides/Unhides replies to a tweet. +### [Lookup](Tweets/Lookup.md) + +Get information on one or more tweets. + ### [Mentions Timeline](Tweets/Mentions-Timeline.md) Read all mentions of a user. -### [Tweets Timeline](Tweets/Tweets-Timeline.md) +### [Recent Search](Tweets/Recent-Search.md) -Read all mentions of a user. +Search for tweets that occurred within the last week. ### [Recent Tweets Count](Tweets/Tweets-Count-Recent.md) Get count of tweets matching a query for the last 7 days. -### [All Tweets Count](Tweets/Tweets-Count-All.md) +### [Reverse Chronological Timeline](Tweets/Reverse-Chronological-Timeline.md) -Get count of all tweets matching a query (academic only). +Recent tweets of authorized user and those they follow. + +### [Sampled Stream](Tweets/Sampled-Stream.md) + +Read a real-time stream sampling around 1% of public tweets. Coming soon... + +### [Tweets Timeline](Tweets/Tweets-Timeline.md) + +Read all mentions of a user. From ec871d283ab6b07387f4fe1da2fa84d6572a00a7 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sat, 16 Jul 2022 21:54:14 +0000 Subject: [PATCH 93/95] Update Reverse-Chronological-Timeline.md --- LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md b/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md index e70aed74..4abf5702 100644 --- a/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md +++ b/LINQ-to-Twitter-6/Tweets/Reverse-Chronological-Timeline.md @@ -10,7 +10,7 @@ Recent tweets of authorized user and those they follow. | Name | Purpose | Type | Required | |------|---------|------|----------| -| ID | ID of the user who's timeline should be read | string | +| ID | ID of the user who's timeline should be read | string | yes | | EndTime | Date/Time to search to | DateTime | no | | Exclude | Comma-separated list of tweet types to not include ("retweets" or "replies") | string | no | | Expansions | Comma-separated list of expansion fields | string (ExpansionField) | no | From 053e3d3714c2275cc10348fa2eaff05accfe24f1 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Sun, 17 Jul 2022 23:46:18 +0000 Subject: [PATCH 94/95] Removed Help/Configuration, which is deprecated. --- LINQ-to-Twitter-5/Using-Help-Methods.md | 4 - .../Getting-Configuration-Information.md | 86 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md diff --git a/LINQ-to-Twitter-5/Using-Help-Methods.md b/LINQ-to-Twitter-5/Using-Help-Methods.md index 19468151..e2d3f402 100644 --- a/LINQ-to-Twitter-5/Using-Help-Methods.md +++ b/LINQ-to-Twitter-5/Using-Help-Methods.md @@ -2,10 +2,6 @@ This method is for testing Twitter connectivity. -#### [Getting Configuration Information](Using-Help-Methods/Getting-Configuration-Information.md) - -Pulls general configuration information such as URL lengths, system names, and photo sizes - #### [Retrieving Languages](Using-Help-Methods/Retrieving-Languages.md) Provides a list of languages supported by Twitter diff --git a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md b/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md deleted file mode 100644 index 4de22a4a..00000000 --- a/LINQ-to-Twitter-5/Using-Help-Methods/Getting-Configuration-Information.md +++ /dev/null @@ -1,86 +0,0 @@ -#### Getting Configuration Information - -Pulls general configuration information such as URL lengths, system names, and photo sizes. - -*Entity:* [Help](../LINQ-to-Twitter-Entities/Help-Entity.md) - -*Type:* HelpType.Configuration - -##### Parameters/Filters: - -None - -##### v3.0 Example: - -```c# - var helpResult = - await - (from test in twitterCtx.Help - where test.Type == HelpType.Configuration - select test) - .SingleOrDefaultAsync(); - - if (helpResult != null && - helpResult.Configuration != null && - helpResult.Configuration.NonUserNamePaths != null && - helpResult.Configuration.PhotoSizes != null) - { - Configuration cfg = helpResult.Configuration; - - Console.WriteLine("Short URL Length: " + cfg.ShortUrlLength); - Console.WriteLine("Short URL HTTPS Length: " + cfg.ShortUrlLengthHttps); - Console.WriteLine("Non-UserName Paths: "); - foreach (var name in cfg.NonUserNamePaths) - { - Console.WriteLine("\t" + name); - } - Console.WriteLine("Photo Size Limit: " + cfg.PhotoSizeLimit); - Console.WriteLine("Max Media Per Upload: " + cfg.MaxMediaPerUpload); - Console.WriteLine( - "Characters Reserved Per Media: " + cfg.CharactersReservedPerMedia); - Console.WriteLine("Photo Sizes"); - foreach (var photo in cfg.PhotoSizes) - { - Console.WriteLine("\t" + photo.Type); - Console.WriteLine("\t\t" + photo.Width); - Console.WriteLine("\t\t" + photo.Height); - Console.WriteLine("\t\t" + photo.Resize); - } - } -``` - -##### v2.1 Example: - -```c# -var helpResult = - (from test in twitterCtx.Help - where test.Type == HelpType.Configuration - select test) - .SingleOrDefault(); - -Configuration cfg = helpResult.Configuration; - -Console.WriteLine("Short URL Length: " + cfg.ShortUrlLength); -Console.WriteLine("Short URL HTTPS Length: " + cfg.ShortUrlLengthHttps); -Console.WriteLine("Non-UserName Paths: "); - -foreach (var name in cfg.NonUserNamePaths) -{ - Console.WriteLine("\t" + name); -} - -Console.WriteLine("Photo Size Limit: " + cfg.PhotoSizeLimit); -Console.WriteLine("Max Media Per Upload: " + cfg.MaxMediaPerUpload); -Console.WriteLine("Characters Reserved Per Media: " + cfg.CharactersReservedPerMedia); -Console.WriteLine("Photo Sizes"); - -foreach (var photo in cfg.PhotoSizes) -{ - Console.WriteLine("\t" + photo.Type); - Console.WriteLine("\t\t" + photo.Width); - Console.WriteLine("\t\t" + photo.Height); - Console.WriteLine("\t\t" + photo.Resize); -} -``` - -*Twitter API:* [help/configuration](https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration) \ No newline at end of file From 13e5752201a0cf4e41088b0db71d5a3ef90519e6 Mon Sep 17 00:00:00 2001 From: Joe Mayo Date: Tue, 19 Jul 2022 02:59:49 +0000 Subject: [PATCH 95/95] Documented Counts All and Counts Recent --- LINQ-to-Twitter-6/Tweets/Tweets-Count-All.md | 42 +++++++++++++++++++ .../Tweets/Tweets-Count-Recent.md | 42 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 LINQ-to-Twitter-6/Tweets/Tweets-Count-All.md create mode 100644 LINQ-to-Twitter-6/Tweets/Tweets-Count-Recent.md diff --git a/LINQ-to-Twitter-6/Tweets/Tweets-Count-All.md b/LINQ-to-Twitter-6/Tweets/Tweets-Count-All.md new file mode 100644 index 00000000..fd8c51a0 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Tweets-Count-All.md @@ -0,0 +1,42 @@ +#### Recent Search + +Get a count of tweets since Twitter started. + +*Entity:* Counts Entity + +*Type:* CountType.Recent + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| EndTime | Date/Time to search to | DateTime | no | +| Granularity | Grouping by "minute", "hour", or "day" | Granularity enum | no | +| Query | Search query | string | yes | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| UntilID | Return tweets whose ids are less than this | string | no | + +```csharp +string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo"; + +Counts? countsResponse = + await + (from count in twitterCtx.Counts + where count.Type == CountType.All && + count.Query == searchTerm && + count.Granularity == Granularity.Day + select count) + .SingleOrDefaultAsync(); + +if (countsResponse?.CountRanges != null) + countsResponse.CountRanges.ForEach(range => + Console.WriteLine( + $"\nStart: {range.Start}" + + $"\nEnd: {range.End}" + + $"\nTweet: {range.TweetCount}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [tweets/counts/all](https://developer.twitter.com/en/docs/twitter-api/tweets/counts/api-reference/get-tweets-counts-all) \ No newline at end of file diff --git a/LINQ-to-Twitter-6/Tweets/Tweets-Count-Recent.md b/LINQ-to-Twitter-6/Tweets/Tweets-Count-Recent.md new file mode 100644 index 00000000..ec42b900 --- /dev/null +++ b/LINQ-to-Twitter-6/Tweets/Tweets-Count-Recent.md @@ -0,0 +1,42 @@ +#### Recent Search + +Get a count of tweets for the last 7 days. + +*Entity:* Counts Entity + +*Type:* CountType.Recent + +##### Parameters/Filters: + +| Name | Purpose | Type | Required | +|------|---------|------|----------| +| EndTime | Date/Time to search to | DateTime | no | +| Granularity | Grouping by "minute", "hour", or "day" | Granularity enum | no | +| Query | Search query | string | yes | +| SinceID | Return tweets whose IDs are greater than this | string | no | +| StartTime | Date/Time to start search | DateTime | no | +| UntilID | Return tweets whose ids are less than this | string | no | + +```csharp +string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo"; + +Counts? countsResponse = + await + (from count in twitterCtx.Counts + where count.Type == CountType.Recent && + count.Query == searchTerm && + count.Granularity == Granularity.Day + select count) + .SingleOrDefaultAsync(); + +if (countsResponse?.CountRanges != null) + countsResponse.CountRanges.ForEach(range => + Console.WriteLine( + $"\nStart: {range.Start}" + + $"\nEnd: {range.End}" + + $"\nTweet: {range.TweetCount}")); +else + Console.WriteLine("No entries found."); +``` + +*Twitter API:* [tweets/counts/recent](https://developer.twitter.com/en/docs/twitter-api/tweets/counts/api-reference/get-tweets-counts-recent) \ No newline at end of file