Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8a9e40c
feat(client): add support for endpoint-specific base URLs in python
stainless-app[bot] May 14, 2025
c92d800
fix(client): correctly set stream key for multipart
stainless-app[bot] May 20, 2025
a7b1b83
fix(client): don't panic on marshal with extra null field
stainless-app[bot] May 20, 2025
2cfd5f5
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
592c8c5
chore: improve devcontainer setup
stainless-app[bot] May 22, 2025
8115308
chore(internal): codegen related update
stainless-app[bot] May 29, 2025
0e93679
fix: fix error
stainless-app[bot] May 30, 2025
3ff08b2
chore: make go mod tidy continue on error
stainless-app[bot] May 31, 2025
7444639
feat(client): allow overriding unions
stainless-app[bot] Jun 4, 2025
b04a33b
fix(client): cast to raw message when converting to params
stainless-app[bot] Jun 4, 2025
d1d2857
feat(client): add debug log helper
stainless-app[bot] Jun 17, 2025
7bb51f1
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
89e3fb1
feat(client): add escape hatch for null slice & maps
stainless-app[bot] Jun 21, 2025
e400d5e
chore: fix documentation of null map
stainless-app[bot] Jun 21, 2025
d464ddc
fix: don't try to deserialize as json when ResponseBodyInto is []byte
stainless-app[bot] Jun 28, 2025
8ab152a
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jun 28, 2025
ea88937
chore: lint tests
stainless-app[bot] Jul 8, 2025
319d4a5
chore(internal): fix lint script for tests
stainless-app[bot] Jul 9, 2025
1558f15
release: 0.1.0-alpha.2
stainless-app[bot] Jul 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .devcontainer/Dockerfile

This file was deleted.

19 changes: 3 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"name": "Development",
"image": "mcr.microsoft.com/devcontainers/go:1.23-bookworm",
"postCreateCommand": "go mod tidy"
}
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/ideogram-sdk-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
Expand All @@ -28,6 +33,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/ideogram-sdk-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 0.1.0-alpha.2 (2025-07-09)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/NeuralNetLab/ideogram-sdk-go/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **client:** add debug log helper ([d1d2857](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/d1d285714794fbcf14e63a255ee11b426578f3bf))
* **client:** add escape hatch for null slice & maps ([89e3fb1](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/89e3fb13ebe879ab9a8aa6b048c8ae5e8bfe06a9))
* **client:** add support for endpoint-specific base URLs in python ([8a9e40c](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/8a9e40c2aa0454214a28d9534370fba35d086f26))
* **client:** allow overriding unions ([7444639](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/74446396a0b9a19f0849bfbfe1b21b9a96401b7b))


### Bug Fixes

* **client:** cast to raw message when converting to params ([b04a33b](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/b04a33b06b5d09472339b694c18430d022ccae1a))
* **client:** correctly set stream key for multipart ([c92d800](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/c92d800e7bba4191ff11837186578affbf4df88b))
* **client:** don't panic on marshal with extra null field ([a7b1b83](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/a7b1b83ab93a3b1901c69bbc39e49908b9f6e298))
* don't try to deserialize as json when ResponseBodyInto is []byte ([d464ddc](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/d464ddc51a2136dffc49b4894e4aefe0cb75fb91))
* fix error ([0e93679](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/0e93679303d1d0a06ff6506567fae60292536b64))


### Chores

