diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19588bd..bfc26f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.1.1" + ".": "2.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 1fdb990..94357b3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ce4e1e..6a9b04c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index e914d88..ffc95e0 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Or to pin the 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' ``` diff --git a/asset.go b/asset.go index 366218e..ff95c4e 100644 --- a/asset.go +++ b/asset.go @@ -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"` @@ -97,6 +104,8 @@ 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"` @@ -104,10 +113,14 @@ type AssetListResponseUnion struct { 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 @@ -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 diff --git a/file.go b/file.go index afa48a9..bbd0f90 100644 --- a/file.go +++ b/file.go @@ -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"` @@ -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. @@ -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 @@ -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 @@ -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 @@ -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:"-"` } diff --git a/internal/version.go b/internal/version.go index e670ce2..0759deb 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "2.1.1" // x-release-please-version +const PackageVersion = "2.2.0" // x-release-please-version diff --git a/lib/helper.go b/lib/helper.go index d8e4bf8..ea38f91 100644 --- a/lib/helper.go +++ b/lib/helper.go @@ -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 diff --git a/packages/param/param.go b/packages/param/param.go index cf1b12c..2fb7bea 100644 --- a/packages/param/param.go +++ b/packages/param/param.go @@ -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, @@ -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) diff --git a/tests/helper_overlay_test.go b/tests/helper_overlay_test.go index 8205cfa..4e730d1 100644 --- a/tests/helper_overlay_test.go +++ b/tests/helper_overlay_test.go @@ -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) } @@ -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) } @@ -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) } @@ -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) }