示例#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());
        }
        internal static RestGuildIntegration Create(BaseDiscordClient discord, IGuild guild, Model model)
        {
            RestGuildIntegration entity = new RestGuildIntegration(discord, guild, model.Id);

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