Client Credentials

This commit is contained in:
Tyr Mactire 2022-08-26 16:33:24 -07:00 committed by mattn
parent d272534ac7
commit 2a3ac1d1d5
4 changed files with 107 additions and 0 deletions

17
apps.go
View file

@ -94,3 +94,20 @@ func RegisterApp(ctx context.Context, appConfig *AppConfig) (*Application, error
return &app, nil
}
// ApplicationVerification is mastodon application.
type ApplicationVerification struct {
Name string `json:"name"`
Website string `json:"website"`
VapidKey string `json:"vapid_key"`
}
// VerifyAppCredentials returns the mastodon application.
func (c *Client) VerifyAppCredentials(ctx context.Context) (*ApplicationVerification, error) {
var application ApplicationVerification
err := c.doAPI(ctx, http.MethodGet, "/api/v1/apps/verify_credentials", nil, &application, nil)
if err != nil {
return nil, err
}
return &application, nil
}