Path: blob/master/src/packages/conat/hub/api/projects.ts
1452 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,12};1314export type AddCollaborator =15| {16project_id: string;17account_id: string;18token_id?: undefined;19}20| {21token_id: string;22account_id: string;23project_id?: undefined;24}25| { project_id: string[]; account_id: string[]; token_id?: undefined } // for adding more than one at once26| { account_id: string[]; token_id: string[]; project_id?: undefined };2728export interface Projects {29// request to have conat permissions to project subjects.30createProject: (opts: CreateProjectOptions) => Promise<string>;3132copyPathBetweenProjects: (opts: UserCopyOptions) => Promise<void>;3334removeCollaborator: ({35account_id,36opts,37}: {38account_id?: string;39opts: {40account_id;41project_id;42};43}) => Promise<void>;4445addCollaborator: ({46account_id,47opts,48}: {49account_id?: string;50opts: AddCollaborator;51}) => Promise<{ project_id?: string | string[] }>;5253inviteCollaborator: ({54account_id,55opts,56}: {57account_id?: string;58opts: {59project_id: string;60account_id: string;61title?: string;62link2proj?: string;63replyto?: string;64replyto_name?: string;65email?: string;66subject?: string;67};68}) => Promise<void>;6970inviteCollaboratorWithoutAccount: ({71account_id,72opts,73}: {74account_id?: string;75opts: {76project_id: string;77title: string;78link2proj: string;79replyto?: string;80replyto_name?: string;81to: string;82email: string; // body in HTML format83subject?: string;84};85}) => Promise<void>;8687setQuotas: (opts: {88account_id?: string;89project_id: string;90memory?: number;91memory_request?: number;92cpu_shares?: number;93cores?: number;94disk_quota?: number;95mintime?: number;96network?: number;97member_host?: number;98always_running?: number;99}) => Promise<void>;100}101102103