internal static RestUser Create(BaseDiscordClient discord, IGuild guild, Model model, ulong?webhookId) { RestUser entity; if (webhookId.HasValue) { entity = new RestWebhookUser(discord, guild, model.Id, webhookId.Value); } else { entity = new RestUser(discord, model.Id); } entity.Update(model); return(entity); }
/// <summary> /// Constructs a new <see cref="RestWebhookUserAbstraction"/> around an existing <see cref="WebRest.RestWebhookUser"/>. /// </summary> /// <param name="restWebhookUser">The value to use for <see cref="WebRest.RestWebhookUser"/>.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restWebhookUser"/>.</exception> public RestWebhookUserAbstraction(RestWebhookUser restWebhookUser) : base(restWebhookUser) { }
/// <summary> /// Converts an existing <see cref="RestWebhookUser"/> to an abstracted <see cref="IRestWebhookUser"/> value. /// </summary> /// <param name="restWebhookUser">The existing <see cref="RestWebhookUser"/> to be abstracted.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restWebhookUser"/>.</exception> /// <returns>An <see cref="IRestWebhookUser"/> that abstracts <paramref name="restWebhookUser"/>.</returns> public static IRestWebhookUser Abstract(this RestWebhookUser restWebhookUser) => new RestWebhookUserAbstraction(restWebhookUser);