imagekit

package module
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

README

ImageKit.io Go SDK

Go Reference

The ImageKit Go SDK is a comprehensive library designed to simplify the integration of ImageKit into your server-side applications. It provides powerful tools for working with the ImageKit REST API, including building and transforming URLs, generating signed URLs for secure content delivery, verifying webhooks, and handling file uploads.

The full API of this library can be found in api.md.

For additional details, refer to the ImageKit REST API documentation.

Table of Contents

Installation

import (
	"github.com/imagekit-developer/imagekit-go/v2" // imported as imagekit
)

Or to pin the version:

go get -u 'github.com/imagekit-developer/imagekit-go@v2.0.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"), // defaults to os.LookupEnv("IMAGEKIT_PRIVATE_KEY")
	)
	
	file, err := os.Open("/path/to/your/image.jpg")
	if err != nil {
		panic(err.Error())
	}
	defer file.Close()
	
	response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
		File:     file,
		FileName: "uploaded-image.jpg",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response)
}

Request fields

The imagekit library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, imagekit.String(string), imagekit.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := imagekit.ExampleParams{
	ID:   "id_xxx",               // required property
	Name: imagekit.String("..."), // optional property

	Point: imagekit.Point{
		X: 0,               // required field will serialize as 0
		Y: imagekit.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: imagekit.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[imagekit.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := imagekit.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Files.Upload(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

URL generation

The ImageKit SDK provides a powerful Helper.BuildURL() method for generating optimized image and video URLs with transformations. Here are examples ranging from simple URLs to complex transformations with overlays and signed URLs.

Basic URL generation

Generate a simple URL without any transformations:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// Basic URL without transformations
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/image.jpg",
	})
	fmt.Println(url)
	// Result: https://ik.imagekit.io/your_imagekit_id/path/to/image.jpg
}
URL generation with transformations

Apply common transformations like resizing, cropping, and format conversion:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// URL with basic transformations
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/image.jpg",
		Transformation: []shared.TransformationParam{
			{
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 400},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 300},
				},
				Crop:    shared.TransformationCropMaintainRatio,
				Quality:  param.Opt[float64]{Value: 80},
				Format:   shared.TransformationFormatWebp,
			},
		},
	})
	fmt.Println(url)
	// Result: https://ik.imagekit.io/your_imagekit_id/path/to/image.jpg?tr=w-400,h-300,c-maintain_ratio,q-80,f-webp
}
URL generation with image overlay

Add image overlays to your base image:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
	"github.com/imagekit-developer/imagekit-go/v2/shared/constant"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// URL with image overlay
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/base-image.jpg",
		Transformation: []shared.TransformationParam{
			{
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 500},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 400},
				},
				Overlay: shared.OverlayUnionParam{
					OfImage: &shared.ImageOverlayParam{
						Type:  constant.Image("image"),
						Input: "/path/to/overlay-logo.png",
						BaseOverlayParam: shared.BaseOverlayParam{
							Position: shared.OverlayPositionParam{
								X: shared.OverlayPositionXUnionParam{
									OfFloat: param.Opt[float64]{Value: 10},
								},
								Y: shared.OverlayPositionYUnionParam{
									OfFloat: param.Opt[float64]{Value: 10},
								},
							},
						},
						Transformation: []shared.TransformationParam{
							{
								Width: shared.TransformationWidthUnionParam{
									OfFloat: param.Opt[float64]{Value: 100},
								},
								Height: shared.TransformationHeightUnionParam{
									OfFloat: param.Opt[float64]{Value: 50},
								},
							},
						},
					},
				},
			},
		},
	})
	fmt.Println(url)
	// Result: URL with image overlay positioned at x:10, y:10
}
URL generation with text overlay

Add customized text overlays:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
	"github.com/imagekit-developer/imagekit-go/v2/shared/constant"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// URL with text overlay
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/base-image.jpg",
		Transformation: []shared.TransformationParam{
			{
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 600},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 400},
				},
				Overlay: shared.OverlayUnionParam{
					OfText: &shared.TextOverlayParam{
						Type: constant.Text("text"),
						Text: "Sample Text Overlay",
						BaseOverlayParam: shared.BaseOverlayParam{
							Position: shared.OverlayPositionParam{
								X: shared.OverlayPositionXUnionParam{
									OfFloat: param.Opt[float64]{Value: 50},
								},
								Y: shared.OverlayPositionYUnionParam{
									OfFloat: param.Opt[float64]{Value: 50},
								},
								Focus: shared.OverlayPositionFocusCenter,
							},
						},
						Transformation: []shared.TextOverlayTransformationParam{
							{
								FontSize: shared.TextOverlayTransformationFontSizeUnionParam{
									OfFloat: param.Opt[float64]{Value: 40},
								},
								FontFamily: param.Opt[string]{Value: "Arial"},
								FontColor:  param.Opt[string]{Value: "FFFFFF"},
								Typography: param.Opt[string]{Value: "b"}, // bold
							},
						},
					},
				},
			},
		},
	})
	fmt.Println(url)
	// Result: URL with bold white Arial text overlay at center position
}
URL generation with multiple overlays

Combine multiple overlays for complex compositions:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
	"github.com/imagekit-developer/imagekit-go/v2/shared/constant"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// URL with multiple overlays (text + image)
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/base-image.jpg",
		Transformation: []shared.TransformationParam{
			{
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 800},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 600},
				},
				Overlay: shared.OverlayUnionParam{
					OfText: &shared.TextOverlayParam{
						Type: constant.Text("text"),
						Text: "Header Text",
						BaseOverlayParam: shared.BaseOverlayParam{
							Position: shared.OverlayPositionParam{
								X: shared.OverlayPositionXUnionParam{
									OfFloat: param.Opt[float64]{Value: 20},
								},
								Y: shared.OverlayPositionYUnionParam{
									OfFloat: param.Opt[float64]{Value: 20},
								},
							},
						},
						Transformation: []shared.TextOverlayTransformationParam{
							{
								FontSize: shared.TextOverlayTransformationFontSizeUnionParam{
									OfFloat: param.Opt[float64]{Value: 30},
								},
								FontColor: param.Opt[string]{Value: "000000"},
							},
						},
					},
				},
			},
			{
				Overlay: shared.OverlayUnionParam{
					OfImage: &shared.ImageOverlayParam{
						Type:  constant.Image("image"),
						Input: "/watermark.png",
						BaseOverlayParam: shared.BaseOverlayParam{
							Position: shared.OverlayPositionParam{
								Focus: shared.OverlayPositionFocusBottomRight,
							},
						},
						Transformation: []shared.TransformationParam{
							{
								Width: shared.TransformationWidthUnionParam{
									OfFloat: param.Opt[float64]{Value: 100},
								},
								Opacity: param.Opt[float64]{Value: 70},
							},
						},
					},
				},
			},
		},
	})
	fmt.Println(url)
	// Result: URL with text overlay at top-left and semi-transparent watermark at bottom-right
}
Signed URLs for secure delivery

Generate signed URLs that expire after a specified time for secure content delivery:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// Generate a signed URL that expires in 1 hour (3600 seconds)
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/private/secure-image.jpg",
		Transformation: []shared.TransformationParam{
			{
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 400},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 300},
				},
				Quality: param.Opt[float64]{Value: 90},
			},
		},
		Signed:    param.Opt[bool]{Value: true},
		ExpiresIn: param.Opt[float64]{Value: 3600}, // URL expires in 1 hour
	})
	fmt.Println(url)
	// Result: URL with signature parameters (?ik-t=timestamp&ik-s=signature)

	// Generate a signed URL that doesn't expire
	permanentSignedUrl := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/private/secure-image.jpg",
		Signed:      param.Opt[bool]{Value: true},
		// No ExpiresIn means the URL won't expire
	})
	fmt.Println(permanentSignedUrl)
	// Result: URL with signature parameter (?ik-s=signature)
}
Using Raw transformations for undocumented features

ImageKit frequently adds new transformation parameters that might not yet be documented in the SDK. You can use the Raw parameter to access these features or create custom transformation strings:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
	"github.com/imagekit-developer/imagekit-go/v2/packages/param"
	"github.com/imagekit-developer/imagekit-go/v2/shared"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// Using Raw transformation for undocumented or new parameters
	url := client.Helper.BuildURL(shared.SrcOptionsParam{
		URLEndpoint: "https://ik.imagekit.io/your_imagekit_id",
		Src:         "/path/to/image.jpg",
		Transformation: []shared.TransformationParam{
			{
				// Combine documented transformations with raw parameters
				Width: shared.TransformationWidthUnionParam{
					OfFloat: param.Opt[float64]{Value: 400},
				},
				Height: shared.TransformationHeightUnionParam{
					OfFloat: param.Opt[float64]{Value: 300},
				},
			},
			{
				// Use Raw for undocumented transformations or complex parameters
				Raw: param.Opt[string]{Value: "something-new"},
			},
		},
	})
	fmt.Println(url)
	// Result: https://ik.imagekit.io/your_imagekit_id/path/to/image.jpg?tr=w-400,h-300:something-new
}

Authentication parameters for client-side uploads

Generate authentication parameters for secure client-side file uploads:

package main

import (
	"fmt"
	
	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("private_key_xxx"),
	)

	// Generate authentication parameters for client-side uploads
	authParams := client.Helper.GetAuthenticationParameters("", 0)
	fmt.Printf("%+v\n", authParams)
	// Result: map[expire:<timestamp> signature:<hmac-signature> token:<uuid-token>]

	// Generate with custom token and expiry
	customAuthParams := client.Helper.GetAuthenticationParameters("my-custom-token", 1800)
	fmt.Printf("%+v\n", customAuthParams)
	// Result: map[expire:1800 signature:<hmac-signature> token:my-custom-token]
}

These authentication parameters can be used in client-side upload forms to securely upload files without exposing your private API key.

Webhook verification

The ImageKit SDK provides utilities to verify webhook signatures for secure event handling. This ensures that webhook requests are actually coming from ImageKit and haven't been tampered with.

Verifying webhook signatures
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
	"os"

	"github.com/imagekit-developer/imagekit-go/v2"
	"github.com/imagekit-developer/imagekit-go/v2/option"
)

func main() {
	client := imagekit.NewClient(
		option.WithPrivateKey("your_private_key"),
		option.WithWebhookSecret("whsec_..."), // Copy from ImageKit dashboard
	)

	// Webhook handler with proper request body handling
	http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
		// Limit request body size to prevent abuse (64KB should be sufficient for most webhooks)
		const MaxBodyBytes = int64(65536)
		req.Body = http.MaxBytesReader(w, req.Body, MaxBodyBytes)
		
		// Read the raw webhook payload
		payload, err := io.ReadAll(req.Body)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error reading request body: %v\n", err)
			w.WriteHeader(http.StatusServiceUnavailable)
			return
		}

		// Verify and unwrap webhook payload
		event, err := client.Webhooks.Unwrap(payload, req.Header)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Invalid webhook signature or malformed payload: %v\n", err)
			w.WriteHeader(http.StatusUnauthorized)
			return
		}

		fmt.Printf("Verified webhook event: %s\n", event.Type)
		
		// Handle different event types with full type safety
		switch event.Type {
		case "video.transformation.accepted":
			videoEvent := event.AsVideoTransformationAcceptedEvent()
			fmt.Printf("Video transformation accepted: %s\n", videoEvent.Data.Asset.URL)
			// Debugging: Track transformation requests
			// handleVideoTransformationAccepted(videoEvent)
			
		case "video.transformation.ready":
			videoEvent := event.AsVideoTransformationReadyEvent()
			fmt.Printf("Video transformation ready: %s\n", videoEvent.Data.Transformation.Output.URL)
			// Update your database/CMS to show the transformed video
			// handleVideoTransformationReady(videoEvent)
			
		case "video.transformation.error":
			videoEvent := event.AsVideoTransformationErrorEvent()
			fmt.Printf("Video transformation error: %s\n", videoEvent.Data.Transformation.Error.Reason)
			// Log error and check your origin/URL endpoint settings
			// handleVideoTransformationError(videoEvent)
			
		case "upload.pre-transform.success":
			uploadEvent := event.AsUploadPreTransformSuccessEvent()
			fmt.Printf("Pre-transform success: %s\n", uploadEvent.Data.FileID)
			// File uploaded and pre-transformation completed
			// handleUploadPreTransformSuccess(uploadEvent)
			
		case "upload.post-transform.success":
			postEvent := event.AsUploadPostTransformSuccessEvent()
			fmt.Printf("Post-transform success: %s\n", postEvent.Data.Name)
			// Additional transformation completed
			// handleUploadPostTransformSuccess(postEvent)
			
		// Handle other event types as needed
		default:
			fmt.Printf("Unhandled event type: %s\n", event.Type)
		}

		w.WriteHeader(http.StatusOK)
	})

	// Start the server
	fmt.Println("Webhook server listening on :8080")
	log.Fatal(http.ListenAndServe(":8080", nil))
}

For detailed information about webhook setup, signature verification, and handling different webhook events, refer to the ImageKit webhook documentation.

Errors

When the API returns a non-success status code, we return an error with type *imagekit.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

file, err := os.Open("/path/to/your/image.jpg")
if err != nil {
	panic(err.Error())
}
defer file.Close()

_, err = client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
	File:     file,
	FileName: "uploaded-image.jpg",
})
if err != nil {
	var apierr *imagekit.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/api/v1/files/upload": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

file, err := os.Open("/path/to/your/image.jpg")
if err != nil {
	panic(err.Error())
}
defer file.Close()

client.Files.Upload(
	ctx,
	imagekit.FileUploadParams{
		File:     file,
		FileName: "uploaded-image.jpg",
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper imagekit.NewFile(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Here are common file upload patterns:

// Upload from local file system
file, err := os.Open("/path/to/your/image.jpg")
if err != nil {
	panic(err.Error())
}
defer file.Close()

response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
	File:     file,
	FileName: "uploaded-image.jpg",
})

// Upload from remote URL
resp, err := http.Get("https://example.com/remote-image.jpg")
if err != nil {
	panic(err.Error())
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
	panic("Failed to fetch remote image")
}

response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
	File:     resp.Body,
	FileName: "remote-image.jpg",
})

// Upload from binary data
imageData := []byte{/* your binary data */}
response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
	File:     bytes.NewReader(imageData),
	FileName: "binary-upload.jpg",
})

// Upload with custom content type
response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{
	File:     imagekit.NewFile(bytes.NewReader(imageData), "custom.jpg", "image/jpeg"),
	FileName: "custom-upload.jpg",
})
Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := imagekit.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
file, err := os.Open("/path/to/your/image.jpg")
if err != nil {
	panic(err.Error())
}
defer file.Close()

