



// Code generated by RonyKIT Stub Generator (TypeScript); DO NOT EDIT.



// ErrorMessage is a data transfer object
	export interface ErrorMessage {
	code: number
	item: string
}
// KeyValue is a data transfer object
	export interface KeyValue {
	key: string
	value: number
}
// SimpleHdr is a data transfer object
	export interface SimpleHdr {
	sKey1: string
	sKey2: number
	t1: string
	t2: string| null
	t3: string| null
}
// VeryComplexRequest is a data transfer object
export interface VeryComplexRequest extends SimpleHdr { 
	key1: string
	key1Ptr: string| null
	key2Ptr?: number
	mapKey1: {[key: string]: number}| null
	mapKey2: {[key: number]: KeyValue}| null
	sliceKey1: boolean[]| null
	sliceKey2: KeyValue[]| null
	rawKey: any| null
}
// VeryComplexResponse is a data transfer object
	export interface VeryComplexResponse {
	key1?: string
	key1Ptr?: string
	mapKey1?: {[key: string]: number}
	mapKey2?: {[key: number]: KeyValue}
	sliceKey1: string| null
	sliceKey2: KeyValue[]| null
	-: number
	printer: any
}




export class sampleServiceStub {
	readonly serverURL: string;

	constructor(serverURL: string) {
		this.serverURL = serverURL.replace(/\/$/, '');
	}

	
// @ts-ignore
	async complexDummy(req: VeryComplexRequest, headers?: HeadersInit): Promise<VeryComplexResponse> {
		return fetch(this.serverURL + `/complexDummy`, {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				...headers,
			},
			body: JSON.stringify(req)
		}).then((res: Response) => {
			if (res.status !== 200) {
				throw new Error("Failed to fetch the data");
			}

			return res.json()
		})
	}
// @ts-ignore
	async complexDummy2(req: VeryComplexRequest, headers?: HeadersInit): Promise<VeryComplexResponse> {
		return fetch(this.serverURL + `/complexDummy/${req.key1}`, {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				...headers,
			},
			body: JSON.stringify(req)
		}).then((res: Response) => {
			if (res.status !== 200) {
				throw new Error("Failed to fetch the data");
			}

			return res.json()
		})
	}
// @ts-ignore
	async getComplexDummy(req: VeryComplexRequest, headers?: HeadersInit): Promise<VeryComplexResponse> {
		const keys = Object.keys(req);
		const keyValuePairs = keys
			.filter((key) => ((req as any)[key] !== undefined && (req as any)[key] !== null))
			.map(key => {
				return encodeURIComponent(key) + '=' + encodeURIComponent((req as any)[key]);
			}).join('&');
		const queryParams = (keyValuePairs.length > 0) ? `?${keyValuePairs}` : ""
		const url = `${this.serverURL}/complexDummy/${req.key1}/xs/${req.sKey1}${queryParams}`;
		return fetch(url, {
			method: "GET",
			headers: {
				"Content-Type": "application/json",
				...headers,
			}
		}).then((res: Response) => {
			if (res.status !== 200) {
				throw new Error("Failed to fetch the data");
			}

			return res.json()
		})
	}

} // end of sampleServiceStub



