From 749eb3b0684e758da33b2af2e6f67fbb1682ca90 Mon Sep 17 00:00:00 2001 From: kavin Date: Wed, 29 Jun 2022 09:43:11 +0000 Subject: [PATCH] Fixed 422 error in list repositories for the authenticated user --- github/src/repos.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/github/src/repos.rs b/github/src/repos.rs index 87b42f3e..daaf783e 100644 --- a/github/src/repos.rs +++ b/github/src/repos.rs @@ -8440,9 +8440,9 @@ impl Repos { */ pub async fn list_for_authenticated_user( &self, - visibility: crate::types::ReposListVisibility, + visibility: Option, affiliation: &str, - type_: crate::types::ReposListType, + type_: Option, sort: crate::types::ReposListOrgSort, direction: crate::types::Order, per_page: i64, @@ -8472,10 +8472,10 @@ impl Repos { if !sort.to_string().is_empty() { query_args.push(("sort".to_string(), sort.to_string())); } - if !type_.to_string().is_empty() { + if let Some(type_) = type_.filter(|type_| !type_.to_string().is_empty()) { query_args.push(("type".to_string(), type_.to_string())); } - if !visibility.to_string().is_empty() { + if let Some(visibility) = visibility.filter(|visibility| !visibility.to_string().is_empty()) { query_args.push(("visibility".to_string(), visibility.to_string())); } let query_ = serde_urlencoded::to_string(&query_args).unwrap(); @@ -8505,9 +8505,9 @@ impl Repos { */ pub async fn list_all_for_authenticated_user( &self, - visibility: crate::types::ReposListVisibility, + visibility: Option, affiliation: &str, - type_: crate::types::ReposListType, + type_: Option, sort: crate::types::ReposListOrgSort, direction: crate::types::Order, since: Option>, @@ -8529,10 +8529,10 @@ impl Repos { if !sort.to_string().is_empty() { query_args.push(("sort".to_string(), sort.to_string())); } - if !type_.to_string().is_empty() { + if let Some(type_) = type_.filter(|type_| !type_.to_string().is_empty()) { query_args.push(("type".to_string(), type_.to_string())); } - if !visibility.to_string().is_empty() { + if let Some(visibility) = visibility.filter(|visibility| !visibility.to_string().is_empty()) { query_args.push(("visibility".to_string(), visibility.to_string())); } let query_ = serde_urlencoded::to_string(&query_args).unwrap();