1// Discordgo - Discord bindings for Go
2// Available at https://github.com/bwmarrin/discordgo
3
4// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>.  All rights reserved.
5// Use of this source code is governed by a BSD-style
6// license that can be found in the LICENSE file.
7
8// This file contains variables for all known Discord end points.  All functions
9// throughout the Discordgo package use these variables for all connections
10// to Discord.  These are all exported and you may modify them if needed.
11
12package discordgo
13
14import "strconv"
15
16// APIVersion is the Discord API version used for the REST and Websocket API.
17var APIVersion = "8"
18
19// Known Discord API Endpoints.
20var (
21	EndpointStatus     = "https://status.discord.com/api/v2/"
22	EndpointSm         = EndpointStatus + "scheduled-maintenances/"
23	EndpointSmActive   = EndpointSm + "active.json"
24	EndpointSmUpcoming = EndpointSm + "upcoming.json"
25
26	EndpointDiscord    = "https://discord.com/"
27	EndpointAPI        = EndpointDiscord + "api/v" + APIVersion + "/"
28	EndpointGuilds     = EndpointAPI + "guilds/"
29	EndpointChannels   = EndpointAPI + "channels/"
30	EndpointUsers      = EndpointAPI + "users/"
31	EndpointGateway    = EndpointAPI + "gateway"
32	EndpointGatewayBot = EndpointGateway + "/bot"
33	EndpointWebhooks   = EndpointAPI + "webhooks/"
34
35	EndpointCDN             = "https://cdn.discordapp.com/"
36	EndpointCDNAttachments  = EndpointCDN + "attachments/"
37	EndpointCDNAvatars      = EndpointCDN + "avatars/"
38	EndpointCDNIcons        = EndpointCDN + "icons/"
39	EndpointCDNSplashes     = EndpointCDN + "splashes/"
40	EndpointCDNChannelIcons = EndpointCDN + "channel-icons/"
41	EndpointCDNBanners      = EndpointCDN + "banners/"
42
43	EndpointAuth           = EndpointAPI + "auth/"
44	EndpointLogin          = EndpointAuth + "login"
45	EndpointLogout         = EndpointAuth + "logout"
46	EndpointVerify         = EndpointAuth + "verify"
47	EndpointVerifyResend   = EndpointAuth + "verify/resend"
48	EndpointForgotPassword = EndpointAuth + "forgot"
49	EndpointResetPassword  = EndpointAuth + "reset"
50	EndpointRegister       = EndpointAuth + "register"
51
52	EndpointVoice        = EndpointAPI + "/voice/"
53	EndpointVoiceRegions = EndpointVoice + "regions"
54	EndpointVoiceIce     = EndpointVoice + "ice"
55
56	EndpointTutorial           = EndpointAPI + "tutorial/"
57	EndpointTutorialIndicators = EndpointTutorial + "indicators"
58
59	EndpointTrack        = EndpointAPI + "track"
60	EndpointSso          = EndpointAPI + "sso"
61	EndpointReport       = EndpointAPI + "report"
62	EndpointIntegrations = EndpointAPI + "integrations"
63
64	EndpointUser               = func(uID string) string { return EndpointUsers + uID }
65	EndpointUserAvatar         = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".png" }
66	EndpointUserAvatarAnimated = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".gif" }
67	EndpointDefaultUserAvatar  = func(uDiscriminator string) string {
68		uDiscriminatorInt, _ := strconv.Atoi(uDiscriminator)
69		return EndpointCDN + "embed/avatars/" + strconv.Itoa(uDiscriminatorInt%5) + ".png"
70	}
71	EndpointUserSettings      = func(uID string) string { return EndpointUsers + uID + "/settings" }
72	EndpointUserGuilds        = func(uID string) string { return EndpointUsers + uID + "/guilds" }
73	EndpointUserGuild         = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID }
74	EndpointUserGuildSettings = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID + "/settings" }
75	EndpointUserChannels      = func(uID string) string { return EndpointUsers + uID + "/channels" }
76	EndpointUserDevices       = func(uID string) string { return EndpointUsers + uID + "/devices" }
77	EndpointUserConnections   = func(uID string) string { return EndpointUsers + uID + "/connections" }
78	EndpointUserNotes         = func(uID string) string { return EndpointUsers + "@me/notes/" + uID }
79
80	EndpointGuild                = func(gID string) string { return EndpointGuilds + gID }
81	EndpointGuildChannels        = func(gID string) string { return EndpointGuilds + gID + "/channels" }
82	EndpointGuildMembers         = func(gID string) string { return EndpointGuilds + gID + "/members" }
83	EndpointGuildMember          = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
84	EndpointGuildMemberRole      = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
85	EndpointGuildBans            = func(gID string) string { return EndpointGuilds + gID + "/bans" }
86	EndpointGuildBan             = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
87	EndpointGuildIntegrations    = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
88	EndpointGuildIntegration     = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID }
89	EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" }
90	EndpointGuildRoles           = func(gID string) string { return EndpointGuilds + gID + "/roles" }
91	EndpointGuildRole            = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID }
92	EndpointGuildInvites         = func(gID string) string { return EndpointGuilds + gID + "/invites" }
93	EndpointGuildWidget          = func(gID string) string { return EndpointGuilds + gID + "/widget" }
94	EndpointGuildEmbed           = EndpointGuildWidget
95	EndpointGuildPrune           = func(gID string) string { return EndpointGuilds + gID + "/prune" }
96	EndpointGuildIcon            = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
97	EndpointGuildIconAnimated    = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
98	EndpointGuildSplash          = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
99	EndpointGuildWebhooks        = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
100	EndpointGuildAuditLogs       = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
101	EndpointGuildEmojis          = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
102	EndpointGuildEmoji           = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
103	EndpointGuildBanner          = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
104
105	EndpointChannel                   = func(cID string) string { return EndpointChannels + cID }
106	EndpointChannelPermissions        = func(cID string) string { return EndpointChannels + cID + "/permissions" }
107	EndpointChannelPermission         = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID }
108	EndpointChannelInvites            = func(cID string) string { return EndpointChannels + cID + "/invites" }
109	EndpointChannelTyping             = func(cID string) string { return EndpointChannels + cID + "/typing" }
110	EndpointChannelMessages           = func(cID string) string { return EndpointChannels + cID + "/messages" }
111	EndpointChannelMessage            = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID }
112	EndpointChannelMessageAck         = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" }
113	EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
114	EndpointChannelMessagesPins       = func(cID string) string { return EndpointChannel(cID) + "/pins" }
115	EndpointChannelMessagePin         = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
116	EndpointChannelMessageCrosspost   = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" }
117	EndpointChannelFollow             = func(cID string) string { return EndpointChannel(cID) + "/followers" }
118
119	EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }
120
121	EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" }
122	EndpointWebhook         = func(wID string) string { return EndpointWebhooks + wID }
123	EndpointWebhookToken    = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token }
124
125	EndpointMessageReactionsAll = func(cID, mID string) string {
126		return EndpointChannelMessage(cID, mID) + "/reactions"
127	}
128	EndpointMessageReactions = func(cID, mID, eID string) string {
129		return EndpointChannelMessage(cID, mID) + "/reactions/" + eID
130	}
131	EndpointMessageReaction = func(cID, mID, eID, uID string) string {
132		return EndpointMessageReactions(cID, mID, eID) + "/" + uID
133	}
134
135	EndpointRelationships       = func() string { return EndpointUsers + "@me" + "/relationships" }
136	EndpointRelationship        = func(uID string) string { return EndpointRelationships() + "/" + uID }
137	EndpointRelationshipsMutual = func(uID string) string { return EndpointUsers + uID + "/relationships" }
138
139	EndpointGuildCreate = EndpointAPI + "guilds"
140
141	EndpointInvite = func(iID string) string { return EndpointAPI + "invite/" + iID }
142
143	EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
144
145	EndpointEmoji         = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" }
146	EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" }
147
148	EndpointOauth2            = EndpointAPI + "oauth2/"
149	EndpointApplications      = EndpointOauth2 + "applications"
150	EndpointApplication       = func(aID string) string { return EndpointApplications + "/" + aID }
151	EndpointApplicationsBot   = func(aID string) string { return EndpointApplications + "/" + aID + "/bot" }
152	EndpointApplicationAssets = func(aID string) string { return EndpointApplications + "/" + aID + "/assets" }
153)
154