Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Add getTeamMembershipsForTeam and deprecate put/deleteTeamMembership endpoints #122

Merged
merged 1 commit into from
May 10, 2021
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
29 changes: 28 additions & 1 deletion src/collections/teamMemberships.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { TeamMembership, TeamMembershipNew } from '../requestTypes';
import { TeamMemberMembershipFullResponse } from '../responseTypes';
import { ResultSetResponse, TeamMemberMembershipFullResponse } from '../responseTypes';
import Collection from './abstractCollection';

export default class TeamMemberships extends Collection {
/**
* Creates a new membership.
*/
public async post(
teamMembership: TeamMembershipNew,
): Promise<TeamMemberMembershipFullResponse> {
Expand All @@ -12,12 +15,21 @@ export default class TeamMemberships extends Collection {
});
}

/**
* Retrieve an existing membership for the given id.
*/
public async getTeamMembership(
id: string,
): Promise<TeamMemberMembershipFullResponse> {
return this.createAndSendRequest(`/team-memberships/${id}`);
}

/**
* Update an existing membership for the given id.
*
* @deprecated Removed from Tempo.io documentation since April 2021.
* @see team.putTeam()
*/
public async putTeamMembership(
id: string,
teamMembership: TeamMembership,
Expand All @@ -28,9 +40,24 @@ export default class TeamMemberships extends Collection {
});
}

/**
* Delete an existing membership.
*
* @deprecated Removed from Tempo.io documentation since April 2021.
* @see team.putTeam()
*/
public async deleteTeamMembership(id: string): Promise<void> {
await this.createAndSendRequest(`/team-memberships/${id}`, {
method: 'DELETE',
});
}

/**
* Retrieves all the memberships of the team.
*/
public async getTeamMembershipsForTeam(
id: string,
): Promise<ResultSetResponse<TeamMemberMembershipFullResponse>> {
return this.createAndSendRequest(`/team-memberships/team/${id}`);
}
}
Loading