notes

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: 7 Imported by: 5

Documentation

Index

Examples

Constants

View Source
const (
	// MinimumNumberOfChoices is the minimum number
	// of choices in a poll.
	MinimumNumberOfChoices = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildrenRequest

type ChildrenRequest struct {
	NoteID  string `json:"noteId"`
	Limit   uint   `json:"limit"`
	SinceID string `json:"sinceId,omitempty"`
	UntilID string `json:"untilId,omitempty"`
}

ChildrenRequest represents an Children request.

func (ChildrenRequest) Validate

func (r ChildrenRequest) Validate() error

Validate the request.

type ConversationRequest

type ConversationRequest struct {
	NoteID string `json:"noteId"`
	Limit  uint   `json:"limit"`
	Offset uint64 `json:"offset,omitempty"`
}

ConversationRequest represents an Conversation request.

func (ConversationRequest) Validate

func (r ConversationRequest) Validate() error

Validate the request.

type CreateRequest

type CreateRequest struct {
	Visibility        models.Visibility `json:"visibility"`
	VisibleUserIDs    []string          `json:"visibleUserIds,omitempty"`
	Text              core.String       `json:"text,omitempty"`
	CW                core.String       `json:"cw,omitempty"`
	ViaMobile         bool              `json:"viaMobile"`
	LocalOnly         bool              `json:"localOnly"`
	NoExtractMentions bool              `json:"noExtractMentions"`
	NoExtractHashtags bool              `json:"noExtractHashtags"`
	NoExtractEmojis   bool              `json:"noExtractEmojis"`
	FileIDs           []string          `json:"fileIds,omitempty"`
	ReplyID           core.String       `json:"replyId,omitempty"`
	RenoteID          core.String       `json:"renoteId,omitempty"`
	ChannelID         core.String       `json:"channelId,omitempty"`
	Poll              *Poll             `json:"poll,omitempty"`
}

CreateRequest represents an Create request.

func (CreateRequest) Validate

func (r CreateRequest) Validate() error

Validate the request.

type CreateResponse

type CreateResponse struct {
	CreatedNote models.Note `json:"createdNote"`
}

CreateResponse is the response for a Create request.

type DeleteRequest

type DeleteRequest struct {
	NoteID string `json:"noteId"`
}

DeleteRequest represents an Delete request.

func (DeleteRequest) Validate

func (r DeleteRequest) Validate() error

Validate the request.

type FeaturedRequest

type FeaturedRequest struct {
	Limit  uint   `json:"limit"`
	Offset uint64 `json:"offset"`
}

FeaturedRequest represents an Featured request.

func (FeaturedRequest) Validate

func (r FeaturedRequest) Validate() error

Validate the request.

type MentionsRequest

type MentionsRequest struct {
	Following  string            `json:"following,omitempty"`
	Limit      uint              `json:"limit"`
	SinceID    string            `json:"sinceId,omitempty"`
	UntilID    string            `json:"untilId,omitempty"`
	Visibility models.Visibility `json:"visibility,omitempty"`
}

MentionsRequest represents an Mentions request.

func (MentionsRequest) Validate

func (r MentionsRequest) Validate() error

Validate the request.

type NoteState

type NoteState struct {
	IsFavorited bool `json:"isFavorited"`
	IsWatching  bool `json:"isWatching"`
}

NoteState is the state of a note.

type Poll

type Poll struct {
	Choices      []string `json:"choices,omitempty"`
	Multiple     bool     `json:"multiple,omitempty"`
	ExpiresAt    uint64   `json:"expiresAt,omitempty"`
	ExpiredAfter uint64   `json:"expiredAfter,omitempty"`
}

Poll is a poll in a CreateRequest.

type RenotesRequest

type RenotesRequest struct {
	NoteID  string `json:"noteId"`
	Limit   uint   `json:"limit"`
	SinceID string `json:"sinceId"`
	UntilID string `json:"untilId"`
}

RenotesRequest represents an Renotes request.

func (RenotesRequest) Validate

func (r RenotesRequest) Validate() error

Validate the request.

type RepliesRequest

type RepliesRequest struct {
	NoteID  string `json:"noteId"`
	Limit   uint   `json:"limit"`
	SinceID string `json:"sinceId"`
	UntilID string `json:"untilId"`
}

RepliesRequest represents an Replies request.

func (RepliesRequest) Validate

func (r RepliesRequest) Validate() error

Validate the request.

type SearchByTagRequest

type SearchByTagRequest struct {
	Tag           string      `json:"tag,omitempty"`
	Query         [][]string  `json:"query,omitempty"`
	Limit         uint        `json:"limit"`
	Reply         bool        `json:"reply,omitempty"`
	Renote        bool        `json:"renote,omitempty"`
	OnlyWithFiles bool        `json:"withFiles,omitempty"`
	OnlyPolls     bool        `json:"poll,omitempty"`
	SinceID       string      `json:"sinceId,omitempty"`
	UntilID       string      `json:"untilId,omitempty"`
	Host          core.String `json:"host,omitempty"`
	UserID        core.String `json:"userId,omitempty"`
}

SearchByTagRequest represents an SearchByTag request.

func (SearchByTagRequest) Validate

func (r SearchByTagRequest) Validate() error

Validate the request.

type SearchRequest

type SearchRequest struct {
	Query   string      `json:"query"`
	Limit   uint        `json:"limit"`
	SinceID string      `json:"sinceId,omitempty"`
	UntilID string      `json:"untilId,omitempty"`
	Host    core.String `json:"host,omitempty"`
	UserID  core.String `json:"userId,omitempty"`
}

SearchRequest represents an Search request.

func (SearchRequest) Validate

func (r SearchRequest) 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) Children

