Path: blob/master/src/packages/conat/hub/api/projects.ts
1712 views
import { authFirstRequireAccount } from "./util";1import { type CreateProjectOptions } from "@cocalc/util/db-schema/projects";2import { type UserCopyOptions } from "@cocalc/util/db-schema/projects";34export const projects = {5createProject: authFirstRequireAccount,6copyPathBetweenProjects: authFirstRequireAccount,7removeCollaborator: authFirstRequireAccount,8addCollaborator: authFirstRequireAccount,9inviteCollaborator: authFirstRequireAccount,10inviteCollaboratorWithoutAccount: authFirstRequireAccount,11setQuotas: authFirstRequireAccount,12start: authFirstRequireAccount,13stop: authFirstRequireAccount,14};1516export type AddCollaborator =17| {18project_id: string;19account_id: string;20token_id?: undefined;21}22| {23token_id: string;24account_id: string;25project_id?: undefined;26}27| { project_id: string[]; account_id: string[]; token_id?: undefined } // for adding more than one at once28| { account_id: string[]; token_id: string[]; project_id?: undefined };2930export interface Projects {31// request to have conat permissions to project subjects.32createProject: (opts: CreateProjectOptions) => Promise<string>;3334copyPathBetweenProjects: (opts: UserCopyOptions) => Promise<void>;3536removeCollaborator: ({37account_id,38opts,39}: {40account_id?: string;41opts: {42account_id;43project_id;44};45}) => Promise<void>;4647addCollaborator: ({48account_id,49opts,50}: {51account_id?: string;52opts: AddCollaborator;53}) => Promise<{ project_id?: string | string[] }>;5455inviteCollaborator: ({56account_id,57opts,58}: {59account_id?: string;60opts: {61project_id: string;62account_id: string;63title?: string;64link2proj?: string;65replyto?: string;66replyto_name?: string;67email?: string;68subject?: string;69};70}) => Promise<void>;7172inviteCollaboratorWithoutAccount: ({73account_id,74opts,75}: {76account_id?: string;77opts: {78project_id: string;79title: string;80link2proj: string;81replyto?: string;82replyto_name?: string;83to: string;84email: string; // body in HTML format85subject?: string;86};87}) => Promise<void>;8889setQuotas: (opts: {90account_id?: string;91project_id: string;92memory?: number;93memory_request?: number;94cpu_shares?: number;95cores?: number;96disk_quota?: number;97mintime?: number;98network?: number;99member_host?: number;100always_running?: number;101}) => Promise<void>;102103start: (opts: { account_id: string; project_id: string }) => Promise<void>;104stop: (opts: { account_id: string; project_id: string }) => Promise<void>;105}106107108