import { AjaxRequest, Observable } from 'rxjs'; import { ObservableLike } from '../WebRx'; export enum HttpRequestMethod { GET, POST, PUT, DELETE, PATCH, } export interface ObservableApiError { uri?: string; message: string; messageDetail?: string; code?: number; reason?: string; response?: any; } export type SampleDataAction = ( params?: any, data?: any, ) => ObservableLike<{} | undefined>; export type SampleDataActionSet = StringMap; export interface SampleDataStore { readonly actions: SampleDataActionSet; } export interface SampleDataApi { observe( action: string, params?: any, data?: any, cloneResult?: boolean, ): Observable; getStoreValue( name: string, selector: (store: TStore) => T, ): T | undefined; } export type SampleDataCreator = () => SampleDataApi; export interface StoreApi { readonly path: string; readonly base: string; readonly baseUri: string; observe( action: string, params?: any, data?: any, method?: HttpRequestMethod, options?: AjaxRequest, baseUri?: string, ): Observable; getObservable( action: string, params?: any, options?: AjaxRequest, baseUri?: string, ): Observable; postObservable( action: string, data?: any, params?: any, options?: AjaxRequest, baseUri?: string, ): Observable; getSampleStoreValue( name: string, selector: (data: TStore) => T, ): T | undefined; } export interface Store { readonly api: StoreApi; }