Documentation
¶
Index ¶
- Constants
- type FilesRequest
- type FoldersRequest
- type InformationRequest
- type InformationResponse
- type Service
- func (s *Service) File() *files.Service
- func (s *Service) Files(request FilesRequest) ([]models.File, error)
- func (s *Service) Folder() *folders.Service
- func (s *Service) Folders(request FoldersRequest) ([]models.Folder, error)
- func (s *Service) Information() (InformationResponse, error)
- func (s *Service) Stream(request StreamRequest) ([]models.File, error)
- type StreamRequest
Examples ¶
Constants ¶
View Source
const (
// DefaultListLimit is the default value for the limit lists.
DefaultListLimit = 10
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilesRequest ¶
type FilesRequest struct { Limit uint `json:"limit"` SinceID string `json:"sinceId"` UntilID string `json:"untilId"` FolderID core.String `json:"folderId"` Type core.String `json:"type"` }
FilesRequest gets a list of files available in drive.
type FoldersRequest ¶
type FoldersRequest struct { Limit uint `json:"limit"` SinceID string `json:"sinceId"` UntilID string `json:"untilId"` FolderID core.String `json:"folderId"` }
FoldersRequest gets a list of folders available in drive.
type InformationRequest ¶
type InformationRequest struct{}
InformationRequest is a pseudo type to get information about drive. No payload, but that way requests stay consistent.
func (InformationRequest) Validate ¶
func (r InformationRequest) Validate() error
Validate the request.
type InformationResponse ¶
type InformationResponse struct { Capacity core.DataSize `json:"capacity"` Usage core.DataSize `json:"usage"` }
InformationResponse is the representation of the /drive/files 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) Files ¶
func (s *Service) Files(request FilesRequest) ([]models.File, error)
Files lists all files in drive.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) fileList, err := client.Drive().Files(drive.FilesRequest{ Limit: drive.DefaultListLimit, }) if err != nil { log.Printf("[Drive/Files] %s", err) return } log.Printf("[Drive/Files] Number of files: %d", len(fileList))
Output:
func (*Service) Folders ¶
func (s *Service) Folders(request FoldersRequest) ([]models.Folder, error)
Folders lists all folders in drive.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) folderList, err := client.Drive().Folders(drive.FoldersRequest{ Limit: drive.DefaultListLimit, }) if err != nil { log.Printf("[Drive/Folders] %s", err) return } log.Printf("[Drive/Folders] Number of files: %d", len(folderList))
Output:
func (*Service) Information ¶
func (s *Service) Information() (InformationResponse, error)
Information gets drive information.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) info, err := client.Drive().Information() if err != nil { log.Printf("[Drive/Information] %s", err) return } log.Printf("[Drive/Information] Capacity: %.2f", info.Capacity.Gigabytes())
Output:
func (*Service) Stream ¶
func (s *Service) Stream(request StreamRequest) ([]models.File, error)
Stream lists all folders in drive.
Example ¶
client, _ := misskey.NewClientWithOptions(misskey.WithSimpleConfig("https://slippy.xyz", os.Getenv("MISSKEY_TOKEN"))) fileList, err := client.Drive().Stream(drive.StreamRequest{ Limit: drive.DefaultListLimit, }) if err != nil { log.Printf("[Drive/Stream] %s", err) return } log.Printf("[Drive/Stream] Number of files: %d", len(fileList))
Output:
Click to show internal directories.
Click to hide internal directories.