import { HttpSetup , HttpResponse } from 'kibana/public' ; import { API_BASE_PATH } from '../../../common/constants' ; import { Cluster } from '../../../common/lib' ; let _httpClient ; export interface SendGetOptions { asSystemRequest ? : boolean ; } export function init ( httpClient ) { _httpClient = httpClient ; } export function getFullPath ( path ? ) { if ( path ) { return `${ API_BASE_PATH }/${ path }` ; } return API_BASE_PATH ; } export function sendPost ( path , payload ) { return _httpClient . post ( getFullPath ( path ) , { body : JSON . stringify ( payload ) , } ) ; } export function sendGet ( path ? , { asSystemRequest } = { } ) { return _httpClient . get ( getFullPath ( path ) , { asSystemRequest } ) ; } export function sendPut ( path , payload ) { return _httpClient . put ( getFullPath ( path ) , { body : JSON . stringify ( payload ) , } ) ; } export function sendDelete ( path ) { return _httpClient . delete ( getFullPath ( path ) ) ; }