Added Asset and ApplicationAssets (#666)
Fixed ApplicationAssets returning the wrong type Added Asset and ApplicationAssets
This commit is contained in:
parent
e405cbd54c
commit
a6d2557a8e
2 changed files with 24 additions and 4 deletions
|
@ -145,4 +145,5 @@ var (
|
||||||
EndpointApplications = EndpointOauth2 + "applications"
|
EndpointApplications = EndpointOauth2 + "applications"
|
||||||
EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID }
|
EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID }
|
||||||
EndpointApplicationsBot = func(aID string) string { return EndpointApplications + "/" + aID + "/bot" }
|
EndpointApplicationsBot = func(aID string) string { return EndpointApplications + "/" + aID + "/bot" }
|
||||||
|
EndpointApplicationAssets = func(aID string) string { return EndpointApplications + "/" + aID + "/assets" }
|
||||||
)
|
)
|
||||||
|
|
19
oauth2.go
19
oauth2.go
|
@ -105,6 +105,25 @@ func (s *Session) ApplicationDelete(appID string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Asset struct stores values for an asset of an application
|
||||||
|
type Asset struct {
|
||||||
|
Type int `json:"type"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(""))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = unmarshal(body, &ass)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Code specific to Discord OAuth2 Application Bots
|
// Code specific to Discord OAuth2 Application Bots
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue