示例#1
0
        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));
 }
示例#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));
        }
示例#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);
示例#6
0
 /// <inheritdoc cref="RestApplication.ToString" />
 public override string ToString()
 => RestApplication.ToString();
示例#7
0
 /// <inheritdoc />
 public Task UpdateAsync()
 => RestApplication.UpdateAsync();
示例#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));
 }
示例#9
0
 /// <inheritdoc />
 public async Task <RestApplication> GetApplicationInfoAsync()
 {
     return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this)));
 }