Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { Title string `json:"title"` Text string `json:"text"` ImageURL core.String `json:"imageUrl,omitempty"` }
CreateRequest represents an Create Announcement request.
type DeleteRequest ¶
type DeleteRequest struct {
ID string `json:"id"`
}
DeleteRequest represents an Delete Announcement request.
type ListRequest ¶
type ListRequest struct { Limit uint `json:"limit"` SinceID string `json:"sinceId,omitempty"` UntilID string `json:"untilId,omitempty"` }
ListRequest represents an List Announcement 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.Announcement, error)
Create an announcement.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) response, err := client.Admin().Announcements().Create(announcements.CreateRequest{ Title: "New Announcement", Text: "Because we can do it!", }) if err != nil { log.Printf("[Admin/Announcements] %s", err) return } log.Printf("[Admin/Announcements] %s", *response.ID)
Output:
func (*Service) Delete ¶
Delete an announcement.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) err := client.Admin().Announcements().Delete("8d44utwtj6") if err != nil { log.Printf("[Admin/Announcements] %s", err) return }
Output:
func (*Service) List ¶
func (s *Service) List(request ListRequest) ([]models.Announcement, error)
List lists all announcements.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) response, err := client.Admin().Announcements().List(announcements.ListRequest{ Limit: 10, }) if err != nil { log.Printf("[Admin/Announcements] %s", err) return } for _, item := range response { log.Printf("[Admin/Announcements] %s", *item.Title) }
Output:
func (*Service) Update ¶
func (s *Service) Update(request UpdateRequest) error
Update an announcement.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) err := client.Admin().Announcements().Update(announcements.UpdateRequest{ ID: "8d44utwtj6", Title: "New Title", Text: "New text", }) if err != nil { log.Printf("[Admin/Announcements] %s", err) return }
Output:
Click to show internal directories.
Click to hide internal directories.