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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ java {

group = 'io.intercom'

version = '3.0.0-alpha5'
version = '3.0.0-alpha7'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -77,7 +77,7 @@ publishing {
maven(MavenPublication) {
groupId = 'io.intercom'
artifactId = 'intercom-java'
version = '3.0.0-alpha5'
version = '3.0.0-alpha7'
from components.java
pom {
name = 'intercom'
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/intercom/api/AsyncIntercom.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.intercom.api.resources.companies.AsyncCompaniesClient;
import com.intercom.api.resources.contacts.AsyncContactsClient;
import com.intercom.api.resources.conversations.AsyncConversationsClient;
import com.intercom.api.resources.customchannelevents.AsyncCustomChannelEventsClient;
import com.intercom.api.resources.dataattributes.AsyncDataAttributesClient;
import com.intercom.api.resources.dataexport.AsyncDataExportClient;
import com.intercom.api.resources.events.AsyncEventsClient;
Expand Down Expand Up @@ -68,6 +69,8 @@ public class AsyncIntercom {

protected final Supplier<AsyncVisitorsClient> visitorsClient;

protected final Supplier<AsyncCustomChannelEventsClient> customChannelEventsClient;

protected final Supplier<AsyncNewsClient> newsClient;

public AsyncIntercom(ClientOptions clientOptions) {
Expand All @@ -91,6 +94,7 @@ public AsyncIntercom(ClientOptions clientOptions) {
this.ticketTypesClient = Suppliers.memoize(() -> new AsyncTicketTypesClient(clientOptions));
this.ticketsClient = Suppliers.memoize(() -> new AsyncTicketsClient(clientOptions));
this.visitorsClient = Suppliers.memoize(() -> new AsyncVisitorsClient(clientOptions));
this.customChannelEventsClient = Suppliers.memoize(() -> new AsyncCustomChannelEventsClient(clientOptions));
this.newsClient = Suppliers.memoize(() -> new AsyncNewsClient(clientOptions));
}

Expand Down Expand Up @@ -170,6 +174,10 @@ public AsyncVisitorsClient visitors() {
return this.visitorsClient.get();
}

public AsyncCustomChannelEventsClient customChannelEvents() {
return this.customChannelEventsClient.get();
}

public AsyncNewsClient news() {
return this.newsClient.get();
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/intercom/api/Intercom.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.intercom.api.resources.companies.CompaniesClient;
import com.intercom.api.resources.contacts.ContactsClient;
import com.intercom.api.resources.conversations.ConversationsClient;
import com.intercom.api.resources.customchannelevents.CustomChannelEventsClient;
import com.intercom.api.resources.dataattributes.DataAttributesClient;
import com.intercom.api.resources.dataexport.DataExportClient;
import com.intercom.api.resources.events.EventsClient;
Expand Down Expand Up @@ -68,6 +69,8 @@ public class Intercom {

protected final Supplier<VisitorsClient> visitorsClient;

protected final Supplier<CustomChannelEventsClient> customChannelEventsClient;

protected final Supplier<NewsClient> newsClient;

public Intercom(ClientOptions clientOptions) {
Expand All @@ -91,6 +94,7 @@ public Intercom(ClientOptions clientOptions) {
this.ticketTypesClient = Suppliers.memoize(() -> new TicketTypesClient(clientOptions));
this.ticketsClient = Suppliers.memoize(() -> new TicketsClient(clientOptions));
this.visitorsClient = Suppliers.memoize(() -> new VisitorsClient(clientOptions));
this.customChannelEventsClient = Suppliers.memoize(() -> new CustomChannelEventsClient(clientOptions));
this.newsClient = Suppliers.memoize(() -> new NewsClient(clientOptions));
}

Expand Down Expand Up @@ -170,6 +174,10 @@ public VisitorsClient visitors() {
return this.visitorsClient.get();
}

public CustomChannelEventsClient customChannelEvents() {
return this.customChannelEventsClient.get();
}

public NewsClient news() {
return this.newsClient.get();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/intercom/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap<String, String>() {
{
put("User-Agent", "io.intercom:intercom-java/3.0.0-alpha5");
put("User-Agent", "io.intercom:intercom-java/3.0.0-alpha7");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.intercom.fern:api-sdk");
put("X-Fern-SDK-Version", "3.0.0-alpha5");
put("X-Fern-SDK-Version", "3.0.0-alpha7");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.intercom.api.resources.customchannelevents;

import com.intercom.api.core.ClientOptions;
import com.intercom.api.core.RequestOptions;
import java.util.concurrent.CompletableFuture;

public class AsyncCustomChannelEventsClient {
protected final ClientOptions clientOptions;

private final AsyncRawCustomChannelEventsClient rawClient;

public AsyncCustomChannelEventsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawCustomChannelEventsClient(clientOptions);
}

/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawCustomChannelEventsClient withRawResponse() {
return this.rawClient;
}

public CompletableFuture<Void> notifyAttributeCollected() {
return this.rawClient.notifyAttributeCollected().thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyAttributeCollected(RequestOptions requestOptions) {
return this.rawClient.notifyAttributeCollected(requestOptions).thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyNewMessage() {
return this.rawClient.notifyNewMessage().thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyNewMessage(RequestOptions requestOptions) {
return this.rawClient.notifyNewMessage(requestOptions).thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyNewConversation() {
return this.rawClient.notifyNewConversation().thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyNewConversation(RequestOptions requestOptions) {
return this.rawClient.notifyNewConversation(requestOptions).thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyQuickReplySelected() {
return this.rawClient.notifyQuickReplySelected().thenApply(response -> response.body());
}

public CompletableFuture<Void> notifyQuickReplySelected(RequestOptions requestOptions) {
return this.rawClient.notifyQuickReplySelected(requestOptions).thenApply(response -> response.body());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.intercom.api.resources.customchannelevents;

import com.intercom.api.core.ClientOptions;
import com.intercom.api.core.IntercomApiException;
import com.intercom.api.core.IntercomException;
import com.intercom.api.core.IntercomHttpResponse;
import com.intercom.api.core.ObjectMappers;
import com.intercom.api.core.RequestOptions;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;

public class AsyncRawCustomChannelEventsClient {
protected final ClientOptions clientOptions;

public AsyncRawCustomChannelEventsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyAttributeCollected() {
return notifyAttributeCollected(null);
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyAttributeCollected(RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("custom_channel_events/notify_attribute_collected")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<IntercomHttpResponse<Void>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new IntercomHttpResponse<>(null, response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new IntercomApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
}

@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
});
return future;
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyNewMessage() {
return notifyNewMessage(null);
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyNewMessage(RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("custom_channel_events/notify_new_message")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<IntercomHttpResponse<Void>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new IntercomHttpResponse<>(null, response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new IntercomApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
}

@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
});
return future;
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyNewConversation() {
return notifyNewConversation(null);
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyNewConversation(RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("custom_channel_events/notify_new_conversation")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<IntercomHttpResponse<Void>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new IntercomHttpResponse<>(null, response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new IntercomApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
}

@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
});
return future;
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyQuickReplySelected() {
return notifyQuickReplySelected(null);
}

public CompletableFuture<IntercomHttpResponse<Void>> notifyQuickReplySelected(RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("custom_channel_events/notify_quick_reply_selected")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<IntercomHttpResponse<Void>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new IntercomHttpResponse<>(null, response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new IntercomApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
}

@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new IntercomException("Network error executing HTTP request", e));
}
});
return future;
}
}
Loading
Loading