Documentation
¶
Overview ¶
Package api has type definitions for gofile
Converted from the API docs with help from https://mholt.github.io/json-to-go/
Index ¶
- Constants
- func DirectUploadURL() string
- func FromNativeTime(t int64) time.Time
- func ToNativeTime(t time.Time) int64
- type AccountsGet
- type AccountsGetID
- type Contents
- type CopyRequest
- type CopyResponse
- type CreateFolderRequest
- type CreateFolderResponse
- type DeleteRequest
- type DeleteResponse
- type DirectLink
- type DirectLinksRequest
- type DirectLinksResult
- type Error
- type Item
- type Metadata
- type MoveRequest
- type MoveResponse
- type Stats
- type Time
- type UpdateItemRequest
- type UpdateItemResponse
- type UploadResponse
- type UploadServerStatus
Constants ¶
const ( ItemTypeFolder = "folder" ItemTypeFile = "file" )
Types of things in Item
Variables ¶
This section is empty.
Functions ¶
func DirectUploadURL ¶
func DirectUploadURL() string
DirectUploadURL returns the direct upload URL for Gofile
func FromNativeTime ¶
FromNativeTime converts native time to a go time
func ToNativeTime ¶
ToNativeTime converts a go time to a native time
Types ¶
type AccountsGet ¶
type AccountsGet struct {
Error
Data struct {
ID string `json:"id"`
Email string `json:"email"`
Tier string `json:"tier"`
PremiumType string `json:"premiumType"`
Token string `json:"token"`
RootFolder string `json:"rootFolder"`
SubscriptionProvider string `json:"subscriptionProvider"`
SubscriptionEndDate int `json:"subscriptionEndDate"`
SubscriptionLimitDirectTraffic int64 `json:"subscriptionLimitDirectTraffic"`
SubscriptionLimitStorage int64 `json:"subscriptionLimitStorage"`
StatsCurrent Stats `json:"statsCurrent"`
} `json:"data"`
}
AccountsGet is the result of /accounts/{id}
type AccountsGetID ¶
AccountsGetID is the result of /accounts/getid
type Contents ¶
type Contents struct {
Error
Data struct {
Item
} `json:"data"`
Metadata Metadata `json:"metadata"`
}
Contents is returned from the /contents call
type CopyRequest ¶
type CopyRequest struct {
FolderID string `json:"folderId"`
ContentsID string `json:"contentsId"` // comma separated list of IDs
}
CopyRequest is the input to /contents/copy
type CopyResponse ¶
type CopyResponse struct {
Error
Data map[string]struct {
Error
Item `json:"data"`
} `json:"data"`
}
CopyResponse is returned by POST /contents/copy
type CreateFolderRequest ¶
type CreateFolderRequest struct {
ParentFolderID string `json:"parentFolderId"`
FolderName string `json:"folderName"`
ModTime int64 `json:"modTime,omitempty"`
}
CreateFolderRequest is the input to /contents/createFolder
type CreateFolderResponse ¶
CreateFolderResponse is the output from /contents/createFolder
type DeleteRequest ¶
type DeleteRequest struct {
ContentsID string `json:"contentsId"` // comma separated list of IDs
}
DeleteRequest is the input to DELETE /contents
type DeleteResponse ¶
DeleteResponse is the input to DELETE /contents
type DirectLink ¶
type DirectLink struct {
ExpireTime int64 `json:"expireTime"`
SourceIpsAllowed []any `json:"sourceIpsAllowed"`
DomainsAllowed []any `json:"domainsAllowed"`
Auth []any `json:"auth"`
IsReqLink bool `json:"isReqLink"`
DirectLink string `json:"directLink"`
}
DirectLink describes a direct link to a file so it can be downloaded by third parties.
type DirectLinksRequest ¶
type DirectLinksRequest struct {
ExpireTime int64 `json:"expireTime,omitempty"`
SourceIpsAllowed []any `json:"sourceIpsAllowed,omitempty"`
DomainsAllowed []any `json:"domainsAllowed,omitempty"`
Auth []any `json:"auth,omitempty"`
}
DirectLinksRequest specifies the parameters for the direct link
type DirectLinksResult ¶
type DirectLinksResult struct {
Error
Data struct {
ExpireTime int64 `json:"expireTime"`
SourceIpsAllowed []any `json:"sourceIpsAllowed"`
DomainsAllowed []any `json:"domainsAllowed"`
Auth []any `json:"auth"`
IsReqLink bool `json:"isReqLink"`
ID string `json:"id"`
DirectLink string `json:"directLink"`
} `json:"data"`
}
DirectLinksResult is returned from POST /contents/{id}/directlinks
type Error ¶
type Error struct {
Status string `json:"status"`
}
Error is returned from gofile when things go wrong
type Item ¶
type Item struct {
ID string `json:"id"`
ParentFolder string `json:"parentFolder"`
Type string `json:"type"`
Name string `json:"name"`
Size int64 `json:"size"`
Code string `json:"code"`
CreateTime int64 `json:"createTime"`
ModTime int64 `json:"modTime"`
Link string `json:"link"`
MD5 string `json:"md5"`
MimeType string `json:"mimetype"`
ChildrenCount int `json:"childrenCount"`
DirectLinks map[string]*DirectLink `json:"directLinks"`
//Public bool `json:"public"`
//ServerSelected string `json:"serverSelected"`
//Thumbnail string `json:"thumbnail"`
//DownloadCount int `json:"downloadCount"`
//TotalDownloadCount int64 `json:"totalDownloadCount"`
//TotalSize int64 `json:"totalSize"`
//ChildrenIDs []string `json:"childrenIds"`
Children map[string]*Item `json:"children"`
}
Item describes a folder or a file as returned by /contents
type Metadata ¶
type Metadata struct {
TotalCount int `json:"totalCount"`
TotalPages int `json:"totalPages"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
HasNextPage bool `json:"hasNextPage"`
}
Metadata is returned when paging is in use
type MoveRequest ¶
type MoveRequest struct {
FolderID string `json:"folderId"`
ContentsID string `json:"contentsId"` // comma separated list of IDs
}
MoveRequest is the input to /contents/move
type MoveResponse ¶
type MoveResponse struct {
Error
Data map[string]struct {
Error
Item `json:"data"`
} `json:"data"`
}
MoveResponse is returned by POST /contents/move
type Stats ¶
type Stats struct {
FolderCount int64 `json:"folderCount"`
FileCount int64 `json:"fileCount"`
Storage int64 `json:"storage"`
TrafficDirectGenerated int64 `json:"trafficDirectGenerated"`
TrafficReqDownloaded int64 `json:"trafficReqDownloaded"`
TrafficWebDownloaded int64 `json:"trafficWebDownloaded"`
}
Stats of storage and traffic
type Time ¶
Time represents date and time information for the gofile API, by using RFC3339
func (*Time) MarshalJSON ¶
MarshalJSON turns a Time into JSON (in UTC)
func (*Time) UnmarshalJSON ¶
UnmarshalJSON turns JSON into a Time
type UpdateItemRequest ¶
type UpdateItemRequest struct {
Attribute string `json:"attribute"`
Value any `json:"attributeValue"`
}
UpdateItemRequest describes the updates to be done to an item for PUT /contents/{id}/update
The Value of the attribute to define : For Attribute "name" : The name of the content (file or folder) For Attribute "description" : The description displayed on the download page (folder only) For Attribute "tags" : A comma-separated list of tags (folder only) For Attribute "public" : either true or false (folder only) For Attribute "expiry" : A unix timestamp of the expiration date (folder only) For Attribute "password" : The password to set (folder only)
type UpdateItemResponse ¶
UpdateItemResponse is returned by PUT /contents/{id}/update
type UploadResponse ¶
UploadResponse is returned by POST /contents/uploadfile
type UploadServerStatus ¶
type UploadServerStatus struct {
Error
Data struct {
Server string `json:"server"`
Test string `json:"test"`
} `json:"data"`
}
UploadServerStatus is returned when fetching the root of an upload server