go-mastodon/instance.go

25 lines
542 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
2017-05-06 16:03:19 +02:00
err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance", nil, &instance, nil)
2017-04-14 16:59:43 +02:00
if err != nil {
return nil, err
}
return &instance, nil
}