Documentation
¶
Index ¶
- func UploadContentToPresignedUrl(content io.Reader, size int64, presigned PresignedPostURLs) error
- func UploadFileToPresignedUrl(filePath string, presigned PresignedPostURLs) error
- type DeleteFilesByCustomIdsRequest
- type DeleteFilesByKeysRequest
- type DeleteFilesResponse
- type GetAppInfoResponse
- type ListFilesFile
- type ListFilesRequest
- type ListFilesResponse
- type PresignedPostURLs
- type RenameFileUpdate
- type RenameFilesRequest
- type RenameFilesResponse
- type RequestFileAccessRequest
- type RequestFileAccessResponse
- type UploadFileInfo
- type UploadFilesRequest
- type UploadFilesResponse
- type UsageInfoResponse
- type UtApi
- func (ut *UtApi) DeleteFilesByCustomIds(customIds []string) (*DeleteFilesResponse, error)
- func (ut *UtApi) DeleteFilesByKeys(fileKeys []string) (*DeleteFilesResponse, error)
- func (ut *UtApi) GetAppInfo() (*GetAppInfoResponse, error)
- func (ut *UtApi) GetPresignedUploadUrl(files []UploadFileInfo, acl string) (*UploadFilesResponse, error)
- func (ut *UtApi) GetPresignedUrl(fileKey string, expiresIn int) (string, error)
- func (ut *UtApi) GetUsageInfo() (*UsageInfoResponse, error)
- func (ut *UtApi) ListFiles(limit, offset int) (*ListFilesResponse, error)
- func (ut *UtApi) RenameFiles(updates []RenameFileUpdate) (*RenameFilesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UploadContentToPresignedUrl ¶ added in v1.0.2
func UploadContentToPresignedUrl(content io.Reader, size int64, presigned PresignedPostURLs) error
Upload content to presigned URL (S3 compatible POST) content - io.Reader with file data size - content size in bytes presigned - PresignedPostURLs struct from GetPresignedUploadUrl response
func UploadFileToPresignedUrl ¶
func UploadFileToPresignedUrl(filePath string, presigned PresignedPostURLs) error
Upload file to presigned URL (S3 compatible POST) filePath - path to local file presigned - PresignedPostURLs struct from GetPresignedUploadUrl response
Types ¶
type DeleteFilesByCustomIdsRequest ¶ added in v1.0.6
type DeleteFilesByCustomIdsRequest struct {
CustomIds []string `json:"customIds"`
}
type DeleteFilesByKeysRequest ¶ added in v1.0.6
type DeleteFilesByKeysRequest struct {
FileKeys []string `json:"fileKeys"`
}
1. Delete files POST /v6/deleteFiles {"fileKeys": ["key1", ...]}
type DeleteFilesResponse ¶
type GetAppInfoResponse ¶
type GetAppInfoResponse struct {
AppId string `json:"appId"`
DefaultACL string `json:"defaultACL"`
AllowACLOverride bool `json:"allowACLOverride"`
}
7. Get app info POST /v7/getAppInfo
type ListFilesFile ¶
type ListFilesRequest ¶
3. List files POST /v6/listFiles {"limit": 100, "offset": 0}
type ListFilesResponse ¶
type ListFilesResponse struct {
HasMore bool `json:"hasMore"`
Files []ListFilesFile `json:"files"`
}
type PresignedPostURLs ¶
type PresignedPostURLs struct {
Key string `json:"key"`
FileName string `json:"fileName"`
FileType string `json:"fileType"`
FileUrl string `json:"fileUrl"`
ContentDisposition string `json:"contentDisposition"`
PollingJwt string `json:"pollingJwt"`
PollingUrl string `json:"pollingUrl"`
CustomId *string `json:"customId"`
Url string `json:"url"`
Fields map[string]string `json:"fields"`
}
type RenameFileUpdate ¶
4. Rename files POST /v6/renameFiles {"updates": [{"fileKey": "...", "newName": "..."}]}
type RenameFilesRequest ¶
type RenameFilesRequest struct {
Updates []RenameFileUpdate `json:"updates"`
}
type RenameFilesResponse ¶
type RequestFileAccessRequest ¶
type RequestFileAccessRequest struct {
FileKey string `json:"fileKey"`
ExpiresIn int `json:"expiresIn,omitempty"`
}
6. Get presigned URL for a private file POST /v6/requestFileAccess {"fileKey": "...", "expiresIn": 3600}
type UploadFileInfo ¶
type UploadFileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
Type string `json:"type"`
CustomId *string `json:"customId,omitempty"`
}
8. Get presigned URL for file upload (without file router) POST /v6/uploadFiles {"files": [{"name": "file.txt", "size": 123, "type": "text/plain"}], "acl": "public-read"}
type UploadFilesRequest ¶
type UploadFilesRequest struct {
Files []UploadFileInfo `json:"files"`
ACL string `json:"acl"` // "public-read" or "private"
Metadata interface{} `json:"metadata,omitempty"`
ContentDisposition string `json:"contentDisposition,omitempty"`
}
type UploadFilesResponse ¶
type UploadFilesResponse struct {
Data []PresignedPostURLs `json:"data"`
}
type UsageInfoResponse ¶
type UsageInfoResponse struct {
TotalBytes int64 `json:"totalBytes"`
AppTotalBytes int64 `json:"appTotalBytes"`
FilesUploaded int `json:"filesUploaded"`
LimitBytes int64 `json:"limitBytes"`
}
5. Get usage info POST /v6/getUsageInfo
type UtApi ¶
type UtApi struct {
// contains filtered or unexported fields
}
Client structure httpClient can be overridden for tests config stores the key and version fePackage/beAdapter - optional headers for analytics (can be left empty)
func (*UtApi) DeleteFilesByCustomIds ¶ added in v1.0.3
func (ut *UtApi) DeleteFilesByCustomIds(customIds []string) (*DeleteFilesResponse, error)
func (*UtApi) DeleteFilesByKeys ¶ added in v1.0.3
func (ut *UtApi) DeleteFilesByKeys(fileKeys []string) (*DeleteFilesResponse, error)
func (*UtApi) GetAppInfo ¶
func (ut *UtApi) GetAppInfo() (*GetAppInfoResponse, error)
func (*UtApi) GetPresignedUploadUrl ¶
func (ut *UtApi) GetPresignedUploadUrl(files []UploadFileInfo, acl string) (*UploadFilesResponse, error)
Get presigned URL for file upload
func (*UtApi) GetPresignedUrl ¶
func (*UtApi) GetUsageInfo ¶
func (ut *UtApi) GetUsageInfo() (*UsageInfoResponse, error)
func (*UtApi) RenameFiles ¶
func (ut *UtApi) RenameFiles(updates []RenameFileUpdate) (*RenameFilesResponse, error)