Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/client/project-collaborators.ts
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import * as message from "@cocalc/util/message";6import { AsyncCall } from "./client";78export class ProjectCollaborators {9private async_call: AsyncCall;1011constructor(async_call: AsyncCall) {12this.async_call = async_call;13}1415private async call(message: object): Promise<any> {16return await this.async_call({ message });17}1819public async invite_noncloud(opts: {20project_id: string;21title: string;22link2proj: string;23replyto?: string;24replyto_name?: string;25to: string;26email: string; // body in HTML format27subject?: string;28}): Promise<any> {29return await this.call(message.invite_noncloud_collaborators(opts));30}3132public async invite(opts: {33project_id: string;34account_id: string;35title?: string;36link2proj?: string;37replyto?: string;38replyto_name?: string;39email?: string;40subject?: string;41}): Promise<any> {42return await this.call(message.invite_collaborator(opts));43}4445public async remove(opts: {46project_id: string;47account_id: string;48}): Promise<any> {49return await this.call(message.remove_collaborator(opts));50}5152// Directly add one (or more) collaborators to (one or more) projects via53// a single API call. There is no invite process, etc.54public async add_collaborator(55opts:56| {57project_id: string;58account_id: string;59}60| {61token_id: string;62account_id: string;63}64| { project_id: string[]; account_id: string[] } // for adding more than one at once65| { account_id: string[]; token_id: string[] } // for adding more than one at once66): Promise<{ event: "error" | "ok"; project_id?: string | string[] }> {67// project_id is a single string or an array of project id's in case of a token.68return await this.call(message.add_collaborator(opts));69}70}717273