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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.settings
.node
build
src/main/java/com/seam/api/SeamBuilder.java

# IntelliJ
*.iml
Expand Down
11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {
}

dependencies {
api 'com.squareup.okhttp3:okhttp:4.9.3'
api 'com.squareup.okhttp3:okhttp:4.12.0'
api 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.3'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3'
Expand Down Expand Up @@ -47,8 +47,15 @@ publishing {
maven(MavenPublication) {
groupId = 'io.github.seamapi'
artifactId = 'java'
version = '0.2.1'
version = '0.3.0'
from components.java
pom {
scm {
connection = 'scm:git:git://github.com/seamapi/java.git'
developerConnection = 'scm:git:git://github.com/seamapi/java.git'
url = 'https://github.com/seamapi/java'
}
}
}
}
repositories {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew

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

20 changes: 10 additions & 10 deletions gradlew.bat

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

62 changes: 43 additions & 19 deletions src/main/java/com/seam/api/Seam.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
import com.seam.api.core.ClientOptions;
import com.seam.api.core.Suppliers;
import com.seam.api.resources.accesscodes.AccessCodesClient;
import com.seam.api.resources.acs.AcsClient;
import com.seam.api.resources.actionattempts.ActionAttemptsClient;
import com.seam.api.resources.clientsessions.ClientSessionsClient;
import com.seam.api.resources.connectedaccounts.ConnectedAccountsClient;
import com.seam.api.resources.connectwebviews.ConnectWebviewsClient;
import com.seam.api.resources.devices.DevicesClient;
import com.seam.api.resources.events.EventsClient;
import com.seam.api.resources.health.HealthClient;
import com.seam.api.resources.locks.LocksClient;
import com.seam.api.resources.networks.NetworksClient;
import com.seam.api.resources.noisesensors.NoiseSensorsClient;
import com.seam.api.resources.phones.PhonesClient;
import com.seam.api.resources.thermostats.ThermostatsClient;
import com.seam.api.resources.useridentities.UserIdentitiesClient;
import com.seam.api.resources.webhooks.WebhooksClient;
import com.seam.api.resources.workspaces.WorkspacesClient;
import java.util.function.Supplier;
Expand All @@ -29,41 +32,50 @@ public class Seam {

protected final Supplier<ClientSessionsClient> clientSessionsClient;

protected final Supplier<ConnectedAccountsClient> connectedAccountsClient;

protected final Supplier<ConnectWebviewsClient> connectWebviewsClient;

protected final Supplier<ConnectedAccountsClient> connectedAccountsClient;

protected final Supplier<DevicesClient> devicesClient;

protected final Supplier<EventsClient> eventsClient;

protected final Supplier<HealthClient> healthClient;

protected final Supplier<LocksClient> locksClient;

protected final Supplier<NoiseSensorsClient> noiseSensorsClient;
protected final Supplier<NetworksClient> networksClient;

protected final Supplier<PhonesClient> phonesClient;

protected final Supplier<ThermostatsClient> thermostatsClient;

protected final Supplier<UserIdentitiesClient> userIdentitiesClient;

protected final Supplier<WebhooksClient> webhooksClient;

protected final Supplier<WorkspacesClient> workspacesClient;

protected final Supplier<AcsClient> acsClient;

protected final Supplier<NoiseSensorsClient> noiseSensorsClient;

public Seam(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.accessCodesClient = Suppliers.memoize(() -> new AccessCodesClient(clientOptions));
this.actionAttemptsClient = Suppliers.memoize(() -> new ActionAttemptsClient(clientOptions));
this.clientSessionsClient = Suppliers.memoize(() -> new ClientSessionsClient(clientOptions));
this.connectedAccountsClient = Suppliers.memoize(() -> new ConnectedAccountsClient(clientOptions));
this.connectWebviewsClient = Suppliers.memoize(() -> new ConnectWebviewsClient(clientOptions));
this.connectedAccountsClient = Suppliers.memoize(() -> new ConnectedAccountsClient(clientOptions));
this.devicesClient = Suppliers.memoize(() -> new DevicesClient(clientOptions));
this.eventsClient = Suppliers.memoize(() -> new EventsClient(clientOptions));
this.healthClient = Suppliers.memoize(() -> new HealthClient(clientOptions));
this.locksClient = Suppliers.memoize(() -> new LocksClient(clientOptions));
this.noiseSensorsClient = Suppliers.memoize(() -> new NoiseSensorsClient(clientOptions));
this.networksClient = Suppliers.memoize(() -> new NetworksClient(clientOptions));
this.phonesClient = Suppliers.memoize(() -> new PhonesClient(clientOptions));
this.thermostatsClient = Suppliers.memoize(() -> new ThermostatsClient(clientOptions));
this.userIdentitiesClient = Suppliers.memoize(() -> new UserIdentitiesClient(clientOptions));
this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions));
this.workspacesClient = Suppliers.memoize(() -> new WorkspacesClient(clientOptions));
this.acsClient = Suppliers.memoize(() -> new AcsClient(clientOptions));
this.noiseSensorsClient = Suppliers.memoize(() -> new NoiseSensorsClient(clientOptions));
}

public AccessCodesClient accessCodes() {
Expand All @@ -78,14 +90,14 @@ public ClientSessionsClient clientSessions() {
return this.clientSessionsClient.get();
}

public ConnectedAccountsClient connectedAccounts() {
return this.connectedAccountsClient.get();
}

public ConnectWebviewsClient connectWebviews() {
return this.connectWebviewsClient.get();
}

public ConnectedAccountsClient connectedAccounts() {
return this.connectedAccountsClient.get();
}

public DevicesClient devices() {
return this.devicesClient.get();
}
Expand All @@ -94,22 +106,26 @@ public EventsClient events() {
return this.eventsClient.get();
}

public HealthClient health() {
return this.healthClient.get();
}

public LocksClient locks() {
return this.locksClient.get();
}

public NoiseSensorsClient noiseSensors() {
return this.noiseSensorsClient.get();
public NetworksClient networks() {
return this.networksClient.get();
}

public PhonesClient phones() {
return this.phonesClient.get();
}

public ThermostatsClient thermostats() {
return this.thermostatsClient.get();
}

public UserIdentitiesClient userIdentities() {
return this.userIdentitiesClient.get();
}

public WebhooksClient webhooks() {
return this.webhooksClient.get();
}
Expand All @@ -118,6 +134,14 @@ public WorkspacesClient workspaces() {
return this.workspacesClient.get();
}

public AcsClient acs() {
return this.acsClient.get();
}

public NoiseSensorsClient noiseSensors() {
return this.noiseSensorsClient.get();
}

public static SeamBuilder builder() {
return new SeamBuilder();
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/seam/api/SeamBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
public final class SeamBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();

private String apiKey = null;

private Environment environment = Environment.DEFAULT;

/**
* Sets apiKey
*/
public SeamBuilder apiKey(String apiKey) {
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + apiKey);
return this;
}

public SeamBuilder seamWorkspace(String seamWorkspace) {
this.clientOptionsBuilder.addHeader("Seam-Workspace", seamWorkspace);
this.apiKey = apiKey;
return this;
}

Expand All @@ -32,6 +32,7 @@ public SeamBuilder url(String url) {
}

public Seam build() {
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.apiKey);
clientOptionsBuilder.environment(this.environment);
return new Seam(clientOptionsBuilder.build());
}
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/com/seam/api/core/ApiError.java

This file was deleted.

24 changes: 21 additions & 3 deletions src/main/java/com/seam/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import okhttp3.OkHttpClient;

Expand All @@ -25,11 +26,15 @@ private ClientOptions(
this.environment = environment;
this.headers = new HashMap<>();
this.headers.putAll(headers);
this.headers.putAll(Map.of(
"X-Fern-SDK-Name", "com.seam.fern:api-sdk", "X-Fern-SDK-Version", "0.2.1", "X-Fern-Language", "JAVA"));
this.headers.putAll(new HashMap<String, String>() {
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.seam.fern:api-sdk");
put("X-Fern-SDK-Version", "0.3.0");
}
});
this.headerSuppliers = headerSuppliers;
this.httpClient = httpClient;
;
}

public Environment environment() {
Expand All @@ -51,6 +56,19 @@ public OkHttpClient httpClient() {
return this.httpClient;
}

public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) {
if (requestOptions == null) {
return this.httpClient;
}
return this.httpClient
.newBuilder()
.callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.connectTimeout(0, TimeUnit.SECONDS)
.writeTimeout(0, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.SECONDS)
.build();
}

public static Builder builder() {
return new Builder();
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/seam/api/core/MediaTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.seam.api.core;

import okhttp3.MediaType;

public final class MediaTypes {

public static final MediaType APPLICATION_JSON = MediaType.parse("application/json");

private MediaTypes() {}
}
Loading