clips

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

View Source
const (
	// MaximumNameLength is the maximum length of the name of the clip.
	MaximumNameLength = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Name string `json:"name"`
}

CreateRequest represents a Create request.

func (CreateRequest) Validate

func (r CreateRequest) Validate() error

Validate request.

type ListRequest

type ListRequest struct{}

ListRequest represents an List request.

func (ListRequest) Validate

func (r ListRequest) 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) Create

func (s *Service) Create(request CreateRequest) (models.Clip, error)

Create clip.

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

clip, err := client.Clips().Create(clips.CreateRequest{
	Name: "test clip",
})
if err != nil {
	log.Printf("[Clips/Create] %s", err)

	return
}

log.Printf("[Clips/Create] %s created", clip.Name)
Output:

func (*Service) List

func (s *Service) List() ([]models.Clip, error)

List clips.

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

clips, err := client.Clips().List()
if err != nil {
	log.Printf("[Clips/List] %s", err)

	return
}

for _, clip := range clips {
	log.Printf("[Clips/List] %s", clip.Name)
}
Output:

func (*Service) Show

func (s *Service) Show(request ShowRequest) (models.Clip, error)

Show clips.

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

clip, err := client.Clips().Show(clips.ShowRequest{
	ClipID: "8drxu3ckca",
})
if err != nil {
	log.Printf("[Clips/Show] %s", err)

	return
}

log.Printf("[Clips/Show] %s", clip.Name)
Output:

func (*Service) Update

func (s *Service) Update(request UpdateRequest) (models.Clip, error)

Update clip.

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

clip, err := client.Clips().Update(clips.UpdateRequest{
	ClipID: "8drxu3ckca",
	Name:   "new test",
})
if err != nil {
	log.Printf("[Clips/Update] %s", err)

	return
}

log.Printf("[Clips/Update] %s updated", clip.Name)
Output:

type ShowRequest

type ShowRequest struct {
	ClipID string `json:"clipId"`
}

ShowRequest represents an Show request.

func (ShowRequest) Validate

func (r ShowRequest) Validate() error

Validate the request.

type UpdateRequest

type UpdateRequest struct {
	ClipID string `json:"clipId"`
	Name   string `json:"name"`
}

UpdateRequest represents a Update request.

func (UpdateRequest) Validate

func (r UpdateRequest) Validate() error

Validate request.

Jump to

Keyboard shortcuts

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