コード例 #1
0
        internal static RestApplication Create(BaseDiscordClient discord, Model model)
        {
            RestApplication entity = new RestApplication(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
コード例 #2
0
 public async Task <RestApplication> GetApplicationInfoAsync(RequestOptions options = null)
 {
     return(_applicationInfo ?? (_applicationInfo = await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false)));
 }
コード例 #3
0
 /// <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)));
 }