Ejemplo n.º 1
0
        //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());
        }
Ejemplo n.º 2
0
        internal static RestGuildIntegration Create(BaseDiscordClient discord, IGuild guild, Model model)
        {
            RestGuildIntegration entity = new RestGuildIntegration(discord, guild, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 /// <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));
 }
Ejemplo n.º 5
0
 /// <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);
Ejemplo n.º 6
0
 /// <inheritdoc cref="RestGuildIntegration.ToString" />
 public override string ToString()
 => RestGuildIntegration.ToString();
Ejemplo n.º 7
0
 /// <inheritdoc />
 public Task SyncAsync()
 => RestGuildIntegration.SyncAsync();
Ejemplo n.º 8
0
 /// <inheritdoc />
 public Task ModifyAsync(Action <GuildIntegrationProperties> func)
 => RestGuildIntegration.ModifyAsync(func);
Ejemplo n.º 9
0
 /// <inheritdoc />
 public Task DeleteAsync()
 => RestGuildIntegration.DeleteAsync();