Skip to content

Commit 69dae4b

Browse files
author
stottp
committed
first commit
0 parents  commit 69dae4b

File tree

243 files changed

+8422
-0
lines changed

Some content is hidden

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

243 files changed

+8422
-0
lines changed

README.md

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api-ng-sample-code", "Api-ng-sample-code\Api-ng-sample-code.csproj", "{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|x86 = Debug|x86
9+
Release|x86 = Release|x86
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}.Debug|x86.ActiveCfg = Debug|x86
13+
{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}.Debug|x86.Build.0 = Debug|x86
14+
{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}.Release|x86.ActiveCfg = Release|x86
15+
{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}.Release|x86.Build.0 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{6B5844C4-BBF3-43D9-9B58-6AEA1FC6E548}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Api_ng_sample_code</RootNamespace>
12+
<AssemblyName>Api-ng-sample-code</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
15+
<FileAlignment>512</FileAlignment>
16+
<PublishUrl>publish\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>false</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<ApplicationRevision>0</ApplicationRevision>
27+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
28+
<IsWebBootstrapper>false</IsWebBootstrapper>
29+
<UseApplicationTrust>false</UseApplicationTrust>
30+
<BootstrapperEnabled>true</BootstrapperEnabled>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
33+
<PlatformTarget>x86</PlatformTarget>
34+
<DebugSymbols>true</DebugSymbols>
35+
<DebugType>full</DebugType>
36+
<Optimize>false</Optimize>
37+
<OutputPath>bin\Debug\</OutputPath>
38+
<DefineConstants>DEBUG;TRACE</DefineConstants>
39+
<ErrorReport>prompt</ErrorReport>
40+
<WarningLevel>4</WarningLevel>
41+
</PropertyGroup>
42+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
43+
<PlatformTarget>x86</PlatformTarget>
44+
<DebugType>pdbonly</DebugType>
45+
<Optimize>true</Optimize>
46+
<OutputPath>bin\Release\</OutputPath>
47+
<DefineConstants>TRACE</DefineConstants>
48+
<ErrorReport>prompt</ErrorReport>
49+
<WarningLevel>4</WarningLevel>
50+
</PropertyGroup>
51+
<PropertyGroup>
52+
<StartupObject>Api_ng_sample_code.Program</StartupObject>
53+
</PropertyGroup>
54+
<ItemGroup>
55+
<Reference Include="Newtonsoft.Json">
56+
<HintPath>..\lib\Newtonsoft.Json.dll</HintPath>
57+
</Reference>
58+
<Reference Include="System" />
59+
<Reference Include="System.Core" />
60+
<Reference Include="System.Web.Services" />
61+
<Reference Include="System.Xml.Linq" />
62+
<Reference Include="System.Data.DataSetExtensions" />
63+
<Reference Include="Microsoft.CSharp" />
64+
<Reference Include="System.Data" />
65+
<Reference Include="System.Xml" />
66+
</ItemGroup>
67+
<ItemGroup>
68+
<Compile Include="IClient.cs" />
69+
<Compile Include="JsonRpcClient.cs">
70+
<SubType>Component</SubType>
71+
</Compile>
72+
<Compile Include="Json\JsonConvert.cs" />
73+
<Compile Include="Json\JsonRequest.cs" />
74+
<Compile Include="Json\JsonResponse.cs" />
75+
<Compile Include="Json\RescriptRequest.cs" />
76+
<Compile Include="Program.cs" />
77+
<Compile Include="Properties\AssemblyInfo.cs" />
78+
<Compile Include="RescriptClient.cs">
79+
<SubType>Component</SubType>
80+
</Compile>
81+
<Compile Include="TO\APINGException.cs" />
82+
<Compile Include="TO\Competition.cs" />
83+
<Compile Include="TO\CompetitionResult.cs" />
84+
<Compile Include="TO\Event.cs" />
85+
<Compile Include="TO\EventResult.cs" />
86+
<Compile Include="TO\EventType.cs" />
87+
<Compile Include="TO\EventTypeResult.cs" />
88+
<Compile Include="TO\ExBestOffersOverrides.cs" />
89+
<Compile Include="TO\Exception.cs" />
90+
<Compile Include="TO\ExchangePrices.cs" />
91+
<Compile Include="TO\ExecutionReportErrorCode.cs" />
92+
<Compile Include="TO\ExecutionReportStatus.cs" />
93+
<Compile Include="TO\InstructionReportErrorCode.cs" />
94+
<Compile Include="TO\InstructionReportStatus.cs" />
95+
<Compile Include="TO\LimitOnCloseOrder.cs" />
96+
<Compile Include="TO\LimitOrder.cs" />
97+
<Compile Include="TO\MarketBettingType.cs" />
98+
<Compile Include="TO\MarketBook.cs" />
99+
<Compile Include="TO\MarketCatalogue.cs" />
100+
<Compile Include="TO\MarketDescription.cs" />
101+
<Compile Include="TO\MarketFilter.cs" />
102+
<Compile Include="TO\MarketOnCloseOrder.cs" />
103+
<Compile Include="TO\MarketProjection.cs" />
104+
<Compile Include="TO\MarketSort.cs" />
105+
<Compile Include="TO\MarketStatus.cs" />
106+
<Compile Include="TO\Match.cs" />
107+
<Compile Include="TO\MatchProjection.cs" />
108+
<Compile Include="TO\Order.cs" />
109+
<Compile Include="TO\OrderProjection.cs" />
110+
<Compile Include="TO\OrderStatus.cs" />
111+
<Compile Include="TO\OrderType.cs" />
112+
<Compile Include="TO\PersistenceType.cs" />
113+
<Compile Include="TO\PlaceExecutionReport.cs" />
114+
<Compile Include="TO\PlaceInstruction.cs" />
115+
<Compile Include="TO\PlaceInstructionReport.cs" />
116+
<Compile Include="TO\PriceData.cs" />
117+
<Compile Include="TO\PriceProjection.cs" />
118+
<Compile Include="TO\PriceSize.cs" />
119+
<Compile Include="TO\RollUpModel.cs" />
120+
<Compile Include="TO\Runner.cs" />
121+
<Compile Include="TO\RunnerDescription.cs" />
122+
<Compile Include="TO\RunnerStatus.cs" />
123+
<Compile Include="TO\Side.cs" />
124+
<Compile Include="TO\StartingPrices.cs" />
125+
<Compile Include="TO\TimeRange.cs" />
126+
</ItemGroup>
127+
<ItemGroup>
128+
<WCFMetadata Include="Service References\" />
129+
</ItemGroup>
130+
<ItemGroup>
131+
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
132+
<Visible>False</Visible>
133+
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
134+
<Install>true</Install>
135+
</BootstrapperPackage>
136+
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
137+
<Visible>False</Visible>
138+
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
139+
<Install>false</Install>
140+
</BootstrapperPackage>
141+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
142+
<Visible>False</Visible>
143+
<ProductName>.NET Framework 3.5 SP1</ProductName>
144+
<Install>false</Install>
145+
</BootstrapperPackage>
146+
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
147+
<Visible>False</Visible>
148+
<ProductName>Windows Installer 3.1</ProductName>
149+
<Install>true</Install>
150+
</BootstrapperPackage>
151+
</ItemGroup>
152+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
153+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
154+
Other similar extension points exist, see Microsoft.Common.targets.
155+
<Target Name="BeforeBuild">
156+
</Target>
157+
<Target Name="AfterBuild">
158+
</Target>
159+
-->
160+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PublishUrlHistory>publish\</PublishUrlHistory>
5+
<InstallUrlHistory />
6+
<SupportUrlHistory />
7+
<UpdateUrlHistory />
8+
<BootstrapperUrlHistory />
9+
<ErrorReportUrlHistory />
10+
<FallbackCulture>en-US</FallbackCulture>
11+
<VerifyUploadedFiles>false</VerifyUploadedFiles>
12+
</PropertyGroup>
13+
</Project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using Api_ng_sample_code.TO;
6+
7+
namespace Api_ng_sample_code
8+
{
9+
public interface IClient
10+
{
11+
/**
12+
* calls api-ng to get a list of events
13+
*
14+
* */
15+
IList<EventTypeResult> listEventTypes(MarketFilter marketFilter, string locale = null);
16+
17+
/**
18+
* calls api-ng to get a list of market catalogues
19+
* */
20+
IList<MarketCatalogue> listMarketCatalogue(MarketFilter marketFilter, ISet<MarketProjection> marketProjections, MarketSort marketSort, string maxResult = "1", string locale = null);
21+
22+
/**
23+
* calls api-ng to get more detailed info about the specified markets
24+
* */
25+
IList<MarketBook> listMarketBook(IList<string> marketIds, PriceProjection priceProjection, OrderProjection? orderProjection = null, MatchProjection? matchProjection = null, string currencyCode = null, string locale = null);
26+
27+
/**
28+
* places a bet
29+
* */
30+
PlaceExecutionReport placeOrders(string marketId, string customerRef, IList<PlaceInstruction> placeInstructions, string locale = null);
31+
32+
}
33+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.IO;
6+
using Newtonsoft.Json;
7+
8+
9+
namespace Api_ng_sample_code.Json
10+
{
11+
class JsonConvert
12+
{
13+
14+
public static JsonResponse<T> Import<T>(TextReader reader)
15+
{
16+
var jsonResponse = reader.ReadToEnd();
17+
return Deserialize<JsonResponse<T>>(jsonResponse);
18+
}
19+
20+
public static T Deserialize<T>(string json)
21+
{
22+
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(json);
23+
}
24+
25+
//Used for json rpc calls to create a body
26+
public static void Export(JsonRequest request, TextWriter writer)
27+
{
28+
var json = Serialize<JsonRequest>(request);
29+
writer.Write(json);
30+
}
31+
32+
public static string Serialize<T>(T value)
33+
{
34+
35+
var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore};
36+
37+
return Newtonsoft.Json.JsonConvert.SerializeObject(value, settings);
38+
}
39+
}
40+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using Newtonsoft.Json;
6+
7+
namespace Api_ng_sample_code.Json
8+
{
9+
[JsonObject(MemberSerialization.OptIn)]
10+
public class JsonRequest
11+
{
12+
public JsonRequest()
13+
{
14+
JsonRpc = "2.0";
15+
}
16+
17+
[JsonProperty(PropertyName = "jsonrpc", NullValueHandling = NullValueHandling.Ignore)]
18+
public string JsonRpc { get; set; }
19+
20+
[JsonProperty(PropertyName = "method")]
21+
public string Method { get; set; }
22+
23+
[JsonProperty(PropertyName = "params")]
24+
public object Params { get; set; }
25+
26+
[JsonProperty(PropertyName = "id")]
27+
public object Id { get; set; }
28+
}
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using Newtonsoft.Json;
6+
using Api_ng_sample_code.TO;
7+
8+
namespace Api_ng_sample_code.Json
9+
{
10+
[JsonObject(MemberSerialization.OptIn)]
11+
public class JsonResponse<T>
12+
{
13+
[JsonProperty(PropertyName = "jsonrpc", NullValueHandling = NullValueHandling.Ignore)]
14+
public string JsonRpc { get; set; }
15+
16+
[JsonProperty(PropertyName = "result", NullValueHandling = NullValueHandling.Ignore)]
17+
public T Result { get; set; }
18+
19+
[JsonProperty(PropertyName = "error", NullValueHandling = NullValueHandling.Ignore)]
20+
public Api_ng_sample_code.TO.Exception Error { get; set; }
21+
22+
[JsonProperty(PropertyName = "id")]
23+
public object Id { get; set; }
24+
25+
[JsonIgnore]
26+
public bool HasError
27+
{
28+
get { return Error != null; }
29+
}
30+
}
31+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using Newtonsoft.Json;
6+
7+
namespace Api_ng_sample_code.Json
8+
{
9+
[JsonObject(MemberSerialization.OptIn)]
10+
public class RescriptRequest
11+
{
12+
13+
[JsonProperty(PropertyName = "")]
14+
public IDictionary<string, object> args { get; set; }
15+
16+
public RescriptRequest(IDictionary<string, object> args)
17+
{
18+
this.args = args;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)