Documentation ¶
Index ¶
- Constants
- Variables
- type Bool
- type FileDetails
- type FileOptions
- type FilesFetchParams
- type ImageKit
- func (imgKit *ImageKit) AddTags(fileIds, tags []string) (updatedFileIds []string, err error)
- func (imgKit *ImageKit) CopyFile(srcFilePath, destFolderPath string) (err error)
- func (imgKit *ImageKit) CreateFolder(folderName, parentFolderPath string) (err error)
- func (imgKit *ImageKit) DeleteFile(fileId string) (err error)
- func (imgKit *ImageKit) DeleteFiles(fileIds []string) (deletedFileIds []string, err error)
- func (imgKit *ImageKit) DeleteFolder(folderPath string) (err error)
- func (imgKit *ImageKit) DoRequest(req *http.Request) (body string, err error)
- func (imgKit *ImageKit) GetFileDetails(fileId string) (fileDetail *FileDetails, err error)
- func (imgKit *ImageKit) GetFiles(params *FilesFetchParams) (fileDetails *[]FileDetails, err error)
- func (imgKit *ImageKit) MoveFile(srcFilePath, destFolderPath string) (err error)
- func (imgKit *ImageKit) RemoveAITags(fileIds, aiTags []string) (updatedFileIds []string, err error)
- func (imgKit *ImageKit) RemoveTags(fileIds, tags []string) (updatedFileIds []string, err error)
- func (imgKit *ImageKit) RenameFile(srcFilePath, newFileName string, purgeCache ...bool) (purgeRequestId string, err error)
- func (imgKit *ImageKit) UpdateFileDetails(fileId string, options *FileOptions) (fileDetail *FileDetails, err error)
- func (imgKit *ImageKit) Upload(file, fileName string, options *FileOptions) (result *FileDetails, err error)
- type Int32
- type String
Constants ¶
View Source
const ( BASE_URL = "https://api.imagekit.io/v1" UPLOAD_URL = "https://upload.imagekit.io/api/v1/files/upload" MIN_LIMIT_VALUE = 1 MIN_SKIP_VALUE = 0 MAX_LIMIT_VALUE = 1000 )
Variables ¶
View Source
var VALID_FILE_TYPES = []string{"all", "image", "non-image"}
View Source
var VALID_SORT_FIELDS = []string{
"ASC_NAME",
"DESC_NAME",
"ASC_CREATED",
"DESC_CREATED",
"ASC_UPDATED",
"DESC_UPDATED",
"ASC_HEIGHT",
"DESC_HEIGHT",
"ASC_WIDTH",
"DESC_WIDTH",
"ASC_SIZE",
"DESC_SIZE",
}
View Source
var VALID_TYPES = []string{"all", "file", "folder"}
Functions ¶
This section is empty.
Types ¶
type FileDetails ¶
type FileDetails struct { FileId *String `json:"fileId" binding:"-"` Type *String `json:"type" binding:"-"` Name *String `json:"name" binding:"-"` FilePath *String `json:"filePath" binding:"-"` Tags *[]String `json:"tags" binding:"-"` AITags *[]interface{} `json:"AITags" binding:"-"` IsPrivateFile *Bool `json:"isPrivateFile" binding:"-"` CustomCoordinates *String `json:"customCoordinates" binding:"-"` Url *String `json:"url" binding:"-"` Thumbnail *String `json:"thumbnail" binding:"-"` FileType *String `json:"fileType" binding:"-"` Mime *String `json:"mime" binding:"-"` Height Int32 `json:"height" binding:"-"` Width Int32 `json:"width" binding:"-"` Size Int32 `json:"size" binding:"-"` HasAlpha *Bool `json:"hasAlpha" binding:"-"` CustomMetadata *interface{} `json:"customMetadata" binding:"-"` EmbeddedMetadata *interface{} `json:"embeddedMetadata" binding:"-"` CreatedAt *time.Time `json:"createdAt" binding:"-" time_format:"YYYY-MM-DDTHH:mm:ss.sssZ"` UpdatedAt *time.Time `json:"updatedAt" binding:"-" time_format:"YYYY-MM-DDTHH:mm:ss.sssZ"` ExtensionStatus map[string]string `json:"extensionStatus" binding:"-"` }
Represents details about a file.
type FileOptions ¶
type FileOptions struct { UseUniqueFileName *Bool Tags *[]String Folder *String IsPrivateFile *Bool CustomCoordinates *String ResponseFields *[]String Extensions *[]interface{} WebhookUrl *String OverwriteFile *Bool OverwriteAITags *Bool OverwriteTags *Bool OverwriteCustomMetadata *Bool CustomMetadata *interface{} }
Represents options for creating or modifying files.
func (FileOptions) ToDict ¶
func (options FileOptions) ToDict() (fields map[string]string, err error)
Converts options to a map of optionName-optionValue pairs.
func (FileOptions) ToJSON ¶
func (options FileOptions) ToJSON() (jsonStr string, err error)
Converts options to its JSON representation.
type FilesFetchParams ¶
type FilesFetchParams struct {
Type, Sort, Path, SearchQuery *String
Tags *[]String
FileType *String
Limit, Skip *Int32
}
Represents query parameters for fetching files from imagekit.io.
func (FilesFetchParams) BuildURLQuery ¶
func (params FilesFetchParams) BuildURLQuery() (query string, err error)
Creates a URL query from the FilesFetchParams.
type ImageKit ¶
type ImageKit struct {
PublicKey, PrivateKey, UrlEndpoint string
}
Represents a struct with routines for managing assets on imagekit.io.
func (*ImageKit) CreateFolder ¶
Create a folder.
func (*ImageKit) DeleteFile ¶
Delete a file.
func (*ImageKit) DeleteFiles ¶
Delete an array of files.
func (*ImageKit) DeleteFolder ¶
Delete a folder.
func (*ImageKit) GetFileDetails ¶
func (imgKit *ImageKit) GetFileDetails(fileId string) (fileDetail *FileDetails, err error)
Get details of a file.
func (*ImageKit) GetFiles ¶
func (imgKit *ImageKit) GetFiles( params *FilesFetchParams) (fileDetails *[]FileDetails, err error)
List and search files.
func (*ImageKit) RemoveAITags ¶
Remove AI tags from an array of files.
func (*ImageKit) RemoveTags ¶
Remove tags from an array of files.
func (*ImageKit) RenameFile ¶
func (imgKit *ImageKit) RenameFile(srcFilePath, newFileName string, purgeCache ...bool) (purgeRequestId string, err error)
Rename a file.
func (*ImageKit) UpdateFileDetails ¶
func (imgKit *ImageKit) UpdateFileDetails( fileId string, options *FileOptions) (fileDetail *FileDetails, err error)
Update details of a file.
func (*ImageKit) Upload ¶
func (imgKit *ImageKit) Upload( file, fileName string, options *FileOptions) (result *FileDetails, err error)
Uploads a file to ImageKit.io.
Click to show internal directories.
Click to hide internal directories.