@datalayer/core
Version:
**Datalayer Core**
307 lines (306 loc) • 17.8 kB
TypeScript
import { IAnyOrganization, IAnySpace, IAssignment, ICell, IContact, ICourse, IDataset, IDatasource, IDocument, IEnvironment, IExercise, IIAMToken, IInbound, IInvite, IItemType, ILesson, ILinkedInUser, INotebook, IOrganization, IOutbound, IPage, ISchool, ISecret, ISpaceItem, IStudent, ITeam, IUsage, IUser, IUserOnboarding, IUserSettings, LinkedInUser, WaitingListFormData } from "../models";
import { IPrice } from "./../components/checkout";
import { type IRESTBaseResponse } from '../models';
type CacheProps = {
loginRoute?: string;
};
type ISearchOpts = {
q: string;
types: string[];
max: number;
public: boolean;
};
/**
* Callbacks to RUN service.
*
* It assumes to be used within a {@link Router} component. If not
* you must set the options `loginRoute` to `null` (raise an error _Unauthorized_
* instead of redirecting to the login page).
*/
export declare const useCache: ({ loginRoute }?: CacheProps) => {
addMemberToOrganization: (organizationId: string, userId: string) => Promise<any>;
addMemberToOrganizationSpace: (organizationId: string, spaceId: string, accountId: string) => Promise<any>;
addMemberToTeam: (teamId: string, userId: string) => Promise<any>;
addRoleToOrganizationMember: (organizationId: string, userId: string, roleName: string) => Promise<any>;
addRoleToTeamMember: (teamId: string, userId: string, roleName: string) => Promise<any>;
assignRoleToUser: (userId: any, roleName: any) => Promise<any>;
assignTagToContact: (contactId: any, tagName: any) => Promise<any>;
burnCredit: (credits: any) => Promise<any>;
changePassword: (handle: any, password: any, passwordConfirm: any) => Promise<any>;
clearAllCaches: () => void;
clearCachedDatasources: () => void;
clearCachedInvites: () => void;
clearCachedItems: () => void;
clearCachedOrganizations: () => void;
clearCachedPages: () => void;
clearCachedPublicItems: () => void;
clearCachedSecrets: () => void;
clearCachedTeams: () => void;
clearCachedTokens: () => void;
cloneAssignment: (assignmentId: string) => Promise<any>;
cloneCell: (cellId: string) => Promise<any>;
cloneDocument: (documentId: string) => Promise<any>;
cloneExercise: (exerciseId: string) => Promise<any>;
cloneLesson: (lessonId: string) => Promise<any>;
cloneNotebook: (notebookId: string) => Promise<any>;
confirmCourseItemCompletion: (courseId: any, itemType: IItemType, itemId: string, completed: boolean) => Promise<any>;
confirmEmailUpdate: (token: any) => Promise<any>;
confirmJoinWithToken: (userHandle: any, token: any) => Promise<any>;
confirmPassworkWithToken: (userHandle: any, token: any) => Promise<any>;
createCheckoutSession: (product: any, location: any) => Promise<any>;
createContact: (contact: IContact) => Promise<any>;
createDatasource: (datasource: Omit<IDatasource, "id">) => Promise<any>;
createOrganization: (organization: Partial<IOrganization>) => Promise<any>;
createPage: (page: Omit<IPage, "id">) => Promise<any>;
createSecret: (secret: Omit<ISecret, "id">) => Promise<any>;
createSpace: (space: Partial<IAnySpace>, organization?: IAnyOrganization) => Promise<any>;
createTeam: (team: Partial<ITeam>, organization: IAnyOrganization) => Promise<any>;
createToken: (token: Omit<IIAMToken, "id" | "value">) => Promise<any>;
createTokenForPasswordChange: (handle: any, password: any, passwordConfirm: any) => Promise<any>;
deleteContact: (contactId: string) => Promise<any>;
deleteItem: (itemId: string) => Promise<any>;
deleteOutbound: (outboundId: string) => Promise<any>;
deletePage: (page: IPage) => Promise<any>;
deleteSecret: (secret: ISecret) => Promise<any>;
disableUserMFA: () => Promise<any>;
draftBulkEmailsOutbounds: (params: any) => Promise<any>;
enableUserMFA: () => Promise<any>;
enrichContactEmail: (contactId: any, useDomain: any) => Promise<any>;
enrichContactLinkedin: (contactId: any) => Promise<any>;
enrollStudentToCourse: (courseId: string, studentId: string) => Promise<any>;
exportSpace: (spaceId: string) => Promise<any>;
getAssignment: (assignmentId: any) => IAssignment | undefined;
getAssignmentForStudent: (assignmentId: string) => IAssignment | undefined;
getAssignmentStudentVersion: (assignmentId: any) => Promise<any>;
getCell: (id: string) => ICell | undefined;
getContactByHandle: (contactHandle: string) => IContact | undefined;
getContactById: (contactId: string) => IContact | undefined;
getCourse: (courseId: string) => ICourse | undefined;
getCoursesEnrollments: () => ICourse[];
getDataset: (id: any) => IDataset | undefined;
getDatasource: (datasourceId: string) => IDatasource | undefined;
getDatasources: () => IDatasource[];
getDocument: (id: any) => IDocument | undefined;
getEnvironment: (id: string) => IEnvironment | undefined;
getExercise: (id: string) => IExercise | undefined;
getGitHubProfile: (accessToken: string) => Promise<any>;
getGrowthKPI: () => Promise<any>;
getInbound: (id: string) => IInbound | undefined;
getInboundByHandle: (handle: string) => IInbound | undefined;
getInbounds: () => Promise<any>;
getInstructorCourses: () => ICourse[];
getInvite: (token: string) => IInvite | undefined;
getInvites: () => IInvite[];
getLesson: (id: any) => ILesson | undefined;
getLinkedinProfile: (accessToken: string) => Promise<LinkedInUser>;
getMe: (token?: string) => Promise<IUser | null>;
getNotebook: (notebookId: any) => INotebook | undefined;
getOAuth2AuthorizationLinkURL: (queryArgs: Record<string, string>) => Promise<{
success: boolean;
autorization_url: string;
}>;
getOAuth2AuthorizationURL: (queryArgs: Record<string, string>) => Promise<{
success: boolean;
autorization_url: string;
}>;
getOrganizationByHandle: (organizationHandle: string) => IOrganization | undefined;
getOrganizationById: (organizationId: string) => IOrganization | undefined;
getOrganizationSpace: (organizationId: string, spaceId: string) => IAnySpace | undefined;
getOrganizationSpaceByHandle: (organizationHandle: string, spaceHandle: string) => IAnySpace | undefined;
getOrganizationSpaces: (organizationId: string) => IAnySpace[];
getOutbound: (id: string) => IOutbound | undefined;
getOutbounds: () => Promise<any>;
getPage: (pageId: string) => IPage | undefined;
getPages: () => IPage[];
getPlatformUsages: () => Promise<{
success: boolean;
message: string;
usages?: IUsage[];
}>;
getPublicCourses: () => ICourse[];
getPublicItems: () => ISpaceItem[];
getSchools: () => ISchool[];
getSecret: (secretId: string) => ISecret | undefined;
getSecrets: () => ISecret[];
getSpaceAssignment: (id: any) => IAssignment | undefined;
getSpaceAssignments: () => IAssignment[];
getSpaceCells: () => ICell[];
getSpaceDatasets: () => IDataset[];
getSpaceDocument: (id: any) => IDocument | undefined;
getSpaceDocuments: () => IDocument[];
getSpaceEnvironments: () => IEnvironment[];
getSpaceExercises: () => IExercise[];
getSpaceItems: () => ISpaceItem[];
getSpaceLesson: (id: any) => ILesson | undefined;
getSpaceLessons: () => ILesson[];
getSpaceNotebook: (id: any) => INotebook | undefined;
getSpaceNotebooks: () => INotebook[];
getStudent: (courseId: any, studentId: any) => IStudent | undefined;
getTeamByHandle: (teamHandle: string) => ITeam | undefined;
getTeamById: (teamId: string) => ITeam | undefined;
getTeamsByOrganizationId: (organizationId: string) => ITeam[] | undefined;
getToken: (tokenId: string) => IIAMToken | undefined;
getTokens: () => IIAMToken[];
getUsages: () => Promise<{
success: boolean;
message: string;
usages?: IUsage[];
}>;
getUsagesForUser: (userId: string) => Promise<{
success: boolean;
message: string;
usages?: IUsage[];
}>;
getUser: (id: string) => IUser | undefined;
getUserByHandle: (handle: string) => IUser | undefined;
getUserCredits: (userId: any) => Promise<any>;
getUserOrganizationById: (organizationId: string) => IAnyOrganization | undefined;
getUserOrganizations: () => IAnyOrganization[];
getUserSpace: (userId: string) => IAnySpace | undefined;
getUserSpaceByHandle: (userHandle: string) => IAnySpace | undefined;
getUserSpaces: () => IAnySpace[];
getUserSurveys: (userId: string) => Promise<any>;
gradeAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string, model: any) => Promise<any>;
joinWithInvite: (formValues: any, token: any) => Promise<any>;
launchBulkEmailsOutbounds: (outboundId: string) => Promise<any>;
linkUserWithContact: (userId: any, contactId: any) => Promise<any>;
login: (handle: any, password: any) => Promise<any>;
logout: () => Promise<any>;
makeItemPrivate: (id: string) => Promise<any>;
makeItemPublic: (id: string) => Promise<any>;
makeSpacePrivate: (spaceId: string) => Promise<any>;
makeSpacePublic: (spaceId: string) => Promise<any>;
postLinkedinShare: (linkedinUser: ILinkedInUser, postText: string, accessToken: string) => Promise<any>;
postLinkedinShareWithUpload: (linkedinUser: ILinkedInUser, postText: string, uploadObject: string, accessToken: string) => Promise<any>;
proxyGET: (url: string, token: string) => Promise<any>;
proxyPOST: (url: string, body: object, token: string) => Promise<any>;
proxyPUT: (url: string, body: object, token: string) => Promise<any>;
putInvite: (token: string) => Promise<any>;
refreshAccount: (accountHandle: string) => Promise<any>;
refreshAssignment: (assignmentId: string) => Promise<any>;
refreshAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string) => Promise<any>;
refreshCell: (id: string) => Promise<any>;
refreshContact: (contactId: string) => Promise<any>;
refreshCourse: (courseId: string) => Promise<any>;
refreshCoursesEnrollments: () => Promise<any>;
refreshDataset: (id: string) => Promise<any>;
refreshDatasource: (datasourceId: string) => Promise<any>;
refreshDatasources: () => Promise<any>;
refreshDocument: (id: string) => Promise<any>;
refreshEnvironment: (id: string) => Promise<any>;
refreshExercise: (id: string) => Promise<any>;
refreshInbound: (userId: string) => Promise<any>;
refreshInstructorCourses: () => Promise<any>;
refreshInvite: (token: string) => Promise<any>;
refreshInvites: (accountId: string) => Promise<any>;
refreshLayout: (accountHandle: string, spaceHandle?: string, user?: IUser) => Promise<any>;
refreshLesson: (id: string) => Promise<any>;
refreshNotebook: (notebookId: string) => Promise<any>;
refreshOrganization: (user: IUser, organizationId: string) => Promise<any>;
refreshOrganizationSpace: (organizationId: string, spaceId: string) => Promise<any>;
refreshOrganizationSpaces: (organizationId: string) => Promise<any>;
refreshOutbound: (outboundId: string) => Promise<any>;
refreshPage: (pageId: string) => Promise<any>;
refreshPages: () => Promise<any>;
refreshPublicCourses: () => Promise<any>;
refreshPublicItems: () => Promise<any>;
refreshSchools: () => Promise<any>;
refreshSecret: (secretId: string) => Promise<any>;
refreshSecrets: () => Promise<any>;
refreshSpaceAssignments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceCells: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceDatasets: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceDocuments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceEnvironments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceExercises: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceItems: (spaceId: string) => Promise<any>;
refreshSpaceLessons: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshSpaceNotebooks: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
refreshStripePrices: () => Promise<IRESTBaseResponse & {
prices: IPrice[];
}>;
refreshStudent: (courseId: any, studentHandle: any) => Promise<any>;
refreshTeam: (teamId: string, organizationId: string) => Promise<any>;
refreshTeams: (organizationId: string) => Promise<any>;
refreshToken: (tokenId: string) => Promise<any>;
refreshTokens: () => Promise<any>;
refreshUser: (userId: string) => Promise<any>;
refreshUserOrganizations: (user: IUser) => Promise<any>;
refreshUserSpace: (userId: string, spaceId: string) => Promise<any>;
refreshUserSpaces: () => Promise<any>;
registerToWaitingList: (formData: WaitingListFormData) => void;
removeMemberFromOrganization: (organizationId: string, userId: string) => Promise<any>;
removeMemberFromOrganizationSpace: (organizationId: string, spaceId: string, accountId: string) => Promise<any>;
removeMemberFromTeam: (teamId: string, userId: string) => Promise<any>;
removeRoleFromOrganizationMember: (organizationId: string, userId: string, roleName: string) => Promise<any>;
removeRoleFromTeamMember: (teamId: string, userId: string, roleName: string) => Promise<any>;
removeStudentFromCourse: (courseId: string, studentId: string) => Promise<any>;
requestEmailUpdate: (email: any) => Promise<any>;
requestInvite: (firstName: string, lastName: string, email: string, socialUrl: string) => Promise<any>;
requestJoin: (handle: any, email: any, firstName: any, lastName: any, password: any, passwordConfirm: any) => Promise<any>;
requestJoinToken: (handle: any, email: any, firstName: any, lastName: any, password: any, passwordConfirm: any) => Promise<any>;
requestPlatformSupport: (subject: any, message: any, email: any, brand: any) => Promise<any>;
requestPlatformSupport2: (accountHandle: any, firstName: any, lastName: any, email: any, message: any) => Promise<any>;
resetAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string) => Promise<any>;
searchContacts: (query: string) => Promise<any>;
searchPublicItems: (opts?: ISearchOpts) => Promise<any>;
searchUsers: (namingPattern: string) => Promise<any>;
sendInvite: (invite: IInvite) => Promise<any>;
sendInviteToContact: (contact: IContact, message: string) => Promise<any>;
sendLinkedinConnectionRequest: (contact: IContact, message: string) => Promise<any>;
sendOutboundEmailToUser: (userId: string, recipient: string, subject: string, content: string) => Promise<any>;
setCourseItems: (courseId: any, itemIds: any) => Promise<any>;
subscribeUserToOutbounds: (userId: string) => Promise<any>;
toInbound: (u: any) => IInbound | undefined;
toOutbound: (u: any) => IOutbound | undefined;
tryBulkEmailsOutbounds: (outboundId: string) => Promise<any>;
unassignRoleFromUser: (userId: any, roleName: any) => Promise<any>;
unassignTagFromContact: (contactId: any, tagName: any) => Promise<any>;
unlinkUserFromContact: (userId: any, contactId: any) => Promise<any>;
unsubscribeContactFromOutbounds: (contactId: string) => Promise<any>;
unsubscribeInviteeFromOutbounds: (token: string) => Promise<any>;
unsubscribeUserFromOutbounds: (userId: string) => Promise<any>;
updateCell: (cell: {
id: string;
name: string;
description: string;
source: string;
outputshotUrl?: string;
outputshotData?: string;
spaceId: string;
}) => Promise<any>;
updateContact: (contactId: any, contact: IContact) => Promise<any>;
updateCourse: (courseId: any, name: any, description: any) => Promise<any>;
updateDataset: (id: any, name: any, description: any) => Promise<any>;
updateDatasource: (datasource: IDatasource) => Promise<any>;
updateDocument: (id: any, name: any, description: any) => Promise<any>;
updateDocumentModel: (id: any, model: any) => Promise<any>;
updateExercise: ({ id, name, description, help, codePre, codeSolution, codeQuestion, codeTest, }: {
id: any;
name: any;
description: any;
help: any;
codePre: any;
codeSolution: any;
codeQuestion: any;
codeTest: any;
}) => Promise<any>;
updateExercisePoints: (id: any, codeStudent: any, points: any) => Promise<any>;
updateMe: (email: any, firstName: any, lastName: any) => Promise<any>;
updateNotebook: (id: any, name: any, description: any) => Promise<any>;
updateNotebookModel: (notebookId: any, nbformat: any) => Promise<any>;
updateOrganization: (organization: Partial<IAnyOrganization>) => Promise<any>;
updateOrganizationSpace: (organization: IAnyOrganization, space: Partial<IAnySpace>) => Promise<any>;
updatePage: (page: Pick<IPage, "id" | "name" | "description" | "tags">) => Promise<any>;
updateSecret: (secret: ISecret) => Promise<any>;
updateSpace: (space: Partial<IAnySpace>) => Promise<any>;
updateTeam: (team: Partial<ITeam>) => Promise<any>;
updateToken: (token: IIAMToken) => Promise<any>;
updateUserCredits: (userId: any, credits: any, brand: any) => Promise<any>;
updateUserCreditsQuota: (userId: string, quota?: number) => Promise<any>;
updateUserOnboarding: (onboarding: IUserOnboarding) => Promise<any>;
updateUserSettings: (userId: string, settings: IUserSettings) => Promise<any>;
validateUserMFACode: (userUid: any, code: string) => Promise<any>;
whoami: () => Promise<any>;
};
export default useCache;