func (s *Service) Children(request ChildrenRequest) ([]models.Note, error)

Children endpoint.

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

noteList, err := client.Notes().Children(notes.ChildrenRequest{
	NoteID: "noteid",
	Limit:  10,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Printf(" - %s", note.Text)
}
Output:

func (*Service) Conversation

func (s *Service) Conversation(request ConversationRequest) ([]models.Note, error)

Conversation endpoint.

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

noteList, err := client.Notes().Conversation(notes.ConversationRequest{
	NoteID: "noteid",
	Limit:  10,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Printf(" - %s", note.Text)
}
Output:

func (*Service) Create

func (s *Service) Create(request CreateRequest) (CreateResponse, error)

Create endpoint.

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

response, err := client.Notes().Create(notes.CreateRequest{
	Text:       core.NewString("test"),
	Visibility: models.VisibilityHome,
	Poll: &notes.Poll{
		Choices: []string{"a", "b", "c"},
	},
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

log.Println(response.CreatedNote.ID)
Output:

func (*Service) Delete

func (s *Service) Delete(noteID string) error

Delete endpoint.

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

err := client.Notes().Delete("noteid")
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}
Output:

func (*Service) Favorites

func (s *Service) Favorites() *favorites.Service

Favorites contains all endpoints related to /notes/favorites.

func (*Service) Featured

func (s *Service) Featured(request FeaturedRequest) ([]models.Note, error)

Featured endpoint.

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

noteList, err := client.Notes().Featured(notes.FeaturedRequest{
	Limit: 10,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Printf(" - %s", note.Text)
}
Output:

func (*Service) Mentions

func (s *Service) Mentions(request MentionsRequest) ([]models.Note, error)

Mentions endpoint.

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

noteList, err := client.Notes().Mentions(notes.MentionsRequest{
	Limit: 3,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Println(note.Text)
}
Output:

func (*Service) Polls

func (s *Service) Polls() *polls.Service

Polls contains all endpoints related to /notes/polls.

func (*Service) Reactions

func (s *Service) Reactions() *reactions.Service

Reactions contains all endpoints under /notes/reactions.

func (*Service) Renotes

func (s *Service) Renotes(request RenotesRequest) ([]models.Note, error)

Renotes endpoint.

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

renotes, err := client.Notes().Renotes(notes.RenotesRequest{
	NoteID: "8dsk7x47y3",
	Limit:  10,
})
if err != nil {
	log.Printf("[Notes/Renotes] %s", err)

	return
}

for _, renote := range renotes {
	log.Printf("[Notes/Renotes] %s", renote.User.Name)
}
Output:

func (*Service) Replies

func (s *Service) Replies(request RepliesRequest) ([]models.Note, error)

Replies endpoint.

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

replies, err := client.Notes().Replies(notes.RepliesRequest{
	NoteID: "8dsk7x47y3",
	Limit:  10,
})
if err != nil {
	log.Printf("[Notes/Replies] %s", err)

	return
}

for _, reply := range replies {
	log.Printf("[Notes/Replies] %s", reply.User.Name)
}
Output:

func (*Service) Search

func (s *Service) Search(request SearchRequest) ([]models.Note, error)

Search endpoint.

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

noteList, err := client.Notes().Search(notes.SearchRequest{
	Query: "hack%",
	Limit: 10,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Printf(" - %s", note.Text)
}
Output:

func (*Service) SearchByTag

func (s *Service) SearchByTag(request SearchByTagRequest) ([]models.Note, error)

SearchByTag endpoint.

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

noteList, err := client.Notes().SearchByTag(notes.SearchByTagRequest{
	Tag:   "test",
	Limit: 10,
})
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}

for _, note := range noteList {
	log.Printf(" - %s", note.Text)
}
Output:

func (*Service) Show

func (s *Service) Show(noteID string) (models.Note, error)

Show endpoint.

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

note, err := client.Notes().Show("8dsk7x47y3")
if err != nil {
	log.Printf("[Notes/Show] %s", err)

	return
}

log.Printf("[Notes/Show] <%s> %s", note.User.Username, note.Text)
Output:

func (*Service) State

func (s *Service) State(noteID string) (NoteState, error)

State endpoint.

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

state, err := client.Notes().State("8dsk7x47y3")
if err != nil {
	log.Printf("[Notes/State] %s", err)

	return
}

log.Printf("[Notes/State] %v", state)
Output:

func (*Service) Timeline

func (s *Service) Timeline() *timeline.Service

Timeline contains all endpoints related to /notes/timeline.

func (*Service) Unrenote

func (s *Service) Unrenote(noteID string) error

Unrenote endpoint.

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

err := client.Notes().Unrenote("noteid")
if err != nil {
	log.Printf("[Notes] Error happened: %s", err)

	return
}
Output:

func (*Service) Watching

func (s *Service) Watching() *watching.Service

Watching contains all endpoints related to /notes/watching.

type ShowRequest

type ShowRequest struct {
	NoteID string `json:"noteId"`
}

ShowRequest represents an Show request.

func (ShowRequest) Validate

func (r ShowRequest) Validate() error

Validate the request.

type StateRequest

type StateRequest struct {
	NoteID string `json:"noteId"`
}

StateRequest represents an State request.

func (StateRequest) Validate

func (r StateRequest) Validate() error

Validate the request.

type UnrenoteRequest

type UnrenoteRequest struct {
	NoteID string `json:"noteId"`
}

UnrenoteRequest represents an Unrenote request.

func (UnrenoteRequest) Validate

func (r UnrenoteRequest) Validate() error

Validate the request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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