﻿using System;
using System.Net.Http;
{{#UsingList}}
using {{Item}};
{{/UsingList}}

{{#ClassList}}
namespace {{Namespace}}
{
    public class AutoGeneratedImpl__{{InterfaceName}} : {{InterfaceName}}
    {
        readonly HttpClient client;
        readonly Dictionary<string, Func<HttpClient, object[], object>> methodImpls;

        public AutoGeneratedImpl__{{InterfaceName}}(HttpClient client, IRequestBuilder requestBuilder)
        {
            methodImpls = requestBuilder.InterfaceHttpMethods.ToDictionary(k => k, v => requestBuilder.BuildRestResultFuncForMethod(v));
            this.client = client;
        }

{{#MethodList}}
        public {{ReturnType}} {{Name}}({{ArgumentListWithTypes}})
        {
            var arguments = new object[] { {{ArgumentList}} };
            return ({{ReturnType}}) methodImpls["{{Name}}"](client, arguments);
        }
{{/MethodList}}
    }
}

{{/ClassList}}
﻿using System;
using System.Net.Http;
{{#UsingList}}
using {{Item}};
{{/UsingList}}

/* Hey You!
 *
 * This is a generated file, and gets rewritten every time you build the
 * project. If you want to edit it, you need to edit the mustache template
 * in the Refit package */

{{#ClassList}}
namespace {{Namespace}}
{
    public partial class AutoGenerated{{InterfaceName}} : {{InterfaceName}}
    {
        readonly HttpClient client;
        readonly Dictionary<string, Func<HttpClient, object[], object>> methodImpls;

        public AutoGenerated{{InterfaceName}}(HttpClient client, IRequestBuilder requestBuilder)
        {
            methodImpls = requestBuilder.InterfaceHttpMethods.ToDictionary(k => k, v => requestBuilder.BuildRestResultFuncForMethod(v));
            this.client = client;
        }

{{#MethodList}}
        public {{ReturnType}} {{Name}}({{ArgumentListWithTypes}})
        {
            var arguments = new object[] { {{ArgumentList}} };
            return ({{ReturnType}}) methodImpls["{{Name}}"](client, arguments);
        }
{{/MethodList}}
    }
}

{{/ClassList}}
Write a comment hint, and make the built class partial so people can bolt things into it in a pinch
Write a comment hint, and make the built class partial so people can bolt things into it in a pinch