client.Files.Upload(
	context.TODO(),
	imagekit.FileUploadParams{
		File:     file,
		FileName: "uploaded-image.jpg",
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response

file, err := os.Open("/path/to/your/image.jpg")
if err != nil {
	panic(err.Error())
}
defer file.Close()

response, err = client.Files.Upload(
	context.TODO(),
	imagekit.FileUploadParams{
		File:     file,
		FileName: "uploaded-image.jpg",
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: imagekit.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := imagekit.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const OverlayPositionFocusBottom = shared.OverlayPositionFocusBottom

Equals "bottom"

View Source
const OverlayPositionFocusBottomLeft = shared.OverlayPositionFocusBottomLeft

Equals "bottom_left"

View Source
const OverlayPositionFocusBottomRight = shared.OverlayPositionFocusBottomRight

Equals "bottom_right"

View Source
const OverlayPositionFocusCenter = shared.OverlayPositionFocusCenter

Equals "center"

View Source
const OverlayPositionFocusLeft = shared.OverlayPositionFocusLeft

Equals "left"

View Source
const OverlayPositionFocusRight = shared.OverlayPositionFocusRight

Equals "right"

View Source
const OverlayPositionFocusTop = shared.OverlayPositionFocusTop

Equals "top"

View Source
const OverlayPositionFocusTopLeft = shared.OverlayPositionFocusTopLeft

Equals "top_left"

View Source
const OverlayPositionFocusTopRight = shared.OverlayPositionFocusTopRight

Equals "top_right"

View Source
const StreamingResolution1080 = shared.StreamingResolution1080

Equals "1080"

View Source
const StreamingResolution1440 = shared.StreamingResolution1440

Equals "1440"

View Source
const StreamingResolution2160 = shared.StreamingResolution2160

Equals "2160"

View Source
const StreamingResolution240 = shared.StreamingResolution240

Equals "240"

View Source
const StreamingResolution360 = shared.StreamingResolution360

Equals "360"

View Source
const StreamingResolution480 = shared.StreamingResolution480

Equals "480"

View Source
const StreamingResolution720 = shared.StreamingResolution720

Equals "720"

View Source
const SubtitleOverlayTransformationTypographyB = shared.SubtitleOverlayTransformationTypographyB

Equals "b"

View Source
const SubtitleOverlayTransformationTypographyBI = shared.SubtitleOverlayTransformationTypographyBI

Equals "b_i"

View Source
const SubtitleOverlayTransformationTypographyI = shared.SubtitleOverlayTransformationTypographyI

Equals "i"

View Source
const TextOverlayTransformationFlipH = shared.TextOverlayTransformationFlipH

Equals "h"

View Source
const TextOverlayTransformationFlipHV = shared.TextOverlayTransformationFlipHV

Equals "h_v"

View Source
const TextOverlayTransformationFlipV = shared.TextOverlayTransformationFlipV

Equals "v"

View Source
const TextOverlayTransformationFlipVH = shared.TextOverlayTransformationFlipVH

Equals "v_h"

View Source
const TextOverlayTransformationInnerAlignmentCenter = shared.TextOverlayTransformationInnerAlignmentCenter

Equals "center"

View Source
const TextOverlayTransformationInnerAlignmentLeft = shared.TextOverlayTransformationInnerAlignmentLeft

Equals "left"

View Source
const TextOverlayTransformationInnerAlignmentRight = shared.TextOverlayTransformationInnerAlignmentRight

Equals "right"

View Source
const TransformationAudioCodecAac = shared.TransformationAudioCodecAac

Equals "aac"

View Source
const TransformationAudioCodecNone = shared.TransformationAudioCodecNone

Equals "none"

View Source
const TransformationAudioCodecOpus = shared.TransformationAudioCodecOpus

Equals "opus"

View Source
const TransformationCropAtLeast = shared.TransformationCropAtLeast

Equals "at_least"

View Source
const TransformationCropAtMax = shared.TransformationCropAtMax

Equals "at_max"

View Source
const TransformationCropAtMaxEnlarge = shared.TransformationCropAtMaxEnlarge

Equals "at_max_enlarge"

View Source
const TransformationCropForce = shared.TransformationCropForce

Equals "force"

View Source
const TransformationCropMaintainRatio = shared.TransformationCropMaintainRatio

Equals "maintain_ratio"

View Source
const TransformationCropModeExtract = shared.TransformationCropModeExtract

Equals "extract"

View Source
const TransformationCropModePadExtract = shared.TransformationCropModePadExtract

Equals "pad_extract"

View Source
const TransformationCropModePadResize = shared.TransformationCropModePadResize

Equals "pad_resize"

View Source
const TransformationFlipH = shared.TransformationFlipH

Equals "h"

View Source
const TransformationFlipHV = shared.TransformationFlipHV

Equals "h_v"

View Source
const TransformationFlipV = shared.TransformationFlipV

Equals "v"

View Source
const TransformationFlipVH = shared.TransformationFlipVH

Equals "v_h"

View Source
const TransformationFormatAuto = shared.TransformationFormatAuto

Equals "auto"

View Source
const TransformationFormatAvif = shared.TransformationFormatAvif

Equals "avif"

View Source
const TransformationFormatGif = shared.TransformationFormatGif

Equals "gif"

View Source
const TransformationFormatJpeg = shared.TransformationFormatJpeg

Equals "jpeg"

View Source
const TransformationFormatJpg = shared.TransformationFormatJpg

Equals "jpg"

View Source
const TransformationFormatMP4 = shared.TransformationFormatMP4

Equals "mp4"

View Source
const TransformationFormatOrig = shared.TransformationFormatOrig

Equals "orig"

View Source
const TransformationFormatPng = shared.TransformationFormatPng

Equals "png"

View Source
const TransformationFormatSvg = shared.TransformationFormatSvg

Equals "svg"

View Source
const TransformationFormatWebm = shared.TransformationFormatWebm

Equals "webm"

View Source
const TransformationFormatWebp = shared.TransformationFormatWebp

Equals "webp"

View Source
const TransformationPositionPath = shared.TransformationPositionPath

Equals "path"

View Source
const TransformationPositionQuery = shared.TransformationPositionQuery

Equals "query"

View Source
const TransformationVideoCodecAv1 = shared.TransformationVideoCodecAv1

Equals "av1"

View Source
const TransformationVideoCodecH264 = shared.TransformationVideoCodecH264

Equals "h264"

View Source
const TransformationVideoCodecNone = shared.TransformationVideoCodecNone

Equals "none"

View Source
const TransformationVideoCodecVp9 = shared.TransformationVideoCodecVp9

Equals "vp9"

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (IMAGEKIT_PRIVATE_KEY, OPTIONAL_IMAGEKIT_IGNORES_THIS, IMAGEKIT_WEBHOOK_SECRET, IMAGE_KIT_BASE_URL). This should be used to initialize new clients.

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func NewFile

func NewFile(rdr io.Reader, filename string, contentType string) file

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AccountOriginNewParams

type AccountOriginNewParams struct {
	// Schema for origin request resources.
	OriginRequest OriginRequestUnionParam
	// contains filtered or unexported fields
}

func (AccountOriginNewParams) MarshalJSON

func (r AccountOriginNewParams) MarshalJSON() (data []byte, err error)

func (*AccountOriginNewParams) UnmarshalJSON

func (r *AccountOriginNewParams) UnmarshalJSON(data []byte) error

type AccountOriginService

type AccountOriginService struct {
	Options []option.RequestOption
}

AccountOriginService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountOriginService method instead.

func NewAccountOriginService

func NewAccountOriginService(opts ...option.RequestOption) (r AccountOriginService)

NewAccountOriginService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountOriginService) Delete

func (r *AccountOriginService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

**Note:** This API is currently in beta. Permanently removes the origin identified by `id`. If the origin is in use by any URL‑endpoints, the API will return an error.

func (*AccountOriginService) Get

**Note:** This API is currently in beta. Retrieves the origin identified by `id`.

func (*AccountOriginService) List

**Note:** This API is currently in beta. Returns an array of all configured origins for the current account.

func (*AccountOriginService) New

**Note:** This API is currently in beta. Creates a new origin and returns the origin object.

func (*AccountOriginService) Update

**Note:** This API is currently in beta. Updates the origin identified by `id` and returns the updated origin object.

type AccountOriginUpdateParams

type AccountOriginUpdateParams struct {
	// Schema for origin request resources.
	OriginRequest OriginRequestUnionParam
	// contains filtered or unexported fields
}

func (AccountOriginUpdateParams) MarshalJSON

func (r AccountOriginUpdateParams) MarshalJSON() (data []byte, err error)

func (*AccountOriginUpdateParams) UnmarshalJSON

func (r *AccountOriginUpdateParams) UnmarshalJSON(data []byte) error

type AccountService

type AccountService struct {
	Options      []option.RequestOption
	Usage        AccountUsageService
	Origins      AccountOriginService
	URLEndpoints AccountURLEndpointService
}

AccountService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.

func NewAccountService

func NewAccountService(opts ...option.RequestOption) (r AccountService)

NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type AccountURLEndpointNewParams

type AccountURLEndpointNewParams struct {
	// Schema for URL endpoint resource.
	URLEndpointRequest URLEndpointRequestParam
	// contains filtered or unexported fields
}

func (AccountURLEndpointNewParams) MarshalJSON

func (r AccountURLEndpointNewParams) MarshalJSON() (data []byte, err error)

func (*AccountURLEndpointNewParams) UnmarshalJSON

func (r *AccountURLEndpointNewParams) UnmarshalJSON(data []byte) error

type AccountURLEndpointService

type AccountURLEndpointService struct {
	Options []option.RequestOption
}

AccountURLEndpointService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountURLEndpointService method instead.

func NewAccountURLEndpointService

func NewAccountURLEndpointService(opts ...option.RequestOption) (r AccountURLEndpointService)

NewAccountURLEndpointService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountURLEndpointService) Delete

func (r *AccountURLEndpointService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

**Note:** This API is currently in beta. Deletes the URL‑endpoint identified by `id`. You cannot delete the default URL‑endpoint created by ImageKit during account creation.

func (*AccountURLEndpointService) Get

**Note:** This API is currently in beta. Retrieves the URL‑endpoint identified by `id`.

func (*AccountURLEndpointService) List

**Note:** This API is currently in beta. Returns an array of all URL‑endpoints configured including the default URL-endpoint generated by ImageKit during account creation.

func (*AccountURLEndpointService) New

**Note:** This API is currently in beta. Creates a new URL‑endpoint and returns the resulting object.

func (*AccountURLEndpointService) Update

**Note:** This API is currently in beta. Updates the URL‑endpoint identified by `id` and returns the updated object.

type AccountURLEndpointUpdateParams

type AccountURLEndpointUpdateParams struct {
	// Schema for URL endpoint resource.
	URLEndpointRequest URLEndpointRequestParam
	// contains filtered or unexported fields
}

func (AccountURLEndpointUpdateParams) MarshalJSON

func (r AccountURLEndpointUpdateParams) MarshalJSON() (data []byte, err error)

func (*AccountURLEndpointUpdateParams) UnmarshalJSON

func (r *AccountURLEndpointUpdateParams) UnmarshalJSON(data []byte) error

type AccountUsageGetParams

type AccountUsageGetParams struct {
	// Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`.
	// The difference between `startDate` and `endDate` should be less than 90 days.
	EndDate time.Time `query:"endDate,required" format:"date" json:"-"`
	// Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`.
	// The difference between `startDate` and `endDate` should be less than 90 days.
	StartDate time.Time `query:"startDate,required" format:"date" json:"-"`
	// contains filtered or unexported fields
}

func (AccountUsageGetParams) URLQuery

func (r AccountUsageGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes AccountUsageGetParams's query parameters as `url.Values`.

type AccountUsageGetResponse

type AccountUsageGetResponse struct {
	// Amount of bandwidth used in bytes.
	BandwidthBytes int64 `json:"bandwidthBytes"`
	// Number of extension units used.
	ExtensionUnitsCount int64 `json:"extensionUnitsCount"`
	// Storage used by media library in bytes.
	MediaLibraryStorageBytes int64 `json:"mediaLibraryStorageBytes"`
	// Storage used by the original cache in bytes.
	OriginalCacheStorageBytes int64 `json:"originalCacheStorageBytes"`
	// Number of video processing units used.
	VideoProcessingUnitsCount int64 `json:"videoProcessingUnitsCount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BandwidthBytes            respjson.Field
		ExtensionUnitsCount       respjson.Field
		MediaLibraryStorageBytes  respjson.Field
		OriginalCacheStorageBytes respjson.Field
		VideoProcessingUnitsCount respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccountUsageGetResponse) RawJSON

func (r AccountUsageGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccountUsageGetResponse) UnmarshalJSON

func (r *AccountUsageGetResponse) UnmarshalJSON(data []byte) error

type AccountUsageService

type AccountUsageService struct {
	Options []option.RequestOption
}

AccountUsageService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountUsageService method instead.

func NewAccountUsageService

func NewAccountUsageService(opts ...option.RequestOption) (r AccountUsageService)

NewAccountUsageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountUsageService) Get

Get the account usage information between two dates. Note that the API response includes data from the start date while excluding data from the end date. In other words, the data covers the period starting from the specified start date up to, but not including, the end date.

type AssetListParams

type AssetListParams struct {
	// The maximum number of results to return in response.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Folder path if you want to limit the search within a specific folder. For
	// example, `/sales-banner/` will only search in folder sales-banner.
	//
	// Note : If your use case involves searching within a folder as well as its
	// subfolders, you can use `path` parameter in `searchQuery` with appropriate
	// operator. Checkout
	// [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters)
	// for more information.
	Path param.Opt[string] `query:"path,omitzero" json:"-"`
	// Query string in a Lucene-like query language e.g. `createdAt > "7d"`.
	//
	// Note : When the searchQuery parameter is present, the following query parameters
	// will have no effect on the result:
	//
	// 1. `tags`
	// 2. `type`
	// 3. `name`
	//
	// [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries)
	// from examples.
	SearchQuery param.Opt[string] `query:"searchQuery,omitzero" json:"-"`
	// The number of results to skip before returning results.
	Skip param.Opt[int64] `query:"skip,omitzero" json:"-"`
	// Filter results by file type.
	//
	// - `all` — include all file types
	// - `image` — include only image files
	// - `non-image` — include only non-image files (e.g., JS, CSS, video)
	//
	// Any of "all", "image", "non-image".
	FileType AssetListParamsFileType `query:"fileType,omitzero" json:"-"`
	// Sort the results by one of the supported fields in ascending or descending
	// order.
	//
	// Any of "ASC_NAME", "DESC_NAME", "ASC_CREATED", "DESC_CREATED", "ASC_UPDATED",
	// "DESC_UPDATED", "ASC_HEIGHT", "DESC_HEIGHT", "ASC_WIDTH", "DESC_WIDTH",
	// "ASC_SIZE", "DESC_SIZE", "ASC_RELEVANCE", "DESC_RELEVANCE".
	Sort AssetListParamsSort `query:"sort,omitzero" json:"-"`
	// Filter results by asset type.
	//
	// - `file` — returns only files
	// - `file-version` — returns specific file versions
	// - `folder` — returns only folders
	// - `all` — returns both files and folders (excludes `file-version`)
	//
	// Any of "file", "file-version", "folder", "all".
	Type AssetListParamsType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AssetListParams) URLQuery

func (r AssetListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AssetListParams's query parameters as `url.Values`.

type AssetListParamsFileType

type AssetListParamsFileType string

Filter results by file type.

- `all` — include all file types - `image` — include only image files - `non-image` — include only non-image files (e.g., JS, CSS, video)

const (
	AssetListParamsFileTypeAll      AssetListParamsFileType = "all"
	AssetListParamsFileTypeImage    AssetListParamsFileType = "image"
	AssetListParamsFileTypeNonImage AssetListParamsFileType = "non-image"
)

type AssetListParamsSort

type AssetListParamsSort string

Sort the results by one of the supported fields in ascending or descending order.

const (
	AssetListParamsSortAscName       AssetListParamsSort = "ASC_NAME"
	AssetListParamsSortDescName      AssetListParamsSort = "DESC_NAME"
	AssetListParamsSortAscCreated    AssetListParamsSort = "ASC_CREATED"
	AssetListParamsSortDescCreated   AssetListParamsSort = "DESC_CREATED"
	AssetListParamsSortAscUpdated    AssetListParamsSort = "ASC_UPDATED"
	AssetListParamsSortDescUpdated   AssetListParamsSort = "DESC_UPDATED"
	AssetListParamsSortAscHeight     AssetListParamsSort = "ASC_HEIGHT"
	AssetListParamsSortDescHeight    AssetListParamsSort = "DESC_HEIGHT"
	AssetListParamsSortAscWidth      AssetListParamsSort = "ASC_WIDTH"
	AssetListParamsSortDescWidth     AssetListParamsSort = "DESC_WIDTH"
	AssetListParamsSortAscSize       AssetListParamsSort = "ASC_SIZE"
	AssetListParamsSortDescSize      AssetListParamsSort = "DESC_SIZE"
	AssetListParamsSortAscRelevance  AssetListParamsSort = "ASC_RELEVANCE"
	AssetListParamsSortDescRelevance AssetListParamsSort = "DESC_RELEVANCE"
)

type AssetListParamsType

type AssetListParamsType string

Filter results by asset type.

- `file` — returns only files - `file-version` — returns specific file versions - `folder` — returns only folders - `all` — returns both files and folders (excludes `file-version`)

const (
	AssetListParamsTypeFile        AssetListParamsType = "file"
	AssetListParamsTypeFileVersion AssetListParamsType = "file-version"
	AssetListParamsTypeFolder      AssetListParamsType = "folder"
	AssetListParamsTypeAll         AssetListParamsType = "all"
)

type AssetListResponseUnion

type AssetListResponseUnion struct {
	// This field is from variant [File].
	AITags    []FileAITag `json:"AITags"`
	CreatedAt time.Time   `json:"createdAt"`
	// This field is from variant [File].
	CustomCoordinates string `json:"customCoordinates"`
	// This field is from variant [File].
	CustomMetadata map[string]any `json:"customMetadata"`
	// This field is from variant [File].
	Description string `json:"description"`
	// This field is from variant [File].
	FileID string `json:"fileId"`
	// This field is from variant [File].
	FilePath string `json:"filePath"`
	// This field is from variant [File].
	FileType string `json:"fileType"`
	// This field is from variant [File].
	HasAlpha bool `json:"hasAlpha"`
	// This field is from variant [File].
	Height float64 `json:"height"`
	// This field is from variant [File].
	IsPrivateFile bool `json:"isPrivateFile"`
	// This field is from variant [File].
	IsPublished bool `json:"isPublished"`
	// This field is from variant [File].
	Mime string `json:"mime"`
	Name string `json:"name"`
	// This field is from variant [File].
	SelectedFieldsSchema map[string]FileSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// This field is from variant [File].
	Size float64 `json:"size"`
	// This field is from variant [File].
	Tags []string `json:"tags"`
	// This field is from variant [File].
	Thumbnail string `json:"thumbnail"`
	// Any of nil, "folder".
	Type      string    `json:"type"`
	UpdatedAt time.Time `json:"updatedAt"`
	// This field is from variant [File].
	URL string `json:"url"`
	// This field is from variant [File].
	VersionInfo FileVersionInfo `json:"versionInfo"`
	// 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
		CreatedAt            respjson.Field
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		HasAlpha             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Mime                 respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		Thumbnail            respjson.Field
		Type                 respjson.Field
		UpdatedAt            respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		Width                respjson.Field
		FolderID             respjson.Field
		FolderPath           respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AssetListResponseUnion contains all possible properties and values from File, Folder.

Use the [AssetListResponseUnion.AsAny] method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AssetListResponseUnion) AsFileFileVersion

func (u AssetListResponseUnion) AsFileFileVersion() (v File)

func (AssetListResponseUnion) AsFolder

func (u AssetListResponseUnion) AsFolder() (v Folder)

func (AssetListResponseUnion) RawJSON

func (u AssetListResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssetListResponseUnion) UnmarshalJSON

func (r *AssetListResponseUnion) UnmarshalJSON(data []byte) error

type AssetService

type AssetService struct {
	Options []option.RequestOption
}

AssetService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetService method instead.

func NewAssetService

func NewAssetService(opts ...option.RequestOption) (r AssetService)

NewAssetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetService) List

func (r *AssetService) List(ctx context.Context, query AssetListParams, opts ...option.RequestOption) (res *[]AssetListResponseUnion, err error)

This API can list all the uploaded files and folders in your ImageKit.io media library. In addition, you can fine-tune your query by specifying various filters by generating a query string in a Lucene-like syntax and provide this generated string as the value of the `searchQuery`.

type BaseOverlayParam

type BaseOverlayParam = shared.BaseOverlayParam

This is an alias to an internal type.

type BaseWebhookEvent

type BaseWebhookEvent struct {
	// Unique identifier for the event.
	ID string `json:"id,required"`
	// The type of webhook event.
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BaseWebhookEvent) RawJSON

func (r BaseWebhookEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*BaseWebhookEvent) UnmarshalJSON

func (r *BaseWebhookEvent) UnmarshalJSON(data []byte) error

type BetaService

type BetaService struct {
	Options []option.RequestOption
	V2      BetaV2Service
}

BetaService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaService method instead.

func NewBetaService

func NewBetaService(opts ...option.RequestOption) (r BetaService)

NewBetaService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type BetaV2FileService

type BetaV2FileService struct {
	Options []option.RequestOption
}

BetaV2FileService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaV2FileService method instead.

func NewBetaV2FileService

func NewBetaV2FileService(opts ...option.RequestOption) (r BetaV2FileService)

NewBetaV2FileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BetaV2FileService) Upload

The V2 API enhances security by verifying the entire payload using JWT. This API is in beta.

ImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) about how to implement secure client-side file upload.

**File size limit** \ On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw files, and 100MB for videos. On the paid plan, these limits increase to 40MB for images, audio, and raw files, and 2GB for videos. These limits can be further increased with higher-tier plans.

**Version limit** \ A file can have a maximum of 100 versions.

**Demo applications**

  • A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.
  • [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.

type BetaV2FileUploadParams

type BetaV2FileUploadParams struct {
	// File is the upload payload. It MUST be a non-nil io.Reader (e.g., *os.File,
	// *bytes.Reader, *bytes.Buffer, *strings.Reader, or any stream).
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	// The name with which the file has to be uploaded.
	FileName string `json:"fileName,required"`
	// This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses
	// it to authenticate and check that the upload request parameters have not been
	// tampered with after the token has been generated. Learn how to create the token
	// on the page below. This field is only required for authentication when uploading
	// a file from the client side.
	//
	// **Note**: Sending a JWT that has been used in the past will result in a
	// validation error. Even if your previous request resulted in an error, you should
	// always send a new token.
	//
	// **⚠️Warning**: JWT must be generated on the server-side because it is generated
	// using your account's private API key. This field is required for authentication
	// when uploading a file from the client-side.
	Token param.Opt[string] `json:"token,omitzero"`
	// Server-side checks to run on the asset. Read more about
	// [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks).
	Checks param.Opt[string] `json:"checks,omitzero"`
	// Define an important area in the image. This is only relevant for image type
	// files.
	//
	//   - To be passed as a string with the x and y coordinates of the top-left corner,
	//     and width and height of the area of interest in the format `x,y,width,height`.
	//     For example - `10,10,100,100`
	//   - Can be used with fo-customtransformation.
	//   - If this field is not specified and the file is overwritten, then
	//     customCoordinates will be removed.
	CustomCoordinates param.Opt[string] `json:"customCoordinates,omitzero"`
	// Optional text to describe the contents of the file.
	Description param.Opt[string] `json:"description,omitzero"`
	// The folder path in which the image has to be uploaded. If the folder(s) didn't
	// exist before, a new folder(s) is created. Using multiple `/` creates a nested
	// folder.
	Folder param.Opt[string] `json:"folder,omitzero"`
	// Whether to mark the file as private or not.
	//
	// If `true`, the file is marked as private and is accessible only using named
	// transformation or signed URL.
	IsPrivateFile param.Opt[bool] `json:"isPrivateFile,omitzero"`
	// Whether to upload file as published or not.
	//
	// If `false`, the file is marked as unpublished, which restricts access to the
	// file only via the media library. Files in draft or unpublished state can only be
	// publicly accessed after being published.
	//
	// The option to upload in draft state is only available in custom enterprise
	// pricing plans.
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// If set to `true` and a file already exists at the exact location, its AITags
	// will be removed. Set `overwriteAITags` to `false` to preserve AITags.
	OverwriteAITags param.Opt[bool] `json:"overwriteAITags,omitzero"`
	// If the request does not have `customMetadata`, and a file already exists at the
	// exact location, existing customMetadata will be removed.
	OverwriteCustomMetadata param.Opt[bool] `json:"overwriteCustomMetadata,omitzero"`
	// If `false` and `useUniqueFileName` is also `false`, and a file already exists at
	// the exact location, upload API will return an error immediately.
	OverwriteFile param.Opt[bool] `json:"overwriteFile,omitzero"`
	// If the request does not have `tags`, and a file already exists at the exact
	// location, existing tags will be removed.
	OverwriteTags param.Opt[bool] `json:"overwriteTags,omitzero"`
	// Whether to use a unique filename for this file or not.
	//
	// If `true`, ImageKit.io will add a unique suffix to the filename parameter to get
	// a unique filename.
	//
	// If `false`, then the image is uploaded with the provided filename parameter, and
	// any existing file with the same name is replaced.
	UseUniqueFileName param.Opt[bool] `json:"useUniqueFileName,omitzero"`
	// The final status of extensions after they have completed execution will be
	// delivered to this endpoint as a POST request.
	// [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure)
	// about the webhook payload structure.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero" format:"uri"`
	// JSON key-value pairs to associate with the asset. Create the custom metadata
	// fields before setting these values.
	CustomMetadata map[string]any `json:"customMetadata,omitzero"`
	// Array of extensions to be applied to the asset. Each extension can be configured
	// with specific parameters based on the extension type.
	Extensions shared.ExtensionsParam `json:"extensions,omitzero"`
	// Array of response field keys to include in the API response body.
	//
	// Any of "tags", "customCoordinates", "isPrivateFile", "embeddedMetadata",
	// "isPublished", "customMetadata", "metadata", "selectedFieldsSchema".
	ResponseFields []string `json:"responseFields,omitzero"`
	// Set the tags while uploading the file. Provide an array of tag strings (e.g.
	// `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not
	// exceed 500, and the `%` character is not allowed. If this field is not specified
	// and the file is overwritten, the existing tags will be removed.
	Tags []string `json:"tags,omitzero"`
	// Configure pre-processing (`pre`) and post-processing (`post`) transformations.
	//
	//   - `pre` — applied before the file is uploaded to the Media Library.
	//     Useful for reducing file size or applying basic optimizations upfront (e.g.,
	//     resize, compress).
	//
	//   - `post` — applied immediately after upload.
	//     Ideal for generating transformed versions (like video encodes or thumbnails)
	//     in advance, so they're ready for delivery without delay.
	//
	// You can mix and match any combination of post-processing types.
	Transformation BetaV2FileUploadParamsTransformation `json:"transformation,omitzero"`
	// contains filtered or unexported fields
}

func (BetaV2FileUploadParams) MarshalMultipart

func (r BetaV2FileUploadParams) MarshalMultipart() (data []byte, contentType string, err error)

type BetaV2FileUploadParamsTransformation

type BetaV2FileUploadParamsTransformation struct {
	// Transformation string to apply before uploading the file to the Media Library.
	// Useful for optimizing files at ingestion.
	Pre param.Opt[string] `json:"pre,omitzero"`
	// List of transformations to apply _after_ the file is uploaded.
	// Each item must match one of the following types: `transformation`,
	// `gif-to-video`, `thumbnail`, `abs`.
	Post []BetaV2FileUploadParamsTransformationPostUnion `json:"post,omitzero"`
	// contains filtered or unexported fields
}

Configure pre-processing (`pre`) and post-processing (`post`) transformations.

  • `pre` — applied before the file is uploaded to the Media Library. Useful for reducing file size or applying basic optimizations upfront (e.g., resize, compress).

  • `post` — applied immediately after upload. Ideal for generating transformed versions (like video encodes or thumbnails) in advance, so they're ready for delivery without delay.

You can mix and match any combination of post-processing types.

func (BetaV2FileUploadParamsTransformation) MarshalJSON

func (r BetaV2FileUploadParamsTransformation) MarshalJSON() (data []byte, err error)

func (*BetaV2FileUploadParamsTransformation) UnmarshalJSON

func (r *BetaV2FileUploadParamsTransformation) UnmarshalJSON(data []byte) error

type BetaV2FileUploadParamsTransformationPostAbs

type BetaV2FileUploadParamsTransformationPostAbs struct {
	// Streaming protocol to use (`hls` or `dash`).
	//
	// Any of "hls", "dash".
	Protocol string `json:"protocol,omitzero,required"`
	// List of different representations you want to create separated by an underscore.
	Value string `json:"value,required"`
	// Adaptive Bitrate Streaming (ABS) setup.
	//
	// This field can be elided, and will marshal its zero value as "abs".
	Type constant.Abs `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Protocol, Type, Value are required.

func (BetaV2FileUploadParamsTransformationPostAbs) MarshalJSON

func (r BetaV2FileUploadParamsTransformationPostAbs) MarshalJSON() (data []byte, err error)

func (*BetaV2FileUploadParamsTransformationPostAbs) UnmarshalJSON

func (r *BetaV2FileUploadParamsTransformationPostAbs) UnmarshalJSON(data []byte) error

type BetaV2FileUploadParamsTransformationPostGifToVideo

type BetaV2FileUploadParamsTransformationPostGifToVideo struct {
	// Optional transformation string to apply to the output video.
	// **Example**: `q-80`
	Value param.Opt[string] `json:"value,omitzero"`
	// Converts an animated GIF into an MP4.
	//
	// This field can be elided, and will marshal its zero value as "gif-to-video".
	Type constant.GifToVideo `json:"type,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (BetaV2FileUploadParamsTransformationPostGifToVideo) MarshalJSON

func (r BetaV2FileUploadParamsTransformationPostGifToVideo) MarshalJSON() (data []byte, err error)

func (*BetaV2FileUploadParamsTransformationPostGifToVideo) UnmarshalJSON

type BetaV2FileUploadParamsTransformationPostThumbnail

type BetaV2FileUploadParamsTransformationPostThumbnail struct {
	// Optional transformation string.
	// **Example**: `w-150,h-150`
	Value param.Opt[string] `json:"value,omitzero"`
	// Generates a thumbnail image.
	//
	// This field can be elided, and will marshal its zero value as "thumbnail".
	Type constant.Thumbnail `json:"type,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (BetaV2FileUploadParamsTransformationPostThumbnail) MarshalJSON

func (r BetaV2FileUploadParamsTransformationPostThumbnail) MarshalJSON() (data []byte, err error)

func (*BetaV2FileUploadParamsTransformationPostThumbnail) UnmarshalJSON

type BetaV2FileUploadParamsTransformationPostTransformation

type BetaV2FileUploadParamsTransformationPostTransformation struct {
	// Transformation string (e.g. `w-200,h-200`).
	// Same syntax as ImageKit URL-based transformations.
	Value string `json:"value,required"`
	// Transformation type.
	//
	// This field can be elided, and will marshal its zero value as "transformation".
	Type constant.Transformation `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Type, Value are required.

func (BetaV2FileUploadParamsTransformationPostTransformation) MarshalJSON

func (*BetaV2FileUploadParamsTransformationPostTransformation) UnmarshalJSON

type BetaV2FileUploadParamsTransformationPostUnion

type BetaV2FileUploadParamsTransformationPostUnion struct {
	OfTransformation *BetaV2FileUploadParamsTransformationPostTransformation `json:",omitzero,inline"`
	OfGifToVideo     *BetaV2FileUploadParamsTransformationPostGifToVideo     `json:",omitzero,inline"`
	OfThumbnail      *BetaV2FileUploadParamsTransformationPostThumbnail      `json:",omitzero,inline"`
	OfAbs            *BetaV2FileUploadParamsTransformationPostAbs            `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (BetaV2FileUploadParamsTransformationPostUnion) GetProtocol

Returns a pointer to the underlying variant's property, if present.

func (BetaV2FileUploadParamsTransformationPostUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (BetaV2FileUploadParamsTransformationPostUnion) GetValue

Returns a pointer to the underlying variant's property, if present.

func (BetaV2FileUploadParamsTransformationPostUnion) MarshalJSON

func (*BetaV2FileUploadParamsTransformationPostUnion) UnmarshalJSON

func (u *BetaV2FileUploadParamsTransformationPostUnion) UnmarshalJSON(data []byte) error

type BetaV2FileUploadResponse

type BetaV2FileUploadResponse struct {
	// An array of tags assigned to the uploaded file by auto tagging.
	AITags []BetaV2FileUploadResponseAITag `json:"AITags,nullable"`
	// The audio codec used in the video (only for video).
	AudioCodec string `json:"audioCodec"`
	// The bit rate of the video in kbps (only for video).
	BitRate int64 `json:"bitRate"`
	// Value of custom coordinates associated with the image in the format
	// `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`.
	// Send `customCoordinates` in `responseFields` in API request to get the value of
	// this field.
	CustomCoordinates string `json:"customCoordinates,nullable"`
	// A key-value data associated with the asset. Use `responseField` in API request
	// to get `customMetadata` in the upload API response. Before setting any custom
	// metadata on an asset, you have to create the field using custom metadata fields
	// API. Send `customMetadata` in `responseFields` in API request to get the value
	// of this field.
	CustomMetadata map[string]any `json:"customMetadata"`
	// 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. Send `embeddedMetadata` in `responseFields` in API request to get
	// embeddedMetadata in the upload API response.
	EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
	// Extension names with their processing status at the time of completion of the
	// request. It could have one of the following status values:
	//
	// `success`: The extension has been successfully applied. `failed`: The extension
	// has failed and will not be retried. `pending`: The extension will finish
	// processing in some time. On completion, the final status (success / failed) will
	// be sent to the `webhookUrl` provided.
	//
	// If no extension was requested, then this parameter is not returned.
	ExtensionStatus BetaV2FileUploadResponseExtensionStatus `json:"extensionStatus"`
	// Unique fileId. Store this fileld in your database, as this will be used to
	// perform update action on this file.
	FileID string `json:"fileId"`
	// The relative path of the file in the media library e.g.
	// `/marketing-assets/new-banner.jpg`.
	FilePath string `json:"filePath"`
	// Type of the uploaded file. Possible values are `image`, `non-image`.
	FileType string `json:"fileType"`
	// Height of the image in pixels (Only for images)
	Height float64 `json:"height"`
	// Is the file marked as private. It can be either `true` or `false`. Send
	// `isPrivateFile` in `responseFields` in API request to get the value of this
	// field.
	IsPrivateFile bool `json:"isPrivateFile"`
	// Is the file published or in draft state. It can be either `true` or `false`.
	// Send `isPublished` in `responseFields` in API request to get the value of this
	// field.
	IsPublished bool `json:"isPublished"`
	// Legacy metadata. Send `metadata` in `responseFields` in API request to get
	// metadata in the upload API response.
	Metadata Metadata `json:"metadata"`
	// Name of the asset.
	Name string `json:"name"`
	// This field is included in the response only if the Path policy feature is
	// available in the plan. It contains schema definitions for the custom metadata
	// fields selected for the specified file path. Field selection can only be done
	// when the Path policy feature is enabled.
	//
	// Keys are the names of the custom metadata fields; the value object has details
	// about the custom metadata schema.
	SelectedFieldsSchema map[string]BetaV2FileUploadResponseSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// Size of the image file in Bytes.
	Size float64 `json:"size"`
	// The array of tags associated with the asset. If no tags are set, it will be
	// `null`. Send `tags` in `responseFields` in API request to get the value of this
	// field.
	Tags []string `json:"tags,nullable"`
	// In the case of an image, a small thumbnail URL.
	ThumbnailURL string `json:"thumbnailUrl"`
	// A publicly accessible URL of the file.
	URL string `json:"url"`
	// An object containing the file or file version's `id` (versionId) and `name`.
	VersionInfo BetaV2FileUploadResponseVersionInfo `json:"versionInfo"`
	// The video codec used in the video (only for video).
	VideoCodec string `json:"videoCodec"`
	// Width of the image in pixels (Only for Images)
	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
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		Duration             respjson.Field
		EmbeddedMetadata     respjson.Field
		ExtensionStatus      respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Metadata             respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		ThumbnailURL         respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		VideoCodec           respjson.Field
		Width                respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing details of a successful upload.

func (BetaV2FileUploadResponse) RawJSON

func (r BetaV2FileUploadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponse) UnmarshalJSON

func (r *BetaV2FileUploadResponse) UnmarshalJSON(data []byte) error

type BetaV2FileUploadResponseAITag

type BetaV2FileUploadResponseAITag struct {
	// Confidence score of the tag.
	Confidence float64 `json:"confidence"`
	// Name of the tag.
	Name string `json:"name"`
	// Array of `AITags` associated with the image. If no `AITags` are set, it will be
	// null. These tags can be added using the `google-auto-tagging` or
	// `aws-auto-tagging` extensions.
	Source string `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Confidence  respjson.Field
		Name        respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BetaV2FileUploadResponseAITag) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseAITag) UnmarshalJSON

func (r *BetaV2FileUploadResponseAITag) UnmarshalJSON(data []byte) error

type BetaV2FileUploadResponseExtensionStatus

type BetaV2FileUploadResponseExtensionStatus struct {
	// Any of "success", "pending", "failed".
	AIAutoDescription string `json:"ai-auto-description"`
	// Any of "success", "pending", "failed".
	AwsAutoTagging string `json:"aws-auto-tagging"`
	// Any of "success", "pending", "failed".
	GoogleAutoTagging string `json:"google-auto-tagging"`
	// Any of "success", "pending", "failed".
	RemoveBg string `json:"remove-bg"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AIAutoDescription respjson.Field
		AwsAutoTagging    respjson.Field
		GoogleAutoTagging respjson.Field
		RemoveBg          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Extension names with their processing status at the time of completion of the request. It could have one of the following status values:

`success`: The extension has been successfully applied. `failed`: The extension has failed and will not be retried. `pending`: The extension will finish processing in some time. On completion, the final status (success / failed) will be sent to the `webhookUrl` provided.

If no extension was requested, then this parameter is not returned.

func (BetaV2FileUploadResponseExtensionStatus) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseExtensionStatus) UnmarshalJSON

func (r *BetaV2FileUploadResponseExtensionStatus) UnmarshalJSON(data []byte) error

type BetaV2FileUploadResponseSelectedFieldsSchema

type BetaV2FileUploadResponseSelectedFieldsSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,required"`
	// The default value for this custom metadata field. The value should match the
	// `type` of custom metadata field.
	DefaultValue BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion `json:"defaultValue"`
	// Specifies if the custom metadata field is required or not.
	IsValueRequired bool `json:"isValueRequired"`
	// Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MaxLength float64 `json:"maxLength"`
	// Maximum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MaxValue BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion `json:"maxValue"`
	// Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MinLength float64 `json:"minLength"`
	// Minimum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MinValue BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion `json:"minValue"`
	// Indicates whether the custom metadata field is read only. A read only field
	// cannot be modified after being set. This field is configurable only via the
	// **Path policy** feature.
	ReadOnly bool `json:"readOnly"`
	// An array of allowed values when field type is `SingleSelect` or `MultiSelect`.
	SelectOptions []BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion `json:"selectOptions"`
	// Specifies if the selectOptions array is truncated. It is truncated when number
	// of options are > 100.
	SelectOptionsTruncated bool `json:"selectOptionsTruncated"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type                   respjson.Field
		DefaultValue           respjson.Field
		IsValueRequired        respjson.Field
		MaxLength              respjson.Field
		MaxValue               respjson.Field
		MinLength              respjson.Field
		MinValue               respjson.Field
		ReadOnly               respjson.Field
		SelectOptions          respjson.Field
		SelectOptionsTruncated respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BetaV2FileUploadResponseSelectedFieldsSchema) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchema) UnmarshalJSON

func (r *BetaV2FileUploadResponseSelectedFieldsSchema) UnmarshalJSON(data []byte) error

type BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion

type BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsBool

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsFloat

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsString

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion

type BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a
	// [[]BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion]
	// instead of an object.
	OfMixed []BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		OfMixed  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion contains all possible properties and values from [string], [float64], [bool], [[]BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfMixed]

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsBool

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsFloat

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsMixed

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsString

func (BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) UnmarshalJSON

type BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion

type BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion) AsFloat

func (BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion) AsString

func (BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchemaMaxValueUnion) UnmarshalJSON

type BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion

type BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion) AsFloat

func (BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion) AsString

func (BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchemaMinValueUnion) UnmarshalJSON

type BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion

type BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsBool

func (BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsFloat

func (BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsString

func (BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) UnmarshalJSON

type BetaV2FileUploadResponseVersionInfo

type BetaV2FileUploadResponseVersionInfo struct {
	// Unique identifier of the file version.
	ID string `json:"id"`
	// Name of the file version.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object containing the file or file version's `id` (versionId) and `name`.

func (BetaV2FileUploadResponseVersionInfo) RawJSON

Returns the unmodified JSON received from the API

func (*BetaV2FileUploadResponseVersionInfo) UnmarshalJSON

func (r *BetaV2FileUploadResponseVersionInfo) UnmarshalJSON(data []byte) error

type BetaV2Service

type BetaV2Service struct {
	Options []option.RequestOption
	Files   BetaV2FileService
}

BetaV2Service contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaV2Service method instead.

func NewBetaV2Service

func NewBetaV2Service(opts ...option.RequestOption) (r BetaV2Service)

NewBetaV2Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type CacheInvalidationGetResponse

type CacheInvalidationGetResponse struct {
	// Status of the purge request.
	//
	// Any of "Pending", "Completed".
	Status CacheInvalidationGetResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CacheInvalidationGetResponse) RawJSON

Returns the unmodified JSON received from the API

func (*CacheInvalidationGetResponse) UnmarshalJSON

func (r *CacheInvalidationGetResponse) UnmarshalJSON(data []byte) error

type CacheInvalidationGetResponseStatus

type CacheInvalidationGetResponseStatus string

Status of the purge request.

const (
	CacheInvalidationGetResponseStatusPending   CacheInvalidationGetResponseStatus = "Pending"
	CacheInvalidationGetResponseStatusCompleted CacheInvalidationGetResponseStatus = "Completed"
)

type CacheInvalidationNewParams

type CacheInvalidationNewParams struct {
	// The full URL of the file to be purged.
	URL string `json:"url,required" format:"uri"`
	// contains filtered or unexported fields
}

func (CacheInvalidationNewParams) MarshalJSON

func (r CacheInvalidationNewParams) MarshalJSON() (data []byte, err error)

func (*CacheInvalidationNewParams) UnmarshalJSON

func (r *CacheInvalidationNewParams) UnmarshalJSON(data []byte) error

type CacheInvalidationNewResponse

type CacheInvalidationNewResponse struct {
	// Unique identifier of the purge request. This can be used to check the status of
	// the purge request.
	RequestID string `json:"requestId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RequestID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CacheInvalidationNewResponse) RawJSON

Returns the unmodified JSON received from the API

func (*CacheInvalidationNewResponse) UnmarshalJSON

func (r *CacheInvalidationNewResponse) UnmarshalJSON(data []byte) error

type CacheInvalidationService

type CacheInvalidationService struct {
	Options []option.RequestOption
}

CacheInvalidationService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCacheInvalidationService method instead.

func NewCacheInvalidationService

func NewCacheInvalidationService(opts ...option.RequestOption) (r CacheInvalidationService)

NewCacheInvalidationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CacheInvalidationService) Get

This API returns the status of a purge cache request.

func (*CacheInvalidationService) New

This API will purge CDN cache and ImageKit.io's internal cache for a file. Note: Purge cache is an asynchronous process and it may take some time to reflect the changes.

type CacheService

type CacheService struct {
	Options      []option.RequestOption
	Invalidation CacheInvalidationService
}

CacheService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCacheService method instead.

func NewCacheService

func NewCacheService(opts ...option.RequestOption) (r CacheService)

NewCacheService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type Client

type Client struct {
	Options              []option.RequestOption
	Dummy                DummyService
	CustomMetadataFields CustomMetadataFieldService
	Files                FileService
	Assets               AssetService
	Cache                CacheService
	Folders              FolderService
	Accounts             AccountService
	Beta                 BetaService
	Webhooks             WebhookService
	Helper               lib.HelperService
}

Client creates a struct with services and top level methods that help with interacting with the ImageKit API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (IMAGEKIT_PRIVATE_KEY, OPTIONAL_IMAGEKIT_IGNORES_THIS, IMAGEKIT_WEBHOOK_SECRET, IMAGE_KIT_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CustomMetadataField

type CustomMetadataField struct {
	// Unique identifier for the custom metadata field. Use this to update the field.
	ID string `json:"id,required"`
	// Human readable name of the custom metadata field. This name is displayed as form
	// field label to the users while setting field value on the asset in the media
	// library UI.
	Label string `json:"label,required"`
	// API name of the custom metadata field. This becomes the key while setting
	// `customMetadata` (key-value object) for an asset using upload or update API.
	Name string `json:"name,required"`
	// An object that describes the rules for the custom metadata field value.
	Schema CustomMetadataFieldSchema `json:"schema,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Label       respjson.Field
		Name        respjson.Field
		Schema      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing details of a custom metadata field.

func (CustomMetadataField) RawJSON

func (r CustomMetadataField) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomMetadataField) UnmarshalJSON

func (r *CustomMetadataField) UnmarshalJSON(data []byte) error

type CustomMetadataFieldDeleteResponse

type CustomMetadataFieldDeleteResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomMetadataFieldDeleteResponse) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldDeleteResponse) UnmarshalJSON

func (r *CustomMetadataFieldDeleteResponse) UnmarshalJSON(data []byte) error

type CustomMetadataFieldListParams

type CustomMetadataFieldListParams struct {
	// The folder path (e.g., `/path/to/folder`) for which to retrieve applicable
	// custom metadata fields. Useful for determining path-specific field selections
	// when the [Path policy](https://imagekit.io/docs/dam/path-policy) feature is in
	// use.
	FolderPath param.Opt[string] `query:"folderPath,omitzero" json:"-"`
	// Set it to `true` to include deleted field objects in the API response.
	IncludeDeleted param.Opt[bool] `query:"includeDeleted,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CustomMetadataFieldListParams) URLQuery

func (r CustomMetadataFieldListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CustomMetadataFieldListParams's query parameters as `url.Values`.

type CustomMetadataFieldNewParams

type CustomMetadataFieldNewParams struct {
	// Human readable name of the custom metadata field. This should be unique across
	// all non deleted custom metadata fields. This name is displayed as form field
	// label to the users while setting field value on an asset in the media library
	// UI.
	Label string `json:"label,required"`
	// API name of the custom metadata field. This should be unique across all
	// (including deleted) custom metadata fields.
	Name   string                             `json:"name,required"`
	Schema CustomMetadataFieldNewParamsSchema `json:"schema,omitzero,required"`
	// contains filtered or unexported fields
}

func (CustomMetadataFieldNewParams) MarshalJSON

func (r CustomMetadataFieldNewParams) MarshalJSON() (data []byte, err error)

func (*CustomMetadataFieldNewParams) UnmarshalJSON

func (r *CustomMetadataFieldNewParams) UnmarshalJSON(data []byte) error

type CustomMetadataFieldNewParamsSchema

type CustomMetadataFieldNewParamsSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,omitzero,required"`
	// Sets this custom metadata field as required. Setting custom metadata fields on
	// an asset will throw error if the value for all required fields are not present
	// in upload or update asset API request body.
	IsValueRequired param.Opt[bool] `json:"isValueRequired,omitzero"`
	// Maximum length of string. Only set this property if `type` is set to `Text` or
	// `Textarea`.
	MaxLength param.Opt[float64] `json:"maxLength,omitzero"`
	// Minimum length of string. Only set this property if `type` is set to `Text` or
	// `Textarea`.
	MinLength param.Opt[float64] `json:"minLength,omitzero"`
	// The default value for this custom metadata field. This property is only required
	// if `isValueRequired` property is set to `true`. The value should match the
	// `type` of custom metadata field.
	DefaultValue CustomMetadataFieldNewParamsSchemaDefaultValueUnion `json:"defaultValue,omitzero"`
	// Maximum value of the field. Only set this property if field type is `Date` or
	// `Number`. For `Date` type field, set the minimum date in ISO8601 string format.
	// For `Number` type field, set the minimum numeric value.
	MaxValue CustomMetadataFieldNewParamsSchemaMaxValueUnion `json:"maxValue,omitzero"`
	// Minimum value of the field. Only set this property if field type is `Date` or
	// `Number`. For `Date` type field, set the minimum date in ISO8601 string format.
	// For `Number` type field, set the minimum numeric value.
	MinValue CustomMetadataFieldNewParamsSchemaMinValueUnion `json:"minValue,omitzero"`
	// An array of allowed values. This property is only required if `type` property is
	// set to `SingleSelect` or `MultiSelect`.
	SelectOptions []CustomMetadataFieldNewParamsSchemaSelectOptionUnion `json:"selectOptions,omitzero"`
	// contains filtered or unexported fields
}

The property Type is required.

func (CustomMetadataFieldNewParamsSchema) MarshalJSON

func (r CustomMetadataFieldNewParamsSchema) MarshalJSON() (data []byte, err error)

func (*CustomMetadataFieldNewParamsSchema) UnmarshalJSON

func (r *CustomMetadataFieldNewParamsSchema) UnmarshalJSON(data []byte) error

type CustomMetadataFieldNewParamsSchemaDefaultValueMixedItemUnion

type CustomMetadataFieldNewParamsSchemaDefaultValueMixedItemUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldNewParamsSchemaDefaultValueMixedItemUnion) MarshalJSON

func (*CustomMetadataFieldNewParamsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type CustomMetadataFieldNewParamsSchemaDefaultValueUnion

type CustomMetadataFieldNewParamsSchemaDefaultValueUnion struct {
	OfString param.Opt[string]                                              `json:",omitzero,inline"`
	OfFloat  param.Opt[float64]                                             `json:",omitzero,inline"`
	OfBool   param.Opt[bool]                                                `json:",omitzero,inline"`
	OfMixed  []CustomMetadataFieldNewParamsSchemaDefaultValueMixedItemUnion `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldNewParamsSchemaDefaultValueUnion) MarshalJSON

func (*CustomMetadataFieldNewParamsSchemaDefaultValueUnion) UnmarshalJSON

type CustomMetadataFieldNewParamsSchemaMaxValueUnion

type CustomMetadataFieldNewParamsSchemaMaxValueUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldNewParamsSchemaMaxValueUnion) MarshalJSON

func (*CustomMetadataFieldNewParamsSchemaMaxValueUnion) UnmarshalJSON

type CustomMetadataFieldNewParamsSchemaMinValueUnion

type CustomMetadataFieldNewParamsSchemaMinValueUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldNewParamsSchemaMinValueUnion) MarshalJSON

func (*CustomMetadataFieldNewParamsSchemaMinValueUnion) UnmarshalJSON

type CustomMetadataFieldNewParamsSchemaSelectOptionUnion

type CustomMetadataFieldNewParamsSchemaSelectOptionUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldNewParamsSchemaSelectOptionUnion) MarshalJSON

func (*CustomMetadataFieldNewParamsSchemaSelectOptionUnion) UnmarshalJSON

type CustomMetadataFieldSchema

type CustomMetadataFieldSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,required"`
	// The default value for this custom metadata field. Data type of default value
	// depends on the field type.
	DefaultValue CustomMetadataFieldSchemaDefaultValueUnion `json:"defaultValue"`
	// Specifies if the this custom metadata field is required or not.
	IsValueRequired bool `json:"isValueRequired"`
	// Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MaxLength float64 `json:"maxLength"`
	// Maximum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MaxValue CustomMetadataFieldSchemaMaxValueUnion `json:"maxValue"`
	// Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MinLength float64 `json:"minLength"`
	// Minimum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MinValue CustomMetadataFieldSchemaMinValueUnion `json:"minValue"`
	// An array of allowed values when field type is `SingleSelect` or `MultiSelect`.
	SelectOptions []CustomMetadataFieldSchemaSelectOptionUnion `json:"selectOptions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type            respjson.Field
		DefaultValue    respjson.Field
		IsValueRequired respjson.Field
		MaxLength       respjson.Field
		MaxValue        respjson.Field
		MinLength       respjson.Field
		MinValue        respjson.Field
		SelectOptions   respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object that describes the rules for the custom metadata field value.

func (CustomMetadataFieldSchema) RawJSON

func (r CustomMetadataFieldSchema) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchema) UnmarshalJSON

func (r *CustomMetadataFieldSchema) UnmarshalJSON(data []byte) error

type CustomMetadataFieldSchemaDefaultValueMixedItemUnion

type CustomMetadataFieldSchemaDefaultValueMixedItemUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

CustomMetadataFieldSchemaDefaultValueMixedItemUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (CustomMetadataFieldSchemaDefaultValueMixedItemUnion) AsBool

func (CustomMetadataFieldSchemaDefaultValueMixedItemUnion) AsFloat

func (CustomMetadataFieldSchemaDefaultValueMixedItemUnion) AsString

func (CustomMetadataFieldSchemaDefaultValueMixedItemUnion) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type CustomMetadataFieldSchemaDefaultValueUnion

type CustomMetadataFieldSchemaDefaultValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a
	// [[]CustomMetadataFieldSchemaDefaultValueMixedItemUnion] instead of an object.
	OfMixed []CustomMetadataFieldSchemaDefaultValueMixedItemUnion `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		OfMixed  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

CustomMetadataFieldSchemaDefaultValueUnion contains all possible properties and values from [string], [float64], [bool], [[]CustomMetadataFieldSchemaDefaultValueMixedItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfMixed]

func (CustomMetadataFieldSchemaDefaultValueUnion) AsBool

func (CustomMetadataFieldSchemaDefaultValueUnion) AsFloat

func (CustomMetadataFieldSchemaDefaultValueUnion) AsMixed

func (CustomMetadataFieldSchemaDefaultValueUnion) AsString

func (CustomMetadataFieldSchemaDefaultValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchemaDefaultValueUnion) UnmarshalJSON

func (r *CustomMetadataFieldSchemaDefaultValueUnion) UnmarshalJSON(data []byte) error

type CustomMetadataFieldSchemaMaxValueUnion

type CustomMetadataFieldSchemaMaxValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

CustomMetadataFieldSchemaMaxValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (CustomMetadataFieldSchemaMaxValueUnion) AsFloat

func (CustomMetadataFieldSchemaMaxValueUnion) AsString

func (CustomMetadataFieldSchemaMaxValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchemaMaxValueUnion) UnmarshalJSON

func (r *CustomMetadataFieldSchemaMaxValueUnion) UnmarshalJSON(data []byte) error

type CustomMetadataFieldSchemaMinValueUnion

type CustomMetadataFieldSchemaMinValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

CustomMetadataFieldSchemaMinValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (CustomMetadataFieldSchemaMinValueUnion) AsFloat

func (CustomMetadataFieldSchemaMinValueUnion) AsString

func (CustomMetadataFieldSchemaMinValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchemaMinValueUnion) UnmarshalJSON

func (r *CustomMetadataFieldSchemaMinValueUnion) UnmarshalJSON(data []byte) error

type CustomMetadataFieldSchemaSelectOptionUnion

type CustomMetadataFieldSchemaSelectOptionUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

CustomMetadataFieldSchemaSelectOptionUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (CustomMetadataFieldSchemaSelectOptionUnion) AsBool

func (CustomMetadataFieldSchemaSelectOptionUnion) AsFloat

func (CustomMetadataFieldSchemaSelectOptionUnion) AsString

func (CustomMetadataFieldSchemaSelectOptionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*CustomMetadataFieldSchemaSelectOptionUnion) UnmarshalJSON

func (r *CustomMetadataFieldSchemaSelectOptionUnion) UnmarshalJSON(data []byte) error

type CustomMetadataFieldService

type CustomMetadataFieldService struct {
	Options []option.RequestOption
}

CustomMetadataFieldService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomMetadataFieldService method instead.

func NewCustomMetadataFieldService

func NewCustomMetadataFieldService(opts ...option.RequestOption) (r CustomMetadataFieldService)

NewCustomMetadataFieldService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomMetadataFieldService) Delete

This API deletes a custom metadata field. Even after deleting a custom metadata field, you cannot create any new custom metadata field with the same name.

func (*CustomMetadataFieldService) List

This API returns the array of created custom metadata field objects. By default the API returns only non deleted field objects, but you can include deleted fields in the API response.

You can also filter results by a specific folder path to retrieve custom metadata fields applicable at that location. This path-specific filtering is useful when using the **Path policy** feature to determine which custom metadata fields are selected for a given path.

func (*CustomMetadataFieldService) New

This API creates a new custom metadata field. Once a custom metadata field is created either through this API or using the dashboard UI, its value can be set on the assets. The value of a field for an asset can be set using the media library UI or programmatically through upload or update assets API.

func (*CustomMetadataFieldService) Update

This API updates the label or schema of an existing custom metadata field.

type CustomMetadataFieldUpdateParams

type CustomMetadataFieldUpdateParams struct {
	// Human readable name of the custom metadata field. This should be unique across
	// all non deleted custom metadata fields. This name is displayed as form field
	// label to the users while setting field value on an asset in the media library
	// UI. This parameter is required if `schema` is not provided.
	Label param.Opt[string] `json:"label,omitzero"`
	// An object that describes the rules for the custom metadata key. This parameter
	// is required if `label` is not provided. Note: `type` cannot be updated and will
	// be ignored if sent with the `schema`. The schema will be validated as per the
	// existing `type`.
	Schema CustomMetadataFieldUpdateParamsSchema `json:"schema,omitzero"`
	// contains filtered or unexported fields
}

func (CustomMetadataFieldUpdateParams) MarshalJSON

func (r CustomMetadataFieldUpdateParams) MarshalJSON() (data []byte, err error)

func (*CustomMetadataFieldUpdateParams) UnmarshalJSON

func (r *CustomMetadataFieldUpdateParams) UnmarshalJSON(data []byte) error

type CustomMetadataFieldUpdateParamsSchema

type CustomMetadataFieldUpdateParamsSchema struct {
	// Sets this custom metadata field as required. Setting custom metadata fields on
	// an asset will throw error if the value for all required fields are not present
	// in upload or update asset API request body.
	IsValueRequired param.Opt[bool] `json:"isValueRequired,omitzero"`
	// Maximum length of string. Only set this property if `type` is set to `Text` or
	// `Textarea`.
	MaxLength param.Opt[float64] `json:"maxLength,omitzero"`
	// Minimum length of string. Only set this property if `type` is set to `Text` or
	// `Textarea`.
	MinLength param.Opt[float64] `json:"minLength,omitzero"`
	// The default value for this custom metadata field. This property is only required
	// if `isValueRequired` property is set to `true`. The value should match the
	// `type` of custom metadata field.
	DefaultValue CustomMetadataFieldUpdateParamsSchemaDefaultValueUnion `json:"defaultValue,omitzero"`
	// Maximum value of the field. Only set this property if field type is `Date` or
	// `Number`. For `Date` type field, set the minimum date in ISO8601 string format.
	// For `Number` type field, set the minimum numeric value.
	MaxValue CustomMetadataFieldUpdateParamsSchemaMaxValueUnion `json:"maxValue,omitzero"`
	// Minimum value of the field. Only set this property if field type is `Date` or
	// `Number`. For `Date` type field, set the minimum date in ISO8601 string format.
	// For `Number` type field, set the minimum numeric value.
	MinValue CustomMetadataFieldUpdateParamsSchemaMinValueUnion `json:"minValue,omitzero"`
	// An array of allowed values. This property is only required if `type` property is
	// set to `SingleSelect` or `MultiSelect`.
	SelectOptions []CustomMetadataFieldUpdateParamsSchemaSelectOptionUnion `json:"selectOptions,omitzero"`
	// contains filtered or unexported fields
}

An object that describes the rules for the custom metadata key. This parameter is required if `label` is not provided. Note: `type` cannot be updated and will be ignored if sent with the `schema`. The schema will be validated as per the existing `type`.

func (CustomMetadataFieldUpdateParamsSchema) MarshalJSON

func (r CustomMetadataFieldUpdateParamsSchema) MarshalJSON() (data []byte, err error)

func (*CustomMetadataFieldUpdateParamsSchema) UnmarshalJSON

func (r *CustomMetadataFieldUpdateParamsSchema) UnmarshalJSON(data []byte) error

type CustomMetadataFieldUpdateParamsSchemaDefaultValueMixedItemUnion

type CustomMetadataFieldUpdateParamsSchemaDefaultValueMixedItemUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldUpdateParamsSchemaDefaultValueMixedItemUnion) MarshalJSON

func (*CustomMetadataFieldUpdateParamsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type CustomMetadataFieldUpdateParamsSchemaDefaultValueUnion

type CustomMetadataFieldUpdateParamsSchemaDefaultValueUnion struct {
	OfString param.Opt[string]                                                 `json:",omitzero,inline"`
	OfFloat  param.Opt[float64]                                                `json:",omitzero,inline"`
	OfBool   param.Opt[bool]                                                   `json:",omitzero,inline"`
	OfMixed  []CustomMetadataFieldUpdateParamsSchemaDefaultValueMixedItemUnion `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldUpdateParamsSchemaDefaultValueUnion) MarshalJSON

func (*CustomMetadataFieldUpdateParamsSchemaDefaultValueUnion) UnmarshalJSON

type CustomMetadataFieldUpdateParamsSchemaMaxValueUnion

type CustomMetadataFieldUpdateParamsSchemaMaxValueUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldUpdateParamsSchemaMaxValueUnion) MarshalJSON

func (*CustomMetadataFieldUpdateParamsSchemaMaxValueUnion) UnmarshalJSON

type CustomMetadataFieldUpdateParamsSchemaMinValueUnion

type CustomMetadataFieldUpdateParamsSchemaMinValueUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldUpdateParamsSchemaMinValueUnion) MarshalJSON

func (*CustomMetadataFieldUpdateParamsSchemaMinValueUnion) UnmarshalJSON

type CustomMetadataFieldUpdateParamsSchemaSelectOptionUnion

type CustomMetadataFieldUpdateParamsSchemaSelectOptionUnion struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (CustomMetadataFieldUpdateParamsSchemaSelectOptionUnion) MarshalJSON

func (*CustomMetadataFieldUpdateParamsSchemaSelectOptionUnion) UnmarshalJSON

type DummyNewParams

type DummyNewParams struct {
	BaseOverlay shared.BaseOverlayParam `json:"baseOverlay,omitzero"`
	// Array of extensions to be applied to the asset. Each extension can be configured
	// with specific parameters based on the extension type.
	Extensions   shared.ExtensionsParam   `json:"extensions,omitzero"`
	ImageOverlay shared.ImageOverlayParam `json:"imageOverlay,omitzero"`
	// Specifies an overlay to be applied on the parent image or video. ImageKit
	// supports overlays including images, text, videos, subtitles, and solid colors.
	// See
	// [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers).
	Overlay                         shared.OverlayUnionParam                    `json:"overlay,omitzero"`
	OverlayPosition                 shared.OverlayPositionParam                 `json:"overlayPosition,omitzero"`
	OverlayTiming                   shared.OverlayTimingParam                   `json:"overlayTiming,omitzero"`
	SolidColorOverlay               shared.SolidColorOverlayParam               `json:"solidColorOverlay,omitzero"`
	SolidColorOverlayTransformation shared.SolidColorOverlayTransformationParam `json:"solidColorOverlayTransformation,omitzero"`
	// Options for generating ImageKit URLs with transformations. See the
	// [Transformations guide](https://imagekit.io/docs/transformations).
	SrcOptions shared.SrcOptionsParam `json:"srcOptions,omitzero"`
	// Available streaming resolutions for
	// [adaptive bitrate streaming](https://imagekit.io/docs/adaptive-bitrate-streaming)
	//
	// Any of "240", "360", "480", "720", "1080", "1440", "2160".
	StreamingResolution shared.StreamingResolution  `json:"streamingResolution,omitzero"`
	SubtitleOverlay     shared.SubtitleOverlayParam `json:"subtitleOverlay,omitzero"`
	// Subtitle styling options.
	// [Learn more](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer)
	// from the docs.
	SubtitleOverlayTransformation shared.SubtitleOverlayTransformationParam `json:"subtitleOverlayTransformation,omitzero"`
	TextOverlay                   shared.TextOverlayParam                   `json:"textOverlay,omitzero"`
	TextOverlayTransformation     shared.TextOverlayTransformationParam     `json:"textOverlayTransformation,omitzero"`
	// The SDK provides easy-to-use names for transformations. These names are
	// converted to the corresponding transformation string before being added to the
	// URL. SDKs are updated regularly to support new transformations. If you want to
	// use a transformation that is not supported by the SDK, You can use the `raw`
	// parameter to pass the transformation string directly. See the
	// [Transformations documentation](https://imagekit.io/docs/transformations).
	Transformation shared.TransformationParam `json:"transformation,omitzero"`
	// By default, the transformation string is added as a query parameter in the URL,
	// e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the
	// path of the URL, set this to `path`. Learn more in the
	// [Transformations guide](https://imagekit.io/docs/transformations).
	//
	// Any of "path", "query".
	TransformationPosition shared.TransformationPosition `json:"transformationPosition,omitzero"`
	VideoOverlay           shared.VideoOverlayParam      `json:"videoOverlay,omitzero"`
	// contains filtered or unexported fields
}

func (DummyNewParams) MarshalJSON

func (r DummyNewParams) MarshalJSON() (data []byte, err error)

func (*DummyNewParams) UnmarshalJSON

func (r *DummyNewParams) UnmarshalJSON(data []byte) error

type DummyService

type DummyService struct {
	Options []option.RequestOption
}

DummyService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDummyService method instead.

func NewDummyService

func NewDummyService(opts ...option.RequestOption) (r DummyService)

NewDummyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DummyService) New

func (r *DummyService) New(ctx context.Context, body DummyNewParams, opts ...option.RequestOption) (err error)

Internal test endpoint for SDK generation purposes only. This endpoint demonstrates usage of all shared models defined in the Stainless configuration and is not intended for public consumption.

type Error

type Error = apierror.Error

type ExtensionAIAutoDescriptionParam

type ExtensionAIAutoDescriptionParam = shared.ExtensionAIAutoDescriptionParam

This is an alias to an internal type.

type ExtensionAutoTaggingParam

type ExtensionAutoTaggingParam = shared.ExtensionAutoTaggingParam

This is an alias to an internal type.

type ExtensionRemoveBgOptionsParam

type ExtensionRemoveBgOptionsParam = shared.ExtensionRemoveBgOptionsParam

This is an alias to an internal type.

type ExtensionRemoveBgParam

type ExtensionRemoveBgParam = shared.ExtensionRemoveBgParam

This is an alias to an internal type.

type ExtensionUnionParam

type ExtensionUnionParam = shared.ExtensionUnionParam

This is an alias to an internal type.

type ExtensionsParam

type ExtensionsParam = shared.ExtensionsParam

Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type.

This is an alias to an internal type.

type File

type File struct {
	// An array of tags assigned to the file by auto tagging.
	AITags []FileAITag `json:"AITags,nullable"`
	// Date and time when the file was uploaded. The date and time is in ISO8601
	// format.
	CreatedAt time.Time `json:"createdAt" format:"date-time"`
	// An string with custom coordinates of the file.
	CustomCoordinates string `json:"customCoordinates,nullable"`
	// An object with custom metadata for the file.
	CustomMetadata map[string]any `json:"customMetadata"`
	// 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"`
	// 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.
	// For example, if the file is at the root of the media library, the path will be
	// `/file.jpg`. If the file is inside a folder named `images`, the path will be
	// `/images/file.jpg`.
	FilePath string `json:"filePath"`
	// Type of the file. Possible values are `image`, `non-image`.
	FileType string `json:"fileType"`
	// Specifies if the image has an alpha channel.
	HasAlpha bool `json:"hasAlpha"`
	// Height of the file.
	Height float64 `json:"height"`
	// Specifies if the file is private or not.
	IsPrivateFile bool `json:"isPrivateFile"`
	// Specifies if the file is published or not.
	IsPublished bool `json:"isPublished"`
	// MIME type of the file.
	Mime string `json:"mime"`
	// Name of the asset.
	Name string `json:"name"`
	// This field is included in the response only if the Path policy feature is
	// available in the plan. It contains schema definitions for the custom metadata
	// fields selected for the specified file path. Field selection can only be done
	// when the Path policy feature is enabled.
	//
	// Keys are the names of the custom metadata fields; the value object has details
	// about the custom metadata schema.
	SelectedFieldsSchema map[string]FileSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// Size of the file in bytes.
	Size float64 `json:"size"`
	// An array of tags assigned to the file. Tags are used to search files in the
	// media library.
	Tags []string `json:"tags,nullable"`
	// URL of the thumbnail image. This URL is used to access the thumbnail image of
	// the file in the media library.
	Thumbnail string `json:"thumbnail" format:"uri"`
	// Type of the asset.
	//
	// Any of "file", "file-version".
	Type FileType `json:"type"`
	// Date and time when the file was last updated. The date and time is in ISO8601
	// format.
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// URL of the file.
	URL string `json:"url" format:"uri"`
	// An object with details of the file version.
	VersionInfo FileVersionInfo `json:"versionInfo"`
	// Width of the file.
	Width float64 `json:"width"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AITags               respjson.Field
		CreatedAt            respjson.Field
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		HasAlpha             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Mime                 respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		Thumbnail            respjson.Field
		Type                 respjson.Field
		UpdatedAt            respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		Width                respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing details of a file or file version.

func (File) RawJSON

func (r File) RawJSON() string

Returns the unmodified JSON received from the API

func (*File) UnmarshalJSON

func (r *File) UnmarshalJSON(data []byte) error

type FileAITag

type FileAITag struct {
	// Confidence score of the tag.
	Confidence float64 `json:"confidence"`
	// Name of the tag.
	Name string `json:"name"`
	// Source of the tag. Possible values are `google-auto-tagging` and
	// `aws-auto-tagging`.
	Source string `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Confidence  respjson.Field
		Name        respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileAITag) RawJSON

func (r FileAITag) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileAITag) UnmarshalJSON

func (r *FileAITag) UnmarshalJSON(data []byte) error

type FileBulkAddTagsParams

type FileBulkAddTagsParams struct {
	// An array of fileIds to which you want to add tags.
	FileIDs []string `json:"fileIds,omitzero,required"`
	// An array of tags that you want to add to the files.
	Tags []string `json:"tags,omitzero,required"`
	// contains filtered or unexported fields
}

func (FileBulkAddTagsParams) MarshalJSON

func (r FileBulkAddTagsParams) MarshalJSON() (data []byte, err error)

func (*FileBulkAddTagsParams) UnmarshalJSON

func (r *FileBulkAddTagsParams) UnmarshalJSON(data []byte) error

type FileBulkAddTagsResponse

type FileBulkAddTagsResponse struct {
	// An array of fileIds that in which tags were successfully added.
	SuccessfullyUpdatedFileIDs []string `json:"successfullyUpdatedFileIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SuccessfullyUpdatedFileIDs respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileBulkAddTagsResponse) RawJSON

func (r FileBulkAddTagsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileBulkAddTagsResponse) UnmarshalJSON

func (r *FileBulkAddTagsResponse) UnmarshalJSON(data []byte) error

type FileBulkDeleteParams

type FileBulkDeleteParams struct {
	// An array of fileIds which you want to delete.
	FileIDs []string `json:"fileIds,omitzero,required"`
	// contains filtered or unexported fields
}

func (FileBulkDeleteParams) MarshalJSON

func (r FileBulkDeleteParams) MarshalJSON() (data []byte, err error)

func (*FileBulkDeleteParams) UnmarshalJSON

func (r *FileBulkDeleteParams) UnmarshalJSON(data []byte) error

type FileBulkDeleteResponse

type FileBulkDeleteResponse struct {
	// An array of fileIds that were successfully deleted.
	SuccessfullyDeletedFileIDs []string `json:"successfullyDeletedFileIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SuccessfullyDeletedFileIDs respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileBulkDeleteResponse) RawJSON

func (r FileBulkDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileBulkDeleteResponse) UnmarshalJSON

func (r *FileBulkDeleteResponse) UnmarshalJSON(data []byte) error

type FileBulkRemoveAITagsParams

type FileBulkRemoveAITagsParams struct {
	// An array of AITags that you want to remove from the files.
	AITags []string `json:"AITags,omitzero,required"`
	// An array of fileIds from which you want to remove AITags.
	FileIDs []string `json:"fileIds,omitzero,required"`
	// contains filtered or unexported fields
}

func (FileBulkRemoveAITagsParams) MarshalJSON

func (r FileBulkRemoveAITagsParams) MarshalJSON() (data []byte, err error)

func (*FileBulkRemoveAITagsParams) UnmarshalJSON

func (r *FileBulkRemoveAITagsParams) UnmarshalJSON(data []byte) error

type FileBulkRemoveAITagsResponse

type FileBulkRemoveAITagsResponse struct {
	// An array of fileIds that in which AITags were successfully removed.
	SuccessfullyUpdatedFileIDs []string `json:"successfullyUpdatedFileIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SuccessfullyUpdatedFileIDs respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileBulkRemoveAITagsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*FileBulkRemoveAITagsResponse) UnmarshalJSON

func (r *FileBulkRemoveAITagsResponse) UnmarshalJSON(data []byte) error

type FileBulkRemoveTagsParams

type FileBulkRemoveTagsParams struct {
	// An array of fileIds from which you want to remove tags.
	FileIDs []string `json:"fileIds,omitzero,required"`
	// An array of tags that you want to remove from the files.
	Tags []string `json:"tags,omitzero,required"`
	// contains filtered or unexported fields
}

func (FileBulkRemoveTagsParams) MarshalJSON

func (r FileBulkRemoveTagsParams) MarshalJSON() (data []byte, err error)

func (*FileBulkRemoveTagsParams) UnmarshalJSON

func (r *FileBulkRemoveTagsParams) UnmarshalJSON(data []byte) error

type FileBulkRemoveTagsResponse

type FileBulkRemoveTagsResponse struct {
	// An array of fileIds that in which tags were successfully removed.
	SuccessfullyUpdatedFileIDs []string `json:"successfullyUpdatedFileIds"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SuccessfullyUpdatedFileIDs respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileBulkRemoveTagsResponse) RawJSON

func (r FileBulkRemoveTagsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileBulkRemoveTagsResponse) UnmarshalJSON

func (r *FileBulkRemoveTagsResponse) UnmarshalJSON(data []byte) error

type FileBulkService

type FileBulkService struct {
	Options []option.RequestOption
}

FileBulkService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileBulkService method instead.

func NewFileBulkService

func NewFileBulkService(opts ...option.RequestOption) (r FileBulkService)

NewFileBulkService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileBulkService) AddTags

This API adds tags to multiple files in bulk. A maximum of 50 files can be specified at a time.

func (*FileBulkService) Delete

This API deletes multiple files and all their file versions permanently.

Note: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.

A maximum of 100 files can be deleted at a time.

func (*FileBulkService) RemoveAITags

This API removes AITags from multiple files in bulk. A maximum of 50 files can be specified at a time.

func (*FileBulkService) RemoveTags

This API removes tags from multiple files in bulk. A maximum of 50 files can be specified at a time.

type FileCopyParams

type FileCopyParams struct {
	// Full path to the folder you want to copy the above file into.
	DestinationPath string `json:"destinationPath,required"`
	// The full path of the file you want to copy.
	SourceFilePath string `json:"sourceFilePath,required"`
	// Option to copy all versions of a file. By default, only the current version of
	// the file is copied. When set to true, all versions of the file will be copied.
	// Default value - `false`.
	IncludeFileVersions param.Opt[bool] `json:"includeFileVersions,omitzero"`
	// contains filtered or unexported fields
}

func (FileCopyParams) MarshalJSON

func (r FileCopyParams) MarshalJSON() (data []byte, err error)

func (*FileCopyParams) UnmarshalJSON

func (r *FileCopyParams) UnmarshalJSON(data []byte) error

type FileCopyResponse

type FileCopyResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileCopyResponse) RawJSON

func (r FileCopyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileCopyResponse) UnmarshalJSON

func (r *FileCopyResponse) UnmarshalJSON(data []byte) error

type FileMetadataGetFromURLParams

type FileMetadataGetFromURLParams struct {
	// Should be a valid file URL. It should be accessible using your ImageKit.io
	// account.
	URL string `query:"url,required" format:"uri" json:"-"`
	// contains filtered or unexported fields
}

func (FileMetadataGetFromURLParams) URLQuery

func (r FileMetadataGetFromURLParams) URLQuery() (v url.Values, err error)

URLQuery serializes FileMetadataGetFromURLParams's query parameters as `url.Values`.

type FileMetadataService

type FileMetadataService struct {
	Options []option.RequestOption
}

FileMetadataService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileMetadataService method instead.

func NewFileMetadataService

func NewFileMetadataService(opts ...option.RequestOption) (r FileMetadataService)

NewFileMetadataService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileMetadataService) Get

func (r *FileMetadataService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *Metadata, err error)

You can programmatically get image EXIF, pHash, and other metadata for uploaded files in the ImageKit.io media library using this API.

You can also get the metadata in upload API response by passing `metadata` in `responseFields` parameter.

func (*FileMetadataService) GetFromURL

func (r *FileMetadataService) GetFromURL(ctx context.Context, query FileMetadataGetFromURLParams, opts ...option.RequestOption) (res *Metadata, err error)

Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL using this API.

type FileMoveParams

type FileMoveParams struct {
	// Full path to the folder you want to move the above file into.
	DestinationPath string `json:"destinationPath,required"`
	// The full path of the file you want to move.
	SourceFilePath string `json:"sourceFilePath,required"`
	// contains filtered or unexported fields
}

func (FileMoveParams) MarshalJSON

func (r FileMoveParams) MarshalJSON() (data []byte, err error)

func (*FileMoveParams) UnmarshalJSON

func (r *FileMoveParams) UnmarshalJSON(data []byte) error

type FileMoveResponse

type FileMoveResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileMoveResponse) RawJSON

func (r FileMoveResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileMoveResponse) UnmarshalJSON

func (r *FileMoveResponse) UnmarshalJSON(data []byte) error

type FileRenameParams

type FileRenameParams struct {
	// The full path of the file you want to rename.
	FilePath string `json:"filePath,required"`
	// The new name of the file. A filename can contain:
	//
	// Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks,
	// and numerals in other languages). Special Characters: `.`, `_`, and `-`.
	//
	// Any other character, including space, will be replaced by `_`.
	NewFileName string `json:"newFileName,required"`
	// Option to purge cache for the old file and its versions' URLs.
	//
	// When set to true, it will internally issue a purge cache request on CDN to
	// remove cached content of old file and its versions. This purge request is
	// counted against your monthly purge quota.
	//
	// Note: If the old file were accessible at
	// `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be
	// issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard
	// at the end). It will remove the file and its versions' URLs and any
	// transformations made using query parameters on this file or its versions.
	// However, the cache for file transformations made using path parameters will
	// persist. You can purge them using the purge API. For more details, refer to the
	// purge API documentation.
	//
	// Default value - `false`
	PurgeCache param.Opt[bool] `json:"purgeCache,omitzero"`
	// contains filtered or unexported fields
}

func (FileRenameParams) MarshalJSON

func (r FileRenameParams) MarshalJSON() (data []byte, err error)

func (*FileRenameParams) UnmarshalJSON

func (r *FileRenameParams) UnmarshalJSON(data []byte) error

type FileRenameResponse

type FileRenameResponse struct {
	// Unique identifier of the purge request. This can be used to check the status of
	// the purge request.
	PurgeRequestID string `json:"purgeRequestId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PurgeRequestID respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileRenameResponse) RawJSON

func (r FileRenameResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileRenameResponse) UnmarshalJSON

func (r *FileRenameResponse) UnmarshalJSON(data []byte) error

type FileSelectedFieldsSchema

type FileSelectedFieldsSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,required"`
	// The default value for this custom metadata field. The value should match the
	// `type` of custom metadata field.
	DefaultValue FileSelectedFieldsSchemaDefaultValueUnion `json:"defaultValue"`
	// Specifies if the custom metadata field is required or not.
	IsValueRequired bool `json:"isValueRequired"`
	// Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MaxLength float64 `json:"maxLength"`
	// Maximum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MaxValue FileSelectedFieldsSchemaMaxValueUnion `json:"maxValue"`
	// Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MinLength float64 `json:"minLength"`
	// Minimum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MinValue FileSelectedFieldsSchemaMinValueUnion `json:"minValue"`
	// Indicates whether the custom metadata field is read only. A read only field
	// cannot be modified after being set. This field is configurable only via the
	// **Path policy** feature.
	ReadOnly bool `json:"readOnly"`
	// An array of allowed values when field type is `SingleSelect` or `MultiSelect`.
	SelectOptions []FileSelectedFieldsSchemaSelectOptionUnion `json:"selectOptions"`
	// Specifies if the selectOptions array is truncated. It is truncated when number
	// of options are > 100.
	SelectOptionsTruncated bool `json:"selectOptionsTruncated"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type                   respjson.Field
		DefaultValue           respjson.Field
		IsValueRequired        respjson.Field
		MaxLength              respjson.Field
		MaxValue               respjson.Field
		MinLength              respjson.Field
		MinValue               respjson.Field
		ReadOnly               respjson.Field
		SelectOptions          respjson.Field
		SelectOptionsTruncated respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileSelectedFieldsSchema) RawJSON

func (r FileSelectedFieldsSchema) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchema) UnmarshalJSON

func (r *FileSelectedFieldsSchema) UnmarshalJSON(data []byte) error

type FileSelectedFieldsSchemaDefaultValueMixedItemUnion

type FileSelectedFieldsSchemaDefaultValueMixedItemUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSelectedFieldsSchemaDefaultValueMixedItemUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (FileSelectedFieldsSchemaDefaultValueMixedItemUnion) AsBool

func (FileSelectedFieldsSchemaDefaultValueMixedItemUnion) AsFloat

func (FileSelectedFieldsSchemaDefaultValueMixedItemUnion) AsString

func (FileSelectedFieldsSchemaDefaultValueMixedItemUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type FileSelectedFieldsSchemaDefaultValueUnion

type FileSelectedFieldsSchemaDefaultValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a
	// [[]FileSelectedFieldsSchemaDefaultValueMixedItemUnion] instead of an object.
	OfMixed []FileSelectedFieldsSchemaDefaultValueMixedItemUnion `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		OfMixed  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSelectedFieldsSchemaDefaultValueUnion contains all possible properties and values from [string], [float64], [bool], [[]FileSelectedFieldsSchemaDefaultValueMixedItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfMixed]

func (FileSelectedFieldsSchemaDefaultValueUnion) AsBool

func (FileSelectedFieldsSchemaDefaultValueUnion) AsFloat

func (FileSelectedFieldsSchemaDefaultValueUnion) AsMixed

func (FileSelectedFieldsSchemaDefaultValueUnion) AsString

func (FileSelectedFieldsSchemaDefaultValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchemaDefaultValueUnion) UnmarshalJSON

func (r *FileSelectedFieldsSchemaDefaultValueUnion) UnmarshalJSON(data []byte) error

type FileSelectedFieldsSchemaMaxValueUnion

type FileSelectedFieldsSchemaMaxValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSelectedFieldsSchemaMaxValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (FileSelectedFieldsSchemaMaxValueUnion) AsFloat

func (FileSelectedFieldsSchemaMaxValueUnion) AsString

func (FileSelectedFieldsSchemaMaxValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchemaMaxValueUnion) UnmarshalJSON

func (r *FileSelectedFieldsSchemaMaxValueUnion) UnmarshalJSON(data []byte) error

type FileSelectedFieldsSchemaMinValueUnion

type FileSelectedFieldsSchemaMinValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSelectedFieldsSchemaMinValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (FileSelectedFieldsSchemaMinValueUnion) AsFloat

func (FileSelectedFieldsSchemaMinValueUnion) AsString

func (FileSelectedFieldsSchemaMinValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchemaMinValueUnion) UnmarshalJSON

func (r *FileSelectedFieldsSchemaMinValueUnion) UnmarshalJSON(data []byte) error

type FileSelectedFieldsSchemaSelectOptionUnion

type FileSelectedFieldsSchemaSelectOptionUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSelectedFieldsSchemaSelectOptionUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (FileSelectedFieldsSchemaSelectOptionUnion) AsBool

func (FileSelectedFieldsSchemaSelectOptionUnion) AsFloat

func (FileSelectedFieldsSchemaSelectOptionUnion) AsString

func (FileSelectedFieldsSchemaSelectOptionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileSelectedFieldsSchemaSelectOptionUnion) UnmarshalJSON

func (r *FileSelectedFieldsSchemaSelectOptionUnion) UnmarshalJSON(data []byte) error

type FileService

type FileService struct {
	Options  []option.RequestOption
	Bulk     FileBulkService
	Versions FileVersionService
	Metadata FileMetadataService
}

FileService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileService method instead.

func NewFileService

func NewFileService(opts ...option.RequestOption) (r FileService)

NewFileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileService) Copy

func (r *FileService) Copy(ctx context.Context, body FileCopyParams, opts ...option.RequestOption) (res *FileCopyResponse, err error)

This will copy a file from one folder to another.

Note: If any file at the destination has the same name as the source file, then the source file and its versions (if `includeFileVersions` is set to true) will be appended to the destination file version history.

func (*FileService) Delete

func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (err error)

This API deletes the file and all its file versions permanently.

Note: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.

func (*FileService) Get

func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *File, err error)

This API returns an object with details or attributes about the current version of the file.

func (*FileService) Move

func (r *FileService) Move(ctx context.Context, body FileMoveParams, opts ...option.RequestOption) (res *FileMoveResponse, err error)

This will move a file and all its versions from one folder to another.

Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file.

func (*FileService) Rename

func (r *FileService) Rename(ctx context.Context, body FileRenameParams, opts ...option.RequestOption) (res *FileRenameResponse, err error)

You can rename an already existing file in the media library using rename file API. This operation would rename all file versions of the file.

Note: The old URLs will stop working. The file/file version URLs cached on CDN will continue to work unless a purge is requested.

func (*FileService) Update

func (r *FileService) Update(ctx context.Context, fileID string, body FileUpdateParams, opts ...option.RequestOption) (res *FileUpdateResponse, err error)

This API updates the details or attributes of the current version of the file. You can update `tags`, `customCoordinates`, `customMetadata`, publication status, remove existing `AITags` and apply extensions using this API.

func (*FileService) Upload

func (r *FileService) Upload(ctx context.Context, body FileUploadParams, opts ...option.RequestOption) (res *FileUploadResponse, err error)

ImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token`, `signature`, and `expire` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) about how to implement client-side file upload.

The [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security by verifying the entire payload using JWT.

**File size limit** \ On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw files and 100MB for videos. On the paid plan, these limits increase to 40MB for images, audio, and raw files and 2GB for videos. These limits can be further increased with higher-tier plans.

**Version limit** \ A file can have a maximum of 100 versions.

**Demo applications**

  • A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.
  • [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.

type FileType

type FileType string

Type of the asset.

const (
	FileTypeFile        FileType = "file"
	FileTypeFileVersion FileType = "file-version"
)

type FileUpdateParams

type FileUpdateParams struct {
	// Schema for update file update request.
	UpdateFileRequest UpdateFileRequestUnionParam
	// contains filtered or unexported fields
}

func (FileUpdateParams) MarshalJSON

func (r FileUpdateParams) MarshalJSON() (data []byte, err error)

func (*FileUpdateParams) UnmarshalJSON

func (r *FileUpdateParams) UnmarshalJSON(data []byte) error

type FileUpdateResponse

type FileUpdateResponse struct {
	ExtensionStatus FileUpdateResponseExtensionStatus `json:"extensionStatus"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtensionStatus respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	File
}

Object containing details of a file or file version.

func (FileUpdateResponse) RawJSON

func (r FileUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileUpdateResponse) UnmarshalJSON

func (r *FileUpdateResponse) UnmarshalJSON(data []byte) error

type FileUpdateResponseExtensionStatus

type FileUpdateResponseExtensionStatus struct {
	// Any of "success", "pending", "failed".
	AIAutoDescription string `json:"ai-auto-description"`
	// Any of "success", "pending", "failed".
	AwsAutoTagging string `json:"aws-auto-tagging"`
	// Any of "success", "pending", "failed".
	GoogleAutoTagging string `json:"google-auto-tagging"`
	// Any of "success", "pending", "failed".
	RemoveBg string `json:"remove-bg"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AIAutoDescription respjson.Field
		AwsAutoTagging    respjson.Field
		GoogleAutoTagging respjson.Field
		RemoveBg          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileUpdateResponseExtensionStatus) RawJSON

Returns the unmodified JSON received from the API

func (*FileUpdateResponseExtensionStatus) UnmarshalJSON

func (r *FileUpdateResponseExtensionStatus) UnmarshalJSON(data []byte) error

type FileUploadParams

type FileUploadParams struct {
	// File is the upload payload. It MUST be a non-nil io.Reader (e.g., *os.File,
	// *bytes.Reader, *bytes.Buffer, *strings.Reader, or any stream).
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	// The name with which the file has to be uploaded. The file name can contain:
	//
	// - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`.
	// - Special Characters: `.`, `-`
	//
	// Any other character including space will be replaced by `_`
	FileName string `json:"fileName,required"`
	// A unique value that the ImageKit.io server will use to recognize and prevent
	// subsequent retries for the same request. We suggest using V4 UUIDs, or another
	// random string with enough entropy to avoid collisions. This field is only
	// required for authentication when uploading a file from the client side.
	//
	// **Note**: Sending a value that has been used in the past will result in a
	// validation error. Even if your previous request resulted in an error, you should
	// always send a new value for this field.
	Token param.Opt[string] `json:"token,omitzero"`
	// Server-side checks to run on the asset. Read more about
	// [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks).
	Checks param.Opt[string] `json:"checks,omitzero"`
	// Define an important area in the image. This is only relevant for image type
	// files.
	//
	//   - To be passed as a string with the x and y coordinates of the top-left corner,
	//     and width and height of the area of interest in the format `x,y,width,height`.
	//     For example - `10,10,100,100`
	//   - Can be used with fo-customtransformation.
	//   - If this field is not specified and the file is overwritten, then
	//     customCoordinates will be removed.
	CustomCoordinates param.Opt[string] `json:"customCoordinates,omitzero"`
	// Optional text to describe the contents of the file.
	Description param.Opt[string] `json:"description,omitzero"`
	// The time until your signature is valid. It must be a
	// [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into
	// the future. It should be in seconds. This field is only required for
	// authentication when uploading a file from the client side.
	Expire param.Opt[int64] `json:"expire,omitzero"`
	// The folder path in which the image has to be uploaded. If the folder(s) didn't
	// exist before, a new folder(s) is created.
	//
	// The folder name can contain:
	//
	// - Alphanumeric Characters: `a-z` , `A-Z` , `0-9`
	// - Special Characters: `/` , `_` , `-`
	//
	// Using multiple `/` creates a nested folder.
	Folder param.Opt[string] `json:"folder,omitzero"`
	// Whether to mark the file as private or not.
	//
	// If `true`, the file is marked as private and is accessible only using named
	// transformation or signed URL.
	IsPrivateFile param.Opt[bool] `json:"isPrivateFile,omitzero"`
	// Whether to upload file as published or not.
	//
	// If `false`, the file is marked as unpublished, which restricts access to the
	// file only via the media library. Files in draft or unpublished state can only be
	// publicly accessed after being published.
	//
	// The option to upload in draft state is only available in custom enterprise
	// pricing plans.
	IsPublished param.Opt[bool] `json:"isPublished,omitzero"`
	// If set to `true` and a file already exists at the exact location, its AITags
	// will be removed. Set `overwriteAITags` to `false` to preserve AITags.
	OverwriteAITags param.Opt[bool] `json:"overwriteAITags,omitzero"`
	// If the request does not have `customMetadata`, and a file already exists at the
	// exact location, existing customMetadata will be removed.
	OverwriteCustomMetadata param.Opt[bool] `json:"overwriteCustomMetadata,omitzero"`
	// If `false` and `useUniqueFileName` is also `false`, and a file already exists at
	// the exact location, upload API will return an error immediately.
	OverwriteFile param.Opt[bool] `json:"overwriteFile,omitzero"`
	// If the request does not have `tags`, and a file already exists at the exact
	// location, existing tags will be removed.
	OverwriteTags param.Opt[bool] `json:"overwriteTags,omitzero"`
	// Your ImageKit.io public key. This field is only required for authentication when
	// uploading a file from the client side.
	PublicKey param.Opt[string] `json:"publicKey,omitzero"`
	// HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a
	// key. Learn how to create a signature on the page below. This should be in
	// lowercase.
	//
	// Signature must be calculated on the server-side. This field is only required for
	// authentication when uploading a file from the client side.
	Signature param.Opt[string] `json:"signature,omitzero"`
	// Whether to use a unique filename for this file or not.
	//
	// If `true`, ImageKit.io will add a unique suffix to the filename parameter to get
	// a unique filename.
	//
	// If `false`, then the image is uploaded with the provided filename parameter, and
	// any existing file with the same name is replaced.
	UseUniqueFileName param.Opt[bool] `json:"useUniqueFileName,omitzero"`
	// The final status of extensions after they have completed execution will be
	// delivered to this endpoint as a POST request.
	// [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure)
	// about the webhook payload structure.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero" format:"uri"`
	// JSON key-value pairs to associate with the asset. Create the custom metadata
	// fields before setting these values.
	CustomMetadata map[string]any `json:"customMetadata,omitzero"`
	// Array of extensions to be applied to the asset. Each extension can be configured
	// with specific parameters based on the extension type.
	Extensions shared.ExtensionsParam `json:"extensions,omitzero"`
	// Array of response field keys to include in the API response body.
	//
	// Any of "tags", "customCoordinates", "isPrivateFile", "embeddedMetadata",
	// "isPublished", "customMetadata", "metadata", "selectedFieldsSchema".
	ResponseFields []string `json:"responseFields,omitzero"`
	// Set the tags while uploading the file. Provide an array of tag strings (e.g.
	// `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not
	// exceed 500, and the `%` character is not allowed. If this field is not specified
	// and the file is overwritten, the existing tags will be removed.
	Tags []string `json:"tags,omitzero"`
	// Configure pre-processing (`pre`) and post-processing (`post`) transformations.
	//
	//   - `pre` — applied before the file is uploaded to the Media Library.
	//     Useful for reducing file size or applying basic optimizations upfront (e.g.,
	//     resize, compress).
	//
	//   - `post` — applied immediately after upload.
	//     Ideal for generating transformed versions (like video encodes or thumbnails)
	//     in advance, so they're ready for delivery without delay.
	//
	// You can mix and match any combination of post-processing types.
	Transformation FileUploadParamsTransformation `json:"transformation,omitzero"`
	// contains filtered or unexported fields
}

func (FileUploadParams) MarshalMultipart

func (r FileUploadParams) MarshalMultipart() (data []byte, contentType string, err error)

type FileUploadParamsTransformation

type FileUploadParamsTransformation struct {
	// Transformation string to apply before uploading the file to the Media Library.
	// Useful for optimizing files at ingestion.
	Pre param.Opt[string] `json:"pre,omitzero"`
	// List of transformations to apply _after_ the file is uploaded.
	// Each item must match one of the following types: `transformation`,
	// `gif-to-video`, `thumbnail`, `abs`.
	Post []FileUploadParamsTransformationPostUnion `json:"post,omitzero"`
	// contains filtered or unexported fields
}

Configure pre-processing (`pre`) and post-processing (`post`) transformations.

  • `pre` — applied before the file is uploaded to the Media Library. Useful for reducing file size or applying basic optimizations upfront (e.g., resize, compress).

  • `post` — applied immediately after upload. Ideal for generating transformed versions (like video encodes or thumbnails) in advance, so they're ready for delivery without delay.

You can mix and match any combination of post-processing types.

func (FileUploadParamsTransformation) MarshalJSON

func (r FileUploadParamsTransformation) MarshalJSON() (data []byte, err error)

func (*FileUploadParamsTransformation) UnmarshalJSON

func (r *FileUploadParamsTransformation) UnmarshalJSON(data []byte) error

type FileUploadParamsTransformationPostAbs

type FileUploadParamsTransformationPostAbs struct {
	// Streaming protocol to use (`hls` or `dash`).
	//
	// Any of "hls", "dash".
	Protocol string `json:"protocol,omitzero,required"`
	// List of different representations you want to create separated by an underscore.
	Value string `json:"value,required"`
	// Adaptive Bitrate Streaming (ABS) setup.
	//
	// This field can be elided, and will marshal its zero value as "abs".
	Type constant.Abs `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Protocol, Type, Value are required.

func (FileUploadParamsTransformationPostAbs) MarshalJSON

func (r FileUploadParamsTransformationPostAbs) MarshalJSON() (data []byte, err error)

func (*FileUploadParamsTransformationPostAbs) UnmarshalJSON

func (r *FileUploadParamsTransformationPostAbs) UnmarshalJSON(data []byte) error

type FileUploadParamsTransformationPostGifToVideo

type FileUploadParamsTransformationPostGifToVideo struct {
	// Optional transformation string to apply to the output video.
	// **Example**: `q-80`
	Value param.Opt[string] `json:"value,omitzero"`
	// Converts an animated GIF into an MP4.
	//
	// This field can be elided, and will marshal its zero value as "gif-to-video".
	Type constant.GifToVideo `json:"type,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (FileUploadParamsTransformationPostGifToVideo) MarshalJSON

func (r FileUploadParamsTransformationPostGifToVideo) MarshalJSON() (data []byte, err error)

func (*FileUploadParamsTransformationPostGifToVideo) UnmarshalJSON

func (r *FileUploadParamsTransformationPostGifToVideo) UnmarshalJSON(data []byte) error

type FileUploadParamsTransformationPostThumbnail

type FileUploadParamsTransformationPostThumbnail struct {
	// Optional transformation string.
	// **Example**: `w-150,h-150`
	Value param.Opt[string] `json:"value,omitzero"`
	// Generates a thumbnail image.
	//
	// This field can be elided, and will marshal its zero value as "thumbnail".
	Type constant.Thumbnail `json:"type,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (FileUploadParamsTransformationPostThumbnail) MarshalJSON

func (r FileUploadParamsTransformationPostThumbnail) MarshalJSON() (data []byte, err error)

func (*FileUploadParamsTransformationPostThumbnail) UnmarshalJSON

func (r *FileUploadParamsTransformationPostThumbnail) UnmarshalJSON(data []byte) error

type FileUploadParamsTransformationPostTransformation

type FileUploadParamsTransformationPostTransformation struct {
	// Transformation string (e.g. `w-200,h-200`).
	// Same syntax as ImageKit URL-based transformations.
	Value string `json:"value,required"`
	// Transformation type.
	//
	// This field can be elided, and will marshal its zero value as "transformation".
	Type constant.Transformation `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Type, Value are required.

func (FileUploadParamsTransformationPostTransformation) MarshalJSON

func (r FileUploadParamsTransformationPostTransformation) MarshalJSON() (data []byte, err error)

func (*FileUploadParamsTransformationPostTransformation) UnmarshalJSON

type FileUploadParamsTransformationPostUnion

type FileUploadParamsTransformationPostUnion struct {
	OfTransformation *FileUploadParamsTransformationPostTransformation `json:",omitzero,inline"`
	OfGifToVideo     *FileUploadParamsTransformationPostGifToVideo     `json:",omitzero,inline"`
	OfThumbnail      *FileUploadParamsTransformationPostThumbnail      `json:",omitzero,inline"`
	OfAbs            *FileUploadParamsTransformationPostAbs            `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FileUploadParamsTransformationPostUnion) GetProtocol

Returns a pointer to the underlying variant's property, if present.

func (FileUploadParamsTransformationPostUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (FileUploadParamsTransformationPostUnion) GetValue

Returns a pointer to the underlying variant's property, if present.

func (FileUploadParamsTransformationPostUnion) MarshalJSON

func (u FileUploadParamsTransformationPostUnion) MarshalJSON() ([]byte, error)

func (*FileUploadParamsTransformationPostUnion) UnmarshalJSON

func (u *FileUploadParamsTransformationPostUnion) UnmarshalJSON(data []byte) error

type FileUploadResponse

type FileUploadResponse struct {
	// An array of tags assigned to the uploaded file by auto tagging.
	AITags []FileUploadResponseAITag `json:"AITags,nullable"`
	// The audio codec used in the video (only for video).
	AudioCodec string `json:"audioCodec"`
	// The bit rate of the video in kbps (only for video).
	BitRate int64 `json:"bitRate"`
	// Value of custom coordinates associated with the image in the format
	// `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`.
	// Send `customCoordinates` in `responseFields` in API request to get the value of
	// this field.
	CustomCoordinates string `json:"customCoordinates,nullable"`
	// A key-value data associated with the asset. Use `responseField` in API request
	// to get `customMetadata` in the upload API response. Before setting any custom
	// metadata on an asset, you have to create the field using custom metadata fields
	// API. Send `customMetadata` in `responseFields` in API request to get the value
	// of this field.
	CustomMetadata map[string]any `json:"customMetadata"`
	// 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. Send `embeddedMetadata` in `responseFields` in API request to get
	// embeddedMetadata in the upload API response.
	EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
	// Extension names with their processing status at the time of completion of the
	// request. It could have one of the following status values:
	//
	// `success`: The extension has been successfully applied. `failed`: The extension
	// has failed and will not be retried. `pending`: The extension will finish
	// processing in some time. On completion, the final status (success / failed) will
	// be sent to the `webhookUrl` provided.
	//
	// If no extension was requested, then this parameter is not returned.
	ExtensionStatus FileUploadResponseExtensionStatus `json:"extensionStatus"`
	// Unique fileId. Store this fileld in your database, as this will be used to
	// perform update action on this file.
	FileID string `json:"fileId"`
	// The relative path of the file in the media library e.g.
	// `/marketing-assets/new-banner.jpg`.
	FilePath string `json:"filePath"`
	// Type of the uploaded file. Possible values are `image`, `non-image`.
	FileType string `json:"fileType"`
	// Height of the image in pixels (Only for images)
	Height float64 `json:"height"`
	// Is the file marked as private. It can be either `true` or `false`. Send
	// `isPrivateFile` in `responseFields` in API request to get the value of this
	// field.
	IsPrivateFile bool `json:"isPrivateFile"`
	// Is the file published or in draft state. It can be either `true` or `false`.
	// Send `isPublished` in `responseFields` in API request to get the value of this
	// field.
	IsPublished bool `json:"isPublished"`
	// Legacy metadata. Send `metadata` in `responseFields` in API request to get
	// metadata in the upload API response.
	Metadata Metadata `json:"metadata"`
	// Name of the asset.
	Name string `json:"name"`
	// This field is included in the response only if the Path policy feature is
	// available in the plan. It contains schema definitions for the custom metadata
	// fields selected for the specified file path. Field selection can only be done
	// when the Path policy feature is enabled.
	//
	// Keys are the names of the custom metadata fields; the value object has details
	// about the custom metadata schema.
	SelectedFieldsSchema map[string]FileUploadResponseSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// Size of the image file in Bytes.
	Size float64 `json:"size"`
	// The array of tags associated with the asset. If no tags are set, it will be
	// `null`. Send `tags` in `responseFields` in API request to get the value of this
	// field.
	Tags []string `json:"tags,nullable"`
	// In the case of an image, a small thumbnail URL.
	ThumbnailURL string `json:"thumbnailUrl"`
	// A publicly accessible URL of the file.
	URL string `json:"url"`
	// An object containing the file or file version's `id` (versionId) and `name`.
	VersionInfo FileUploadResponseVersionInfo `json:"versionInfo"`
	// The video codec used in the video (only for video).
	VideoCodec string `json:"videoCodec"`
	// Width of the image in pixels (Only for Images)
	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
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		Duration             respjson.Field
		EmbeddedMetadata     respjson.Field
		ExtensionStatus      respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Metadata             respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		ThumbnailURL         respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		VideoCodec           respjson.Field
		Width                respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing details of a successful upload.

func (FileUploadResponse) RawJSON

func (r FileUploadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileUploadResponse) UnmarshalJSON

func (r *FileUploadResponse) UnmarshalJSON(data []byte) error

type FileUploadResponseAITag

type FileUploadResponseAITag struct {
	// Confidence score of the tag.
	Confidence float64 `json:"confidence"`
	// Name of the tag.
	Name string `json:"name"`
	// Array of `AITags` associated with the image. If no `AITags` are set, it will be
	// null. These tags can be added using the `google-auto-tagging` or
	// `aws-auto-tagging` extensions.
	Source string `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Confidence  respjson.Field
		Name        respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileUploadResponseAITag) RawJSON

func (r FileUploadResponseAITag) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileUploadResponseAITag) UnmarshalJSON

func (r *FileUploadResponseAITag) UnmarshalJSON(data []byte) error

type FileUploadResponseExtensionStatus

type FileUploadResponseExtensionStatus struct {
	// Any of "success", "pending", "failed".
	AIAutoDescription string `json:"ai-auto-description"`
	// Any of "success", "pending", "failed".
	AwsAutoTagging string `json:"aws-auto-tagging"`
	// Any of "success", "pending", "failed".
	GoogleAutoTagging string `json:"google-auto-tagging"`
	// Any of "success", "pending", "failed".
	RemoveBg string `json:"remove-bg"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AIAutoDescription respjson.Field
		AwsAutoTagging    respjson.Field
		GoogleAutoTagging respjson.Field
		RemoveBg          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Extension names with their processing status at the time of completion of the request. It could have one of the following status values:

`success`: The extension has been successfully applied. `failed`: The extension has failed and will not be retried. `pending`: The extension will finish processing in some time. On completion, the final status (success / failed) will be sent to the `webhookUrl` provided.

If no extension was requested, then this parameter is not returned.

func (FileUploadResponseExtensionStatus) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseExtensionStatus) UnmarshalJSON

func (r *FileUploadResponseExtensionStatus) UnmarshalJSON(data []byte) error

type FileUploadResponseSelectedFieldsSchema

type FileUploadResponseSelectedFieldsSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,required"`
	// The default value for this custom metadata field. The value should match the
	// `type` of custom metadata field.
	DefaultValue FileUploadResponseSelectedFieldsSchemaDefaultValueUnion `json:"defaultValue"`
	// Specifies if the custom metadata field is required or not.
	IsValueRequired bool `json:"isValueRequired"`
	// Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MaxLength float64 `json:"maxLength"`
	// Maximum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MaxValue FileUploadResponseSelectedFieldsSchemaMaxValueUnion `json:"maxValue"`
	// Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MinLength float64 `json:"minLength"`
	// Minimum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MinValue FileUploadResponseSelectedFieldsSchemaMinValueUnion `json:"minValue"`
	// Indicates whether the custom metadata field is read only. A read only field
	// cannot be modified after being set. This field is configurable only via the
	// **Path policy** feature.
	ReadOnly bool `json:"readOnly"`
	// An array of allowed values when field type is `SingleSelect` or `MultiSelect`.
	SelectOptions []FileUploadResponseSelectedFieldsSchemaSelectOptionUnion `json:"selectOptions"`
	// Specifies if the selectOptions array is truncated. It is truncated when number
	// of options are > 100.
	SelectOptionsTruncated bool `json:"selectOptionsTruncated"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type                   respjson.Field
		DefaultValue           respjson.Field
		IsValueRequired        respjson.Field
		MaxLength              respjson.Field
		MaxValue               respjson.Field
		MinLength              respjson.Field
		MinValue               respjson.Field
		ReadOnly               respjson.Field
		SelectOptions          respjson.Field
		SelectOptionsTruncated respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileUploadResponseSelectedFieldsSchema) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchema) UnmarshalJSON

func (r *FileUploadResponseSelectedFieldsSchema) UnmarshalJSON(data []byte) error

type FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion

type FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsBool

func (FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsFloat

func (FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) AsString

func (FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type FileUploadResponseSelectedFieldsSchemaDefaultValueUnion

type FileUploadResponseSelectedFieldsSchemaDefaultValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a
	// [[]FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion] instead of
	// an object.
	OfMixed []FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		OfMixed  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileUploadResponseSelectedFieldsSchemaDefaultValueUnion contains all possible properties and values from [string], [float64], [bool], [[]FileUploadResponseSelectedFieldsSchemaDefaultValueMixedItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfMixed]

func (FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsBool

func (FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsFloat

func (FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsMixed

func (FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) AsString

func (FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchemaDefaultValueUnion) UnmarshalJSON

type FileUploadResponseSelectedFieldsSchemaMaxValueUnion

type FileUploadResponseSelectedFieldsSchemaMaxValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileUploadResponseSelectedFieldsSchemaMaxValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (FileUploadResponseSelectedFieldsSchemaMaxValueUnion) AsFloat

func (FileUploadResponseSelectedFieldsSchemaMaxValueUnion) AsString

func (FileUploadResponseSelectedFieldsSchemaMaxValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchemaMaxValueUnion) UnmarshalJSON

type FileUploadResponseSelectedFieldsSchemaMinValueUnion

type FileUploadResponseSelectedFieldsSchemaMinValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileUploadResponseSelectedFieldsSchemaMinValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (FileUploadResponseSelectedFieldsSchemaMinValueUnion) AsFloat

func (FileUploadResponseSelectedFieldsSchemaMinValueUnion) AsString

func (FileUploadResponseSelectedFieldsSchemaMinValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchemaMinValueUnion) UnmarshalJSON

type FileUploadResponseSelectedFieldsSchemaSelectOptionUnion

type FileUploadResponseSelectedFieldsSchemaSelectOptionUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileUploadResponseSelectedFieldsSchemaSelectOptionUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsBool

func (FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsFloat

func (FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) AsString

func (FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseSelectedFieldsSchemaSelectOptionUnion) UnmarshalJSON

type FileUploadResponseVersionInfo

type FileUploadResponseVersionInfo struct {
	// Unique identifier of the file version.
	ID string `json:"id"`
	// Name of the file version.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object containing the file or file version's `id` (versionId) and `name`.

func (FileUploadResponseVersionInfo) RawJSON

Returns the unmodified JSON received from the API

func (*FileUploadResponseVersionInfo) UnmarshalJSON

func (r *FileUploadResponseVersionInfo) UnmarshalJSON(data []byte) error

type FileVersionDeleteParams

type FileVersionDeleteParams struct {
	FileID string `path:"fileId,required" json:"-"`
	// contains filtered or unexported fields
}

type FileVersionDeleteResponse

type FileVersionDeleteResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileVersionDeleteResponse) RawJSON

func (r FileVersionDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileVersionDeleteResponse) UnmarshalJSON

func (r *FileVersionDeleteResponse) UnmarshalJSON(data []byte) error

type FileVersionGetParams

type FileVersionGetParams struct {
	FileID string `path:"fileId,required" json:"-"`
	// contains filtered or unexported fields
}

type FileVersionInfo

type FileVersionInfo struct {
	// Unique identifier of the file version.
	ID string `json:"id"`
	// Name of the file version.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object with details of the file version.

func (FileVersionInfo) RawJSON

func (r FileVersionInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileVersionInfo) UnmarshalJSON

func (r *FileVersionInfo) UnmarshalJSON(data []byte) error

type FileVersionRestoreParams

type FileVersionRestoreParams struct {
	FileID string `path:"fileId,required" json:"-"`
	// contains filtered or unexported fields
}

type FileVersionService

type FileVersionService struct {
	Options []option.RequestOption
}

FileVersionService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileVersionService method instead.

func NewFileVersionService

func NewFileVersionService(opts ...option.RequestOption) (r FileVersionService)

NewFileVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileVersionService) Delete

This API deletes a non-current file version permanently. The API returns an empty response.

Note: If you want to delete all versions of a file, use the delete file API.

func (*FileVersionService) Get

func (r *FileVersionService) Get(ctx context.Context, versionID string, query FileVersionGetParams, opts ...option.RequestOption) (res *File, err error)

This API returns an object with details or attributes of a file version.

func (*FileVersionService) List

func (r *FileVersionService) List(ctx context.Context, fileID string, opts ...option.RequestOption) (res *[]File, err error)

This API returns details of all versions of a file.

func (*FileVersionService) Restore

func (r *FileVersionService) Restore(ctx context.Context, versionID string, body FileVersionRestoreParams, opts ...option.RequestOption) (res *File, err error)

This API restores a file version as the current file version.

type Folder

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"`
	// 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
	// folder. For example, if the folder is at the root of the media library, the path
	// will be /folder. If the folder is inside another folder named images, the path
	// will be /images/folder.
	FolderPath string `json:"folderPath"`
	// Name of the asset.
	Name string `json:"name"`
	// Type of the asset.
	//
	// Any of "folder".
	Type FolderType `json:"type"`
	// Date and time when the folder was last updated. The date and time is in ISO8601
	// format.
	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
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Folder) RawJSON

func (r Folder) RawJSON() string

Returns the unmodified JSON received from the API

func (*Folder) UnmarshalJSON

func (r *Folder) UnmarshalJSON(data []byte) error

type FolderCopyParams

type FolderCopyParams struct {
	// Full path to the destination folder where you want to copy the source folder
	// into.
	DestinationPath string `json:"destinationPath,required"`
	// The full path to the source folder you want to copy.
	SourceFolderPath string `json:"sourceFolderPath,required"`
	// Option to copy all versions of files that are nested inside the selected folder.
	// By default, only the current version of each file will be copied. When set to
	// true, all versions of each file will be copied. Default value - `false`.
	IncludeVersions param.Opt[bool] `json:"includeVersions,omitzero"`
	// contains filtered or unexported fields
}

func (FolderCopyParams) MarshalJSON

func (r FolderCopyParams) MarshalJSON() (data []byte, err error)

func (*FolderCopyParams) UnmarshalJSON

func (r *FolderCopyParams) UnmarshalJSON(data []byte) error

type FolderCopyResponse

type FolderCopyResponse struct {
	// Unique identifier of the bulk job. This can be used to check the status of the
	// bulk job.
	JobID string `json:"jobId,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		JobID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Job submitted successfully. A `jobId` will be returned.

func (FolderCopyResponse) RawJSON

func (r FolderCopyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderCopyResponse) UnmarshalJSON

func (r *FolderCopyResponse) UnmarshalJSON(data []byte) error

type FolderDeleteParams

type FolderDeleteParams struct {
	// Full path to the folder you want to delete. For example `/folder/to/delete/`.
	FolderPath string `json:"folderPath,required"`
	// contains filtered or unexported fields
}

func (FolderDeleteParams) MarshalJSON

func (r FolderDeleteParams) MarshalJSON() (data []byte, err error)

func (*FolderDeleteParams) UnmarshalJSON

func (r *FolderDeleteParams) UnmarshalJSON(data []byte) error

type FolderDeleteResponse

type FolderDeleteResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderDeleteResponse) RawJSON

func (r FolderDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderDeleteResponse) UnmarshalJSON

func (r *FolderDeleteResponse) UnmarshalJSON(data []byte) error

type FolderJobGetResponse

type FolderJobGetResponse struct {
	// Unique identifier of the bulk job.
	JobID string `json:"jobId"`
	// Unique identifier of the purge request. This will be present only if
	// `purgeCache` is set to `true` in the rename folder API request.
	PurgeRequestID string `json:"purgeRequestId"`
	// Status of the bulk job.
	//
	// Any of "Pending", "Completed".
	Status FolderJobGetResponseStatus `json:"status"`
	// Type of the bulk job.
	//
	// Any of "COPY_FOLDER", "MOVE_FOLDER", "RENAME_FOLDER".
	Type FolderJobGetResponseType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		JobID          respjson.Field
		PurgeRequestID respjson.Field
		Status         respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderJobGetResponse) RawJSON

func (r FolderJobGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderJobGetResponse) UnmarshalJSON

func (r *FolderJobGetResponse) UnmarshalJSON(data []byte) error

type FolderJobGetResponseStatus

type FolderJobGetResponseStatus string

Status of the bulk job.

const (
	FolderJobGetResponseStatusPending   FolderJobGetResponseStatus = "Pending"
	FolderJobGetResponseStatusCompleted FolderJobGetResponseStatus = "Completed"
)

type FolderJobGetResponseType

type FolderJobGetResponseType string

Type of the bulk job.

const (
	FolderJobGetResponseTypeCopyFolder   FolderJobGetResponseType = "COPY_FOLDER"
	FolderJobGetResponseTypeMoveFolder   FolderJobGetResponseType = "MOVE_FOLDER"
	FolderJobGetResponseTypeRenameFolder FolderJobGetResponseType = "RENAME_FOLDER"
)

type FolderJobService

type FolderJobService struct {
	Options []option.RequestOption
}

FolderJobService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFolderJobService method instead.

func NewFolderJobService

func NewFolderJobService(opts ...option.RequestOption) (r FolderJobService)

NewFolderJobService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FolderJobService) Get

func (r *FolderJobService) Get(ctx context.Context, jobID string, opts ...option.RequestOption) (res *FolderJobGetResponse, err error)

This API returns the status of a bulk job like copy and move folder operations.

type FolderMoveParams

type FolderMoveParams struct {
	// Full path to the destination folder where you want to move the source folder
	// into.
	DestinationPath string `json:"destinationPath,required"`
	// The full path to the source folder you want to move.
	SourceFolderPath string `json:"sourceFolderPath,required"`
	// contains filtered or unexported fields
}

func (FolderMoveParams) MarshalJSON

func (r FolderMoveParams) MarshalJSON() (data []byte, err error)

func (*FolderMoveParams) UnmarshalJSON

func (r *FolderMoveParams) UnmarshalJSON(data []byte) error

type FolderMoveResponse

type FolderMoveResponse struct {
	// Unique identifier of the bulk job. This can be used to check the status of the
	// bulk job.
	JobID string `json:"jobId,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		JobID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Job submitted successfully. A `jobId` will be returned.

func (FolderMoveResponse) RawJSON

func (r FolderMoveResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderMoveResponse) UnmarshalJSON

func (r *FolderMoveResponse) UnmarshalJSON(data []byte) error

type FolderNewParams

type FolderNewParams struct {
	// The folder will be created with this name.
	//
	// All characters except alphabets and numbers (inclusive of unicode letters,
	// marks, and numerals in other languages) will be replaced by an underscore i.e.
	// `_`.
	FolderName string `json:"folderName,required"`
	// The folder where the new folder should be created, for root use `/` else the
	// path e.g. `containing/folder/`.
	//
	// Note: If any folder(s) is not present in the parentFolderPath parameter, it will
	// be automatically created. For example, if you pass `/product/images/summer`,
	// then `product`, `images`, and `summer` folders will be created if they don't
	// already exist.
	ParentFolderPath string `json:"parentFolderPath,required"`
	// contains filtered or unexported fields
}

func (FolderNewParams) MarshalJSON

func (r FolderNewParams) MarshalJSON() (data []byte, err error)

func (*FolderNewParams) UnmarshalJSON

func (r *FolderNewParams) UnmarshalJSON(data []byte) error

type FolderNewResponse

type FolderNewResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FolderNewResponse) RawJSON

func (r FolderNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderNewResponse) UnmarshalJSON

func (r *FolderNewResponse) UnmarshalJSON(data []byte) error

type FolderRenameParams

type FolderRenameParams struct {
	// The full path to the folder you want to rename.
	FolderPath string `json:"folderPath,required"`
	// The new name for the folder.
	//
	// All characters except alphabets and numbers (inclusive of unicode letters,
	// marks, and numerals in other languages) and `-` will be replaced by an
	// underscore i.e. `_`.
	NewFolderName string `json:"newFolderName,required"`
	// Option to purge cache for the old nested files and their versions' URLs.
	//
	// When set to true, it will internally issue a purge cache request on CDN to
	// remove the cached content of the old nested files and their versions. There will
	// only be one purge request for all the nested files, which will be counted
	// against your monthly purge quota.
	//
	// Note: A purge cache request will be issued against
	// `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This
	// will remove all nested files, their versions' URLs, and any transformations made
	// using query parameters on these files or their versions. However, the cache for
	// file transformations made using path parameters will persist. You can purge them
	// using the purge API. For more details, refer to the purge API documentation.
	//
	// Default value - `false`
	PurgeCache param.Opt[bool] `json:"purgeCache,omitzero"`
	// contains filtered or unexported fields
}

func (FolderRenameParams) MarshalJSON

func (r FolderRenameParams) MarshalJSON() (data []byte, err error)

func (*FolderRenameParams) UnmarshalJSON

func (r *FolderRenameParams) UnmarshalJSON(data []byte) error

type FolderRenameResponse

type FolderRenameResponse struct {
	// Unique identifier of the bulk job. This can be used to check the status of the
	// bulk job.
	JobID string `json:"jobId,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		JobID       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Job submitted successfully. A `jobId` will be returned.

func (FolderRenameResponse) RawJSON

func (r FolderRenameResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FolderRenameResponse) UnmarshalJSON

func (r *FolderRenameResponse) UnmarshalJSON(data []byte) error

type FolderService

type FolderService struct {
	Options []option.RequestOption
	Job     FolderJobService
}

FolderService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFolderService method instead.

func NewFolderService

func NewFolderService(opts ...option.RequestOption) (r FolderService)

NewFolderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FolderService) Copy

This will copy one folder into another. The selected folder, its nested folders, files, and their versions (in `includeVersions` is set to true) are copied in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.

func (*FolderService) Delete

This will delete a folder and all its contents permanently. The API returns an empty response.

func (*FolderService) Move

This will move one folder into another. The selected folder, its nested folders, files, and their versions are moved in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.

func (*FolderService) New

This will create a new folder. You can specify the folder name and location of the parent folder where this new folder should be created.

func (*FolderService) Rename

This API allows you to rename an existing folder. The folder and all its nested assets and sub-folders will remain unchanged, but their paths will be updated to reflect the new folder name.

type FolderType

type FolderType string

Type of the asset.

const (
	FolderTypeFolder FolderType = "folder"
)

type ImageOverlayParam

type ImageOverlayParam = shared.ImageOverlayParam

This is an alias to an internal type.

type Metadata

type Metadata struct {
	// The audio codec used in the video (only for video).
	AudioCodec string `json:"audioCodec"`
	// The bit rate of the video in kbps (only for video).
	BitRate int64 `json:"bitRate"`
	// The density of the image in DPI.
	Density int64 `json:"density"`
	// The duration of the video in seconds (only for video).
	Duration int64        `json:"duration"`
	Exif     MetadataExif `json:"exif"`
	// The format of the file (e.g., 'jpg', 'mp4').
	Format string `json:"format"`
	// Indicates if the image has a color profile.
	HasColorProfile bool `json:"hasColorProfile"`
	// Indicates if the image contains transparent areas.
	HasTransparency bool `json:"hasTransparency"`
	// The height of the image or video in pixels.
	Height int64 `json:"height"`
	// Perceptual hash of the image.
	PHash string `json:"pHash"`
	// The quality indicator of the image.
	Quality int64 `json:"quality"`
	// The file size in bytes.
	Size int64 `json:"size"`
	// The video codec used in the video (only for video).
	VideoCodec string `json:"videoCodec"`
	// The width of the image or video in pixels.
	Width int64 `json:"width"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AudioCodec      respjson.Field
		BitRate         respjson.Field
		Density         respjson.Field
		Duration        respjson.Field
		Exif            respjson.Field
		Format          respjson.Field
		HasColorProfile respjson.Field
		HasTransparency respjson.Field
		Height          respjson.Field
		PHash           respjson.Field
		Quality         respjson.Field
		Size            respjson.Field
		VideoCodec      respjson.Field
		Width           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

JSON object containing metadata.

func (Metadata) RawJSON

func (r Metadata) RawJSON() string

Returns the unmodified JSON received from the API

func (*Metadata) UnmarshalJSON

func (r *Metadata) UnmarshalJSON(data []byte) error

type MetadataExif

type MetadataExif struct {
	// Object containing Exif details.
	Exif MetadataExifExif `json:"exif"`
	// Object containing GPS information.
	Gps MetadataExifGps `json:"gps"`
	// Object containing EXIF image information.
	Image MetadataExifImage `json:"image"`
	// JSON object.
	Interoperability MetadataExifInteroperability `json:"interoperability"`
	Makernote        map[string]any               `json:"makernote"`
	// Object containing Thumbnail information.
	Thumbnail MetadataExifThumbnail `json:"thumbnail"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Exif             respjson.Field
		Gps              respjson.Field
		Image            respjson.Field
		Interoperability respjson.Field
		Makernote        respjson.Field
		Thumbnail        respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MetadataExif) RawJSON

func (r MetadataExif) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetadataExif) UnmarshalJSON

func (r *MetadataExif) UnmarshalJSON(data []byte) error

type MetadataExifExif

type MetadataExifExif struct {
	ApertureValue            float64 `json:"ApertureValue"`
	ColorSpace               int64   `json:"ColorSpace"`
	CreateDate               string  `json:"CreateDate"`
	CustomRendered           int64   `json:"CustomRendered"`
	DateTimeOriginal         string  `json:"DateTimeOriginal"`
	ExifImageHeight          int64   `json:"ExifImageHeight"`
	ExifImageWidth           int64   `json:"ExifImageWidth"`
	ExifVersion              string  `json:"ExifVersion"`
	ExposureCompensation     float64 `json:"ExposureCompensation"`
	ExposureMode             int64   `json:"ExposureMode"`
	ExposureProgram          int64   `json:"ExposureProgram"`
	ExposureTime             float64 `json:"ExposureTime"`
	Flash                    int64   `json:"Flash"`
	FlashpixVersion          string  `json:"FlashpixVersion"`
	FNumber                  float64 `json:"FNumber"`
	FocalLength              int64   `json:"FocalLength"`
	FocalPlaneResolutionUnit int64   `json:"FocalPlaneResolutionUnit"`
	FocalPlaneXResolution    float64 `json:"FocalPlaneXResolution"`
	FocalPlaneYResolution    float64 `json:"FocalPlaneYResolution"`
	InteropOffset            int64   `json:"InteropOffset"`
	ISO                      int64   `json:"ISO"`
	MeteringMode             int64   `json:"MeteringMode"`
	SceneCaptureType         int64   `json:"SceneCaptureType"`
	ShutterSpeedValue        float64 `json:"ShutterSpeedValue"`
	SubSecTime               string  `json:"SubSecTime"`
	WhiteBalance             int64   `json:"WhiteBalance"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ApertureValue            respjson.Field
		ColorSpace               respjson.Field
		CreateDate               respjson.Field
		CustomRendered           respjson.Field
		DateTimeOriginal         respjson.Field
		ExifImageHeight          respjson.Field
		ExifImageWidth           respjson.Field
		ExifVersion              respjson.Field
		ExposureCompensation     respjson.Field
		ExposureMode             respjson.Field
		ExposureProgram          respjson.Field
		ExposureTime             respjson.Field
		Flash                    respjson.Field
		FlashpixVersion          respjson.Field
		FNumber                  respjson.Field
		FocalLength              respjson.Field
		FocalPlaneResolutionUnit respjson.Field
		FocalPlaneXResolution    respjson.Field
		FocalPlaneYResolution    respjson.Field
		InteropOffset            respjson.Field
		ISO                      respjson.Field
		MeteringMode             respjson.Field
		SceneCaptureType         respjson.Field
		ShutterSpeedValue        respjson.Field
		SubSecTime               respjson.Field
		WhiteBalance             respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing Exif details.

func (MetadataExifExif) RawJSON

func (r MetadataExifExif) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetadataExifExif) UnmarshalJSON

func (r *MetadataExifExif) UnmarshalJSON(data []byte) error

type MetadataExifGps

type MetadataExifGps struct {
	GpsVersionID []int64 `json:"GPSVersionID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GpsVersionID respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing GPS information.

func (MetadataExifGps) RawJSON

func (r MetadataExifGps) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetadataExifGps) UnmarshalJSON

func (r *MetadataExifGps) UnmarshalJSON(data []byte) error

type MetadataExifImage

type MetadataExifImage struct {
	ExifOffset       int64  `json:"ExifOffset"`
	GpsInfo          int64  `json:"GPSInfo"`
	Make             string `json:"Make"`
	Model            string `json:"Model"`
	ModifyDate       string `json:"ModifyDate"`
	Orientation      int64  `json:"Orientation"`
	ResolutionUnit   int64  `json:"ResolutionUnit"`
	Software         string `json:"Software"`
	XResolution      int64  `json:"XResolution"`
	YCbCrPositioning int64  `json:"YCbCrPositioning"`
	YResolution      int64  `json:"YResolution"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExifOffset       respjson.Field
		GpsInfo          respjson.Field
		Make             respjson.Field
		Model            respjson.Field
		ModifyDate       respjson.Field
		Orientation      respjson.Field
		ResolutionUnit   respjson.Field
		Software         respjson.Field
		XResolution      respjson.Field
		YCbCrPositioning respjson.Field
		YResolution      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing EXIF image information.

func (MetadataExifImage) RawJSON

func (r MetadataExifImage) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetadataExifImage) UnmarshalJSON

func (r *MetadataExifImage) UnmarshalJSON(data []byte) error

type MetadataExifInteroperability

type MetadataExifInteroperability struct {
	InteropIndex   string `json:"InteropIndex"`
	InteropVersion string `json:"InteropVersion"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InteropIndex   respjson.Field
		InteropVersion respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

JSON object.

func (MetadataExifInteroperability) RawJSON

Returns the unmodified JSON received from the API

func (*MetadataExifInteroperability) UnmarshalJSON

func (r *MetadataExifInteroperability) UnmarshalJSON(data []byte) error

type MetadataExifThumbnail

type MetadataExifThumbnail struct {
	Compression     int64 `json:"Compression"`
	ResolutionUnit  int64 `json:"ResolutionUnit"`
	ThumbnailLength int64 `json:"ThumbnailLength"`
	ThumbnailOffset int64 `json:"ThumbnailOffset"`
	XResolution     int64 `json:"XResolution"`
	YResolution     int64 `json:"YResolution"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Compression     respjson.Field
		ResolutionUnit  respjson.Field
		ThumbnailLength respjson.Field
		ThumbnailOffset respjson.Field
		XResolution     respjson.Field
		YResolution     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing Thumbnail information.

func (MetadataExifThumbnail) RawJSON

func (r MetadataExifThumbnail) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetadataExifThumbnail) UnmarshalJSON

func (r *MetadataExifThumbnail) UnmarshalJSON(data []byte) error

type OriginRequestAkeneoPimParam

type OriginRequestAkeneoPimParam struct {
	// Akeneo instance base URL.
	BaseURL string `json:"baseUrl,required" format:"uri"`
	// Akeneo API client ID.
	ClientID string `json:"clientId,required"`
	// Akeneo API client secret.
	ClientSecret string `json:"clientSecret,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Akeneo API password.
	Password string `json:"password,required"`
	// Akeneo API username.
	Username string `json:"username,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// This field can be elided, and will marshal its zero value as "AKENEO_PIM".
	Type constant.AkeneoPim `json:"type,required"`
	// contains filtered or unexported fields
}

The properties BaseURL, ClientID, ClientSecret, Name, Password, Type, Username are required.

func (OriginRequestAkeneoPimParam) MarshalJSON

func (r OriginRequestAkeneoPimParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestAkeneoPimParam) UnmarshalJSON

func (r *OriginRequestAkeneoPimParam) UnmarshalJSON(data []byte) error

type OriginRequestAzureBlobParam

type OriginRequestAzureBlobParam struct {
	AccountName string `json:"accountName,required"`
	Container   string `json:"container,required"`
	// Display name of the origin.
	Name     string `json:"name,required"`
	SasToken string `json:"sasToken,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool]   `json:"includeCanonicalHeader,omitzero"`
	Prefix                 param.Opt[string] `json:"prefix,omitzero"`
	// This field can be elided, and will marshal its zero value as "AZURE_BLOB".
	Type constant.AzureBlob `json:"type,required"`
	// contains filtered or unexported fields
}

The properties AccountName, Container, Name, SasToken, Type are required.

func (OriginRequestAzureBlobParam) MarshalJSON

func (r OriginRequestAzureBlobParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestAzureBlobParam) UnmarshalJSON

func (r *OriginRequestAzureBlobParam) UnmarshalJSON(data []byte) error

type OriginRequestCloudinaryBackupParam

type OriginRequestCloudinaryBackupParam struct {
	// Access key for the bucket.
	AccessKey string `json:"accessKey,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Secret key for the bucket.
	SecretKey string `json:"secretKey,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// Path prefix inside the bucket.
	Prefix param.Opt[string] `json:"prefix,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "CLOUDINARY_BACKUP".
	Type constant.CloudinaryBackup `json:"type,required"`
	// contains filtered or unexported fields
}

The properties AccessKey, Bucket, Name, SecretKey, Type are required.

func (OriginRequestCloudinaryBackupParam) MarshalJSON

func (r OriginRequestCloudinaryBackupParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestCloudinaryBackupParam) UnmarshalJSON

func (r *OriginRequestCloudinaryBackupParam) UnmarshalJSON(data []byte) error

type OriginRequestGcsParam

type OriginRequestGcsParam struct {
	Bucket      string `json:"bucket,required"`
	ClientEmail string `json:"clientEmail,required" format:"email"`
	// Display name of the origin.
	Name       string `json:"name,required"`
	PrivateKey string `json:"privateKey,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool]   `json:"includeCanonicalHeader,omitzero"`
	Prefix                 param.Opt[string] `json:"prefix,omitzero"`
	// This field can be elided, and will marshal its zero value as "GCS".
	Type constant.Gcs `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Bucket, ClientEmail, Name, PrivateKey, Type are required.

func (OriginRequestGcsParam) MarshalJSON

func (r OriginRequestGcsParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestGcsParam) UnmarshalJSON

func (r *OriginRequestGcsParam) UnmarshalJSON(data []byte) error

type OriginRequestS3CompatibleParam

type OriginRequestS3CompatibleParam struct {
	// Access key for the bucket.
	AccessKey string `json:"accessKey,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Custom S3-compatible endpoint.
	Endpoint string `json:"endpoint,required" format:"uri"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Secret key for the bucket.
	SecretKey string `json:"secretKey,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// Path prefix inside the bucket.
	Prefix param.Opt[string] `json:"prefix,omitzero"`
	// Use path-style S3 URLs?
	S3ForcePathStyle param.Opt[bool] `json:"s3ForcePathStyle,omitzero"`
	// This field can be elided, and will marshal its zero value as "S3_COMPATIBLE".
	Type constant.S3Compatible `json:"type,required"`
	// contains filtered or unexported fields
}

The properties AccessKey, Bucket, Endpoint, Name, SecretKey, Type are required.

func (OriginRequestS3CompatibleParam) MarshalJSON

func (r OriginRequestS3CompatibleParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestS3CompatibleParam) UnmarshalJSON

func (r *OriginRequestS3CompatibleParam) UnmarshalJSON(data []byte) error

type OriginRequestS3Param

type OriginRequestS3Param struct {
	// Access key for the bucket.
	AccessKey string `json:"accessKey,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Secret key for the bucket.
	SecretKey string `json:"secretKey,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// Path prefix inside the bucket.
	Prefix param.Opt[string] `json:"prefix,omitzero"`
	// This field can be elided, and will marshal its zero value as "S3".
	Type constant.S3 `json:"type,required"`
	// contains filtered or unexported fields
}

The properties AccessKey, Bucket, Name, SecretKey, Type are required.

func (OriginRequestS3Param) MarshalJSON

func (r OriginRequestS3Param) MarshalJSON() (data []byte, err error)

func (*OriginRequestS3Param) UnmarshalJSON

func (r *OriginRequestS3Param) UnmarshalJSON(data []byte) error

type OriginRequestUnionParam

type OriginRequestUnionParam struct {
	OfS3               *OriginRequestS3Param               `json:",omitzero,inline"`
	OfS3Compatible     *OriginRequestS3CompatibleParam     `json:",omitzero,inline"`
	OfCloudinaryBackup *OriginRequestCloudinaryBackupParam `json:",omitzero,inline"`
	OfWebFolder        *OriginRequestWebFolderParam        `json:",omitzero,inline"`
	OfWebProxy         *OriginRequestWebProxyParam         `json:",omitzero,inline"`
	OfGcs              *OriginRequestGcsParam              `json:",omitzero,inline"`
	OfAzureBlob        *OriginRequestAzureBlobParam        `json:",omitzero,inline"`
	OfAkeneoPim        *OriginRequestAkeneoPimParam        `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func OriginRequestParamOfWebFolder

func OriginRequestParamOfWebFolder(baseURL string, name string) OriginRequestUnionParam

func OriginRequestParamOfWebProxy

func OriginRequestParamOfWebProxy(name string) OriginRequestUnionParam

func (OriginRequestUnionParam) GetAccessKey

func (u OriginRequestUnionParam) GetAccessKey() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetAccountName

func (u OriginRequestUnionParam) GetAccountName() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetBaseURL

func (u OriginRequestUnionParam) GetBaseURL() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetBaseURLForCanonicalHeader

func (u OriginRequestUnionParam) GetBaseURLForCanonicalHeader() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetBucket

func (u OriginRequestUnionParam) GetBucket() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetClientEmail

func (u OriginRequestUnionParam) GetClientEmail() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetClientID

func (u OriginRequestUnionParam) GetClientID() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetClientSecret

func (u OriginRequestUnionParam) GetClientSecret() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetContainer

func (u OriginRequestUnionParam) GetContainer() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetEndpoint

func (u OriginRequestUnionParam) GetEndpoint() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetForwardHostHeaderToOrigin

func (u OriginRequestUnionParam) GetForwardHostHeaderToOrigin() *bool

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetIncludeCanonicalHeader

func (u OriginRequestUnionParam) GetIncludeCanonicalHeader() *bool

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetName

func (u OriginRequestUnionParam) GetName() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetPassword

func (u OriginRequestUnionParam) GetPassword() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetPrefix

func (u OriginRequestUnionParam) GetPrefix() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetPrivateKey

func (u OriginRequestUnionParam) GetPrivateKey() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetS3ForcePathStyle

func (u OriginRequestUnionParam) GetS3ForcePathStyle() *bool

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetSasToken

func (u OriginRequestUnionParam) GetSasToken() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetSecretKey

func (u OriginRequestUnionParam) GetSecretKey() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetType

func (u OriginRequestUnionParam) GetType() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) GetUsername

func (u OriginRequestUnionParam) GetUsername() *string

Returns a pointer to the underlying variant's property, if present.

func (OriginRequestUnionParam) MarshalJSON

func (u OriginRequestUnionParam) MarshalJSON() ([]byte, error)

func (*OriginRequestUnionParam) UnmarshalJSON

func (u *OriginRequestUnionParam) UnmarshalJSON(data []byte) error

type OriginRequestWebFolderParam

type OriginRequestWebFolderParam struct {
	// Root URL for the web folder origin.
	BaseURL string `json:"baseUrl,required" format:"uri"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Forward the Host header to origin?
	ForwardHostHeaderToOrigin param.Opt[bool] `json:"forwardHostHeaderToOrigin,omitzero"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// This field can be elided, and will marshal its zero value as "WEB_FOLDER".
	Type constant.WebFolder `json:"type,required"`
	// contains filtered or unexported fields
}

The properties BaseURL, Name, Type are required.

func (OriginRequestWebFolderParam) MarshalJSON

func (r OriginRequestWebFolderParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestWebFolderParam) UnmarshalJSON

func (r *OriginRequestWebFolderParam) UnmarshalJSON(data []byte) error

type OriginRequestWebProxyParam

type OriginRequestWebProxyParam struct {
	// Display name of the origin.
	Name string `json:"name,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
	// This field can be elided, and will marshal its zero value as "WEB_PROXY".
	Type constant.WebProxy `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Name, Type are required.

func (OriginRequestWebProxyParam) MarshalJSON

func (r OriginRequestWebProxyParam) MarshalJSON() (data []byte, err error)

func (*OriginRequestWebProxyParam) UnmarshalJSON

func (r *OriginRequestWebProxyParam) UnmarshalJSON(data []byte) error

type OriginResponseAkeneoPim

type OriginResponseAkeneoPim struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// Akeneo instance base URL.
	BaseURL string `json:"baseUrl,required" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string             `json:"name,required"`
	Type constant.AkeneoPim `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		BaseURL                   respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseAkeneoPim) RawJSON

func (r OriginResponseAkeneoPim) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseAkeneoPim) UnmarshalJSON

func (r *OriginResponseAkeneoPim) UnmarshalJSON(data []byte) error

type OriginResponseAzureBlob

type OriginResponseAzureBlob struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID          string `json:"id,required"`
	AccountName string `json:"accountName,required"`
	Container   string `json:"container,required"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name   string             `json:"name,required"`
	Prefix string             `json:"prefix,required"`
	Type   constant.AzureBlob `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		AccountName               respjson.Field
		Container                 respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseAzureBlob) RawJSON

func (r OriginResponseAzureBlob) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseAzureBlob) UnmarshalJSON

func (r *OriginResponseAzureBlob) UnmarshalJSON(data []byte) error

type OriginResponseCloudinaryBackup

type OriginResponseCloudinaryBackup struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Path prefix inside the bucket.
	Prefix string                    `json:"prefix,required"`
	Type   constant.CloudinaryBackup `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		Bucket                    respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseCloudinaryBackup) RawJSON

Returns the unmodified JSON received from the API

func (*OriginResponseCloudinaryBackup) UnmarshalJSON

func (r *OriginResponseCloudinaryBackup) UnmarshalJSON(data []byte) error

type OriginResponseGcs

type OriginResponseGcs struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID          string `json:"id,required"`
	Bucket      string `json:"bucket,required"`
	ClientEmail string `json:"clientEmail,required" format:"email"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name   string       `json:"name,required"`
	Prefix string       `json:"prefix,required"`
	Type   constant.Gcs `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		Bucket                    respjson.Field
		ClientEmail               respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseGcs) RawJSON

func (r OriginResponseGcs) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseGcs) UnmarshalJSON

func (r *OriginResponseGcs) UnmarshalJSON(data []byte) error

type OriginResponseS3

type OriginResponseS3 struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Path prefix inside the bucket.
	Prefix string      `json:"prefix,required"`
	Type   constant.S3 `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		Bucket                    respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseS3) RawJSON

func (r OriginResponseS3) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseS3) UnmarshalJSON

