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
41 changes: 41 additions & 0 deletions .github/workflows/publish-sonatype.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to Sonatype in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/ArcadeAI/arcade-java/actions/workflows/publish-sonatype.yml
name: Publish Sonatype
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: |
8
17
cache: gradle

- name: Set up Gradle
uses: gradle/gradle-build-action@v2

- name: Publish to Sonatype
run: |-
export -- GPG_SIGNING_KEY_ID
printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD"
GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')"
./gradlew publish
env:
SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.ARCADE_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.ARCADE_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }}
24 changes: 24 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'ArcadeAI/arcade-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.ARCADE_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.ARCADE_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0-alpha.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-8446c4e394ac1eeeab4eea23ba29649287af8cf410607dc8eea7ad6ec7d39861.yml
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-4dc4e58ef402ce5362e0a8988b3928a8bfa0d5ba847f7ad8b14226a0cf282f28.yml
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

## 0.1.0-alpha.1 (2025-12-08)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/ArcadeAI/arcade-java/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** api update ([f2a8654](https://github.com/ArcadeAI/arcade-java/commit/f2a8654351c4a197d666dcb2b2eb0190bcdab2e2))
* **api:** api update ([867c358](https://github.com/ArcadeAI/arcade-java/commit/867c358d06c3d5af9306d304a4e41320b1c0c67b))


### Chores

* configure new SDK language ([7a33653](https://github.com/ArcadeAI/arcade-java/commit/7a336537713407720db5315850b1f0fcd3f79442))
* **internal:** update java config ([e61bcc1](https://github.com/ArcadeAI/arcade-java/commit/e61bcc109789d0c8546626df6f50f4487bfa4da8))
* update SDK settings ([cb6b641](https://github.com/ArcadeAI/arcade-java/commit/cb6b641e3fc81f0640a0712edaf0d42e549cb236))


### Documentation

* add source file links to readme ([1801e21](https://github.com/ArcadeAI/arcade-java/commit/1801e21404a817fe4d68fdf1969af49f088ce154))
114 changes: 61 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Arcade Java API Library

[![Maven Central](https://img.shields.io/maven-central/v/com.arcade_engine.api/arcade-java)](https://central.sonatype.com/artifact/com.arcade_engine.api/arcade-java/0.0.1-alpha.0)
<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/dev.arcade/arcade-java)](https://central.sonatype.com/artifact/dev.arcade/arcade-java/0.1.0-alpha.1)

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

The Arcade Java SDK provides convenient access to the Arcade REST API from applications written in Java.

Expand All @@ -10,34 +14,38 @@ The REST API documentation can be found on [docs.arcade.dev](https://docs.arcade

## Installation

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

### Gradle

```kotlin
implementation("com.arcade_engine.api:arcade-java:0.0.1-alpha.0")
implementation("dev.arcade:arcade-java:0.1.0-alpha.1")
```

### Maven

```xml
<dependency>
<groupId>com.arcade_engine.api</groupId>
<groupId>dev.arcade</groupId>
<artifactId>arcade-java</artifactId>
<version>0.0.1-alpha.0</version>
<version>0.1.0-alpha.1</version>
</dependency>
```

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

## Requirements

This library requires Java 8 or later.

## Usage

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ExecuteToolResponse;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ExecuteToolResponse;
import dev.arcade.models.ToolExecuteParams;

// Configures using the `ARCADE_API_KEY` environment variable
ArcadeClient client = ArcadeOkHttpClient.fromEnv();
Expand All @@ -55,8 +63,8 @@ ExecuteToolResponse executeToolResponse = client.tools().execute(params);
Configure the client using environment variables:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;

// Configures using the `ARCADE_API_KEY` environment variable
ArcadeClient client = ArcadeOkHttpClient.fromEnv();
Expand All @@ -65,8 +73,8 @@ ArcadeClient client = ArcadeOkHttpClient.fromEnv();
Or manually:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;

ArcadeClient client = ArcadeOkHttpClient.builder()
.apiKey("My API Key")
Expand All @@ -76,8 +84,8 @@ ArcadeClient client = ArcadeOkHttpClient.builder()
Or using a combination of the two approaches:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;

ArcadeClient client = ArcadeOkHttpClient.builder()
// Configures using the `ARCADE_API_KEY` environment variable
Expand Down Expand Up @@ -115,11 +123,11 @@ Because each class is immutable, builder modification will _never_ affect alread
The default client is synchronous. To switch to asynchronous execution, call the `async()` method:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ExecuteToolResponse;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ExecuteToolResponse;
import dev.arcade.models.ToolExecuteParams;
import java.util.concurrent.CompletableFuture;

// Configures using the `ARCADE_API_KEY` environment variable
Expand All @@ -136,11 +144,11 @@ CompletableFuture<ExecuteToolResponse> executeToolResponse = client.async().tool
Or create an asynchronous client from the beginning:

```java
import com.arcade_engine.api.client.ArcadeClientAsync;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClientAsync;
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ExecuteToolResponse;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.client.ArcadeClientAsync;
import dev.arcade.client.okhttp.ArcadeOkHttpClientAsync;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ExecuteToolResponse;
import dev.arcade.models.ToolExecuteParams;
import java.util.concurrent.CompletableFuture;

// Configures using the `ARCADE_API_KEY` environment variable
Expand All @@ -160,7 +168,7 @@ The asynchronous client supports the same options as the synchronous one, except

The SDK throws custom unchecked exception types:

- [`ArcadeServiceException`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/errors/ArcadeServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:
- [`ArcadeServiceException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:

| Status | Exception |
| ------ | ------------------------------- |
Expand All @@ -173,11 +181,11 @@ The SDK throws custom unchecked exception types:
| 5xx | `InternalServerException` |
| others | `UnexpectedStatusCodeException` |

- [`ArcadeIoException`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/errors/ArcadeIoException.kt): I/O networking errors.
- [`ArcadeIoException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeIoException.kt): I/O networking errors.

- [`ArcadeInvalidDataException`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/errors/ArcadeInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response.
- [`ArcadeInvalidDataException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response.

- [`ArcadeException`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/errors/ArcadeException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.
- [`ArcadeException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.

## Logging

Expand Down Expand Up @@ -214,8 +222,8 @@ The API may also explicitly instruct the SDK to retry or not retry a response.
To set a custom number of retries, configure the client using the `maxRetries` method:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;

ArcadeClient client = ArcadeOkHttpClient.builder()
.fromEnv()
Expand All @@ -230,9 +238,9 @@ Requests time out after 1 minute by default.
To set a custom timeout, configure the method call using the `timeout` method:

```java
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ExecuteToolResponse;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ExecuteToolResponse;
import dev.arcade.models.ToolExecuteParams;

ExecuteToolResponse executeToolResponse = client.tools().execute(
params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()
Expand All @@ -242,8 +250,8 @@ ExecuteToolResponse executeToolResponse = client.tools().execute(
Or configure the default for all method calls at the client level:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;
import java.time.Duration;

ArcadeClient client = ArcadeOkHttpClient.builder()
Expand All @@ -257,8 +265,8 @@ ArcadeClient client = ArcadeOkHttpClient.builder()
To route requests through a proxy, configure the client using the `proxy` method:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;
import java.net.InetSocketAddress;
import java.net.Proxy;

Expand All @@ -281,8 +289,8 @@ The SDK is typed for convenient usage of the documented API. However, it also su
To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:

```java
import com.arcade_engine.api.core.JsonValue;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.core.JsonValue;
import dev.arcade.models.ToolExecuteParams;

ToolExecuteParams params = ToolExecuteParams.builder()
.putAdditionalHeader("Secret-Header", "42")
Expand All @@ -293,11 +301,11 @@ ToolExecuteParams params = ToolExecuteParams.builder()

These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. You can also set undocumented parameters on nested headers, query params, or body classes using the `putAdditionalProperty` method. These properties can be accessed on the built object later using the `_additionalProperties()` method.

To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/core/JsonValue.kt) object to its setter:
To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](arcade-java-core/src/main/kotlin/dev/arcade/core/JsonValue.kt) object to its setter:

```java
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ToolExecuteParams;

ToolExecuteParams params = ToolExecuteParams.builder()
.executeToolRequest(ExecuteToolRequest.builder()
Expand All @@ -311,7 +319,7 @@ ToolExecuteParams params = ToolExecuteParams.builder()
To access undocumented response properties, call the `_additionalProperties()` method:

```java
import com.arcade_engine.api.core.JsonValue;
import dev.arcade.core.JsonValue;
import java.util.Map;

Map<String, JsonValue> additionalProperties = client.tools().execute(params)._additionalProperties();
Expand Down Expand Up @@ -341,7 +349,7 @@ String result = secretPropertyValue.accept(new JsonValue.Visitor<>() {
To access a property's raw JSON value, which may be undocumented, call its `_` prefixed method:

```java
import com.arcade_engine.api.core.JsonField;
import dev.arcade.core.JsonField;
import java.util.Optional;

JsonField<Object> field = client.tools().execute(params)._field();
Expand All @@ -364,22 +372,22 @@ if (field.isMissing()) {

In rare cases, the API may return a response that doesn't match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.

By default, the SDK will not throw an exception in this case. It will throw [`ArcadeInvalidDataException`](arcade-java-core/src/main/kotlin/com/arcade_engine/api/errors/ArcadeInvalidDataException.kt) only if you directly access the property.
By default, the SDK will not throw an exception in this case. It will throw [`ArcadeInvalidDataException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeInvalidDataException.kt) only if you directly access the property.

If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:

```java
import com.arcade_engine.api.models.ExecuteToolResponse;
import dev.arcade.models.ExecuteToolResponse;

ExecuteToolResponse executeToolResponse = client.tools().execute(params).validate();
```

Or configure the method call to validate the response using the `responseValidation` method:

```java
import com.arcade_engine.api.models.ExecuteToolRequest;
import com.arcade_engine.api.models.ExecuteToolResponse;
import com.arcade_engine.api.models.ToolExecuteParams;
import dev.arcade.models.ExecuteToolRequest;
import dev.arcade.models.ExecuteToolResponse;
import dev.arcade.models.ToolExecuteParams;

ExecuteToolResponse executeToolResponse = client.tools().execute(
params, RequestOptions.builder().responseValidation(true).build()
Expand All @@ -389,8 +397,8 @@ ExecuteToolResponse executeToolResponse = client.tools().execute(
Or configure the default for all method calls at the client level:

```java
import com.arcade_engine.api.client.ArcadeClient;
import com.arcade_engine.api.client.okhttp.ArcadeOkHttpClient;
import dev.arcade.client.ArcadeClient;
import dev.arcade.client.okhttp.ArcadeOkHttpClient;

ArcadeClient client = ArcadeOkHttpClient.builder()
.fromEnv()
Expand Down Expand Up @@ -436,4 +444,4 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

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](https://www.github.com/stainless-sdks/arcade-engine-java/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/ArcadeAI/arcade-java/issues) with questions, bugs, or suggestions.
Loading
Loading