@stackend/api
Version:
JS bindings to api.stackend.com
82 lines • 2.67 kB
TypeScript
import * as commentAction from './commentAction';
import * as commentsApi from './index';
import { CommentModule, CommentSortCriteria } from './index';
import SortOrder from '../api/SortOrder';
export declare const REQUEST_GROUP_COMMENTS = "REQUEST_GROUP_COMMENTS";
export declare const RECEIVE_GROUP_COMMENTS = "RECEIVE_GROUP_COMMENTS";
export declare const REQUEST_COMMENTS = "REQUEST_COMMENTS";
export declare const RECEIVE_COMMENTS = "RECEIVE_COMMENTS";
export declare const UPDATE_COMMENT = "UPDATE_COMMENT";
export declare const INVALIDATE_GROUP_COMMENTS = "INVALIDATE_GROUP_COMMENTS";
export declare const COMMENT_REMOVED = "COMMENT_REMOVED";
export interface CommentCollectionState {
isFetching: boolean;
didInvalidate: boolean;
lastUpdated: number;
entries: Array<commentsApi.Comment>;
}
export interface CommentsState {
/**
* Comments, arranged by getCommentsStateKey()
*/
[commentsStateKey: string]: {
isFetching: boolean;
didInvalidate: boolean;
lastUpdated: number;
json: {
likesByCurrentUser: any;
comments: {
[referenceId: number]: CommentCollectionState;
};
error?: string;
};
};
}
export interface CommonParameters {
module: CommentModule;
referenceId: number;
referenceGroupId: number;
commentSortCriteria: CommentSortCriteria;
order: SortOrder;
}
export declare type CommentsActions = {
type: typeof REQUEST_GROUP_COMMENTS;
module: CommentModule;
referenceGroupId: number;
commentSortCriteria: CommentSortCriteria;
order: SortOrder;
} | {
type: typeof RECEIVE_GROUP_COMMENTS;
module: CommentModule;
referenceGroupId: number;
receivedAt: number;
json: {
comments: any;
likesByCurrentUser: any;
};
commentSortCriteria: CommentSortCriteria;
order: SortOrder;
} | {
type: typeof INVALIDATE_GROUP_COMMENTS;
module: CommentModule;
referenceGroupId: number;
commentSortCriteria: CommentSortCriteria;
order: SortOrder;
} | (CommonParameters & {
type: typeof REQUEST_COMMENTS;
}) | (CommonParameters & {
type: typeof RECEIVE_COMMENTS;
receivedAt: number;
json: commentAction.ReceiveCommentsJson;
}) | (CommonParameters & {
type: typeof UPDATE_COMMENT;
id: number;
receivedAt: number;
json: commentsApi.Comment;
}) | (CommonParameters & {
type: typeof COMMENT_REMOVED;
id: number;
});
export declare function GroupComments(state: CommentsState | undefined, action: CommentsActions): CommentsState;
export default GroupComments;
//# sourceMappingURL=commentReducer.d.ts.map