Documentation ¶
Overview ¶
Package files provides API calls related to files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
DownloadFile writes file response to destination file. If stopped with ^c (SIGINT), removes the invalid file.
func UpdateFileDetails ¶
func UpdateFileDetails(fileId string, fdMap FileDetailsMap) (respBody []byte, err error)
UpdateFileDetails will update file details for that fileId. It will make two separate PATCH requests. One is for updating multiple metadata fields; the other is for basic fields like name and tags
Types ¶
type File ¶
type File struct { Href string `json:"href"` Id string `json:"id"` Name string `json:"name"` Parent string `json:"parent"` Project string `json:"project"` Type string `json:"type"` }
File contains all the JSON fields from one File.
func GetFiles ¶
GetFiles will get first 1-100 (limit) files for the given project. The totalOffset is obtained from X-Total-Matching-Query header. Based on that value we know how many times to make a new GET request. On each GET request we get []byte which we unmarshal to array of files. All file arrays gets merged into one which this function returns.
type FileDetails ¶
type FileDetails struct { Href string `json:"href"` Id string `json:"id"` Name string `json:"name"` Size int `json:"size"` Project string `json:"project"` CreatedOn string `json:"created_on"` ModifiedOn string `json:"modified_on"` Storage struct { Type string `json:"type"` Volume string `json:"volume"` Location string `json:"location"` } `json:"storage"` Origin struct { Dataset string `json:"dataset"` } `json:"origin"` Tags []string `json:"tags"` Metadata map[string]string `json:"metadata"` }
FileDetails contains all the JSON fields from details about a specific File.
func GetFileDetails ¶
func GetFileDetails(fileId string) (fDetails *FileDetails, err error)
GetFileDetails will get all the details for that fileId.
type FileDetailsMap ¶
type FileDetailsMap map[string]interface{}
FileDetailsMap is just an alias for map used for marshaling the FileDetails JSON.
type FileDetailsMetadataMap ¶
FileDetailsMetadataMap is just an alias for map used as FileDetailsMap metadata JSON field.
type FileUrl ¶
type FileUrl struct {
Url string `json:"url"`
}
FileUrl contains download link json field
func GetDownloadLink ¶
GetDownloadLink gets download link for the given file id.
type JsonResponse ¶
JsonResponse contains self link and array of Files.