import { Observable } from 'rxjs' ; import { MaybePromise } from '@osd/utility-types' ; public export interface HttpSetup { /**
     * APIs for manipulating the basePath on URL segments.
     * See  IBasePath basePath : IBasePath ; /**
     * APIs for denoting certain paths for not requiring authentication
     */ anonymousPaths : IAnonymousPaths ; /**
     * Adds a new  HttpInterceptor to the global HTTP client.
     *  param interceptor a  HttpInterceptor returns intercept ( interceptor ) : ( ) => void ; /** Makes an HTTP request. Defaults to a GET request unless overriden. See  HttpHandler for options.  fetch : HttpHandler ; /** Makes an HTTP request with the DELETE method. See  HttpHandler for options.  delete : HttpHandler ; /** Makes an HTTP request with the GET method. See  HttpHandler for options.  get : HttpHandler ; /** Makes an HTTP request with the HEAD method. See  HttpHandler for options.  head : HttpHandler ; /** Makes an HTTP request with the OPTIONS method. See  HttpHandler for options.  options : HttpHandler ; /** Makes an HTTP request with the PATCH method. See  HttpHandler for options.  patch : HttpHandler ; /** Makes an HTTP request with the POST method. See  HttpHandler for options.  post : HttpHandler ; /** Makes an HTTP request with the PUT method. See  HttpHandler for options.  put : HttpHandler ; param countSource$ addLoadingCountSource ( countSource$ ) : void ; /**
     * Get the sum of all loading count sources as a single Observable.
     */ getLoadingCount$ ( ) : Observable < number > ; } /**
 * See  HttpSetup public export type HttpStart = HttpSetup ; public export interface IBasePath { /**
     * Gets the `basePath` string.
     */ get : ( ) => string ; /**
     * Prepends `path` with the basePath.
     */ prepend : ( url : string ) => string ; /**
     * Removes the prepended basePath from the `path`.
     */ remove : ( url : string ) => string ; /**
     * Returns the server's root basePath as configured, without any namespace prefix.
     *
     * See  BasePath . get for getting the basePath value for a specific request
      readonly serverBasePath : string ; } /**
 * APIs for denoting paths as not requiring authentication
 */ export interface IAnonymousPaths { /**
     * Determines whether the provided path doesn't require authentication. `path` should include the current basePath.
     */ isAnonymous ( path ) : boolean ; /**
     * Register `path` as not requiring authentication. `path` should not include the current basePath.
     */ register ( path ) : void ; } /**
 * Headers to append to the request. Any headers that begin with `osd-` are considered private to Core and will cause
 *  HttpHandler to throw an error.
 *  public export interface HttpHeadersInit { [ name ] : any ; } /**
 * Fetch API options available to  HttpHandler s.
 *
 *  internalRemarks public export interface HttpRequestInit { /**
     * A BodyInit object or null to set request's body.
     */ body ? : BodyInit | null ; /**
     * The cache mode associated with request, which is a string indicating how the request will interact with the
     * browser's cache when fetching.
     */ cache ? : RequestCache ; /**
     * The credentials mode associated with request, which is a string indicating whether credentials will be sent with
     * the request always, never, or only when sent to a same-origin URL.
     */ credentials ? : RequestCredentials ; /**  HttpHeadersInit headers ? : HttpHeadersInit ; /**
     * Subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of
     * multiple hashes separated by whitespace.
     */ integrity ? : string ; /** Whether or not request can outlive the global in which it was created. */ keepalive ? : boolean ; /** HTTP method, which is "GET" by default. */ method ? : string ; /**
     * The mode associated with request, which is a string indicating whether the request will use CORS, or will be
     * restricted to same-origin URLs.
     */ mode ? : RequestMode ; /**
     * The redirect mode associated with request, which is a string indicating how redirects for the request will be
     * handled during fetching. A request will follow redirects by default.
     */ redirect ? : RequestRedirect ; /**
     * The referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to
     * indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to
     * determine the value of the `Referer` header of the request being made.
     */ referrer ? : string ; /**
     * The referrer policy associated with request. This is used during fetching to compute the value of the request's
     * referrer.
     */ referrerPolicy ? : ReferrerPolicy ; /**
     * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has
     * been aborted, and its abort event handler.
     */ signal ? : AbortSignal | null ; /**
     * Can only be null. Used to disassociate request from any Window.
     */ window ? : null ; } public export interface HttpFetchQuery { [ key ] : string | number | boolean | undefined | Array < string | number | boolean | undefined > ; } /**
 * All options that may be used with a  HttpHandler .
 *  public export interface HttpFetchOptions extends HttpRequestInit { /**
     * The query string for an HTTP request. See  HttpFetchQuery .
      query ? : HttpFetchQuery ; /**
     * Whether or not the request should automatically prepend the basePath. Defaults to `true`.
     */ prependBasePath ? : boolean ; /**
     * Headers to send with the request. See  HttpHeadersInit .
      headers ? : HttpHeadersInit ; /**
     * Whether or not the request should include the "system request" header to differentiate an end user request from
     * OpenSearch Dashboards internal request.
     * Can be read on the server-side using OpenSearchDashboardsRequest#isSystemRequest. Defaults to `false`.
     */ asSystemRequest ? : boolean ; /**
     * When `true` the return type of  HttpHandler will be an  HttpResponse with detailed request and
     * response information. When `false`, the return type will just be the parsed response body. Defaults to `false`.
      asResponse ? : boolean ; } /**
 * Similar to  HttpFetchOptions but with the URL path included.
 *  public export interface HttpFetchOptionsWithPath extends HttpFetchOptions { path : string ; } /**
 * A function for making an HTTP requests to OpenSearchDashboards's backend. See  HttpFetchOptions for options and
 *  HttpResponse for the response.
 *
 *  param path param options HttpFetchOptions returns a Promise that resolves to a  HttpResponse public export interface HttpHandler { < TResponseBody = any > ( path , options ) : Promise < HttpResponse < TResponseBody > > ; < TResponseBody = any > ( options ) : Promise < HttpResponse < TResponseBody > > ; < TResponseBody = any > ( path , options ? ) : Promise < TResponseBody > ; < TResponseBody = any > ( options ) : Promise < TResponseBody > ; } public export interface HttpResponse < TResponseBody = any > { /** The original  HttpFetchOptionsWithPath used to send this request.  readonly fetchOptions : Readonly < HttpFetchOptionsWithPath > ; /** Raw request sent to OpenSearch Dashboards server. */ readonly request : Readonly < Request > ; /** Raw response received, may be undefined if there was an error. */ readonly response ? : Readonly < Response > ; /** Parsed body received, may be undefined if there was an error. */ readonly body ? : TResponseBody ; } public export interface IHttpResponseInterceptorOverrides < TResponseBody = any > { /** Raw response received, may be undefined if there was an error. */ readonly response ? : Readonly < Response > ; /** Parsed body received, may be undefined if there was an error. */ readonly body ? : TResponseBody ; } public export interface IHttpFetchError extends Error { readonly name : string ; readonly request : Request ; readonly response ? : Response ; deprecated readonly req : Request ; deprecated readonly res ? : Response ; readonly body ? : any ; } public export interface HttpInterceptorResponseError extends HttpResponse { request : Readonly < Request > ; error : Error | IHttpFetchError ; } public export interface HttpInterceptorRequestError { fetchOptions : Readonly < HttpFetchOptionsWithPath > ; error : Error ; } /**
 * An object that may define global interceptor functions for different parts of the request and response lifecycle.
 * See  IHttpInterceptController .
 *
 *  public export interface HttpInterceptor { param request param controller IHttpInterceptController request ? ( fetchOptions , controller ) : MaybePromise < Partial < HttpFetchOptionsWithPath > > | void ; param httpErrorRequest HttpInterceptorRequestError param controller IHttpInterceptController requestError ? ( httpErrorRequest , controller ) : MaybePromise < Partial < HttpFetchOptionsWithPath > > | void ; param httpResponse HttpResponse param controller IHttpInterceptController response ? ( httpResponse , controller ) : MaybePromise < IHttpResponseInterceptorOverrides > | void ; param httpErrorResponse HttpInterceptorResponseError param controller IHttpInterceptController responseError ? ( httpErrorResponse , controller ) : MaybePromise < IHttpResponseInterceptorOverrides > | void ; } /**
 * Used to halt a request Promise chain in a  HttpInterceptor .
 *  public export interface IHttpInterceptController { /** Whether or not this chain has been halted. */ halted : boolean ; /** Halt the request Promise chain and do not process further interceptors or response handlers. */ halt ( ) : void ; }