rest

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package rest handles the REST API of Discord

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoEmptyRequest added in v0.4.0

func DoEmptyRequest(client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) error

func DoEmptyRequestWithFiles added in v0.4.0

func DoEmptyRequestWithFiles(client *Client, method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) error

func DoRequestAsList added in v0.3.0

func DoRequestAsList[T any](client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) ([]T, error)

func DoRequestAsStructure added in v0.4.0

func DoRequestAsStructure[T any](client *Client, method, url string, requestBody any, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) (*T, error)

func DoRequestWithFiles added in v0.4.0

func DoRequestWithFiles[T any](client *Client, method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) (*T, error)

Types

type Bucket

type Bucket struct {
	sync.Mutex
	Key       string
	Remaining int
	Limit     int
	ResetAt   time.Time
}

Bucket represents a rate limit bucket

func NewBucket

func NewBucket(key string) *Bucket

NewBucket returns a new bucket (rest.Bucket) based on a key

type Client

type Client struct {
	HttpClient  *HttpClient
	Logger      *tangra.Logger
	Debug       bool
	RateLimiter *RateLimiter
	TaskManager *tasks.TaskManager

	// Extras is a field you can use freely that will **never** be touched by the library itself
	Extras interface{}
	// contains filtered or unexported fields
}

Client is a client made to send REST API requests only

func New added in v0.6.0

func New(token string) *Client

New creates a new REST API client

func (*Client) AddGuildMemberRole added in v0.4.0

func (c *Client) AddGuildMemberRole(guildID, userID, roleID discord.Snowflake, reason string) error

AddGuildMemberRole adds a role (discord.Role) for the given guild, user and role IDs

func (*Client) AddThreadMember added in v0.4.0

func (c *Client) AddThreadMember(threadID, userID discord.Snowflake) error

AddThreadMember adds a member to a thread given the thread and user IDs

func (*Client) BeginGuildPrune added in v0.4.0

func (c *Client) BeginGuildPrune(guildID discord.Snowflake, prune discord.BeginGuildPrune) (*discord.GuildPrune, error)

BeginGuildPrune begins a guild prune operation (discord.GuildPrune) for the given guild ID and returns the number of members that were removed

func (*Client) BulkDeleteMessages added in v0.4.0

func (c *Client) BulkDeleteMessages(channelID discord.Snowflake, bulkDeleteMessages discord.BulkDeleteMessages) error

BulkDeleteMessages deletes multiple messages from the given channel ID in a single request

func (*Client) BulkOverwriteGlobalApplicationCommand added in v0.4.0

func (c *Client) BulkOverwriteGlobalApplicationCommand(applicationCommands []discord.CreateGlobalApplicationCommand) ([]discord.ApplicationCommand, error)

BulkOverwriteGlobalApplicationCommand overwrites all the existing global application commands (discord.ApplicationCommand) and returns a list of application command structures

func (*Client) BulkOverwriteGuildApplicationCommand added in v0.4.0

func (c *Client) BulkOverwriteGuildApplicationCommand(guildID discord.Snowflake, applicationCommands []discord.CreateGuildApplicationCommand) ([]discord.ApplicationCommand, error)

BulkOverwriteGuildApplicationCommand overwrites all the existing guild application commands (discord.ApplicationCommand) for the given guild ID and returns a list of application command structures

func (*Client) CreateAutoModerationRule added in v0.4.0

func (c *Client) CreateAutoModerationRule(guildID discord.Snowflake, autoModerationRule discord.CreateAutoModerationRule) (*discord.AutoModerationRule, error)

CreateAutoModerationRule creates a new auto moderation rule (discord.AutoModerationRule) and returns its structure

func (*Client) CreateChannelInvite added in v0.4.0

func (c *Client) CreateChannelInvite(channelID discord.Snowflake, invite discord.CreateChannelInvite) (*discord.Invite, error)

CreateChannelInvite creates a new invite (discord.Invite) for the given channel ID and returns its new structure

func (*Client) CreateDM added in v0.4.0

func (c *Client) CreateDM(userID discord.Snowflake) (*discord.Channel, error)

CreateDM creates a new DM channel (discord.Channel) for the given user ID and returns its structure

func (*Client) CreateFollowupMessage added in v0.6.0

func (c *Client) CreateFollowupMessage(interactionToken string, message discord.CreateFollowupMessage) (*discord.Message, error)

CreateFollowupMessage creates a followup message (discord.Message) for the given interaction token

func (*Client) CreateGlobalApplicationCommand added in v0.4.0

func (c *Client) CreateGlobalApplicationCommand(applicationCommand discord.CreateGlobalApplicationCommand) (*discord.ApplicationCommand, error)

CreateGlobalApplicationCommand creates a global application command (discord.ApplicationCommand) and returns its structure

func (*Client) CreateGuild added in v0.4.0

func (c *Client) CreateGuild(guild discord.CreateGuild) (*discord.Guild, error)

CreateGuild creates a guild (discord.Guild) and returns its structure

func (*Client) CreateGuildApplicationCommand added in v0.4.0

func (c *Client) CreateGuildApplicationCommand(guildID discord.Snowflake, applicationCommand discord.CreateGuildApplicationCommand) (*discord.ApplicationCommand, error)

CreateGuildApplicationCommand creates a guild application command (discord.ApplicationCommand) for the given guild ID and returns its structure

func (*Client) CreateGuildBan added in v0.4.0

func (c *Client) CreateGuildBan(guildID discord.Snowflake, ban discord.CreateGuildBan) error

CreateGuildBan creates a guild ban (discord.GuildBan) for the given guild ID

func (*Client) CreateGuildChannel added in v0.4.0

func (c *Client) CreateGuildChannel(guildID discord.Snowflake, channel discord.CreateGuildChannel) (*discord.Channel, error)

CreateGuildChannel creates a channel (discord.Channel) for the given guild ID and returns its structure

func (*Client) CreateGuildEmoji added in v0.4.0

func (c *Client) CreateGuildEmoji(guildID discord.Snowflake, emoji discord.CreateGuildEmoji) (*discord.Emoji, error)

CreateGuildEmoji creates a new emoji (discord.Emoji) for the given guild ID and returns its structure

func (*Client) CreateGuildFromTemplate added in v0.4.0

