meta

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnouncementsRequest

type AnnouncementsRequest struct {
	WithUnreads bool   `json:"withUnreads"`
	SinceID     string `json:"sinceId"`
	UntilID     string `json:"untilId"`
}

AnnouncementsRequest represents an Announcement request.

func (AnnouncementsRequest) Validate

func (r AnnouncementsRequest) Validate() error

Validate the request.

type Features

type Features struct {
	Registration   bool `json:"registration"`
	LocalTimeLine  bool `json:"localTimeLine"`
	GlobalTimeLine bool `json:"globalTimeLine"`
	Elasticsearch  bool `json:"elasticsearch"`
	Hcaptcha       bool `json:"hcaptcha"`
	Recaptcha      bool `json:"recaptcha"`
	ObjectStorage  bool `json:"objectStorage"`
	Twitter        bool `json:"twitter"`
	Github         bool `json:"github"`
	Discord        bool `json:"discord"`
	ServiceWorker  bool `json:"serviceWorker"`
	MiAuth         bool `json:"miauth"`
}

Features lists all available features of the instance and their statuses.

type InstanceMetaRequest

type InstanceMetaRequest struct {
	Detail bool `json:"detail"`
}

InstanceMetaRequest represents an Announcement request.

func (InstanceMetaRequest) Validate

func (r InstanceMetaRequest) Validate() error

Validate the request.

type InstanceMetaResponse

type InstanceMetaResponse struct {
	MaintainerName               core.String    `json:"maintainerName"`
	MaintainerEmail              core.String    `json:"maintainerEmail"`
	Version                      core.String    `json:"version"`
	Name                         core.String    `json:"name"`
	URI                          core.String    `json:"uri"`
	Description                  core.String    `json:"description"`
	Langs                        []core.String  `json:"langs"`
	ToSURL                       core.String    `json:"tosUrl"`
	RepositoryURL                core.String    `json:"repositoryUrl"`
	FeedbackURL                  core.String    `json:"feedbackUrl"`
	DriveCapacityPerLocalUserMb  uint64         `json:"driveCapacityPerLocalUserMb"`
	DriveCapacityPerRemoteUserMb uint64         `json:"driveCapacityPerRemoteUserMb"`
	HcaptchaSiteKey              core.String    `json:"hcaptchaSiteKey"`
	RecaptchaSiteKey             core.String    `json:"recaptchaSiteKey"`
	SwPublickey                  core.String    `json:"swPublickey"`
	MascotImageURL               core.String    `json:"mascotImageUrl"`
	BannerURL                    core.String    `json:"bannerUrl"`
	ErrorImageURL                core.String    `json:"errorImageUrl"`
	IconURL                      core.String    `json:"iconUrl"`
	MaxNoteTextLength            uint64         `json:"maxNoteTextLength"`
	Emojis                       []models.Emoji `json:"emojis"`
	Features                     Features       `json:"features"`
	RequireSetup                 bool           `json:"requireSetup"`
	EnableEmail                  bool           `json:"enableEmail"`
	EnableTwitterIntegration     bool           `json:"enableTwitterIntegration"`
	EnableGithubIntegration      bool           `json:"enableGithubIntegration"`
	EnableDiscordIntegration     bool           `json:"enableDiscordIntegration"`
	EnableServiceWorker          bool           `json:"enableServiceWorker"`
	EnableRecaptcha              bool           `json:"enableRecaptcha"`
	Secure                       bool           `json:"secure"`
	DisableRegistration          bool           `json:"disableRegistration"`
	DisableLocalTimeline         bool           `json:"disableLocalTimeline"`
	DisableGlobalTimeline        bool           `json:"disableGlobalTimeline"`
	CacheRemoteFiles             bool           `json:"cacheRemoteFiles"`
	ProxyRemoteFiles             bool           `json:"proxyRemoteFiles"`
	EnableHcaptcha               bool           `json:"enableHcaptcha"`
}

InstanceMetaResponse represents the response from the meta endpoint.

type Service

type Service struct {
	Call core.RequestHandlerFunc
}

Service is the base for all the endpoints on this service.

func NewService

func NewService(requestHandler core.RequestHandlerFunc) *Service

NewService creates a new Service instance.

