Documentation
¶
Index ¶
- Constants
- type ChildrenRequest
- type ConversationRequest
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type FeaturedRequest
- type MentionsRequest
- type NoteState
- type Poll
- type RenotesRequest
- type RepliesRequest
- type SearchByTagRequest
- type SearchRequest
- type Service
- func (s *Service) Children(request ChildrenRequest) ([]models.Note, error)
- func (s *Service) Conversation(request ConversationRequest) ([]models.Note, error)
- func (s *Service) Create(request CreateRequest) (CreateResponse, error)
- func (s *Service) Delete(noteID string) error
- func (s *Service) Favorites() *favorites.Service
- func (s *Service) Featured(request FeaturedRequest) ([]models.Note, error)
- func (s *Service) Mentions(request MentionsRequest) ([]models.Note, error)
- func (s *Service) Polls() *polls.Service
- func (s *Service) Reactions() *reactions.Service
- func (s *Service) Renotes(request RenotesRequest) ([]models.Note, error)
- func (s *Service) Replies(request RepliesRequest) ([]models.Note, error)
- func (s *Service) Search(request SearchRequest) ([]models.Note, error)
- func (s *Service) SearchByTag(request SearchByTagRequest) ([]models.Note, error)
- func (s *Service) Show(noteID string) (models.Note, error)
- func (s *Service) State(noteID string) (NoteState, error)
- func (s *Service) Timeline() *timeline.Service
- func (s *Service) Unrenote(noteID string) error
- func (s *Service) Watching() *watching.Service
- type ShowRequest
- type StateRequest
- type UnrenoteRequest
Examples ¶
Constants ¶
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.
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"`
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.
type CreateResponse ¶
CreateResponse is the response for a Create request.
type DeleteRequest ¶
type DeleteRequest struct {
NoteID string `json:"noteId"`
}
DeleteRequest represents an Delete request.
type FeaturedRequest ¶
FeaturedRequest represents an Featured 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.
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.
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.
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.
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)
}
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)
}
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: ¬es.Poll{
Choices: []string{"a", "b", "c"},
},
})
if err != nil {
log.Printf("[Notes] Error happened: %s", err)
return
}
log.Println(response.CreatedNote.ID)
func (*Service) Delete ¶
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
}
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)
}
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)
}
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)
}
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)
}
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)
}
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)
}
func (*Service) Show ¶
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)
func (*Service) State ¶
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)
func (*Service) Unrenote ¶
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
}
type ShowRequest ¶
type ShowRequest struct {
NoteID string `json:"noteId"`
}
ShowRequest represents an Show request.
type StateRequest ¶
type StateRequest struct {
NoteID string `json:"noteId"`
}
StateRequest represents an State request.
type UnrenoteRequest ¶
type UnrenoteRequest struct {
NoteID string `json:"noteId"`
}
UnrenoteRequest represents an Unrenote request.