@companydna/rcp-client
Version:
RCP Client npm package
91 lines (81 loc) • 2.08 kB
TypeScript
type ConnectionParam = {
key: string;
info: string;
options?: string[];
};
type ConnectionCredential = {
connectionId: string;
params: ConnectionParam[];
};
declare enum AppStatus {
None = "",
Verified = "Verified",
InReview = "InReview",
Unverified = "Unverified"
}
declare enum CompanyUserAppStatus {
None = "",
Approved = "Approved",
Declined = "Declined",
InProgress = "InProgress"
}
declare enum CompanyUserAppStatus {
SYNC_DATA_RESULT = 2,
UPLOAD_FILES = 3,
CREATE_INDEX = 4,
DELETE_DATA_AND_INDEX = 5,
STREAM_RESULT = 7
}
type App = {
id: number;
name: string;
description: string;
important: string;
limitations: string;
params: ConnectionParam[];
auth_type: string;
integration_id: string;
logo: string;
status: AppStatus;
published: boolean;
is_source_available: number;
};
type CompanyUserApp = {
id: number;
company_id: number;
company_user_id: number;
app_id: number;
credentials: string;
status: CompanyUserAppStatus;
};
type ConnectUserAppResponse = {
success: boolean;
message: string;
companyUserApp?: CompanyUserApp;
};
type SyncUserAppDataResponse = {
success: boolean;
message: string;
};
type GetAppResponse = {
success: boolean;
message: string;
apps?: App[];
};
interface RCPConfig {
secretKey: string;
socketUrl?: string;
}
declare class RCP {
private secretKey;
constructor(config: RCPConfig);
getApps(): Promise<GetAppResponse>;
connectUserApp(app: App, userId: number, credential?: ConnectionCredential): Promise<ConnectUserAppResponse>;
syncUserAppData(app: App, userId: number): Promise<SyncUserAppDataResponse>;
deleteCompanyUserApp(app: App, userId: number): Promise<SyncUserAppDataResponse>;
deleteCompanyUser(userId: number): Promise<SyncUserAppDataResponse>;
subscribeSocket(handler: (message: any) => void): void;
unsubscribeSocket(handler: (message: any) => void): void;
closeSocket(): void;
}
export { RCP };