go-mastodon/instance.go

25 lines
537 B
Go
Raw Normal View History

2017-04-14 16:59:43 +02:00
package mastodon
import (
"context"
"net/http"
)
2017-04-14 21:23:36 +02:00
2017-04-14 16:59:43 +02:00
// Instance hold information for mastodon instance.
type Instance struct {
URI string `json:"uri"`
Title string `json:"title"`
Description string `json:"description"`
EMail string `json:"email"`
}
// GetInstance return Instance.
func (c *Client) GetInstance(ctx context.Context) (*Instance, error) {
2017-04-14 16:59:43 +02:00
var instance Instance
err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance", nil, &instance)
2017-04-14 16:59:43 +02:00
if err != nil {
return nil, err
}
return &instance, nil
}