Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.1.1"
".": "2.2.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 48
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-84f0d75048a9268981a84800b4190e3691997ce57dcfc0876f38a5b3fce6bacd.yml
openapi_spec_hash: 35607d4e850c8a60524223ff632c83bb
config_hash: aeb6eb949d73382270bbd8bbf2e4cf2a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-13fc3d7cafdea492f62eef7c1d63424d6d9d8adbff74b9f6ca6fd3fc12a36840.yml
openapi_spec_hash: a1fe6fa48207791657a1ea2d60a6dfcc
config_hash: 47cb702ee2cb52c58d803ae39ade9b44
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 2.2.0 (2026-02-02)

Full Changelog: [v2.1.1...v2.2.0](https://github.com/imagekit-developer/imagekit-go/compare/v2.1.1...v2.2.0)

### Features

* **api:** add customMetadata property to folder schema ([71fcd55](https://github.com/imagekit-developer/imagekit-go/commit/71fcd554cadcbc4981b57078a2ab9c2fbe72be51))
* **client:** add a convenient param.SetJSON helper ([7db0b48](https://github.com/imagekit-developer/imagekit-go/commit/7db0b4829c864151bda74f002c122f8a018118a0))


### Bug Fixes

* **api:** add missing embeddedMetadata and video properties to FileDetails ([b0e6909](https://github.com/imagekit-developer/imagekit-go/commit/b0e69096abac1ceba154150495cc2ae508ba63a0))
* **docs:** fix mcp installation instructions for remote servers ([f3875dd](https://github.com/imagekit-developer/imagekit-go/commit/f3875dddc1017d0db1ac2f3a86bd905bb941353d))
* **tests:** update subtitle references to use plural form ([7d180b7](https://github.com/imagekit-developer/imagekit-go/commit/7d180b758a232951e4b5c918c9dcc47aa11e99ab))

## 2.1.1 (2026-01-20)

Full Changelog: [v2.1.0...v2.1.1](https://github.com/imagekit-developer/imagekit-go/compare/v2.1.0...v2.1.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/imagekit-developer/imagekit-go/v2@v2.1.1'
go get -u 'github.com/imagekit-developer/imagekit-go/v2@v2.2.0'
```

<!-- x-release-please-end -->
Expand Down
22 changes: 18 additions & 4 deletions asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,22 @@ func (r *AssetService) List(ctx context.Context, query AssetListParams, opts ...
// Use the methods beginning with 'As' to cast the union to one of its variants.
type AssetListResponseUnion struct {
// This field is from variant [File].
AITags []FileAITag `json:"AITags"`
CreatedAt time.Time `json:"createdAt"`
AITags []FileAITag `json:"AITags"`
// This field is from variant [File].
CustomCoordinates string `json:"customCoordinates"`
AudioCodec string `json:"audioCodec"`
// This field is from variant [File].
BitRate int64 `json:"bitRate"`
CreatedAt time.Time `json:"createdAt"`
// This field is from variant [File].
CustomMetadata map[string]any `json:"customMetadata"`
CustomCoordinates string `json:"customCoordinates"`
CustomMetadata any `json:"customMetadata"`
// This field is from variant [File].
Description string `json:"description"`
// This field is from variant [File].
Duration int64 `json:"duration"`
// This field is from variant [File].
EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
// This field is from variant [File].
FileID string `json:"fileId"`
// This field is from variant [File].
FilePath string `json:"filePath"`
Expand Down Expand Up @@ -97,17 +104,23 @@ type AssetListResponseUnion struct {
// This field is from variant [File].
VersionInfo FileVersionInfo `json:"versionInfo"`
// This field is from variant [File].
VideoCodec string `json:"videoCodec"`
// This field is from variant [File].
Width float64 `json:"width"`
// This field is from variant [Folder].
FolderID string `json:"folderId"`
// This field is from variant [Folder].
FolderPath string `json:"folderPath"`
JSON struct {
AITags respjson.Field
AudioCodec respjson.Field
BitRate respjson.Field
CreatedAt respjson.Field
CustomCoordinates respjson.Field
CustomMetadata respjson.Field
Description respjson.Field
Duration respjson.Field
EmbeddedMetadata respjson.Field
FileID respjson.Field
FilePath respjson.Field
FileType respjson.Field
Expand All @@ -125,6 +138,7 @@ type AssetListResponseUnion struct {
UpdatedAt respjson.Field
URL respjson.Field
VersionInfo respjson.Field
VideoCodec respjson.Field
Width respjson.Field
FolderID respjson.Field
FolderPath respjson.Field
Expand Down
36 changes: 28 additions & 8 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func (r *FileService) Upload(ctx context.Context, body FileUploadParams, opts ..
type File struct {
// An array of tags assigned to the file by auto tagging.
AITags []FileAITag `json:"AITags,nullable"`
// The audio codec used in the video (only for video/audio).
AudioCodec string `json:"audioCodec"`
// The bit rate of the video in kbps (only for video).
BitRate int64 `json:"bitRate"`
// Date and time when the file was uploaded. The date and time is in ISO8601
// format.
CreatedAt time.Time `json:"createdAt" format:"date-time"`
Expand All @@ -179,6 +183,11 @@ type File struct {
// Optional text to describe the contents of the file. Can be set by the user or
// the ai-auto-description extension.
Description string `json:"description"`
// The duration of the video in seconds (only for video).
Duration int64 `json:"duration"`
// Consolidated embedded metadata associated with the file. It includes exif, iptc,
// and xmp data.
EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
// Unique identifier of the asset.
FileID string `json:"fileId"`
// Path of the file. This is the path you would use in the URL to access the file.
Expand Down Expand Up @@ -227,15 +236,21 @@ type File struct {
URL string `json:"url" format:"uri"`
// An object with details of the file version.
VersionInfo FileVersionInfo `json:"versionInfo"`
// The video codec used in the video (only for video).
VideoCodec string `json:"videoCodec"`
// Width of the file.
Width float64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AITags respjson.Field
AudioCodec respjson.Field
BitRate respjson.Field
CreatedAt respjson.Field
CustomCoordinates respjson.Field
CustomMetadata respjson.Field
Description respjson.Field
Duration respjson.Field
EmbeddedMetadata respjson.Field
FileID respjson.Field
FilePath respjson.Field
FileType respjson.Field
Expand All @@ -253,6 +268,7 @@ type File struct {
UpdatedAt respjson.Field
URL respjson.Field
VersionInfo respjson.Field
VideoCodec respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
raw string
Expand Down Expand Up @@ -591,6 +607,9 @@ type Folder struct {
// Date and time when the folder was created. The date and time is in ISO8601
// format.
CreatedAt time.Time `json:"createdAt" format:"date-time"`
// An object with custom metadata for the folder. Returns empty object if no custom
// metadata is set.
CustomMetadata map[string]any `json:"customMetadata"`
// Unique identifier of the asset.
FolderID string `json:"folderId"`
// Path of the folder. This is the path you would use in the URL to access the
Expand All @@ -609,14 +628,15 @@ type Folder struct {
UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
FolderID respjson.Field
FolderPath respjson.Field
Name respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
raw string
CreatedAt respjson.Field
CustomMetadata respjson.Field
FolderID respjson.Field
FolderPath respjson.Field
Name respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "2.1.1" // x-release-please-version
const PackageVersion = "2.2.0" // x-release-please-version
2 changes: 1 addition & 1 deletion lib/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func (r *HelperService) processOverlay(overlay shared.OverlayUnionParam) string
encoding = "auto"
}

entries = append(entries, "l-subtitle")
entries = append(entries, "l-subtitles")
entries = append(entries, processInputPath(subtitleOverlay.Input, encoding))
baseOverlay = &subtitleOverlay.BaseOverlayParam

Expand Down
18 changes: 18 additions & 0 deletions packages/param/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ func Override[T ParamStruct, PtrT InferPtr[T]](v any) T {
return *pt
}

// SetJSON configures a param struct to serialize with the provided raw JSON data.
// Use this when you have existing JSON that you want to send as request parameters.
//
// var req example.NewUserParams
// var rawJSON = []byte(`{"name": "...", "age": 40}`)
// param.SetJSON(rawJSON, &req)
// res, err := client.Users.New(ctx, req)
//
// Note: The struct's existing fields will be ignored; only the provided JSON is serialized.
func SetJSON(rawJSON []byte, ptr anyParamStruct) {
ptr.setMetadata(json.RawMessage(rawJSON))
}

// IsOmitted returns true if v is the zero value of its type.
//
// If IsOmitted is true, and the field uses a `json:"...,omitzero"` tag,
Expand Down Expand Up @@ -91,6 +104,11 @@ type ParamStruct interface {
extraFields() map[string]any
}

// A pointer to ParamStruct
type anyParamStruct interface {
setMetadata(any)
}

// This is an implementation detail and should never be explicitly set.
type InferPtr[T ParamStruct] interface {
setMetadata(any)
Expand Down
8 changes: 4 additions & 4 deletions tests/helper_overlay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func TestOverlayTransformations(t *testing.T) {
Transformation: transformation,
})

expected := "https://ik.imagekit.io/test_url_endpoint/tr:l-subtitle,i-subtitle.srt,l-end/base-video.mp4"
expected := "https://ik.imagekit.io/test_url_endpoint/tr:l-subtitles,i-subtitle.srt,l-end/base-video.mp4"
if url != expected {
t.Errorf("Expected %s, got %s", expected, url)
}
Expand Down Expand Up @@ -461,7 +461,7 @@ func TestOverlayTransformations(t *testing.T) {
Transformation: transformation,
})

expected := "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Every%20thing,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,i-Nested%20text%20overlay,l-end,l-end:l-video,i-play-pause-loop.mp4,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-subtitle,i-subtitle.srt,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,bg-red,co-0000ff,ff-Arial,fol-2_A1CCDD50,fsh-A1CCDD_3,l-end:l-image,i-ik_canvas,bg-FF0000,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,al-0.5,bg-red,e-gradient,r-max,l-end/base-image.jpg"
expected := "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Every%20thing,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,i-Nested%20text%20overlay,l-end,l-end:l-video,i-play-pause-loop.mp4,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-subtitles,i-subtitle.srt,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,bg-red,co-0000ff,ff-Arial,fol-2_A1CCDD50,fsh-A1CCDD_3,l-end:l-image,i-ik_canvas,bg-FF0000,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,al-0.5,bg-red,e-gradient,r-max,l-end/base-image.jpg"
if url != expected {
t.Errorf("Expected %s, got %s", expected, url)
}
Expand Down Expand Up @@ -777,7 +777,7 @@ func TestOverlayEncoding(t *testing.T) {
Transformation: transformation,
})

expected := "https://ik.imagekit.io/demo/tr:l-subtitle,i-sub.srt,l-end/sample.mp4"
expected := "https://ik.imagekit.io/demo/tr:l-subtitles,i-sub.srt,l-end/sample.mp4"
if url != expected {
t.Errorf("Expected %s, got %s", expected, url)
}
Expand All @@ -803,7 +803,7 @@ func TestOverlayEncoding(t *testing.T) {
Transformation: transformation,
})

expected := "https://ik.imagekit.io/demo/tr:l-subtitle,ie-c3ViLnNydA%3D%3D,l-end/sample.mp4"
expected := "https://ik.imagekit.io/demo/tr:l-subtitles,ie-c3ViLnNydA%3D%3D,l-end/sample.mp4"
if url != expected {
t.Errorf("Expected %s, got %s", expected, url)
}
Expand Down
Loading