aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientCodeFile.cshtml
blob: 100171849ca3f0396818ec51f7bade2b5b78a43d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@{
    Tango.CodeGeneration.TangoWebClientCodeFile model = Model as Tango.CodeGeneration.TangoWebClientCodeFile;
}

using System.Threading.Tasks;
using Tango.Web;
using Tango.Web.Authentication;

namespace @(model.Namespace)
{
    /// <summary>
    /// Represents a machine service @(model.ControllerName) web client.
    /// </summary>
    /// <seealso cref="Tango.Web.TangoWebClient" />
    public abstract class @(model.Name) : TangoWebClient<@(model.LoginRequest), @(model.LoginResponse)>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <param name="token">Existing token.</param>
        public @(model.Name)(DeploymentSlot environment, WebToken token) : base(environment, "@(model.ControllerName)", token)
        {
            
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="environment">The environment.</param>
        public @(model.Name)(DeploymentSlot environment) : this(environment, null)
        {

        }

        @foreach (var action in model.Actions)
        {
          <div>
            /// <summary>
            /// Executes the @(action.Name) action and returns @(action.Response).
            /// </summary>
            /// <returns></returns>
            public Task<@(action.Response)> @(action.Name)(@(action.Request) request)
            {
                return Post<@(action.Request), @(action.Response)>("@(action.Name)", request);
            }

          </div>
        }
    }
}