public static async Task <RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, string inviteId, RequestOptions options) { API.InviteMetadataJson model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false); if (model != null) { return(RestInviteMetadata.Create(client, null, null, model)); } return(null); }
/// <exception cref="ArgumentException"> /// <paramref name="channel.Id"/> may not be equal to zero. /// -and- /// <paramref name="maxAge"/> and <paramref name="maxUses"/> must be greater than zero. /// -and- /// <paramref name="maxAge"/> must be lesser than 86400. /// </exception> public static async Task <RestInviteMetadata> CreateInviteAsync(IGuildChannel channel, BaseDiscordClient client, int?maxAge, int?maxUses, bool isTemporary, bool isUnique, RequestOptions options) { CreateChannelInviteParams args = new API.Rest.CreateChannelInviteParams { IsTemporary = isTemporary, IsUnique = isUnique, MaxAge = maxAge ?? 0, MaxUses = maxUses ?? 0 }; API.InviteMetadataJson model = await client.ApiClient.CreateChannelInviteAsync(channel.Id, args, options).ConfigureAwait(false); return(RestInviteMetadata.Create(client, null, channel, model)); }
/// <inheritdoc /> public async Task UpdateAsync(RequestOptions options = null) { API.InviteMetadataJson model = await Discord.ApiClient.GetInviteAsync(Code, options).ConfigureAwait(false); Update(model); }