confluence-go-api icon indicating copy to clipboard operation
confluence-go-api copied to clipboard

Search user by key

Open WayneSpiteri opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. When i read certain pages on our confluence i get back the ri:user that has a userkey identifier. In order to retrieve the user i need to be able to search by key instead of username and accountId

Describe the solution you'd like To support this, in the user.go file change this

if strings.Contains(query, ":") {
	data.Set("accountId", strings.Split(query, ":")[1])
} else {
	data.Set("username", query)
}

to this

if strings.Contains(query, ":") {
	customLookup := strings.Split(query, ":")
	if customLookup[0] == "key" {
		data.Set("key", customLookup[1])
	} else {
		data.Set("accountId", customLookup[1])
	}
} else {
	data.Set("username", query)
}

WayneSpiteri avatar Jun 04 '22 05:06 WayneSpiteri