func (r *OriginResponseS3) UnmarshalJSON(data []byte) error

type OriginResponseS3Compatible

type OriginResponseS3Compatible struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// S3 bucket name.
	Bucket string `json:"bucket,required"`
	// Custom S3-compatible endpoint.
	Endpoint string `json:"endpoint,required" format:"uri"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string `json:"name,required"`
	// Path prefix inside the bucket.
	Prefix string `json:"prefix,required"`
	// Use path-style S3 URLs?
	S3ForcePathStyle bool                  `json:"s3ForcePathStyle,required"`
	Type             constant.S3Compatible `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		Bucket                    respjson.Field
		Endpoint                  respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		S3ForcePathStyle          respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseS3Compatible) RawJSON

func (r OriginResponseS3Compatible) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseS3Compatible) UnmarshalJSON

func (r *OriginResponseS3Compatible) UnmarshalJSON(data []byte) error

type OriginResponseUnion

type OriginResponseUnion struct {
	ID                     string `json:"id"`
	Bucket                 string `json:"bucket"`
	IncludeCanonicalHeader bool   `json:"includeCanonicalHeader"`
	Name                   string `json:"name"`
	Prefix                 string `json:"prefix"`
	// Any of "S3", "S3_COMPATIBLE", "CLOUDINARY_BACKUP", "WEB_FOLDER", "WEB_PROXY",
	// "GCS", "AZURE_BLOB", "AKENEO_PIM".
	Type                      string `json:"type"`
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader"`
	// This field is from variant [OriginResponseS3Compatible].
	Endpoint string `json:"endpoint"`
	// This field is from variant [OriginResponseS3Compatible].
	S3ForcePathStyle bool   `json:"s3ForcePathStyle"`
	BaseURL          string `json:"baseUrl"`
	// This field is from variant [OriginResponseWebFolder].
	ForwardHostHeaderToOrigin bool `json:"forwardHostHeaderToOrigin"`
	// This field is from variant [OriginResponseGcs].
	ClientEmail string `json:"clientEmail"`
	// This field is from variant [OriginResponseAzureBlob].
	AccountName string `json:"accountName"`
	// This field is from variant [OriginResponseAzureBlob].
	Container string `json:"container"`
	JSON      struct {
		ID                        respjson.Field
		Bucket                    respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Prefix                    respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		Endpoint                  respjson.Field
		S3ForcePathStyle          respjson.Field
		BaseURL                   respjson.Field
		ForwardHostHeaderToOrigin respjson.Field
		ClientEmail               respjson.Field
		AccountName               respjson.Field
		Container                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

OriginResponseUnion contains all possible properties and values from OriginResponseS3, OriginResponseS3Compatible, OriginResponseCloudinaryBackup, OriginResponseWebFolder, OriginResponseWebProxy, OriginResponseGcs, OriginResponseAzureBlob, OriginResponseAkeneoPim.

Use the OriginResponseUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (OriginResponseUnion) AsAkeneoPim

func (u OriginResponseUnion) AsAkeneoPim() (v OriginResponseAkeneoPim)

func (OriginResponseUnion) AsAny

func (u OriginResponseUnion) AsAny() anyOriginResponse

Use the following switch statement to find the correct variant

switch variant := OriginResponseUnion.AsAny().(type) {
case imagekit.OriginResponseS3:
case imagekit.OriginResponseS3Compatible:
case imagekit.OriginResponseCloudinaryBackup:
case imagekit.OriginResponseWebFolder:
case imagekit.OriginResponseWebProxy:
case imagekit.OriginResponseGcs:
case imagekit.OriginResponseAzureBlob:
case imagekit.OriginResponseAkeneoPim:
default:
  fmt.Errorf("no variant present")
}

func (OriginResponseUnion) AsAzureBlob

func (u OriginResponseUnion) AsAzureBlob() (v OriginResponseAzureBlob)

func (OriginResponseUnion) AsCloudinaryBackup

func (u OriginResponseUnion) AsCloudinaryBackup() (v OriginResponseCloudinaryBackup)

func (OriginResponseUnion) AsGcs

func (u OriginResponseUnion) AsGcs() (v OriginResponseGcs)

func (OriginResponseUnion) AsS3

func (OriginResponseUnion) AsS3Compatible

func (u OriginResponseUnion) AsS3Compatible() (v OriginResponseS3Compatible)

func (OriginResponseUnion) AsWebFolder

func (u OriginResponseUnion) AsWebFolder() (v OriginResponseWebFolder)

func (OriginResponseUnion) AsWebProxy

func (u OriginResponseUnion) AsWebProxy() (v OriginResponseWebProxy)

func (OriginResponseUnion) RawJSON

func (u OriginResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseUnion) UnmarshalJSON

func (r *OriginResponseUnion) UnmarshalJSON(data []byte) error

type OriginResponseWebFolder

type OriginResponseWebFolder struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// Root URL for the web folder origin.
	BaseURL string `json:"baseUrl,required" format:"uri"`
	// Forward the Host header to origin?
	ForwardHostHeaderToOrigin bool `json:"forwardHostHeaderToOrigin,required"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string             `json:"name,required"`
	Type constant.WebFolder `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		BaseURL                   respjson.Field
		ForwardHostHeaderToOrigin respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseWebFolder) RawJSON

func (r OriginResponseWebFolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseWebFolder) UnmarshalJSON

func (r *OriginResponseWebFolder) UnmarshalJSON(data []byte) error

type OriginResponseWebProxy

type OriginResponseWebProxy struct {
	// Unique identifier for the origin. This is generated by ImageKit when you create
	// a new origin.
	ID string `json:"id,required"`
	// Whether to send a Canonical header.
	IncludeCanonicalHeader bool `json:"includeCanonicalHeader,required"`
	// Display name of the origin.
	Name string            `json:"name,required"`
	Type constant.WebProxy `json:"type,required"`
	// URL used in the Canonical header (if enabled).
	BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		IncludeCanonicalHeader    respjson.Field
		Name                      respjson.Field
		Type                      respjson.Field
		BaseURLForCanonicalHeader respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OriginResponseWebProxy) RawJSON

func (r OriginResponseWebProxy) RawJSON() string

Returns the unmodified JSON received from the API

func (*OriginResponseWebProxy) UnmarshalJSON

func (r *OriginResponseWebProxy) UnmarshalJSON(data []byte) error

type OverlayPositionFocus

type OverlayPositionFocus = shared.OverlayPositionFocus

Specifies the position of the overlay relative to the parent image or video. Maps to `lfo` in the URL.

This is an alias to an internal type.

type OverlayPositionParam

type OverlayPositionParam = shared.OverlayPositionParam

This is an alias to an internal type.

type OverlayPositionXUnionParam

type OverlayPositionXUnionParam = shared.OverlayPositionXUnionParam

Specifies the x-coordinate of the top-left corner of the base asset where the overlay's top-left corner will be positioned. It also accepts arithmetic expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn about [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).

This is an alias to an internal type.

type OverlayPositionYUnionParam

type OverlayPositionYUnionParam = shared.OverlayPositionYUnionParam

Specifies the y-coordinate of the top-left corner of the base asset where the overlay's top-left corner will be positioned. It also accepts arithmetic expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn about [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).

This is an alias to an internal type.

type OverlayTimingDurationUnionParam

type OverlayTimingDurationUnionParam = shared.OverlayTimingDurationUnionParam

Specifies the duration (in seconds) during which the overlay should appear on the base video. Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if the base asset is a video. Maps to `ldu` in the URL.

This is an alias to an internal type.

type OverlayTimingEndUnionParam

type OverlayTimingEndUnionParam = shared.OverlayTimingEndUnionParam

Specifies the end time (in seconds) for when the overlay should disappear from the base video. If both end and duration are provided, duration is ignored. Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if the base asset is a video. Maps to `leo` in the URL.

This is an alias to an internal type.

type OverlayTimingParam

type OverlayTimingParam = shared.OverlayTimingParam

This is an alias to an internal type.

type OverlayTimingStartUnionParam

type OverlayTimingStartUnionParam = shared.OverlayTimingStartUnionParam

Specifies the start time (in seconds) for when the overlay should appear on the base video. Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if the base asset is a video. Maps to `lso` in the URL.

This is an alias to an internal type.

type OverlayUnionParam

type OverlayUnionParam = shared.OverlayUnionParam

Specifies an overlay to be applied on the parent image or video. ImageKit supports overlays including images, text, videos, subtitles, and solid colors. See [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers).

This is an alias to an internal type.

type SolidColorOverlayParam

type SolidColorOverlayParam = shared.SolidColorOverlayParam

This is an alias to an internal type.

type SolidColorOverlayTransformationGradientBoolean

type SolidColorOverlayTransformationGradientBoolean = shared.SolidColorOverlayTransformationGradientBoolean

This is an alias to an internal type.

type SolidColorOverlayTransformationGradientUnionParam

type SolidColorOverlayTransformationGradientUnionParam = shared.SolidColorOverlayTransformationGradientUnionParam

Creates a linear gradient with two colors. Pass `true` for a default gradient, or provide a string for a custom gradient. Only works if the base asset is an image. See [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient).

This is an alias to an internal type.

type SolidColorOverlayTransformationHeightUnionParam

type SolidColorOverlayTransformationHeightUnionParam = shared.SolidColorOverlayTransformationHeightUnionParam

Controls the height of the solid color overlay. Accepts a numeric value or an arithmetic expression. Learn about [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).

This is an alias to an internal type.

type SolidColorOverlayTransformationParam

type SolidColorOverlayTransformationParam = shared.SolidColorOverlayTransformationParam

This is an alias to an internal type.

type SolidColorOverlayTransformationRadiusUnionParam

type SolidColorOverlayTransformationRadiusUnionParam = shared.SolidColorOverlayTransformationRadiusUnionParam

Specifies the corner radius of the solid color overlay. Set to `max` for circular or oval shape. See [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).

This is an alias to an internal type.

type SolidColorOverlayTransformationWidthUnionParam

type SolidColorOverlayTransformationWidthUnionParam = shared.SolidColorOverlayTransformationWidthUnionParam

Controls the width of the solid color overlay. Accepts a numeric value or an arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).

