Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/client/project-collaborators.ts
1503 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import type { ConatClient } from "@cocalc/frontend/conat/client";
7
import type { AddCollaborator } from "@cocalc/conat/hub/api/projects";
8
9
export class ProjectCollaborators {
10
private conat: ConatClient;
11
12
constructor(client) {
13
this.conat = client.conat_client;
14
}
15
16
public async invite_noncloud(opts: {
17
project_id: string;
18
title: string;
19
link2proj: string;
20
replyto?: string;
21
replyto_name?: string;
22
to: string;
23
email: string; // body in HTML format
24
subject?: string;
25
}): Promise<any> {
26
return await this.conat.hub.projects.inviteCollaboratorWithoutAccount({
27
opts,
28
});
29
}
30
31
public async invite(opts: {
32
project_id: string;
33
account_id: string;
34
title?: string;
35
link2proj?: string;
36
replyto?: string;
37
replyto_name?: string;
38
email?: string;
39
subject?: string;
40
}): Promise<any> {
41
return await this.conat.hub.projects.inviteCollaborator({
42
opts,
43
});
44
}
45
46
public async remove(opts: {
47
project_id: string;
48
account_id: string;
49
}): Promise<any> {
50
return await this.conat.hub.projects.removeCollaborator({
51
opts,
52
});
53
}
54
55
// Directly add one (or more) collaborators to (one or more) projects via
56
// a single API call. There is no defined invite email message.
57
public async add_collaborator(
58
opts: AddCollaborator,
59
): Promise<{ project_id?: string | string[] }> {
60
// project_id is a single string or possibly an array of project_id's
61
// in case of a token.
62
return await this.conat.hub.projects.addCollaborator({
63
opts,
64
});
65
}
66
}
67
68