UNPKG

@uprtcl/http-provider

Version:

_Prtcl provider wrappers around the native fetch api

29 lines (28 loc) 1.41 kB
import { Logger } from '@uprtcl/evees'; import { HttpAuthentication } from './auth/http.authentication'; import { AuthTokenStorage } from './auth/http.token.store'; import { HttpAuthenticatedConnection } from './http.auth.connection.if'; import { PostResult } from './http.connection'; /** Exposes wrappers to FETCH methods, and injects the header authentication * credentials (provided by HttpAuthentication service) */ export declare class HttpAuthenticatedConnectionImp implements HttpAuthenticatedConnection { readonly host: string; protected authentication?: HttpAuthentication | undefined; logger: Logger; tokenStore: AuthTokenStorage; constructor(host: string, authentication?: HttpAuthentication | undefined, tokenStorageId?: string, userStorageId?: string); get userId(): string | undefined; login(): Promise<void>; connect(): Promise<void>; isConnected(): Promise<boolean>; disconnect(): Promise<void>; isLogged(): Promise<boolean>; logout(): Promise<void>; get headers(): HeadersInit; get<T>(url: string): Promise<T>; getWithPut<T>(url: string, body: any): Promise<T>; put(url: string, body: any): Promise<PostResult>; post(url: string, body: any): Promise<PostResult>; delete(url: string, body?: any): Promise<PostResult>; putOrPost(url: string, body: any, method: string): Promise<PostResult>; }