export class RestController {
  /**
   * Makes a request to a features REST API. It resolves to the server
   * response object.
   * @param feature GeoJSON feature to be sent to the API.
   * @param options Options object.
   */
  async create(feature, options) {
    let headers = {};
    headers["Content-Type"] = "application/json";
    if (options.token != undefined)
      headers["Authorization"] = "Bearer " + options.token;
    return await fetch(options.url, {
      body: options.method === "GET" ? undefined : 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": [{
                  "name": "param",
                  "text": "feature GeoJSON feature to be sent to the API."
                }],
              "text": "GeoJSON feature to be sent to the API."
            }, {
              "tags": [{
                  "name": "param",
                  "text": "options Options object."
                }],
              "text": "Options object."
            }],
          "references": {
            "Promise": {
              "location": "global",
              "id": "global::Promise"
            },
            "Response": {
              "location": "global",
              "id": "global::Response"
            },
            "RestOptions": {
              "location": "import",
              "path": "./interface",
              "id": "src/components/rest-controller/interface.ts::RestOptions"
            }
          },
          "return": "Promise<Response>"
        },
        "docs": {
          "text": "Makes a request to a features REST API. It resolves to the server\nresponse object.",
          "tags": [{
              "name": "param",
              "text": "feature GeoJSON feature to be sent to the API."
            }, {
              "name": "param",
              "text": "options Options object."
            }]
        }
      }
    };
  }
}
//# sourceMappingURL=rest-controller.js.map
