Documentation
¶
Index ¶
- Constants
- func InArray[T comparable](el T, a []T) bool
- type Client
- type CommentIds
- type Disk
- type DiskService
- type ErrorResponse
- type Exif
- type FilesResourceList
- type HTTPHeaders
- type LastUploadedResourceList
- type Link
- type Metadata
- type Operation
- type OperationService
- type PublicResource
- type PublicResourcesList
- type PublicService
- func (s *PublicService) DownloadURL(ctx context.Context, public_key string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *PublicService) Meta(ctx context.Context, public_key string, params *QueryParams) (*PublicResource, *ErrorResponse)
- func (s *PublicService) Save(ctx context.Context, public_key string, params *QueryParams) (*Link, *ErrorResponse)
- type QueryParams
- type Resource
- type ResourceList
- type ResourceService
- func (s *ResourceService) Copy(ctx context.Context, from, to string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) CreateDir(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) Delete(ctx context.Context, path string, permanent bool, params *QueryParams) *ErrorResponse
- func (s *ResourceService) DownloadURL(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) GetSortedFiles(ctx context.Context, params *QueryParams) (*FilesResourceList, *ErrorResponse)
- func (s *ResourceService) GetUploadLink(ctx context.Context, path string) (*Link, *ErrorResponse)
- func (s *ResourceService) ListLastUploaded(ctx context.Context, params *QueryParams) (*LastUploadedResourceList, *ErrorResponse)
- func (s *ResourceService) ListPublic(ctx context.Context, params *QueryParams) (*PublicResourcesList, *ErrorResponse)
- func (s *ResourceService) Meta(ctx context.Context, path string, params *QueryParams) (*Resource, *ErrorResponse)
- func (s *ResourceService) Move(ctx context.Context, from, to string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) Publish(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) Unpublish(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *ResourceService) UpdateMeta(ctx context.Context, path string, custom_properties *Metadata) (*Resource, *ErrorResponse)
- func (s *ResourceService) Upload(ctx context.Context, file, url string, params *QueryParams) *ErrorResponse
- func (s *ResourceService) UploadFromURL(ctx context.Context, path, url string, params *QueryParams) (*Link, *ErrorResponse)
- type ResourceUploadLink
- type ShareInfo
- type SystemFolders
- type TrashResource
- type TrashService
- func (s *TrashService) Delete(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
- func (s *TrashService) List(ctx context.Context, path string, params *QueryParams) (*TrashResource, *ErrorResponse)
- func (s *TrashService) Restore(ctx context.Context, path string, params *QueryParams) (*Link, *Operation, *ErrorResponse)
- type User
- type UserPublicInformation
Constants ¶
View Source
const API_URL = "https://cloud-api.yandex.net/v1/disk/"
Variables ¶
This section is empty.
Functions ¶
func InArray ¶
func InArray[T comparable](el T, a []T) bool
Types ¶
type Client ¶
type Client struct { HTTPClient *http.Client Disk *DiskService Trash *TrashService Public *PublicService Resources *ResourceService Operation *OperationService // contains filtered or unexported fields }
type CommentIds ¶
type CommentIds struct { PrivateResource string `json:"private_resource,omitempty"` PublicResource string `json:"public_resource,omitempty"` }
CommentIds ...
type Disk ¶
type Disk struct { MaxFileSize int `json:"max_file_size,omitempty"` PaidMaxFileSize int `json:"paid_max_file_size,omitempty"` TotalSpace int `json:"total_space,omitempty"` TrashSize int `json:"trash_size,omitempty"` IsPaid bool `json:"is_paid,omitempty"` UsedSpace int `json:"used_space,omitempty"` SystemFolders *SystemFolders `json:"system_folders,omitempty"` User *User `json:"user,omitempty"` UnlimitedAutouploadEnabled bool `json:"unlimited_autoupload_enabled,omitempty"` Revision int `json:"revision,omitempty"` }
Disk Данные о свободном и занятом пространстве на Диске
type DiskService ¶
type DiskService service
func (*DiskService) Info ¶
func (s *DiskService) Info(ctx context.Context, params *QueryParams) (*Disk, *ErrorResponse)
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"message"` Description string `json:"description"` StatusCode int `json:"status_code"` Error error `json:"error"` // TODO: []errors }
ErrorResponse ...
type Exif ¶
type Exif struct { DateTime string `json:"date_time,omitempty"` Longitude float64 `json:"gps_longitude,omitempty"` Latitude float64 `json:"gps_latitude,omitempty"` }
Exif ...
type FilesResourceList ¶
type FilesResourceList struct { Items []*Resource `json:"items"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` }
FilesResourceList ...
type HTTPHeaders ¶
type LastUploadedResourceList ¶
type LastUploadedResourceList struct { Items []*Resource `json:"items"` Limit int `json:"limit,omitempty"` }
LastUploadedResourceList ...
type Link ¶
type Link struct { Href string `json:"href"` Method string `json:"method"` Templated bool `json:"templated,omitempty"` }
Link ...
type OperationService ¶
type OperationService service
func (*OperationService) Status ¶
func (s *OperationService) Status(ctx context.Context, operationID string, params *QueryParams) (*Operation, *ErrorResponse)
type PublicResource ¶
type PublicResource struct { Resource Owner *UserPublicInformation `json:"owner,omitempty"` ViewsCount int `json:"views_count,omitempty"` }
PublicResource ...
type PublicResourcesList ¶
type PublicResourcesList struct { Items []*Resource `json:"items"` Type string `json:"type"` Limit int `json:"limit"` Offset int `json:"offset"` }
PublicResourcesList ...
type PublicService ¶
type PublicService service
func (*PublicService) DownloadURL ¶
func (s *PublicService) DownloadURL(ctx context.Context, public_key string, params *QueryParams) (*Link, *ErrorResponse)
func (*PublicService) Meta ¶
func (s *PublicService) Meta(ctx context.Context, public_key string, params *QueryParams) (*PublicResource, *ErrorResponse)
func (*PublicService) Save ¶
func (s *PublicService) Save(ctx context.Context, public_key string, params *QueryParams) (*Link, *ErrorResponse)
type QueryParams ¶
type Resource ¶
type Resource struct { AntivirusStatus string `json:"antivirus_status,omitempty"` ResourceID string `json:"resource_id,omitempty"` File string `json:"file,omitempty"` Size int `json:"size,omitempty"` PhotosliceTime string `json:"photoslice_time,omitempty"` Embedded *ResourceList `json:"_embedded,omitempty"` Exif *Exif `json:"exif,omitempty"` CustomProperties map[string]string `json:"custom_properties,omitempty"` MediaType string `json:"media_type,omitempty"` Preview string `json:"preview,omitempty"` Type string `json:"type"` MimeType string `json:"mime_type,omitempty"` Revision int `json:"revision,omitempty"` PublicURL string `json:"public_url,omitempty"` Path string `json:"path"` Md5 string `json:"md5,omitempty"` PublicKey string `json:"public_key,omitempty"` Sha256 string `json:"sha256,omitempty"` Name string `json:"name"` Created string `json:"created"` // TODO: time format Modified string `json:"modified"` // TODO: time format CommentIDs *CommentIds `json:"comment_ids,omitempty"` }
Resource ...
type ResourceList ¶
type ResourceList struct { Sort string `json:"sort,omitempty"` Items []*Resource `json:"items"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` Path string `json:"path"` Total int `json:"total,omitempty"` }
ResourceList ... Список ресурсов, содержащихся в папке. Содержит объекты Resource и свойства списка.
type ResourceService ¶
type ResourceService service
func (*ResourceService) Copy ¶
func (s *ResourceService) Copy(ctx context.Context, from, to string, params *QueryParams) (*Link, *ErrorResponse)
func (*ResourceService) CreateDir ¶
func (s *ResourceService) CreateDir(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
CreateDir creates a new dorectory with 'path'(string) name todo: can't create nested dirs like newDir/subDir/anotherDir
func (*ResourceService) Delete ¶
func (s *ResourceService) Delete(ctx context.Context, path string, permanent bool, params *QueryParams) *ErrorResponse
func (*ResourceService) DownloadURL ¶
func (s *ResourceService) DownloadURL(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
func (*ResourceService) GetSortedFiles ¶
func (s *ResourceService) GetSortedFiles(ctx context.Context, params *QueryParams) (*FilesResourceList, *ErrorResponse)
TODO: rename to ListFiles
func (*ResourceService) GetUploadLink ¶
func (s *ResourceService) GetUploadLink(ctx context.Context, path string) (*Link, *ErrorResponse)
func (*ResourceService) ListLastUploaded ¶
func (s *ResourceService) ListLastUploaded(ctx context.Context, params *QueryParams) (*LastUploadedResourceList, *ErrorResponse)
get | sortBy = [name = default, uploadDate]
func (*ResourceService) ListPublic ¶
func (s *ResourceService) ListPublic(ctx context.Context, params *QueryParams) (*PublicResourcesList, *ErrorResponse)
func (*ResourceService) Meta ¶
func (s *ResourceService) Meta(ctx context.Context, path string, params *QueryParams) (*Resource, *ErrorResponse)
func (*ResourceService) Move ¶
func (s *ResourceService) Move(ctx context.Context, from, to string, params *QueryParams) (*Link, *ErrorResponse)
func (*ResourceService) Publish ¶
func (s *ResourceService) Publish(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
func (*ResourceService) Unpublish ¶
func (s *ResourceService) Unpublish(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
func (*ResourceService) UpdateMeta ¶
func (s *ResourceService) UpdateMeta(ctx context.Context, path string, custom_properties *Metadata) (*Resource, *ErrorResponse)
func (*ResourceService) Upload ¶
func (s *ResourceService) Upload(ctx context.Context, file, url string, params *QueryParams) *ErrorResponse
func (*ResourceService) UploadFromURL ¶
func (s *ResourceService) UploadFromURL(ctx context.Context, path, url string, params *QueryParams) (*Link, *ErrorResponse)
type ResourceUploadLink ¶
type ResourceUploadLink struct { OperationID string `json:"operation_id"` Href string `json:"href"` Method string `json:"method"` Templated bool `json:"templated,omitempty"` }
ResourceUploadLink ...
type SystemFolders ¶
type SystemFolders struct { Odnoklassniki string `json:"odnoklassniki,omitempty"` Google string `json:"google,omitempty"` Instagram string `json:"instagram,omitempty"` Vkontakte string `json:"vkontakte,omitempty"` Attach string `json:"attach,omitempty"` Mailru string `json:"mailru,omitempty"` Downloads string `json:"downloads,omitempty"` Applications string `json:"applications,omitempty"` Facebook string `json:"facebook,omitempty"` Social string `json:"social,omitempty"` Messenger string `json:"messenger,omitempty"` Calendar string `json:"calendar,omitempty"` Scans string `json:"scans,omitempty"` Screenshots string `json:"screenshots,omitempty"` Photostream string `json:"photostream,omitempty"` }
SystemFolders ...
type TrashService ¶
type TrashService service
func (*TrashService) Delete ¶
func (s *TrashService) Delete(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse)
func (*TrashService) List ¶
func (s *TrashService) List(ctx context.Context, path string, params *QueryParams) (*TrashResource, *ErrorResponse)
ListTrashResources -
func (*TrashService) Restore ¶
func (s *TrashService) Restore(ctx context.Context, path string, params *QueryParams) (*Link, *Operation, *ErrorResponse)
RestoreFromTrash -
type User ¶
type User struct { Country string `json:"country,omitempty"` Login string `json:"login,omitempty"` DisplayName string `json:"display_name,omitempty"` UID string `json:"uid,omitempty"` }
User ...
type UserPublicInformation ¶
type UserPublicInformation struct { Login string `json:"login,omitempty"` DisplayName string `json:"display_name,omitempty"` UID string `json:"uid,omitempty"` }
UserPublicInformation ...
Click to show internal directories.
Click to hide internal directories.