func (c *Client) CreateGuildFromTemplate(templateCode string, guild discord.CreateGuildFromTemplate) (*discord.Guild, error)

CreateGuildFromTemplate creates a guild (discord.Guild) based on the given template code and returns its structure

func (*Client) CreateGuildRole added in v0.4.0

func (c *Client) CreateGuildRole(guildID discord.Snowflake, role discord.CreateGuildRole) (*discord.Role, error)

CreateGuildRole creates a role (discord.Role) for the given guild ID and returns its structure

func (*Client) CreateGuildScheduledEvent added in v0.4.0

func (c *Client) CreateGuildScheduledEvent(guildID discord.Snowflake, scheduledEvent discord.CreateGuildScheduledEvent) (*discord.GuildScheduledEvent, error)

CreateGuildScheduledEvent creates a guild scheduled event (discord.GuildScheduledEvent) for the given guild ID and returns its structure

func (*Client) CreateGuildSticker added in v0.4.0

func (c *Client) CreateGuildSticker(guildID discord.Snowflake, sticker discord.CreateGuildSticker) (*discord.Sticker, error)

CreateGuildSticker creates a new sticker (discord.Sticker) for the given guild ID and returns its structure **Warning**: Seems to not be working at the moment, always giving "Invalid Asset"

func (*Client) CreateGuildTemplate added in v0.4.0

func (c *Client) CreateGuildTemplate(guildID discord.Snowflake, guildTemplate discord.CreateGuildTemplate) (*discord.GuildTemplate, error)

CreateGuildTemplate creates a guild template (discord.GuildTemplate) for the given guild ID and returns its structure

func (*Client) CreateInteractionResponse added in v0.6.0

func (c *Client) CreateInteractionResponse(interactionID discord.Snowflake, interactionToken string, interactionResponse discord.CreateInteractionResponse) error

CreateInteractionResponse creates a response to an interaction (discord.Interaction) for the given interaction ID and token

func (*Client) CreateMessage added in v0.4.0

func (c *Client) CreateMessage(channelID discord.Snowflake, message discord.CreateMessage) (*discord.Message, error)

CreateMessage posts a message (discord.Message) in a given channel ID and returns its structure

func (*Client) CreateReaction added in v0.4.0

func (c *Client) CreateReaction(channelID, messageID discord.Snowflake, emoji string) error

CreateReaction creates a reaction (discord.Reaction) for the given channel and message IDs

func (*Client) CreateStageInstance added in v0.4.0

func (c *Client) CreateStageInstance(stageInstance discord.CreateStageInstance) (*discord.StageInstance, error)

CreateStageInstance creates a new stage instance (discord.StageInstance) and returns its structure

func (*Client) CreateWebhook added in v0.4.0

func (c *Client) CreateWebhook(channelID discord.Snowflake, webhook discord.CreateWebhook) (*discord.Webhook, error)

CreateWebhook creates a new webhook (discord.Webhook) for the given channel ID and returns its structure

func (*Client) CrosspostMessage added in v0.4.0

func (c *Client) CrosspostMessage(channelID, messageID discord.Snowflake) (*discord.Message, error)

CrosspostMessage cross-posts a given message ID from a given announcement channel (discord.ChannelTypeGuildAnnouncement) ID to following channels (discord.Channel) and returns a message structure (discord.Message)

func (*Client) DeleteAllReactions added in v0.4.0

func (c *Client) DeleteAllReactions(channelID, messageID discord.Snowflake) error

DeleteAllReactions deletes all reactions (discord.Reaction) for the given channel and message IDs

func (*Client) DeleteAllReactionsForEmoji added in v0.4.0

func (c *Client) DeleteAllReactionsForEmoji(channelID, messageID discord.Snowflake, emoji string) error

DeleteAllReactionsForEmoji deletes all reactions (discord.Reaction) for the given channel and message IDs and the emoji

func (*Client) DeleteAutoModerationRule added in v0.4.0

func (c *Client) DeleteAutoModerationRule(guildID, ruleID discord.Snowflake, reason string) error

DeleteAutoModerationRule deletes an existing auto moderation rule (discord.AutoModerationRule)

func (*Client) DeleteChannel added in v0.4.0

func (c *Client) DeleteChannel(channelID discord.Snowflake, reason string) error

DeleteChannel deletes an existing channel (discord.Channel)

func (*Client) DeleteChannelPermissions added in v0.4.0

func (c *Client) DeleteChannelPermissions(channelID, overwriteID discord.Snowflake, reason string) error

DeleteChannelPermissions delete the permissions for the given channel and overwrite IDs

func (*Client) DeleteFollowupMessage added in v0.6.0

func (c *Client) DeleteFollowupMessage(interactionToken string, messageID discord.Snowflake) error

DeleteFollowupMessage deletes the followup response message (discord.Message) for the given interaction token and message ID

func (*Client) DeleteGlobalApplicationCommand added in v0.4.0

func (c *Client) DeleteGlobalApplicationCommand(commandID discord.Snowflake) error

DeleteGlobalApplicationCommand deletes an existing global application command (discord.Guild) from the given command ID

func (*Client) DeleteGuild added in v0.4.0

func (c *Client) DeleteGuild(guildID discord.Snowflake) error

DeleteGuild deletes an existing guild (discord.Guild) from the given guild ID

func (*Client) DeleteGuildApplicationCommand added in v0.4.0

func (c *Client) DeleteGuildApplicationCommand(guildID, commandID discord.Snowflake) error

DeleteGuildApplicationCommand deletes an existing guild application command (discord.Guild) from the given guild and command IDs

func (*Client) DeleteGuildEmoji added in v0.4.0

func (c *Client) DeleteGuildEmoji(guildID, emojiID discord.Snowflake, reason string) error

DeleteGuildEmoji deletes an existing emoji (discord.Emoji) for the given guild and emoji IDs

func (*Client) DeleteGuildIntegration added in v0.4.0

func (c *Client) DeleteGuildIntegration(guildID, integrationID discord.Snowflake, reason string) error

DeleteGuildIntegration deletes an existing integration (discord.Integration) for the given guild and integration IDs

func (*Client) DeleteGuildRole added in v0.4.0

func (c *Client) DeleteGuildRole(guildID, roleID discord.Snowflake, reason string) error

DeleteGuildRole deletes an existing role (discord.Role) for the given guild and role IDs

func (*Client) DeleteGuildScheduledEvent added in v0.4.0

func (c *Client) DeleteGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake) error

DeleteGuildScheduledEvent deletes an existing guild scheduled event (discord.GuildScheduledEvent) for the given guild and scheduled event IDs

func (*Client) DeleteGuildSticker added in v0.4.0

func (c *Client) DeleteGuildSticker(guildID, stickerID discord.Snowflake, reason string) error

DeleteGuildSticker deletes an existing sticker (discord.Sticker) from the given guild and sticker ID

func (*Client) DeleteGuildTemplate added in v0.4.0

func (c *Client) DeleteGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)

DeleteGuildTemplate deletes an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns the structure of the deleted template

func (*Client) DeleteInvite added in v0.4.0

func (c *Client) DeleteInvite(inviteCode string) (*discord.Invite, error)

DeleteInvite deletes an existing invitation (discord.Invite) for the given invite code

func (*Client) DeleteMessage added in v0.4.0

func (c *Client) DeleteMessage(channelID, messageID discord.Snowflake, reason string) error

DeleteMessage deletes a message from the given channel and message IDs

func (*Client) DeleteOriginalInteractionResponse added in v0.6.0

func (c *Client) DeleteOriginalInteractionResponse(interactionToken string) error

DeleteOriginalInteractionResponse deletes the original interaction response message (discord.Message) for the given interaction token

func (*Client) DeleteOwnReaction added in v0.4.0

func (c *Client) DeleteOwnReaction(channelID, messageID discord.Snowflake, emoji string) error

DeleteOwnReaction deletes a reaction (discord.Reaction) the current user has made for the given channel and message IDs

func (*Client) DeleteStageInstance added in v0.4.0

func (c *Client) DeleteStageInstance(channelID discord.Snowflake) error

DeleteStageInstance deletes an existing stage instance (discord.StageInstance) for the given channel ID

func (*Client) DeleteUserReaction added in v0.4.0

func (c *Client) DeleteUserReaction(channelID, messageID, userID discord.Snowflake, emoji string) error

DeleteUserReaction deletes a reaction (discord.Reaction) a given user ID has made for the given channel and message IDs

func (*Client) DeleteWebhook added in v0.4.0

func (c *Client) DeleteWebhook(webhookID discord.Snowflake) error

DeleteWebhook deletes an existing webhook (discord.Webhook) from the given webhook ID

func (*Client) DeleteWebhookMessage added in v0.5.0

func (c *Client) DeleteWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, threadID discord.Snowflake) error

DeleteWebhookMessage deletes a message (discord.Message) sent by a webhook (discord.Webhook) for the given webhook and message IDs and webhook token

func (*Client) DeleteWebhookWithToken added in v0.4.0

func (c *Client) DeleteWebhookWithToken(webhookID discord.Snowflake, webhookToken string) error

DeleteWebhookWithToken deletes an existing webhook (discord.Webhook) from the given webhook ID and webhook token (does not require authentication)

func (*Client) DoRequest

func (c *Client) DoRequest(method, url string, requestBody []byte, queryParams QueryParameters, attempt int, requestOptions ...RequestOption) ([]byte, *http.Response, error)

DoRequest performs a request to the given URL with the given method, it will make sure to follow rate limits, and returns the body and the response individually

func (*Client) EditChannelPermissions added in v0.4.0

func (c *Client) EditChannelPermissions(channelID, overwriteID discord.Snowflake, channelPermissions discord.EditChannelPermissions) error

EditChannelPermissions edits the permissions for the given channel and overwrite IDs

func (*Client) EditFollowupMessage added in v0.6.0

func (c *Client) EditFollowupMessage(interactionToken string, messageID, threadID discord.Snowflake, message discord.EditFollowupMessage) (*discord.Webhook, error)

EditFollowupMessage edits the followup message (discord.Message) for the given interaction token and message ID and returns its new structure

func (*Client) EditGlobalApplicationCommand added in v0.4.0

func (c *Client) EditGlobalApplicationCommand(commandID discord.Snowflake, applicationCommand discord.EditGlobalApplicationCommand) (*discord.ApplicationCommand, error)

EditGlobalApplicationCommand edits and existing global application command (discord.ApplicationCommand) for the given command ID and returns its new structure

func (*Client) EditGuildApplicationCommand added in v0.4.0

func (c *Client) EditGuildApplicationCommand(guildID, commandID discord.Snowflake, applicationCommand discord.EditGuildApplicationCommand) (*discord.ApplicationCommand, error)

EditGuildApplicationCommand edits and existing guild application command (discord.ApplicationCommand) for the given guild and command IDs and returns its new structure

func (*Client) EditMessage added in v0.4.0

func (c *Client) EditMessage(channelID, messageID discord.Snowflake, message discord.EditMessage) (*discord.Message, error)

EditMessage edits a message (discord.Message) from the given channel and message IDs and returns its structure

func (*Client) EditOriginalInteractionResponse added in v0.6.0

func (c *Client) EditOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake, message discord.EditOriginalInteractionResponse) (*discord.Webhook, error)

EditOriginalInteractionResponse edits the original interaction response message (discord.Message) for the given interaction token and returns its new structure

func (*Client) EditWebhookMessage added in v0.5.0

func (c *Client) EditWebhookMessage(webhookID, messageID discord.Snowflake, webhookToken string, threadID discord.Snowflake, message discord.EditWebhookMessage) (*discord.Webhook, error)

EditWebhookMessage edits a message (discord.Message) sent by a webhook (discord.Webhook) for the given webhook and message IDs and webhook token and returns its new structure

func (*Client) ExecuteWebhook added in v0.4.0

func (c *Client) ExecuteWebhook(webhookID discord.Snowflake, webhookToken string, threadID discord.Snowflake, wait bool, message discord.ExecuteWebhook) (*discord.Message, error)

ExecuteWebhook executes a webhook (discord.Webhook) to send some message with it for the given webhook ID and webhook token (can also be executed in a given thread ID)

func (*Client) FollowAnnouncementChannel added in v0.4.0

func (c *Client) FollowAnnouncementChannel(channelID, targetID discord.Snowflake) (*discord.FollowedChannel, error)

FollowAnnouncementChannel follows the given channel ID to the given target channel ID and returns a followed channel structure (discord.FollowedChannel)

func (*Client) GetApplicationCommandPermissions added in v0.3.0

func (c *Client) GetApplicationCommandPermissions(guildID, commandID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)

GetApplicationCommandPermissions returns a guild application command permissions structure (discord.GuildApplicationCommandPermissions) for the given guild and command IDs that is available in the guild ID

func (*Client) GetApplicationRoleConnectionMetadataRecords added in v0.4.0

func (c *Client) GetApplicationRoleConnectionMetadataRecords() ([]discord.ApplicationRoleConnectionMetadata, error)

GetApplicationRoleConnectionMetadataRecords returns a list of application role connection metadata structures (discord.ApplicationRoleConnectionMetadata) for the given application ID

func (*Client) GetAutoModerationRule added in v0.3.0

func (c *Client) GetAutoModerationRule(guildID, ruleID discord.Snowflake) (*discord.AutoModerationRule, error)

GetAutoModerationRule returns an auto moderation rule structure (discord.AutoModerationRule) for the given guild and rule ID

func (*Client) GetAutoModerationRules added in v0.3.0

func (c *Client) GetAutoModerationRules(guildID discord.Snowflake) ([]discord.AutoModerationRule, error)

GetAutoModerationRules returns a list of auto moderation rule structures (discord.AutoModerationRule) for the given guild ID

func (*Client) GetChannel added in v0.3.0

func (c *Client) GetChannel(channelID discord.Snowflake) (*discord.Channel, error)

GetChannel returns a channel structure (discord.Channel) for the given channel ID

func (*Client) GetChannelInvites added in v0.3.0

func (c *Client) GetChannelInvites(channelID discord.Snowflake) ([]discord.InviteWithMetadata, error)

GetChannelInvites returns a list of invite with metadata structures (discord.InviteWithMetadata) for a given channel ID

func (*Client) GetChannelMessage added in v0.3.0

func (c *Client) GetChannelMessage(channelID, messageID discord.Snowflake) (*discord.Message, error)

GetChannelMessage returns a message (discord.Message) for the given channel and message IDs

func (*Client) GetChannelMessages added in v0.3.0

func (c *Client) GetChannelMessages(channelID discord.Snowflake) ([]discord.Message, error)

GetChannelMessages returns a list of message structures (discord.Message) for the given channel ID

func (*Client) GetChannelWebhooks added in v0.3.0

func (c *Client) GetChannelWebhooks(channelID discord.Snowflake) ([]discord.Webhook, error)

GetChannelWebhooks returns a list of channel webhook structures (discord.Webhook) given the channel ID

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser() (*discord.User, error)

GetCurrentUser returns the current user structure (discord.User)

func (*Client) GetCurrentUserGuilds added in v0.5.0

func (c *Client) GetCurrentUserGuilds(before, after discord.Snowflake, limit int) ([]discord.PartialGuild, error)

GetCurrentUserGuilds returns a list of partial guild structures (discord.PartialGuild)

func (*Client) GetFollowupMessage added in v0.6.0

func (c *Client) GetFollowupMessage(interactionToken string, messageID discord.Snowflake) (*discord.Message, error)

GetFollowupMessage returns the message structure (discord.Message) of the followup message for the given the interaction token and message ID

func (*Client) GetGlobalApplicationCommand added in v0.3.0

func (c *Client) GetGlobalApplicationCommand(commandID discord.Snowflake) (*discord.ApplicationCommand, error)

GetGlobalApplicationCommand returns a global application command structure (discord.ApplicationCommand) for the given command ID

func (*Client) GetGlobalApplicationCommands added in v0.3.0

func (c *Client) GetGlobalApplicationCommands(withLocalizations bool) ([]discord.ApplicationCommand, error)

GetGlobalApplicationCommands returns a list of global application command structures (discord.ApplicationCommand)

func (*Client) GetGuild added in v0.3.0

func (c *Client) GetGuild(guildID discord.Snowflake, withCounts bool) (*discord.Guild, error)

GetGuild returns a guild structure (discord.Guild) for the given guild ID

func (*Client) GetGuildApplicationCommand added in v0.3.0

func (c *Client) GetGuildApplicationCommand(guildID, commandID discord.Snowflake) (*discord.ApplicationCommand, error)

GetGuildApplicationCommand returns a guild application command structure (discord.ApplicationCommand) for the given guild and command IDs that is available in the given guild ID

func (*Client) GetGuildApplicationCommandPermissions added in v0.3.0

func (c *Client) GetGuildApplicationCommandPermissions(guildID discord.Snowflake) ([]discord.GuildApplicationCommandPermissions, error)

GetGuildApplicationCommandPermissions returns a list of guild application command permissions structures (discord.GuildApplicationCommandPermissions) for the given guild ID that is available in the guild ID

func (*Client) GetGuildApplicationCommands added in v0.3.0

func (c *Client) GetGuildApplicationCommands(guildID discord.Snowflake, withLocalizations bool) ([]discord.ApplicationCommand, error)

GetGuildApplicationCommands returns a list of guild application command structures (discord.ApplicationCommand) that are available in the given guild ID

func (*Client) GetGuildAuditLog added in v0.3.0

func (c *Client) GetGuildAuditLog(guildID discord.Snowflake) (*discord.AuditLog, error)

GetGuildAuditLog returns an audit log structure (discord.AuditLog) for given guild ID

func (*Client) GetGuildBan added in v0.3.0

func (c *Client) GetGuildBan(guildID, userID discord.Snowflake) (*discord.GuildBan, error)

GetGuildBan returns a guild ban structure (discord.GuildBan) for the given guild and user IDs

func (*Client) GetGuildBans added in v0.3.0

func (c *Client) GetGuildBans(guildID, before, after discord.Snowflake, limit int) ([]discord.GuildBan, error)

GetGuildBans returns a list of guild ban structures (discord.GuildBan) for the given guild ID

func (*Client) GetGuildChannels added in v0.3.0

func (c *Client) GetGuildChannels(guildID discord.Snowflake) ([]discord.Channel, error)

GetGuildChannels returns a list of channel structures (discord.Channel) for the given guild ID

func (*Client) GetGuildEmoji added in v0.3.0

func (c *Client) GetGuildEmoji(guildID, emojiID discord.Snowflake) (*discord.Emoji, error)

GetGuildEmoji returns an emoji structure (discord.Emoji) for the given guild and emoji IDs

func (*Client) GetGuildIntegrations added in v0.3.0

func (c *Client) GetGuildIntegrations(guildID discord.Snowflake) ([]discord.Integration, error)

GetGuildIntegrations returns a list of integrations structures (discord.Integration) for the given guild ID

func (*Client) GetGuildInvites added in v0.3.0

func (c *Client) GetGuildInvites(guildID discord.Snowflake) ([]discord.InviteWithMetadata, error)

GetGuildInvites returns a list of invite with metadata structures (discord.InviteWithMetadata) for the given guild ID

func (*Client) GetGuildMember added in v0.3.0

func (c *Client) GetGuildMember(guildID, userID discord.Snowflake) (*discord.Member, error)

GetGuildMember returns a member structure (discord.Member) for the given guild and user IDs

func (*Client) GetGuildOnboarding added in v0.3.0

func (c *Client) GetGuildOnboarding(guildID discord.Snowflake) (*discord.Onboarding, error)

GetGuildOnboarding returns an onboarding structure (discord.Onboarding) for the given guild ID

func (*Client) GetGuildPreview added in v0.3.0

func (c *Client) GetGuildPreview(guildID discord.Snowflake) (*discord.GuildPreview, error)

GetGuildPreview returns a guild preview structure (discord.GuildPreview) for the given guild ID

func (*Client) GetGuildPruneCount added in v0.3.0

func (c *Client) GetGuildPruneCount(guildID discord.Snowflake, days int, includeRoles discord.ArraySnowflakes) (*discord.GuildPrune, error)

GetGuildPruneCount returns a guild prune structure (discord.GuildPrune) for the given guild IDs

func (*Client) GetGuildRoles added in v0.3.0

func (c *Client) GetGuildRoles(guildID discord.Snowflake) ([]discord.Role, error)

GetGuildRoles returns a list role structures (discord.Role)

func (*Client) GetGuildScheduledEvent added in v0.3.0

func (c *Client) GetGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, withUserCount bool) (*discord.GuildScheduledEvent, error)

GetGuildScheduledEvent returns a guild scheduled event structure (discord.GuildScheduledEvent) for the given guild ID and scheduled event ID

func (*Client) GetGuildScheduledEventUsers added in v0.3.0

func (c *Client) GetGuildScheduledEventUsers(guildID, scheduledEventID, before, after discord.Snowflake, limit int, withMember bool) ([]discord.GuildScheduledEventUser, error)

GetGuildScheduledEventUsers returns a list of guild scheduled event user structures (discord.GuildScheduledEventUser)

func (*Client) GetGuildSticker added in v0.3.0

func (c *Client) GetGuildSticker(guildID, stickerID discord.Snowflake) (*discord.Sticker, error)

GetGuildSticker returns a sticker structure (discord.Sticker) for the given guild and sticker IDs

func (*Client) GetGuildTemplate added in v0.3.0

func (c *Client) GetGuildTemplate(templateCode string) (*discord.GuildTemplate, error)

GetGuildTemplate returns a guild template structure (discord.GuildTemplate) for the given template code

func (*Client) GetGuildTemplates added in v0.3.0

func (c *Client) GetGuildTemplates(guildID discord.Snowflake) ([]discord.GuildTemplate, error)

GetGuildTemplates returns a list of guild template structures (discord.GuildTemplate) for the given guild ID

func (*Client) GetGuildVanityURL added in v0.3.0

func (c *Client) GetGuildVanityURL(guildID discord.Snowflake) (*discord.PartialInvite, error)

GetGuildVanityURL returns the vanity invite, which is a partial invite structure (discord.PartialInvite), for the given guild ID

func (*Client) GetGuildVoiceRegions added in v0.3.0

func (c *Client) GetGuildVoiceRegions(guildID discord.Snowflake) ([]discord.VoiceRegion, error)

GetGuildVoiceRegions returns a list of voice region structures (discord.VoiceRegion) for the given guild ID

func (*Client) GetGuildWebhooks added in v0.3.0

func (c *Client) GetGuildWebhooks(guildID discord.Snowflake) ([]discord.Webhook, error)

GetGuildWebhooks returns a list of guild webhook structures (discord.Webhook) given the guild ID

func (*Client) GetGuildWelcomeScreen added in v0.3.0

func (c *Client) GetGuildWelcomeScreen(guildID discord.Snowflake) (*discord.WelcomeScreen, error)

GetGuildWelcomeScreen returns a welcome screen structure (discord.WelcomeScreen) for the given guild ID

func (*Client) GetGuildWidget added in v0.3.0

func (c *Client) GetGuildWidget(guildID discord.Snowflake) (*discord.Widget, error)

GetGuildWidget returns a widget structure (discord.Widget) for the given guild ID

func (*Client) GetGuildWidgetSetting added in v0.3.0

func (c *Client) GetGuildWidgetSetting(guildID discord.Snowflake) (*discord.WidgetSetting, error)

GetGuildWidgetSetting returns a widget setting structure (discord.WidgetSetting) for the given guild ID

func (*Client) GetInvite added in v0.3.0

func (c *Client) GetInvite(inviteCode string, withCounts, withExpiration bool, guildScheduledEventID discord.Snowflake) (*discord.Invite, error)

GetInvite returns an invitation structure (discord.Invite) for the given invite code

func (*Client) GetOriginalInteractionResponse added in v0.6.0

func (c *Client) GetOriginalInteractionResponse(interactionToken string, threadID discord.Snowflake) (*discord.Message, error)

GetOriginalInteractionResponse returns the message structure (discord.Message) of the original interaction response for given the interaction token

func (*Client) GetPinnedMessages added in v0.3.0

func (c *Client) GetPinnedMessages(channelID discord.Snowflake) ([]discord.Message, error)

GetPinnedMessages returns a list of message structures (discord.Message) that are pinned in the given channel ID

func (*Client) GetReactions added in v0.3.0

func (c *Client) GetReactions(channelID, messageID discord.Snowflake, emoji string, after discord.Snowflake, limit int) ([]discord.User, error)

GetReactions returns a list of user structures (discord.User) that reacted to the given message ID in the given channel ID with the given emoji

func (*Client) GetSelfUser

func (c *Client) GetSelfUser() (*discord.User, error)

GetSelfUser is an alias of GetCurrentUser

func (*Client) GetStageInstance added in v0.3.0

func (c *Client) GetStageInstance(channelID discord.Snowflake) (*discord.StageInstance, error)

GetStageInstance returns a stage instance structure (discord.StageInstance) associated with the stage channel

func (*Client) GetSticker added in v0.3.0

func (c *Client) GetSticker(stickerID discord.Snowflake) (*discord.Sticker, error)

GetSticker returns a sticker structure (discord.Sticker) for the given sticker ID

func (*Client) GetThreadMember added in v0.3.0

func (c *Client) GetThreadMember(threadID, userID discord.Snowflake) (*discord.ThreadMember, error)

GetThreadMember returns a thread member structure (discord.ThreadMember) for a given thread and user ID if they are a member of said thread

func (*Client) GetUser added in v0.3.0

func (c *Client) GetUser(userID discord.Snowflake) (*discord.User, error)

GetUser returns a user structure (discord.User) for the given user ID

func (*Client) GetWebhook added in v0.3.0

func (c *Client) GetWebhook(webhookID discord.Snowflake) (*discord.Webhook, error)

GetWebhook returns a webhook structure (discord.Webhook) given the webhook ID

func (*Client) GetWebhookMessage added in v0.3.0

func (c *Client) GetWebhookMessage(webhookID discord.Snowflake, webhookToken string, messageID, threadID discord.Snowflake) (*discord.Message, error)

GetWebhookMessage returns a previously-sent webhook message structure (discord.Message) from the same token given the message ID

func (*Client) GetWebhookWithToken added in v0.3.0

func (c *Client) GetWebhookWithToken(webhookID discord.Snowflake, webhookToken string) (*discord.Webhook, error)

GetWebhookWithToken returns a webhook structure (discord.Webhook) given the webhook ID and webhook token (does not require authentication and returns no user in the webhook structure)

func (*Client) LeaveGuild added in v0.4.0

func (c *Client) LeaveGuild(guildID discord.Snowflake) error

LeaveGuild leaves a guild (discord.Guild) from the given guild ID

func (*Client) LeaveThread added in v0.4.0

func (c *Client) LeaveThread(threadID discord.Snowflake) error

LeaveThread removes the current user from a given thread given its ID

func (*Client) ListActiveThreads added in v0.3.0

func (c *Client) ListActiveThreads(guildID discord.Snowflake) (*discord.ActiveThreads, error)

ListActiveThreads returns an active threads structure (discord.ActiveThreads) for the given guild ID

func (*Client) ListGuildEmojis added in v0.3.0

func (c *Client) ListGuildEmojis(guildID discord.Snowflake) ([]discord.Emoji, error)

ListGuildEmojis returns a list of emoji structures (discord.Emoji) for the given guild ID

func (*Client) ListGuildMembers added in v0.6.0

func (c *Client) ListGuildMembers(guildID, after discord.Snowflake, limit int) ([]discord.Member, error)

ListGuildMembers returns a list of member structures (discord.Member) for the given guild ID

func (*Client) ListGuildScheduledEvents added in v0.3.0

func (c *Client) ListGuildScheduledEvents(guildID discord.Snowflake, withUserCount bool) ([]discord.GuildScheduledEvent, error)

ListGuildScheduledEvents returns a list of guild scheduled event structures (discord.GuildScheduledEvent) for the given guild ID

func (*Client) ListGuildStickers added in v0.3.0

func (c *Client) ListGuildStickers(guildID discord.Snowflake) ([]discord.Sticker, error)

ListGuildStickers returns a list of sticker structures (discord.Sticker) for the given guild ID

func (*Client) ListJoinedPrivateArchivedThreads added in v0.3.0

func (c *Client) ListJoinedPrivateArchivedThreads(channelID, before discord.Snowflake, limit int) (*discord.ArchivedThreads, error)

ListJoinedPrivateArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the private archived threads in the given channel ID that the user has joined

func (*Client) ListPrivateArchivedThreads added in v0.3.0

func (c *Client) ListPrivateArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)

ListPrivateArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the private archived threads in the given channel ID

func (*Client) ListPublicArchivedThreads added in v0.3.0

func (c *Client) ListPublicArchivedThreads(channelID discord.Snowflake, before *time.Time, limit int) (*discord.ArchivedThreads, error)

ListPublicArchivedThreads returns an archived threads structure (discord.ArchivedThreads) which contains the public archived threads in the given channel ID

func (*Client) ListStickerPacks added in v0.7.0

func (c *Client) ListStickerPacks() (*discord.NitroStickerPacks, error)

ListStickerPacks returns the list of sticker pack structures (discord.NitroStickerPacks)

func (*Client) ListThreadMembers added in v0.3.0

func (c *Client) ListThreadMembers(threadID, after discord.Snowflake, withMember bool, limit int) ([]discord.ThreadMember, error)

ListThreadMembers returns a list of thread member structures (discord.ThreadMember) that are members of the given thread ID

func (*Client) ListVoiceRegions added in v0.3.0

func (c *Client) ListVoiceRegions() ([]discord.VoiceRegion, error)

ListVoiceRegions returns a list of voice region structures (discord.VoiceRegion) that can be used when setting a voice or stage channel's `rtc_region`

func (*Client) ModifyAutoModerationRule added in v0.4.0

func (c *Client) ModifyAutoModerationRule(guildID, ruleID discord.Snowflake, autoModerationRule discord.ModifyAutoModerationRule) (*discord.AutoModerationRule, error)

ModifyAutoModerationRule modifies an existing auto moderation rule (discord.AutoModerationRule) and returns its structure

func (*Client) ModifyChannel added in v0.4.0

func (c *Client) ModifyChannel(channelID discord.Snowflake, newChannel discord.ModifyChannel) (*discord.Channel, error)

ModifyChannel modifies an existing channel (discord.Channel) and returns its structure

func (*Client) ModifyCurrentUser added in v0.4.0

func (c *Client) ModifyCurrentUser(user discord.ModifyCurrentUser) (*discord.User, error)

ModifyCurrentUser modifies the current user (discord.User) and returns its new structure

func (*Client) ModifyCurrentUserVoiceState added in v0.4.0

func (c *Client) ModifyCurrentUserVoiceState(guildID discord.Snowflake, voiceState discord.ModifyCurrentUserVoiceState) error

ModifyCurrentUserVoiceState modifies the voice state of the current user for the given guild ID

func (*Client) ModifyGuild added in v0.4.0

func (c *Client) ModifyGuild(guildID discord.Snowflake, guild discord.ModifyGuild) (*discord.Guild, error)

ModifyGuild modifies an existing guild (discord.Guild) from the given guild ID and returns its new structure

func (*Client) ModifyGuildChannelPositions added in v0.4.0

func (c *Client) ModifyGuildChannelPositions(guildID discord.Snowflake, channelPositions []discord.ModifyGuildChannelPosition) error

ModifyGuildChannelPositions modifies the position of existing channels (discord.Channel) for the given guild ID

func (*Client) ModifyGuildEmoji added in v0.4.0

func (c *Client) ModifyGuildEmoji(guildID, emojiID discord.Snowflake, emoji discord.ModifyGuildEmoji) (*discord.Emoji, error)

ModifyGuildEmoji modifies an existing emoji (discord.Emoji) for the given guild and emoji IDs and returns the edited emoji structure

func (*Client) ModifyGuildMFALevel added in v0.4.0

func (c *Client) ModifyGuildMFALevel(guildID discord.Snowflake, mfaLevel discord.ModifyGuildMFALevel) (*discord.MFALevel, error)

ModifyGuildMFALevel modifies the MFA level (discord.MFALevel) for the given guild ID and returns its new structure

func (*Client) ModifyGuildMember added in v0.4.0

func (c *Client) ModifyGuildMember(guildID, userID discord.Snowflake, member discord.ModifyGuildMember) (*discord.Member, error)

ModifyGuildMember modifies a guild member (discord.Member) for the given guild and user IDs and returns the new structure

func (*Client) ModifyGuildRole added in v0.4.0

func (c *Client) ModifyGuildRole(guildID, roleID discord.Snowflake, role discord.ModifyGuildRole) (*discord.Role, error)

ModifyGuildRole modifies an existing role (discord.Role) for the given guild and role IDs and returns its new structure

func (*Client) ModifyGuildRolePositions added in v0.4.0

func (c *Client) ModifyGuildRolePositions(guildID discord.Snowflake, rolePositions []discord.GuildRolePosition) ([]discord.Role, error)

ModifyGuildRolePositions modifies the position of existing roles (discord.Role) for the given guild ID and returns the list of role structures in the guild

func (*Client) ModifyGuildScheduledEvent added in v0.4.0

func (c *Client) ModifyGuildScheduledEvent(guildID, scheduledEventID discord.Snowflake, scheduledEvent discord.ModifyGuildScheduledEvent) (*discord.GuildScheduledEvent, error)

ModifyGuildScheduledEvent modifies an existing guild scheduled event (discord.GuildScheduledEvent) for the given guild and scheduled event IDs and returns its new structure

func (*Client) ModifyGuildSticker added in v0.4.0

func (c *Client) ModifyGuildSticker(guildID, stickerID discord.Snowflake, sticker discord.ModifyGuildSticker) (*discord.Sticker, error)

ModifyGuildSticker modifies an existing sticker (discord.Sticker) for the given guild and sticker IDs and returns its new structure

func (*Client) ModifyGuildTemplate added in v0.4.0

func (c *Client) ModifyGuildTemplate(guildID discord.Snowflake, guildTemplate discord.ModifyGuildTemplate) (*discord.GuildTemplate, error)

ModifyGuildTemplate modifies an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns its new structure

func (*Client) ModifyGuildWelcomeScreen added in v0.4.0

func (c *Client) ModifyGuildWelcomeScreen(guildID discord.Snowflake, welcomeScreen discord.ModifyGuildWelcomeScreen) (*discord.WelcomeScreen, error)

ModifyGuildWelcomeScreen modifies an existing welcome screen (discord.WelcomeScreen) for the given guild ID and returns its new structure

func (*Client) ModifyGuildWidget added in v0.4.0

func (c *Client) ModifyGuildWidget(guildID discord.Snowflake, widget discord.ModifyGuildWidget) (*discord.WidgetSetting, error)

ModifyGuildWidget modifies an existing widget (discord.WidgetSetting) for the given guild ID and returns its new structure

func (*Client) ModifyStageInstance added in v0.4.0

func (c *Client) ModifyStageInstance(channelID discord.Snowflake, stageInstance discord.ModifyStageInstance) (*discord.StageInstance, error)

ModifyStageInstance modifies an existing stage instance (discord.StageInstance) for the given channel ID and returns its new structure

func (*Client) ModifyUserVoiceState added in v0.4.0

func (c *Client) ModifyUserVoiceState(guildID, userID discord.Snowflake, voiceState discord.ModifyUserVoiceState) error

ModifyUserVoiceState modifies the voice state of the current user for the given guild and user IDs

func (*Client) ModifyWebhook added in v0.4.0

func (c *Client) ModifyWebhook(webhookID discord.Snowflake, webhook discord.ModifyWebhook) (*discord.Webhook, error)

ModifyWebhook modifies an existing webhook (discord.Webhook) for the given webhook ID and returns its new structure

func (*Client) ModifyWebhookWithToken added in v0.4.0

func (c *Client) ModifyWebhookWithToken(webhookID discord.Snowflake, webhookToken string, webhook discord.ModifyWebhookWithToken) (*discord.Webhook, error)

ModifyWebhookWithToken modifies an existing webhook (discord.Webhook) for the given webhook ID and webhook token and returns its new structure (does not require authentication and returns no user in the webhook structure)

func (*Client) PinMessage added in v0.4.0

func (c *Client) PinMessage(channelID, messageID discord.Snowflake, reason string) error

PinMessage pins the given message ID in the given channel ID

func (*Client) RemoveGuildBan added in v0.4.0

func (c *Client) RemoveGuildBan(guildID, userID discord.Snowflake, reason string) error

