diff --git a/src/Collaborators/index.ts b/src/Collaborators/index.ts index c21128e3..fc7b1825 100644 --- a/src/Collaborators/index.ts +++ b/src/Collaborators/index.ts @@ -6,6 +6,12 @@ import { } from "../models/regional/collaborators"; import { unpackData } from "../utils"; +export type IndexQuery = NonNullable; + +export interface IndexResponse { + collaborators: Collaborator[]; +} + /** * Collaborators API Client */ @@ -74,4 +80,13 @@ export default class Collaborators { .get("/apps/collaboration", { params: { token: token } }), ); } + + /** + * list all request owner collaborators + */ + all(params: IndexQuery): Promise { + return unpackData( + this._client.apiClient().get("/collaborators", { params }), + ); + } } diff --git a/src/models/regional/collaborators.ts b/src/models/regional/collaborators.ts index 127cb8dd..6d6b68f3 100644 --- a/src/models/regional/collaborators.ts +++ b/src/models/regional/collaborators.ts @@ -21,6 +21,8 @@ export interface Collaborator { username: string; /** Status of the invitation */ status: string; + /** Name of the application owning the collaborator */ + app_name?: string; } export interface CollaboratorInvitation { diff --git a/test/Collaborators/index.test.js b/test/Collaborators/index.test.js index c52dd43c..0a72dd13 100644 --- a/test/Collaborators/index.test.js +++ b/test/Collaborators/index.test.js @@ -50,3 +50,14 @@ describe("Collaborators#inviteAccept", () => { }, ); }); + +describe("Collaborators#all", () => { + testGetter( + "https://api.osc-fr1.scalingo.com/v1/collaborators", + {}, + null, + (client) => { + return new Collaborators(client).all(); + }, + ); +});