/// <inheritdoc /> internal override async Task OnLoginAsync(TokenType tokenType, string token) { API.UserJson user = await ApiClient.GetMyUserAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false); ApiClient.CurrentUserId = user.Id; base.CurrentUser = RestSelfUser.Create(this, user); }
internal new static RestSelfUser Create(BaseDiscordClient discord, Model model) { var entity = new RestSelfUser(discord, model.Id); entity.Update(model); return(entity); }
/// <summary> /// Converts an existing <see cref="RestSelfUser"/> to an abstracted <see cref="IRestSelfUser"/> value. /// </summary> /// <param name="restSelfUser">The existing <see cref="RestSelfUser"/> to be abstracted.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restSelfUser"/>.</exception> /// <returns>An <see cref="IRestSelfUser"/> that abstracts <paramref name="restSelfUser"/>.</returns> public static IRestSelfUser Abstract(this RestSelfUser restSelfUser) => new RestSelfUserAbstraction(restSelfUser);
/// <inheritdoc /> public Task ModifyAsync(Action <SelfUserProperties> func, RequestOptions options = null) => RestSelfUser.ModifyAsync(func, options);
/// <summary> /// Constructs a new <see cref="RestSelfUserAbstraction"/> around an existing <see cref="Rest.RestSelfUser"/>. /// </summary> /// <param name="restSelfUser">The value to use for <see cref="Rest.RestSelfUser"/>.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restSelfUser"/>.</exception> public RestSelfUserAbstraction(RestSelfUser restSelfUser) : base(restSelfUser) { }