ideogramsdk

package module
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

README

Ideogram SDK Go API Library

Go Reference

The Ideogram SDK Go library provides convenient access to the Ideogram SDK REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/NeuralNetLab/ideogram-sdk-go" // imported as ideogramsdk
)

Or to pin the version:

go get -u 'github.com/NeuralNetLab/ideogram-sdk-go@v0.1.0-alpha.1'

Requirements

This library requires Go 1.18+.

Usage

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

package main

import (
	"bytes"
	"context"
	"fmt"
	"io"

	"github.com/NeuralNetLab/ideogram-sdk-go"
	"github.com/NeuralNetLab/ideogram-sdk-go/option"
)

func main() {
	client := ideogramsdk.NewClient(
		option.WithAPIKey("My API Key"),           // defaults to os.LookupEnv("IDEOGRAM_SDK_API_KEY")
		option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("IDEOGRAM_SDK_BEARER_TOKEN")
	)
	describe, err := client.Describe.New(context.TODO(), ideogramsdk.DescribeNewParams{
		ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", describe.Descriptions)
}

Request fields

The ideogramsdk 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, ideogramsdk.String(string), ideogramsdk.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 := ideogramsdk.ExampleParams{
	ID:   "id_xxx",                  // required property
	Name: ideogramsdk.String("..."), // optional property

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

	Origin: ideogramsdk.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[ideogramsdk.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 := ideogramsdk.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Describe.New(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"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *ideogramsdk.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:

_, err := client.Describe.New(context.TODO(), ideogramsdk.DescribeNewParams{
	ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
})
if err != nil {
	var apierr *ideogramsdk.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 "/describe": 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()
client.Describe.New(
	ctx,
	ideogramsdk.DescribeNewParams{
		ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
	},
	// 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 ideogramsdk.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

// A file from the file system
file, err := os.Open("/path/to/file")
ideogramsdk.DescribeNewParams{
	ImageFile: file,
}

// A file from a string
ideogramsdk.DescribeNewParams{
	ImageFile: strings.NewReader("my file contents"),
}

// With a custom filename and contentType
ideogramsdk.DescribeNewParams{
	ImageFile: ideogramsdk.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
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 := ideogramsdk.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Describe.New(
	context.TODO(),
	ideogramsdk.DescribeNewParams{
		ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
	},
	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
describe, err := client.Describe.New(
	context.TODO(),
	ideogramsdk.DescribeNewParams{
		ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", describe)

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: ideogramsdk.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 := ideogramsdk.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

This section is empty.

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 (IDEOGRAM_SDK_API_KEY, IDEOGRAM_SDK_BEARER_TOKEN, IDEOGRAM_SDK_BASE_URL). This should be used to initialize new clients.

func File

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

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 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 AspectRatio

type AspectRatio string

The aspect ratio to use for image generation, which determines the image's resolution. Cannot be used in conjunction with resolution. Defaults to 1x1.

const (
	AspectRatio1x3   AspectRatio = "1x3"
	AspectRatio3x1   AspectRatio = "3x1"
	AspectRatio1x2   AspectRatio = "1x2"
	AspectRatio2x1   AspectRatio = "2x1"
	AspectRatio9x16  AspectRatio = "9x16"
	AspectRatio16x9  AspectRatio = "16x9"
	AspectRatio10x16 AspectRatio = "10x16"
	AspectRatio16x10 AspectRatio = "16x10"
	AspectRatio2x3   AspectRatio = "2x3"
	AspectRatio3x2   AspectRatio = "3x2"
	AspectRatio3x4   AspectRatio = "3x4"
	AspectRatio4x3   AspectRatio = "4x3"
	AspectRatio4x5   AspectRatio = "4x5"
	AspectRatio5x4   AspectRatio = "5x4"
	AspectRatio1x1   AspectRatio = "1x1"
)

type Client

type Client struct {
	Options         []option.RequestOption
	Describe        DescribeService
	Edit            EditService
	Generate        GenerateService
	InternalTesting InternalTestingService
	Manage          ManageService
	Reframe         ReframeService
	Remix           RemixService
	Upscale         UpscaleService
	IdeogramV3      IdeogramV3Service
}

Client creates a struct with services and top level methods that help with interacting with the ideogram-sdk 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 (IDEOGRAM_SDK_API_KEY, IDEOGRAM_SDK_BEARER_TOKEN, IDEOGRAM_SDK_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 ColorPaletteColorPaletteWithMembersMemberParam

type ColorPaletteColorPaletteWithMembersMemberParam struct {
	// The hexadecimal representation of the color with an optional chosen weight.
	ColorHex string `json:"color_hex,required"`
	// The weight of the color in the color palette.
	ColorWeight param.Opt[float64] `json:"color_weight,omitzero"`
	// contains filtered or unexported fields
}

A member of a color palette.

The property ColorHex is required.

func (ColorPaletteColorPaletteWithMembersMemberParam) MarshalJSON

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

func (*ColorPaletteColorPaletteWithMembersMemberParam) UnmarshalJSON

type ColorPaletteColorPaletteWithMembersParam

type ColorPaletteColorPaletteWithMembersParam struct {
	// A list of ColorPaletteMembers that define the color palette. Each color palette
	// member consists of a required color hex and an optional weight between 0.05 and
	// 1.0 (inclusive). It is recommended that these weights descend from highest to
	// lowest for the color hexes provided.
	Members []ColorPaletteColorPaletteWithMembersMemberParam `json:"members,omitzero,required"`
	// contains filtered or unexported fields
}

A color palette represented only via its members. Cannot be used in conjunction with preset name.

The property Members is required.

func (ColorPaletteColorPaletteWithMembersParam) MarshalJSON

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

func (*ColorPaletteColorPaletteWithMembersParam) UnmarshalJSON

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

type ColorPaletteColorPaletteWithPresetNameParam

type ColorPaletteColorPaletteWithPresetNameParam struct {
	// A color palette preset value.
	//
	// Any of "EMBER", "FRESH", "JUNGLE", "MAGIC", "MELON", "MOSAIC", "PASTEL",
	// "ULTRAMARINE".
	Name string `json:"name,omitzero,required"`
	// contains filtered or unexported fields
}

The property Name is required.

func (ColorPaletteColorPaletteWithPresetNameParam) MarshalJSON

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

func (*ColorPaletteColorPaletteWithPresetNameParam) UnmarshalJSON

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

type ColorPaletteUnionParam

type ColorPaletteUnionParam struct {
	OfColorPaletteWithPresetName *ColorPaletteColorPaletteWithPresetNameParam `json:",omitzero,inline"`
	OfColorPaletteWithMembers    *ColorPaletteColorPaletteWithMembersParam    `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 ColorPaletteParamOfColorPaletteWithPresetName

func ColorPaletteParamOfColorPaletteWithPresetName(name string) ColorPaletteUnionParam

func (ColorPaletteUnionParam) MarshalJSON

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

func (*ColorPaletteUnionParam) UnmarshalJSON

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

type DescribeNewParams

type DescribeNewParams struct {
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	ImageFile io.Reader `json:"image_file,omitzero,required" format:"binary"`
	// contains filtered or unexported fields
}

func (DescribeNewParams) MarshalMultipart

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

type DescribeNewResponse

type DescribeNewResponse struct {
	// A collection of descriptions for given content.
	Descriptions []DescribeNewResponseDescription `json:"descriptions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Descriptions respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response for a describe request encapsulates a list of descriptions.

func (DescribeNewResponse) RawJSON

func (r DescribeNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DescribeNewResponse) UnmarshalJSON

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

type DescribeNewResponseDescription

type DescribeNewResponseDescription struct {
	// The generated description for the provided image.
	Text string `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DescribeNewResponseDescription) RawJSON

Returns the unmodified JSON received from the API

func (*DescribeNewResponseDescription) UnmarshalJSON

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

type DescribeService

type DescribeService struct {
	Options []option.RequestOption
}

DescribeService contains methods and other services that help with interacting with the ideogram-sdk 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 NewDescribeService method instead.

func NewDescribeService

func NewDescribeService(opts ...option.RequestOption) (r DescribeService)

NewDescribeService 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 (*DescribeService) New

Describe an image.

Supported image formats include JPEG, PNG, and WebP.

type EditApplyParams

type EditApplyParams struct {
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	ImageFile io.Reader `json:"image_file,omitzero,required" format:"binary"`
	// A black and white image of the same size as the image being edited (max size
	// 10MB). Black regions in the mask should match up with the regions of the image
	// that you would like to edit; only JPEG, WebP and PNG formats are supported at
	// this time.
	Mask io.Reader `json:"mask,omitzero,required" format:"binary"`
	// The model used to generate an image or edit one. /generate and /remix supports
	// all model types, however, /edit is only supported for V_2 and V_2_TURBO.
	//
	// Any of "V_1", "V_1_TURBO", "V_2", "V_2_TURBO", "V_2A", "V_2A_TURBO", "V_3".
	Model ModelEnum `json:"model,omitzero,required"`
	// The prompt used to describe the edited result.
	Prompt string `json:"prompt,required"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPromptOption MagicPromptOption `json:"magic_prompt_option,omitzero"`
	// The style type to generate with; this is only applicable for models V_2 and
	// above and should not be specified for model versions V_1.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN", "RENDER_3D", "ANIME", "CUSTOM".
	StyleType StyleTypeV2AndAbove `json:"style_type,omitzero"`
	// contains filtered or unexported fields
}

func (EditApplyParams) MarshalMultipart

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

type EditService

type EditService struct {
	Options []option.RequestOption
}

EditService contains methods and other services that help with interacting with the ideogram-sdk 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 NewEditService method instead.

func NewEditService

func NewEditService(opts ...option.RequestOption) (r EditService)

NewEditService 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 (*EditService) Apply

func (r *EditService) Apply(ctx context.Context, body EditApplyParams, opts ...option.RequestOption) (res *GenerateImage, err error)

Edit a given image synchronously using the provided mask. The mask indicates which part of the image should be edited, while the prompt and chosen style type can further guide the edit.

Supported image formats include JPEG, PNG, and WebP.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

type Error

type Error = apierror.Error

type GenerateImage

type GenerateImage struct {
	// The time the request was created.
	Created time.Time `json:"created,required" format:"date-time"`
	// A list of ImageObjects that contain the generated image(s).
	Data []GenerateImageData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response which contains information about the generated image, including the download link. Images links are available for a limited period of time; if you would like to keep the image, you must download it.

func (GenerateImage) RawJSON

func (r GenerateImage) RawJSON() string

Returns the unmodified JSON received from the API

func (*GenerateImage) UnmarshalJSON

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

type GenerateImageData

type GenerateImageData struct {
	// Whether this request passes safety checks. If false, the url field will be
	// empty.
	IsImageSafe bool `json:"is_image_safe,required"`
	// The prompt used for the generation. This may be different from the original
	// prompt.
	Prompt string `json:"prompt,required"`
	// The resolution of the final image.
	Resolution string `json:"resolution,required"`
	// Random seed. Set for reproducible generation.
	Seed int64 `json:"seed,required"`
	// The style type to generate with; this is only applicable for models V_2 and
	// above and should not be specified for model versions V_1.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN", "RENDER_3D", "ANIME", "CUSTOM".
	StyleType StyleTypeV2AndAbove `json:"style_type"`
	// The direct link to the image generated.
	URL string `json:"url,nullable" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsImageSafe respjson.Field
		Prompt      respjson.Field
		Resolution  respjson.Field
		Seed        respjson.Field
		StyleType   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (GenerateImageData) RawJSON

func (r GenerateImageData) RawJSON() string

Returns the unmodified JSON received from the API

func (*GenerateImageData) UnmarshalJSON

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

type GenerateNewParams

type GenerateNewParams struct {
	ImageRequest ImageRequestParam `json:"image_request,omitzero,required"`
	// contains filtered or unexported fields
}

func (GenerateNewParams) MarshalJSON

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

func (*GenerateNewParams) UnmarshalJSON

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

type GenerateService

type GenerateService struct {
	Options []option.RequestOption
}

GenerateService contains methods and other services that help with interacting with the ideogram-sdk 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 NewGenerateService method instead.

func NewGenerateService

func NewGenerateService(opts ...option.RequestOption) (r GenerateService)

NewGenerateService 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 (*GenerateService) New

Generates images synchronously based on a given prompt and optional parameters.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

type IdeogramV3EditParams

type IdeogramV3EditParams struct {
	// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are
	// supported at this time.
	Image io.Reader `json:"image,omitzero,required" format:"binary"`
	// A black and white image of the same size as the image being edited (max size
	// 10MB). Black regions in the mask should match up with the regions of the image
	// that you would like to edit; only JPEG, WebP and PNG formats are supported at
	// this time.
	Mask io.Reader `json:"mask,omitzero,required" format:"binary"`
	// The prompt used to describe the edited result.
	Prompt string `json:"prompt,required"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPrompt MagicPromptOption `json:"magic_prompt,omitzero"`
	// The rendering speed to use.
	//
	// Any of "TURBO", "BALANCED", "DEFAULT", "QUALITY".
	RenderingSpeed RenderingSpeed `json:"rendering_speed,omitzero"`
	// A list of 8 character hexadecimal codes representing the style of the image.
	// Cannot be used in conjunction with style_reference_images or style_type.
	StyleCodes []string `json:"style_codes,omitzero"`
	// A set of images to use as style references (maximum total size 10MB across all
	// style references). The images should be in JPEG, PNG or WebP format.
	StyleReferenceImages []io.Reader `json:"style_reference_images,omitzero" format:"binary"`
	// contains filtered or unexported fields
}

func (IdeogramV3EditParams) MarshalMultipart

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

type IdeogramV3GenerateParams

type IdeogramV3GenerateParams struct {
	// The prompt to use to generate the image.
	Prompt string `json:"prompt,required"`
	// Description of what to exclude from an image. Descriptions in the prompt take
	// precedence to descriptions in the negative prompt.
	NegativePrompt param.Opt[string] `json:"negative_prompt,omitzero"`
	// Number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// The aspect ratio to use for image generation, which determines the image's
	// resolution. Cannot be used in conjunction with resolution. Defaults to 1x1.
	//
	// Any of "1x3", "3x1", "1x2", "2x1", "9x16", "16x9", "10x16", "16x10", "2x3",
	// "3x2", "3x4", "4x3", "4x5", "5x4", "1x1".
	AspectRatio AspectRatio `json:"aspect_ratio,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPrompt MagicPromptOption `json:"magic_prompt,omitzero"`
	// The rendering speed to use.
	//
	// Any of "TURBO", "BALANCED", "DEFAULT", "QUALITY".
	RenderingSpeed RenderingSpeed `json:"rendering_speed,omitzero"`
	// The resolutions supported for Ideogram 3.0.
	//
	// Any of "512x1536", "576x1408", "576x1472", "576x1536", "640x1344", "640x1408",
	// "640x1472", "640x1536", "704x1152", "704x1216", "704x1280", "704x1344",
	// "704x1408", "704x1472", "736x1312", "768x1088", "768x1216", "768x1280",
	// "768x1344", "800x1280", "832x960", "832x1024", "832x1088", "832x1152",
	// "832x1216", "832x1248", "864x1152", "896x960", "896x1024", "896x1088",
	// "896x1120", "896x1152", "960x832", "960x896", "960x1024", "960x1088",
	// "1024x832", "1024x896", "1024x960", "1024x1024", "1088x768", "1088x832",
	// "1088x896", "1088x960", "1120x896", "1152x704", "1152x832", "1152x864",
	// "1152x896", "1216x704", "1216x768", "1216x832", "1248x832", "1280x704",
	// "1280x768", "1280x800", "1312x736", "1344x640", "1344x704", "1344x768",
	// "1408x576", "1408x640", "1408x704", "1472x576", "1472x640", "1472x704",
	// "1536x512", "1536x576", "1536x640".
	Resolution ResolutionIdeogram `json:"resolution,omitzero"`
	// A list of 8 character hexadecimal codes representing the style of the image.
	// Cannot be used in conjunction with style_reference_images or style_type.
	StyleCodes []string `json:"style_codes,omitzero"`
	// A set of images to use as style references (maximum total size 10MB across all
	// style references). The images should be in JPEG, PNG or WebP format.
	StyleReferenceImages []io.Reader `json:"style_reference_images,omitzero" format:"binary"`
	// The style type to generate with.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN".
	StyleType StyleTypeV3 `json:"style_type,omitzero"`
	// contains filtered or unexported fields
}

func (IdeogramV3GenerateParams) MarshalMultipart

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

type IdeogramV3ReframeParams

type IdeogramV3ReframeParams struct {
	// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are
	// supported at this time.
	Image io.Reader `json:"image,omitzero,required" format:"binary"`
	// The resolutions supported for Ideogram 3.0.
	//
	// Any of "512x1536", "576x1408", "576x1472", "576x1536", "640x1344", "640x1408",
	// "640x1472", "640x1536", "704x1152", "704x1216", "704x1280", "704x1344",
	// "704x1408", "704x1472", "736x1312", "768x1088", "768x1216", "768x1280",
	// "768x1344", "800x1280", "832x960", "832x1024", "832x1088", "832x1152",
	// "832x1216", "832x1248", "864x1152", "896x960", "896x1024", "896x1088",
	// "896x1120", "896x1152", "960x832", "960x896", "960x1024", "960x1088",
	// "1024x832", "1024x896", "1024x960", "1024x1024", "1088x768", "1088x832",
	// "1088x896", "1088x960", "1120x896", "1152x704", "1152x832", "1152x864",
	// "1152x896", "1216x704", "1216x768", "1216x832", "1248x832", "1280x704",
	// "1280x768", "1280x800", "1312x736", "1344x640", "1344x704", "1344x768",
	// "1408x576", "1408x640", "1408x704", "1472x576", "1472x640", "1472x704",
	// "1536x512", "1536x576", "1536x640".
	Resolution ResolutionIdeogram `json:"resolution,omitzero,required"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// The rendering speed to use.
	//
	// Any of "TURBO", "BALANCED", "DEFAULT", "QUALITY".
	RenderingSpeed RenderingSpeed `json:"rendering_speed,omitzero"`
	// A list of 8 character hexadecimal codes representing the style of the image.
	// Cannot be used in conjunction with style_reference_images or style_type.
	StyleCodes []string `json:"style_codes,omitzero"`
	// A set of images to use as style references (maximum total size 10MB across all
	// style references). The images should be in JPEG, PNG or WebP format.
	StyleReferenceImages []io.Reader `json:"style_reference_images,omitzero" format:"binary"`
	// contains filtered or unexported fields
}

func (IdeogramV3ReframeParams) MarshalMultipart

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

type IdeogramV3RemixParams

type IdeogramV3RemixParams struct {
	// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are
	// supported at this time.
	Image io.Reader `json:"image,omitzero,required" format:"binary"`
	// The prompt to use to generate the image.
	Prompt      string           `json:"prompt,required"`
	ImageWeight param.Opt[int64] `json:"image_weight,omitzero"`
	// Description of what to exclude from an image. Descriptions in the prompt take
	// precedence to descriptions in the negative prompt.
	NegativePrompt param.Opt[string] `json:"negative_prompt,omitzero"`
	// Number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// The aspect ratio to use for image generation, which determines the image's
	// resolution. Cannot be used in conjunction with resolution. Defaults to 1x1.
	//
	// Any of "1x3", "3x1", "1x2", "2x1", "9x16", "16x9", "10x16", "16x10", "2x3",
	// "3x2", "3x4", "4x3", "4x5", "5x4", "1x1".
	AspectRatio AspectRatio `json:"aspect_ratio,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPrompt MagicPromptOption `json:"magic_prompt,omitzero"`
	// The rendering speed to use.
	//
	// Any of "TURBO", "BALANCED", "DEFAULT", "QUALITY".
	RenderingSpeed RenderingSpeed `json:"rendering_speed,omitzero"`
	// The resolutions supported for Ideogram 3.0.
	//
	// Any of "512x1536", "576x1408", "576x1472", "576x1536", "640x1344", "640x1408",
	// "640x1472", "640x1536", "704x1152", "704x1216", "704x1280", "704x1344",
	// "704x1408", "704x1472", "736x1312", "768x1088", "768x1216", "768x1280",
	// "768x1344", "800x1280", "832x960", "832x1024", "832x1088", "832x1152",
	// "832x1216", "832x1248", "864x1152", "896x960", "896x1024", "896x1088",
	// "896x1120", "896x1152", "960x832", "960x896", "960x1024", "960x1088",
	// "1024x832", "1024x896", "1024x960", "1024x1024", "1088x768", "1088x832",
	// "1088x896", "1088x960", "1120x896", "1152x704", "1152x832", "1152x864",
	// "1152x896", "1216x704", "1216x768", "1216x832", "1248x832", "1280x704",
	// "1280x768", "1280x800", "1312x736", "1344x640", "1344x704", "1344x768",
	// "1408x576", "1408x640", "1408x704", "1472x576", "1472x640", "1472x704",
	// "1536x512", "1536x576", "1536x640".
	Resolution ResolutionIdeogram `json:"resolution,omitzero"`
	// A list of 8 character hexadecimal codes representing the style of the image.
	// Cannot be used in conjunction with style_reference_images or style_type.
	StyleCodes []string `json:"style_codes,omitzero"`
	// A set of images to use as style references (maximum total size 10MB across all
	// style references). The images should be in JPEG, PNG or WebP format.
	StyleReferenceImages []io.Reader `json:"style_reference_images,omitzero" format:"binary"`
	// The style type to generate with.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN".
	StyleType StyleTypeV3 `json:"style_type,omitzero"`
	// contains filtered or unexported fields
}

func (IdeogramV3RemixParams) MarshalMultipart

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

type IdeogramV3ReplaceBackgroundParams

type IdeogramV3ReplaceBackgroundParams struct {
	// The image whose background is being replaced (max size 10MB); only JPEG, WebP
	// and PNG formats are supported at this time.
	Image io.Reader `json:"image,omitzero,required" format:"binary"`
	// The prompt describing the desired new background.
	Prompt string `json:"prompt,required"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPrompt MagicPromptOption `json:"magic_prompt,omitzero"`
	// The rendering speed to use.
	//
	// Any of "TURBO", "BALANCED", "DEFAULT", "QUALITY".
	RenderingSpeed RenderingSpeed `json:"rendering_speed,omitzero"`
	// A list of 8 character hexadecimal codes representing the style of the image.
	// Cannot be used in conjunction with style_reference_images or style_type.
	StyleCodes []string `json:"style_codes,omitzero"`
	// A set of images to use as style references (maximum total size 10MB across all
	// style references). The images should be in JPEG, PNG or WebP format.
	StyleReferenceImages []io.Reader `json:"style_reference_images,omitzero" format:"binary"`
	// contains filtered or unexported fields
}

func (IdeogramV3ReplaceBackgroundParams) MarshalMultipart

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

type IdeogramV3Service

type IdeogramV3Service struct {
	Options []option.RequestOption
}

IdeogramV3Service contains methods and other services that help with interacting with the ideogram-sdk 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 NewIdeogramV3Service method instead.

func NewIdeogramV3Service

func NewIdeogramV3Service(opts ...option.RequestOption) (r IdeogramV3Service)

NewIdeogramV3Service 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 (*IdeogramV3Service) Edit

Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image should be edited, while the prompt and chosen style can further guide the edit.

Supported image formats include JPEG, PNG, and WebP.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

func (*IdeogramV3Service) Generate

Generates images synchronously based on a given prompt and optional parameters using the Ideogram 3.0 model.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

func (*IdeogramV3Service) Reframe

Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.

Image links are available for a limited period of time; if you would like to keep the image, you must download it.

func (*IdeogramV3Service) Remix

Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.

Input images are cropped to the chosen aspect ratio before being remixed.

Supported image formats include JPEG, PNG, and WebP.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

func (*IdeogramV3Service) ReplaceBackground

Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject will be identified and kept, while the background is replaced based on the prompt and chosen style. Supported image formats include JPEG, PNG, and WebP. Images links are available for a limited period of time; if you would like to keep the image, you must download it.

type ImageGenerationResponse

type ImageGenerationResponse struct {
	// The time the request was created.
	Created time.Time `json:"created,required" format:"date-time"`
	// A list of ImageObjects that contain the generated image(s).
	Data []ImageGenerationResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The response which contains information about the generated image, including the download link. Images links are available for a limited period of time; if you would like to keep the image, you must download it.

func (ImageGenerationResponse) RawJSON

func (r ImageGenerationResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageGenerationResponse) UnmarshalJSON

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

type ImageGenerationResponseData

type ImageGenerationResponseData struct {
	// Whether this request passes safety checks. If false, the url field will be
	// empty.
	IsImageSafe bool `json:"is_image_safe,required"`
	// The prompt used for the generation. This may be different from the original
	// prompt.
	Prompt string `json:"prompt,required"`
	// The resolutions supported for Ideogram 3.0.
	//
	// Any of "512x1536", "576x1408", "576x1472", "576x1536", "640x1344", "640x1408",
	// "640x1472", "640x1536", "704x1152", "704x1216", "704x1280", "704x1344",
	// "704x1408", "704x1472", "736x1312", "768x1088", "768x1216", "768x1280",
	// "768x1344", "800x1280", "832x960", "832x1024", "832x1088", "832x1152",
	// "832x1216", "832x1248", "864x1152", "896x960", "896x1024", "896x1088",
	// "896x1120", "896x1152", "960x832", "960x896", "960x1024", "960x1088",
	// "1024x832", "1024x896", "1024x960", "1024x1024", "1088x768", "1088x832",
	// "1088x896", "1088x960", "1120x896", "1152x704", "1152x832", "1152x864",
	// "1152x896", "1216x704", "1216x768", "1216x832", "1248x832", "1280x704",
	// "1280x768", "1280x800", "1312x736", "1344x640", "1344x704", "1344x768",
	// "1408x576", "1408x640", "1408x704", "1472x576", "1472x640", "1472x704",
	// "1536x512", "1536x576", "1536x640".
	Resolution ResolutionIdeogram `json:"resolution,required"`
	// Random seed. Set for reproducible generation.
	Seed int64 `json:"seed,required"`
	// The style type to generate with.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN".
	StyleType StyleTypeV3 `json:"style_type"`
	// The direct link to the image generated.
	URL string `json:"url,nullable" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsImageSafe respjson.Field
		Prompt      respjson.Field
		Resolution  respjson.Field
		Seed        respjson.Field
		StyleType   respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ImageGenerationResponseData) RawJSON

func (r ImageGenerationResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageGenerationResponseData) UnmarshalJSON

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

type ImageRequestAspectRatio

type ImageRequestAspectRatio string

(Cannot be used in conjunction with resolution) The aspect ratio to use for image generation, which determines the image's resolution. Defaults to ASPECT_1_1.

const (
	ImageRequestAspectRatioAspect10_16 ImageRequestAspectRatio = "ASPECT_10_16"
	ImageRequestAspectRatioAspect16_10 ImageRequestAspectRatio = "ASPECT_16_10"
	ImageRequestAspectRatioAspect9_16  ImageRequestAspectRatio = "ASPECT_9_16"
	ImageRequestAspectRatioAspect16_9  ImageRequestAspectRatio = "ASPECT_16_9"
	ImageRequestAspectRatioAspect3_2   ImageRequestAspectRatio = "ASPECT_3_2"
	ImageRequestAspectRatioAspect2_3   ImageRequestAspectRatio = "ASPECT_2_3"
	ImageRequestAspectRatioAspect4_3   ImageRequestAspectRatio = "ASPECT_4_3"
	ImageRequestAspectRatioAspect3_4   ImageRequestAspectRatio = "ASPECT_3_4"
	ImageRequestAspectRatioAspect1_1   ImageRequestAspectRatio = "ASPECT_1_1"
	ImageRequestAspectRatioAspect1_3   ImageRequestAspectRatio = "ASPECT_1_3"
	ImageRequestAspectRatioAspect3_1   ImageRequestAspectRatio = "ASPECT_3_1"
)

type ImageRequestParam

type ImageRequestParam struct {
	// The prompt to use to generate the image.
	Prompt string `json:"prompt,required"`
	// Only available for model versions V_1, V_1_TURBO, V_2 and V_2_TURBO. Description
	// of what to exclude from an image. Descriptions in the prompt take precedence to
	// descriptions in the negative prompt.
	NegativePrompt param.Opt[string] `json:"negative_prompt,omitzero"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// (Cannot be used in conjunction with resolution) The aspect ratio to use for
	// image generation, which determines the image's resolution. Defaults to
	// ASPECT_1_1.
	//
	// Any of "ASPECT_10_16", "ASPECT_16_10", "ASPECT_9_16", "ASPECT_16_9",
	// "ASPECT_3_2", "ASPECT_2_3", "ASPECT_4_3", "ASPECT_3_4", "ASPECT_1_1",
	// "ASPECT_1_3", "ASPECT_3_1".
	AspectRatio ImageRequestAspectRatio `json:"aspect_ratio,omitzero"`
	// A color palette for generation, must EITHER be specified via one of the presets
	// (name) or explicitly via hexadecimal representations of the color with optional
	// weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.
	ColorPalette ColorPaletteUnionParam `json:"color_palette,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPromptOption MagicPromptOption `json:"magic_prompt_option,omitzero"`
	// The magic prompt version to use when magic prompt option is set to AUTO or ON.
	//
	// Any of "V_0", "V_0_1", "V_0_2".
	MagicPromptVersion MagicPromptVersionEnum `json:"magic_prompt_version,omitzero"`
	// The model used to generate an image or edit one. /generate and /remix supports
	// all model types, however, /edit is only supported for V_2 and V_2_TURBO.
	//
	// Any of "V_1", "V_1_TURBO", "V_2", "V_2_TURBO", "V_2A", "V_2A_TURBO", "V_3".
	Model ModelEnum `json:"model,omitzero"`
	// (For model_version for 2.0 only, cannot be used in conjunction with
	// aspect_ratio) The resolution to use for image generation, represented in width x
	// height. If not specified, defaults to using aspect_ratio.
	//
	// Any of "RESOLUTION_512_1536", "RESOLUTION_576_1408", "RESOLUTION_576_1472",
	// "RESOLUTION_576_1536", "RESOLUTION_640_1024", "RESOLUTION_640_1344",
	// "RESOLUTION_640_1408", "RESOLUTION_640_1472", "RESOLUTION_640_1536",
	// "RESOLUTION_704_1152", "RESOLUTION_704_1216", "RESOLUTION_704_1280",
	// "RESOLUTION_704_1344", "RESOLUTION_704_1408", "RESOLUTION_704_1472",
	// "RESOLUTION_720_1280", "RESOLUTION_736_1312", "RESOLUTION_768_1024",
	// "RESOLUTION_768_1088", "RESOLUTION_768_1152", "RESOLUTION_768_1216",
	// "RESOLUTION_768_1232", "RESOLUTION_768_1280", "RESOLUTION_768_1344",
	// "RESOLUTION_832_960", "RESOLUTION_832_1024", "RESOLUTION_832_1088",
	// "RESOLUTION_832_1152", "RESOLUTION_832_1216", "RESOLUTION_832_1248",
	// "RESOLUTION_864_1152", "RESOLUTION_896_960", "RESOLUTION_896_1024",
	// "RESOLUTION_896_1088", "RESOLUTION_896_1120", "RESOLUTION_896_1152",
	// "RESOLUTION_960_832", "RESOLUTION_960_896", "RESOLUTION_960_1024",
	// "RESOLUTION_960_1088", "RESOLUTION_1024_640", "RESOLUTION_1024_768",
	// "RESOLUTION_1024_832", "RESOLUTION_1024_896", "RESOLUTION_1024_960",
	// "RESOLUTION_1024_1024", "RESOLUTION_1088_768", "RESOLUTION_1088_832",
	// "RESOLUTION_1088_896", "RESOLUTION_1088_960", "RESOLUTION_1120_896",
	// "RESOLUTION_1152_704", "RESOLUTION_1152_768", "RESOLUTION_1152_832",
	// "RESOLUTION_1152_864", "RESOLUTION_1152_896", "RESOLUTION_1216_704",
	// "RESOLUTION_1216_768", "RESOLUTION_1216_832", "RESOLUTION_1232_768",
	// "RESOLUTION_1248_832", "RESOLUTION_1280_704", "RESOLUTION_1280_720",
	// "RESOLUTION_1280_768", "RESOLUTION_1280_800", "RESOLUTION_1312_736",
	// "RESOLUTION_1344_640", "RESOLUTION_1344_704", "RESOLUTION_1344_768",
	// "RESOLUTION_1408_576", "RESOLUTION_1408_640", "RESOLUTION_1408_704",
	// "RESOLUTION_1472_576", "RESOLUTION_1472_640", "RESOLUTION_1472_704",
	// "RESOLUTION_1536_512", "RESOLUTION_1536_576", "RESOLUTION_1536_640".
	Resolution ResolutionImageGeneration `json:"resolution,omitzero"`
	// The style type to generate with; this is only applicable for models V_2 and
	// above and should not be specified for model versions V_1.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN", "RENDER_3D", "ANIME", "CUSTOM".
	StyleType StyleTypeV2AndAbove `json:"style_type,omitzero"`
	// contains filtered or unexported fields
}

The property Prompt is required.

func (ImageRequestParam) MarshalJSON

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

func (*ImageRequestParam) UnmarshalJSON

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

type InternalTestingNewParams

type InternalTestingNewParams struct {
	RequiredDateTypeField time.Time            `json:"required_date_type_field,required" format:"date"`
	XPosition             param.Opt[int64]     `json:"x_position,omitzero"`
	DateTimeTypeField     param.Opt[time.Time] `json:"date_time_type_field,omitzero" format:"date-time"`
	DateTypeField         param.Opt[time.Time] `json:"date_type_field,omitzero" format:"date"`
	SomeText              param.Opt[string]    `json:"some_text,omitzero"`
	XTestHeader           param.Opt[string]    `header:"X-Test-Header,omitzero" json:"-"`
	XTestHeader2          param.Opt[string]    `header:"X-Test-Header-2,omitzero" json:"-"`
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	AnotherImageFile io.Reader `json:"another_image_file,omitzero" format:"binary"`
	// Any of "EIN", "ZWEI", "DREI".
	EnumTypeField InternalTestingNewParamsEnumTypeField `json:"enum_type_field,omitzero"`
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	ImageFile                  io.Reader                                          `json:"image_file,omitzero" format:"binary"`
	NestedObject               NestedObjectParam                                  `json:"nested_object,omitzero"`
	NestedObjectRequiredFields InternalTestingNewParamsNestedObjectRequiredFields `json:"nested_object_required_fields,omitzero"`
	RepeatedComplexField       []NestedObjectParam                                `json:"repeated_complex_field,omitzero"`
	RepeatedPrimitiveField     []string                                           `json:"repeated_primitive_field,omitzero"`
	// contains filtered or unexported fields
}

func (InternalTestingNewParams) MarshalMultipart

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

type InternalTestingNewParamsEnumTypeField

type InternalTestingNewParamsEnumTypeField string
const (
	InternalTestingNewParamsEnumTypeFieldEin  InternalTestingNewParamsEnumTypeField = "EIN"
	InternalTestingNewParamsEnumTypeFieldZwei InternalTestingNewParamsEnumTypeField = "ZWEI"
	InternalTestingNewParamsEnumTypeFieldDrei InternalTestingNewParamsEnumTypeField = "DREI"
)

type InternalTestingNewParamsNestedObjectRequiredFields

type InternalTestingNewParamsNestedObjectRequiredFields struct {
	PropOne string `json:"prop_one,required"`
	PropTwo string `json:"prop_two,required"`
	// contains filtered or unexported fields
}

The properties PropOne, PropTwo are required.

func (InternalTestingNewParamsNestedObjectRequiredFields) MarshalJSON

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

func (*InternalTestingNewParamsNestedObjectRequiredFields) UnmarshalJSON

type InternalTestingNewResponse

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

func (InternalTestingNewResponse) RawJSON

func (r InternalTestingNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InternalTestingNewResponse) UnmarshalJSON

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

type InternalTestingService

type InternalTestingService struct {
	Options []option.RequestOption
}

InternalTestingService contains methods and other services that help with interacting with the ideogram-sdk 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 NewInternalTestingService method instead.

func NewInternalTestingService

func NewInternalTestingService(opts ...option.RequestOption) (r InternalTestingService)

NewInternalTestingService 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 (*InternalTestingService) New

Just a testing endpoint

type MagicPromptOption

type MagicPromptOption string

Determine if MagicPrompt should be used in generating the request or not.

const (
	MagicPromptOptionAuto MagicPromptOption = "AUTO"
	MagicPromptOptionOn   MagicPromptOption = "ON"
	MagicPromptOptionOff  MagicPromptOption = "OFF"
)

type MagicPromptVersionEnum

type MagicPromptVersionEnum string

The magic prompt version to use when magic prompt option is set to AUTO or ON.

const (
	MagicPromptVersionEnumV0   MagicPromptVersionEnum = "V_0"
	MagicPromptVersionEnumV0_1 MagicPromptVersionEnum = "V_0_1"
	MagicPromptVersionEnumV0_2 MagicPromptVersionEnum = "V_0_2"
)

type ManageAPIAPIKeyService

type ManageAPIAPIKeyService struct {
	Options []option.RequestOption
}

ManageAPIAPIKeyService contains methods and other services that help with interacting with the ideogram-sdk 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 NewManageAPIAPIKeyService method instead.

func NewManageAPIAPIKeyService

func NewManageAPIAPIKeyService(opts ...option.RequestOption) (r ManageAPIAPIKeyService)

NewManageAPIAPIKeyService 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 (*ManageAPIAPIKeyService) Delete

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

Delete an API key.

func (*ManageAPIAPIKeyService) Get

Retrieve current API keys and their respective data.

func (*ManageAPIAPIKeyService) New

Creates an API key.

type ManageAPIAddCreditsParams

type ManageAPIAddCreditsParams struct {
	// Represents a price.
	Amount PriceParam `json:"amount,omitzero,required"`
	// contains filtered or unexported fields
}

func (ManageAPIAddCreditsParams) MarshalJSON

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

func (*ManageAPIAddCreditsParams) UnmarshalJSON

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

type ManageAPIAddCreditsResponse

type ManageAPIAddCreditsResponse struct {
	// Represents a price.
	Amount Price `json:"amount,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageAPIAddCreditsResponse) RawJSON

func (r ManageAPIAddCreditsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ManageAPIAddCreditsResponse) UnmarshalJSON

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

type ManageAPIGetStripeSubscriptionParams

type ManageAPIGetStripeSubscriptionParams struct {
	// Whether the subscription is intended to be used for business or personal use.
	IsBusiness param.Opt[bool] `query:"isBusiness,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ManageAPIGetStripeSubscriptionParams) URLQuery

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

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

type ManageAPIGetStripeSubscriptionResponse

type ManageAPIGetStripeSubscriptionResponse struct {
	// DEPRECATED. The URL for the user to manage the existing Stripe subscription
	// plan. Get this from ManageApiSubscriptionResponse instead.
	//
	// Deprecated: deprecated
	StripeBillingURL string `json:"stripe_billing_url"`
	// The URL for the user to checkout the Stripe subscription plan.
	StripeSubscriptionURL string `json:"stripe_subscription_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StripeBillingURL      respjson.Field
		StripeSubscriptionURL respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageAPIGetStripeSubscriptionResponse) RawJSON

Returns the unmodified JSON received from the API

func (*ManageAPIGetStripeSubscriptionResponse) UnmarshalJSON

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

type ManageAPIReactivateResponse

type ManageAPIReactivateResponse struct {
	// The current recharge settings for the API subscription.
	RechargeSettings RechargeSettingsResponse `json:"recharge_settings"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RechargeSettings respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response to re-activating API settings.

func (ManageAPIReactivateResponse) RawJSON

func (r ManageAPIReactivateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ManageAPIReactivateResponse) UnmarshalJSON

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

type ManageAPIService

type ManageAPIService struct {
	Options      []option.RequestOption
	APIKeys      ManageAPIAPIKeyService
	Subscription ManageAPISubscriptionService
	Terms        ManageAPITermService
}

ManageAPIService contains methods and other services that help with interacting with the ideogram-sdk 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 NewManageAPIService method instead.

func NewManageAPIService

func NewManageAPIService(opts ...option.RequestOption) (r ManageAPIService)

NewManageAPIService 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 (*ManageAPIService) AddCredits

Add credits to an API user's account.

func (*ManageAPIService) GetStripeSubscription

Retrieve data relevant to connecting to Stripe.

func (*ManageAPIService) Reactivate

func (r *ManageAPIService) Reactivate(ctx context.Context, opts ...option.RequestOption) (res *ManageAPIReactivateResponse, err error)

Reactivates a subscription by attempting to re-enable Metronome billing.

type ManageAPISubscriptionGetResponse

type ManageAPISubscriptionGetResponse struct {
	// Whether or not the latest required terms have been accepted.
	HasAcceptedTerms bool `json:"has_accepted_terms,required"`
	// Whether or not Stripe is setup for API usage.
	HasStripeSetup bool `json:"has_stripe_setup,required"`
	// The URL to display the customer usage dashboard, in dark mode.
	//
	// Deprecated: deprecated
	MetronomeDashboardDarkModeURL string `json:"metronome_dashboard_dark_mode_url"`
	// The URL to display the customer usage dashboard.
	//
	// Deprecated: deprecated
	MetronomeDashboardURL string                                         `json:"metronome_dashboard_url"`
	MetronomeLinks        ManageAPISubscriptionGetResponseMetronomeLinks `json:"metronome_links"`
	// The current recharge settings for the API subscription.
	RechargeSettings RechargeSettingsResponse `json:"recharge_settings"`
	// The URL for the user to manage the existing Stripe subscription plan.
	StripeBillingURL string `json:"stripe_billing_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		HasAcceptedTerms              respjson.Field
		HasStripeSetup                respjson.Field
		MetronomeDashboardDarkModeURL respjson.Field
		MetronomeDashboardURL         respjson.Field
		MetronomeLinks                respjson.Field
		RechargeSettings              respjson.Field
		StripeBillingURL              respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageAPISubscriptionGetResponse) RawJSON

Returns the unmodified JSON received from the API

func (*ManageAPISubscriptionGetResponse) UnmarshalJSON

func (r *ManageAPISubscriptionGetResponse) UnmarshalJSON(data []byte) error
type ManageAPISubscriptionGetResponseMetronomeLinks struct {
	// The URL to display the customer invoice and API usage.
	CreditsIframeDarkModeURL string `json:"credits_iframe_dark_mode_url"`
	// The URL to display the customer invoice and API usage.
	CreditsIframeURL string `json:"credits_iframe_url"`
	// The URL to display the customer invoice and API usage.
	InvoicesIframeDarkModeURL string `json:"invoices_iframe_dark_mode_url"`
	// The URL to display the customer invoice and API usage.
	InvoicesIframeURL string `json:"invoices_iframe_url"`
	// The URL to display the customer usage dashboard, in dark mode.
	UsageIframeDarkModeURL string `json:"usage_iframe_dark_mode_url"`
	// The URL to display the customer usage dashboard.
	UsageIframeURL string `json:"usage_iframe_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditsIframeDarkModeURL  respjson.Field
		CreditsIframeURL          respjson.Field
		InvoicesIframeDarkModeURL respjson.Field
		InvoicesIframeURL         respjson.Field
		UsageIframeDarkModeURL    respjson.Field
		UsageIframeURL            respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageAPISubscriptionGetResponseMetronomeLinks) RawJSON

Returns the unmodified JSON received from the API

func (*ManageAPISubscriptionGetResponseMetronomeLinks) UnmarshalJSON

type ManageAPISubscriptionService

type ManageAPISubscriptionService struct {
	Options []option.RequestOption
}

ManageAPISubscriptionService contains methods and other services that help with interacting with the ideogram-sdk 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 NewManageAPISubscriptionService method instead.

func NewManageAPISubscriptionService

func NewManageAPISubscriptionService(opts ...option.RequestOption) (r ManageAPISubscriptionService)

NewManageAPISubscriptionService 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 (*ManageAPISubscriptionService) Get

Retrieve data relevant to creating an API subscription.

func (*ManageAPISubscriptionService) Update

Update API subscription settings

type ManageAPISubscriptionUpdateParams

type ManageAPISubscriptionUpdateParams struct {
	// The current recharge settings for the API subscription.
	RechargeSettings RechargeSettingsSubscriptionParam `json:"recharge_settings,omitzero"`
	// contains filtered or unexported fields
}

func (ManageAPISubscriptionUpdateParams) MarshalJSON

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

func (*ManageAPISubscriptionUpdateParams) UnmarshalJSON

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

type ManageAPISubscriptionUpdateResponse

type ManageAPISubscriptionUpdateResponse struct {
	// The current recharge settings for the API subscription.
	RechargeSettings RechargeSettingsResponse `json:"recharge_settings"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RechargeSettings respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The updated API subscription.

func (ManageAPISubscriptionUpdateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*ManageAPISubscriptionUpdateResponse) UnmarshalJSON

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

type ManageAPITermAcceptParams

type ManageAPITermAcceptParams struct {
	// The ID of the terms which are being accepted.
	TermsID string `json:"terms_id,required"`
	// contains filtered or unexported fields
}

func (ManageAPITermAcceptParams) MarshalJSON

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

func (*ManageAPITermAcceptParams) UnmarshalJSON

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

type ManageAPITermGetResponse

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

func (ManageAPITermGetResponse) RawJSON

func (r ManageAPITermGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ManageAPITermGetResponse) UnmarshalJSON

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

type ManageAPITermGetResponseAPITerms

type ManageAPITermGetResponseAPITerms struct {
	// The ID of the terms.
	TermsID string `json:"terms_id,required"`
	// The URL where the terms are hosted.
	TermsURL string `json:"terms_url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TermsID     respjson.Field
		TermsURL    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageAPITermGetResponseAPITerms) RawJSON

Returns the unmodified JSON received from the API

func (*ManageAPITermGetResponseAPITerms) UnmarshalJSON

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

type ManageAPITermService

type ManageAPITermService struct {
	Options []option.RequestOption
}

ManageAPITermService contains methods and other services that help with interacting with the ideogram-sdk 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 NewManageAPITermService method instead.

func NewManageAPITermService

func NewManageAPITermService(opts ...option.RequestOption) (r ManageAPITermService)

NewManageAPITermService 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 (*ManageAPITermService) Accept

Accept terms

func (*ManageAPITermService) Get

Retrieve the latest terms of service for API usage.

type ManageApiapiKeyGetResponse

type ManageApiapiKeyGetResponse struct {
	// The current API keys that are active. Only returns redacted keys.
	CurrentAPIKeys []ManageApiapiKeyGetResponseCurrentAPIKey `json:"current_api_keys"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentAPIKeys respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageApiapiKeyGetResponse) RawJSON

func (r ManageApiapiKeyGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ManageApiapiKeyGetResponse) UnmarshalJSON

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

type ManageApiapiKeyGetResponseCurrentAPIKey

type ManageApiapiKeyGetResponseCurrentAPIKey struct {
	// A URL safe base64 encoded UUID
	APIKeyID string `json:"api_key_id,required"`
	// The time at which the key was created
	CreationTime time.Time `json:"creation_time,required" format:"date-time"`
	// A redacted text snippet of the API key. Contains the first 4 characters of the
	// API key
	RedactedAPIKey string `json:"redacted_api_key,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKeyID       respjson.Field
		CreationTime   respjson.Field
		RedactedAPIKey respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A representation of an API key that does not contain the full key.

func (ManageApiapiKeyGetResponseCurrentAPIKey) RawJSON

Returns the unmodified JSON received from the API

func (*ManageApiapiKeyGetResponseCurrentAPIKey) UnmarshalJSON

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

type ManageApiapiKeyNewResponse

type ManageApiapiKeyNewResponse struct {
	// The API key to use when making authenticated requests with the API. This key
	// will only be shown once.
	APIKey string `json:"api_key,required"`
	// The ID of the API key. A URL safe base64 encoded UUID
	APIKeyID string `json:"api_key_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey      respjson.Field
		APIKeyID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ManageApiapiKeyNewResponse) RawJSON

func (r ManageApiapiKeyNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ManageApiapiKeyNewResponse) UnmarshalJSON

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

type ManageService

type ManageService struct {
	Options []option.RequestOption
	API     ManageAPIService
}

ManageService contains methods and other services that help with interacting with the ideogram-sdk 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 NewManageService method instead.

func NewManageService

func NewManageService(opts ...option.RequestOption) (r ManageService)

NewManageService 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 ModelEnum

type ModelEnum string

The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.

const (
	ModelEnumV1       ModelEnum = "V_1"
	ModelEnumV1Turbo  ModelEnum = "V_1_TURBO"
	ModelEnumV2       ModelEnum = "V_2"
	ModelEnumV2Turbo  ModelEnum = "V_2_TURBO"
	ModelEnumV2A      ModelEnum = "V_2A"
	ModelEnumV2ATurbo ModelEnum = "V_2A_TURBO"
	ModelEnumV3       ModelEnum = "V_3"
)

type NestedObjectParam

type NestedObjectParam struct {
	PropOne param.Opt[string] `json:"prop_one,omitzero"`
	PropTwo param.Opt[string] `json:"prop_two,omitzero"`
	// contains filtered or unexported fields
}

func (NestedObjectParam) MarshalJSON

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

func (*NestedObjectParam) UnmarshalJSON

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

type Price

type Price struct {
	// The amount of the currency in the common denomination. For example, in USD this
	// is cents.
	Amount float64 `json:"amount,required"`
	// The ISO 4217 currency code for the price object.
	CurrencyCode string `json:"currency_code,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount       respjson.Field
		CurrencyCode respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a price.

func (Price) RawJSON

func (r Price) RawJSON() string

Returns the unmodified JSON received from the API

func (Price) ToParam

func (r Price) ToParam() PriceParam

ToParam converts this Price to a PriceParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with PriceParam.Overrides()

func (*Price) UnmarshalJSON

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

type PriceParam

type PriceParam struct {
	// The amount of the currency in the common denomination. For example, in USD this
	// is cents.
	Amount float64 `json:"amount,required"`
	// The ISO 4217 currency code for the price object.
	CurrencyCode string `json:"currency_code,required"`
	// contains filtered or unexported fields
}

Represents a price.

The properties Amount, CurrencyCode are required.

func (PriceParam) MarshalJSON

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

func (*PriceParam) UnmarshalJSON

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

type RechargeSettingsResponse

type RechargeSettingsResponse struct {
	// Whether or not the recharge setting is currently active.
	IsActive bool `json:"is_active,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsActive    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	RechargeSettingsSubscription
}

The current recharge settings for the API subscription.

func (RechargeSettingsResponse) RawJSON

func (r RechargeSettingsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*RechargeSettingsResponse) UnmarshalJSON

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

type RechargeSettingsSubscription

type RechargeSettingsSubscription struct {
	// Represents a price.
	MinimumBalanceThreshold Price `json:"minimum_balance_threshold,required"`
	// Represents a price.
	TopUpBalance Price `json:"top_up_balance,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinimumBalanceThreshold respjson.Field
		TopUpBalance            respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The current recharge settings for the API subscription.

func (RechargeSettingsSubscription) RawJSON

Returns the unmodified JSON received from the API

func (RechargeSettingsSubscription) ToParam

ToParam converts this RechargeSettingsSubscription to a RechargeSettingsSubscriptionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RechargeSettingsSubscriptionParam.Overrides()

func (*RechargeSettingsSubscription) UnmarshalJSON

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

type RechargeSettingsSubscriptionParam

type RechargeSettingsSubscriptionParam struct {
	// Represents a price.
	MinimumBalanceThreshold PriceParam `json:"minimum_balance_threshold,omitzero,required"`
	// Represents a price.
	TopUpBalance PriceParam `json:"top_up_balance,omitzero,required"`
	// contains filtered or unexported fields
}

The current recharge settings for the API subscription.

The properties MinimumBalanceThreshold, TopUpBalance are required.

func (RechargeSettingsSubscriptionParam) MarshalJSON

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

func (*RechargeSettingsSubscriptionParam) UnmarshalJSON

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

type ReframeNewParams

type ReframeNewParams struct {
	// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are
	// supported at this time.
	ImageFile io.Reader `json:"image_file,omitzero,required" format:"binary"`
	// The model used to generate an image or edit one. /generate and /remix supports
	// all model types, however, /edit is only supported for V_2 and V_2_TURBO.
	//
	// Any of "V_1", "V_1_TURBO", "V_2", "V_2_TURBO", "V_2A", "V_2A_TURBO", "V_3".
	Model ModelEnum `json:"model,omitzero,required"`
	// (For model_version for 2.0 only, cannot be used in conjunction with
	// aspect_ratio) The resolution to use for image generation, represented in width x
	// height. If not specified, defaults to using aspect_ratio.
	//
	// Any of "RESOLUTION_512_1536", "RESOLUTION_576_1408", "RESOLUTION_576_1472",
	// "RESOLUTION_576_1536", "RESOLUTION_640_1024", "RESOLUTION_640_1344",
	// "RESOLUTION_640_1408", "RESOLUTION_640_1472", "RESOLUTION_640_1536",
	// "RESOLUTION_704_1152", "RESOLUTION_704_1216", "RESOLUTION_704_1280",
	// "RESOLUTION_704_1344", "RESOLUTION_704_1408", "RESOLUTION_704_1472",
	// "RESOLUTION_720_1280", "RESOLUTION_736_1312", "RESOLUTION_768_1024",
	// "RESOLUTION_768_1088", "RESOLUTION_768_1152", "RESOLUTION_768_1216",
	// "RESOLUTION_768_1232", "RESOLUTION_768_1280", "RESOLUTION_768_1344",
	// "RESOLUTION_832_960", "RESOLUTION_832_1024", "RESOLUTION_832_1088",
	// "RESOLUTION_832_1152", "RESOLUTION_832_1216", "RESOLUTION_832_1248",
	// "RESOLUTION_864_1152", "RESOLUTION_896_960", "RESOLUTION_896_1024",
	// "RESOLUTION_896_1088", "RESOLUTION_896_1120", "RESOLUTION_896_1152",
	// "RESOLUTION_960_832", "RESOLUTION_960_896", "RESOLUTION_960_1024",
	// "RESOLUTION_960_1088", "RESOLUTION_1024_640", "RESOLUTION_1024_768",
	// "RESOLUTION_1024_832", "RESOLUTION_1024_896", "RESOLUTION_1024_960",
	// "RESOLUTION_1024_1024", "RESOLUTION_1088_768", "RESOLUTION_1088_832",
	// "RESOLUTION_1088_896", "RESOLUTION_1088_960", "RESOLUTION_1120_896",
	// "RESOLUTION_1152_704", "RESOLUTION_1152_768", "RESOLUTION_1152_832",
	// "RESOLUTION_1152_864", "RESOLUTION_1152_896", "RESOLUTION_1216_704",
	// "RESOLUTION_1216_768", "RESOLUTION_1216_832", "RESOLUTION_1232_768",
	// "RESOLUTION_1248_832", "RESOLUTION_1280_704", "RESOLUTION_1280_720",
	// "RESOLUTION_1280_768", "RESOLUTION_1280_800", "RESOLUTION_1312_736",
	// "RESOLUTION_1344_640", "RESOLUTION_1344_704", "RESOLUTION_1344_768",
	// "RESOLUTION_1408_576", "RESOLUTION_1408_640", "RESOLUTION_1408_704",
	// "RESOLUTION_1472_576", "RESOLUTION_1472_640", "RESOLUTION_1472_704",
	// "RESOLUTION_1536_512", "RESOLUTION_1536_576", "RESOLUTION_1536_640".
	Resolution ResolutionImageGeneration `json:"resolution,omitzero,required"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// The style type to generate with; this is only applicable for models V_2 and
	// above and should not be specified for model versions V_1.
	//
	// Any of "AUTO", "GENERAL", "REALISTIC", "DESIGN", "RENDER_3D", "ANIME", "CUSTOM".
	StyleType StyleTypeV2AndAbove `json:"style_type,omitzero"`
	// contains filtered or unexported fields
}

func (ReframeNewParams) MarshalMultipart

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

type ReframeService

type ReframeService struct {
	Options []option.RequestOption
}

ReframeService contains methods and other services that help with interacting with the ideogram-sdk 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 NewReframeService method instead.

func NewReframeService

func NewReframeService(opts ...option.RequestOption) (r ReframeService)

NewReframeService 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 (*ReframeService) New

func (r *ReframeService) New(ctx context.Context, body ReframeNewParams, opts ...option.RequestOption) (res *GenerateImage, err error)

Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.

Image links are available for a limited period of time; if you would like to keep the image, you must download it.

type RemixNewParams

type RemixNewParams struct {
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	ImageFile io.Reader `json:"image_file,omitzero,required" format:"binary"`
	// A request to generate a new image using a provided image and a prompt.
	ImageRequest RemixNewParamsImageRequest `json:"image_request,omitzero,required"`
	// contains filtered or unexported fields
}

func (RemixNewParams) MarshalMultipart

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

type RemixNewParamsImageRequest

type RemixNewParamsImageRequest struct {
	ImageWeight param.Opt[int64] `json:"image_weight,omitzero"`
	ImageRequestParam
}

A request to generate a new image using a provided image and a prompt.

func (RemixNewParamsImageRequest) MarshalJSON

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

type RemixService

type RemixService struct {
	Options []option.RequestOption
}

RemixService contains methods and other services that help with interacting with the ideogram-sdk 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 NewRemixService method instead.

func NewRemixService

func NewRemixService(opts ...option.RequestOption) (r RemixService)

NewRemixService 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 (*RemixService) New

func (r *RemixService) New(ctx context.Context, body RemixNewParams, opts ...option.RequestOption) (res *GenerateImage, err error)

Remix provided images synchronously based on a given prompt and optional parameters.

Input images are cropped to the chosen aspect ratio before being remixed.

Supported image formats include JPEG, PNG, and WebP.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

type RenderingSpeed

type RenderingSpeed string

The rendering speed to use.

const (
	RenderingSpeedTurbo    RenderingSpeed = "TURBO"
	RenderingSpeedBalanced RenderingSpeed = "BALANCED"
	RenderingSpeedDefault  RenderingSpeed = "DEFAULT"
	RenderingSpeedQuality  RenderingSpeed = "QUALITY"
)

type ResolutionIdeogram

type ResolutionIdeogram string

The resolutions supported for Ideogram 3.0.

const (
	ResolutionIdeogram512x1536  ResolutionIdeogram = "512x1536"
	ResolutionIdeogram576x1408  ResolutionIdeogram = "576x1408"
	ResolutionIdeogram576x1472  ResolutionIdeogram = "576x1472"
	ResolutionIdeogram576x1536  ResolutionIdeogram = "576x1536"
	ResolutionIdeogram640x1344  ResolutionIdeogram = "640x1344"
	ResolutionIdeogram640x1408  ResolutionIdeogram = "640x1408"
	ResolutionIdeogram640x1472  ResolutionIdeogram = "640x1472"
	ResolutionIdeogram640x1536  ResolutionIdeogram = "640x1536"
	ResolutionIdeogram704x1152  ResolutionIdeogram = "704x1152"
	ResolutionIdeogram704x1216  ResolutionIdeogram = "704x1216"
	ResolutionIdeogram704x1280  ResolutionIdeogram = "704x1280"
	ResolutionIdeogram704x1344  ResolutionIdeogram = "704x1344"
	ResolutionIdeogram704x1408  ResolutionIdeogram = "704x1408"
	ResolutionIdeogram704x1472  ResolutionIdeogram = "704x1472"
	ResolutionIdeogram736x1312  ResolutionIdeogram = "736x1312"
	ResolutionIdeogram768x1088  ResolutionIdeogram = "768x1088"
	ResolutionIdeogram768x1216  ResolutionIdeogram = "768x1216"
	ResolutionIdeogram768x1280  ResolutionIdeogram = "768x1280"
	ResolutionIdeogram768x1344  ResolutionIdeogram = "768x1344"
	ResolutionIdeogram800x1280  ResolutionIdeogram = "800x1280"
	ResolutionIdeogram832x960   ResolutionIdeogram = "832x960"
	ResolutionIdeogram832x1024  ResolutionIdeogram = "832x1024"
	ResolutionIdeogram832x1088  ResolutionIdeogram = "832x1088"
	ResolutionIdeogram832x1152  ResolutionIdeogram = "832x1152"
	ResolutionIdeogram832x1216  ResolutionIdeogram = "832x1216"
	ResolutionIdeogram832x1248  ResolutionIdeogram = "832x1248"
	ResolutionIdeogram864x1152  ResolutionIdeogram = "864x1152"
	ResolutionIdeogram896x960   ResolutionIdeogram = "896x960"
	ResolutionIdeogram896x1024  ResolutionIdeogram = "896x1024"
	ResolutionIdeogram896x1088  ResolutionIdeogram = "896x1088"
	ResolutionIdeogram896x1120  ResolutionIdeogram = "896x1120"
	ResolutionIdeogram896x1152  ResolutionIdeogram = "896x1152"
	ResolutionIdeogram960x832   ResolutionIdeogram = "960x832"
	ResolutionIdeogram960x896   ResolutionIdeogram = "960x896"
	ResolutionIdeogram960x1024  ResolutionIdeogram = "960x1024"
	ResolutionIdeogram960x1088  ResolutionIdeogram = "960x1088"
	ResolutionIdeogram1024x832  ResolutionIdeogram = "1024x832"
	ResolutionIdeogram1024x896  ResolutionIdeogram = "1024x896"
	ResolutionIdeogram1024x960  ResolutionIdeogram = "1024x960"
	ResolutionIdeogram1024x1024 ResolutionIdeogram = "1024x1024"
	ResolutionIdeogram1088x768  ResolutionIdeogram = "1088x768"
	ResolutionIdeogram1088x832  ResolutionIdeogram = "1088x832"
	ResolutionIdeogram1088x896  ResolutionIdeogram = "1088x896"
	ResolutionIdeogram1088x960  ResolutionIdeogram = "1088x960"
	ResolutionIdeogram1120x896  ResolutionIdeogram = "1120x896"
	ResolutionIdeogram1152x704  ResolutionIdeogram = "1152x704"
	ResolutionIdeogram1152x832  ResolutionIdeogram = "1152x832"
	ResolutionIdeogram1152x864  ResolutionIdeogram = "1152x864"
	ResolutionIdeogram1152x896  ResolutionIdeogram = "1152x896"
	ResolutionIdeogram1216x704  ResolutionIdeogram = "1216x704"
	ResolutionIdeogram1216x768  ResolutionIdeogram = "1216x768"
	ResolutionIdeogram1216x832  ResolutionIdeogram = "1216x832"
	ResolutionIdeogram1248x832  ResolutionIdeogram = "1248x832"
	ResolutionIdeogram1280x704  ResolutionIdeogram = "1280x704"
	ResolutionIdeogram1280x768  ResolutionIdeogram = "1280x768"
	ResolutionIdeogram1280x800  ResolutionIdeogram = "1280x800"
	ResolutionIdeogram1312x736  ResolutionIdeogram = "1312x736"
	ResolutionIdeogram1344x640  ResolutionIdeogram = "1344x640"
	ResolutionIdeogram1344x704  ResolutionIdeogram = "1344x704"
	ResolutionIdeogram1344x768  ResolutionIdeogram = "1344x768"
	ResolutionIdeogram1408x576  ResolutionIdeogram = "1408x576"
	ResolutionIdeogram1408x640  ResolutionIdeogram = "1408x640"
	ResolutionIdeogram1408x704  ResolutionIdeogram = "1408x704"
	ResolutionIdeogram1472x576  ResolutionIdeogram = "1472x576"
	ResolutionIdeogram1472x640  ResolutionIdeogram = "1472x640"
	ResolutionIdeogram1472x704  ResolutionIdeogram = "1472x704"
	ResolutionIdeogram1536x512  ResolutionIdeogram = "1536x512"
	ResolutionIdeogram1536x576  ResolutionIdeogram = "1536x576"
	ResolutionIdeogram1536x640  ResolutionIdeogram = "1536x640"
)

type ResolutionImageGeneration

type ResolutionImageGeneration string

(For model_version for 2.0 only, cannot be used in conjunction with aspect_ratio) The resolution to use for image generation, represented in width x height. If not specified, defaults to using aspect_ratio.

const (
	ResolutionImageGenerationResolution512_1536  ResolutionImageGeneration = "RESOLUTION_512_1536"
	ResolutionImageGenerationResolution576_1408  ResolutionImageGeneration = "RESOLUTION_576_1408"
	ResolutionImageGenerationResolution576_1472  ResolutionImageGeneration = "RESOLUTION_576_1472"
	ResolutionImageGenerationResolution576_1536  ResolutionImageGeneration = "RESOLUTION_576_1536"
	ResolutionImageGenerationResolution640_1024  ResolutionImageGeneration = "RESOLUTION_640_1024"
	ResolutionImageGenerationResolution640_1344  ResolutionImageGeneration = "RESOLUTION_640_1344"
	ResolutionImageGenerationResolution640_1408  ResolutionImageGeneration = "RESOLUTION_640_1408"
	ResolutionImageGenerationResolution640_1472  ResolutionImageGeneration = "RESOLUTION_640_1472"
	ResolutionImageGenerationResolution640_1536  ResolutionImageGeneration = "RESOLUTION_640_1536"
	ResolutionImageGenerationResolution704_1152  ResolutionImageGeneration = "RESOLUTION_704_1152"
	ResolutionImageGenerationResolution704_1216  ResolutionImageGeneration = "RESOLUTION_704_1216"
	ResolutionImageGenerationResolution704_1280  ResolutionImageGeneration = "RESOLUTION_704_1280"
	ResolutionImageGenerationResolution704_1344  ResolutionImageGeneration = "RESOLUTION_704_1344"
	ResolutionImageGenerationResolution704_1408  ResolutionImageGeneration = "RESOLUTION_704_1408"
	ResolutionImageGenerationResolution704_1472  ResolutionImageGeneration = "RESOLUTION_704_1472"
	ResolutionImageGenerationResolution720_1280  ResolutionImageGeneration = "RESOLUTION_720_1280"
	ResolutionImageGenerationResolution736_1312  ResolutionImageGeneration = "RESOLUTION_736_1312"
	ResolutionImageGenerationResolution768_1024  ResolutionImageGeneration = "RESOLUTION_768_1024"
	ResolutionImageGenerationResolution768_1088  ResolutionImageGeneration = "RESOLUTION_768_1088"
	ResolutionImageGenerationResolution768_1152  ResolutionImageGeneration = "RESOLUTION_768_1152"
	ResolutionImageGenerationResolution768_1216  ResolutionImageGeneration = "RESOLUTION_768_1216"
	ResolutionImageGenerationResolution768_1232  ResolutionImageGeneration = "RESOLUTION_768_1232"
	ResolutionImageGenerationResolution768_1280  ResolutionImageGeneration = "RESOLUTION_768_1280"
	ResolutionImageGenerationResolution768_1344  ResolutionImageGeneration = "RESOLUTION_768_1344"
	ResolutionImageGenerationResolution832_960   ResolutionImageGeneration = "RESOLUTION_832_960"
	ResolutionImageGenerationResolution832_1024  ResolutionImageGeneration = "RESOLUTION_832_1024"
	ResolutionImageGenerationResolution832_1088  ResolutionImageGeneration = "RESOLUTION_832_1088"
	ResolutionImageGenerationResolution832_1152  ResolutionImageGeneration = "RESOLUTION_832_1152"
	ResolutionImageGenerationResolution832_1216  ResolutionImageGeneration = "RESOLUTION_832_1216"
	ResolutionImageGenerationResolution832_1248  ResolutionImageGeneration = "RESOLUTION_832_1248"
	ResolutionImageGenerationResolution864_1152  ResolutionImageGeneration = "RESOLUTION_864_1152"
	ResolutionImageGenerationResolution896_960   ResolutionImageGeneration = "RESOLUTION_896_960"
	ResolutionImageGenerationResolution896_1024  ResolutionImageGeneration = "RESOLUTION_896_1024"
	ResolutionImageGenerationResolution896_1088  ResolutionImageGeneration = "RESOLUTION_896_1088"
	ResolutionImageGenerationResolution896_1120  ResolutionImageGeneration = "RESOLUTION_896_1120"
	ResolutionImageGenerationResolution896_1152  ResolutionImageGeneration = "RESOLUTION_896_1152"
	ResolutionImageGenerationResolution960_832   ResolutionImageGeneration = "RESOLUTION_960_832"
	ResolutionImageGenerationResolution960_896   ResolutionImageGeneration = "RESOLUTION_960_896"
	ResolutionImageGenerationResolution960_1024  ResolutionImageGeneration = "RESOLUTION_960_1024"
	ResolutionImageGenerationResolution960_1088  ResolutionImageGeneration = "RESOLUTION_960_1088"
	ResolutionImageGenerationResolution1024_640  ResolutionImageGeneration = "RESOLUTION_1024_640"
	ResolutionImageGenerationResolution1024_768  ResolutionImageGeneration = "RESOLUTION_1024_768"
	ResolutionImageGenerationResolution1024_832  ResolutionImageGeneration = "RESOLUTION_1024_832"
	ResolutionImageGenerationResolution1024_896  ResolutionImageGeneration = "RESOLUTION_1024_896"
	ResolutionImageGenerationResolution1024_960  ResolutionImageGeneration = "RESOLUTION_1024_960"
	ResolutionImageGenerationResolution1024_1024 ResolutionImageGeneration = "RESOLUTION_1024_1024"
	ResolutionImageGenerationResolution1088_768  ResolutionImageGeneration = "RESOLUTION_1088_768"
	ResolutionImageGenerationResolution1088_832  ResolutionImageGeneration = "RESOLUTION_1088_832"
	ResolutionImageGenerationResolution1088_896  ResolutionImageGeneration = "RESOLUTION_1088_896"
	ResolutionImageGenerationResolution1088_960  ResolutionImageGeneration = "RESOLUTION_1088_960"
	ResolutionImageGenerationResolution1120_896  ResolutionImageGeneration = "RESOLUTION_1120_896"
	ResolutionImageGenerationResolution1152_704  ResolutionImageGeneration = "RESOLUTION_1152_704"
	ResolutionImageGenerationResolution1152_768  ResolutionImageGeneration = "RESOLUTION_1152_768"
	ResolutionImageGenerationResolution1152_832  ResolutionImageGeneration = "RESOLUTION_1152_832"
	ResolutionImageGenerationResolution1152_864  ResolutionImageGeneration = "RESOLUTION_1152_864"
	ResolutionImageGenerationResolution1152_896  ResolutionImageGeneration = "RESOLUTION_1152_896"
	ResolutionImageGenerationResolution1216_704  ResolutionImageGeneration = "RESOLUTION_1216_704"
	ResolutionImageGenerationResolution1216_768  ResolutionImageGeneration = "RESOLUTION_1216_768"
	ResolutionImageGenerationResolution1216_832  ResolutionImageGeneration = "RESOLUTION_1216_832"
	ResolutionImageGenerationResolution1232_768  ResolutionImageGeneration = "RESOLUTION_1232_768"
	ResolutionImageGenerationResolution1248_832  ResolutionImageGeneration = "RESOLUTION_1248_832"
	ResolutionImageGenerationResolution1280_704  ResolutionImageGeneration = "RESOLUTION_1280_704"
	ResolutionImageGenerationResolution1280_720  ResolutionImageGeneration = "RESOLUTION_1280_720"
	ResolutionImageGenerationResolution1280_768  ResolutionImageGeneration = "RESOLUTION_1280_768"
	ResolutionImageGenerationResolution1280_800  ResolutionImageGeneration = "RESOLUTION_1280_800"
	ResolutionImageGenerationResolution1312_736  ResolutionImageGeneration = "RESOLUTION_1312_736"
	ResolutionImageGenerationResolution1344_640  ResolutionImageGeneration = "RESOLUTION_1344_640"
	ResolutionImageGenerationResolution1344_704  ResolutionImageGeneration = "RESOLUTION_1344_704"
	ResolutionImageGenerationResolution1344_768  ResolutionImageGeneration = "RESOLUTION_1344_768"
	ResolutionImageGenerationResolution1408_576  ResolutionImageGeneration = "RESOLUTION_1408_576"
	ResolutionImageGenerationResolution1408_640  ResolutionImageGeneration = "RESOLUTION_1408_640"
	ResolutionImageGenerationResolution1408_704  ResolutionImageGeneration = "RESOLUTION_1408_704"
	ResolutionImageGenerationResolution1472_576  ResolutionImageGeneration = "RESOLUTION_1472_576"
	ResolutionImageGenerationResolution1472_640  ResolutionImageGeneration = "RESOLUTION_1472_640"
	ResolutionImageGenerationResolution1472_704  ResolutionImageGeneration = "RESOLUTION_1472_704"
	ResolutionImageGenerationResolution1536_512  ResolutionImageGeneration = "RESOLUTION_1536_512"
	ResolutionImageGenerationResolution1536_576  ResolutionImageGeneration = "RESOLUTION_1536_576"
	ResolutionImageGenerationResolution1536_640  ResolutionImageGeneration = "RESOLUTION_1536_640"
)

type StyleTypeV2AndAbove

type StyleTypeV2AndAbove string

The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.

const (
	StyleTypeV2AndAboveAuto      StyleTypeV2AndAbove = "AUTO"
	StyleTypeV2AndAboveGeneral   StyleTypeV2AndAbove = "GENERAL"
	StyleTypeV2AndAboveRealistic StyleTypeV2AndAbove = "REALISTIC"
	StyleTypeV2AndAboveDesign    StyleTypeV2AndAbove = "DESIGN"
	StyleTypeV2AndAboveRender3D  StyleTypeV2AndAbove = "RENDER_3D"
	StyleTypeV2AndAboveAnime     StyleTypeV2AndAbove = "ANIME"
	StyleTypeV2AndAboveCustom    StyleTypeV2AndAbove = "CUSTOM"
)

type StyleTypeV3

type StyleTypeV3 string

The style type to generate with.

const (
	StyleTypeV3Auto      StyleTypeV3 = "AUTO"
	StyleTypeV3General   StyleTypeV3 = "GENERAL"
	StyleTypeV3Realistic StyleTypeV3 = "REALISTIC"
	StyleTypeV3Design    StyleTypeV3 = "DESIGN"
)

type UpscaleNewParams

type UpscaleNewParams struct {
	// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported
	// at this time.
	ImageFile io.Reader `json:"image_file,omitzero,required" format:"binary"`
	// A request to upscale a provided image with the help of an optional prompt.
	ImageRequest UpscaleNewParamsImageRequest `json:"image_request,omitzero,required"`
	// contains filtered or unexported fields
}

func (UpscaleNewParams) MarshalMultipart

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

type UpscaleNewParamsImageRequest

type UpscaleNewParamsImageRequest struct {
	Detail param.Opt[int64] `json:"detail,omitzero"`
	// The number of images to generate.
	NumImages param.Opt[int64] `json:"num_images,omitzero"`
	// An optional prompt to guide the upscale
	Prompt      param.Opt[string] `json:"prompt,omitzero"`
	Resemblance param.Opt[int64]  `json:"resemblance,omitzero"`
	// Random seed. Set for reproducible generation.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// Determine if MagicPrompt should be used in generating the request or not.
	//
	// Any of "AUTO", "ON", "OFF".
	MagicPromptOption MagicPromptOption `json:"magic_prompt_option,omitzero"`
	// The magic prompt version to use when magic prompt option is set to AUTO or ON.
	//
	// Any of "V_0", "V_0_1", "V_0_2".
	MagicPromptVersion MagicPromptVersionEnum `json:"magic_prompt_version,omitzero"`
	// contains filtered or unexported fields
}

A request to upscale a provided image with the help of an optional prompt.

func (UpscaleNewParamsImageRequest) MarshalJSON

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

func (*UpscaleNewParamsImageRequest) UnmarshalJSON

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

type UpscaleService

type UpscaleService struct {
	Options []option.RequestOption
}

UpscaleService contains methods and other services that help with interacting with the ideogram-sdk 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 NewUpscaleService method instead.

func NewUpscaleService

func NewUpscaleService(opts ...option.RequestOption) (r UpscaleService)

NewUpscaleService 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 (*UpscaleService) New

func (r *UpscaleService) New(ctx context.Context, body UpscaleNewParams, opts ...option.RequestOption) (res *GenerateImage, err error)

Upscale provided images synchronously with an optional prompt.

Supported image formats include JPEG, PNG, and WebP.

Images links are available for a limited period of time; if you would like to keep the image, you must download it.

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.21, 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.21, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL