Skip to content

Commit d00b14f

Browse files
chore(collaborators): Make Collaborator interface matching recent changes in the API (#487)
* chore(collaborators): Make Collaborator interface matching recent changes in the API * Move CollaboratorInvitePayload in Collaborators exports --------- Co-authored-by: TheoPouletSouchard <[email protected]>
1 parent d56f485 commit d00b14f

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

src/Collaborators/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Client } from "..";
22
import { App } from "../models/regional/apps";
33
import {
44
Collaborator,
5-
CollaboratorInvitation,
5+
CollaboratorInvitePayload,
66
} from "../models/regional/collaborators";
77
import { unpackData } from "../utils";
88

@@ -57,14 +57,14 @@ export default class Collaborators {
5757
* Invite collaborators to an application
5858
* @see https://developers.scalingo.com/collaborators#invite-collaborator-to-work-on-an-app
5959
* @param appId Id of the application
60-
* @param email Email of the collaborator to invite
60+
* @param payload (string | CollaboratorInvitePayload) Email of the limited collaborator or CollaboratorInvitePayload
6161
*/
6262
invite(
6363
appId: string,
64-
payload: Collaborator | string,
65-
): Promise<CollaboratorInvitation> {
64+
payload: CollaboratorInvitePayload | string,
65+
): Promise<Collaborator> {
6666
if (typeof payload === "string") {
67-
payload = { email: payload } as Collaborator;
67+
payload = { email: payload } as CollaboratorInvitePayload;
6868
}
6969
return unpackData(
7070
this._client.apiClient().post(`/apps/${appId}/collaborators`, {

src/models/regional/collaborators.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,27 @@ export default {
1111
export interface Collaborator {
1212
/** Id of the collaborator */
1313
id: string;
14-
/** Email of the collaborator to invite */
14+
/** Email of the collaborator - required in the invite payload */
1515
email: string;
1616
/** Unique User ID of the user who accepted the collaboration */
1717
user_id: string;
1818
/** ID of the application owning the collaborator */
1919
app_id: string;
20-
/** Username of the person to invite */
20+
/** Username of the collaborator */
2121
username: string;
2222
/** Status of the invitation */
2323
status: string;
2424
/** Name of the application owning the collaborator */
2525
app_name?: string;
26-
/** Collaborator with limited access */
26+
/** Collaborator with limited access - true if the collaborator has limited access, false otherwise */
2727
is_limited?: boolean;
28+
/** Link for the invitation */
29+
invitation_link?: string;
30+
/** Two Factor Authentication status of the collaborator */
31+
tfa_status?: boolean;
2832
}
2933

30-
export interface CollaboratorInvitation {
31-
/** Id of the collaborator */
32-
id: string;
33-
/** Email of the collaborator to invite */
34+
export interface CollaboratorInvitePayload {
3435
email: string;
35-
/** Username of the person to invite */
36-
username: string;
37-
/** Status of the invitation */
38-
status: string;
39-
/** Link of for the invitation */
40-
invitation_link: string;
41-
/** Collaborator with limited access */
4236
is_limited?: boolean;
4337
}

0 commit comments

Comments
 (0)