internal static RestApplication Create(BaseDiscordClient discord, Model model) { RestApplication entity = new RestApplication(discord, model.Id); entity.Update(model); return(entity); }
public async Task <RestApplication> GetApplicationInfoAsync(RequestOptions options = null) { return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false))); }
/// <inheritdoc /> internal override Task OnLogoutAsync() { _applicationInfo = null; return(Task.Delay(0)); }
public static async Task <RestApplication> GetApplicationInfoAsync(BaseDiscordClient client, RequestOptions options) { var model = await client.ApiClient.GetMyApplicationAsync(options).ConfigureAwait(false); return(RestApplication.Create(client, model)); }
/// <summary> /// Converts an existing <see cref="RestApplication"/> to an abstracted <see cref="IRestApplication"/> value. /// </summary> /// <param name="restApplication">The existing <see cref="RestApplication"/> to be abstracted.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restApplication"/>.</exception> /// <returns>An <see cref="IRestApplication"/> that abstracts <paramref name="restApplication"/>.</returns> public static IRestApplication Abstract(this RestApplication restApplication) => new RestApplicationAbstraction(restApplication);
/// <inheritdoc cref="RestApplication.ToString" /> public override string ToString() => RestApplication.ToString();
/// <inheritdoc /> public Task UpdateAsync() => RestApplication.UpdateAsync();
/// <summary> /// Constructs a new <see cref="RestApplicationAbstraction"/> around an existing <see cref="Rest.RestApplication"/>. /// </summary> /// <param name="restApplication">The value to use for <see cref="Rest.RestApplication"/>.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restApplication"/>.</exception> public RestApplicationAbstraction(RestApplication restApplication) { RestApplication = restApplication ?? throw new ArgumentNullException(nameof(restApplication)); }
/// <inheritdoc /> public async Task <RestApplication> GetApplicationInfoAsync() { return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this))); }