func (*Service) Announcements

func (s *Service) Announcements(request AnnouncementsRequest) ([]models.Announcement, error)

Announcements lists all announcements.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

announcements, err := client.Meta().Announcements(
	meta.AnnouncementsRequest{
		WithUnreads: true,
		SinceID:     "",
		UntilID:     "",
	},
)
if err != nil {
	log.Printf("[Announcements] Error happened: %s", err)

	return
}

for _, announcement := range announcements {
	log.Printf("[Announcements] %s", core.StringValue(announcement.Title))
}
Output:

func (*Service) InstanceMeta

func (s *Service) InstanceMeta(details bool) (InstanceMetaResponse, error)

InstanceMeta is the endpoint to get metadata about the instance.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

meta, err := client.Meta().InstanceMeta(true)
if err != nil {
	log.Printf("[Meta] Error happened: %s", err)

	return
}

log.Printf("[InstanceMeta/Name] %s", core.StringValue(meta.Name))

for _, emoji := range meta.Emojis {
	log.Printf("[InstanceMeta/Emoji] %s", core.StringValue(emoji.Name))
}

boolStatusToString := func(v bool) string {
	if v {
		return "enabled"
	}

	return "disabled"
}

log.Printf("[InstanceMeta/Feature] Registration:   %s", boolStatusToString(meta.Features.Registration))
log.Printf("[InstanceMeta/Feature] LocalTimeLine:  %s", boolStatusToString(meta.Features.LocalTimeLine))
log.Printf("[InstanceMeta/Feature] GlobalTimeLine: %s", boolStatusToString(meta.Features.GlobalTimeLine))
log.Printf("[InstanceMeta/Feature] Elasticsearch:  %s", boolStatusToString(meta.Features.Elasticsearch))
log.Printf("[InstanceMeta/Feature] Hcaptcha:       %s", boolStatusToString(meta.Features.Hcaptcha))
log.Printf("[InstanceMeta/Feature] Recaptcha:      %s", boolStatusToString(meta.Features.Recaptcha))
log.Printf("[InstanceMeta/Feature] ObjectStorage:  %s", boolStatusToString(meta.Features.ObjectStorage))
log.Printf("[InstanceMeta/Feature] Twitter:        %s", boolStatusToString(meta.Features.Twitter))
log.Printf("[InstanceMeta/Feature] Github:         %s", boolStatusToString(meta.Features.Github))
log.Printf("[InstanceMeta/Feature] Discord:        %s", boolStatusToString(meta.Features.Discord))
log.Printf("[InstanceMeta/Feature] ServiceWorker:  %s", boolStatusToString(meta.Features.ServiceWorker))
log.Printf("[InstanceMeta/Feature] MiAuth:         %s", boolStatusToString(meta.Features.MiAuth))
Output:

func (*Service) Stats

func (s *Service) Stats() (StatsResponse, error)

Stats endpoint.

Example
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN")))

stats, err := client.Meta().Stats()
if err != nil {
	log.Printf("[Meta] Error happened: %s", err)

	return
}

log.Printf("[Stats] Instances:          %d", stats.Instances)
log.Printf("[Stats] NotesCount:         %d", stats.NotesCount)
log.Printf("[Stats] UsersCount:         %d", stats.UsersCount)
log.Printf("[Stats] OriginalNotesCount: %d", stats.OriginalNotesCount)
log.Printf("[Stats] OriginalUsersCount: %d", stats.OriginalUsersCount)
Output:

type StatsRequest

type StatsRequest struct{}

StatsRequest represents an Stats request.

func (StatsRequest) Validate

func (r StatsRequest) Validate() error

Validate the request.

type StatsResponse

type StatsResponse struct {
	NotesCount         uint64        `json:"notesCount"`
	OriginalNotesCount uint64        `json:"originalNotesCount"`
	UsersCount         uint64        `json:"usersCount"`
	OriginalUsersCount uint64        `json:"originalUsersCount"`
	Instances          uint64        `json:"instances"`
	DriveUsageLocal    core.DataSize `json:"driveUsageLocal"`
	DriveUsageRemote   core.DataSize `json:"driveUsageRemote"`
}

StatsResponse represents the response to a stats request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL