Skip to content

Commit b2f668a

Browse files
committed
Various improvement of documentation of members, classes, exceptions and events.
1 parent 6035bde commit b2f668a

File tree

80 files changed

+479
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+479
-206
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# My own ignores
22
/tools/temp*
33
/tools/TweetinviAPI/lib
4+
/tools/TweetinviAPI-Symbols/lib
5+
/tools/TweetinviAspNet/lib
46
/tools/tweetinvi.certificate.p12
57
/Examplinvi.Web/App_Data
68
*.blob

Examples - Account Activity/Examplinvi.AccountActivityEvents/AccountActivityEventsManager.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void RegisterAccountActivityStream(IAccountActivityStream accountActivity
2424

2525
// Tweet events
2626
accountActivityStream.TweetCreated += TweetCreated;
27-
accountActivityStream.TweetFavourited += TweetFavourited;
27+
accountActivityStream.TweetFavorited += TweetFavorited;
2828
accountActivityStream.TweetDeleted += TweetDeleted;
2929

3030
// Message events
@@ -61,7 +61,7 @@ public void UnregisterAccountActivityStream(IAccountActivityStream accountActivi
6161

6262
// Tweet events
6363
accountActivityStream.TweetCreated -= TweetCreated;
64-
accountActivityStream.TweetFavourited -= TweetFavourited;
64+
accountActivityStream.TweetFavorited -= TweetFavorited;
6565
accountActivityStream.TweetDeleted -= TweetDeleted;
6666

6767
// Message events
@@ -97,9 +97,9 @@ private void TweetDeleted(object sender, TweetDeletedEvent e)
9797
Console.WriteLine($">>> Tweet {e.TweetId} has been deleted at {e.EventDate}");
9898
}
9999

100-
private void TweetFavourited(object sender, TweetFavouritedEvent e)
100+
private void TweetFavorited(object sender, TweetFavoritedEvent e)
101101
{
102-
Console.WriteLine($">>> Tweet has been favourited by {e.FavouritedBy}:\n{e.Tweet}");
102+
Console.WriteLine($">>> Tweet has been Favorited by {e.FavoritedBy}:\n{e.Tweet}");
103103
}
104104

105105

@@ -170,7 +170,7 @@ private void AccountActivityEvent(object sender, AccountActivityEvent args)
170170

171171
private void UnmanagedEventReceived(object sender, UnsupportedMessageReceivedEvent e)
172172
{
173-
Console.WriteLine(">>> An event that Tweetinvi is not yet capable of analyzing has been received. Please open a github issue with this message: " + e.JsonMessageReceived);
173+
Console.WriteLine(">>> An event that Tweetinvi is not yet capable of analyzing has been received. Please open a github issue with this message: " + e.Message);
174174
}
175175
}
176176
}

