Ejemplo n.º 1
0
        internal static RestApplication Create(BaseDiscordClient discord, Model model)
        {
            RestApplication entity = new RestApplication(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 2
0
 public async Task <RestApplication> GetApplicationInfoAsync(RequestOptions options = null)
 {
     return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false)));
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 internal override Task OnLogoutAsync()
 {
     _applicationInfo = null;
     return(Task.Delay(0));
 }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
0
 /// <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);
Ejemplo n.º 6
0
 /// <inheritdoc cref="RestApplication.ToString" />
 public override string ToString()
 => RestApplication.ToString();
Ejemplo n.º 7
0
 /// <inheritdoc />
 public Task UpdateAsync()
 => RestApplication.UpdateAsync();
Ejemplo n.º 8
0
 /// <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));
 }
Ejemplo n.º 9
0
 /// <inheritdoc />
 public async Task <RestApplication> GetApplicationInfoAsync()
 {
     return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this)));
 }