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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
use crate::framework::response::ApiResult;
pub mod delete;
pub mod get;
pub mod patch;
pub mod post;
pub mod put;
pub use delete::{OAuthClientDelete, OAuthDelete, OAuthTokenDelete};
pub use get::{OAuthClientDetails, OAuthClientList, OAuthDetails, OAuthList};
pub use patch::{OAuthClientUpdate, OAuthClientUpdateParams};
pub use post::{
OAuthClientCreate, OAuthClientCreateParams, OAuthClientRotateCredentials, OAuthCreate,
OAuthCreateParams, OAuthRegenerate, OAuthTokenCreate, OAuthTokenCreateParams,
};
impl ApiResult for auth::OAuth {}
impl ApiResult for Vec<auth::OAuth> {}
impl ApiResult for client::OAuthClient {}
impl ApiResult for Vec<client::OAuthClient> {}
impl ApiResult for token::OAuthToken {}
impl ApiResult for Vec<token::OAuthToken> {}
pub use auth::OAuth;
pub use client::OAuthClient;
pub use token::OAuthToken;
// auth submodule, anything from /oauth/authorizations goes here.
mod auth {
use chrono::offset::Utc;
use chrono::DateTime;
/// OAuth Authorization
///
/// Stability: production
///
/// OAuth authorizations represent clients that a Heroku user has authorized to automate, customize or extend their usage of the platform.
///
/// [For more information please refer to the Heroku OAuth documentation](https://devcenter.heroku.com/articles/oauth)
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct OAuth {
/// access token for this authorization
pub access_token: Option<AccessToken>,
/// identifier of the client that obtained this authorization, if any
pub client: Option<Client>,
/// when OAuth authorization was created
pub created_at: DateTime<Utc>,
/// this authorization’s grant
pub grant: Option<Grant>,
/// unique identifier of OAuth authorization
pub id: String,
/// refresh token for this authorization
pub refresh_token: Option<RefreshToken>,
/// The scope of access OAuth authorization allows
pub scope: Vec<String>,
/// when OAuth authorization was updated
pub updated_at: DateTime<Utc>,
/// User account
pub user: User,
}
/// OAuth Token
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct AccessToken {
/// seconds until OAuth token expires; may be null for tokens with indefinite lifetime
pub expires_in: Option<i64>,
/// unique identifier of OAuth token
pub id: String,
/// contents of the token to be used for authorization
pub token: String,
}
/// OAuth Client
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Client {
/// unique identifier of this OAuth client
pub id: String,
/// OAuth client name
pub name: String,
/// endpoint for redirection after authorization with OAuth client
pub redirect_uri: String,
}
/// OAuth Grant
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Grant {
/// grant code received from OAuth web application authorization
pub code: String,
/// seconds until OAuth grant expires
pub expires_in: i64,
/// unique identifier of OAuth grant
pub id: String,
}
/// OAuth Token
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct RefreshToken {
/// refresh token for this authorization
pub expires_in: Option<i64>,
/// unique identifier of OAuth token
pub id: String,
/// contents of the token to be used for authorization
pub token: String,
}
/// Account
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct User {
/// identifier of an account
pub id: String,
/// unique email address
pub email: String,
/// full name of the account owner
pub full_name: Option<String>,
}
}
// oauth client submodule, anything from /oauth/clients goes here.
mod client {
use chrono::offset::Utc;
use chrono::DateTime;
/// OAuth Client
///
/// Stability: production
///
/// OAuth clients are applications that Heroku users can authorize to automate, customize or extend their usage of the platform.
///
/// [For more information please refer to the Heroku OAuth documentation](https://devcenter.heroku.com/articles/oauth)
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct OAuthClient {
/// when OAuth client was created
pub created_at: DateTime<Utc>,
/// unique identifier of this OAuth client
pub id: String,
/// whether the client is still operable given a delinquent account
pub ignores_delinquent: Option<bool>,
/// OAuth client name
pub name: String,
/// endpoint for redirection after authorization with OAuth client
pub redirect_uri: String,
/// secret used to obtain OAuth authorizations under this client
pub secret: String,
/// when OAuth client was updated
pub updated_at: DateTime<Utc>,
}
}
// token submodule, anything from /oauth/tokens goes here.
mod token {
use chrono::offset::Utc;
use chrono::DateTime;
/// OAuth Token
///
/// Stability: production
///
/// OAuth tokens provide access for authorized clients to act on behalf of a Heroku user to automate, customize or extend their usage of the platform.
///
/// [For more information please refer to the Heroku OAuth documentation](https://devcenter.heroku.com/articles/oauth)
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct OAuthToken {
/// AccessToken
pub access_token: AccessToken,
/// Authorization
pub authorization: Authorization,
/// OAuth client secret used to obtain token
pub client: Option<Client>,
/// when OAuth token was created
pub created_at: DateTime<Utc>,
/// Grant
pub grant: Grant,
/// unique identifier of OAuth token
pub id: String,
/// RefreshToken
pub refresh_token: RefreshToken,
/// Session
pub session: Session,
/// when OAuth token was updated
pub updated_at: DateTime<Utc>,
/// Account
pub user: User,
}
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct AccessToken {
/// seconds until OAuth token expires; may be null for tokens with indefinite lifetime
pub expires_in: Option<i64>,
/// unique identifier of OAuth token
pub id: String,
/// contents of the token to be used for authorization
pub token: String,
}
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Authorization {
/// unique identifier of OAuth authorization
pub id: String,
}
/// OAuth client secret used to obtain token
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Client {
/// secret used to obtain OAuth authorizations under this client
pub secret: String,
}
/// Grant
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Grant {
/// grant code received from OAuth web application authorization
pub code: String,
/// type of grant requested, one of authorization_code or refresh_token
#[serde(rename = "type")]
pub type_field: String,
}
/// RefreshToken
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct RefreshToken {
/// seconds until OAuth token expires; may be null for tokens with indefinite lifetime
pub expires_in: Option<i64>,
/// unique identifier of OAuth token
pub id: String,
/// contents of the token to be used for authorization
pub token: String,
}
/// Session
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct Session {
/// unique identifier of OAuth token
pub id: String,
}
/// Account
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct User {
/// identifier of an account
pub id: String,
}
}