Tests/xUnitinvi/EndToEnd/AccountActivityStreamEndToEndTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ await userClient.Messages.PublishMessageAsync(new PublishMessageParameters("hell
109109

110110
Assert.Equal(state.TweetCreated.Count, 1);
111111
Assert.Equal(state.TweetDeleted.Count, 1);
112-
Assert.Equal(state.TweetFavourited.Count, 1);
112+
Assert.Equal(state.TweetFavorited.Count, 1);
113113

114114
Assert.Equal(state.UserFollowed.Count, 1);
115115
Assert.Equal(state.UserUnfollowed.Count, 1);
@@ -140,7 +140,7 @@ private static void RegisterEvents(IAccountActivityStream stream, AccountActivty
140140

141141
stream.TweetCreated += (sender, args) => { state.TweetCreated.Add(args); };
142142
stream.TweetDeleted += (sender, args) => { state.TweetDeleted.Add(args); };
143-
stream.TweetFavourited += (sender, args) => { state.TweetFavourited.Add(args); };
143+
stream.TweetFavorited += (sender, args) => { state.TweetFavorited.Add(args); };
144144

145145
stream.UserFollowed += (sender, args) => { state.UserFollowed.Add(args); };
146146
stream.UserUnfollowed += (sender, args) => { state.UserUnfollowed.Add(args); };
@@ -165,7 +165,7 @@ class AccountActivtyEventsState
165165
public List<string> EventsReceived { get; set; } = new List<string>();
166166
public List<TweetCreatedEvent> TweetCreated { get; set; } = new List<TweetCreatedEvent>();
167167
public List<TweetDeletedEvent> TweetDeleted { get; set; } = new List<TweetDeletedEvent>();
168-
public List<TweetFavouritedEvent> TweetFavourited { get; set; } = new List<TweetFavouritedEvent>();
168+
public List<TweetFavoritedEvent> TweetFavorited { get; set; } = new List<TweetFavoritedEvent>();
169169

170170
public List<UserFollowedEvent> UserFollowed { get; } = new List<UserFollowedEvent>();
171171
public List<UserUnfollowedEvent> UserUnfollowed { get; set; } = new List<UserUnfollowedEvent>();

Tests/xUnitinvi/Streams/AccountActivityStreamTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,27 @@ public void FavouriteTweetRaised()
8888
{
8989
var activityStream = CreateAccountActivityStream();
9090

91-
var tweetFavouritedJson = @"{
91+
var tweetFavoritedJson = @"{
9292
""for_user_id"": ""100"",
9393
""favorite_events"": [{
9494
""favorited_status"" : " + JsonTests.TWEET_TEST_JSON + @",
9595
""user"": " + JsonTests.USER_TEST_JSON(4242) + @"
9696
}]
9797
}";
9898

99-
var eventsReceived = new List<TweetFavouritedEvent>();
100-
activityStream.TweetFavourited += (sender, args) =>
99+
var eventsReceived = new List<TweetFavoritedEvent>();
100+
activityStream.TweetFavorited += (sender, args) =>
101101
{
102102
eventsReceived.Add(args);
103103
};
104104

105105
// Act
106-
activityStream.WebhookMessageReceived(new WebhookMessage(tweetFavouritedJson));
106+
activityStream.WebhookMessageReceived(new WebhookMessage(tweetFavoritedJson));
107107

108108
// Assert
109109
Assert.Equal(eventsReceived.Count, 1);
110110
Assert.Equal(eventsReceived[0].Tweet.CreatedBy.Id, 42);
111-
Assert.Equal(eventsReceived[0].FavouritedBy.Id, 4242);
111+
Assert.Equal(eventsReceived[0].FavoritedBy.Id, 4242);
112112
}
113113

114114
[Fact]

Tests/xUnitinvi/Streams/FilteredStreamTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace xUnitinvi.Streams
1414
{
1515
public class FilteredStreamTests
1616
{
17-
private Tuple<IFilteredStream, Func<Action<string>>> InitForCatchingJsonEvents()
17+
private static Tuple<IFilteredStream, Func<Action<string>>> InitForCatchingJsonEvents()
1818
{
1919
// arrange
2020
var fakeStreamResultGenerator = A.Fake<IStreamResultGenerator>();

Tests/xUnitinvi/TestHelpers/TwitterAccessorSpy.cs

-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public Task<ITwitterResult<T>> ExecuteRequestAsync<T>(ITwitterRequest request) w
3131
return FakedObject.ExecuteRequestAsync<T>(request);
3232
}
3333

34-
public Task<byte[]> DownloadBinaryAsync(ITwitterRequest request)
35-
{
36-
throw new NotImplementedException();
37-
}
38-
3934
public Task PrepareTwitterRequestAsync(ITwitterRequest request)
4035
{
4136
throw new NotImplementedException();

src/Tweetinvi.Core/Core/Iterators/TwitterIteratorProxy.cs

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
24
using System.Threading.Tasks;
35
using Tweetinvi.Iterators;
46

@@ -22,6 +24,12 @@ public TwitterIteratorProxy(ITwitterPageIterator<TInput, TCursor> source, Func<T
2224
_transform = transform;
2325
}
2426

27+
public TwitterIteratorProxy(ITwitterPageIterator<TInput, TCursor> source, Func<TInput, IEnumerable<TOutput>> transform)
28+
{
29+
_source = source;
30+
_transform = input => transform(input).ToArray();
31+
}
32+
2533
public TCursor NextCursor { get; private set; }
2634
public bool Completed { get; private set; }
2735

src/Tweetinvi.Core/Core/Models/User.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public Task<Stream> GetProfileImageStreamAsync()
243243

244244
public Task<Stream> GetProfileImageStreamAsync(ImageSize imageSize)
245245
{
246-
return Client.Users.GetProfileImageStream(new GetProfileImageParameters(this)
246+
return Client.Users.GetProfileImageStreamAsync(new GetProfileImageParameters(this)
247247
{
248248
ImageSize = imageSize
249249
});

src/Tweetinvi.Core/Public/Client/Clients/IUsersClient.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -526,19 +526,19 @@ public interface IUsersClient
526526
#region Profile Image
527527

528528
/// <inheritdoc cref="IUsersClient.GetProfileImageStreamAsync(IGetProfileImageParameters)" />
529-
Task<System.IO.Stream> GetProfileImageStream(string url);
529+
Task<System.IO.Stream> GetProfileImageStreamAsync(string url);
530530

531531
/// <inheritdoc cref="IUsersClient.GetProfileImageStreamAsync(IGetProfileImageParameters)" />
532-
Task<System.IO.Stream> GetProfileImageStream(IUser user);
532+
Task<System.IO.Stream> GetProfileImageStreamAsync(IUser user);
533533

534534
/// <inheritdoc cref="IUsersClient.GetProfileImageStreamAsync(IGetProfileImageParameters)" />
535-
Task<System.IO.Stream> GetProfileImageStream(IUserDTO user);
535+
Task<System.IO.Stream> GetProfileImageStreamAsync(IUserDTO user);
536536

537537
/// <summary>
538538
/// Get the profile image of a user
539539
/// </summary>
540540
/// <returns>A stream of the image file</returns>
541-
Task<System.IO.Stream> GetProfileImageStream(IGetProfileImageParameters parameters);
541+
Task<System.IO.Stream> GetProfileImageStreamAsync(IGetProfileImageParameters parameters);
542542

543543
#endregion
544544

src/Tweetinvi.Core/Public/Client/IRawExecutors.cs

+44-1
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,59 @@ namespace Tweetinvi.Client
44
{
55
public interface IRawExecutors
66
{
7+
/// <summary>
8+
/// Client to execute all the actions related with webhooks
9+
/// </summary>
710
IAccountActivityRequester AccountActivity { get; }
11+
12+
/// <summary>
13+
/// Client to execute all actions related with the account associated with the clients' credentials
14+
/// </summary>
815
IAccountSettingsRequester AccountSettings { get; }
16+
17+
/// <summary>
18+
/// Client to execute all actions related with authentication
19+
/// </summary>
920
IAuthRequester Auth { get; }
21+
22+
/// <summary>
23+
/// Client to execute all actions from the help path
24+
/// </summary>
1025
IHelpRequester Help { get; }
26+
27+
/// <summary>
28+
/// Client to execute all actions related with twitter lists
29+
/// </summary>
30+
ITwitterListsRequester Lists { get; }
31+
32+
/// <summary>
33+
/// Client to execute all actions related with search
34+
/// </summary>
1135
ISearchRequester Search { get; }
36+
37+
/// <summary>
38+
/// Client to execute all actions related with timelines
39+
/// </summary>
1240
ITimelinesRequester Timelines { get; }
41+
42+
/// <summary>
43+
/// Client to execute all actions related with trends
44+
/// </summary>
1345
ITrendsRequester Trends { get; }
46+
47+
/// <summary>
48+
/// Client to execute all actions related with tweets
49+
/// </summary>
1450
ITweetsRequester Tweets { get; }
15-
ITwitterListsRequester Lists { get; }
51+
52+
/// <summary>
53+
/// Client to execute all actions related with media upload
54+
/// </summary>
1655
IUploadRequester Upload { get; }
56+
57+
/// <summary>
58+
/// Client to execute all actions related with users
59+
/// </summary>
1760
IUsersRequester Users { get; }
1861
}
1962
}

src/Tweetinvi.Core/Public/Client/Requesters/IExecuteRequester.cs

+18
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@ namespace Tweetinvi.Client.Requesters
77
{
88
public interface IExecuteRequester
99
{
10+
/// <summary>
11+
/// Execute a custom request
12+
/// </summary>
13+
/// <returns>The raw response from twitter with the json parsed into a Data Transfer Object</returns>
1014
Task<ITwitterResult<T>> RequestAsync<T>(Action<ITwitterRequest> configureRequest) where T : class;
15+
16+
/// <summary>
17+
/// Execute a custom request
18+
/// </summary>
19+
/// <returns>The raw response from Twitter</returns>
1120
Task<ITwitterResult> RequestAsync(Action<ITwitterRequest> configureRequest);
1221

22+
/// <summary>
23+
/// Execute a custom query
24+
/// </summary>
25+
/// <returns>The raw response from twitter with the json parsed into a Data Transfer Object</returns>
1326
Task<ITwitterResult<T>> RequestAsync<T>(Action<ITwitterQuery> configureQuery) where T : class;
27+
28+
/// <summary>
29+
/// Execute a custom query
30+
/// </summary>
31+
/// <returns>The raw response from Twitter</returns>
1432
Task<ITwitterResult> RequestAsync(Action<ITwitterQuery> configureQuery);
1533

1634
Task<ITwitterRequest> PrepareTwitterRequestAsync(Action<ITwitterQuery> configureQuery);

src/Tweetinvi.Core/Public/Client/Requesters/IHelpRequester.cs

+22
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,32 @@ public interface IHelpRequester
2424
/// <returns>Twitter response containing the official configuration</returns>
2525
Task<ITwitterResult<ITwitterConfiguration>> GetTwitterConfigurationAsync(IGetTwitterConfigurationParameters parameters);
2626

27+
/// <summary>
28+
/// Get Twitter supported languages
29+
/// </summary>
30+
/// <para> https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages </para>
31+
/// <returns>Twitter result containing the supported languages</returns>
2732
Task<ITwitterResult<SupportedLanguage[]>> GetSupportedLanguagesAsync(IGetSupportedLanguagesParameters parameters);
2833

34+
/// <summary>
35+
/// Get a place information from place identifier.
36+
/// </summary>
37+
/// <para> https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id </para>
38+
/// <returns>Twitter result containing the requested Place</returns>
2939
Task<ITwitterResult<IPlace>> GetPlaceAsync(IGetPlaceParameters parameters);
40+
41+
/// <summary>
42+
/// Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name.
43+
/// </summary>
44+
/// <para> https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search </para>
45+
/// <returns>Twitter result containing the places matching search</returns>
3046
Task<ITwitterResult<SearchGeoSearchResultDTO>> SearchGeoAsync(IGeoSearchParameters parameters);
47+
48+
/// <summary>
49+
/// Given a latitude and a longitude, searches for up to 20 places.
50+
/// </summary>
51+
/// <para> https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode </para>
52+
/// <returns>Twitter result containing the matching the search</returns>
3153
Task<ITwitterResult<SearchGeoSearchResultDTO>> SearchGeoReverseAsync(IGeoSearchReverseParameters parameters);
3254
}
3355
}

src/Tweetinvi.Core/Public/Client/Requesters/ITrendsRequester.cs

+17
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,25 @@ namespace Tweetinvi.Client.Requesters
77
{
88
public interface ITrendsRequester
99
{
10+
/// <summary>
11+
/// Returns the top 50 trending topics for a specific WOEID
12+
/// </summary>
13+
/// <para>Read more : https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place </para>
14+
/// <returns>Twitter result containing the place trends</returns>
1015
Task<ITwitterResult<IGetTrendsAtResult[]>> GetPlaceTrendsAtAsync(IGetTrendsAtParameters parameters);
16+
17+
/// <summary>
18+
/// Returns the locations that Twitter has trending topic information for.
19+
/// </summary>
20+
/// <para>Read more : https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available </para>
21+
/// <returns>Twitter result containing the trending locations</returns>
1122
Task<ITwitterResult<ITrendLocation[]>> GetTrendLocationsAsync(IGetTrendsLocationParameters parameters);
23+
24+
/// <summary>
25+
/// Returns the locations that Twitter has trending topic information for, closest to a specified location.
26+
/// </summary>
27+
/// <para>Read more : https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest </para>
28+
/// <returns>Twitter result containing the trending locations</returns>
1229
Task<ITwitterResult<ITrendLocation[]>> GetTrendsLocationCloseToAsync(IGetTrendsLocationCloseToParameters parameters);
1330
}
1431
}

src/Tweetinvi.Core/Public/Client/Requesters/ITwitterListsRequester.cs

-1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,5 @@ public interface ITwitterListsRequester
149149
/// </summary>
150150
/// <returns>An iterator to get through the tweets of a list</returns>
151151
ITwitterPageIterator<ITwitterResult<ITweetDTO[]>, long?> GetTweetsFromListIterator(IGetTweetsFromListParameters parameters);
152-
153152
}
154153
}

0 commit comments

Comments
 (0)