federation

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 FollowersRequest

type FollowersRequest struct {
	Host    string `json:"host"`
	SinceID string `json:"sinceId"`
	UntilID string `json:"untilId"`
	Limit   uint   `json:"limit"`
}

FollowersRequest contains request information to obtain followers.

func (FollowersRequest) Validate

func (r FollowersRequest) Validate() error

Validate the request.

type FollowingRequest

type FollowingRequest struct {
	Host    string `json:"host"`
	SinceID string `json:"sinceId"`
	UntilID string `json:"untilId"`
	Limit   uint   `json:"limit"`
}

FollowingRequest contains request information to obtain followees.

func (FollowingRequest) Validate

func (r FollowingRequest) Validate() error

Validate the request.

type InstancesRequest

type InstancesRequest struct {
	Host          string `json:"host"`
	Blocked       bool   `json:"blocked"`
	NotResponding bool   `json:"notResponding"`
	Suspended     bool   `json:"suspended"`
	Federating    bool   `json:"federating"`
	Subscribing   bool   `json:"subscribing"`
	Publishing    bool   `json:"publishing"`
	Limit         uint   `json:"limit"`
	Offset        uint64 `json:"offset"`
	Sort          string `json:"sort"`
}

InstancesRequest contains request information to obtain instances.

func (InstancesRequest) Validate

func (r InstancesRequest) Validate() error

Validate the request.

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) Followers

func (s *Service) Followers(request FollowersRequest) ([]models.FollowStatus, error)

Followers lists all followers.

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

resp, err := client.Federation().Followers(federation.FollowersRequest{
	Limit: 40,
	Host:  "slippy.xyz",
})
if err != nil {
	log.Printf("[Federation/Followers] %s", err)

	return
}

log.Printf("[Federation/Followers] %v listed", resp)
Output:

func (*Service) Following

func (s *Service) Following(request FollowingRequest) ([]models.FollowStatus, error)

Following lists all followings.

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

resp, err := client.Federation().Following(federation.FollowingRequest{
	Limit: 100,
	Host:  "slippy.xyz",
})
if err != nil {
	log.Printf("[Federation/Following] %s", err)

	return
}

log.Printf("[Federation/Following] %v listed", resp)
Output:

func (*Service) Instances

func (s *Service) Instances(request InstancesRequest) ([]models.Instance, error)

Instances will list all instances and information about the instances for a given host.

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

resp, err := client.Federation().Instances(federation.InstancesRequest{
	Limit: 90,
	Host:  "slippy.xyz",
})
if err != nil {
	log.Printf("[Federation/Instances] %s", err)

	return
}

log.Printf("[Federation/Instances] %v listed", resp)
Output:

func (*Service) ShowInstance

func (s *Service) ShowInstance(request ShowInstanceRequest) (models.Instance, error)

ShowInstance returns a single instance given a host.

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

resp, err := client.Federation().ShowInstance(federation.ShowInstanceRequest{
	Host: "slippy.xyz",
})
if err != nil {
	log.Printf("[Federation/ShowInstance] %s", err)

	return
}

log.Printf("[Federation/ShowInstance] %v listed", resp)
Output:

func (*Service) Users

func (s *Service) Users(request UsersRequest) ([]models.User, error)

Users will list all users for a federation with a given host.

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

resp, err := client.Federation().Users(federation.UsersRequest{
	Limit: 90,
	Host:  "misskey.io",
})
if err != nil {
	log.Printf("[Federation/Users] %s", err)

	return
}

log.Printf("[Federation/Users] %v listed", resp)
Output:

type ShowInstanceRequest

type ShowInstanceRequest struct {
	Host string `json:"host"`
}

ShowInstanceRequest contains request information to obtain a single instance.

func (ShowInstanceRequest) Validate

func (r ShowInstanceRequest) Validate() error

Validate the request.

type UsersRequest

type UsersRequest struct {
	Host    string `json:"host"`
	SinceID string `json:"sinceId"`
	UntilID string `json:"untilId"`
	Limit   uint   `json:"limit"`
}

UsersRequest contains request information to obtain users.

func (UsersRequest) Validate

func (r UsersRequest) Validate() error

Validate the request.

Jump to

Keyboard shortcuts

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