2017-04-14 16:59:43 +02:00
|
|
|
package mastodon
|
|
|
|
|
2017-04-17 04:10:29 +02:00
|
|
|
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.
|
2017-04-17 04:10:29 +02:00
|
|
|
func (c *Client) GetInstance(ctx context.Context) (*Instance, error) {
|
2017-04-14 16:59:43 +02:00
|
|
|
var instance Instance
|
2017-04-18 10:08:48 +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
|
|
|
|
}
|