gotosocial/internal/message/instanceprocess.go

23 lines
639 B
Go
Raw Normal View History

package message
import (
"fmt"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
func (p *processor) InstanceGet(domain string) (*apimodel.Instance, ErrorWithCode) {
i := &gtsmodel.Instance{}
if err := p.db.GetWhere("domain", domain, i); err != nil {
return nil, NewErrorInternalError(fmt.Errorf("db error fetching instance %s: %s", p.config.Host, err))
}
ai, err := p.tc.InstanceToMasto(i)
if err != nil {
return nil, NewErrorInternalError(fmt.Errorf("error converting instance to api representation: %s", err))
}
2021-05-09 18:34:27 +00:00
return ai, nil
}