1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//Anything related to GET requests for Teams and it's variations goes here.
use super::{Team, TeamInvitation, TeamMember};

use crate::framework::endpoint::{HerokuEndpoint, Method};

/// Team Delete
///
/// Delete an existing team.
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#team-delete)
pub struct TeamDelete<'a> {
    /// unique team identifier.
    pub team_id: &'a str,
}

impl<'a> TeamDelete<'a> {
    pub fn new(team_id: &'a str) -> TeamDelete {
        TeamDelete { team_id }
    }
}

impl<'a> HerokuEndpoint<Team> for TeamDelete<'a> {
    fn method(&self) -> Method {
        Method::Delete
    }
    fn path(&self) -> String {
        format!("teams/{}", self.team_id)
    }
}

/// Team Invitation Revoke
///
/// Revoke a team invitation.
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#team-invitation-revoke)
pub struct TeamInvitationRevoke<'a> {
    /// unique team identifier.
    pub team_id: &'a str,
    /// unique invitation identifier
    pub invitation_id: &'a str,
}

impl<'a> TeamInvitationRevoke<'a> {
    pub fn new(team_id: &'a str, invitation_id: &'a str) -> TeamInvitationRevoke<'a> {
        TeamInvitationRevoke {
            team_id,
            invitation_id,
        }
    }
}

impl<'a> HerokuEndpoint<TeamInvitation> for TeamInvitationRevoke<'a> {
    fn method(&self) -> Method {
        Method::Delete
    }
    fn path(&self) -> String {
        format!("teams/{}/invitations/{}", self.team_id, self.invitation_id)
    }
}

/// Team Member Delete
///
/// Remove a member from the team.
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#team-member-delete)
pub struct TeamMemberDelete<'a> {
    /// unique team identifier.
    pub team_id: &'a str,
    /// unique member identifier
    pub member_id: &'a str,
}

impl<'a> TeamMemberDelete<'a> {
    pub fn new(team_id: &'a str, member_id: &'a str) -> TeamMemberDelete<'a> {
        TeamMemberDelete { team_id, member_id }
    }
}

impl<'a> HerokuEndpoint<TeamMember> for TeamMemberDelete<'a> {
    fn method(&self) -> Method {
        Method::Delete
    }
    fn path(&self) -> String {
        format!("teams/{}/members/{}", self.team_id, self.member_id)
    }
}