11use anyhow:: Result ;
22use serde_json:: { json, Value } ;
3- use shuttle_api_client:: { util:: ToBodyContent , ShuttleApiClient } ;
3+ use shuttle_api_client:: {
4+ util:: { ParsedJson , ToBodyContent } ,
5+ ShuttleApiClient ,
6+ } ;
47use shuttle_common:: models:: {
58 project:: { ProjectResponse , ProjectUpdateRequest } ,
69 team:: AddTeamMemberRequest ,
@@ -18,11 +21,13 @@ impl Client {
1821 }
1922 }
2023
21- pub async fn get_old_certificates ( & self ) -> Result < Vec < ( String , String , Option < String > ) > > {
24+ pub async fn get_old_certificates (
25+ & self ,
26+ ) -> Result < ParsedJson < Vec < ( String , String , Option < String > ) > > > {
2227 self . inner . get_json ( "/admin/certificates" ) . await
2328 }
2429
25- pub async fn renew_certificate ( & self , cert_id : & str ) -> Result < String > {
30+ pub async fn renew_certificate ( & self , cert_id : & str ) -> Result < ParsedJson < String > > {
2631 self . inner
2732 . put_json (
2833 format ! ( "/admin/certificates/renew/{cert_id}" ) ,
@@ -35,7 +40,7 @@ impl Client {
3540 & self ,
3641 project_id : & str ,
3742 config : serde_json:: Value ,
38- ) -> Result < ProjectResponse > {
43+ ) -> Result < ParsedJson < ProjectResponse > > {
3944 self . inner
4045 . put_json (
4146 format ! ( "/projects/{project_id}" ) ,
@@ -47,13 +52,13 @@ impl Client {
4752 . await
4853 }
4954
50- pub async fn get_project_config ( & self , project_id : & str ) -> Result < Value > {
55+ pub async fn get_project_config ( & self , project_id : & str ) -> Result < ParsedJson < Value > > {
5156 self . inner
5257 . get_json ( format ! ( "/admin/projects/{project_id}/config" ) )
5358 . await
5459 }
5560
56- pub async fn upgrade_project_to_lb ( & self , project_id : & str ) -> Result < Value > {
61+ pub async fn upgrade_project_to_lb ( & self , project_id : & str ) -> Result < ParsedJson < Value > > {
5762 self . inner
5863 . put_json (
5964 format ! ( "/admin/projects/{project_id}/config" ) ,
@@ -66,7 +71,7 @@ impl Client {
6671 & self ,
6772 project_id : & str ,
6873 update_config : & Value ,
69- ) -> Result < Value > {
74+ ) -> Result < ParsedJson < Value > > {
7075 self . inner
7176 . put_json (
7277 format ! ( "/admin/projects/{project_id}/scale" ) ,
@@ -79,7 +84,7 @@ impl Client {
7984 & self ,
8085 project_id : & str ,
8186 user_id : String ,
82- ) -> Result < ProjectResponse > {
87+ ) -> Result < ParsedJson < ProjectResponse > > {
8388 self . inner
8489 . put_json (
8590 format ! ( "/projects/{project_id}" ) ,
@@ -91,7 +96,11 @@ impl Client {
9196 . await
9297 }
9398
94- pub async fn add_team_member ( & self , team_user_id : & str , user_id : String ) -> Result < String > {
99+ pub async fn add_team_member (
100+ & self ,
101+ team_user_id : & str ,
102+ user_id : String ,
103+ ) -> Result < ParsedJson < String > > {
95104 self . inner
96105 . post_json (
97106 format ! ( "/teams/{team_user_id}/members" ) ,
@@ -126,32 +135,32 @@ impl Client {
126135 }
127136 }
128137
129- pub async fn gc_free_tier ( & self , days : u32 ) -> Result < Vec < String > > {
138+ pub async fn gc_free_tier ( & self , days : u32 ) -> Result < ParsedJson < Vec < String > > > {
130139 let path = format ! ( "/admin/gc/free/{days}" ) ;
131140 self . inner . get_json ( & path) . await
132141 }
133142
134- pub async fn gc_shuttlings ( & self , minutes : u32 ) -> Result < Vec < String > > {
143+ pub async fn gc_shuttlings ( & self , minutes : u32 ) -> Result < ParsedJson < Vec < String > > > {
135144 let path = format ! ( "/admin/gc/shuttlings/{minutes}" ) ;
136145 self . inner . get_json ( & path) . await
137146 }
138147
139- pub async fn stop_gc_inactive_project ( & self , project_id : & str ) -> Result < String > {
148+ pub async fn stop_gc_inactive_project ( & self , project_id : & str ) -> Result < ParsedJson < String > > {
140149 let path = format ! ( "/admin/gc/stop-inactive-project/{project_id}" ) ;
141150 self . inner . put_json ( & path, Option :: < ( ) > :: None ) . await
142151 }
143152
144- pub async fn get_user ( & self , user_id : & str ) -> Result < UserResponse > {
153+ pub async fn get_user ( & self , user_id : & str ) -> Result < ParsedJson < UserResponse > > {
145154 self . inner . get_json ( format ! ( "/admin/users/{user_id}" ) ) . await
146155 }
147156
148- pub async fn get_user_everything ( & self , query : & str ) -> Result < Value > {
157+ pub async fn get_user_everything ( & self , query : & str ) -> Result < ParsedJson < Value > > {
149158 self . inner
150159 . get_json_with_body ( "/admin/users/everything" , json ! ( query) )
151160 . await
152161 }
153162
154- pub async fn delete_user ( & self , user_id : & str ) -> Result < String > {
163+ pub async fn delete_user ( & self , user_id : & str ) -> Result < ParsedJson < String > > {
155164 self . inner
156165 . delete_json ( format ! ( "/admin/users/{user_id}" ) )
157166 . await
@@ -168,10 +177,11 @@ impl Client {
168177 . await
169178 }
170179
171- pub async fn get_expired_protrials ( & self ) -> Result < Vec < String > > {
180+ pub async fn get_expired_protrials ( & self ) -> Result < ParsedJson < Vec < String > > > {
172181 self . inner . get_json ( "/admin/users/protrial-downgrade" ) . await
173182 }
174- pub async fn downgrade_protrial ( & self , user_id : & str ) -> Result < String > {
183+
184+ pub async fn downgrade_protrial ( & self , user_id : & str ) -> Result < ParsedJson < String > > {
175185 self . inner
176186 . put_json (
177187 format ! ( "/admin/users/protrial-downgrade/{user_id}" ) ,
@@ -180,10 +190,10 @@ impl Client {
180190 . await
181191 }
182192
183- pub async fn get_projects_for_retention_policy ( & self ) -> Result < Vec < String > > {
193+ pub async fn get_projects_for_retention_policy ( & self ) -> Result < ParsedJson < Vec < String > > > {
184194 self . inner . get_json ( "/admin/log-retention" ) . await
185195 }
186- pub async fn fix_retention_policy ( & self , project_id : & str ) -> Result < String > {
196+ pub async fn fix_retention_policy ( & self , project_id : & str ) -> Result < ParsedJson < String > > {
187197 self . inner
188198 . put_json (
189199 format ! ( "/admin/log-retention/{project_id}" ) ,
0 commit comments