From 93800c1fde3df4867c7cb1bbf18f1993c6a02b21 Mon Sep 17 00:00:00 2001 From: Thomas CAZALI Date: Mon, 4 Apr 2022 17:59:17 +0200 Subject: [PATCH 1/2] Add "bot" field and search capabilities for users Since Project Access Token and Group Access Token, there is a "bot" field in the User json structure returned by the API. See: https://docs.gitlab.com/ee/api/users.html#single-user Also, from 14.10 it is possible to exclude bots from search result using the "without_project_bots" boolean request parameter. It has been added in the ListUsersOptions struct. --- users.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/users.go b/users.go index a92207cd0..04f1e05b0 100644 --- a/users.go +++ b/users.go @@ -75,6 +75,7 @@ type User struct { WebsiteURL string `json:"website_url"` Organization string `json:"organization"` JobTitle string `json:"job_title"` + Bot bool `json:"bot"` ExternUID string `json:"extern_uid"` Provider string `json:"provider"` ThemeID int `json:"theme_id"` @@ -131,6 +132,7 @@ type ListUsersOptions struct { External *bool `url:"external,omitempty" json:"external,omitempty"` WithoutProjects *bool `url:"without_projects,omitempty" json:"without_projects,omitempty"` WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` + WithoutProjectBots *bool `url:"without_project_bots,omitempty" json:"without_project_bots,omitempty"` } // ListUsers gets a list of users. From 271bf20c4c469f0f1407d8d686b33a31338b2a69 Mon Sep 17 00:00:00 2001 From: Thomas CAZALI Date: Tue, 5 Apr 2022 15:47:26 +0200 Subject: [PATCH 2/2] mv Bot between Bio and Location Moved the "Bot" field between "Bio" and "Location" as described in the Single User documentation (https://docs.gitlab.com/ee/api/users.html#for-user). --- users.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users.go b/users.go index 04f1e05b0..2cf25fb00 100644 --- a/users.go +++ b/users.go @@ -67,6 +67,7 @@ type User struct { WebURL string `json:"web_url"` CreatedAt *time.Time `json:"created_at"` Bio string `json:"bio"` + Bot bool `json:"bot"` Location string `json:"location"` PublicEmail string `json:"public_email"` Skype string `json:"skype"` @@ -75,7 +76,6 @@ type User struct { WebsiteURL string `json:"website_url"` Organization string `json:"organization"` JobTitle string `json:"job_title"` - Bot bool `json:"bot"` ExternUID string `json:"extern_uid"` Provider string `json:"provider"` ThemeID int `json:"theme_id"`