1. Stylelabs.M.Sdk.Models.Clients

Class UserClientBase

Client for fetching user entities and user related actions.

Inheritance

object

UserClientBase

Implements

IUsersClient

Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsClients

Assembly: Stylelabs.M.Sdk.dll

Syntax

public abstract class UserClientBase : IUsersClient

Constructors

UserClientBase(IMClient)

Initializes a new instance of the UserClientBase class.

Declaration

public UserClientBase(IMClient client)

Parameters

TypeNameDescription
IMClientclientThe IMClient.

Properties

MClient

Gets the client.

Declaration

protected IMClient MClient { get; }

Property Value

TypeDescription
IMClient

Methods

GetUserAsync(long, IEntityLoadConfiguration)

Gets the specified user entity.

Declaration

public virtual Task<IEntity> GetUserAsync(long id, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
longidThe id of the user.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IEntityThe user entity or null when it was not found.

GetUserAsync(string, IEntityLoadConfiguration)

Gets the specified user entity.

Declaration

public virtual Task<IEntity> GetUserAsync(string username, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
stringusernameUsername of the user.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IEntityThe user or null when it was not found.

GetUserGroupAsync(long, IEntityLoadConfiguration)

Gets the specified user group entity.

Declaration

public virtual Task<IEntity> GetUserGroupAsync(long id, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
longidId of the user.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IEntityThe user or null when it was not found.

GetUserGroupAsync(string, IEntityLoadConfiguration)

Gets the user group by the specified name.

Declaration

public virtual Task<IEntity> GetUserGroupAsync(string groupName, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
stringgroupNameName of the group.
IEntityLoadConfigurationloadConfigurationThe loading configuration.

Returns

TypeDescription
Task<>IEntityThe user group entity or null when it was not found.

GetUserGroupIdAsync(string)

Gets the ids of the specified user groups by name.

Declaration

public virtual Task<long?> GetUserGroupIdAsync(string groupName)

Parameters

TypeNameDescription
stringgroupNameThe groupName name.

Returns

TypeDescription
Task<>longThe group's id or null when it was not found.

GetUserGroupIdsAsync(IEnumerable)

Gets the ids of the specified user groups by name.

Declaration

public virtual Task<IDictionary<string, long>> GetUserGroupIdsAsync(IEnumerable<string> groupNames)

Parameters

TypeNameDescription
IEnumerable<>stringgroupNamesA list of group names.

Returns

TypeDescription
Task<>IDictionary<, >stringlongNon null, case-insensitive dictionary that maps the user group names to ids. Users that don't exist, will not be in the result.

GetUserGroupNameAsync(long)

Gets the name of the specified user group.

Declaration

public virtual Task<string> GetUserGroupNameAsync(long id)

Parameters

TypeNameDescription
longidThe id of the user group.

Returns

TypeDescription
Task<>stringThe group name or null when it was not found.

GetUserGroupNamesAsync(IEnumerable)

Gets the name of the specified user groups.

Declaration

public virtual Task<IDictionary<long, string>> GetUserGroupNamesAsync(IEnumerable<long> ids)

Parameters

TypeNameDescription
IEnumerable<>longidsThe ids of user groups.

Returns

TypeDescription
Task<>IDictionary<, >longstringNon null dictionary that maps the user group ids to user group names. Users that don't exist, will not be in the result.

GetUserGroupsAsync(IEnumerable, IEntityLoadConfiguration)

Gets the specified user group entities.

Declaration

public virtual Task<IList<IEntity>> GetUserGroupsAsync(IEnumerable<long> ids, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
IEnumerable<>longidsThe ids of the user groups.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IList<>IEntityThe user group entities. Can contain null when a user group was not found.

GetUserGroupsAsync(IEnumerable, IEntityLoadConfiguration)

Gets the specified user group entities.

Declaration

public virtual Task<IList<IEntity>> GetUserGroupsAsync(IEnumerable<string> groupNames, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
IEnumerable<>stringgroupNamesThe names of the user groups.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IList<>IEntityThe user group entities. Can contain null when a user group was not found.

GetUserIdAsync(string)

Gets the id of the specified user by username.

Declaration

public virtual Task<long?> GetUserIdAsync(string username)

Parameters

TypeNameDescription
stringusernameThe user name.

Returns

TypeDescription
Task<>longThe user's id or null when it was not found.

GetUserIdsAsync(IEnumerable)

Gets the ids of the specified users by username.

Declaration

public virtual Task<IDictionary<string, long>> GetUserIdsAsync(IEnumerable<string> usernames)

Parameters

TypeNameDescription
IEnumerable<>stringusernamesA list of user names.

Returns

TypeDescription
Task<>IDictionary<, >stringlongNon null, case-insensitive dictionary that maps the user names to ids. Users that don't exist, will not be in the result.

GetUsernameAsync(long)

Gets the username of the specified user.

Declaration

public virtual Task<string> GetUsernameAsync(long id)

Parameters

TypeNameDescription
longidThe id of the user.

Returns

TypeDescription
Task<>stringThe username or null when it was not found.

GetUsernamesAsync(IEnumerable)

Gets the usernames of the specified users.

Declaration

public virtual Task<IDictionary<long, string>> GetUsernamesAsync(IEnumerable<long> ids)

Parameters

TypeNameDescription
IEnumerable<>longidsThe ids of the entities to get.

Returns

TypeDescription
Task<>IDictionary<, >longstringNon null dictionary that maps the user ids to usernames. Users that don't exist, will not be in the result.

GetUsersAsync(IEnumerable, IEntityLoadConfiguration)

Gets the specified user entities.

Declaration

public virtual Task<IList<IEntity>> GetUsersAsync(IEnumerable<long> ids, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
IEnumerable<>longidsThe ids of the users.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IList<>IEntityThe user entities. Can contain null when a user was not found.

GetUsersAsync(IEnumerable, IEntityLoadConfiguration)

Gets the specified user entities.

Declaration

public virtual Task<IList<IEntity>> GetUsersAsync(IEnumerable<string> usernames, IEntityLoadConfiguration loadConfiguration = null)

Parameters

TypeNameDescription
IEnumerable<>stringusernamesA list of user names.
IEntityLoadConfigurationloadConfigurationThe load configuration.

Returns

TypeDescription
Task<>IList<>IEntityThe user entities. Can contain null when a user was not found.

ResetPasswordAsync(long)

Resets the password of the specified user. This sends an e-mail to the specified user with a link to choose a new password.

Declaration

public abstract Task ResetPasswordAsync(long id)

Parameters

TypeNameDescription
longidId of the user.

Returns

TypeDescription
TaskA representing the asynchronous operation.

Exceptions

TypeCondition
ForbiddenExceptionWhen the current user is not a superuser.

SetPasswordAsync(long, string)

Changes the password of the specified user.

Declaration

public abstract Task SetPasswordAsync(long id, string password)

Parameters

TypeNameDescription
longidThe user id to change the password on.
stringpasswordThe password to reset.

Returns

TypeDescription
TaskA representing the asynchronous operation.

Exceptions

TypeCondition
ForbiddenExceptionWhen the current user is not a superuser.

Implements

IUsersClient

If you have suggestions for improving this article, let us know!