Commit d4cc3575 authored by Levente Polyak's avatar Levente Polyak
Browse files

api/users: Allow string UIDs for the ExternalProvider API data.

The GitLab API expects and allows arbitrary strings as UID as some
providers have non integer UIDs for mapping. Reflect the API and struct
name according to the actual API.
parent 17d1b1cc
Pipeline #230064 canceled with stages
in 33 seconds
# v0.1311.3
## Breaking changes
* Allow arbitrary strings for the UID of `ExternalProvider` matching what the
API expects and allows.
# v0.1311.2
## Additions
......@@ -56,8 +56,9 @@ impl ParamValue<'static> for UserOrderBy {
/// Representation of a user provided by an external service.
#[derive(Debug, Clone, PartialEq, Eq, Builder)]
pub struct ExternalProvider<'a> {
/// The ID of the user on the service.
pub id: u64,
/// The UID of the user on the service.
pub uid: Cow<'a, str>,
/// The name of the service.
pub name: Cow<'a, str>,
......@@ -202,7 +203,7 @@ impl<'a> Endpoint for Users<'a> {
if let Some(value) = self.external_provider.as_ref() {
.push("extern_uid", &value.uid)
.push("provider", &;
......@@ -242,30 +243,30 @@ mod tests {
fn external_provider_id_and_name_are_necessary() {
fn external_provider_uid_and_name_are_necessary() {
let err = ExternalProvider::builder().build().unwrap_err();
assert_eq!(err, "`id` must be initialized");
assert_eq!(err, "`uid` must be initialized");
fn external_provider_id_is_necessary() {
fn external_provider_uid_is_necessary() {
let err = ExternalProvider::builder()
assert_eq!(err, "`id` must be initialized");
assert_eq!(err, "`uid` must be initialized");
fn external_provider_name_is_necessary() {
let err = ExternalProvider::builder().id(1).build().unwrap_err();
let err = ExternalProvider::builder().uid("1").build().unwrap_err();
assert_eq!(err, "`name` must be initialized");
fn external_provider_id_and_name_are_sufficient() {
fn external_provider_uid_and_name_are_sufficient() {
......@@ -348,7 +349,7 @@ mod tests {
let endpoint = Users::builder()
.external_provider(ExternalProvider {
id: 1,
uid: "1".into(),
name: "provider".into(),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment