Path: blob/master/src/packages/frontend/client/project-collaborators.ts
5808 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45// cSpell:ignore replyto collabs noncloud67import type { ConatClient } from "@cocalc/frontend/conat/client";8import type { AddCollaborator } from "@cocalc/conat/hub/api/projects";910export class ProjectCollaborators {11private conat: ConatClient;1213constructor(client) {14this.conat = client.conat_client;15}1617public async invite_noncloud(opts: {18project_id: string;19title: string;20link2proj: string;21replyto?: string;22replyto_name?: string;23to: string;24email: string; // body in HTML format25subject?: string;26}): Promise<any> {27return await this.conat.hub.projects.inviteCollaboratorWithoutAccount({28opts,29});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.conat.hub.projects.inviteCollaborator({43opts,44});45}4647public async remove(opts: {48project_id: string;49account_id: string;50}): Promise<any> {51return await this.conat.hub.projects.removeCollaborator({52opts,53});54}5556// Directly add one (or more) collaborators to (one or more) projects via57// a single API call. There is no defined invite email message.58public async add_collaborator(59opts: AddCollaborator,60): Promise<{ project_id?: string | string[] }> {61// project_id is a single string or possibly an array of project_id's62// in case of a token.63return await this.conat.hub.projects.addCollaborator({64opts,65});66}6768public async change_user_type(opts: {69project_id: string;70target_account_id: string;71new_group: "owner" | "collaborator";72}): Promise<void> {73return await this.conat.hub.projects.changeUserType({ opts });74}75}767778