This is an alias to an internal type.

type SrcOptionsParam

type SrcOptionsParam = shared.SrcOptionsParam

Options for generating ImageKit URLs with transformations. See the [Transformations guide](https://imagekit.io/docs/transformations).

This is an alias to an internal type.

type StreamingResolution

type StreamingResolution = shared.StreamingResolution

Available streaming resolutions for [adaptive bitrate streaming](https://imagekit.io/docs/adaptive-bitrate-streaming)

This is an alias to an internal type.

type SubtitleOverlayParam

type SubtitleOverlayParam = shared.SubtitleOverlayParam

This is an alias to an internal type.

type SubtitleOverlayTransformationParam

type SubtitleOverlayTransformationParam = shared.SubtitleOverlayTransformationParam

Subtitle styling options. [Learn more](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) from the docs.

This is an alias to an internal type.

type SubtitleOverlayTransformationTypography

type SubtitleOverlayTransformationTypography = shared.SubtitleOverlayTransformationTypography

Sets the typography style of the subtitle text. Supports values are `b` for bold, `i` for italics, and `b_i` for bold with italics.

[Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer)

This is an alias to an internal type.

type TextOverlayParam

type TextOverlayParam = shared.TextOverlayParam

This is an alias to an internal type.

type TextOverlayTransformationFlip

type TextOverlayTransformationFlip = shared.TextOverlayTransformationFlip

Flip the text overlay horizontally, vertically, or both.

This is an alias to an internal type.

type TextOverlayTransformationFontSizeUnionParam

type TextOverlayTransformationFontSizeUnionParam = shared.TextOverlayTransformationFontSizeUnionParam

Specifies the font size of the overlaid text. Accepts a numeric value or an arithmetic expression.

This is an alias to an internal type.

type TextOverlayTransformationInnerAlignment

type TextOverlayTransformationInnerAlignment = shared.TextOverlayTransformationInnerAlignment

Specifies the inner alignment of the text when width is more than the text length.

This is an alias to an internal type.

type TextOverlayTransformationLineHeightUnionParam

type TextOverlayTransformationLineHeightUnionParam = shared.TextOverlayTransformationLineHeightUnionParam

Specifies the line height of the text overlay. Accepts integer values representing line height in points. It can also accept [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) such as `bw_mul_0.2`, or `bh_div_20`.

This is an alias to an internal type.

type TextOverlayTransformationPaddingUnionParam

type TextOverlayTransformationPaddingUnionParam = shared.TextOverlayTransformationPaddingUnionParam

Specifies the padding around the overlaid text. Can be provided as a single positive integer or multiple values separated by underscores (following CSS shorthand order). Arithmetic expressions are also accepted.

This is an alias to an internal type.

type TextOverlayTransformationParam

type TextOverlayTransformationParam = shared.TextOverlayTransformationParam

This is an alias to an internal type.

type TextOverlayTransformationRadiusUnionParam

type TextOverlayTransformationRadiusUnionParam = shared.TextOverlayTransformationRadiusUnionParam

Specifies the corner radius of the text overlay. Set to `max` to achieve a circular or oval shape.

This is an alias to an internal type.

type TextOverlayTransformationRotationUnionParam

type TextOverlayTransformationRotationUnionParam = shared.TextOverlayTransformationRotationUnionParam

Specifies the rotation angle of the text overlay. Accepts a numeric value for clockwise rotation or a string prefixed with "N" for counter-clockwise rotation.

This is an alias to an internal type.

type TextOverlayTransformationWidthUnionParam

type TextOverlayTransformationWidthUnionParam = shared.TextOverlayTransformationWidthUnionParam

Specifies the maximum width (in pixels) of the overlaid text. The text wraps automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are supported. Useful when used in conjunction with the `background`. Learn about [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).

This is an alias to an internal type.

type TransformationAIDropShadowBoolean

type TransformationAIDropShadowBoolean = shared.TransformationAIDropShadowBoolean

This is an alias to an internal type.

type TransformationAIDropShadowUnionParam

type TransformationAIDropShadowUnionParam = shared.TransformationAIDropShadowUnionParam

Adds an AI-based drop shadow around a foreground object on a transparent or removed background. Optionally, control the direction, elevation, and saturation of the light source (e.g., `az-45` to change light direction). Pass `true` for the default drop shadow, or provide a string for a custom drop shadow. Supported inside overlay. See [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow).

This is an alias to an internal type.

type TransformationAspectRatioUnionParam

type TransformationAspectRatioUnionParam = shared.TransformationAspectRatioUnionParam

Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, or an expression like `iar_div_2`. See [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar).

This is an alias to an internal type.

type TransformationAudioCodec

type TransformationAudioCodec = shared.TransformationAudioCodec

Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac).

This is an alias to an internal type.

type TransformationCrop

type TransformationCrop = shared.TransformationCrop

Crop modes for image resizing. See [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).

This is an alias to an internal type.

type TransformationCropMode

type TransformationCropMode = shared.TransformationCropMode

Additional crop modes for image resizing. See [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).

This is an alias to an internal type.

type TransformationDurationUnionParam

type TransformationDurationUnionParam = shared.TransformationDurationUnionParam

Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. Typically used with startOffset to indicate the length from the start offset. Arithmetic expressions are supported. See [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du).

This is an alias to an internal type.

type TransformationEndOffsetUnionParam

type TransformationEndOffsetUnionParam = shared.TransformationEndOffsetUnionParam

Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. Typically used with startOffset to define a time window. Arithmetic expressions are supported. See [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo).

This is an alias to an internal type.

type TransformationFlip

type TransformationFlip = shared.TransformationFlip

Flips or mirrors an image either horizontally, vertically, or both. Acceptable values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl).

