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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.31.0"
".": "4.32.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 151
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-dd99495ad509338e6de862802839360dfe394d5cd6d6ba6d13fec8fca92328b8.yml
openapi_spec_hash: 68abda9122013a9ae3f084cfdbe8e8c1
config_hash: 5635033cdc8c930255f8b529a78de722
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7c540cce6eb30401259f4831ea9803b6d88501605d13734f98212cbb3b199e10.yml
openapi_spec_hash: 06e656be22bbb92689954253668b42fc
config_hash: 1a88b104658b6c854117996c080ebe6b
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 4.32.0 (2026-04-16)

Full Changelog: [v4.31.0...v4.32.0](https://github.com/openai/openai-java/compare/v4.31.0...v4.32.0)

### Features

* **api:** Add detail to InputFileContent ([0c8418c](https://github.com/openai/openai-java/commit/0c8418cb584103e273b12f70b1cf535364d44bfd))
* **api:** add OAuthErrorCode type ([09b41e1](https://github.com/openai/openai-java/commit/09b41e1d925371b6b6c94b8a147dce6264be6120))


### Documentation

* improve examples ([717a8d5](https://github.com/openai/openai-java/commit/717a8d5cc331c2746ed1548ef89418f70707d23a))

## 4.31.0 (2026-04-08)

Full Changelog: [v4.30.0...v4.31.0](https://github.com/openai/openai-java/compare/v4.30.0...v4.31.0)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.31.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.31.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.31.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.32.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.32.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.32.0)

<!-- x-release-please-end -->

The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://platform.openai.com/docs) from applications written in Java.

<!-- x-release-please-start-version -->

The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.31.0).
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.32.0).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
### Gradle

```kotlin
implementation("com.openai:openai-java:4.31.0")
implementation("com.openai:openai-java:4.32.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.31.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>4.31.0</version>
<version>4.32.0</version>
</dependency>
```

Expand Down Expand Up @@ -1419,7 +1419,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
#### Gradle

```kotlin
implementation("com.openai:openai-java-spring-boot-starter:4.31.0")
implementation("com.openai:openai-java-spring-boot-starter:4.32.0")
```

#### Maven
Expand All @@ -1428,7 +1428,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.31.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java-spring-boot-starter</artifactId>
<version>4.31.0</version>
<version>4.32.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.openai"
version = "4.31.0" // x-release-please-version
version = "4.32.0" // x-release-please-version
}

subprojects {
Expand Down
132 changes: 132 additions & 0 deletions openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// File generated from our OpenAPI spec by Stainless.

package com.openai.models

import com.fasterxml.jackson.annotation.JsonCreator
import com.openai.core.Enum
import com.openai.core.JsonField
import com.openai.errors.OpenAIInvalidDataException

class OAuthErrorCode @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

/**
* Returns this class instance's raw value.
*
* This is usually only useful if this instance was deserialized from data that doesn't match
* any known member, and you want to know that value. For example, if the SDK is on an older
* version than the API, then the API may respond with new members that the SDK is unaware of.
*/
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

companion object {

@JvmField val INVALID_GRANT = of("invalid_grant")

@JvmField val INVALID_SUBJECT_TOKEN = of("invalid_subject_token")

@JvmStatic fun of(value: String) = OAuthErrorCode(JsonField.of(value))
}

/** An enum containing [OAuthErrorCode]'s known values. */
enum class Known {
INVALID_GRANT,
INVALID_SUBJECT_TOKEN,
}

/**
* An enum containing [OAuthErrorCode]'s known values, as well as an [_UNKNOWN] member.
*
* An instance of [OAuthErrorCode] can contain an unknown value in a couple of cases:
* - It was deserialized from data that doesn't match any known member. For example, if the SDK
* is on an older version than the API, then the API may respond with new members that the SDK
* is unaware of.
* - It was constructed with an arbitrary value using the [of] method.
*/
enum class Value {
INVALID_GRANT,
INVALID_SUBJECT_TOKEN,
/**
* An enum member indicating that [OAuthErrorCode] was instantiated with an unknown value.
*/
_UNKNOWN,
}

/**
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
* the class was instantiated with an unknown value.
*
* Use the [known] method instead if you're certain the value is always known or if you want to
* throw for the unknown case.
*/
fun value(): Value =
when (this) {
INVALID_GRANT -> Value.INVALID_GRANT
INVALID_SUBJECT_TOKEN -> Value.INVALID_SUBJECT_TOKEN
else -> Value._UNKNOWN
}

/**
* Returns an enum member corresponding to this class instance's value.
*
* Use the [value] method instead if you're uncertain the value is always known and don't want
* to throw for the unknown case.
*
* @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
*/
fun known(): Known =
when (this) {
INVALID_GRANT -> Known.INVALID_GRANT
INVALID_SUBJECT_TOKEN -> Known.INVALID_SUBJECT_TOKEN
else -> throw OpenAIInvalidDataException("Unknown OAuthErrorCode: $value")
}

/**
* Returns this class instance's primitive wire representation.
*
* This differs from the [toString] method because that method is primarily for debugging and
* generally doesn't throw.
*
* @throws OpenAIInvalidDataException if this class instance's value does not have the expected
* primitive type.
*/
fun asString(): String =
_value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") }

private var validated: Boolean = false

fun validate(): OAuthErrorCode = apply {
if (validated) {
return@apply
}

known()
validated = true
}

fun isValid(): Boolean =
try {
validate()
true
} catch (e: OpenAIInvalidDataException) {
false
}

/**
* Returns a score indicating how many valid values are contained in this object recursively.
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is OAuthErrorCode && value == other.value
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}
Loading
Loading