Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Collaborators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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<CollaboratorInvitation> {
payload: CollaboratorInvitePayload | string,
): Promise<Collaborator> {
if (typeof payload === "string") {
payload = { email: payload } as Collaborator;
payload = { email: payload } as CollaboratorInvitePayload;
}
return unpackData(
this._client.apiClient().post(`/apps/${appId}/collaborators`, {
Expand Down
22 changes: 8 additions & 14 deletions src/models/regional/collaborators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}