@stackend/api
Version:
JS bindings to api.stackend.com
113 lines • 3.73 kB
TypeScript
import { Category } from '../category';
import { Thunk } from '../api';
import { GetCommentResult, GetMultipleCommentsResult } from '../comments';
import { GroupBlogEntriesActions, UpdateBlogEntry } from './groupBlogEntriesReducer';
import { GetBlogEntryResult, GetEntriesResult, SaveBlogEntryInput, SaveEntryResult, SetEntryStatus } from './index';
/**
* Load comments in a group and for a specific blogEntry
*
* @since 15 fen 2017
* @author pelle
*/
/**
* When loading comments receive is run when the server has responded
* @param blogKey
* @param json
*/
export declare function receiveBlogEntries(blogKey: string, json: GetEntriesResult): GroupBlogEntriesActions;
/**
* Discard cached blog entries
* @param blogKey
*/
export declare function cleanCacheBlogEntries({ blogKey }: {
blogKey: string;
}): GroupBlogEntriesActions;
/**
* Request comments from the server
* @param blogKey
*/
export declare function requestBlogEntries(blogKey: string): GroupBlogEntriesActions;
/**
* Update already existing blog entry.
* Only the last BlogEntry of json.resultPaginated.entries will be updated.
*/
export declare function updateBlogEntry(blogKey: string, json: UpdateBlogEntry): GroupBlogEntriesActions;
export interface FetchBlogEntries {
blogKey: string;
pageSize?: number;
p?: number;
categories?: Array<Category>;
invalidatePrevious?: boolean;
goToBlogEntry?: string;
tags?: string[];
}
/**
* Requests and receive blog entries and store them in redux-state
*/
export declare function fetchBlogEntries({ blogKey, pageSize, p, categories, invalidatePrevious, goToBlogEntry, tags }: FetchBlogEntries): Thunk<Promise<GetEntriesResult | null>>;
/**
* Requests and receive entries and store them in redux-state
*/
export declare function fetchBlogEntry({ id, permalink, blogKey }: {
id?: number;
permalink?: string;
blogKey: string;
}): Thunk<Promise<GetBlogEntryResult | null>>;
export interface FetchBlogEntriesWithComments {
blogKey: string;
page?: number;
categories?: Array<Category>;
goToBlogEntry?: string;
invalidatePrevious?: boolean;
tags?: string[];
}
export interface FetchBlogEntriesWithCommentsResult {
fetchBlogEntries: GetEntriesResult | null;
fetchMultipleComments: GetMultipleCommentsResult | null;
}
/**
* Fetch blog entries and their comments
* @param blogKey
* @param page
* @param categories
* @param goToBlogEntry
* @param invalidatePrevious
*/
export declare function fetchBlogEntriesWithComments({ blogKey, page, categories, goToBlogEntry, invalidatePrevious, tags }: FetchBlogEntriesWithComments): Thunk<Promise<FetchBlogEntriesWithCommentsResult>>;
export interface FetchBlogEntryWithCommentsResult {
fetchBlogEntry: GetBlogEntryResult | null;
fetchComments: GetCommentResult | null;
}
/**
* Fetch a blog entry and its comments
* @param id
* @param permalink
* @param blogKey
*/
export declare function fetchBlogEntryWithComments({ id, permalink, blogKey }: {
id?: number;
permalink?: string;
blogKey: string;
}): Thunk<Promise<FetchBlogEntryWithCommentsResult>>;
/**
* Edit or create a blog entry.
*
* @param blogEntryInput
* @param type
* @param draftId
* @param blogKey
*/
export declare function postBlogEntry({ blogEntryInput, type, draftId, blogKey }: {
blogEntryInput: SaveBlogEntryInput;
type: 'PUBLISHED' | '';
blogKey: string;
draftId?: number;
}): Thunk<Promise<SaveEntryResult>>;
/**
* Set the {@link BlogEntryStatus} of an entry.
* @param blogKey
* @param id
* @param status
*/
export declare function changeBlogEntryStatus({ blogKey, id, status }: SetEntryStatus): Thunk<Promise<void>>;
//# sourceMappingURL=groupBlogEntriesActions.d.ts.map