UNPKG

@stackend/api

Version:

JS bindings to api.stackend.com

128 lines 3.99 kB
import { AuthObject } from '../user/privileges'; import { Group, GroupMemberAuth, ListMembersResult, SubscribeResult } from './index'; import { Thunk, XcapJsonResult } from '../api'; import { GroupState } from './groupReducer'; export declare const REQUEST_GROUPS = "REQUEST_GROUPS"; export declare const RECEIVE_GROUPS = "RECEIVE_GROUPS"; export declare const INVALIDATE_GROUPS = "INVALIDATE_GROUPS"; export declare const RECEIVE_GROUPS_AUTH = "RECEIVE_GROUPS_AUTH"; export declare const RECEIVE_GROUP_MEMBERS = "RECEIVE_GROUP_MEMBERS"; export declare type Request = { type: typeof REQUEST_GROUPS; mine?: boolean; }; export declare type Receive = { type: typeof RECEIVE_GROUPS; entries: Array<Group>; mine?: boolean; }; export declare type ReceiveGroup = { type: typeof RECEIVE_GROUPS; entries: Array<Group>; mine?: boolean; }; export declare type Invalidate = { type: typeof INVALIDATE_GROUPS; }; export declare type ReceiveAuth = { type: typeof RECEIVE_GROUPS_AUTH; entries: { [id: number]: AuthObject; }; }; export declare type ReceiveMembers = { type: typeof RECEIVE_GROUP_MEMBERS; groupMembers: { [key: number]: Array<GroupMemberAuth>; }; }; export declare type GroupActions = Request | Receive | ReceiveGroup | Invalidate | ReceiveAuth | ReceiveMembers; /** * Fetch my groups * @param refresh */ export declare function fetchMyGroups(refresh?: boolean): Thunk<Promise<void>>; /** * Get my groups from * @param groups */ export declare function getMyGroups(groups: GroupState): Array<Group>; /** * Get a group by id from the store * @param groups * @param id */ export declare function getGroupById(groups: GroupState, id: number): Group | null; /** * Get a group by permalink from the store * @param groups * @param permalink */ export declare function getGroupByPermalink(groups: GroupState, permalink: string): Group | null; /** * Request a group */ export declare function fetchGroup({ groupPermalink, groupId, refresh }: { groupPermalink?: string; groupId?: number; refresh?: boolean; }): Thunk<Promise<Group | null>>; /** * Request a group * @deprecated use fetchGroup instead */ export declare const addGroup: typeof fetchGroup; /** * Subscribe to a group * @param groupPermalink * @param groupId */ export declare function subscribe({ groupPermalink, groupId }: { groupPermalink?: string; groupId?: number; }): Thunk<Promise<SubscribeResult>>; /** * Unsubscribe from a group * @param groupPermalink * @param groupId */ export declare function unsubscribe({ groupPermalink, groupId }: { groupPermalink?: string; groupId?: number; }): Thunk<Promise<XcapJsonResult>>; export interface ApplyForMembership { groupPermalink: string; groupId: number; } export declare function applyForMembership({ groupPermalink, groupId }: ApplyForMembership): Thunk<Promise<XcapJsonResult>>; export declare function requestGroups(mine?: boolean): Request; export interface ReceiveGroups { entries: Array<Group>; mine?: boolean; } export declare function receiveGroups({ entries, mine }: ReceiveGroups): Receive; export declare function invalidateGroups(): Invalidate; declare type ReceiveGroupsAuth = { entries: { [key: number]: AuthObject; }; }; /** * Receives a list of the current users auth-status for all groups the user is part of. */ export declare function receiveGroupsAuth({ entries }: ReceiveGroupsAuth): ReceiveAuth; declare type ReceiveGroupMembers = { groupMembers: { [key: number]: Array<GroupMemberAuth>; }; }; export declare function receiveGroupMembers({ groupMembers }: ReceiveGroupMembers): ReceiveMembers; /** * Requests and receive comments and store them in redux-state */ export declare function fetchGroupMembers({ groupId, groupPermalink }: { groupId?: number; groupPermalink?: string; }): Thunk<Promise<ListMembersResult>>; export {}; //# sourceMappingURL=groupActions.d.ts.map