Skip to content

Commit

Permalink
Adding SignalR template as an item template for VS (#967)
Browse files Browse the repository at this point in the history
Added signalR to itemTemplates for VS
  • Loading branch information
yojagad committed Aug 4, 2020
1 parent 9c3928f commit b1b4f85
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Build/PackageFiles/ItemTemplates.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,9 @@
<file src="..\..\Functions.Templates\Templates\EdgeHubTrigger-CSharp\.template.config\template.json" target="content\EdgeHubTrigger-CSharp\.template.config\template.json" />
<file src="..\..\Functions.Templates\Templates\EdgeHubTrigger-CSharp\.template.config\vs-2017.3.host.json" target="content\EdgeHubTrigger-CSharp\.template.config\vs-2017.3.host.json" />
<file src="..\..\Functions.Templates\Templates\EdgeHubTrigger-CSharp\.template.config\vs-2017.3\*.*" target="content\EdgeHubTrigger-CSharp\.template.config\vs-2017.3" />
<file src="..\..\Functions.Templates\Templates\SignalRConnectionInfoHttpTrigger-CSharp\SignalRConnectionInfoHttpTriggerCSharp.cs" target="content\SignalRConnectionInfoHttpTrigger-CSharp\SignalRConnectionInfoHttpTriggerCSharp.cs" />
<file src="..\..\Functions.Templates\Templates\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\template.json" target="content\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\template.json" />
<file src="..\..\Functions.Templates\Templates\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\vs-2017.3.host.json" target="content\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\vs-2017.3.host.json" />
<file src="..\..\Functions.Templates\Templates\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\vs-2017.3\*.*" target="content\SignalRConnectionInfoHttpTrigger-CSharp\.template.config\vs-2017.3" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"author": "Microsoft",
"classifications": [
"Azure Function",
"Trigger",
"Http",
"SignalR"
],
"name": "SignalRTrigger",
"identity": "Azure.Function.CSharp.SignalR.2.x",
"groupIdentity": "Azure.Function.SignalR",
"shortName": "signalr",
"tags": {
"language": "C#",
"type": "item"
},
"sourceName": "SignalRConnectionInfoHttpTriggerCSharp",
"symbols": {
"namespace": {
"description": "namespace for the generated code",
"replaces": "Company.Function",
"type": "parameter"
},
"AccessRights": {
"type": "parameter",
"description": "Authorization level controls whether the function requires an API key and which key to use; Function uses a function key; Admin uses your master key. The function and master keys are found in the 'keys' management panel on the portal, when your function is selected.",
"datatype": "choice",
"choices": [
{
"choice": "Function",
"description": "Function"
},
{
"choice": "Anonymous",
"description": "Anonymous"
},
{
"choice": "Admin",
"description": "Admin"
}
],
"replaces": "AuthLevelValue",
"defaultValue": "Function"
},
"HubName": {
"description": "SignalR Hub Name",
"replaces": "HubValue",
"type": "parameter"
}
},
"primaryOutputs": [
{
"path": "SignalRConnectionInfoHttpTriggerCSharp.cs"
}
],
"defaultName": "SignalRConnectionInfoHttpTriggerCSharp",
"postActions": [
{
"Description": "Adding Reference to Microsoft.Azure.WebJobs.Extensions.SignalRService Nuget package",
"ActionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
"ContinueOnError": "true",
"ManualInstructions": [],
"args": {
"referenceType": "package",
"reference": "Microsoft.Azure.WebJobs.Extensions.SignalRService", "version": "1.2.0",
"projectFileExtensions": ".csproj"
}
},
{
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"description": "Opens the function class file in the editor",
"manualInstructions": [],
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
"args": {
"files": "0"
},
"continueOnError": true
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": {
"text": "SignalR",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "2180"
},
"description": {
"text": "The following example shows a C# function that acquires SignalR connection information using the input binding and returns it over HTTP.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "2181"
},
"order": 900,
"icon": "vs-2017.3/functionF.png",
"learnMoreLink": "https://go.microsoft.com/fwlink/?linkid=848145",
"uiFilters": [
"functions"
],
"symbolInfo": [
{
"id": "AccessRights",
"name": {
"id": "2182",
"text": "Authorization level controls whether the function requires an API key and which key to use; Function uses a function key; Admin uses your master key. The function and master keys are found in the 'keys' management panel on the portal, when your function is selected.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
},
{
"id": "HubName",
"name": {
"id": "2183",
"text": "Hub name",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
#if (portalTemplates)
#r "Microsoft.Azure.WebJobs.Extensions.SignalRService"
#endif
#if (vsTemplates)
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
#endif
using Microsoft.Azure.WebJobs.Extensions.SignalRService;

#if (portalTemplates)
public static SignalRConnectionInfo Run(HttpRequest req, SignalRConnectionInfo connectionInfo)
{
return connectionInfo;
}
#endif
#if (vsTemplates)
namespace Company.Function
{
public static class SignalRConnectionInfoHttpTriggerCSharp
{
[FunctionName("negotiate")]
public static SignalRConnectionInfo Negotiate(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
[SignalRConnectionInfo(HubName = "chat")] SignalRConnectionInfo connectionInfo)
[HttpTrigger(AuthorizationLevel.AuthLevelValue, "post")] HttpRequest req,
[SignalRConnectionInfo(HubName = "HubValue")] SignalRConnectionInfo connectionInfo)
{
return connectionInfo;
}
}
}
#endif
}

0 comments on commit b1b4f85

Please sign in to comment.