Skip to content

Commit 749eb3b

Browse files
author
kavin
committed
Fixed 422 error in list repositories for the authenticated user
1 parent c5c23eb commit 749eb3b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

github/src/repos.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8440,9 +8440,9 @@ impl Repos {
84408440
*/
84418441
pub async fn list_for_authenticated_user(
84428442
&self,
8443-
visibility: crate::types::ReposListVisibility,
8443+
visibility: Option<crate::types::ReposListVisibility>,
84448444
affiliation: &str,
8445-
type_: crate::types::ReposListType,
8445+
type_: Option<crate::types::ReposListType>,
84468446
sort: crate::types::ReposListOrgSort,
84478447
direction: crate::types::Order,
84488448
per_page: i64,
@@ -8472,10 +8472,10 @@ impl Repos {
84728472
if !sort.to_string().is_empty() {
84738473
query_args.push(("sort".to_string(), sort.to_string()));
84748474
}
8475-
if !type_.to_string().is_empty() {
8475+
if let Some(type_) = type_.filter(|type_| !type_.to_string().is_empty()) {
84768476
query_args.push(("type".to_string(), type_.to_string()));
84778477
}
8478-
if !visibility.to_string().is_empty() {
8478+
if let Some(visibility) = visibility.filter(|visibility| !visibility.to_string().is_empty()) {
84798479
query_args.push(("visibility".to_string(), visibility.to_string()));
84808480
}
84818481
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
@@ -8505,9 +8505,9 @@ impl Repos {
85058505
*/
85068506
pub async fn list_all_for_authenticated_user(
85078507
&self,
8508-
visibility: crate::types::ReposListVisibility,
8508+
visibility: Option<crate::types::ReposListVisibility>,
85098509
affiliation: &str,
8510-
type_: crate::types::ReposListType,
8510+
type_: Option<crate::types::ReposListType>,
85118511
sort: crate::types::ReposListOrgSort,
85128512
direction: crate::types::Order,
85138513
since: Option<chrono::DateTime<chrono::Utc>>,
@@ -8529,10 +8529,10 @@ impl Repos {
85298529
if !sort.to_string().is_empty() {
85308530
query_args.push(("sort".to_string(), sort.to_string()));
85318531
}
8532-
if !type_.to_string().is_empty() {
8532+
if let Some(type_) = type_.filter(|type_| !type_.to_string().is_empty()) {
85338533
query_args.push(("type".to_string(), type_.to_string()));
85348534
}
8535-
if !visibility.to_string().is_empty() {
8535+
if let Some(visibility) = visibility.filter(|visibility| !visibility.to_string().is_empty()) {
85368536
query_args.push(("visibility".to_string(), visibility.to_string()));
85378537
}
85388538
let query_ = serde_urlencoded::to_string(&query_args).unwrap();

0 commit comments

Comments
 (0)