Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 17ac522

Browse files
author
jonas747
committed
tidy up endpoints
1 parent ea782f6 commit 17ac522

File tree

1 file changed

+129
-131
lines changed

1 file changed

+129
-131
lines changed

endpoints.go

Lines changed: 129 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -18,173 +18,168 @@ var APIVersion = "9"
1818

1919
// Known Discord API Endpoints.
2020
var (
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-
42-
EndpointAuth = EndpointAPI + "auth/"
43-
EndpointLogin = EndpointAuth + "login"
44-
EndpointLogout = EndpointAuth + "logout"
45-
EndpointVerify = EndpointAuth + "verify"
46-
EndpointVerifyResend = EndpointAuth + "verify/resend"
47-
EndpointForgotPassword = EndpointAuth + "forgot"
48-
EndpointResetPassword = EndpointAuth + "reset"
49-
EndpointRegister = EndpointAuth + "register"
50-
51-
EndpointVoice = EndpointAPI + "/voice/"
52-
EndpointVoiceRegions = EndpointVoice + "regions"
53-
EndpointVoiceIce = EndpointVoice + "ice"
54-
55-
EndpointTutorial = EndpointAPI + "tutorial/"
56-
EndpointTutorialIndicators = EndpointTutorial + "indicators"
57-
58-
EndpointTrack = EndpointAPI + "track"
59-
EndpointSso = EndpointAPI + "sso"
60-
EndpointReport = EndpointAPI + "report"
61-
EndpointIntegrations = EndpointAPI + "integrations"
62-
63-
EndpointUser = func(uID string) string { return EndpointUsers + uID }
64-
EndpointUserAvatar = func(uID int64, aID string) string { return EndpointCDNAvatars + StrID(uID) + "/" + aID + ".png" }
65-
EndpointUserAvatarAnimated = func(uID int64, aID string) string { return EndpointCDNAvatars + StrID(uID) + "/" + aID + ".gif" }
66-
EndpointUserSettings = func(uID string) string { return EndpointUsers + uID + "/settings" }
67-
EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" }
68-
EndpointUserGuild = func(uID string, gID int64) string { return EndpointUsers + uID + "/guilds/" + StrID(gID) }
69-
EndpointUserGuildSettings = func(uID string, gID int64) string { return EndpointUsers + uID + "/guilds/" + StrID(gID) + "/settings" }
70-
EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" }
71-
EndpointUserDevices = func(uID string) string { return EndpointUsers + uID + "/devices" }
72-
EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" }
73-
EndpointUserNotes = func(uID int64) string { return EndpointUsers + "@me/notes/" + StrID(uID) }
74-
75-
EndpointGuild = func(gID int64) string { return EndpointGuilds + StrID(gID) }
76-
EndpointGuildChannels = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/channels" }
77-
EndpointGuildMembers = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/members" }
78-
EndpointGuildMember = func(gID int64, uID int64) string { return EndpointGuilds + StrID(gID) + "/members/" + StrID(uID) }
79-
EndpointGuildMemberMe = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/members/@me" }
21+
EndpointStatus string
22+
EndpointSm string
23+
EndpointSmActive string
24+
EndpointSmUpcoming string
25+
26+
EndpointDiscord string
27+
EndpointAPI string
28+
EndpointGuilds string
29+
EndpointChannels string
30+
EndpointUsers string
31+
EndpointGateway string
32+
EndpointGatewayBot string
33+
EndpointWebhooks string
34+
35+
EndpointCDN string
36+
EndpointCDNAttachments string
37+
EndpointCDNAvatars string
38+
EndpointCDNIcons string
39+
EndpointCDNSplashes string
40+
EndpointCDNChannelIcons string
41+
42+
EndpointAuth string
43+
EndpointLogin string
44+
EndpointLogout string
45+
EndpointVerify string
46+
EndpointVerifyResend string
47+
EndpointForgotPassword string
48+
EndpointResetPassword string
49+
EndpointRegister string
50+
51+
EndpointVoice string
52+
EndpointVoiceRegions string
53+
EndpointVoiceIce string
54+
55+
EndpointTutorial string
56+
EndpointTutorialIndicators string
57+
58+
EndpointTrack string
59+
EndpointSso string
60+
EndpointReport string
61+
EndpointIntegrations string
62+
63+
EndpointUser = func(uID string) string { return "" }
64+
EndpointUserAvatar = func(uID int64, aID string) string { return "" }
65+
EndpointUserAvatarAnimated = func(uID int64, aID string) string { return "" }
66+
EndpointUserSettings = func(uID string) string { return "" }
67+
EndpointUserGuilds = func(uID string) string { return "" }
68+
EndpointUserGuild = func(uID string, gID int64) string { return "" }
69+
EndpointUserGuildSettings = func(uID string, gID int64) string { return "" }
70+
EndpointUserChannels = func(uID string) string { return "" }
71+
EndpointUserDevices = func(uID string) string { return "" }
72+
EndpointUserConnections = func(uID string) string { return "" }
73+
EndpointUserNotes = func(uID int64) string { return "" }
74+
75+
EndpointGuild = func(gID int64) string { return "" }
76+
EndpointGuildChannels = func(gID int64) string { return "" }
77+
EndpointGuildMembers = func(gID int64) string { return "" }
78+
EndpointGuildMember = func(gID int64, uID int64) string { return "" }
79+
EndpointGuildMemberMe = func(gID int64) string { return "" }
8080
EndpointGuildMemberRole = func(gID, uID, rID int64) string {
81-
return EndpointGuilds + StrID(gID) + "/members/" + StrID(uID) + "/roles/" + StrID(rID)
81+
return ""
8282
}
83-
EndpointGuildBans = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/bans" }
84-
EndpointGuildBan = func(gID, uID int64) string { return EndpointGuilds + StrID(gID) + "/bans/" + StrID(uID) }
85-
EndpointGuildIntegrations = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/integrations" }
86-
EndpointGuildIntegration = func(gID, iID int64) string { return EndpointGuilds + StrID(gID) + "/integrations/" + StrID(iID) }
83+
EndpointGuildBans = func(gID int64) string { return "" }
84+
EndpointGuildBan = func(gID, uID int64) string { return "" }
85+
EndpointGuildIntegrations = func(gID int64) string { return "" }
86+
EndpointGuildIntegration = func(gID, iID int64) string { return "" }
8787
EndpointGuildIntegrationSync = func(gID, iID int64) string {
88-
return EndpointGuilds + StrID(gID) + "/integrations/" + StrID(iID) + "/sync"
89-
}
90-
EndpointGuildRoles = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/roles" }
91-
EndpointGuildRole = func(gID, rID int64) string { return EndpointGuilds + StrID(gID) + "/roles/" + StrID(rID) }
92-
EndpointGuildInvites = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/invites" }
93-
EndpointGuildEmbed = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/embed" }
94-
EndpointGuildPrune = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/prune" }
95-
EndpointGuildIcon = func(gID int64, hash string) string { return EndpointCDNIcons + StrID(gID) + "/" + hash + ".png" }
96-
EndpointGuildSplash = func(gID int64, hash string) string { return EndpointCDNSplashes + StrID(gID) + "/" + hash + ".png" }
97-
EndpointGuildWebhooks = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/webhooks" }
98-
EndpointGuildAuditLogs = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/audit-logs" }
99-
EndpointGuildEmojis = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/emojis" }
100-
EndpointGuildEmoji = func(gID, eID int64) string { return EndpointGuilds + StrID(gID) + "/emojis/" + StrID(eID) }
101-
102-
EndpointChannel = func(cID int64) string { return EndpointChannels + StrID(cID) }
103-
EndpointChannelPermissions = func(cID int64) string { return EndpointChannels + StrID(cID) + "/permissions" }
104-
EndpointChannelPermission = func(cID, tID int64) string { return EndpointChannels + StrID(cID) + "/permissions/" + StrID(tID) }
105-
EndpointChannelInvites = func(cID int64) string { return EndpointChannels + StrID(cID) + "/invites" }
106-
EndpointChannelTyping = func(cID int64) string { return EndpointChannels + StrID(cID) + "/typing" }
107-
EndpointChannelMessages = func(cID int64) string { return EndpointChannels + StrID(cID) + "/messages" }
108-
EndpointChannelMessage = func(cID, mID int64) string { return EndpointChannels + StrID(cID) + "/messages/" + StrID(mID) }
109-
EndpointChannelMessageAck = func(cID, mID int64) string { return EndpointChannels + StrID(cID) + "/messages/" + StrID(mID) + "/ack" }
110-
EndpointChannelMessagesBulkDelete = func(cID int64) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
111-
EndpointChannelMessagesPins = func(cID int64) string { return EndpointChannel(cID) + "/pins" }
112-
EndpointChannelMessagePin = func(cID, mID int64) string { return EndpointChannel(cID) + "/pins/" + StrID(mID) }
113-
114-
EndpointGroupIcon = func(cID int64, hash string) string { return EndpointCDNChannelIcons + StrID(cID) + "/" + hash + ".png" }
115-
116-
EndpointChannelWebhooks = func(cID int64) string { return EndpointChannel(cID) + "/webhooks" }
117-
EndpointWebhook = func(wID int64) string { return EndpointWebhooks + StrID(wID) }
118-
EndpointWebhookToken = func(wID int64, token string) string { return EndpointWebhooks + StrID(wID) + "/" + token }
119-
120-
EndpointDefaultUserAvatar = func(uDiscriminator string) string {
121-
uDiscriminatorInt, _ := strconv.Atoi(uDiscriminator)
122-
return EndpointCDN + "embed/avatars/" + strconv.Itoa(uDiscriminatorInt%5) + ".png"
88+
return ""
12389
}
124-
125-
EndpointMessageReactionsAll = func(cID, mID int64) string {
126-
return EndpointChannelMessage(cID, mID) + "/reactions"
127-
}
128-
EndpointMessageReactions = func(cID, mID int64, emoji EmojiName) string {
129-
return EndpointChannelMessage(cID, mID) + "/reactions/" + emoji.String()
90+
EndpointGuildRoles = func(gID int64) string { return "" }
91+
EndpointGuildRole = func(gID, rID int64) string { return "" }
92+
EndpointGuildInvites = func(gID int64) string { return "" }
93+
EndpointGuildEmbed = func(gID int64) string { return "" }
94+
EndpointGuildPrune = func(gID int64) string { return "" }
95+
EndpointGuildIcon = func(gID int64, hash string) string { return "" }
96+
EndpointGuildSplash = func(gID int64, hash string) string { return "" }
97+
EndpointGuildWebhooks = func(gID int64) string { return "" }
98+
EndpointGuildAuditLogs = func(gID int64) string { return "" }
99+
EndpointGuildEmojis = func(gID int64) string { return "" }
100+
EndpointGuildEmoji = func(gID, eID int64) string { return "" }
101+
102+
EndpointChannel = func(cID int64) string { return "" }
103+
EndpointChannelPermissions = func(cID int64) string { return "" }
104+
EndpointChannelPermission = func(cID, tID int64) string { return "" }
105+
EndpointChannelInvites = func(cID int64) string { return "" }
106+
EndpointChannelTyping = func(cID int64) string { return "" }
107+
EndpointChannelMessages = func(cID int64) string { return "" }
108+
EndpointChannelMessage = func(cID, mID int64) string { return "" }
109+
EndpointChannelMessageAck = func(cID, mID int64) string { return "" }
110+
EndpointChannelMessagesBulkDelete = func(cID int64) string { return "" }
111+
EndpointChannelMessagesPins = func(cID int64) string { return "" }
112+
EndpointChannelMessagePin = func(cID, mID int64) string { return "" }
113+
114+
EndpointGroupIcon = func(cID int64, hash string) string { return "" }
115+
116+
EndpointChannelWebhooks = func(cID int64) string { return "" }
117+
EndpointWebhook = func(wID int64) string { return "" }
118+
EndpointWebhookToken = func(wID int64, token string) string { return "" }
119+
120+
EndpointDefaultUserAvatar = func(uDiscriminator string) string { return "" }
121+
122+
EndpointMessageReactionsAll = func(cID, mID int64) string { return "" }
123+
EndpointMessageReactions = func(cID, mID int64, emoji EmojiName) string {
124+
return ""
130125
}
131126
EndpointMessageReaction = func(cID, mID int64, emoji EmojiName, uID string) string {
132-
return EndpointMessageReactions(cID, mID, emoji) + "/" + uID
127+
return ""
133128
}
134129

135-
EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" }
136-
EndpointRelationship = func(uID int64) string { return EndpointRelationships() + "/" + StrID(uID) }
137-
EndpointRelationshipsMutual = func(uID int64) string { return EndpointUsers + StrID(uID) + "/relationships" }
130+
EndpointRelationships = func() string { return "" }
131+
EndpointRelationship = func(uID int64) string { return "" }
132+
EndpointRelationshipsMutual = func(uID int64) string { return "" }
138133

139-
EndpointGuildCreate = EndpointAPI + "guilds"
134+
EndpointGuildCreate = ""
140135

141-
EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID }
136+
EndpointInvite = func(iID string) string { return "" }
142137

143-
EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
138+
EndpointIntegrationsJoin = func(iID string) string { return "" }
144139

145-
EndpointEmoji = func(eID int64) string { return EndpointAPI + "emojis/" + StrID(eID) + ".png" }
146-
EndpointEmojiAnimated = func(eID int64) string { return EndpointAPI + "emojis/" + StrID(eID) + ".gif" }
140+
EndpointEmoji = func(eID int64) string { return "" }
141+
EndpointEmojiAnimated = func(eID int64) string { return "" }
147142

148-
EndpointOauth2 = EndpointAPI + "oauth2/"
149-
EndpointApplications = EndpointOauth2 + "applications"
150-
EndpointApplication = func(aID int64) string { return EndpointApplications + "/" + StrID(aID) }
151-
EndpointApplicationMe = EndpointApplications + "/@me"
152-
EndpointApplicationsBot = func(aID int64) string { return EndpointApplications + "/" + StrID(aID) + "/bot" }
143+
EndpointOauth2 = ""
144+
EndpointApplications = ""
145+
EndpointApplication = func(aID int64) string { return "" }
146+
EndpointApplicationMe = ""
147+
EndpointApplicationsBot = func(aID int64) string { return "" }
153148

154-
EndpointApplicationNonOauth2 = func(aID int64) string { return EndpointAPI + "applications/" + StrID(aID) }
155-
EndpointApplicationCommands = func(aID int64) string { return EndpointApplicationNonOauth2(aID) + "/commands" }
149+
EndpointApplicationNonOauth2 = func(aID int64) string { return "" }
150+
EndpointApplicationCommands = func(aID int64) string { return "" }
156151
EndpointApplicationCommand = func(aID int64, cmdID int64) string {
157-
return EndpointApplicationNonOauth2(aID) + "/commands/" + StrID(cmdID)
152+
return ""
158153
}
159154

160155
EndpointApplicationGuildCommands = func(aID int64, gID int64) string {
161-
return EndpointApplicationNonOauth2(aID) + "/guilds/" + StrID(gID) + "/commands"
156+
return ""
162157
}
163158

164159
EndpointApplicationGuildCommand = func(aID int64, gID int64, cmdID int64) string {
165-
return EndpointApplicationGuildCommands(aID, gID) + "/" + StrID(cmdID)
160+
return ""
166161
}
167162

168163
EndpointApplicationGuildCommandsPermissions = func(aID int64, gID int64) string {
169-
return EndpointApplicationGuildCommands(aID, gID) + "/permissions"
164+
return ""
170165
}
171166

172167
EndpointApplicationGuildCommandPermissions = func(aID int64, gID int64, cmdID int64) string {
173-
return EndpointApplicationGuildCommand(aID, gID, cmdID) + "/permissions"
168+
return ""
174169
}
175170

176-
EndpointInteractions = EndpointAPI + "interactions"
171+
EndpointInteractions = ""
177172
EndpointInteractionCallback = func(interactionID int64, token string) string {
178-
return EndpointInteractions + "/" + StrID(interactionID) + "/" + token + "/callback"
173+
return ""
179174
}
180175
EndpointWebhookInteraction = func(applicationID int64, token string) string {
181-
return EndpointWebhooks + "/" + StrID(applicationID) + "/" + token
176+
return ""
182177
}
183178
EndpointInteractionOriginalMessage = func(applicationID int64, token string) string {
184-
return EndpointWebhookInteraction(applicationID, token) + "/messages/@original"
179+
return ""
185180
}
186181
EndpointInteractionFollowupMessage = func(applicationID int64, token string, messageID int64) string {
187-
return EndpointWebhookInteraction(applicationID, token) + "/messages/" + StrID(messageID)
182+
return ""
188183
}
189184
)
190185

@@ -357,5 +352,8 @@ func CreateEndpoints(base string) {
357352
EndpointInteractionFollowupMessage = func(applicationID int64, token string, messageID int64) string {
358353
return EndpointWebhookInteraction(applicationID, token) + "/messages/" + StrID(messageID)
359354
}
355+
}
360356

357+
func init() {
358+
CreateEndpoints("https://discord.com/")
361359
}

0 commit comments

Comments
 (0)