UNPKG

opds-web-client

Version:
165 lines (164 loc) 4.67 kB
import DataFetcher from "./DataFetcher"; import { CollectionData, BookData, SearchData, FetchErrorData, AuthCallback, AuthCredentials, AuthProvider, AuthMethod } from "./interfaces"; export interface LoadCollectionAction { type: string; data: CollectionData; url?: string; } export default class ActionCreator { private fetcher; FETCH_COLLECTION_REQUEST: string; FETCH_COLLECTION_SUCCESS: string; FETCH_COLLECTION_FAILURE: string; LOAD_COLLECTION: string; CLEAR_COLLECTION: string; FETCH_PAGE_REQUEST: string; FETCH_PAGE_SUCCESS: string; FETCH_PAGE_FAILURE: string; LOAD_PAGE: string; FETCH_BOOK_REQUEST: string; FETCH_BOOK_SUCCESS: string; FETCH_BOOK_FAILURE: string; LOAD_BOOK: string; CLEAR_BOOK: string; LOAD_SEARCH_DESCRIPTION: string; CLOSE_ERROR: string; UPDATE_BOOK_REQUEST: string; UPDATE_BOOK_SUCCESS: string; UPDATE_BOOK_FAILURE: string; LOAD_UPDATE_BOOK_DATA: string; FULFILL_BOOK_REQUEST: string; FULFILL_BOOK_SUCCESS: string; FULFILL_BOOK_FAILURE: string; FETCH_LOANS_REQUEST: string; FETCH_LOANS_SUCCESS: string; FETCH_LOANS_FAILURE: string; LOAD_LOANS: string; SHOW_AUTH_FORM: string; HIDE_AUTH_FORM: string; SAVE_AUTH_CREDENTIALS: string; CLEAR_AUTH_CREDENTIALS: string; constructor(fetcher: DataFetcher); fetchCollection(url: string): (dispatch: any) => Promise<CollectionData>; fetchPage(url: string): (dispatch: any) => Promise<{}>; fetchBook(url: string): (dispatch: any) => Promise<{}>; fetchSearchDescription(url: string): (dispatch: any) => Promise<{}>; fetchCollectionRequest(url: string): { type: string; url: string; }; fetchCollectionSuccess(): { type: string; }; fetchCollectionFailure(error?: FetchErrorData): { type: string; error: FetchErrorData; }; loadCollection(data: CollectionData, url?: string): LoadCollectionAction; fetchPageRequest(url: string): { type: string; url: string; }; fetchPageSuccess(): { type: string; }; fetchPageFailure(error?: FetchErrorData): { type: string; error: FetchErrorData; }; loadPage(data: CollectionData): { type: string; data: CollectionData; }; clearCollection(): { type: string; }; loadSearchDescription(data: SearchData): { type: string; data: SearchData; }; closeError(): { type: string; }; fetchBookRequest(url: string): { type: string; url: string; }; fetchBookSuccess(): { type: string; }; fetchBookFailure(error?: FetchErrorData): { type: string; error: FetchErrorData; }; loadBook(data: BookData, url: string): { type: string; data: BookData; url: string; }; clearBook(): { type: string; }; updateBook(url: string): (dispatch: any) => Promise<BookData>; updateBookRequest(): { type: string; }; updateBookSuccess(): { type: string; }; updateBookFailure(error: any): { type: string; error: any; }; loadUpdateBookData(data: any): { type: string; data: any; }; fulfillBook(url: string): (dispatch: any) => Promise<Blob>; indirectFulfillBook(url: string, type: string): (dispatch: any) => Promise<string>; fulfillBookRequest(): { type: string; }; fulfillBookSuccess(): { type: string; }; fulfillBookFailure(error: any): { type: string; error: any; }; fetchLoans(url: string): (dispatch: any) => Promise<{}>; fetchLoansRequest(url: string): { type: string; url: string; }; fetchLoansSuccess(): { type: string; }; fetchLoansFailure(error?: FetchErrorData): { type: string; error: FetchErrorData; }; loadLoans(books: BookData[]): { type: string; books: BookData[]; }; showAuthForm(callback: AuthCallback, cancel: () => void, providers: AuthProvider<AuthMethod>[], title: string, error?: string): { type: string; callback: AuthCallback; cancel: () => void; providers: AuthProvider<AuthMethod>[]; title: string; error: string; }; closeErrorAndHideAuthForm(): (dispatch: any) => void; hideAuthForm(): { type: string; }; saveAuthCredentials(credentials: AuthCredentials): { type: string; credentials: AuthCredentials; }; clearAuthCredentials(): { type: string; }; }