Documentation ¶
Index ¶
- type CreateOptions
- type CreateRequest
- type DeleteRequest
- type FindRequest
- type Service
- func (s *Service) Create(request CreateRequest) (models.Folder, error)
- func (s *Service) Delete(folderID string) error
- func (s *Service) Find(request FindRequest) ([]models.Folder, error)
- func (s *Service) Show(folderID string) (models.Folder, error)
- func (s *Service) Update(folder models.Folder) (models.Folder, error)
- type ShowRequest
- type UpdateRequest
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
CreateOptions are the possible parameters for a Create request.
type CreateRequest ¶
CreateRequest is the request to create a folder.
type DeleteRequest ¶
type DeleteRequest struct {
FolderID string `json:"folderId"`
}
DeleteRequest is the request to delete a folder.
type FindRequest ¶
FindRequest is the request to find folder(s) by their and parent folder.
type Service ¶
type Service struct {
Call core.RequestHandlerFunc
}
Service is the service for all the endpoints under /drive/folders/*.
func NewService ¶
func NewService(requestHandler core.RequestHandlerFunc) *Service
NewService creates a new Service instance.
func (*Service) Create ¶
func (s *Service) Create(request CreateRequest) (models.Folder, error)
Create a folder.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) folder, err := client.Drive().Folder().Create(folders.CreateRequest{ Name: "Test with Go library", }) if err != nil { log.Printf("[Drive/Folder/Create] %s", err) return } log.Printf( "[Drive/Folder/Create] '%s' folder created. (%s)", folder.Name, folder.ID, )
Output:
func (*Service) Delete ¶
Delete folder.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) err := client.Drive().Folder().Delete("8dmwq3bhtw") if err != nil { log.Printf("[Drive/Folder/Delete] %s", err) return }
Output:
func (*Service) Find ¶
func (s *Service) Find(request FindRequest) ([]models.Folder, error)
Find gets folder(s) by their name and parent folder.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) folderList, err := client.Drive().Folder().Find(folders.FindRequest{ Name: "Board Games", }) if err != nil { log.Printf("[Drive/Folder/Find] %s", err) return } for _, folder := range folderList { log.Printf( "[Drive/Folder/Find] <%s> %s -> %s", folder.CreatedAt, folder.ID, folder.Name, ) }
Output:
func (*Service) Show ¶
Show gets a folder by its ID.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) folder, err := client.Drive().Folder().Show("8dmwisynnu") if err != nil { log.Printf("[Drive/Folder/Show] %s", err) return } log.Printf( "[Drive/Folder/Show] <%s> %s (%d files and %d folders)", folder.CreatedAt, folder.Name, folder.FilesCount, folder.FoldersCount, )
Output:
func (*Service) Update ¶
Update a folder.
The request uses only the ID, Name and ParentID values.
Warning: both Name and ParentID will be updated, so if you want to change only the name, fill in the ParentID with its current value, if you leave it as null, it will be moved to the root of the drive.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) folder, err := client.Drive().Folder().Show("8dmwisynnu") if err != nil { log.Printf("[Drive/Folder/Update] %s", err) return } folder.Name = "New Name" folder, err = client.Drive().Folder().Update(folder) if err != nil { log.Printf("[Drive/Folder/Update] %s", err) return }
Output:
type ShowRequest ¶
type ShowRequest struct {
FolderID string `json:"folderId"`
}
ShowRequest is the request to show a folder.