This is an alias to an internal type.

type TransformationFormat

type TransformationFormat = shared.TransformationFormat

Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, `mp4`, or `auto`. You can also pass `orig` for images to return the original format. ImageKit automatically delivers images and videos in the optimal format based on device support unless overridden by the dashboard settings or the format parameter. See [Image format](https://imagekit.io/docs/image-optimization#format---f) and [Video format](https://imagekit.io/docs/video-optimization#format---f).

This is an alias to an internal type.

type TransformationGradientBoolean

type TransformationGradientBoolean = shared.TransformationGradientBoolean

This is an alias to an internal type.

type TransformationGradientUnionParam

type TransformationGradientUnionParam = shared.TransformationGradientUnionParam

Creates a linear gradient with two colors. Pass `true` for a default gradient, or provide a string for a custom gradient. See [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient).

This is an alias to an internal type.

type TransformationHeightUnionParam

type TransformationHeightUnionParam = shared.TransformationHeightUnionParam

Specifies the height of the output. If a value between 0 and 1 is provided, it is treated as a percentage (e.g., `0.5` represents 50% of the original height). You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height transformation – [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h)

This is an alias to an internal type.

type TransformationPageUnionParam

type TransformationPageUnionParam = shared.TransformationPageUnionParam

Extracts a specific page or frame from multi-page or layered files (PDF, PSD, AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files).

This is an alias to an internal type.

type TransformationParam

type TransformationParam = shared.TransformationParam

The SDK provides easy-to-use names for transformations. These names are converted to the corresponding transformation string before being added to the URL. SDKs are updated regularly to support new transformations. If you want to use a transformation that is not supported by the SDK, You can use the `raw` parameter to pass the transformation string directly. See the [Transformations documentation](https://imagekit.io/docs/transformations).

This is an alias to an internal type.

type TransformationPosition

type TransformationPosition = shared.TransformationPosition

By default, the transformation string is added as a query parameter in the URL, e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the path of the URL, set this to `path`. Learn more in the [Transformations guide](https://imagekit.io/docs/transformations).

This is an alias to an internal type.

type TransformationRadiusUnionParam

type TransformationRadiusUnionParam = shared.TransformationRadiusUnionParam

Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular or oval shape. See [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).

This is an alias to an internal type.

type TransformationRotationUnionParam

type TransformationRotationUnionParam = shared.TransformationRotationUnionParam

Specifies the rotation angle in degrees. Positive values rotate the image clockwise; you can also use, for example, `N40` for counterclockwise rotation or `auto` to use the orientation specified in the image's EXIF data. For videos, only the following values are supported: 0, 90, 180, 270, or 360. See [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt).

This is an alias to an internal type.

type TransformationShadowBoolean

type TransformationShadowBoolean = shared.TransformationShadowBoolean

This is an alias to an internal type.

type TransformationShadowUnionParam

type TransformationShadowUnionParam = shared.TransformationShadowUnionParam

Adds a shadow beneath solid objects in an image with a transparent background. For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default shadow, or provide a string for a custom shadow. See [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow).

This is an alias to an internal type.

type TransformationSharpenBoolean

type TransformationSharpenBoolean = shared.TransformationSharpenBoolean

This is an alias to an internal type.

type TransformationSharpenUnionParam

type TransformationSharpenUnionParam = shared.TransformationSharpenUnionParam

Sharpens the input image, highlighting edges and finer details. Pass `true` for default sharpening, or provide a numeric value for custom sharpening. See [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen).

This is an alias to an internal type.

type TransformationStartOffsetUnionParam

type TransformationStartOffsetUnionParam = shared.TransformationStartOffsetUnionParam

Specifies the start offset (in seconds) for trimming videos, e.g., `5` or `10.5`. Arithmetic expressions are also supported. See [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so).

This is an alias to an internal type.

type TransformationTrimBoolean

type TransformationTrimBoolean = shared.TransformationTrimBoolean

This is an alias to an internal type.

type TransformationTrimUnionParam

type TransformationTrimUnionParam = shared.TransformationTrimUnionParam

Useful for images with a solid or nearly solid background and a central object. This parameter trims the background, leaving only the central object in the output image. See [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t).

This is an alias to an internal type.

type TransformationUnsharpMaskBoolean

type TransformationUnsharpMaskBoolean = shared.TransformationUnsharpMaskBoolean

This is an alias to an internal type.

type TransformationUnsharpMaskUnionParam

type TransformationUnsharpMaskUnionParam = shared.TransformationUnsharpMaskUnionParam

Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a default unsharp mask, or provide a string for a custom unsharp mask. See [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm).

This is an alias to an internal type.

type TransformationVideoCodec

type TransformationVideoCodec = shared.TransformationVideoCodec

Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc).

This is an alias to an internal type.

type TransformationWidthUnionParam

type TransformationWidthUnionParam = shared.TransformationWidthUnionParam

Specifies the width of the output. If a value between 0 and 1 is provided, it is treated as a percentage (e.g., `0.4` represents 40% of the original width). You can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w)

This is an alias to an internal type.

type TransformationXCenterUnionParam

type TransformationXCenterUnionParam = shared.TransformationXCenterUnionParam

Focus using cropped image coordinates - X center coordinate. See [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates).

This is an alias to an internal type.

type TransformationXUnionParam

type TransformationXUnionParam = shared.TransformationXUnionParam

Focus using cropped image coordinates - X coordinate. See [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates).

This is an alias to an internal type.

type TransformationYCenterUnionParam

type TransformationYCenterUnionParam = shared.TransformationYCenterUnionParam

Focus using cropped image coordinates - Y center coordinate. See [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates).

This is an alias to an internal type.

type TransformationYUnionParam

type TransformationYUnionParam = shared.TransformationYUnionParam

Focus using cropped image coordinates - Y coordinate. See [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates).

This is an alias to an internal type.

type URLEndpointRequestParam

type URLEndpointRequestParam struct {
	// Description of the URL endpoint.
	Description string `json:"description,required"`
	// Path segment appended to your base URL to form the endpoint (letters, digits,
	// and hyphens only — or empty for the default endpoint).
	URLPrefix param.Opt[string] `json:"urlPrefix,omitzero"`
	// Ordered list of origin IDs to try when the file isn’t in the Media Library;
	// ImageKit checks them in the sequence provided. Origin must be created before it
	// can be used in a URL endpoint.
	Origins []string `json:"origins,omitzero"`
	// Configuration for third-party URL rewriting.
	URLRewriter URLEndpointRequestURLRewriterUnionParam `json:"urlRewriter,omitzero"`
	// contains filtered or unexported fields
}

Schema for URL endpoint resource.

The property Description is required.

func (URLEndpointRequestParam) MarshalJSON

func (r URLEndpointRequestParam) MarshalJSON() (data []byte, err error)

func (*URLEndpointRequestParam) UnmarshalJSON

func (r *URLEndpointRequestParam) UnmarshalJSON(data []byte) error

type URLEndpointRequestURLRewriterAkamaiParam

type URLEndpointRequestURLRewriterAkamaiParam struct {
	Type constant.Akamai `json:"type,required"`
	// contains filtered or unexported fields
}

This struct has a constant value, construct it with NewURLEndpointRequestURLRewriterAkamaiParam.

func NewURLEndpointRequestURLRewriterAkamaiParam

func NewURLEndpointRequestURLRewriterAkamaiParam() URLEndpointRequestURLRewriterAkamaiParam

func (URLEndpointRequestURLRewriterAkamaiParam) MarshalJSON

func (r URLEndpointRequestURLRewriterAkamaiParam) MarshalJSON() (data []byte, err error)

func (*URLEndpointRequestURLRewriterAkamaiParam) UnmarshalJSON

func (r *URLEndpointRequestURLRewriterAkamaiParam) UnmarshalJSON(data []byte) error

type URLEndpointRequestURLRewriterCloudinaryParam

type URLEndpointRequestURLRewriterCloudinaryParam struct {
	// Whether to preserve `<asset_type>/<delivery_type>` in the rewritten URL.
	PreserveAssetDeliveryTypes param.Opt[bool] `json:"preserveAssetDeliveryTypes,omitzero"`
	// This field can be elided, and will marshal its zero value as "CLOUDINARY".
	Type constant.Cloudinary `json:"type,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (URLEndpointRequestURLRewriterCloudinaryParam) MarshalJSON

func (r URLEndpointRequestURLRewriterCloudinaryParam) MarshalJSON() (data []byte, err error)

func (*URLEndpointRequestURLRewriterCloudinaryParam) UnmarshalJSON

func (r *URLEndpointRequestURLRewriterCloudinaryParam) UnmarshalJSON(data []byte) error

type URLEndpointRequestURLRewriterImgixParam

type URLEndpointRequestURLRewriterImgixParam struct {
	Type constant.Imgix `json:"type,required"`
	// contains filtered or unexported fields
}

This struct has a constant value, construct it with NewURLEndpointRequestURLRewriterImgixParam.

func NewURLEndpointRequestURLRewriterImgixParam

func NewURLEndpointRequestURLRewriterImgixParam() URLEndpointRequestURLRewriterImgixParam

func (URLEndpointRequestURLRewriterImgixParam) MarshalJSON

func (r URLEndpointRequestURLRewriterImgixParam) MarshalJSON() (data []byte, err error)

func (*URLEndpointRequestURLRewriterImgixParam) UnmarshalJSON

func (r *URLEndpointRequestURLRewriterImgixParam) UnmarshalJSON(data []byte) error

type URLEndpointRequestURLRewriterUnionParam

type URLEndpointRequestURLRewriterUnionParam struct {
	OfCloudinary *URLEndpointRequestURLRewriterCloudinaryParam `json:",omitzero,inline"`
	OfImgix      *URLEndpointRequestURLRewriterImgixParam      `json:",omitzero,inline"`
	OfAkamai     *URLEndpointRequestURLRewriterAkamaiParam     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (URLEndpointRequestURLRewriterUnionParam) GetPreserveAssetDeliveryTypes

func (u URLEndpointRequestURLRewriterUnionParam) GetPreserveAssetDeliveryTypes() *bool

Returns a pointer to the underlying variant's property, if present.

func (URLEndpointRequestURLRewriterUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (URLEndpointRequestURLRewriterUnionParam) MarshalJSON

func (u URLEndpointRequestURLRewriterUnionParam) MarshalJSON() ([]byte, error)

func (*URLEndpointRequestURLRewriterUnionParam) UnmarshalJSON

func (u *URLEndpointRequestURLRewriterUnionParam) UnmarshalJSON(data []byte) error

type URLEndpointResponse

type URLEndpointResponse struct {
	// Unique identifier for the URL-endpoint. This is generated by ImageKit when you
	// create a new URL-endpoint. For the default URL-endpoint, this is always
	// `default`.
	ID string `json:"id,required"`
	// Description of the URL endpoint.
	Description string `json:"description,required"`
	// Ordered list of origin IDs to try when the file isn’t in the Media Library;
	// ImageKit checks them in the sequence provided. Origin must be created before it
	// can be used in a URL endpoint.
	Origins []string `json:"origins,required"`
	// Path segment appended to your base URL to form the endpoint (letters, digits,
	// and hyphens only — or empty for the default endpoint).
	URLPrefix string `json:"urlPrefix,required"`
	// Configuration for third-party URL rewriting.
	URLRewriter URLEndpointResponseURLRewriterUnion `json:"urlRewriter"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Description respjson.Field
		Origins     respjson.Field
		URLPrefix   respjson.Field
		URLRewriter respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

URL‑endpoint object as returned by the API.

func (URLEndpointResponse) RawJSON

func (r URLEndpointResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*URLEndpointResponse) UnmarshalJSON

func (r *URLEndpointResponse) UnmarshalJSON(data []byte) error

type URLEndpointResponseURLRewriterAkamai

type URLEndpointResponseURLRewriterAkamai struct {
	Type constant.Akamai `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (URLEndpointResponseURLRewriterAkamai) RawJSON

Returns the unmodified JSON received from the API

func (*URLEndpointResponseURLRewriterAkamai) UnmarshalJSON

func (r *URLEndpointResponseURLRewriterAkamai) UnmarshalJSON(data []byte) error

type URLEndpointResponseURLRewriterCloudinary

type URLEndpointResponseURLRewriterCloudinary struct {
	// Whether to preserve `<asset_type>/<delivery_type>` in the rewritten URL.
	PreserveAssetDeliveryTypes bool                `json:"preserveAssetDeliveryTypes,required"`
	Type                       constant.Cloudinary `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PreserveAssetDeliveryTypes respjson.Field
		Type                       respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (URLEndpointResponseURLRewriterCloudinary) RawJSON

Returns the unmodified JSON received from the API

func (*URLEndpointResponseURLRewriterCloudinary) UnmarshalJSON

func (r *URLEndpointResponseURLRewriterCloudinary) UnmarshalJSON(data []byte) error

type URLEndpointResponseURLRewriterImgix

type URLEndpointResponseURLRewriterImgix struct {
	Type constant.Imgix `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (URLEndpointResponseURLRewriterImgix) RawJSON

Returns the unmodified JSON received from the API

func (*URLEndpointResponseURLRewriterImgix) UnmarshalJSON

func (r *URLEndpointResponseURLRewriterImgix) UnmarshalJSON(data []byte) error

type URLEndpointResponseURLRewriterUnion

type URLEndpointResponseURLRewriterUnion struct {
	// This field is from variant [URLEndpointResponseURLRewriterCloudinary].
	PreserveAssetDeliveryTypes bool `json:"preserveAssetDeliveryTypes"`
	// Any of "CLOUDINARY", "IMGIX", "AKAMAI".
	Type string `json:"type"`
	JSON struct {
		PreserveAssetDeliveryTypes respjson.Field
		Type                       respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

URLEndpointResponseURLRewriterUnion contains all possible properties and values from URLEndpointResponseURLRewriterCloudinary, URLEndpointResponseURLRewriterImgix, URLEndpointResponseURLRewriterAkamai.

Use the URLEndpointResponseURLRewriterUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (URLEndpointResponseURLRewriterUnion) AsAkamai

func (URLEndpointResponseURLRewriterUnion) AsAny

func (u URLEndpointResponseURLRewriterUnion) AsAny() anyURLEndpointResponseURLRewriter

Use the following switch statement to find the correct variant

switch variant := URLEndpointResponseURLRewriterUnion.AsAny().(type) {
case imagekit.URLEndpointResponseURLRewriterCloudinary:
case imagekit.URLEndpointResponseURLRewriterImgix:
case imagekit.URLEndpointResponseURLRewriterAkamai:
default:
  fmt.Errorf("no variant present")
}

func (URLEndpointResponseURLRewriterUnion) AsCloudinary

func (URLEndpointResponseURLRewriterUnion) AsImgix

func (URLEndpointResponseURLRewriterUnion) RawJSON

Returns the unmodified JSON received from the API

func (*URLEndpointResponseURLRewriterUnion) UnmarshalJSON

func (r *URLEndpointResponseURLRewriterUnion) UnmarshalJSON(data []byte) error

type UnsafeUnwrapWebhookEventUnion

type UnsafeUnwrapWebhookEventUnion struct {
	// This field is from variant [VideoTransformationAcceptedEvent],
	// [VideoTransformationReadyEvent], [VideoTransformationErrorEvent],
	// [UploadPreTransformSuccessEvent], [UploadPreTransformErrorEvent],
	// [UploadPostTransformSuccessEvent], [UploadPostTransformErrorEvent].
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	CreatedAt time.Time `json:"created_at"`
	// This field is a union of [VideoTransformationAcceptedEventData],
	// [VideoTransformationReadyEventData], [VideoTransformationErrorEventData],
	// [UploadPreTransformSuccessEventData], [UploadPreTransformErrorEventData],
	// [UploadPostTransformSuccessEventData], [UploadPostTransformErrorEventData]
	Data UnsafeUnwrapWebhookEventUnionData `json:"data"`
	// This field is a union of [VideoTransformationAcceptedEventRequest],
	// [VideoTransformationReadyEventRequest], [VideoTransformationErrorEventRequest],
	// [UploadPreTransformSuccessEventRequest], [UploadPreTransformErrorEventRequest],
	// [UploadPostTransformSuccessEventRequest], [UploadPostTransformErrorEventRequest]
	Request UnsafeUnwrapWebhookEventUnionRequest `json:"request"`
	// This field is from variant [VideoTransformationReadyEvent].
	Timings VideoTransformationReadyEventTimings `json:"timings"`
	JSON    struct {
		ID        respjson.Field
		Type      respjson.Field
		CreatedAt respjson.Field
		Data      respjson.Field
		Request   respjson.Field
		Timings   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnion contains all possible properties and values from VideoTransformationAcceptedEvent, VideoTransformationReadyEvent, VideoTransformationErrorEvent, UploadPreTransformSuccessEvent, UploadPreTransformErrorEvent, UploadPostTransformSuccessEvent, UploadPostTransformErrorEvent.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (UnsafeUnwrapWebhookEventUnion) AsUploadPostTransformErrorEvent

func (u UnsafeUnwrapWebhookEventUnion) AsUploadPostTransformErrorEvent() (v UploadPostTransformErrorEvent)

func (UnsafeUnwrapWebhookEventUnion) AsUploadPostTransformSuccessEvent

func (u UnsafeUnwrapWebhookEventUnion) AsUploadPostTransformSuccessEvent() (v UploadPostTransformSuccessEvent)

func (UnsafeUnwrapWebhookEventUnion) AsUploadPreTransformErrorEvent

func (u UnsafeUnwrapWebhookEventUnion) AsUploadPreTransformErrorEvent() (v UploadPreTransformErrorEvent)

func (UnsafeUnwrapWebhookEventUnion) AsUploadPreTransformSuccessEvent

func (u UnsafeUnwrapWebhookEventUnion) AsUploadPreTransformSuccessEvent() (v UploadPreTransformSuccessEvent)

func (UnsafeUnwrapWebhookEventUnion) AsVideoTransformationAcceptedEvent

func (u UnsafeUnwrapWebhookEventUnion) AsVideoTransformationAcceptedEvent() (v VideoTransformationAcceptedEvent)

func (UnsafeUnwrapWebhookEventUnion) AsVideoTransformationErrorEvent

func (u UnsafeUnwrapWebhookEventUnion) AsVideoTransformationErrorEvent() (v VideoTransformationErrorEvent)

func (UnsafeUnwrapWebhookEventUnion) AsVideoTransformationReadyEvent

func (u UnsafeUnwrapWebhookEventUnion) AsVideoTransformationReadyEvent() (v VideoTransformationReadyEvent)

func (UnsafeUnwrapWebhookEventUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UnsafeUnwrapWebhookEventUnion) UnmarshalJSON

func (r *UnsafeUnwrapWebhookEventUnion) UnmarshalJSON(data []byte) error

type UnsafeUnwrapWebhookEventUnionData

type UnsafeUnwrapWebhookEventUnionData struct {
	// This field is a union of [VideoTransformationAcceptedEventDataAsset],
	// [VideoTransformationReadyEventDataAsset],
	// [VideoTransformationErrorEventDataAsset]
	Asset UnsafeUnwrapWebhookEventUnionDataAsset `json:"asset"`
	// This field is a union of [VideoTransformationAcceptedEventDataTransformation],
	// [VideoTransformationReadyEventDataTransformation],
	// [VideoTransformationErrorEventDataTransformation],
	// [UploadPreTransformErrorEventDataTransformation],
	// [UploadPostTransformErrorEventDataTransformation]
	Transformation UnsafeUnwrapWebhookEventUnionDataTransformation `json:"transformation"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	AITags []UploadPreTransformSuccessEventDataAITag `json:"AITags"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	AudioCodec string `json:"audioCodec"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	BitRate int64 `json:"bitRate"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	CustomCoordinates string `json:"customCoordinates"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	CustomMetadata map[string]any `json:"customMetadata"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Description string `json:"description"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Duration int64 `json:"duration"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	ExtensionStatus UploadPreTransformSuccessEventDataExtensionStatus `json:"extensionStatus"`
	FileID          string                                            `json:"fileId"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	FilePath string `json:"filePath"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	FileType string `json:"fileType"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Height float64 `json:"height"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	IsPrivateFile bool `json:"isPrivateFile"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	IsPublished bool `json:"isPublished"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Metadata Metadata `json:"metadata"`
	Name     string   `json:"name"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	SelectedFieldsSchema map[string]UploadPreTransformSuccessEventDataSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Size float64 `json:"size"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Tags []string `json:"tags"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	ThumbnailURL string `json:"thumbnailUrl"`
	URL          string `json:"url"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	VersionInfo UploadPreTransformSuccessEventDataVersionInfo `json:"versionInfo"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	VideoCodec string `json:"videoCodec"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Width float64 `json:"width"`
	Path  string  `json:"path"`
	JSON  struct {
		Asset                respjson.Field
		Transformation       respjson.Field
		AITags               respjson.Field
		AudioCodec           respjson.Field
		BitRate              respjson.Field
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		Duration             respjson.Field
		EmbeddedMetadata     respjson.Field
		ExtensionStatus      respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Metadata             respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		ThumbnailURL         respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		VideoCodec           respjson.Field
		Width                respjson.Field
		Path                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionData is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionData) UnmarshalJSON

func (r *UnsafeUnwrapWebhookEventUnionData) UnmarshalJSON(data []byte) error

type UnsafeUnwrapWebhookEventUnionDataAsset

type UnsafeUnwrapWebhookEventUnionDataAsset struct {
	URL  string `json:"url"`
	JSON struct {
		URL respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionDataAsset is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionDataAsset provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionDataAsset) UnmarshalJSON

func (r *UnsafeUnwrapWebhookEventUnionDataAsset) UnmarshalJSON(data []byte) error

type UnsafeUnwrapWebhookEventUnionDataTransformation

type UnsafeUnwrapWebhookEventUnionDataTransformation struct {
	Type string `json:"type"`
	// This field is a union of
	// [VideoTransformationAcceptedEventDataTransformationOptions],
	// [VideoTransformationReadyEventDataTransformationOptions],
	// [VideoTransformationErrorEventDataTransformationOptions]
	Options UnsafeUnwrapWebhookEventUnionDataTransformationOptions `json:"options"`
	// This field is from variant [VideoTransformationReadyEventDataTransformation].
	Output VideoTransformationReadyEventDataTransformationOutput `json:"output"`
	// This field is a union of [VideoTransformationErrorEventDataTransformationError],
	// [UploadPreTransformErrorEventDataTransformationError],
	// [UploadPostTransformErrorEventDataTransformationError]
	Error UnsafeUnwrapWebhookEventUnionDataTransformationError `json:"error"`
	JSON  struct {
		Type    respjson.Field
		Options respjson.Field
		Output  respjson.Field
		Error   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionDataTransformation is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionDataTransformation provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionDataTransformation) UnmarshalJSON

type UnsafeUnwrapWebhookEventUnionDataTransformationError

type UnsafeUnwrapWebhookEventUnionDataTransformationError struct {
	Reason string `json:"reason"`
	JSON   struct {
		Reason respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionDataTransformationError is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionDataTransformationError provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionDataTransformationError) UnmarshalJSON

type UnsafeUnwrapWebhookEventUnionDataTransformationOptions

type UnsafeUnwrapWebhookEventUnionDataTransformationOptions struct {
	AudioCodec     string   `json:"audio_codec"`
	AutoRotate     bool     `json:"auto_rotate"`
	Format         string   `json:"format"`
	Quality        int64    `json:"quality"`
	StreamProtocol string   `json:"stream_protocol"`
	Variants       []string `json:"variants"`
	VideoCodec     string   `json:"video_codec"`
	JSON           struct {
		AudioCodec     respjson.Field
		AutoRotate     respjson.Field
		Format         respjson.Field
		Quality        respjson.Field
		StreamProtocol respjson.Field
		Variants       respjson.Field
		VideoCodec     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionDataTransformationOptions is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionDataTransformationOptions provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionDataTransformationOptions) UnmarshalJSON

type UnsafeUnwrapWebhookEventUnionRequest

type UnsafeUnwrapWebhookEventUnionRequest struct {
	URL        string `json:"url"`
	XRequestID string `json:"x_request_id"`
	UserAgent  string `json:"user_agent"`
	// This field is a union of [string], [string],
	// [UploadPostTransformSuccessEventRequestTransformation],
	// [UploadPostTransformErrorEventRequestTransformation]
	Transformation UnsafeUnwrapWebhookEventUnionRequestTransformation `json:"transformation"`
	JSON           struct {
		URL            respjson.Field
		XRequestID     respjson.Field
		UserAgent      respjson.Field
		Transformation respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionRequest is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionRequest provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

func (*UnsafeUnwrapWebhookEventUnionRequest) UnmarshalJSON

func (r *UnsafeUnwrapWebhookEventUnionRequest) UnmarshalJSON(data []byte) error

type UnsafeUnwrapWebhookEventUnionRequestTransformation

type UnsafeUnwrapWebhookEventUnionRequestTransformation struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	Type     string `json:"type"`
	Protocol string `json:"protocol"`
	Value    string `json:"value"`
	JSON     struct {
		OfString respjson.Field
		Type     respjson.Field
		Protocol respjson.Field
		Value    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnsafeUnwrapWebhookEventUnionRequestTransformation is an implicit subunion of UnsafeUnwrapWebhookEventUnion. UnsafeUnwrapWebhookEventUnionRequestTransformation provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnsafeUnwrapWebhookEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (*UnsafeUnwrapWebhookEventUnionRequestTransformation) UnmarshalJSON

type UnwrapWebhookEventUnion

type UnwrapWebhookEventUnion struct {
	// This field is from variant [VideoTransformationAcceptedEvent],
	// [VideoTransformationReadyEvent], [VideoTransformationErrorEvent],
	// [UploadPreTransformSuccessEvent], [UploadPreTransformErrorEvent],
	// [UploadPostTransformSuccessEvent], [UploadPostTransformErrorEvent].
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	CreatedAt time.Time `json:"created_at"`
	// This field is a union of [VideoTransformationAcceptedEventData],
	// [VideoTransformationReadyEventData], [VideoTransformationErrorEventData],
	// [UploadPreTransformSuccessEventData], [UploadPreTransformErrorEventData],
	// [UploadPostTransformSuccessEventData], [UploadPostTransformErrorEventData]
	Data UnwrapWebhookEventUnionData `json:"data"`
	// This field is a union of [VideoTransformationAcceptedEventRequest],
	// [VideoTransformationReadyEventRequest], [VideoTransformationErrorEventRequest],
	// [UploadPreTransformSuccessEventRequest], [UploadPreTransformErrorEventRequest],
	// [UploadPostTransformSuccessEventRequest], [UploadPostTransformErrorEventRequest]
	Request UnwrapWebhookEventUnionRequest `json:"request"`
	// This field is from variant [VideoTransformationReadyEvent].
	Timings VideoTransformationReadyEventTimings `json:"timings"`
	JSON    struct {
		ID        respjson.Field
		Type      respjson.Field
		CreatedAt respjson.Field
		Data      respjson.Field
		Request   respjson.Field
		Timings   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnion contains all possible properties and values from VideoTransformationAcceptedEvent, VideoTransformationReadyEvent, VideoTransformationErrorEvent, UploadPreTransformSuccessEvent, UploadPreTransformErrorEvent, UploadPostTransformSuccessEvent, UploadPostTransformErrorEvent.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (UnwrapWebhookEventUnion) AsUploadPostTransformErrorEvent

func (u UnwrapWebhookEventUnion) AsUploadPostTransformErrorEvent() (v UploadPostTransformErrorEvent)

func (UnwrapWebhookEventUnion) AsUploadPostTransformSuccessEvent

func (u UnwrapWebhookEventUnion) AsUploadPostTransformSuccessEvent() (v UploadPostTransformSuccessEvent)

func (UnwrapWebhookEventUnion) AsUploadPreTransformErrorEvent

func (u UnwrapWebhookEventUnion) AsUploadPreTransformErrorEvent() (v UploadPreTransformErrorEvent)

func (UnwrapWebhookEventUnion) AsUploadPreTransformSuccessEvent

func (u UnwrapWebhookEventUnion) AsUploadPreTransformSuccessEvent() (v UploadPreTransformSuccessEvent)

func (UnwrapWebhookEventUnion) AsVideoTransformationAcceptedEvent

func (u UnwrapWebhookEventUnion) AsVideoTransformationAcceptedEvent() (v VideoTransformationAcceptedEvent)

func (UnwrapWebhookEventUnion) AsVideoTransformationErrorEvent

func (u UnwrapWebhookEventUnion) AsVideoTransformationErrorEvent() (v VideoTransformationErrorEvent)

func (UnwrapWebhookEventUnion) AsVideoTransformationReadyEvent

func (u UnwrapWebhookEventUnion) AsVideoTransformationReadyEvent() (v VideoTransformationReadyEvent)

func (UnwrapWebhookEventUnion) RawJSON

func (u UnwrapWebhookEventUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnwrapWebhookEventUnion) UnmarshalJSON

func (r *UnwrapWebhookEventUnion) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionData

type UnwrapWebhookEventUnionData struct {
	// This field is a union of [VideoTransformationAcceptedEventDataAsset],
	// [VideoTransformationReadyEventDataAsset],
	// [VideoTransformationErrorEventDataAsset]
	Asset UnwrapWebhookEventUnionDataAsset `json:"asset"`
	// This field is a union of [VideoTransformationAcceptedEventDataTransformation],
	// [VideoTransformationReadyEventDataTransformation],
	// [VideoTransformationErrorEventDataTransformation],
	// [UploadPreTransformErrorEventDataTransformation],
	// [UploadPostTransformErrorEventDataTransformation]
	Transformation UnwrapWebhookEventUnionDataTransformation `json:"transformation"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	AITags []UploadPreTransformSuccessEventDataAITag `json:"AITags"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	AudioCodec string `json:"audioCodec"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	BitRate int64 `json:"bitRate"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	CustomCoordinates string `json:"customCoordinates"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	CustomMetadata map[string]any `json:"customMetadata"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Description string `json:"description"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Duration int64 `json:"duration"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	ExtensionStatus UploadPreTransformSuccessEventDataExtensionStatus `json:"extensionStatus"`
	FileID          string                                            `json:"fileId"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	FilePath string `json:"filePath"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	FileType string `json:"fileType"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Height float64 `json:"height"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	IsPrivateFile bool `json:"isPrivateFile"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	IsPublished bool `json:"isPublished"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Metadata Metadata `json:"metadata"`
	Name     string   `json:"name"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	SelectedFieldsSchema map[string]UploadPreTransformSuccessEventDataSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Size float64 `json:"size"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Tags []string `json:"tags"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	ThumbnailURL string `json:"thumbnailUrl"`
	URL          string `json:"url"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	VersionInfo UploadPreTransformSuccessEventDataVersionInfo `json:"versionInfo"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	VideoCodec string `json:"videoCodec"`
	// This field is from variant [UploadPreTransformSuccessEventData].
	Width float64 `json:"width"`
	Path  string  `json:"path"`
	JSON  struct {
		Asset                respjson.Field
		Transformation       respjson.Field
		AITags               respjson.Field
		AudioCodec           respjson.Field
		BitRate              respjson.Field
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		Duration             respjson.Field
		EmbeddedMetadata     respjson.Field
		ExtensionStatus      respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Metadata             respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		ThumbnailURL         respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		VideoCodec           respjson.Field
		Width                respjson.Field
		Path                 respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionData is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionData) UnmarshalJSON

func (r *UnwrapWebhookEventUnionData) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionDataAsset

type UnwrapWebhookEventUnionDataAsset struct {
	URL  string `json:"url"`
	JSON struct {
		URL respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionDataAsset is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionDataAsset provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionDataAsset) UnmarshalJSON

func (r *UnwrapWebhookEventUnionDataAsset) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionDataTransformation

type UnwrapWebhookEventUnionDataTransformation struct {
	Type string `json:"type"`
	// This field is a union of
	// [VideoTransformationAcceptedEventDataTransformationOptions],
	// [VideoTransformationReadyEventDataTransformationOptions],
	// [VideoTransformationErrorEventDataTransformationOptions]
	Options UnwrapWebhookEventUnionDataTransformationOptions `json:"options"`
	// This field is from variant [VideoTransformationReadyEventDataTransformation].
	Output VideoTransformationReadyEventDataTransformationOutput `json:"output"`
	// This field is a union of [VideoTransformationErrorEventDataTransformationError],
	// [UploadPreTransformErrorEventDataTransformationError],
	// [UploadPostTransformErrorEventDataTransformationError]
	Error UnwrapWebhookEventUnionDataTransformationError `json:"error"`
	JSON  struct {
		Type    respjson.Field
		Options respjson.Field
		Output  respjson.Field
		Error   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionDataTransformation is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionDataTransformation provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionDataTransformation) UnmarshalJSON

func (r *UnwrapWebhookEventUnionDataTransformation) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionDataTransformationError

type UnwrapWebhookEventUnionDataTransformationError struct {
	Reason string `json:"reason"`
	JSON   struct {
		Reason respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionDataTransformationError is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionDataTransformationError provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionDataTransformationError) UnmarshalJSON

type UnwrapWebhookEventUnionDataTransformationOptions

type UnwrapWebhookEventUnionDataTransformationOptions struct {
	AudioCodec     string   `json:"audio_codec"`
	AutoRotate     bool     `json:"auto_rotate"`
	Format         string   `json:"format"`
	Quality        int64    `json:"quality"`
	StreamProtocol string   `json:"stream_protocol"`
	Variants       []string `json:"variants"`
	VideoCodec     string   `json:"video_codec"`
	JSON           struct {
		AudioCodec     respjson.Field
		AutoRotate     respjson.Field
		Format         respjson.Field
		Quality        respjson.Field
		StreamProtocol respjson.Field
		Variants       respjson.Field
		VideoCodec     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionDataTransformationOptions is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionDataTransformationOptions provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionDataTransformationOptions) UnmarshalJSON

type UnwrapWebhookEventUnionRequest

type UnwrapWebhookEventUnionRequest struct {
	URL        string `json:"url"`
	XRequestID string `json:"x_request_id"`
	UserAgent  string `json:"user_agent"`
	// This field is a union of [string], [string],
	// [UploadPostTransformSuccessEventRequestTransformation],
	// [UploadPostTransformErrorEventRequestTransformation]
	Transformation UnwrapWebhookEventUnionRequestTransformation `json:"transformation"`
	JSON           struct {
		URL            respjson.Field
		XRequestID     respjson.Field
		UserAgent      respjson.Field
		Transformation respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionRequest is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionRequest provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

func (*UnwrapWebhookEventUnionRequest) UnmarshalJSON

func (r *UnwrapWebhookEventUnionRequest) UnmarshalJSON(data []byte) error

type UnwrapWebhookEventUnionRequestTransformation

type UnwrapWebhookEventUnionRequestTransformation struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	Type     string `json:"type"`
	Protocol string `json:"protocol"`
	Value    string `json:"value"`
	JSON     struct {
		OfString respjson.Field
		Type     respjson.Field
		Protocol respjson.Field
		Value    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UnwrapWebhookEventUnionRequestTransformation is an implicit subunion of UnwrapWebhookEventUnion. UnwrapWebhookEventUnionRequestTransformation provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the UnwrapWebhookEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (*UnwrapWebhookEventUnionRequestTransformation) UnmarshalJSON

func (r *UnwrapWebhookEventUnionRequestTransformation) UnmarshalJSON(data []byte) error

type UpdateFileRequestChangePublicationStatusParam

type UpdateFileRequestChangePublicationStatusParam struct {
	// Configure the publication status of a file and its versions.
	Publish UpdateFileRequestChangePublicationStatusPublishParam `json:"publish,omitzero"`
	// contains filtered or unexported fields
}

func (UpdateFileRequestChangePublicationStatusParam) MarshalJSON

func (r UpdateFileRequestChangePublicationStatusParam) MarshalJSON() (data []byte, err error)

func (*UpdateFileRequestChangePublicationStatusParam) UnmarshalJSON

func (r *UpdateFileRequestChangePublicationStatusParam) UnmarshalJSON(data []byte) error

type UpdateFileRequestChangePublicationStatusPublishParam

type UpdateFileRequestChangePublicationStatusPublishParam struct {
	// Set to `true` to publish the file. Set to `false` to unpublish the file.
	IsPublished bool `json:"isPublished,required"`
	// Set to `true` to publish/unpublish all versions of the file. Set to `false` to
	// publish/unpublish only the current version of the file.
	IncludeFileVersions param.Opt[bool] `json:"includeFileVersions,omitzero"`
	// contains filtered or unexported fields
}

Configure the publication status of a file and its versions.

The property IsPublished is required.

func (UpdateFileRequestChangePublicationStatusPublishParam) MarshalJSON

func (r UpdateFileRequestChangePublicationStatusPublishParam) MarshalJSON() (data []byte, err error)

func (*UpdateFileRequestChangePublicationStatusPublishParam) UnmarshalJSON

type UpdateFileRequestUnionParam

type UpdateFileRequestUnionParam struct {
	OfUpdateFileDetails       *UpdateFileRequestUpdateFileDetailsParam       `json:",omitzero,inline"`
	OfChangePublicationStatus *UpdateFileRequestChangePublicationStatusParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (UpdateFileRequestUnionParam) MarshalJSON

func (u UpdateFileRequestUnionParam) MarshalJSON() ([]byte, error)

func (*UpdateFileRequestUnionParam) UnmarshalJSON

func (u *UpdateFileRequestUnionParam) UnmarshalJSON(data []byte) error

type UpdateFileRequestUpdateFileDetailsParam

type UpdateFileRequestUpdateFileDetailsParam struct {
	// Define an important area in the image in the format `x,y,width,height` e.g.
	// `10,10,100,100`. Send `null` to unset this value.
	CustomCoordinates param.Opt[string] `json:"customCoordinates,omitzero"`
	// Optional text to describe the contents of the file.
	Description param.Opt[string] `json:"description,omitzero"`
	// The final status of extensions after they have completed execution will be
	// delivered to this endpoint as a POST request.
	// [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure)
	// about the webhook payload structure.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero" format:"uri"`
	// An array of tags associated with the file, such as `["tag1", "tag2"]`. Send
	// `null` to unset all tags associated with the file.
	Tags []string `json:"tags,omitzero"`
	// A key-value data to be associated with the asset. To unset a key, send `null`
	// value for that key. Before setting any custom metadata on an asset you have to
	// create the field using custom metadata fields API.
	CustomMetadata map[string]any `json:"customMetadata,omitzero"`
	// Array of extensions to be applied to the asset. Each extension can be configured
	// with specific parameters based on the extension type.
	Extensions shared.ExtensionsParam `json:"extensions,omitzero"`
	// An array of AITags associated with the file that you want to remove, e.g.
	// `["car", "vehicle", "motorsports"]`.
	//
	// If you want to remove all AITags associated with the file, send a string -
	// "all".
	//
	// Note: The remove operation for `AITags` executes before any of the `extensions`
	// are processed.
	RemoveAITags UpdateFileRequestUpdateFileDetailsRemoveAITagsUnionParam `json:"removeAITags,omitzero"`
	// contains filtered or unexported fields
}

func (UpdateFileRequestUpdateFileDetailsParam) MarshalJSON

func (r UpdateFileRequestUpdateFileDetailsParam) MarshalJSON() (data []byte, err error)

func (*UpdateFileRequestUpdateFileDetailsParam) UnmarshalJSON

func (r *UpdateFileRequestUpdateFileDetailsParam) UnmarshalJSON(data []byte) error

type UpdateFileRequestUpdateFileDetailsRemoveAITagsUnionParam

type UpdateFileRequestUpdateFileDetailsRemoveAITagsUnionParam struct {
	OfStringArray []string `json:",omitzero,inline"`
	// Construct this variant with constant.ValueOf[constant.All]()
	OfAll constant.All `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (UpdateFileRequestUpdateFileDetailsRemoveAITagsUnionParam) MarshalJSON

func (*UpdateFileRequestUpdateFileDetailsRemoveAITagsUnionParam) UnmarshalJSON

type UploadPostTransformErrorEvent

type UploadPostTransformErrorEvent struct {
	// Timestamp of when the event occurred in ISO8601 format.
	CreatedAt time.Time                            `json:"created_at,required" format:"date-time"`
	Data      UploadPostTransformErrorEventData    `json:"data,required"`
	Request   UploadPostTransformErrorEventRequest `json:"request,required"`
	Type      constant.UploadPostTransformError    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated.

func (UploadPostTransformErrorEvent) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEvent) UnmarshalJSON

func (r *UploadPostTransformErrorEvent) UnmarshalJSON(data []byte) error

type UploadPostTransformErrorEventData

type UploadPostTransformErrorEventData struct {
	// Unique identifier of the originally uploaded file.
	FileID string `json:"fileId,required"`
	// Name of the file.
	Name string `json:"name,required"`
	// Path of the file.
	Path           string                                          `json:"path,required"`
	Transformation UploadPostTransformErrorEventDataTransformation `json:"transformation,required"`
	// URL of the attempted post-transformation.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileID         respjson.Field
		Name           respjson.Field
		Path           respjson.Field
		Transformation respjson.Field
		URL            respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformErrorEventData) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEventData) UnmarshalJSON

func (r *UploadPostTransformErrorEventData) UnmarshalJSON(data []byte) error

type UploadPostTransformErrorEventDataTransformation

type UploadPostTransformErrorEventDataTransformation struct {
	Error UploadPostTransformErrorEventDataTransformationError `json:"error,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformErrorEventDataTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEventDataTransformation) UnmarshalJSON

type UploadPostTransformErrorEventDataTransformationError

type UploadPostTransformErrorEventDataTransformationError struct {
	// Reason for the post-transformation failure.
	Reason string `json:"reason,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformErrorEventDataTransformationError) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEventDataTransformationError) UnmarshalJSON

type UploadPostTransformErrorEventRequest

type UploadPostTransformErrorEventRequest struct {
	Transformation UploadPostTransformErrorEventRequestTransformation `json:"transformation,required"`
	// Unique identifier for the originating request.
	XRequestID string `json:"x_request_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Transformation respjson.Field
		XRequestID     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformErrorEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEventRequest) UnmarshalJSON

func (r *UploadPostTransformErrorEventRequest) UnmarshalJSON(data []byte) error

type UploadPostTransformErrorEventRequestTransformation

type UploadPostTransformErrorEventRequestTransformation struct {
	// Type of the requested post-transformation.
	//
	// Any of "transformation", "abs", "gif-to-video", "thumbnail".
	Type string `json:"type,required"`
	// Only applicable if transformation type is 'abs'. Streaming protocol used.
	//
	// Any of "hls", "dash".
	Protocol string `json:"protocol"`
	// Value for the requested transformation type.
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Protocol    respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformErrorEventRequestTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformErrorEventRequestTransformation) UnmarshalJSON

type UploadPostTransformSuccessEvent

type UploadPostTransformSuccessEvent struct {
	// Timestamp of when the event occurred in ISO8601 format.
	CreatedAt time.Time                              `json:"created_at,required" format:"date-time"`
	Data      UploadPostTransformSuccessEventData    `json:"data,required"`
	Request   UploadPostTransformSuccessEventRequest `json:"request,required"`
	Type      constant.UploadPostTransformSuccess    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event.

func (UploadPostTransformSuccessEvent) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformSuccessEvent) UnmarshalJSON

func (r *UploadPostTransformSuccessEvent) UnmarshalJSON(data []byte) error

type UploadPostTransformSuccessEventData

type UploadPostTransformSuccessEventData struct {
	// Unique identifier of the originally uploaded file.
	FileID string `json:"fileId,required"`
	// Name of the file.
	Name string `json:"name,required"`
	// URL of the generated post-transformation.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileID      respjson.Field
		Name        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformSuccessEventData) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformSuccessEventData) UnmarshalJSON

func (r *UploadPostTransformSuccessEventData) UnmarshalJSON(data []byte) error

type UploadPostTransformSuccessEventRequest

type UploadPostTransformSuccessEventRequest struct {
	Transformation UploadPostTransformSuccessEventRequestTransformation `json:"transformation,required"`
	// Unique identifier for the originating request.
	XRequestID string `json:"x_request_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Transformation respjson.Field
		XRequestID     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformSuccessEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformSuccessEventRequest) UnmarshalJSON

func (r *UploadPostTransformSuccessEventRequest) UnmarshalJSON(data []byte) error

type UploadPostTransformSuccessEventRequestTransformation

type UploadPostTransformSuccessEventRequestTransformation struct {
	// Type of the requested post-transformation.
	//
	// Any of "transformation", "abs", "gif-to-video", "thumbnail".
	Type string `json:"type,required"`
	// Only applicable if transformation type is 'abs'. Streaming protocol used.
	//
	// Any of "hls", "dash".
	Protocol string `json:"protocol"`
	// Value for the requested transformation type.
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Protocol    respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPostTransformSuccessEventRequestTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPostTransformSuccessEventRequestTransformation) UnmarshalJSON

type UploadPreTransformErrorEvent

type UploadPreTransformErrorEvent struct {
	// Timestamp of when the event occurred in ISO8601 format.
	CreatedAt time.Time                           `json:"created_at,required" format:"date-time"`
	Data      UploadPreTransformErrorEventData    `json:"data,required"`
	Request   UploadPreTransformErrorEventRequest `json:"request,required"`
	Type      constant.UploadPreTransformError    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied.

func (UploadPreTransformErrorEvent) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformErrorEvent) UnmarshalJSON

func (r *UploadPreTransformErrorEvent) UnmarshalJSON(data []byte) error

type UploadPreTransformErrorEventData

type UploadPreTransformErrorEventData struct {
	// Name of the file.
	Name string `json:"name,required"`
	// Path of the file.
	Path           string                                         `json:"path,required"`
	Transformation UploadPreTransformErrorEventDataTransformation `json:"transformation,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name           respjson.Field
		Path           respjson.Field
		Transformation respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformErrorEventData) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformErrorEventData) UnmarshalJSON

func (r *UploadPreTransformErrorEventData) UnmarshalJSON(data []byte) error

type UploadPreTransformErrorEventDataTransformation

type UploadPreTransformErrorEventDataTransformation struct {
	Error UploadPreTransformErrorEventDataTransformationError `json:"error,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformErrorEventDataTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformErrorEventDataTransformation) UnmarshalJSON

type UploadPreTransformErrorEventDataTransformationError

type UploadPreTransformErrorEventDataTransformationError struct {
	// Reason for the pre-transformation failure.
	Reason string `json:"reason,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformErrorEventDataTransformationError) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformErrorEventDataTransformationError) UnmarshalJSON

type UploadPreTransformErrorEventRequest

type UploadPreTransformErrorEventRequest struct {
	// The requested pre-transformation string.
	Transformation string `json:"transformation,required"`
	// Unique identifier for the originating request.
	XRequestID string `json:"x_request_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Transformation respjson.Field
		XRequestID     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformErrorEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformErrorEventRequest) UnmarshalJSON

func (r *UploadPreTransformErrorEventRequest) UnmarshalJSON(data []byte) error

type UploadPreTransformSuccessEvent

type UploadPreTransformSuccessEvent struct {
	// Timestamp of when the event occurred in ISO8601 format.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Object containing details of a successful upload.
	Data    UploadPreTransformSuccessEventData    `json:"data,required"`
	Request UploadPreTransformSuccessEventRequest `json:"request,required"`
	Type    constant.UploadPreTransformSuccess    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library.

func (UploadPreTransformSuccessEvent) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEvent) UnmarshalJSON

func (r *UploadPreTransformSuccessEvent) UnmarshalJSON(data []byte) error

type UploadPreTransformSuccessEventData

type UploadPreTransformSuccessEventData struct {
	// An array of tags assigned to the uploaded file by auto tagging.
	AITags []UploadPreTransformSuccessEventDataAITag `json:"AITags,nullable"`
	// The audio codec used in the video (only for video).
	AudioCodec string `json:"audioCodec"`
	// The bit rate of the video in kbps (only for video).
	BitRate int64 `json:"bitRate"`
	// Value of custom coordinates associated with the image in the format
	// `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`.
	// Send `customCoordinates` in `responseFields` in API request to get the value of
	// this field.
	CustomCoordinates string `json:"customCoordinates,nullable"`
	// A key-value data associated with the asset. Use `responseField` in API request
	// to get `customMetadata` in the upload API response. Before setting any custom
	// metadata on an asset, you have to create the field using custom metadata fields
	// API. Send `customMetadata` in `responseFields` in API request to get the value
	// of this field.
	CustomMetadata map[string]any `json:"customMetadata"`
	// 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. Send `embeddedMetadata` in `responseFields` in API request to get
	// embeddedMetadata in the upload API response.
	EmbeddedMetadata map[string]any `json:"embeddedMetadata"`
	// Extension names with their processing status at the time of completion of the
	// request. It could have one of the following status values:
	//
	// `success`: The extension has been successfully applied. `failed`: The extension
	// has failed and will not be retried. `pending`: The extension will finish
	// processing in some time. On completion, the final status (success / failed) will
	// be sent to the `webhookUrl` provided.
	//
	// If no extension was requested, then this parameter is not returned.
	ExtensionStatus UploadPreTransformSuccessEventDataExtensionStatus `json:"extensionStatus"`
	// Unique fileId. Store this fileld in your database, as this will be used to
	// perform update action on this file.
	FileID string `json:"fileId"`
	// The relative path of the file in the media library e.g.
	// `/marketing-assets/new-banner.jpg`.
	FilePath string `json:"filePath"`
	// Type of the uploaded file. Possible values are `image`, `non-image`.
	FileType string `json:"fileType"`
	// Height of the image in pixels (Only for images)
	Height float64 `json:"height"`
	// Is the file marked as private. It can be either `true` or `false`. Send
	// `isPrivateFile` in `responseFields` in API request to get the value of this
	// field.
	IsPrivateFile bool `json:"isPrivateFile"`
	// Is the file published or in draft state. It can be either `true` or `false`.
	// Send `isPublished` in `responseFields` in API request to get the value of this
	// field.
	IsPublished bool `json:"isPublished"`
	// Legacy metadata. Send `metadata` in `responseFields` in API request to get
	// metadata in the upload API response.
	Metadata Metadata `json:"metadata"`
	// Name of the asset.
	Name string `json:"name"`
	// This field is included in the response only if the Path policy feature is
	// available in the plan. It contains schema definitions for the custom metadata
	// fields selected for the specified file path. Field selection can only be done
	// when the Path policy feature is enabled.
	//
	// Keys are the names of the custom metadata fields; the value object has details
	// about the custom metadata schema.
	SelectedFieldsSchema map[string]UploadPreTransformSuccessEventDataSelectedFieldsSchema `json:"selectedFieldsSchema"`
	// Size of the image file in Bytes.
	Size float64 `json:"size"`
	// The array of tags associated with the asset. If no tags are set, it will be
	// `null`. Send `tags` in `responseFields` in API request to get the value of this
	// field.
	Tags []string `json:"tags,nullable"`
	// In the case of an image, a small thumbnail URL.
	ThumbnailURL string `json:"thumbnailUrl"`
	// A publicly accessible URL of the file.
	URL string `json:"url"`
	// An object containing the file or file version's `id` (versionId) and `name`.
	VersionInfo UploadPreTransformSuccessEventDataVersionInfo `json:"versionInfo"`
	// The video codec used in the video (only for video).
	VideoCodec string `json:"videoCodec"`
	// Width of the image in pixels (Only for Images)
	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
		CustomCoordinates    respjson.Field
		CustomMetadata       respjson.Field
		Description          respjson.Field
		Duration             respjson.Field
		EmbeddedMetadata     respjson.Field
		ExtensionStatus      respjson.Field
		FileID               respjson.Field
		FilePath             respjson.Field
		FileType             respjson.Field
		Height               respjson.Field
		IsPrivateFile        respjson.Field
		IsPublished          respjson.Field
		Metadata             respjson.Field
		Name                 respjson.Field
		SelectedFieldsSchema respjson.Field
		Size                 respjson.Field
		Tags                 respjson.Field
		ThumbnailURL         respjson.Field
		URL                  respjson.Field
		VersionInfo          respjson.Field
		VideoCodec           respjson.Field
		Width                respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object containing details of a successful upload.

func (UploadPreTransformSuccessEventData) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventData) UnmarshalJSON

func (r *UploadPreTransformSuccessEventData) UnmarshalJSON(data []byte) error

type UploadPreTransformSuccessEventDataAITag

type UploadPreTransformSuccessEventDataAITag struct {
	// Confidence score of the tag.
	Confidence float64 `json:"confidence"`
	// Name of the tag.
	Name string `json:"name"`
	// Array of `AITags` associated with the image. If no `AITags` are set, it will be
	// null. These tags can be added using the `google-auto-tagging` or
	// `aws-auto-tagging` extensions.
	Source string `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Confidence  respjson.Field
		Name        respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformSuccessEventDataAITag) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataAITag) UnmarshalJSON

func (r *UploadPreTransformSuccessEventDataAITag) UnmarshalJSON(data []byte) error

type UploadPreTransformSuccessEventDataExtensionStatus

type UploadPreTransformSuccessEventDataExtensionStatus struct {
	// Any of "success", "pending", "failed".
	AIAutoDescription string `json:"ai-auto-description"`
	// Any of "success", "pending", "failed".
	AwsAutoTagging string `json:"aws-auto-tagging"`
	// Any of "success", "pending", "failed".
	GoogleAutoTagging string `json:"google-auto-tagging"`
	// Any of "success", "pending", "failed".
	RemoveBg string `json:"remove-bg"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AIAutoDescription respjson.Field
		AwsAutoTagging    respjson.Field
		GoogleAutoTagging respjson.Field
		RemoveBg          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Extension names with their processing status at the time of completion of the request. It could have one of the following status values:

`success`: The extension has been successfully applied. `failed`: The extension has failed and will not be retried. `pending`: The extension will finish processing in some time. On completion, the final status (success / failed) will be sent to the `webhookUrl` provided.

If no extension was requested, then this parameter is not returned.

func (UploadPreTransformSuccessEventDataExtensionStatus) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataExtensionStatus) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchema

type UploadPreTransformSuccessEventDataSelectedFieldsSchema struct {
	// Type of the custom metadata field.
	//
	// Any of "Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect",
	// "MultiSelect".
	Type string `json:"type,required"`
	// The default value for this custom metadata field. The value should match the
	// `type` of custom metadata field.
	DefaultValue UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion `json:"defaultValue"`
	// Specifies if the custom metadata field is required or not.
	IsValueRequired bool `json:"isValueRequired"`
	// Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MaxLength float64 `json:"maxLength"`
	// Maximum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MaxValue UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion `json:"maxValue"`
	// Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.
	MinLength float64 `json:"minLength"`
	// Minimum value of the field. Only set if field type is `Date` or `Number`. For
	// `Date` type field, the value will be in ISO8601 string format. For `Number` type
	// field, it will be a numeric value.
	MinValue UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion `json:"minValue"`
	// Indicates whether the custom metadata field is read only. A read only field
	// cannot be modified after being set. This field is configurable only via the
	// **Path policy** feature.
	ReadOnly bool `json:"readOnly"`
	// An array of allowed values when field type is `SingleSelect` or `MultiSelect`.
	SelectOptions []UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion `json:"selectOptions"`
	// Specifies if the selectOptions array is truncated. It is truncated when number
	// of options are > 100.
	SelectOptionsTruncated bool `json:"selectOptionsTruncated"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type                   respjson.Field
		DefaultValue           respjson.Field
		IsValueRequired        respjson.Field
		MaxLength              respjson.Field
		MaxValue               respjson.Field
		MinLength              respjson.Field
		MinValue               respjson.Field
		ReadOnly               respjson.Field
		SelectOptions          respjson.Field
		SelectOptionsTruncated respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformSuccessEventDataSelectedFieldsSchema) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchema) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion) AsBool

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion) AsFloat

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion) AsString

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a
	// [[]UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion]
	// instead of an object.
	OfMixed []UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		OfMixed  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion contains all possible properties and values from [string], [float64], [bool], [[]UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueMixedItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool OfMixed]

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) AsBool

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) AsFloat

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) AsMixed

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) AsString

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchemaDefaultValueUnion) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion) AsFloat

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion) AsString

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchemaMaxValueUnion) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion) AsFloat

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion) AsString

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchemaMinValueUnion) UnmarshalJSON

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion

type UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion) AsBool

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion) AsFloat

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion) AsString

func (UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataSelectedFieldsSchemaSelectOptionUnion) UnmarshalJSON

type UploadPreTransformSuccessEventDataVersionInfo

type UploadPreTransformSuccessEventDataVersionInfo struct {
	// Unique identifier of the file version.
	ID string `json:"id"`
	// Name of the file version.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object containing the file or file version's `id` (versionId) and `name`.

func (UploadPreTransformSuccessEventDataVersionInfo) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventDataVersionInfo) UnmarshalJSON

func (r *UploadPreTransformSuccessEventDataVersionInfo) UnmarshalJSON(data []byte) error

type UploadPreTransformSuccessEventRequest

type UploadPreTransformSuccessEventRequest struct {
	// The requested pre-transformation string.
	Transformation string `json:"transformation,required"`
	// Unique identifier for the originating request.
	XRequestID string `json:"x_request_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Transformation respjson.Field
		XRequestID     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UploadPreTransformSuccessEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*UploadPreTransformSuccessEventRequest) UnmarshalJSON

func (r *UploadPreTransformSuccessEventRequest) UnmarshalJSON(data []byte) error

type VideoOverlayParam

type VideoOverlayParam = shared.VideoOverlayParam

This is an alias to an internal type.

type VideoTransformationAcceptedEvent

type VideoTransformationAcceptedEvent struct {
	// Timestamp when the event was created in ISO8601 format.
	CreatedAt time.Time                            `json:"created_at,required" format:"date-time"`
	Data      VideoTransformationAcceptedEventData `json:"data,required"`
	// Information about the original request that triggered the video transformation.
	Request VideoTransformationAcceptedEventRequest `json:"request,required"`
	Type    constant.VideoTransformationAccepted    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle.

func (VideoTransformationAcceptedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEvent) UnmarshalJSON

func (r *VideoTransformationAcceptedEvent) UnmarshalJSON(data []byte) error

type VideoTransformationAcceptedEventData

type VideoTransformationAcceptedEventData struct {
	// Information about the source video asset being transformed.
	Asset VideoTransformationAcceptedEventDataAsset `json:"asset,required"`
	// Base information about a video transformation request.
	Transformation VideoTransformationAcceptedEventDataTransformation `json:"transformation,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asset          respjson.Field
		Transformation respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoTransformationAcceptedEventData) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEventData) UnmarshalJSON

