Path: blob/master/src/packages/frontend/client/project-collaborators.ts
1503 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import type { ConatClient } from "@cocalc/frontend/conat/client";6import type { AddCollaborator } from "@cocalc/conat/hub/api/projects";78export class ProjectCollaborators {9private conat: ConatClient;1011constructor(client) {12this.conat = client.conat_client;13}1415public async invite_noncloud(opts: {16project_id: string;17title: string;18link2proj: string;19replyto?: string;20replyto_name?: string;21to: string;22email: string; // body in HTML format23subject?: string;24}): Promise<any> {25return await this.conat.hub.projects.inviteCollaboratorWithoutAccount({26opts,27});28}2930public async invite(opts: {31project_id: string;32account_id: string;33title?: string;34link2proj?: string;35replyto?: string;36replyto_name?: string;37email?: string;38subject?: string;39}): Promise<any> {40return await this.conat.hub.projects.inviteCollaborator({41opts,42});43}4445public async remove(opts: {46project_id: string;47account_id: string;48}): Promise<any> {49return await this.conat.hub.projects.removeCollaborator({50opts,51});52}5354// Directly add one (or more) collaborators to (one or more) projects via55// a single API call. There is no defined invite email message.56public async add_collaborator(57opts: AddCollaborator,58): Promise<{ project_id?: string | string[] }> {59// project_id is a single string or possibly an array of project_id's60// in case of a token.61return await this.conat.hub.projects.addCollaborator({62opts,63});64}65}666768