diff options
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/oauth2.go')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/oauth2.go | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/oauth2.go b/vendor/github.com/bwmarrin/discordgo/oauth2.go index 289eca9..2fa2d8d 100644 --- a/vendor/github.com/bwmarrin/discordgo/oauth2.go +++ b/vendor/github.com/bwmarrin/discordgo/oauth2.go @@ -18,8 +18,8 @@ type MembershipState int // Constants for the different stages of the MembershipState const ( - MembershipStateInvited MembershipState = iota + 1 - MembershipStateAccepted + MembershipStateInvited MembershipState = 1 + MembershipStateAccepted MembershipState = 2 ) // A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial @@ -40,28 +40,11 @@ type Team struct { Members []*TeamMember `json:"members"` } -// An Application struct stores values for a Discord OAuth2 Application -type Application struct { - ID string `json:"id,omitempty"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Icon string `json:"icon,omitempty"` - Secret string `json:"secret,omitempty"` - RedirectURIs *[]string `json:"redirect_uris,omitempty"` - BotRequireCodeGrant bool `json:"bot_require_code_grant,omitempty"` - BotPublic bool `json:"bot_public,omitempty"` - RPCApplicationState int `json:"rpc_application_state,omitempty"` - Flags int `json:"flags,omitempty"` - Owner *User `json:"owner"` - Bot *User `json:"bot"` - Team *Team `json:"team"` -} - // Application returns an Application structure of a specific Application // appID : The ID of an Application func (s *Session) Application(appID string) (st *Application, err error) { - body, err := s.RequestWithBucketID("GET", EndpointApplication(appID), nil, EndpointApplication("")) + body, err := s.RequestWithBucketID("GET", EndpointOAuth2Application(appID), nil, EndpointOAuth2Application("")) if err != nil { return } @@ -73,7 +56,7 @@ func (s *Session) Application(appID string) (st *Application, err error) { // Applications returns all applications for the authenticated user func (s *Session) Applications() (st []*Application, err error) { - body, err := s.RequestWithBucketID("GET", EndpointApplications, nil, EndpointApplications) + body, err := s.RequestWithBucketID("GET", EndpointOAuth2Applications, nil, EndpointOAuth2Applications) if err != nil { return } @@ -88,12 +71,11 @@ func (s *Session) Applications() (st []*Application, err error) { func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error) { data := struct { - Name string `json:"name"` - Description string `json:"description"` - RedirectURIs *[]string `json:"redirect_uris,omitempty"` - }{ap.Name, ap.Description, ap.RedirectURIs} + Name string `json:"name"` + Description string `json:"description"` + }{ap.Name, ap.Description} - body, err := s.RequestWithBucketID("POST", EndpointApplications, data, EndpointApplications) + body, err := s.RequestWithBucketID("POST", EndpointOAuth2Applications, data, EndpointOAuth2Applications) if err != nil { return } @@ -107,12 +89,11 @@ func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Application, err error) { data := struct { - Name string `json:"name"` - Description string `json:"description"` - RedirectURIs *[]string `json:"redirect_uris,omitempty"` - }{ap.Name, ap.Description, ap.RedirectURIs} + Name string `json:"name"` + Description string `json:"description"` + }{ap.Name, ap.Description} - body, err := s.RequestWithBucketID("PUT", EndpointApplication(appID), data, EndpointApplication("")) + body, err := s.RequestWithBucketID("PUT", EndpointOAuth2Application(appID), data, EndpointOAuth2Application("")) if err != nil { return } @@ -125,7 +106,7 @@ func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Applicat // appID : The ID of an Application func (s *Session) ApplicationDelete(appID string) (err error) { - _, err = s.RequestWithBucketID("DELETE", EndpointApplication(appID), nil, EndpointApplication("")) + _, err = s.RequestWithBucketID("DELETE", EndpointOAuth2Application(appID), nil, EndpointOAuth2Application("")) if err != nil { return } @@ -143,7 +124,7 @@ type Asset struct { // ApplicationAssets returns an application's assets func (s *Session) ApplicationAssets(appID string) (ass []*Asset, err error) { - body, err := s.RequestWithBucketID("GET", EndpointApplicationAssets(appID), nil, EndpointApplicationAssets("")) + body, err := s.RequestWithBucketID("GET", EndpointOAuth2ApplicationAssets(appID), nil, EndpointOAuth2ApplicationAssets("")) if err != nil { return } @@ -163,7 +144,7 @@ func (s *Session) ApplicationAssets(appID string) (ass []*Asset, err error) { // NOTE: func name may change, if I can think up something better. func (s *Session) ApplicationBotCreate(appID string) (st *User, err error) { - body, err := s.RequestWithBucketID("POST", EndpointApplicationsBot(appID), nil, EndpointApplicationsBot("")) + body, err := s.RequestWithBucketID("POST", EndpointOAuth2ApplicationsBot(appID), nil, EndpointOAuth2ApplicationsBot("")) if err != nil { return } |