diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cee0cb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,199 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates +*.DotSettings +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +**/.settings +NDependOut +*.ndproj +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studo 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.[Cc]ache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/NetrunnerDb.Net.sln b/NetrunnerDb.Net.sln new file mode 100644 index 0000000..9f2e8ac --- /dev/null +++ b/NetrunnerDb.Net.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net", "src\NetrunnerDb.Net\NetrunnerDb.Net.csproj", "{1B508DCB-3207-4597-B938-9218D32A41A4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetrunnerDb.Net.Tests", "src\NetrunnerDb.Net.Tests\NetrunnerDb.Net.Tests.csproj", "{60115585-7F0E-438F-BC86-CCA9D6575062}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1B508DCB-3207-4597-B938-9218D32A41A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B508DCB-3207-4597-B938-9218D32A41A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B508DCB-3207-4597-B938-9218D32A41A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B508DCB-3207-4597-B938-9218D32A41A4}.Release|Any CPU.Build.0 = Release|Any CPU + {60115585-7F0E-438F-BC86-CCA9D6575062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60115585-7F0E-438F-BC86-CCA9D6575062}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60115585-7F0E-438F-BC86-CCA9D6575062}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..3639dc0 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +## What is this? + +A simple API wrapper over the netrunner db. Still a WIP diff --git a/src/NetrunnerDb.Net.Tests/Class1.cs b/src/NetrunnerDb.Net.Tests/Class1.cs new file mode 100644 index 0000000..342572e --- /dev/null +++ b/src/NetrunnerDb.Net.Tests/Class1.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace NetrunnerDb.Net.Tests +{ + [TestFixture] + public class Class1 + { + [Test] + [Ignore] + public void Tst() + { + var cool = new Repository().GetRequest("tsb"); + } + } +} diff --git a/src/NetrunnerDb.Net.Tests/NetrunnerDb.Net.Tests.csproj b/src/NetrunnerDb.Net.Tests/NetrunnerDb.Net.Tests.csproj new file mode 100644 index 0000000..8787ccb --- /dev/null +++ b/src/NetrunnerDb.Net.Tests/NetrunnerDb.Net.Tests.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {60115585-7F0E-438F-BC86-CCA9D6575062} + Library + Properties + NetrunnerDb.Net.Tests + NetrunnerDb.Net.Tests + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll + False + + + ..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll + False + + + False + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + ..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll + False + + + ..\..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll + False + + + + + + + + + + + + + + + + + + + {1b508dcb-3207-4597-b938-9218d32a41a4} + NetrunnerDb.Net + + + + + \ No newline at end of file diff --git a/src/NetrunnerDb.Net.Tests/Properties/AssemblyInfo.cs b/src/NetrunnerDb.Net.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7a39f67 --- /dev/null +++ b/src/NetrunnerDb.Net.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("NetrunnerDb.Net.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("NetrunnerDb.Net.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] +[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("adcc42b0-2006-4037-87f8-d0cc4fd3104c")] + +// 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")] diff --git a/src/NetrunnerDb.Net.Tests/packages.config b/src/NetrunnerDb.Net.Tests/packages.config new file mode 100644 index 0000000..1f8800b --- /dev/null +++ b/src/NetrunnerDb.Net.Tests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/NetrunnerDb.Net/NetrunnerDb.Net.csproj b/src/NetrunnerDb.Net/NetrunnerDb.Net.csproj new file mode 100644 index 0000000..c8fe785 --- /dev/null +++ b/src/NetrunnerDb.Net/NetrunnerDb.Net.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {1B508DCB-3207-4597-B938-9218D32A41A4} + Library + Properties + NetrunnerDb.Net + NetrunnerDb.Net + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + False + ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/NetrunnerDb.Net/NetrunnerDb.Net.nuspec b/src/NetrunnerDb.Net/NetrunnerDb.Net.nuspec new file mode 100644 index 0000000..f6abdb5 --- /dev/null +++ b/src/NetrunnerDb.Net/NetrunnerDb.Net.nuspec @@ -0,0 +1,16 @@ + + + + $id$ + $version$ + $title$ + $author$ + $author$ + https://github.com/tparnell8/NetrunnerDb.Net + false + $description$ + Basic NetrunnerDb Wrapper + Copyright 2015 + Netrunner + + diff --git a/src/NetrunnerDb.Net/Properties/AssemblyInfo.cs b/src/NetrunnerDb.Net/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5cb712b --- /dev/null +++ b/src/NetrunnerDb.Net/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("NetrunnerDb.Net")] +[assembly: AssemblyDescription("C# NetrunnerDb API Wrapper")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Tommy Parnell")] +[assembly: AssemblyProduct("NetrunnerDb.Net")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] +[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("a0b3379d-894a-4ded-9c77-17a349b4668b")] + +// 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")] +[assembly: InternalsVisibleTo("NetrunnerDb.Net.Tests")] \ No newline at end of file diff --git a/src/NetrunnerDb.Net/Repository.cs b/src/NetrunnerDb.Net/Repository.cs new file mode 100644 index 0000000..8498ecb --- /dev/null +++ b/src/NetrunnerDb.Net/Repository.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using RestSharp; + +namespace NetrunnerDb.Net +{ + public class Repository + { + public IList GetRequest(string param) + where TResult : class, IRequest, new() + { + var s = new TResult(); + var request = new RestRequest(){ + Resource = s.EndPoint(param)}; + var client = new RestClient("http://netrunnerdb.com"); + var response = client.Execute(request); + + return JsonConvert.DeserializeObject>(response.Content); + } + } +} diff --git a/src/NetrunnerDb.Net/Responses/Cards.cs b/src/NetrunnerDb.Net/Responses/Cards.cs new file mode 100644 index 0000000..573e390 --- /dev/null +++ b/src/NetrunnerDb.Net/Responses/Cards.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace NetrunnerDb.Net +{ + public class Cards : IRequest + { + + [JsonProperty("last-modified")] + public DateTime LastModified { get; set; } + + [JsonProperty("code")] + public string Code { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("type_code")] + public string TypeCode { get; set; } + + [JsonProperty("subtype")] + public string Subtype { get; set; } + + [JsonProperty("subtype_code")] + public string SubtypeCode { get; set; } + + [JsonProperty("text")] + public string Text { get; set; } + + [JsonProperty("baselink")] + public int Baselink { get; set; } + + [JsonProperty("faction")] + public string Faction { get; set; } + + [JsonProperty("faction_code")] + public string FactionCode { get; set; } + + [JsonProperty("faction_letter")] + public string FactionLetter { get; set; } + + [JsonProperty("flavor")] + public string Flavor { get; set; } + + [JsonProperty("illustrator")] + public string Illustrator { get; set; } + + [JsonProperty("influencelimit")] + public int Influencelimit { get; set; } + + [JsonProperty("minimumdecksize")] + public int Minimumdecksize { get; set; } + + [JsonProperty("number")] + public int Number { get; set; } + + [JsonProperty("quantity")] + public int Quantity { get; set; } + + [JsonProperty("setname")] + public string Setname { get; set; } + + [JsonProperty("set_code")] + public string SetCode { get; set; } + + [JsonProperty("side")] + public string Side { get; set; } + + [JsonProperty("side_code")] + public string SideCode { get; set; } + + [JsonProperty("uniqueness")] + public bool Uniqueness { get; set; } + + [JsonProperty("limited")] + public bool Limited { get; set; } + + [JsonProperty("cyclenumber")] + public int Cyclenumber { get; set; } + + [JsonProperty("ancurLink")] + public string AncurLink { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + [JsonProperty("imagesrc")] + public string Imagesrc { get; set; } + + [JsonProperty("cost")] + public int? Cost { get; set; } + + [JsonProperty("factioncost")] + public int? Factioncost { get; set; } + + [JsonProperty("memoryunits")] + public int? Memoryunits { get; set; } + + [JsonProperty("strength")] + public int? Strength { get; set; } + + [JsonProperty("advancementcost")] + public int? Advancementcost { get; set; } + + [JsonProperty("agendapoints")] + public int? Agendapoints { get; set; } + + [JsonProperty("trash")] + public int? Trash { get; set; } + + public string EndPoint(string parameter = "") + { + return "/api/cards/"; + } + } + +} diff --git a/src/NetrunnerDb.Net/Responses/IRequest.cs b/src/NetrunnerDb.Net/Responses/IRequest.cs new file mode 100644 index 0000000..97ff14f --- /dev/null +++ b/src/NetrunnerDb.Net/Responses/IRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NetrunnerDb.Net +{ + public interface IRequest + { + string EndPoint(string parameter = ""); + } +} diff --git a/src/NetrunnerDb.Net/Responses/Set.cs b/src/NetrunnerDb.Net/Responses/Set.cs new file mode 100644 index 0000000..559d740 --- /dev/null +++ b/src/NetrunnerDb.Net/Responses/Set.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace NetrunnerDb.Net +{ + public class Set : IRequest + { + + [JsonProperty("last-modified")] + public DateTime LastModified { get; set; } + + [JsonProperty("code")] + public string Code { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("type_code")] + public string TypeCode { get; set; } + + [JsonProperty("subtype")] + public string Subtype { get; set; } + + [JsonProperty("subtype_code")] + public string SubtypeCode { get; set; } + + [JsonProperty("text")] + public string Text { get; set; } + + [JsonProperty("cost")] + public int Cost { get; set; } + + [JsonProperty("faction")] + public string Faction { get; set; } + + [JsonProperty("faction_code")] + public string FactionCode { get; set; } + + [JsonProperty("faction_letter")] + public string FactionLetter { get; set; } + + [JsonProperty("factioncost")] + public int Factioncost { get; set; } + + [JsonProperty("flavor")] + public string Flavor { get; set; } + + [JsonProperty("illustrator")] + public string Illustrator { get; set; } + + [JsonProperty("number")] + public int Number { get; set; } + + [JsonProperty("quantity")] + public int Quantity { get; set; } + + [JsonProperty("setname")] + public string Setname { get; set; } + + [JsonProperty("set_code")] + public string SetCode { get; set; } + + [JsonProperty("side")] + public string Side { get; set; } + + [JsonProperty("side_code")] + public string SideCode { get; set; } + + [JsonProperty("uniqueness")] + public bool Uniqueness { get; set; } + + [JsonProperty("limited")] + public bool Limited { get; set; } + + [JsonProperty("cyclenumber")] + public int Cyclenumber { get; set; } + + [JsonProperty("ancurLink")] + public string AncurLink { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + [JsonProperty("imagesrc")] + public string Imagesrc { get; set; } + + [JsonProperty("influencelimit")] + public int? Influencelimit { get; set; } + + [JsonProperty("minimumdecksize")] + public int? Minimumdecksize { get; set; } + + [JsonProperty("advancementcost")] + public int? Advancementcost { get; set; } + + [JsonProperty("agendapoints")] + public int? Agendapoints { get; set; } + + [JsonProperty("trash")] + public int? Trash { get; set; } + + public string EndPoint(string parameter = "") + { + return string.Format("/api/set/{0}", parameter); + } + } +} diff --git a/src/NetrunnerDb.Net/Responses/Sets.cs b/src/NetrunnerDb.Net/Responses/Sets.cs new file mode 100644 index 0000000..1279928 --- /dev/null +++ b/src/NetrunnerDb.Net/Responses/Sets.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace NetrunnerDb.Net +{ + public class Sets : IRequest + { + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("code")] + public string Code { get; set; } + + [JsonProperty("number")] + public int Number { get; set; } + + [JsonProperty("cyclenumber")] + public int Cyclenumber { get; set; } + + [JsonProperty("available")] + public string Available { get; set; } + + [JsonProperty("known")] + public int Known { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + public string EndPoint(string parameter = "") + { + return "/api/sets/"; + } + } +} diff --git a/src/NetrunnerDb.Net/packages.config b/src/NetrunnerDb.Net/packages.config new file mode 100644 index 0000000..b305872 --- /dev/null +++ b/src/NetrunnerDb.Net/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file