//Integrations public static async Task <IReadOnlyCollection <RestGuildIntegration> > GetIntegrationsAsync(IGuild guild, BaseDiscordClient client, RequestOptions options) { var models = await client.ApiClient.GetGuildIntegrationsAsync(guild.Id, options).ConfigureAwait(false); return(models.Select(x => RestGuildIntegration.Create(client, guild, x)).ToImmutableArray()); }
internal static RestGuildIntegration Create(BaseDiscordClient discord, IGuild guild, Model model) { RestGuildIntegration entity = new RestGuildIntegration(discord, guild, model.Id); entity.Update(model); return(entity); }
public static async Task <RestGuildIntegration> CreateIntegrationAsync(IGuild guild, BaseDiscordClient client, ulong id, string type, RequestOptions options) { var args = new CreateGuildIntegrationParams(id, type); var model = await client.ApiClient.CreateGuildIntegrationAsync(guild.Id, args, options).ConfigureAwait(false); return(RestGuildIntegration.Create(client, guild, model)); }
/// <summary> /// Constructs a new <see cref="RestGuildIntegrationAbstraction"/> around an existing <see cref="Rest.RestGuildIntegration"/>. /// </summary> /// <param name="restGuildIntegration">The value to use for <see cref="Rest.RestGuildIntegration"/>.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restGuildIntegration"/>.</exception> public RestGuildIntegrationAbstraction(RestGuildIntegration restGuildIntegration) { RestGuildIntegration = restGuildIntegration ?? throw new ArgumentNullException(nameof(restGuildIntegration)); }
/// <summary> /// Converts an existing <see cref="RestGuildIntegration"/> to an abstracted <see cref="IRestGuildIntegration"/> value. /// </summary> /// <param name="restGuildIntegration">The existing <see cref="RestGuildIntegration"/> to be abstracted.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="restGuildIntegration"/>.</exception> /// <returns>An <see cref="IRestGuildIntegration"/> that abstracts <paramref name="restGuildIntegration"/>.</returns> public static IRestGuildIntegration Abstract(this RestGuildIntegration restGuildIntegration) => new RestGuildIntegrationAbstraction(restGuildIntegration);
/// <inheritdoc cref="RestGuildIntegration.ToString" /> public override string ToString() => RestGuildIntegration.ToString();
/// <inheritdoc /> public Task SyncAsync() => RestGuildIntegration.SyncAsync();
/// <inheritdoc /> public Task ModifyAsync(Action <GuildIntegrationProperties> func) => RestGuildIntegration.ModifyAsync(func);
/// <inheritdoc /> public Task DeleteAsync() => RestGuildIntegration.DeleteAsync();