internal new static RestSelfUser Create(BaseRestClient client, Model model) { var entity = new RestSelfUser(client, model.Id); entity.Update(model); return(entity); }
public static async Task <RestSelfUser> GetSelfUserAsync(BaseRestClient client, ulong userId) { if (TokenHelper.TryGetToken(client, userId, out RestTokenInfo info)) { throw new MissingScopeException("user_read"); } if (!info.Authorization.Scopes.Contains("user_read")) { throw new MissingScopeException("user_read"); } var model = await client.RestClient.GetSelfUserInternalAsync(info.Token); var entity = new RestSelfUser(client, model.Id); entity.Update(model); return(entity); }