Skip to content

Commit

Permalink
[STORY-994] feat(iam): Add collaborators.all (#399)
Browse files Browse the repository at this point in the history
* feat(iam): Add get /collaborators endpoint
  • Loading branch information
baptmaury authored Nov 28, 2024
1 parent 8a662b8 commit 1d9610a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Collaborators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import {
} from "../models/regional/collaborators";
import { unpackData } from "../utils";

export type IndexQuery = NonNullable<unknown>;

export interface IndexResponse {
collaborators: Collaborator[];
}

/**
* Collaborators API Client
*/
Expand Down Expand Up @@ -74,4 +80,13 @@ export default class Collaborators {
.get("/apps/collaboration", { params: { token: token } }),
);
}

/**
* list all request owner collaborators
*/
all(params: IndexQuery): Promise<IndexResponse> {
return unpackData(
this._client.apiClient().get("/collaborators", { params }),
);
}
}
2 changes: 2 additions & 0 deletions src/models/regional/collaborators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 11 additions & 0 deletions test/Collaborators/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
);
});

0 comments on commit 1d9610a

Please sign in to comment.