Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit fddc607f5d09dc0496a6c8bb06f94b88c463f93d 1 parent d931f26
Daniel Lewis authored
Showing with 78,110 additions and 0 deletions.
  1. +67 −0 Apigee.Net.Tests/Apigee.Net.Tests.csproj
  2. +96 −0 Apigee.Net.Tests/ApigeeClientTests/ClientTests.cs
  3. +36 −0 Apigee.Net.Tests/Properties/AssemblyInfo.cs
  4. BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.Tests.dll
  5. BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.Tests.pdb
  6. BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.dll
  7. BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.pdb
  8. BIN  Apigee.Net.Tests/bin/Debug/Krystalware.UploadHelper.dll
  9. BIN  Apigee.Net.Tests/bin/Debug/Krystalware.UploadHelper.pdb
  10. BIN  Apigee.Net.Tests/bin/Debug/Newtonsoft.Json.dll
  11. +7,634 −0 Apigee.Net.Tests/bin/Debug/Newtonsoft.Json.xml
  12. BIN  Apigee.Net.Tests/bin/Debug/fastJSON.dll
  13. BIN  Apigee.Net.Tests/bin/Debug/fastJSON.pdb
  14. BIN  Apigee.Net.Tests/bin/Debug/nunit.framework.dll
  15. +10,845 −0 Apigee.Net.Tests/bin/Debug/nunit.framework.xml
  16. BIN  Apigee.Net.Tests/bin/Debug/nunit.mocks.dll
  17. +17 −0 Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.csproj.FileListAbsolute.txt
  18. BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.csprojResolveAssemblyReference.cache
  19. BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.dll
  20. BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.pdb
  21. BIN  Apigee.Net.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  22. 0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  23. 0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  24. 0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  25. +26 −0 Apigee.Net.sln
  26. BIN  Apigee.Net.v11.suo
  27. +68 −0 Apigee.Net/Apigee.Net.csproj
  28. +6 −0 Apigee.Net/Apigee.Net.csproj.user
  29. +157 −0 Apigee.Net/ApigeeClient.cs
  30. +7 −0 Apigee.Net/Models/ApiResponse/CreateApigeeAccountResponse.cs
  31. +18 −0 Apigee.Net/Models/UserModel.cs
  32. +187 −0 Apigee.Net/Networking/HttpTools.cs
  33. +36 −0 Apigee.Net/Properties/AssemblyInfo.cs
  34. BIN  Apigee.Net/bin/Debug/Apigee.Net.dll
  35. BIN  Apigee.Net/bin/Debug/Apigee.Net.pdb
  36. BIN  Apigee.Net/bin/Debug/Krystalware.UploadHelper.dll
  37. BIN  Apigee.Net/bin/Debug/Krystalware.UploadHelper.pdb
  38. BIN  Apigee.Net/bin/Debug/Newtonsoft.Json.dll
  39. +7,634 −0 Apigee.Net/bin/Debug/Newtonsoft.Json.xml
  40. BIN  Apigee.Net/bin/Debug/fastJSON.dll
  41. BIN  Apigee.Net/bin/Debug/fastJSON.pdb
  42. +12 −0 Apigee.Net/obj/Debug/Apigee.Net.csproj.FileListAbsolute.txt
  43. BIN  Apigee.Net/obj/Debug/Apigee.Net.csprojResolveAssemblyReference.cache
  44. BIN  Apigee.Net/obj/Debug/Apigee.Net.dll
  45. BIN  Apigee.Net/obj/Debug/Apigee.Net.pdb
  46. BIN  Apigee.Net/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  47. 0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  48. 0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  49. 0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  50. +4 −0 Apigee.Net/packages.config
  51. BIN  packages/Newtonsoft.Json.4.5.9/Newtonsoft.Json.4.5.9.nupkg
  52. BIN  packages/Newtonsoft.Json.4.5.9/lib/net20/Newtonsoft.Json.dll
  53. +8,255 −0 packages/Newtonsoft.Json.4.5.9/lib/net20/Newtonsoft.Json.xml
  54. BIN  packages/Newtonsoft.Json.4.5.9/lib/net35/Newtonsoft.Json.dll
  55. +7,391 −0 packages/Newtonsoft.Json.4.5.9/lib/net35/Newtonsoft.Json.xml
  56. BIN  packages/Newtonsoft.Json.4.5.9/lib/net40/Newtonsoft.Json.dll
  57. +7,634 −0 packages/Newtonsoft.Json.4.5.9/lib/net40/Newtonsoft.Json.xml
  58. BIN  packages/Newtonsoft.Json.4.5.9/lib/sl3-wp/Newtonsoft.Json.dll
  59. +6,934 −0 packages/Newtonsoft.Json.4.5.9/lib/sl3-wp/Newtonsoft.Json.xml
  60. BIN  packages/Newtonsoft.Json.4.5.9/lib/sl4-windowsphone71/Newtonsoft.Json.dll
  61. +6,934 −0 packages/Newtonsoft.Json.4.5.9/lib/sl4-windowsphone71/Newtonsoft.Json.xml
  62. BIN  packages/Newtonsoft.Json.4.5.9/lib/sl4/Newtonsoft.Json.dll
  63. +6,956 −0 packages/Newtonsoft.Json.4.5.9/lib/sl4/Newtonsoft.Json.xml
  64. BIN  packages/Newtonsoft.Json.4.5.9/lib/winrt45/Newtonsoft.Json.dll
  65. +7,152 −0 packages/Newtonsoft.Json.4.5.9/lib/winrt45/Newtonsoft.Json.xml
  66. BIN  packages/UploadHelper/Krystalware.UploadHelper.dll
  67. BIN  packages/UploadHelper/Krystalware.UploadHelper.pdb
  68. BIN  packages/fastJSON v2.0.2/fastJSON.dll
  69. BIN  packages/fastJSON v2.0.2/fastJSON.pdb
  70. +4 −0 packages/repositories.config
