@stackend/api
Version:
JS bindings to api.stackend.com
125 lines • 3.78 kB
TypeScript
import { CommunityActions, CommunityState } from './communityReducer';
import { Thunk } from '../api';
import { Community, GetCommunityResult, SearchCommunityResult, StoreCommunityResult } from './index';
export interface ResourceUsage {
maximumUseBeforeCharge: {
[key: string]: number;
};
resourceUsageLast30Days: {
[key: string]: number;
};
hasPaymentMethod: boolean;
isUserExcludedFromBilling: boolean;
}
/**
* Load communities
*
* @since 24 apr 2017
*
*/
export declare type ReceiveCommunities = {
results: {
pageSize: number;
page: number;
entries: Array<any>;
};
statistics?: any;
};
export declare function receiveCommunities(json: ReceiveCommunities): CommunityActions;
export declare function requestCommunities(status: string): CommunityActions;
/**
* Set the current community
* @param community
* @param objectsRequiringModeration
* @deprecated, use setCurrentCommunity instead
*/
export declare const loadCommunity: typeof setCurrentCommunity;
/**
* Set the current community
* @param community
* @param objectsRequiringModeration
*/
export declare function setCurrentCommunity(community: Community | null | undefined, objectsRequiringModeration?: number): CommunityActions;
export declare function clearCommunities(): CommunityActions;
/**
* Remove all communities from the redux state
* @deprecated use clearCommunities instead
*/
export declare const removeCommunities: typeof clearCommunities;
/**
* Remove the current community from the redux state
* @deprecated use clearCurrentCommunity instead
*/
export declare const removeCommunity: typeof clearCurrentCommunity;
/**
* Remove the current community from the redux state
*/
export declare function clearCurrentCommunity(): CommunityActions;
/**
* Fetch a single community and set it to be the current community
* @param id
* @param permalink
*/
export declare function fetchCommunity({ id, permalink }: {
id?: number;
permalink?: string;
}): Thunk<Promise<GetCommunityResult>>;
export declare type FetchCommunities = {
myCommunities?: boolean;
creatorUserId?: number;
status?: string;
p?: number;
pageSize?: number;
};
/**
* Fetch a list of communities
* @param myCommunities
* @param creatorUserId
* @param status
* @param p
* @param pageSize
*/
export declare function fetchCommunities({ myCommunities, creatorUserId, status, p, pageSize }: FetchCommunities): Thunk<Promise<SearchCommunityResult>>;
/**
* Store a community and update the redux store
* @param id
* @param name
* @param permalink
* @param description
* @param status
* @param locale
* @param domains
* @param defaultUserId
* @param openAIApiKey
*/
export declare function editCommunity({ id, name, permalink, description, status, locale, domains, defaultUserId, openAIApiKey }: {
id?: number;
name: string;
permalink: string;
description: string;
status: string;
locale: string;
domains: any;
defaultUserId: number;
openAIApiKey?: string;
}): Thunk<Promise<StoreCommunityResult>>;
/**
* Load and set the current community
* @param id
* @param permalink
* @param domain
*/
export declare function loadCommunitySettings({ id, permalink, domain }: {
id?: number;
permalink?: string;
domain?: string;
}): Thunk<Promise<GetCommunityResult>>;
export declare function receiveResourceUsage(json: ResourceUsage): CommunityActions;
/**
* Get the number of objets requiring moderation for a given community
* @param communityState
* @param communityId
* @return a number, never null
*/
export declare function getObjectsRequiringModeration(communityState: CommunityState, communityId: number): number;
//# sourceMappingURL=communityAction.d.ts.map