aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml
blob: cfcc89716ca3da610715f5744a25ea1862aaa38d (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
52
53
54
55
56
57
58
59
@{
    Tango.CodeGeneration.TangoWebClientv2CodeFile model = Model as Tango.CodeGeneration.TangoWebClientv2CodeFile;
}
using System;
using System.Threading.Tasks;
using Tango.Web;

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

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

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="cloned">Other instance.</param>
        public @(model.Name)(@(model.Name) cloned) : base(cloned)
        {

        }

        @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>
        }
    }
}