View
67 Apigee.Net.Tests/Apigee.Net.Tests.csproj
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.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>{2D2A671F-A362-4A43-B848-D265C0CF7201}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Apigee.Net.Tests</RootNamespace>
+ <AssemblyName>Apigee.Net.Tests</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\Program Files (x86)\NUnit 2.6\bin\framework\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.mocks, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\Program Files (x86)\NUnit 2.6\bin\framework\nunit.mocks.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.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ApigeeClientTests\ClientTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Apigee.Net\Apigee.Net.csproj">
+ <Project>{f83a4ff7-a1ca-4f17-8cec-60b7684220dc}</Project>
+ <Name>Apigee.Net</Name>
+ </ProjectReference>
+ </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>
View
96 Apigee.Net.Tests/ApigeeClientTests/ClientTests.cs
@@ -0,0 +1,96 @@
+using Apigee.Net.Models;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Apigee.Net.Tests.ApigeeClientTests
+{
+ public class ClientTests
+ {
+ ApigeeClient aClient = new ApigeeClient("http://api.usergrid.com/sympletech1/sandbox/");
+
+ [Test]
+ public void GetUsersTest()
+ {
+ var results = aClient.GetUsers();
+ Assert.IsNotNull(results);
+ }
+
+ [Test]
+ public void CreateAccountTest()
+ {
+ string un = "apigee_" + Guid.NewGuid();
+ var result = aClient.CreateAccount(new UserModel {
+ Username = un,
+ Password = "abc123",
+ Email = un + "@sympletech.com"
+ });
+
+ Assert.IsNotEmpty(result.Uuid);
+ }
+
+ [Test]
+ public void UpdateAccountTest()
+ {
+ string un = "bobby";
+ var result = aClient.UpdateAccount(new UserModel
+ {
+ Username = un,
+ Password = "abc123",
+ Email = un + "@sympletech.com"
+ });
+ }
+
+
+ [Test]
+ public void GetTokenTest()
+ {
+ var result = aClient.GetToken("apigee_58461c11-6632-4980-9130-cb43fc5d0dc6", "abc123");
+ Assert.IsNotNull(result);
+ }
+
+ [Test]
+ public void LookUpTokenTest()
+ {
+ var result = aClient.LookUpToken("");
+ Assert.IsNotNull(result);
+ }
+
+
+
+ public static void temp()
+ {
+ ApigeeClient apiClient = new ApigeeClient("http://api.usergrid.com/xxx/sandbox/");
+
+ //Get a collection of all users
+ var allUsers = apiClient.GetUsers();
+
+ string un = "apigee_" + Guid.NewGuid();
+
+ //Create a new Account
+ apiClient.CreateAccount(new UserModel
+ {
+ Username = un,
+ Password = "abc123",
+ Email = un + "@sympletech.com"
+ });
+
+ //Update an Existing Account
+ apiClient.UpdateAccount(new UserModel
+ {
+ Username = un,
+ Password = "abc123456",
+ Email = un + "@sympletech.com"
+ });
+
+ //Login User - Get Token
+ var token = apiClient.GetToken(un, "abc123456");
+
+ //Lookup a user by token ID
+ var username = apiClient.LookUpToken(token);
+ }
+ }
+}
View
36 Apigee.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("Apigee.Net.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Apigee.Net.Tests")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[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("90782e30-179e-4635-936c-74e0b1b4a7c5")]
+
+// 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")]
View
BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.Tests.dll
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.Tests.pdb
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.dll
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Apigee.Net.pdb
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Krystalware.UploadHelper.dll
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Krystalware.UploadHelper.pdb
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/Newtonsoft.Json.dll
Binary file not shown
View
7,634 Apigee.Net.Tests/bin/Debug/Newtonsoft.Json.xml
7,634 additions, 0 deletions not shown
View
BIN  Apigee.Net.Tests/bin/Debug/fastJSON.dll
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/fastJSON.pdb
Binary file not shown
View
BIN  Apigee.Net.Tests/bin/Debug/nunit.framework.dll
Binary file not shown
View
10,845 Apigee.Net.Tests/bin/Debug/nunit.framework.xml
10,845 additions, 0 deletions not shown
View
BIN  Apigee.Net.Tests/bin/Debug/nunit.mocks.dll
Binary file not shown
View
17 Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.csproj.FileListAbsolute.txt
@@ -0,0 +1,17 @@
+C:\Users\Daniel\Projects\Apigee.Net\Apigee.Net.Tests\obj\Debug\Apigee.Net.Tests.csprojResolveAssemblyReference.cache
+F:\Projects\Apigee.Net\Apigee.Net.Tests\obj\Debug\Apigee.Net.Tests.csprojResolveAssemblyReference.cache
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Apigee.Net.Tests.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Apigee.Net.Tests.pdb
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Apigee.Net.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\nunit.framework.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\nunit.mocks.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\fastJSON.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Krystalware.UploadHelper.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Apigee.Net.pdb
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\nunit.framework.xml
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\fastJSON.pdb
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Krystalware.UploadHelper.pdb
+F:\Projects\Apigee.Net\Apigee.Net.Tests\obj\Debug\Apigee.Net.Tests.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\obj\Debug\Apigee.Net.Tests.pdb
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Newtonsoft.Json.dll
+F:\Projects\Apigee.Net\Apigee.Net.Tests\bin\Debug\Newtonsoft.Json.xml
View
BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.csprojResolveAssemblyReference.cache
Binary file not shown
View
BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.dll
Binary file not shown
View
BIN  Apigee.Net.Tests/obj/Debug/Apigee.Net.Tests.pdb
Binary file not shown
View
BIN  Apigee.Net.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown
View
0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
No changes.
View
0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
No changes.
View
0  Apigee.Net.Tests/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
No changes.
View
26 Apigee.Net.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apigee.Net", "Apigee.Net\Apigee.Net.csproj", "{F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apigee.Net.Tests", "Apigee.Net.Tests\Apigee.Net.Tests.csproj", "{2D2A671F-A362-4A43-B848-D265C0CF7201}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2D2A671F-A362-4A43-B848-D265C0CF7201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2D2A671F-A362-4A43-B848-D265C0CF7201}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2D2A671F-A362-4A43-B848-D265C0CF7201}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2D2A671F-A362-4A43-B848-D265C0CF7201}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
BIN  Apigee.Net.v11.suo
Binary file not shown
View
68 Apigee.Net/Apigee.Net.csproj
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.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>{F83A4FF7-A1CA-4F17-8CEC-60B7684220DC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Apigee.Net</RootNamespace>
+ <AssemblyName>Apigee.Net</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="fastJSON">
+ <HintPath>..\packages\fastJSON v2.0.2\fastJSON.dll</HintPath>
+ </Reference>
+ <Reference Include="Krystalware.UploadHelper">
+ <HintPath>..\packages\UploadHelper\Krystalware.UploadHelper.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.9\lib\net40\Newtonsoft.Json.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.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ApigeeClient.cs" />
+ <Compile Include="Models\ApiResponse\CreateApigeeAccountResponse.cs" />
+ <Compile Include="Models\UserModel.cs" />
+ <Compile Include="Networking\HttpTools.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.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>
View
6 Apigee.Net/Apigee.Net.csproj.user
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ShowAllFiles</ProjectView>
+ </PropertyGroup>
+</Project>
View
157 Apigee.Net/ApigeeClient.cs
@@ -0,0 +1,157 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Apigee.Net.Models.ApiResponse;
+using Apigee.Net.Networking;
+using Apigee.Net.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Apigee.Net
+{
+ public class ApigeeClient
+ {
+ /// <summary>
+ /// Create a new Apigee Client
+ /// </summary>
+ /// <param name="userGridUrl">The Base URL To the UserGrid</param>
+ public ApigeeClient(string userGridUrl)
+ {
+ this.UserGridUrl = userGridUrl;
+ }
+
+ public string UserGridUrl { get; set; }
+
+ #region Core Worker Methods
+
+ /// <summary>
+ /// Combines The UserGridUrl abd a provided path - checking to emsure proper http formatting
+ /// </summary>
+ /// <param name="path"></param>
+ /// <returns></returns>
+ private string BuildPath(string path)
+ {
+ StringBuilder sbResult = new StringBuilder();
+ sbResult.Append(this.UserGridUrl);
+
+ if (this.UserGridUrl.EndsWith("/") != true)
+ {
+ sbResult.Append("/");
+ }
+
+ if (path.StartsWith("/"))
+ {
+ path = path.TrimStart('/');
+ }
+
+ sbResult.Append(path);
+
+ return sbResult.ToString();
+ }
+
+ private JToken GetEntitiesFromJson(string rawJson)
+ {
+ var objResult = JObject.Parse(rawJson);
+ return objResult.SelectToken("entities");
+ }
+
+ /// <summary>
+ /// Performs a Get agianst the UserGridUrl + provided path
+ /// </summary>
+ /// <typeparam name="retrunT">Return Type</typeparam>
+ /// <param name="path">Sub Path Of the Get Request</param>
+ /// <returns>Object of Type T</returns>
+ public retrunT PerformRequest<retrunT>(string path)
+ {
+ return PerformRequest<retrunT>(path, HttpTools.RequestTypes.Get, null);
+ }
+
+ /// <summary>
+ /// Performs a Request agianst the UserGridUrl + provided path
+ /// </summary>
+ /// <typeparam name="retrunT">Return Type</typeparam>
+ /// <param name="path">Sub Path Of the Get Request</param>
+ /// <returns>Object of Type T</returns>
+ public retrunT PerformRequest<retrunT>(string path, HttpTools.RequestTypes method, object data)
+ {
+ string requestPath = BuildPath(path);
+ return HttpTools.PerformJsonRequest<retrunT>(requestPath, method, data);
+ }
+
+
+
+ #endregion
+
+ #region Account Management
+
+ public List<UserModel> GetUsers()
+ {
+ var rawResults = PerformRequest<string>("/users");
+ var users = GetEntitiesFromJson(rawResults);
+
+ List<UserModel> results = new List<UserModel>();
+ foreach (var usr in users)
+ {
+ results.Add(new UserModel {
+ Uuid = (usr["uuid"] ?? "").ToString(),
+ Username = (usr["username"] ?? "").ToString(),
+ Password = (usr["password"] ?? "").ToString(),
+ Lastname = (usr["lastname"] ?? "").ToString(),
+ Firstname = (usr["firstname"] ?? "").ToString(),
+ Title = (usr["title"] ?? "").ToString(),
+ Email = (usr["Email"] ?? "").ToString(),
+ Tel = (usr["tel"] ?? "").ToString(),
+ HomePage = (usr["homepage"] ?? "").ToString(),
+ Bday = (usr["bday"] ?? "").ToString(),
+ Picture = (usr["picture"] ?? "").ToString(),
+ Url = (usr["url"] ?? "").ToString()
+ });
+ }
+
+ return results;
+ }
+
+ public CreateApigeeAccountResponse CreateAccount(UserModel accountModel)
+ {
+ var rawResults = PerformRequest<string>("/users", HttpTools.RequestTypes.Post, accountModel);
+ var entitiesResult = GetEntitiesFromJson(rawResults);
+
+ return new CreateApigeeAccountResponse {
+ Uuid = entitiesResult[0]["uuid"].ToString()
+ };
+ }
+
+ public string UpdateAccount(UserModel accountModel)
+ {
+ var rawResults = PerformRequest<string>("/users/" + accountModel.Username, HttpTools.RequestTypes.Put, accountModel);
+
+ return "";
+ }
+
+ #endregion
+
+ #region Token Management
+
+ public string GetToken(string username, string password)
+ {
+ var reqString = string.Format("/token/?grant_type=password&username={0}&password={1}", username, password);
+ var rawResults = PerformRequest<string>(reqString);
+ var results = JObject.Parse(rawResults);
+
+ return results["access_token"].ToString();
+ }
+
+ public string LookUpToken(string token)
+ {
+ var reqString = "/users/me/?access_token=" + token;
+ var rawResults = PerformRequest<string>(reqString);
+ var entitiesResult = GetEntitiesFromJson(rawResults);
+
+ return entitiesResult["username"].ToString();
+ }
+
+ #endregion
+
+ }
+}
View
7 Apigee.Net/Models/ApiResponse/CreateApigeeAccountResponse.cs
@@ -0,0 +1,7 @@
+namespace Apigee.Net.Models.ApiResponse
+{
+ public class CreateApigeeAccountResponse
+ {
+ public string Uuid { get; set; }
+ }
+}
View
18 Apigee.Net/Models/UserModel.cs
@@ -0,0 +1,18 @@
+namespace Apigee.Net.Models
+{
+ public class UserModel
+ {
+ public string Uuid { get; set; }
+ public string Username { get; set; }
+ public string Password { get; set; }
+ public string Firstname { get; set; }
+ public string Lastname { get; set; }
+ public string Title { get; set; }
+ public string HomePage { get; set; }
+ public string Email { get; set; }
+ public string Bday { get; set; }
+ public string Picture { get; set; }
+ public string Tel { get; set; }
+ public string Url { get; set; }
+ }
+}
View
187 Apigee.Net/Networking/HttpTools.cs
@@ -0,0 +1,187 @@
+using Krystalware.UploadHelper;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.IO;
+using System.Net;
+using System.Text;
+
+namespace Apigee.Net.Networking
+{
+ public class HttpTools
+ {
+ public enum RequestTypes { Get, Post, Put, Delete }
+
+ #region Get
+
+ public static string PerformGet(string url)
+ {
+ WebRequest req = WebRequest.Create(url);
+ WebResponse resp = req.GetResponse();
+ StreamReader sr = new StreamReader(resp.GetResponseStream());
+ return sr.ReadToEnd().Trim();
+ }
+
+ #endregion
+
+ #region Post
+
+ public static ReturnT PerformPost<ReturnT>(string url)
+ {
+ return PerformPost<object, ReturnT>(url, new object());
+ }
+
+ public static ReturnT PerformPost<PostT, ReturnT>(string url, PostT postData)
+ {
+ return PerformPost<PostT, ReturnT>(url, postData, new NameValueCollection());
+ }
+ public static ReturnT PerformPost<PostT, ReturnT>(string url, PostT postData, NameValueCollection files)
+ {
+ HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+
+ NameValueCollection nvpPost;
+ if (typeof(PostT) == typeof(NameValueCollection))
+ {
+ nvpPost = postData as NameValueCollection;
+ }
+ else
+ {
+ nvpPost = ObjectToNameValueCollection<PostT>(postData);
+ }
+
+ List<UploadFile> postFiles = new List<UploadFile>();
+ foreach (var fKey in files.AllKeys)
+ {
+ FileStream fs = File.OpenRead(files[fKey]);
+ postFiles.Add(new UploadFile(fs, fKey, files[fKey], "application/octet-stream"));
+ }
+
+ var response = HttpUploadHelper.Upload(req, postFiles.ToArray(), nvpPost);
+
+ using (Stream s = response.GetResponseStream())
+ using (StreamReader sr = new StreamReader(s))
+ {
+ var responseJson = sr.ReadToEnd();
+ if (typeof(ReturnT) == typeof(string))
+ {
+ return (ReturnT)Convert.ChangeType(responseJson, typeof(ReturnT));
+ }
+
+ return fastJSON.JSON.Instance.ToObject<ReturnT>(responseJson);
+ }
+ }
+
+ //Converts an object to a name value collection (for posts)
+ private static NameValueCollection ObjectToNameValueCollection<T>(T obj)
+ {
+ NameValueCollection results = new NameValueCollection();
+
+ var oType = typeof(T);
+ foreach (var prop in oType.GetProperties())
+ {
+ string pVal = "";
+ try
+ {
+ pVal = oType.GetProperty(prop.Name).GetValue(obj, null).ToString();
+ }
+ catch { }
+ results[prop.Name] = pVal;
+ }
+
+ return results;
+ }
+
+ #endregion
+
+ #region JSON Request
+
+ public static ReturnT PerformJsonRequest<ReturnT>(string url, RequestTypes method, object postData)
+ {
+ //Initilize the http request
+ HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+ req.ContentType = "application/json";
+ req.Method = Enum.GetName(typeof(RequestTypes), method);
+
+
+ //If posting data - serialize it to a json object
+ if (method != RequestTypes.Get)
+ {
+ StringBuilder sbJsonRequest = new StringBuilder();
+ var T = postData.GetType();
+ foreach (var prop in T.GetProperties())
+ {
+ if (NativeTypes.Contains(prop.PropertyType))
+ {
+ sbJsonRequest.AppendFormat("\"{0}\":\"{1}\",", prop.Name.ToLower(), prop.GetValue(postData, null));
+ }
+ }
+
+ using (var sWriter = new StreamWriter(req.GetRequestStream()))
+ {
+ sWriter.Write("{" + sbJsonRequest.ToString().TrimEnd(',') + "}");
+ }
+ }
+
+ //Submit the Http Request
+ string responseJson = "";
+ try
+ {
+ using (var wResponse = req.GetResponse())
+ {
+ StreamReader sReader = new StreamReader(wResponse.GetResponseStream());
+ responseJson = sReader.ReadToEnd();
+ }
+ }
+ catch (WebException ex)
+ {
+ using (WebResponse response = ex.Response)
+ {
+ StreamReader sReader = new StreamReader(response.GetResponseStream());
+ responseJson = sReader.ReadToEnd();
+ }
+ }
+
+ if (typeof(ReturnT) == typeof(string))
+ {
+ return (ReturnT)Convert.ChangeType(responseJson, typeof(ReturnT));
+ }
+
+ return fastJSON.JSON.Instance.ToObject<ReturnT>(responseJson);
+ }
+
+ //Approved Types for serialization
+ public static List<Type> NativeTypes
+ {
+ get
+ {
+ var approvedTypes = new List<Type>();
+
+ approvedTypes.Add(typeof(int));
+ approvedTypes.Add(typeof(Int32));
+ approvedTypes.Add(typeof(Int64));
+ approvedTypes.Add(typeof(string));
+ approvedTypes.Add(typeof(DateTime));
+ approvedTypes.Add(typeof(double));
+ approvedTypes.Add(typeof(decimal));
+ approvedTypes.Add(typeof(float));
+ approvedTypes.Add(typeof(List<>));
+ approvedTypes.Add(typeof(bool));
+ approvedTypes.Add(typeof(Boolean));
+
+ approvedTypes.Add(typeof(int?));
+ approvedTypes.Add(typeof(Int32?));
+ approvedTypes.Add(typeof(Int64?));
+ approvedTypes.Add(typeof(DateTime?));
+ approvedTypes.Add(typeof(double?));
+ approvedTypes.Add(typeof(decimal?));
+ approvedTypes.Add(typeof(float?));
+ approvedTypes.Add(typeof(bool?));
+ approvedTypes.Add(typeof(Boolean?));
+
+ return approvedTypes;
+ }
+ }
+
+ #endregion
+ }
+}
View
36 Apigee.Net/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("Apigee.Net")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Apigee.Net")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[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("a6628f3e-a180-49d0-a1df-aebbb42cb7e5")]
+
+// 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")]
View
BIN  Apigee.Net/bin/Debug/Apigee.Net.dll
Binary file not shown
View
BIN  Apigee.Net/bin/Debug/Apigee.Net.pdb
Binary file not shown
View
BIN  Apigee.Net/bin/Debug/Krystalware.UploadHelper.dll
Binary file not shown
View
BIN  Apigee.Net/bin/Debug/Krystalware.UploadHelper.pdb
Binary file not shown
View
BIN  Apigee.Net/bin/Debug/Newtonsoft.Json.dll
Binary file not shown
View
7,634 Apigee.Net/bin/Debug/Newtonsoft.Json.xml
7,634 additions, 0 deletions not shown
View
BIN  Apigee.Net/bin/Debug/fastJSON.dll
Binary file not shown
View
BIN  Apigee.Net/bin/Debug/fastJSON.pdb
Binary file not shown
View
12 Apigee.Net/obj/Debug/Apigee.Net.csproj.FileListAbsolute.txt
@@ -0,0 +1,12 @@
+C:\Users\Daniel\Projects\Apigee.Net\Apigee.Net\obj\Debug\Apigee.Net.csprojResolveAssemblyReference.cache
+F:\Projects\Apigee.Net\Apigee.Net\obj\Debug\Apigee.Net.csprojResolveAssemblyReference.cache
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Apigee.Net.dll
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Apigee.Net.pdb
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\fastJSON.dll
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Krystalware.UploadHelper.dll
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Newtonsoft.Json.dll
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\fastJSON.pdb
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Krystalware.UploadHelper.pdb
+F:\Projects\Apigee.Net\Apigee.Net\bin\Debug\Newtonsoft.Json.xml
+F:\Projects\Apigee.Net\Apigee.Net\obj\Debug\Apigee.Net.dll
+F:\Projects\Apigee.Net\Apigee.Net\obj\Debug\Apigee.Net.pdb
View
BIN  Apigee.Net/obj/Debug/Apigee.Net.csprojResolveAssemblyReference.cache
Binary file not shown
View
BIN  Apigee.Net/obj/Debug/Apigee.Net.dll
Binary file not shown
View
BIN  Apigee.Net/obj/Debug/Apigee.Net.pdb
Binary file not shown
View
BIN  Apigee.Net/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown
View
0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
No changes.
View
0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
No changes.
View
0  Apigee.Net/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
No changes.
View
4 Apigee.Net/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="4.5.9" targetFramework="net45" />
+</packages>
View
BIN  packages/Newtonsoft.Json.4.5.9/Newtonsoft.Json.4.5.9.nupkg
Binary file not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/net20/Newtonsoft.Json.dll
Binary file not shown
View
8,255 packages/Newtonsoft.Json.4.5.9/lib/net20/Newtonsoft.Json.xml
8,255 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/net35/Newtonsoft.Json.dll
Binary file not shown
View
7,391 packages/Newtonsoft.Json.4.5.9/lib/net35/Newtonsoft.Json.xml
7,391 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/net40/Newtonsoft.Json.dll
Binary file not shown
View
7,634 packages/Newtonsoft.Json.4.5.9/lib/net40/Newtonsoft.Json.xml
7,634 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/sl3-wp/Newtonsoft.Json.dll
Binary file not shown
View
6,934 packages/Newtonsoft.Json.4.5.9/lib/sl3-wp/Newtonsoft.Json.xml
6,934 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/sl4-windowsphone71/Newtonsoft.Json.dll
Binary file not shown
View
6,934 packages/Newtonsoft.Json.4.5.9/lib/sl4-windowsphone71/Newtonsoft.Json.xml
6,934 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/sl4/Newtonsoft.Json.dll
Binary file not shown
View
6,956 packages/Newtonsoft.Json.4.5.9/lib/sl4/Newtonsoft.Json.xml
6,956 additions, 0 deletions not shown
View
BIN  packages/Newtonsoft.Json.4.5.9/lib/winrt45/Newtonsoft.Json.dll
Binary file not shown
View
7,152 packages/Newtonsoft.Json.4.5.9/lib/winrt45/Newtonsoft.Json.xml
7,152 additions, 0 deletions not shown
View
BIN  packages/UploadHelper/Krystalware.UploadHelper.dll
Binary file not shown
View
BIN  packages/UploadHelper/Krystalware.UploadHelper.pdb
Binary file not shown
View
BIN  packages/fastJSON v2.0.2/fastJSON.dll
Binary file not shown
View
BIN  packages/fastJSON v2.0.2/fastJSON.pdb
Binary file not shown
View
4 packages/repositories.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<repositories>
+ <repository path="..\Apigee.Net\packages.config" />
+</repositories>
Please sign in to comment.
Something went wrong with that request. Please try again.