* **ci:** enable for pull requests ([7bb51f1](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/7bb51f103bee20d7b13ef3d04bce527001ac24b3))
* **ci:** only run for pushes and fork pull requests ([8ab152a](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/8ab152a58c3932e6f63eec121e33abf8f6cd5e14))
* **docs:** grammar improvements ([2cfd5f5](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/2cfd5f57722b60139d2a7663fc816b3765d7993e))
* fix documentation of null map ([e400d5e](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/e400d5e24b3a2154ba5985bde9547a5b9e338032))
* improve devcontainer setup ([592c8c5](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/592c8c5a37cc33bef1aaca90a1282b8720eaca4c))
* **internal:** codegen related update ([8115308](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/8115308d2f141d463a619691692b56dcd9b80a44))
* lint tests ([ea88937](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/ea88937e7487e5d3073f81ecc19f1829110dcdd7))
* make go mod tidy continue on error ([3ff08b2](https://github.com/NeuralNetLab/ideogram-sdk-go/commit/3ff08b2a7c42ccc86eac2eefea3f3fd4748db736))

## 0.1.0-alpha.1 (2025-05-09)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/NeuralNetLab/ideogram-sdk-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

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

<!-- x-release-please-end -->
Expand Down Expand Up @@ -52,8 +52,7 @@ import (

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")
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("IDEOGRAM_SDK_API_KEY")
)
describe, err := client.Describe.New(context.TODO(), ideogramsdk.DescribeNewParams{
ImageFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
Expand Down Expand Up @@ -275,6 +274,8 @@ client.Describe.New(context.TODO(), ...,
)
```

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

See the [full list of request options](https://pkg.go.dev/github.com/NeuralNetLab/ideogram-sdk-go/option).

### Pagination
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Ideogram SDK please follow the respective company's security reporting guidelines.
or products provided by Ideogram SDK, please follow the respective company's security reporting guidelines.

---

Expand Down
3 changes: 3 additions & 0 deletions describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func (r DescribeNewParams) MarshalMultipart() (data []byte, contentType string,
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down
3 changes: 3 additions & 0 deletions edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func (r EditApplyParams) MarshalMultipart() (data []byte, contentType string, er
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down
17 changes: 16 additions & 1 deletion ideogramv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ type ColorPaletteUnionParam struct {
}

func (u ColorPaletteUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[ColorPaletteUnionParam](u.OfColorPaletteWithPresetName, u.OfColorPaletteWithMembers)
return param.MarshalUnion(u, u.OfColorPaletteWithPresetName, u.OfColorPaletteWithMembers)
}
func (u *ColorPaletteUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -434,6 +434,9 @@ func (r IdeogramV3EditParams) MarshalMultipart() (data []byte, contentType strin
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down Expand Up @@ -505,6 +508,9 @@ func (r IdeogramV3GenerateParams) MarshalMultipart() (data []byte, contentType s
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down Expand Up @@ -560,6 +566,9 @@ func (r IdeogramV3ReframeParams) MarshalMultipart() (data []byte, contentType st
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down Expand Up @@ -635,6 +644,9 @@ func (r IdeogramV3RemixParams) MarshalMultipart() (data []byte, contentType stri
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down Expand Up @@ -681,6 +693,9 @@ func (r IdeogramV3ReplaceBackgroundParams) MarshalMultipart() (data []byte, cont
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err == nil {
err = apiform.WriteExtras(writer, r.ExtraFields())
}
if err != nil {
writer.Close()
return nil, "", err
Expand Down
14 changes: 14 additions & 0 deletions internal/apiform/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,17 @@ func (e *encoder) newMapEncoder(_ reflect.Type) encoderFunc {
return e.encodeMapEntries(key, value, writer)
}
}

func WriteExtras(writer *multipart.Writer, extras map[string]any) (err error) {
for k, v := range extras {
str, ok := v.(string)
if !ok {
break
}
err = writer.WriteField(k, str)
if err != nil {
break
}
}
return
}
2 changes: 1 addition & 1 deletion internal/apijson/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (d *decoderBuilder) newStructTypeDecoder(t reflect.Type) decoderFunc {
}

// Handle null [param.Opt]
if itemNode.Type == gjson.Null && dest.Type().Implements(reflect.TypeOf((*param.Optional)(nil)).Elem()) {
if itemNode.Type == gjson.Null && dest.IsValid() && dest.Type().Implements(reflect.TypeOf((*param.Optional)(nil)).Elem()) {
dest.Addr().Interface().(json.Unmarshaler).UnmarshalJSON([]byte(itemNode.Raw))
continue
}
Expand Down
30 changes: 30 additions & 0 deletions internal/apijson/decoderesp_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package apijson_test

import (
"encoding/json"
"github.com/NeuralNetLab/ideogram-sdk-go/internal/apijson"
"github.com/NeuralNetLab/ideogram-sdk-go/packages/respjson"
"testing"
)

type StructWithNullExtraField struct {
Results []string `json:"results,required"`
JSON struct {
Results respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

func (r *StructWithNullExtraField) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

func TestDecodeWithNullExtraField(t *testing.T) {
raw := `{"something_else":null}`
var dst *StructWithNullExtraField
err := json.Unmarshal([]byte(raw), &dst)
if err != nil {
t.Fatalf("error: %s", err.Error())
}
}
13 changes: 3 additions & 10 deletions internal/encoding/json/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ type mapEncoder struct {
}

func (me mapEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
if v.IsNil() {
if v.IsNil() /* EDIT(begin) */ || sentinel.IsValueNull(v) /* EDIT(end) */ {
e.WriteString("null")
return
}
Expand Down Expand Up @@ -855,7 +855,7 @@ type sliceEncoder struct {
}

func (se sliceEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
if v.IsNil() {
if v.IsNil() /* EDIT(begin) */ || sentinel.IsValueNull(v) /* EDIT(end) */ {
e.WriteString("null")
return
}
Expand Down Expand Up @@ -916,14 +916,7 @@ type ptrEncoder struct {
}

func (pe ptrEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
// EDIT(begin)
//
// if v.IsNil() {
// e.WriteString("null")
// return
// }

if v.IsNil() || sentinel.IsValueNullPtr(v) || sentinel.IsValueNullSlice(v) {
if v.IsNil() {
e.WriteString("null")
return
}
Expand Down
Loading