-
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.
- Loading branch information
Showing
101 changed files
with
1,812 additions
and
670 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
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
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,63 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{620D3DB5-5636-4A54-A7D7-600C6518C20E}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>InstaSharper.Examples</RootNamespace> | ||
<AssemblyName>InstaSharper.Examples</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="InstaSharper"> | ||
<HintPath>..\InstaSharper\bin\Debug\net452\InstaSharper.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="InstaSharperExamples.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstaSharper.Examples", "InstaSharper.Examples.csproj", "{620D3DB5-5636-4A54-A7D7-600C6518C20E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
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,64 @@ | ||
using System; | ||
using System.Linq; | ||
using InstaSharper.API; | ||
using InstaSharper.API.Builder; | ||
using InstaSharper.Classes; | ||
|
||
namespace InstaSharper.Examples | ||
{ | ||
internal class InstaSharperExamples | ||
{ | ||
private static IInstaApi _instaApi; | ||
|
||
private static void Main(string[] args) | ||
{ | ||
// create user session data and provide login details | ||
var userSession = new UserSessionData | ||
{ | ||
UserName = "username", | ||
Password = "password" | ||
}; | ||
// create new InstaApi instance using Builder | ||
_instaApi = new InstaApiBuilder() | ||
.SetUser(userSession) | ||
.Build(); | ||
// login | ||
var logInResult = _instaApi.Login(); | ||
if (!logInResult.Succeeded) { Console.WriteLine($"Unable to login: {logInResult.Message}"); } | ||
else | ||
{ | ||
// get currently logged in user | ||
var currentUser = _instaApi.GetCurrentUser().Value; | ||
Console.WriteLine($"Logged in: username - {currentUser.UserName}, full name - {currentUser.FullName}"); | ||
// get followers | ||
var followers = _instaApi.GetUserFollowersAsync(currentUser.UserName, 5).Result.Value; | ||
Console.WriteLine($"Count of followers [{currentUser.UserName}]:{followers.Count}"); | ||
// get user's media | ||
var currentUserMedia = _instaApi.GetUserMedia(currentUser.UserName, 5); | ||
if (currentUserMedia.Succeeded) | ||
{ | ||
Console.WriteLine($"Media count [{currentUser.UserName}]: {currentUserMedia.Value.Count}"); | ||
foreach (var media in currentUserMedia.Value) Console.WriteLine($"Media [{currentUser.UserName}]: {media.Caption.Text}, {media.Code}, likes: {media.LikesCount}, image link: {media.Images.LastOrDefault()?.Url}"); | ||
} | ||
|
||
//get user feed, first 5 pages | ||
var userFeed = _instaApi.GetUserFeed(5); | ||
if (userFeed.Succeeded) | ||
{ | ||
Console.WriteLine($"Feed items (in {userFeed.Value.Pages} pages) [{currentUser.UserName}]: {userFeed.Value.Items.Count}"); | ||
foreach (var media in userFeed.Value.Items) Console.WriteLine($"Feed item - code:{media.Code}, likes: {media.LikesCount}"); | ||
} | ||
// get tag feed, first 5 pages | ||
var tagFeed = _instaApi.GetTagFeed("gm", 5); | ||
if (userFeed.Succeeded) | ||
{ | ||
Console.WriteLine($"Tag feed items (in {tagFeed.Value.Pages} pages) [{currentUser.UserName}]: {tagFeed.Value.Count}"); | ||
foreach (var media in tagFeed.Value) Console.WriteLine($"Tag feed item - code: {media.Code}, likes: {media.LikesCount}"); | ||
} | ||
var logoutResult = _instaApi.Logout(); | ||
if (logoutResult.Value) Console.WriteLine("Logout succeed"); | ||
} | ||
Console.ReadKey(); | ||
} | ||
} | ||
} |
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,39 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
|
||
[assembly: AssemblyTitle("InstaSharper.Examples")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("InstaSharper.Examples")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
|
||
[assembly: Guid("620d3db5-5636-4a54-a7d7-600c6518c20e")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.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
5 changes: 4 additions & 1 deletion
5
...agramAPI.Tests/Properties/AssemblyInfo.cs → ...aSharper.Tests/Properties/AssemblyInfo.cs
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
7 changes: 4 additions & 3 deletions
7
...API.Tests/Tests/ApiInstanceBuilderTest.cs → ...per.Tests/Tests/ApiInstanceBuilderTest.cs
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
39 changes: 17 additions & 22 deletions
39
InstagramAPI.Tests/Tests/LoginTest.cs → InstaSharper.Tests/Tests/AuthTest.cs
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,40 @@ | ||
using System; | ||
using InstaSharper.Classes; | ||
using InstaSharper.Tests.Utils; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace InstaSharper.Tests.Tests | ||
{ | ||
[Collection("InstaSharper Tests")] | ||
public class DiscoverTest | ||
{ | ||
public DiscoverTest(ITestOutputHelper output) | ||
{ | ||
_output = output; | ||
} | ||
|
||
private readonly ITestOutputHelper _output; | ||
private readonly string _username = "alex_codegarage"; | ||
private readonly string _password = Environment.GetEnvironmentVariable("instaapiuserpassword"); | ||
|
||
[Fact] | ||
public async void ExploreTest() | ||
{ | ||
//arrange | ||
var apiInstance = | ||
TestHelpers.GetDefaultInstaApiInstance(new UserSessionData | ||
{ | ||
UserName = _username, | ||
Password = _password | ||
}); | ||
//act | ||
if (!TestHelpers.Login(apiInstance, _output)) return; | ||
var result = await apiInstance.GetExploreFeedAsync(0); | ||
var exploreGeed = result.Value; | ||
//assert | ||
Assert.True(result.Succeeded); | ||
Assert.NotNull(exploreGeed); | ||
} | ||
} | ||
} |
Oops, something went wrong.