Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/paginate through all jobs list #63

Merged
merged 3 commits into from
Oct 1, 2023

Conversation

Shirlo
Copy link
Contributor

@Shirlo Shirlo commented Sep 25, 2023

This PR adds a method to allow users to paginate through all the jobs in the jobs list. It is helpful as it allows people to obtain all of the jobs from the list jobs API.

Also, fix a bug in JobListJobs and Job struct, the API sends user_email in this format and not in camel case like in the struct.

Copy link
Owner

@lquerel lquerel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution. It's a great addition to this crate. I've made two requests; once they're addressed, we'll be ready to go.


let process_resp: Result<JobList, BQError> = process_response(resp).await;

yield Ok(process_resp.as_ref().expect("JobList is not present").clone());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A missing JobList should not be treated as a fatal error. Therefore, this expect should be replaced with a BQError to allow the caller to handle this error appropriately.

#[serde(skip_serializing_if = "Option::is_none")]
pub parent_job_id: Option<String>,
/// Restrict information returned to a set of selected fields. Acceptable values are: full or minimal.
#[serde(skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_projection")]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use an enum with two variants: full and minimal, and let Serde handle the serialization?

@lquerel lquerel merged commit becf942 into lquerel:main Oct 1, 2023
@lquerel
Copy link
Owner

lquerel commented Oct 1, 2023

I made few changes to your code.
Version 0.17.1 available on crates.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants