Archived
1
0
Fork 0
This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
maki/Maki/Rest/RestEndpoints.cs

458 lines
18 KiB
C#

namespace Maki.Rest
{
/// <summary>
/// REST API Endpoint Formatter
/// </summary>
static class RestEndpoints
{
/// <summary>
/// Base URL of Discord
/// </summary>
public const string BASE_URL = "https://discordapp.com";
/// <summary>
/// Path to the REST API
/// </summary>
public static string BASE_PATH => "/api/v" + Discord.GATEWAY_VERSION;
/// <summary>
/// Url of Discord's CDN
/// </summary>
public const string CDN_URL = "https://cdn.discordapp.com";
#region Channels
/// <summary>
/// Gets a Channel endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel endpoint</returns>
public static string Channel(ulong chanId) => $@"/channels/{chanId}";
/// <summary>
/// Gets a Channel Bulk Delete endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Bulk Delete endpoint</returns>
public static string ChannelBulkDelete(ulong chanId) => $@"/channels/{chanId}/messages/bulk_delete";
/// <summary>
/// Gets a Channel Call Ring endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Call Ring endpoint</returns>
public static string ChannelCallRing(ulong chanId) => $@"/channels/{chanId}/call/ring";
/// <summary>
/// Gets a Channel Invites endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Call Ring endpoint</returns>
public static string ChannelInvites(ulong chanId) => $@"/channels/{chanId}/invites";
/// <summary>
/// Gets a Channel Message Reaction endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="msgId">Message Id</param>
/// <param name="reaction">Reaction Emoji</param>
/// <returns>Channel Message Reaction endpoint</returns>
public static string ChannelMessageReaction(ulong chanId, ulong msgId, string reaction) => $@"/channels/{chanId}/messages/{msgId}/reactions/{reaction}";
/// <summary>
/// Gets a Channel Message Reaction User endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="msgId">Message Id</param>
/// <param name="reaction">Reaction Emoji</param>
/// <param name="userId">User Id</param>
/// <returns>Channel Message Reaction User endpoint</returns>
public static string ChannelMessageReactionUser(ulong chanId, ulong msgId, string reaction, ulong userId) => $@"/channels/{chanId}/messages/{msgId}/reactions/{reaction}/{userId}";
/// <summary>
/// Gets a Channel Message Reactions endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="msgId">Message Id</param>
/// <returns>Channel Message Reactions endpoint</returns>
public static string ChannelMessageReactions(ulong chanId, ulong msgId) => $@"/channels/{chanId}/messages/{msgId}/reactions";
/// <summary>
/// Gets a Channel Message endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="msgId">Message Id</param>
/// <returns>Channel Message endpoint</returns>
public static string ChannelMessage(ulong chanId, ulong msgId) => $@"/channels/{chanId}/messages/{msgId}";
/// <summary>
/// Gets a Channel Messages endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Messages endpoint</returns>
public static string ChannelMessages(ulong chanId) => $@"/channels/{chanId}/messages";
/// <summary>
/// Gets a Channel Messages Search endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Messages Search endpoint</returns>
public static string ChannelMessagesSearch(ulong chanId) => $@"/channels/{chanId}/messages/search";
/// <summary>
/// Gets a Channel Permission endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="overId">Overwrite Id</param>
/// <returns>Channel Permission endpoint</returns>
public static string ChannelPermission(ulong chanId, ulong overId) => $@"/channels/{chanId}/permissions/{overId}";
/// <summary>
/// Gets a Channel Permissions endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Permissions endpoint</returns>
public static string ChannelPermissions(ulong chanId) => $@"/channels/{chanId}/permissions";
/// <summary>
/// Gets a Channel Pin endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <param name="msgId">Message Id</param>
/// <returns>Channel Pin endpoint</returns>
public static string ChannelPin(ulong chanId, ulong msgId) => $@"/channels/{chanId}/pins/{msgId}";
/// <summary>
/// Gets a Channel Pins endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Pins endpoint</returns>
public static string ChannelPins(ulong chanId) => $@"/channels/{chanId}/pins";
/// <summary>
/// Gets a Channel Recipient endpoint
/// </summary>
/// <param name="groupId">Group (DM Channel) Id</param>
/// <param name="userId">Recipient (User) Id</param>
/// <returns>Channel Recipient endpoint</returns>
public static string ChannelRecipient(ulong groupId, ulong userId) => $@"/channels/{groupId}/recipients/{userId}";
/// <summary>
/// Gets a Channel Typing endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Typing endpoint</returns>
public static string ChannelTyping(ulong chanId) => $@"/channels/{chanId}/typing";
/// <summary>
/// Gets a Channel Webhooks endpoint
/// </summary>
/// <param name="chanId">Channel Id</param>
/// <returns>Channel Webhooks endpoint</returns>
public static string ChannelWebhooks(ulong chanId) => $@"/channels/{chanId}/webhooks";
/// <summary>
/// Channels endpoint
/// </summary>
public static string Channels => @"/channels";
#endregion
#region Gateway
/// <summary>
/// Gateway endpoint
/// </summary>
public static string Gateway => @"/gateway";
/// <summary>
/// Bot Gateway endpoint
/// </summary>
public static string GatewayBot => @"/gateway/bot";
#endregion
#region Guild
/// <summary>
/// Gets a Guild endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild endpoint</returns>
public static string Guild(ulong guildId) => $@"/guilds/{guildId}";
/// <summary>
/// Gets a Guild Ban endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="memberId">Member (banned user) Id</param>
/// <returns>Guild Ban endpoint</returns>
public static string GuildBan(ulong guildId, ulong memberId) => $@"/guilds/{guildId}/bans/{memberId}";
/// <summary>
/// Gets a Guild Bans endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Bans endpoint</returns>
public static string GuildBans(ulong guildId) => $@"/guilds/{guildId}/bans";
/// <summary>
/// Gets a Guild Channels endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Channels endpoint</returns>
public static string GuildChannels(ulong guildId) => $@"/guilds/{guildId}/channels";
/// <summary>
/// Gets a Guild Embed endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Embed endpoint</returns>
public static string GuildEmbed(ulong guildId) => $@"/guilds/{guildId}/embed";
/// <summary>
/// Gets a Guild Emoji endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="emojiId">Emoji Id</param>
/// <returns>Guild Emoji endpoint</returns>
public static string GuildEmoji(ulong guildId, ulong emojiId) => $@"/guilds/{guildId}/emojis/{emojiId}";
/// <summary>
/// Gets a Guild Emojis endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Emojis endpoint</returns>
public static string GuildEmojis(ulong guildId) => $@"/guilds/{guildId}/emojis";
/// <summary>
/// Gets a Guild Integration endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="intId">Integration Id</param>
/// <returns>Guild Integration endpoint</returns>
public static string GuildIntegration(ulong guildId, ulong intId) => $@"/guilds/{guildId}/integrations/{intId}";
/// <summary>
/// Gets a Guild Integration Sync endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="intId">Integration Id</param>
/// <returns>Guild Integration Sync endpoint</returns>
public static string GuildIntegrationSync(ulong guildId, ulong intId) => $@"/guilds/{guildId}/integrations/{intId}/sync";
/// <summary>
/// Gets a Guild Integrations endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Integrations endpoint</returns>
public static string GuildIntegrations(ulong guildId) => $@"/guilds/{guildId}/integrations";
/// <summary>
/// Gets a Guild Invites endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Invites endpoint</returns>
public static string GuildInvites(ulong guildId) => $@"/guilds/{guildId}/invites";
/// <summary>
/// Gets a Guild Member endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="memberId">Member (User) Id</param>
/// <returns>Guild Member endpoint</returns>
public static string GuildMember(ulong guildId, ulong memberId) => $@"/guilds/{guildId}/members/{memberId}";
/// <summary>
/// Gets a Guild Member Nickname endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="memberId">Member (User) Id</param>
/// <returns>Guild Member Nickname endpoint</returns>
public static string GuildMemberNick(ulong guildId, ulong memberId) => $@"/guilds/{guildId}/members/{memberId}/nick";
/// <summary>
/// Gets a Guild Member Role endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="memberId">Member (User) Id</param>
/// <param name="roleId">Role Id</param>
/// <returns>Guild Member Role endpoint</returns>
public static string GuildMemberRole(ulong guildId, ulong memberId, ulong roleId) => $@"/guilds/{guildId}/members/{memberId}/roles/{roleId}";
/// <summary>
/// Gets a Guild Members endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Members endpoint</returns>
public static string GuildMembers(ulong guildId) => $@"/guilds/{guildId}/members";
/// <summary>
/// Gets a Guild Messages Search endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Messages Search endpoint</returns>
public static string GuildMessagesSearch(ulong guildId) => $@"/guilds/{guildId}/messages/search";
/// <summary>
/// Gets a Guild Prune endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Prune endpoint</returns>
public static string GuildPrune(ulong guildId) => $@"/guilds/{guildId}/prune";
/// <summary>
/// Gets a Guild Role endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <param name="roleId">Role Id</param>
/// <returns>Guild Role endpoint</returns>
public static string GuildRole(ulong guildId, ulong roleId) => $@"/guilds/{guildId}/roles/{roleId}";
/// <summary>
/// Gets a Guild Roles endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Roles endpoint</returns>
public static string GuildRoles(ulong guildId) => $@"/guilds/{guildId}/roles";
/// <summary>
///
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns></returns>
public static string GuildVoiceRegions(ulong guildId) => $@"/guilds/{guildId}/regions";
/// <summary>
/// Gets a Guild Webhooks endpoint
/// </summary>
/// <param name="guildId">Guild Id</param>
/// <returns>Guild Webhooks endpoint</returns>
public static string GuildWebhooks(ulong guildId) => $@"/guilds/{guildId}/webhooks";
/// <summary>
/// Guild endpoint
/// </summary>
public static string Guilds => @"/guilds";
#endregion
#region Invite
/// <summary>
/// Gets an Invite endpoint
/// </summary>
/// <param name="inviteId">Invite Id</param>
/// <returns>Invite endpoint</returns>
public static string Invite(ulong inviteId) => $@"/invite/{inviteId}";
#endregion
#region OAuth2
/// <summary>
/// Gets an OAuth2 Application endpoint
/// </summary>
/// <param name="appId">OAuth2 Application Id</param>
/// <returns>OAuth2 Application endpoint</returns>
public static string OAuth2Application(ulong appId) => $@"/oauth2/applications/{appId}";
#endregion
#region User
/// <summary>
/// Gets a User endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <returns>User endpoint</returns>
public static string User(ulong userId) => $@"/users/{userId}";
/// <summary>
/// Gets a User Channels endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <returns>User Channels endpoint</returns>
public static string UserChannels(ulong userId) => $@"/users/{userId}/channels";
/// <summary>
/// Gets a User Guild endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <param name="guildId">Guild Id</param>
/// <returns>User Guild endpoint</returns>
public static string UserGuild(ulong userId, ulong guildId) => $@"/users/{userId}/guilds/{guildId}";
/// <summary>
/// Gets a User Guilds endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <returns>User Guilds endpoint</returns>
public static string UserGuilds(ulong userId) => $@"/users/{userId}/guilds";
/// <summary>
/// Gets a User Note endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <param name="targetId">Target (User) Id</param>
/// <returns>User Note endpoint</returns>
public static string UserNote(ulong userId, ulong targetId) => $@"/users/{userId}/note/{targetId}";
/// <summary>
/// Gets a User Profile endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <returns>User Profile endpoint</returns>
public static string UserProfile(ulong userId) => $@"/users/{userId}/profile";
/// <summary>
/// Gets a User Relationship endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <param name="targetId">Target (User) Id</param>
/// <returns>User Relationship endpoint</returns>
public static string UserRelationship(ulong userId, ulong targetId) => $@"/users/{userId}/relationships/{targetId}";
/// <summary>
/// Gets a User Settings endpoint
/// </summary>
/// <param name="userId">User Id</param>
/// <returns>User Settings endpoint</returns>
public static string UserSettings(ulong userId) => $@"/users/{userId}/settings";
/// <summary>
/// Users endpoint
/// </summary>
public static string Users => @"/users";
#endregion
#region Voice
/// <summary>
/// Voice Regions endpoint
/// </summary>
public static string VoiceRegions => @"/voice/regions";
#endregion
#region Webhooks
/// <summary>
/// Gets a Webhook endpoint
/// </summary>
/// <param name="hookId">Webhook Id</param>
/// <returns>Webhook endpoint</returns>
public static string Webhook(ulong hookId) => $@"/webhooks/{hookId}";
/// <summary>
/// Gets a Webhook endpoint with token
/// </summary>
/// <param name="hookId">Webhook Id</param>
/// <param name="token">Webhook Token</param>
/// <returns>Webhook endpoint with token</returns>
public static string WebhookToken(ulong hookId, string token) => $@"/webhooks/{hookId}/{token}";
/// <summary>
/// Gets a Webhook endpoint with token for GitHub
/// </summary>
/// <param name="hookId">Webhook Id</param>
/// <param name="token">Webhook Token</param>
/// <returns>Webhook endpoint with token for GitHub</returns>
public static string WebhookTokenGitHub(ulong hookId, string token) => $@"/webhooks/{hookId}/{token}/github";
/// <summary>
/// Gets a Webhook endpoint with token for Slack
/// </summary>
/// <param name="hookId">Webhook Id</param>
/// <param name="token">Webhook Token</param>
/// <returns>Webhook endpoint with token for Slack</returns>
public static string WebhookTokenSlack(ulong hookId, string token) => $@"/webhooks/{hookId}/{token}/slack";
#endregion
}
}