func (r *VideoTransformationAcceptedEventData) UnmarshalJSON(data []byte) error

type VideoTransformationAcceptedEventDataAsset

type VideoTransformationAcceptedEventDataAsset struct {
	// URL to download or access the source video file.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the source video asset being transformed.

func (VideoTransformationAcceptedEventDataAsset) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEventDataAsset) UnmarshalJSON

func (r *VideoTransformationAcceptedEventDataAsset) UnmarshalJSON(data []byte) error

type VideoTransformationAcceptedEventDataTransformation

type VideoTransformationAcceptedEventDataTransformation struct {
	// Type of video transformation:
	//
	//   - `video-transformation`: Standard video processing (resize, format conversion,
	//     etc.)
	//   - `gif-to-video`: Convert animated GIF to video format
	//   - `video-thumbnail`: Generate thumbnail image from video
	//
	// Any of "video-transformation", "gif-to-video", "video-thumbnail".
	Type string `json:"type,required"`
	// Configuration options for video transformations.
	Options VideoTransformationAcceptedEventDataTransformationOptions `json:"options"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Options     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Base information about a video transformation request.

func (VideoTransformationAcceptedEventDataTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEventDataTransformation) UnmarshalJSON

type VideoTransformationAcceptedEventDataTransformationOptions

type VideoTransformationAcceptedEventDataTransformationOptions struct {
	// Audio codec used for encoding (aac or opus).
	//
	// Any of "aac", "opus".
	AudioCodec string `json:"audio_codec"`
	// Whether to automatically rotate the video based on metadata.
	AutoRotate bool `json:"auto_rotate"`
	// Output format for the transformed video or thumbnail.
	//
	// Any of "mp4", "webm", "jpg", "png", "webp".
	Format string `json:"format"`
	// Quality setting for the output video.
	Quality int64 `json:"quality"`
	// Streaming protocol for adaptive bitrate streaming.
	//
	// Any of "HLS", "DASH".
	StreamProtocol string `json:"stream_protocol"`
	// Array of quality representations for adaptive bitrate streaming.
	Variants []string `json:"variants"`
	// Video codec used for encoding (h264, vp9, or av1).
	//
	// Any of "h264", "vp9", "av1".
	VideoCodec string `json:"video_codec"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AudioCodec     respjson.Field
		AutoRotate     respjson.Field
		Format         respjson.Field
		Quality        respjson.Field
		StreamProtocol respjson.Field
		Variants       respjson.Field
		VideoCodec     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration options for video transformations.

func (VideoTransformationAcceptedEventDataTransformationOptions) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEventDataTransformationOptions) UnmarshalJSON

