export class RestController {
    async create(feature, options) {
        let headers = {};
        headers['Content-Type'] = 'application/json';
        if (options.token)
            headers['Authorization'] = 'Bearer ' + options.token;
        return await fetch(options.url, {
            body: JSON.stringify(feature),
            headers: headers,
            method: options.method || 'POST',
            mode: options.mode || 'cors'
        });
    }
    static get is() { return "gl-rest-controller"; }
    static get methods() { return {
        "create": {
            "complexType": {
                "signature": "(feature: any, options: RestOptions) => Promise<Response>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }, {
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "Response": {
                        "location": "global"
                    },
                    "RestOptions": {
                        "location": "import",
                        "path": "./interface"
                    }
                },
                "return": "Promise<Response>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
}
