-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* myget pre-release packages * standart 2.0 + package updates * Remove fallback version * Send direct message implementation (#74) * Send direct message * GetMediaCommentsAsync failed when caption is null * send message improvements * #75 get friendship status * travis ci, dotnet 2.0 * Removed framework version from travis * netstandard2.0 * Improved user info part of API * Access modifiers and general code refactoring * readme update * Adjusted explore feed (no pagination) * Clean up * Code inspection corrections * Added a better logging mechanism to reach more details. (#78) * Added a better loging mechanism with more details. * Linked to previous changes. * Update appveyor.yml * Adjusted logger * More corrections to logger * GetTagFeedAsync»InstaMedia»InstaUserShort should be InstaUser (#80) From log: api is proving whole fields of InstaUser * Explore feed add pagination * Add user story feed * Get story feed corrected * Save session data implemented * Change state saving to return stream * Added GetUserMediaAsync by user pk method. (#82) * GetTagFeedAsync»InstaMedia»InstaUserShort should be InstaUser From log: api is proving whole fields of InstaUser * Make InstaApi instantiable. * get user media by pk. * Update InstaApiBuilder.cs * Revert "Added GetUserMediaAsync by user pk method. (#82)" This reverts commit d138c93. * Added recent and ranked recipients * Added massaging demo sample
- Loading branch information
Showing
237 changed files
with
2,748 additions
and
1,068 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
language: csharp | ||
dist: trusty | ||
dotnet: 1.0.1 | ||
language: csharp | ||
mono: none | ||
dotnet: 2.0.0 | ||
solution: InstaSharper.sln | ||
|
||
script: | ||
- cd InstaSharper | ||
- dotnet --info | ||
- dotnet restore | ||
- dotnet build --framework netstandard1.6 | ||
- dotnet build --framework netstandard2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace InstaSharper.Examples.Samples | ||
{ | ||
internal interface IDemoSample | ||
{ | ||
Task DoShow(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using InstaSharper.API; | ||
|
||
namespace InstaSharper.Examples.Samples | ||
{ | ||
internal class Messaging : IDemoSample | ||
{ | ||
private readonly IInstaApi _instaApi; | ||
|
||
public Messaging(IInstaApi instaApi) | ||
{ | ||
_instaApi = instaApi; | ||
} | ||
|
||
public async Task DoShow() | ||
{ | ||
var recipientsResult = await _instaApi.GetRankedRecipientsAsync(); | ||
if (!recipientsResult.Succeeded) | ||
{ | ||
Console.WriteLine("Unable to get ranked recipients"); | ||
return; | ||
} | ||
Console.WriteLine($"Got {recipientsResult.Value.Items.Count} ranked threads"); | ||
foreach (var thread in recipientsResult.Value.Items) | ||
Console.WriteLine($"Threadname: {thread.ThreadTitle}, users: {thread.Users.Count}"); | ||
|
||
var inboxThreads = await _instaApi.GetDirectInboxAsync(); | ||
if (!inboxThreads.Succeeded) | ||
{ | ||
Console.WriteLine("Unable to get inbox"); | ||
return; | ||
} | ||
Console.WriteLine($"Got {inboxThreads.Value.Inbox.Threads.Count} inbox threads"); | ||
foreach (var thread in inboxThreads.Value.Inbox.Threads) | ||
Console.WriteLine($"Threadname: {thread.Title}, users: {thread.Users.Count}"); | ||
var firstThread = inboxThreads.Value.Inbox.Threads.FirstOrDefault(); | ||
var sendMessageResult = await _instaApi.SendDirectMessage($"{firstThread.Users.FirstOrDefault()?.Pk}", | ||
firstThread.ThreadId, "test"); | ||
Console.WriteLine(sendMessageResult.Succeeded ? "Message sent" : "Unable to send message"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using InstaSharper.API; | ||
using InstaSharper.API.Builder; | ||
|
||
namespace InstaSharper.Examples.Samples | ||
{ | ||
internal class SaveLoadState : IDemoSample | ||
{ | ||
private readonly IInstaApi _instaApi; | ||
|
||
public SaveLoadState(IInstaApi instaApi) | ||
{ | ||
_instaApi = instaApi; | ||
} | ||
|
||
public async Task DoShow() | ||
{ | ||
var result = await _instaApi.GetCurrentUserAsync(); | ||
if (!result.Succeeded) | ||
{ | ||
Console.WriteLine($"Unable to get current user using current API instance: {result.Info}"); | ||
return; | ||
} | ||
Console.WriteLine($"Got current user: {result.Value.UserName} using existing API instance"); | ||
var stream = _instaApi.GetStateDataAsStream(); | ||
var anotherInstance = InstaApiBuilder.CreateBuilder() | ||
.SetRequestDelay(TimeSpan.FromSeconds(2)) | ||
.Build(); | ||
anotherInstance.LoadStateDataFromStream(stream); | ||
var anotherResult = await anotherInstance.GetCurrentUserAsync(); | ||
if (!anotherResult.Succeeded) | ||
{ | ||
Console.WriteLine($"Unable to get current user using current API instance: {result.Info}"); | ||
return; | ||
} | ||
Console.WriteLine( | ||
$"Got current user: {anotherResult.Value.UserName} using new API instance without re-login"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using InstaSharper.API; | ||
|
||
namespace InstaSharper.Examples.Samples | ||
{ | ||
internal class Stories : IDemoSample | ||
{ | ||
private readonly IInstaApi _instaApi; | ||
|
||
public Stories(IInstaApi instaApi) | ||
{ | ||
_instaApi = instaApi; | ||
} | ||
|
||
public async Task DoShow() | ||
{ | ||
var result = await _instaApi.GetStoryFeedAsync(); | ||
if (!result.Succeeded) | ||
{ | ||
Console.WriteLine($"Unable to get story feed: {result.Info}"); | ||
return; | ||
} | ||
var storyFeed = result.Value; | ||
Console.WriteLine($"Got {storyFeed.Items.Count} story reels."); | ||
foreach (var feedItem in storyFeed.Items) | ||
{ | ||
Console.WriteLine($"User: {feedItem.User.FullName}"); | ||
foreach (var item in feedItem.Items) | ||
Console.WriteLine( | ||
$"Story item: {item.Caption?.Text ?? item.Code}, images:{item.ImageList?.Count ?? 0}, videos: {item.VideoList?.Count ?? 0}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.