コード例 #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());
        }
コード例 #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);
        }
コード例 #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();