-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for Node-Restify #353
Changes from all commits
4a8fe07
1e2da8d
01c53b8
1f510d1
48673d0
13e42d6
2f35c04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{1ECC689C-2542-4EE8-8A86-7627E63F44F8}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>NodeApi.Restify</RootNamespace> | ||
<AssemblyName>Script.Node.Restify</AssemblyName> | ||
<NoStdLib>True</NoStdLib> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\..\..\ScriptSharp.snk</AssemblyOriginatorKeyFile> | ||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<OutputPath>..\..\..\..\bin\Debug\</OutputPath> | ||
<DebugSymbols>false</DebugSymbols> | ||
<DefineConstants>DEBUG</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>..\..\..\..\bin\Debug\Script.Node.Restify.xml</DocumentationFile> | ||
<NoWarn>1591, 0661, 0660, 1684</NoWarn> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>none</DebugType> | ||
<DebugSymbols>false</DebugSymbols> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\..\..\..\bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>..\..\..\..\bin\Release\Script.Node.Restify.xml</DocumentationFile> | ||
<NoWarn>1591, 0661, 0660, 1684</NoWarn> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="..\..\..\ScriptSharp.cs"> | ||
<Link>Properties\ScriptSharp.cs</Link> | ||
</Compile> | ||
<Compile Include="RestifyLogger.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="RestifyApplication.cs" /> | ||
<Compile Include="RestifyCallback.cs" /> | ||
<Compile Include="RestifyChain.cs" /> | ||
<Compile Include="RestifyError.cs" /> | ||
<Compile Include="RestifyHandler.cs" /> | ||
<Compile Include="RestifyHttpClient.cs" /> | ||
<Compile Include="RestifyJsonClient.cs" /> | ||
<Compile Include="RestifyJsonClientOptions.cs" /> | ||
<Compile Include="RestifyRequest.cs" /> | ||
<Compile Include="RestifyResponse.cs" /> | ||
<Compile Include="RestifyRoute.cs" /> | ||
<Compile Include="RestifyServer.cs" /> | ||
<Compile Include="RestifyServerGetOptions.cs" /> | ||
<Compile Include="RestifyServerOptions.cs" /> | ||
<Compile Include="RestifyStringClient.cs" /> | ||
<Compile Include="RestifyThrottleOptions.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\Core\CoreLib\CoreLib.csproj"> | ||
<Project>{36d4b098-a21c-4725-acd3-400922885f38}</Project> | ||
<Name>CoreLib</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Node.Core\Node.Core.csproj"> | ||
<Project>{4a9f7ce9-5a45-4b28-ad01-05528709b6e4}</Project> | ||
<Name>Node.Core</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="AfterBuild"> | ||
<Copy SourceFiles="@(ScriptInfo)" DestinationFiles="$(OutputPath)$(AssemblyName).txt" /> | ||
</Target> | ||
<Import Project="..\..\..\packages\ScriptSharp.0.8\tools\ScriptSharp.targets" Condition="Exists('..\..\..\packages\ScriptSharp.0.8\tools\ScriptSharp.targets')" /> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// AssemblyInfo.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System; | ||
using System.Reflection; | ||
|
||
[assembly: AssemblyTitle("Script.Node.Restify")] | ||
[assembly: AssemblyDescription("Script# NodeJS Restify Module API")] | ||
[assembly: ScriptAssembly("restify")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Node Express Module | ||
=============================================================================== | ||
|
||
This assembly provides access to Restify Module APIs for NodeJS applications. | ||
This is only meant for use at development time, so you can reference and compile | ||
your c# code against restify APIs. | ||
|
||
More information is on http://mcavage.github.com/node-restify/. | ||
|
||
------------------------------------------------------------------------------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Restify.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
[ScriptImport] | ||
[ScriptIgnoreNamespace] | ||
[ScriptName("restify")] | ||
public static class RestifyApplication { | ||
|
||
public static RestifyChainedHandler[] AcceptParser(string[] serverAcceptable) { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] AuthorizationParser() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] BodyParser() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] ConditionalRequest() { | ||
return null; | ||
} | ||
|
||
public static RestifyHttpClient CreateHttpClient() { | ||
return null; | ||
} | ||
|
||
public static RestifyJsonClient CreateJsonClient() { | ||
return null; | ||
} | ||
|
||
public static RestifyJsonClient CreateJsonClient(RestifyJsonClientOptions options) { | ||
return null; | ||
} | ||
|
||
public static RestifyServer CreateServer() { | ||
return null; | ||
} | ||
|
||
public static RestifyServer CreateServer(RestifyServerOptions rs) { | ||
return null; | ||
} | ||
|
||
public static RestifyStringClient CreateStringClient() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] DateParser() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] GZipResponse() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] JsonBodyParser() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] Jsonp() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler QueryParser() { | ||
return null; | ||
} | ||
|
||
public static RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { | ||
return null; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// RestifyCallback.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
namespace NodeApi.Restify { | ||
|
||
public delegate void RestifyCallback(RestifyError error, RestifyRequest request, RestifyResponse response, object content); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RestifyChain.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
[ScriptIgnoreNamespace] | ||
[ScriptImport] | ||
public sealed class RestifyChain { | ||
|
||
private RestifyChain() { | ||
} | ||
|
||
[ScriptSkip] | ||
public void Continue() { | ||
} | ||
|
||
[ScriptSkip] | ||
public void Error(Exception error) { | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RestifyError.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
[ScriptIgnoreNamespace] | ||
[ScriptImport] | ||
public sealed class RestifyError { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. internal ctor? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch again. Added internal ctor. |
||
|
||
internal RestifyError() { | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RestifyHandler.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
[ScriptImport] | ||
[ScriptIgnoreNamespace] | ||
public delegate void RestifyHandler(RestifyRequest request, RestifyResponse response); | ||
|
||
[ScriptImport] | ||
[ScriptIgnoreNamespace] | ||
public delegate RestifyChainedHandler RestifyChainedHandler(RestifyRequest request, RestifyResponse response, Func<bool, RestifyChainedHandler> next); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RestifyHttpClient.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
[ScriptImport] | ||
[ScriptIgnoreNamespace] | ||
public sealed class RestifyHttpClient : RestifyStringClient { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am assuming these classes actually have specific functionality/APIs that hasn't been mapped out yet and eventually will be, hence makes sense to have these classes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct. I haven't had the need to use them yet so I'll implement their functionality as we get to using it (which helps me validate that the implementation works). |
||
|
||
private RestifyHttpClient() { | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RestifyJsonClient.cs | ||
// Script#/Libraries/Node/Restify | ||
// This source code is subject to terms and conditions of the Apache License, Version 2.0. | ||
// | ||
|
||
using System.Collections; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace NodeApi.Restify { | ||
|
||
/// <summary> | ||
/// sends and expects application/json | ||
/// </summary> | ||
[ScriptImport] | ||
[ScriptIgnoreNamespace] | ||
public sealed class RestifyJsonClient : RestifyStringClient { | ||
|
||
private RestifyJsonClient() { | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice something in the restify docs to document the restify request deriving from the core http equivalents.
Independent of that though, I feel it might be better to simply duplicate, since:
Same applies to HttpServerResponse.
Might be best duplicating the relevant properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Restify's Request API section, it says that it wraps all of the node ServerRequest API's, events and properties, plus the Restify specific entities.
I don't think we should be replicating functionality as we'll have to keep them in sync every time there are changes in Node's Request object. Same goes for Response.
I can duplicate for now, although I have not been successful at using git squash and have previous changes discarded after sending a pull request. Earlier I had to drop my repo and re-fork to get rid of some of the things. If you have any insights into how to do it, that'll be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a way to undo changes/history for a specific file from an existing push.
I'm assuming that by using git commit --squash, you want me to bundle all the changes in a single request.