RemoveGuildBan removes an existing guild ban (discord.GuildBan) for the given guild and user IDs Note: This endpoint is the only endpoint rejecting a "Content-Type: application/json" header without body...

func (*Client) RemoveGuildMember added in v0.4.0

func (c *Client) RemoveGuildMember(guildID, userID discord.Snowflake, reason string) error

RemoveGuildMember removes a member (discord.Member) from a guild for the given guild and user IDs

func (*Client) RemoveGuildMemberRole added in v0.4.0

func (c *Client) RemoveGuildMemberRole(guildID, userID, roleID discord.Snowflake, reason string) error

RemoveGuildMemberRole removes a role (discord.Role) for the given guild, user and role IDs

func (*Client) RemoveThreadMember added in v0.4.0

func (c *Client) RemoveThreadMember(threadID, userID discord.Snowflake) error

RemoveThreadMember removes another member from a thread given the thread and user IDs

func (*Client) SearchGuildMember added in v0.3.0

func (c *Client) SearchGuildMember(guildID discord.Snowflake, query string, limit int) ([]discord.Member, error)

SearchGuildMember returns a list of member structures (discord.Member) matching the given query in the given guild ID

func (*Client) StartThreadFromMessage added in v0.4.0

func (c *Client) StartThreadFromMessage(channelID, messageID discord.Snowflake, thread discord.StartThreadFromMessage) (*discord.Channel, error)

StartThreadFromMessage creates a new thread from the given message ID and returns a channel structure (discord.Channel)

func (*Client) StartThreadInForumChannel added in v0.4.0

func (c *Client) StartThreadInForumChannel(channelID discord.Snowflake, thread discord.StartThreadInForumChannel) (*discord.Channel, error)

StartThreadInForumChannel creates a new thread in the given channel ID and returns a channel structure (discord.Channel) with a nested message structure (discord.Message)

func (*Client) StartThreadWithoutMessage added in v0.4.0

func (c *Client) StartThreadWithoutMessage(channelID discord.Snowflake, thread discord.StartThreadWithoutMessage) (*discord.Channel, error)

StartThreadWithoutMessage creates a new thread and returns a channel structure (discord.Channel)

func (*Client) SyncGuildTemplate added in v0.4.0

func (c *Client) SyncGuildTemplate(guildID discord.Snowflake, templateCode string) (*discord.GuildTemplate, error)

SyncGuildTemplate syncs an existing guild template (discord.GuildTemplate) for the given guild ID and template code and returns its structure

func (*Client) TriggerTyping added in v0.4.0

func (c *Client) TriggerTyping(channelID discord.Snowflake) error

TriggerTyping triggers the "<User> is typing..." indicator for the given channel ID

func (*Client) UnpinMessage added in v0.4.0

func (c *Client) UnpinMessage(channelID, messageID discord.Snowflake, reason string) error

UnpinMessage unpins the given message ID in the given channel ID

func (*Client) UpdateApplicationRoleConnectionMetadataRecords added in v0.4.0

func (c *Client) UpdateApplicationRoleConnectionMetadataRecords(records []discord.ApplicationRoleConnectionMetadata) ([]discord.ApplicationRoleConnectionMetadata, error)

UpdateApplicationRoleConnectionMetadataRecords returns a list of application role connection metadata structures (discord.ApplicationRoleConnectionMetadata) for the given application ID

type DefaultInterceptor added in v0.2.0

type DefaultInterceptor struct {
	Interceptor
}

DefaultInterceptor is a default interceptor so that you do not have to add both methods in your custom interceptor

func (*DefaultInterceptor) ModifyRequest added in v0.2.0

func (i *DefaultInterceptor) ModifyRequest(_ *http.Request)

ModifyRequest is the default request modifying method from the default interceptor, which does nothing

func (*DefaultInterceptor) ModifyResponse added in v0.2.0

func (i *DefaultInterceptor) ModifyResponse(_ *http.Response)

ModifyResponse is the default response modifying method from the default interceptor, which does nothing

type HttpClient added in v0.2.0

type HttpClient struct {
	*http.Client
	Interceptor Interceptor
}

HttpClient is a http.Client extended with a custom interceptor

func (*HttpClient) SetInterceptor added in v0.2.0

func (c *HttpClient) SetInterceptor(interceptor Interceptor)

SetInterceptor sets the interceptor for the HTTP client

type Interceptor added in v0.2.0

type Interceptor interface {
	ModifyRequest(r *http.Request)
	ModifyResponse(r *http.Response)
}

Interceptor is an interface all custom interceptor should inherit

type QueryParameters added in v0.3.0

type QueryParameters map[string]string

QueryParameters is a map of query parameters when sending requests

type RateLimiter

type RateLimiter struct {
	sync.Mutex
	Buckets       map[string]*Bucket
	GlobalResetAt time.Time
	MaxRetries    int
}

RateLimiter represents the rate limiter holding a map of buckets (rest.Bucket) and responsible to sleep when someone is doing too many requests

func NewRateLimiter

func NewRateLimiter() *RateLimiter

NewRateLimiter returns a new rate limited (rest.RateLimiter)

func (*RateLimiter) GetBucket

func (r *RateLimiter) GetBucket(key string) *Bucket

GetBucket returns a bucket (rest.Bucket) based on the given key (URL without query parameters)

func (*RateLimiter) LockBucket

func (r *RateLimiter) LockBucket(key string) *Bucket

LockBucket locks a bucket (rest.Bucket) and waits if needed until it is no longer rate limited

func (*RateLimiter) UnlockBucket

func (r *RateLimiter) UnlockBucket(bucket *Bucket, headers http.Header) error

UnlockBucket unlocks a bucket (rest.Bucket) and sets the new values about the rate limits

type RequestOption added in v0.4.0

type RequestOption func(r *http.Request)

RequestOption is a function that will get executed before the request and can edit it. Unlike the interceptor (Interceptor), it will get executed per-request and not on all requests made by the client

func WithHeader added in v0.4.0

func WithHeader(key, value string) RequestOption

WithHeader returns a request option (RequestOption) that will set a header

func WithReason added in v0.4.0

func WithReason(reason string) RequestOption

WithReason returns a request option (RequestOption) that will set the 'X-Audit-Log-Reason' header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL