diff --git a/src/Collaborators/index.ts b/src/Collaborators/index.ts index 6621f4f1..e4f98da5 100644 --- a/src/Collaborators/index.ts +++ b/src/Collaborators/index.ts @@ -2,7 +2,7 @@ import { Client } from ".."; import { App } from "../models/regional/apps"; import { Collaborator, - CollaboratorInvitation, + CollaboratorInvitePayload, } from "../models/regional/collaborators"; import { unpackData } from "../utils"; @@ -57,14 +57,14 @@ export default class Collaborators { * Invite collaborators to an application * @see https://developers.scalingo.com/collaborators#invite-collaborator-to-work-on-an-app * @param appId Id of the application - * @param email Email of the collaborator to invite + * @param payload (string | CollaboratorInvitePayload) Email of the limited collaborator or CollaboratorInvitePayload */ invite( appId: string, - payload: Collaborator | string, - ): Promise { + payload: CollaboratorInvitePayload | string, + ): Promise { if (typeof payload === "string") { - payload = { email: payload } as Collaborator; + payload = { email: payload } as CollaboratorInvitePayload; } return unpackData( this._client.apiClient().post(`/apps/${appId}/collaborators`, { diff --git a/src/models/regional/collaborators.ts b/src/models/regional/collaborators.ts index 5d80fc53..e6851881 100644 --- a/src/models/regional/collaborators.ts +++ b/src/models/regional/collaborators.ts @@ -11,33 +11,27 @@ export default { export interface Collaborator { /** Id of the collaborator */ id: string; - /** Email of the collaborator to invite */ + /** Email of the collaborator - required in the invite payload */ email: string; /** Unique User ID of the user who accepted the collaboration */ user_id: string; /** ID of the application owning the collaborator */ app_id: string; - /** Username of the person to invite */ + /** Username of the collaborator */ username: string; /** Status of the invitation */ status: string; /** Name of the application owning the collaborator */ app_name?: string; - /** Collaborator with limited access */ + /** Collaborator with limited access - true if the collaborator has limited access, false otherwise */ is_limited?: boolean; + /** Link for the invitation */ + invitation_link?: string; + /** Two Factor Authentication status of the collaborator */ + tfa_status?: boolean; } -export interface CollaboratorInvitation { - /** Id of the collaborator */ - id: string; - /** Email of the collaborator to invite */ +export interface CollaboratorInvitePayload { email: string; - /** Username of the person to invite */ - username: string; - /** Status of the invitation */ - status: string; - /** Link of for the invitation */ - invitation_link: string; - /** Collaborator with limited access */ is_limited?: boolean; }