@@ -127,6 +127,37 @@ impl AccountTier {
127127 }
128128}
129129
130+ #[ cfg( test) ]
131+ mod account_tier_tests {
132+ use super :: * ;
133+ #[ test]
134+ fn deser ( ) {
135+ assert_eq ! (
136+ serde_json:: from_str:: <AccountTier >( "\" basic\" " ) . unwrap( ) ,
137+ AccountTier :: Basic
138+ ) ;
139+ }
140+ #[ cfg( feature = "unknown-variants" ) ]
141+ #[ test]
142+ fn unknown_deser ( ) {
143+ assert_eq ! (
144+ serde_json:: from_str:: <AccountTier >( "\" \" " ) . unwrap( ) ,
145+ AccountTier :: Unknown ( "" . to_string( ) )
146+ ) ;
147+ assert_eq ! (
148+ serde_json:: from_str:: <AccountTier >( "\" hisshiss\" " ) . unwrap( ) ,
149+ AccountTier :: Unknown ( "hisshiss" . to_string( ) )
150+ ) ;
151+ assert ! ( serde_json:: to_string( & AccountTier :: Unknown ( "asdf" . to_string( ) ) ) . is_err( ) ) ;
152+ }
153+ #[ cfg( not( feature = "unknown-variants" ) ) ]
154+ #[ test]
155+ fn not_unknown_deser ( ) {
156+ assert ! ( serde_json:: from_str:: <AccountTier >( "\" \" " ) . is_err( ) ) ;
157+ assert ! ( serde_json:: from_str:: <AccountTier >( "\" hisshiss\" " ) . is_err( ) ) ;
158+ }
159+ }
160+
130161#[ derive( Debug , Deserialize , Serialize ) ]
131162#[ cfg_attr( feature = "utoipa" , derive( utoipa:: ToSchema ) ) ]
132163#[ typeshare:: typeshare]
@@ -178,37 +209,6 @@ pub enum SubscriptionType {
178209 Unknown ( String ) ,
179210}
180211
181- #[ cfg( test) ]
182- mod tests {
183- use super :: * ;
184- #[ test]
185- fn deser ( ) {
186- assert_eq ! (
187- serde_json:: from_str:: <AccountTier >( "\" basic\" " ) . unwrap( ) ,
188- AccountTier :: Basic
189- ) ;
190- }
191- #[ cfg( feature = "unknown-variants" ) ]
192- #[ test]
193- fn unknown_deser ( ) {
194- assert_eq ! (
195- serde_json:: from_str:: <AccountTier >( "\" \" " ) . unwrap( ) ,
196- AccountTier :: Unknown ( "" . to_string( ) )
197- ) ;
198- assert_eq ! (
199- serde_json:: from_str:: <AccountTier >( "\" hisshiss\" " ) . unwrap( ) ,
200- AccountTier :: Unknown ( "hisshiss" . to_string( ) )
201- ) ;
202- assert ! ( serde_json:: to_string( & AccountTier :: Unknown ( "asdf" . to_string( ) ) ) . is_err( ) ) ;
203- }
204- #[ cfg( not( feature = "unknown-variants" ) ) ]
205- #[ test]
206- fn not_unknown_deser ( ) {
207- assert ! ( serde_json:: from_str:: <AccountTier >( "\" \" " ) . is_err( ) ) ;
208- assert ! ( serde_json:: from_str:: <AccountTier >( "\" hisshiss\" " ) . is_err( ) ) ;
209- }
210- }
211-
212212#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
213213#[ cfg_attr( feature = "utoipa" , derive( utoipa:: ToSchema ) ) ]
214214#[ typeshare:: typeshare]
@@ -285,3 +285,21 @@ pub struct UserUsageResponse {
285285 /// if no project usage data exists for user.
286286 pub projects : HashMap < String , ProjectUsageResponse > ,
287287}
288+
289+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
290+ #[ cfg_attr( feature = "utoipa" , derive( utoipa:: ToSchema ) ) ]
291+ #[ typeshare:: typeshare]
292+ pub struct AccountLimitsResponse {
293+ /// Number of projects the user currently has
294+ pub projects_count : Option < u32 > ,
295+ /// Number of projects the user may have total
296+ pub projects_limit : Option < u32 > ,
297+ /// Number of active projects the user currently has
298+ pub active_projects_count : Option < u32 > ,
299+ /// Number of projects the user may have active at once
300+ pub active_projects_limit : Option < u32 > ,
301+ /// Number of custom domains the user currently has
302+ pub certificate_count : Option < u32 > ,
303+ /// Number of custom domains the user may have total
304+ pub certificate_limit : Option < u32 > ,
305+ }
0 commit comments