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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use super::Release;
use crate::framework::endpoint::{HerokuEndpoint, Method};
#[derive(Serialize)]
pub struct ReleaseCreate {
pub app_id: String,
pub params: ReleaseCreateParams,
}
impl ReleaseCreate {
pub fn new(app_id: String, slug: String, description: Option<String>) -> ReleaseCreate {
ReleaseCreate {
app_id,
params: ReleaseCreateParams { slug, description },
}
}
pub fn create(app_id: String, slug: String) -> ReleaseCreate {
ReleaseCreate {
app_id,
params: ReleaseCreateParams {
slug: slug,
description: None,
},
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Serialize, Clone, Debug)]
pub struct ReleaseCreateParams {
pub slug: String,
pub description: Option<String>,
}
impl HerokuEndpoint<Release, (), ReleaseCreateParams> for ReleaseCreate {
fn method(&self) -> Method {
Method::Post
}
fn path(&self) -> String {
format!("apps/{}/releases", self.app_id)
}
fn body(&self) -> Option<ReleaseCreateParams> {
Some(self.params.clone())
}
}
#[derive(Serialize)]
pub struct ReleaseRollback {
pub app_id: String,
pub params: ReleaseRollbackParams,
}
impl ReleaseRollback {
pub fn new(app_id: String, release_id: String) -> ReleaseRollback {
ReleaseRollback {
app_id,
params: ReleaseRollbackParams {
release: release_id,
},
}
}
}
#[derive(Serialize, Clone, Debug)]
pub struct ReleaseRollbackParams {
pub release: String,
}
impl HerokuEndpoint<Release, (), ReleaseRollbackParams> for ReleaseRollback {
fn method(&self) -> Method {
Method::Post
}
fn path(&self) -> String {
format!("apps/{}/releases", self.app_id)
}
fn body(&self) -> Option<ReleaseRollbackParams> {
Some(self.params.clone())
}
}