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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 6 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cliVersion": "3.56.8",
"cliVersion": "5.44.7",
"generatorName": "fernapi/fern-java-sdk",
"generatorVersion": "3.34.6",
"generatorVersion": "4.9.1",
"generatorConfig": {
"publish-to": "central",
"package-prefix": "com.icepanel",
Expand All @@ -12,5 +12,8 @@
"package-layout": "flat",
"use-local-date-for-dates": true
},
"sdkVersion": "0.1.4"
"originGitCommit": "9f29099c1e75f465353107fd18a048873a6f3f81",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "0.1.5"
}
10 changes: 10 additions & 0 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Specify files that shouldn't be modified by Fern
.github/workflows/ci.yml
.github/workflows/ci.yml
.fern/replay.lock
.fern/replay.yml
.gitattributes
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.fern/replay.lock linguist-generated=true
114 changes: 114 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Contributing

Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.

## Getting Started

### Prerequisites

- Java 11+
- Gradle

### Installation

Install the project dependencies:

```bash
./gradlew build
```

### Building

Build the project:

```bash
./gradlew build
```

### Testing

Run the test suite:

```bash
./gradlew test
```

### Formatting

Check and fix code style:

```bash
./gradlew spotlessApply
```

## About Generated Code

**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.

### Generated Files

The following directories contain generated code:
- `src/` - API client classes and types
- Most Java files in the project

### How to Customize

If you need to customize the SDK, you have two options:

#### Option 1: Use `.fernignore`

For custom code that should persist across SDK regenerations:

1. Create a `.fernignore` file in the project root
2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
3. Add your custom code to those files

Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.

For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).

#### Option 2: Contribute to the Generator

If you want to change how code is generated for all users of this SDK:

1. The Java SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
2. Generator code is located at `generators/java-v2/`
3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
4. Submit a pull request with your changes to the generator

This approach is best for:
- Bug fixes in generated code
- New features that would benefit all users
- Improvements to code generation patterns

## Making Changes

### Workflow

1. Create a new branch for your changes
2. Make your modifications
3. Run tests to ensure nothing breaks: `./gradlew test`
4. Run formatting: `./gradlew spotlessApply`
5. Build the project: `./gradlew build`
6. Commit your changes with a clear commit message
7. Push your branch and create a pull request

### Commit Messages

Write clear, descriptive commit messages that explain what changed and why.

### Code Style

This project uses automated code formatting. Run `./gradlew spotlessApply` before committing to ensure your code meets the project's style guidelines.

## Questions or Issues?

If you have questions or run into issues:

1. Check the [Fern documentation](https://buildwithfern.com)
2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
3. Open a new issue if your question hasn't been addressed

## License

By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
65 changes: 57 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The IcePanel Java library provides convenient access to the IcePanel APIs from J
- [Getting Started](#getting-started)
- [Environments](#environments)
- [Base Url](#base-url)
- [Pagination](#pagination)
- [Exception Handling](#exception-handling)
- [Advanced](#advanced)
- [Custom Client](#custom-client)
Expand All @@ -29,7 +30,7 @@ Add the dependency in your `build.gradle` file:

```groovy
dependencies {
implementation 'com.icepanel:sdk'
implementation 'com.icepanel:sdk:0.1.5'
}
```

Expand All @@ -41,7 +42,7 @@ Add the dependency in your `pom.xml` file:
<dependency>
<groupId>com.icepanel</groupId>
<artifactId>sdk</artifactId>
<version>0.1.4</version>
<version>0.1.5</version>
</dependency>
```

Expand Down Expand Up @@ -104,16 +105,56 @@ IcePanelClient client = IcePanelClient
.build();
```

## Pagination

Paginated requests will return an Iterable<T>, which can be used to loop through the underlying items, or stream them. You can also call
`nextPage` to perform the pagination manually

```java
import com.icepanel.IcePanelClient;
import com.icepanel.core.SyncPagingIterable;
import com.icepanel.types.ModelObjectExpanded;
import java.util.List;

IcePanelClient client = IcePanelClient
.builder()
.build();

SyncPagingIterable<SyncPagingIterable<ModelObjectExpanded>> response = client.model().objects().list(...);

// Iterator
for (item : response){
// Do something with item
}

// Streaming
response.streamItems().map(item -> ...);

// Manual pagination
for (
List<SyncPagingIterable<ModelObjectExpanded>> items = response.getItems;
response.hasNext();
items = items.nextPage().getItems()) {
// Do something with items
}

// Access pagination metadata
response.getResponse().ifPresent(r -> {
String cursor = r.getNext();
// Use cursor for stateless pagination
});
```

## Exception Handling

When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown.

```java
import com.icepanel.core.IcepanelApiApiException;
import com.icepanel.core.IcePanelClientApiException;

try{
client.model().objects().list(...);
} catch (IcepanelApiApiException e){
} catch (IcePanelClientApiException e){
// Do something with the API exception...
}
```
Expand Down Expand Up @@ -145,11 +186,19 @@ retry limit (default: 2). Before defaulting to exponential backoff, the SDK will
the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header
(as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff.

A request is deemed retryable when any of the following HTTP status codes is returned:
Which status codes are retried depends on the `retry-status-codes` generator configuration:

**`legacy`** (current default): retries on
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)

**`recommended`**: retries on
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)

Use the `maxRetries` client option to configure this behavior.

Expand Down Expand Up @@ -218,7 +267,7 @@ The `withRawResponse()` method returns a raw client that wraps all responses wit
(A normal client's `response` is identical to a raw client's `response.body()`.)

```java
ListHttpResponse response = client.model().objects().withRawResponse().list(...);
IcePanelClientHttpResponse response = client.model().objects().withRawResponse().list(...);

System.out.println(response.body());
System.out.println(response.headers().get("X-My-Header"));
Expand All @@ -232,4 +281,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!
On the other hand, contributions to the README are always very welcome!
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ repositories {

dependencies {
api 'com.squareup.okhttp3:okhttp:5.2.1'
api 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
api 'com.fasterxml.jackson.core:jackson-databind:2.18.6'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.6'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.6'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
Expand Down Expand Up @@ -47,7 +47,7 @@ java {

group = 'com.icepanel'

version = '0.1.4'
version = '0.1.5'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -78,7 +78,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.icepanel'
artifactId = 'sdk'
version = '0.1.4'
version = '0.1.5'
from components.java
pom {
name = 'IcePanel <mail@icepanel.io>'
Expand Down
Loading
Loading