type VideoTransformationAcceptedEventRequest

type VideoTransformationAcceptedEventRequest struct {
	// Full URL of the transformation request that was submitted.
	URL string `json:"url,required" format:"uri"`
	// Unique identifier for the originating transformation request.
	XRequestID string `json:"x_request_id,required"`
	// User-Agent header from the original request that triggered the transformation.
	UserAgent string `json:"user_agent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		XRequestID  respjson.Field
		UserAgent   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the original request that triggered the video transformation.

func (VideoTransformationAcceptedEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationAcceptedEventRequest) UnmarshalJSON

func (r *VideoTransformationAcceptedEventRequest) UnmarshalJSON(data []byte) error

type VideoTransformationErrorEvent

type VideoTransformationErrorEvent struct {
	// Timestamp when the event was created in ISO8601 format.
	CreatedAt time.Time                         `json:"created_at,required" format:"date-time"`
	Data      VideoTransformationErrorEventData `json:"data,required"`
	// Information about the original request that triggered the video transformation.
	Request VideoTransformationErrorEventRequest `json:"request,required"`
	Type    constant.VideoTransformationError    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support.

func (VideoTransformationErrorEvent) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEvent) UnmarshalJSON

func (r *VideoTransformationErrorEvent) UnmarshalJSON(data []byte) error

type VideoTransformationErrorEventData

type VideoTransformationErrorEventData struct {
	// Information about the source video asset being transformed.
	Asset          VideoTransformationErrorEventDataAsset          `json:"asset,required"`
	Transformation VideoTransformationErrorEventDataTransformation `json:"transformation,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asset          respjson.Field
		Transformation respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoTransformationErrorEventData) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventData) UnmarshalJSON

func (r *VideoTransformationErrorEventData) UnmarshalJSON(data []byte) error

type VideoTransformationErrorEventDataAsset

type VideoTransformationErrorEventDataAsset struct {
	// URL to download or access the source video file.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the source video asset being transformed.

func (VideoTransformationErrorEventDataAsset) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventDataAsset) UnmarshalJSON

func (r *VideoTransformationErrorEventDataAsset) UnmarshalJSON(data []byte) error

type VideoTransformationErrorEventDataTransformation

type VideoTransformationErrorEventDataTransformation struct {
	// Type of video transformation:
	//
	//   - `video-transformation`: Standard video processing (resize, format conversion,
	//     etc.)
	//   - `gif-to-video`: Convert animated GIF to video format
	//   - `video-thumbnail`: Generate thumbnail image from video
	//
	// Any of "video-transformation", "gif-to-video", "video-thumbnail".
	Type string `json:"type,required"`
	// Details about the transformation error.
	Error VideoTransformationErrorEventDataTransformationError `json:"error"`
	// Configuration options for video transformations.
	Options VideoTransformationErrorEventDataTransformationOptions `json:"options"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Error       respjson.Field
		Options     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoTransformationErrorEventDataTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventDataTransformation) UnmarshalJSON

type VideoTransformationErrorEventDataTransformationError

type VideoTransformationErrorEventDataTransformationError struct {
	// Specific reason for the transformation failure:
	//
	// - `encoding_failed`: Error during video encoding process
	// - `download_failed`: Could not download source video
	// - `internal_server_error`: Unexpected server error
	//
	// Any of "encoding_failed", "download_failed", "internal_server_error".
	Reason string `json:"reason,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about the transformation error.

func (VideoTransformationErrorEventDataTransformationError) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventDataTransformationError) UnmarshalJSON

type VideoTransformationErrorEventDataTransformationOptions

type VideoTransformationErrorEventDataTransformationOptions struct {
	// Audio codec used for encoding (aac or opus).
	//
	// Any of "aac", "opus".
	AudioCodec string `json:"audio_codec"`
	// Whether to automatically rotate the video based on metadata.
	AutoRotate bool `json:"auto_rotate"`
	// Output format for the transformed video or thumbnail.
	//
	// Any of "mp4", "webm", "jpg", "png", "webp".
	Format string `json:"format"`
	// Quality setting for the output video.
	Quality int64 `json:"quality"`
	// Streaming protocol for adaptive bitrate streaming.
	//
	// Any of "HLS", "DASH".
	StreamProtocol string `json:"stream_protocol"`
	// Array of quality representations for adaptive bitrate streaming.
	Variants []string `json:"variants"`
	// Video codec used for encoding (h264, vp9, or av1).
	//
	// Any of "h264", "vp9", "av1".
	VideoCodec string `json:"video_codec"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AudioCodec     respjson.Field
		AutoRotate     respjson.Field
		Format         respjson.Field
		Quality        respjson.Field
		StreamProtocol respjson.Field
		Variants       respjson.Field
		VideoCodec     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration options for video transformations.

func (VideoTransformationErrorEventDataTransformationOptions) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventDataTransformationOptions) UnmarshalJSON

type VideoTransformationErrorEventRequest

type VideoTransformationErrorEventRequest struct {
	// Full URL of the transformation request that was submitted.
	URL string `json:"url,required" format:"uri"`
	// Unique identifier for the originating transformation request.
	XRequestID string `json:"x_request_id,required"`
	// User-Agent header from the original request that triggered the transformation.
	UserAgent string `json:"user_agent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		XRequestID  respjson.Field
		UserAgent   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the original request that triggered the video transformation.

func (VideoTransformationErrorEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationErrorEventRequest) UnmarshalJSON

func (r *VideoTransformationErrorEventRequest) UnmarshalJSON(data []byte) error

type VideoTransformationReadyEvent

type VideoTransformationReadyEvent struct {
	// Timestamp when the event was created in ISO8601 format.
	CreatedAt time.Time                         `json:"created_at,required" format:"date-time"`
	Data      VideoTransformationReadyEventData `json:"data,required"`
	// Information about the original request that triggered the video transformation.
	Request VideoTransformationReadyEventRequest `json:"request,required"`
	Type    constant.VideoTransformationReady    `json:"type,required"`
	// Performance metrics for the transformation process.
	Timings VideoTransformationReadyEventTimings `json:"timings"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Data        respjson.Field
		Request     respjson.Field
		Type        respjson.Field
		Timings     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	BaseWebhookEvent
}

Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users.

func (VideoTransformationReadyEvent) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEvent) UnmarshalJSON

func (r *VideoTransformationReadyEvent) UnmarshalJSON(data []byte) error

type VideoTransformationReadyEventData

type VideoTransformationReadyEventData struct {
	// Information about the source video asset being transformed.
	Asset          VideoTransformationReadyEventDataAsset          `json:"asset,required"`
	Transformation VideoTransformationReadyEventDataTransformation `json:"transformation,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Asset          respjson.Field
		Transformation respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoTransformationReadyEventData) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventData) UnmarshalJSON

func (r *VideoTransformationReadyEventData) UnmarshalJSON(data []byte) error

type VideoTransformationReadyEventDataAsset

type VideoTransformationReadyEventDataAsset struct {
	// URL to download or access the source video file.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the source video asset being transformed.

func (VideoTransformationReadyEventDataAsset) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventDataAsset) UnmarshalJSON

func (r *VideoTransformationReadyEventDataAsset) UnmarshalJSON(data []byte) error

type VideoTransformationReadyEventDataTransformation

type VideoTransformationReadyEventDataTransformation struct {
	// Type of video transformation:
	//
	//   - `video-transformation`: Standard video processing (resize, format conversion,
	//     etc.)
	//   - `gif-to-video`: Convert animated GIF to video format
	//   - `video-thumbnail`: Generate thumbnail image from video
	//
	// Any of "video-transformation", "gif-to-video", "video-thumbnail".
	Type string `json:"type,required"`
	// Configuration options for video transformations.
	Options VideoTransformationReadyEventDataTransformationOptions `json:"options"`
	// Information about the transformed output video.
	Output VideoTransformationReadyEventDataTransformationOutput `json:"output"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Options     respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoTransformationReadyEventDataTransformation) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventDataTransformation) UnmarshalJSON

type VideoTransformationReadyEventDataTransformationOptions

type VideoTransformationReadyEventDataTransformationOptions struct {
	// Audio codec used for encoding (aac or opus).
	//
	// Any of "aac", "opus".
	AudioCodec string `json:"audio_codec"`
	// Whether to automatically rotate the video based on metadata.
	AutoRotate bool `json:"auto_rotate"`
	// Output format for the transformed video or thumbnail.
	//
	// Any of "mp4", "webm", "jpg", "png", "webp".
	Format string `json:"format"`
	// Quality setting for the output video.
	Quality int64 `json:"quality"`
	// Streaming protocol for adaptive bitrate streaming.
	//
	// Any of "HLS", "DASH".
	StreamProtocol string `json:"stream_protocol"`
	// Array of quality representations for adaptive bitrate streaming.
	Variants []string `json:"variants"`
	// Video codec used for encoding (h264, vp9, or av1).
	//
	// Any of "h264", "vp9", "av1".
	VideoCodec string `json:"video_codec"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AudioCodec     respjson.Field
		AutoRotate     respjson.Field
		Format         respjson.Field
		Quality        respjson.Field
		StreamProtocol respjson.Field
		Variants       respjson.Field
		VideoCodec     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration options for video transformations.

func (VideoTransformationReadyEventDataTransformationOptions) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventDataTransformationOptions) UnmarshalJSON

type VideoTransformationReadyEventDataTransformationOutput

type VideoTransformationReadyEventDataTransformationOutput struct {
	// URL to access the transformed video.
	URL string `json:"url,required" format:"uri"`
	// Metadata of the output video file.
	VideoMetadata VideoTransformationReadyEventDataTransformationOutputVideoMetadata `json:"video_metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL           respjson.Field
		VideoMetadata respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the transformed output video.

func (VideoTransformationReadyEventDataTransformationOutput) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventDataTransformationOutput) UnmarshalJSON

type VideoTransformationReadyEventDataTransformationOutputVideoMetadata

type VideoTransformationReadyEventDataTransformationOutputVideoMetadata struct {
	// Bitrate of the output video in bits per second.
	Bitrate int64 `json:"bitrate,required"`
	// Duration of the output video in seconds.
	Duration float64 `json:"duration,required"`
	// Height of the output video in pixels.
	Height int64 `json:"height,required"`
	// Width of the output video in pixels.
	Width int64 `json:"width,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Bitrate     respjson.Field
		Duration    respjson.Field
		Height      respjson.Field
		Width       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Metadata of the output video file.

func (VideoTransformationReadyEventDataTransformationOutputVideoMetadata) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventDataTransformationOutputVideoMetadata) UnmarshalJSON

type VideoTransformationReadyEventRequest

type VideoTransformationReadyEventRequest struct {
	// Full URL of the transformation request that was submitted.
	URL string `json:"url,required" format:"uri"`
	// Unique identifier for the originating transformation request.
	XRequestID string `json:"x_request_id,required"`
	// User-Agent header from the original request that triggered the transformation.
	UserAgent string `json:"user_agent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		XRequestID  respjson.Field
		UserAgent   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about the original request that triggered the video transformation.

func (VideoTransformationReadyEventRequest) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventRequest) UnmarshalJSON

func (r *VideoTransformationReadyEventRequest) UnmarshalJSON(data []byte) error

type VideoTransformationReadyEventTimings

type VideoTransformationReadyEventTimings struct {
	// Time spent downloading the source video from your origin or media library, in
	// milliseconds.
	DownloadDuration int64 `json:"download_duration"`
	// Time spent encoding the video, in milliseconds.
	EncodingDuration int64 `json:"encoding_duration"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DownloadDuration respjson.Field
		EncodingDuration respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Performance metrics for the transformation process.

func (VideoTransformationReadyEventTimings) RawJSON

Returns the unmodified JSON received from the API

func (*VideoTransformationReadyEventTimings) UnmarshalJSON

func (r *VideoTransformationReadyEventTimings) UnmarshalJSON(data []byte) error

type WebhookService

type WebhookService struct {
	Options []option.RequestOption
}

WebhookService contains methods and other services that help with interacting with the ImageKit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebhookService method instead.

func NewWebhookService

func NewWebhookService(opts ...option.RequestOption) (r WebhookService)

NewWebhookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WebhookService) UnsafeUnwrap

func (r *WebhookService) UnsafeUnwrap(payload []byte, opts ...option.RequestOption) (*UnsafeUnwrapWebhookEventUnion, error)

func (*WebhookService) Unwrap

func (r *WebhookService) Unwrap(payload []byte, headers http.Header, opts ...option.RequestOption) (*UnwrapWebhookEventUnion, error)

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
Package lib provides helper utilities for ImageKit SDK This file contains custom helper functions - not generated
Package lib provides helper utilities for ImageKit SDK This file contains custom helper functions - not generated
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL