Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.01k stars 131 forks source link

Unable to access elements of ListCoursesResponse #448

Closed pmnlla closed 10 months ago

pmnlla commented 10 months ago

Heyo! I'm trying to access the course list of hub.courses().list().doit().await; where I assume that each course is a separate Course struct, through the following piece of code:

    match req {
        Err(e) => print!("{}",e),
        Ok(output) => courseListParse(output.1, clist),
    }

 // outside of function...

 fn courseListParse(mut response:ListCoursesResponse, mut clist:Vec<class::classType>){
    for i in &response.courses{
        println!("{:?}\n", i); // this print statement is a placeholder so i can view the data returned by the gclassroom api, and later aggregate it
    }
}

however, i am running into an issue where the data returned by response.courses is a single element, probably a vector of classes. I cannot access any elements of this vector through this current function.

I'm quite new to rust, so if I'm making any obvious mistake, please let me know. I did look over rustdoc and found out that the courses variable in ListCoursesResponse is a vector of Courses, which I think would typically be accessible through response.courses.[0-x] as per a typical vector.