Update code to allow struct with one generic parameter
This commit is contained in:
		@@ -18,17 +18,17 @@ export interface @s.name @{
 | 
			
		||||
export class MRPCConnector @{
 | 
			
		||||
    url: string;
 | 
			
		||||
 | 
			
		||||
    private __create_msg(service: string, method: string, data: any) @{
 | 
			
		||||
        return @{service, method, data@};
 | 
			
		||||
    @}
 | 
			
		||||
 | 
			
		||||
    public constructor(url: string) @{
 | 
			
		||||
        this.url = url;
 | 
			
		||||
    @}
 | 
			
		||||
 | 
			
		||||
@for s in &rpc.services { @for m in &s.methods {
 | 
			
		||||
    public @(s.name)_@(m.name)(@method_args(m))@method_ret(m) @{
 | 
			
		||||
        const __msg = @{
 | 
			
		||||
            service: '@s.name',
 | 
			
		||||
            method: '@m.name',
 | 
			
		||||
            data: @{@m.args.iter().map(|a| &a.name).join(",")@}
 | 
			
		||||
        @};
 | 
			
		||||
        const __msg = this.__create_msg('@s.name', '@m.name', @{@m.args.iter().map(|a| &a.name).join(",")@});
 | 
			
		||||
        @if m.ret.is_some() && !m.ret_stream {return fetch(this.url, @{
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            body: JSON.stringify(__msg)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user