@@ -17,40 +17,14 @@ use std::time::Duration;
1717#[ derive( Debug , Serialize ) ]
1818pub struct ApiProjectFilter < ' a > {
1919 #[ serde( skip_serializing_if = "Option::is_none" ) ]
20- name : Option < & ' a str > ,
20+ pub name : Option < & ' a str > ,
2121
2222 #[ serde( skip_serializing_if = "Option::is_none" ) ]
23- metadata : Option < HashMap < & ' a str , & ' a str > >
24- }
25- impl < ' a > ApiProjectFilter < ' a > {
26- pub fn new ( name : & ' a str , metadata : HashMap < & ' a str , & ' a str > ) -> ApiProjectFilter < ' a > {
27- ApiProjectFilter {
28- name : Some ( name) ,
29- metadata : Some ( metadata)
30- }
31- }
32- #[ allow( dead_code) ]
33- pub fn empty ( ) -> ApiProjectFilter < ' static > {
34- ApiProjectFilter { name : None , metadata : None }
35- }
36- #[ allow( dead_code) ]
37- pub fn with_name ( & self , name : & ' a str ) -> ApiProjectFilter < ' a > {
38- ApiProjectFilter {
39- name : Some ( name) ,
40- metadata : self . metadata . clone ( )
41- }
42- }
43- #[ allow( dead_code) ]
44- pub fn with_metadata ( & self , metadata : HashMap < & ' a str , & ' a str > ) -> ApiProjectFilter < ' a > {
45- ApiProjectFilter {
46- name : self . name ,
47- metadata : Some ( metadata)
48- }
49- }
23+ pub metadata : Option < HashMap < & ' a str , & ' a str > >
5024}
5125
5226/// A project provided by the Code Dx API.
53- #[ derive( Debug , Deserialize ) ]
27+ #[ derive( Debug , Deserialize , Serialize ) ]
5428pub struct ApiProject {
5529 pub id : u32 ,
5630 pub name : String ,
@@ -179,7 +153,7 @@ pub trait PollingStrategy<T> {
179153/// Simple polling strategy that always waits a fixed amount of time between iterations.
180154impl < T : Debug > PollingStrategy < T > for Duration {
181155 fn next_wait ( & self , iteration_number : usize , state : & T ) -> Option < Duration > {
182- println ! ( "in poll ( iteration {}, state: {:?}) " , iteration_number, state) ;
156+ println ! ( "# Polling job completion, iteration {}: status = {:?}" , iteration_number, state) ;
183157 Some ( * self )
184158 }
185159}
@@ -242,6 +216,10 @@ impl ApiClient {
242216 ApiClient { config, client }
243217 }
244218
219+ pub fn get_config ( & self ) -> & ClientConfig {
220+ self . config . as_ref ( )
221+ }
222+
245223 pub fn get_job_status ( & self , job_id : & str ) -> ApiResult < JobStatus > {
246224 self . api_get ( & [ "api" , "jobs" , job_id] )
247225 . expect_success ( )
0 commit comments