endpoints.go 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Discordgo - Discord bindings for Go
  2. // Available at https://github.com/bwmarrin/discordgo
  3. // Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file.
  6. // This file contains variables for all known Discord end points. All functions
  7. // throughout the Discordgo package use these variables for all connections
  8. // to Discord. These are all exported and you may modify them if needed.
  9. package discordgo
  10. // Known Discord API Endpoints.
  11. var (
  12. STATUS = "https://status.discordapp.com/api/v2/"
  13. SM = STATUS + "scheduled-maintenances/"
  14. SM_ACTIVE = SM + "active.json"
  15. SM_UPCOMING = SM + "upcoming.json"
  16. DISCORD = "https://discordapp.com" // TODO consider removing
  17. API = DISCORD + "/api/"
  18. GUILDS = API + "guilds/"
  19. CHANNELS = API + "channels/"
  20. USERS = API + "users/"
  21. GATEWAY = API + "gateway"
  22. AUTH = API + "auth/"
  23. LOGIN = AUTH + "login"
  24. LOGOUT = AUTH + "logout"
  25. VERIFY = AUTH + "verify"
  26. VERIFY_RESEND = AUTH + "verify/resend"
  27. FORGOT_PASSWORD = AUTH + "forgot"
  28. RESET_PASSWORD = AUTH + "reset"
  29. REGISTER = AUTH + "register"
  30. VOICE = API + "/voice/"
  31. VOICE_REGIONS = VOICE + "regions"
  32. VOICE_ICE = VOICE + "ice"
  33. TUTORIAL = API + "tutorial/"
  34. TUTORIAL_INDICATORS = TUTORIAL + "indicators"
  35. TRACK = API + "track"
  36. SSO = API + "sso"
  37. REPORT = API + "report"
  38. INTEGRATIONS = API + "integrations"
  39. USER = func(uID string) string { return USERS + uID }
  40. USER_AVATAR = func(uID, aID string) string { return USERS + uID + "/avatars/" + aID + ".jpg" }
  41. USER_SETTINGS = func(uID string) string { return USERS + uID + "/settings" }
  42. USER_GUILDS = func(uID string) string { return USERS + uID + "/guilds" }
  43. USER_GUILD = func(uID, gID string) string { return USERS + uID + "/guilds/" + gID }
  44. USER_CHANNELS = func(uID string) string { return USERS + uID + "/channels" }
  45. USER_DEVICES = func(uID string) string { return USERS + uID + "/devices" }
  46. USER_CONNECTIONS = func(uID string) string { return USERS + uID + "/connections" }
  47. GUILD = func(gID string) string { return GUILDS + gID }
  48. GUILD_INIVTES = func(gID string) string { return GUILDS + gID + "/invites" }
  49. GUILD_CHANNELS = func(gID string) string { return GUILDS + gID + "/channels" }
  50. GUILD_MEMBERS = func(gID string) string { return GUILDS + gID + "/members" }
  51. GUILD_MEMBER = func(gID, uID string) string { return GUILDS + gID + "/members/" + uID }
  52. GUILD_BANS = func(gID string) string { return GUILDS + gID + "/bans" }
  53. GUILD_BAN = func(gID, uID string) string { return GUILDS + gID + "/bans/" + uID }
  54. GUILD_INTEGRATIONS = func(gID string) string { return GUILDS + gID + "/integrations" }
  55. GUILD_INTEGRATION = func(gID, iID string) string { return GUILDS + gID + "/integrations/" + iID }
  56. GUILD_INTEGRATION_SYNC = func(gID, iID string) string { return GUILDS + gID + "/integrations/" + iID + "/sync" }
  57. GUILD_ROLES = func(gID string) string { return GUILDS + gID + "/roles" }
  58. GUILD_ROLE = func(gID, rID string) string { return GUILDS + gID + "/roles/" + rID }
  59. GUILD_INVITES = func(gID string) string { return GUILDS + gID + "/invites" }
  60. GUILD_EMBED = func(gID string) string { return GUILDS + gID + "/embed" }
  61. GUILD_PRUNE = func(gID string) string { return GUILDS + gID + "/prune" }
  62. GUILD_ICON = func(gID, hash string) string { return GUILDS + gID + "/icons/" + hash + ".jpg" }
  63. GUILD_SPLASH = func(gID, hash string) string { return GUILDS + gID + "/splashes/" + hash + ".jpg" }
  64. CHANNEL = func(cID string) string { return CHANNELS + cID }
  65. CHANNEL_PERMISSIONS = func(cID string) string { return CHANNELS + cID + "/permissions" }
  66. CHANNEL_PERMISSION = func(cID, tID string) string { return CHANNELS + cID + "/permissions/" + tID }
  67. CHANNEL_INVITES = func(cID string) string { return CHANNELS + cID + "/invites" }
  68. CHANNEL_TYPING = func(cID string) string { return CHANNELS + cID + "/typing" }
  69. CHANNEL_MESSAGES = func(cID string) string { return CHANNELS + cID + "/messages" }
  70. CHANNEL_MESSAGE = func(cID, mID string) string { return CHANNELS + cID + "/messages/" + mID }
  71. CHANNEL_MESSAGE_ACK = func(cID, mID string) string { return CHANNELS + cID + "/messages/" + mID + "/ack" }
  72. INVITE = func(iID string) string { return API + "invite/" + iID }
  73. INTEGRATIONS_JOIN = func(iID string) string { return API + "integrations/" + iID + "/join" }
  74. EMOJI = func(eID string) string { return API + "emojis/" + eID + ".png" }
  75. OAUTH2 = API + "oauth2/"
  76. APPLICATIONS = OAUTH2 + "applications"
  77. APPLICATION = func(aID string) string { return APPLICATIONS + "/" + aID }
  78. APPLICATIONS_BOT = func(aID string) string { return APPLICATIONS + "/" + aID + "/bot" }
  79. )