From 9736b8c8ede6a0d121dea8381f0abb561fad5631 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 19 Feb 2019 01:50:58 +0200 Subject: Implemented auto generated web clients for PPC and machine studio. Improved interactions with web clients across solutions. --- .../Templates/TangoWebClientCodeFile.cshtml | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml') diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml new file mode 100644 index 000000000..100171849 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml @@ -0,0 +1,51 @@ +@{ + Tango.CodeGeneration.TangoWebClientCodeFile model = Model as Tango.CodeGeneration.TangoWebClientCodeFile; +} + +using System.Threading.Tasks; +using Tango.Web; +using Tango.Web.Authentication; + +namespace @(model.Namespace) +{ + /// + /// Represents a machine service @(model.ControllerName) web client. + /// + /// + public abstract class @(model.Name) : TangoWebClient<@(model.LoginRequest), @(model.LoginResponse)> + { + /// + /// Initializes a new instance of the class. + /// + /// The environment. + /// Existing token. + public @(model.Name)(DeploymentSlot environment, WebToken token) : base(environment, "@(model.ControllerName)", token) + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The environment. + public @(model.Name)(DeploymentSlot environment) : this(environment, null) + { + + } + + @foreach (var action in model.Actions) + { +
+ /// + /// Executes the @(action.Name) action and returns @(action.Response). + /// + /// + public Task<@(action.Response)> @(action.Name)(@(action.Request) request) + { + return Post<@(action.Request), @(action.Response)>("@(action.Name)", request); + } + +
+ } + } +} \ No newline at end of file -- cgit v1.3.1