Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions samples/CreateCatalogSourceInstance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import com.coveo.pushapiclient.*;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;

public class CreateCatalogSourceInstance {
public static void main(String[] args) throws FileNotFoundException {
Properties properties = new Properties();
try {
//create source from url
URL url = new URL("my_api_url");
CatalogSource catalogSource1 = new CatalogSource("my_api_key", url);

//create source from platform config
PlatformUrl platformUrl = new PlatformUrlBuilder().withEnvironment(Environment.PRODUCTION).withRegion(Region.EU).build();
CatalogSource catalogSource2 = CatalogSource.fromPlatformUrl("my_api_key","my_organization_id","my_source_id", platformUrl);

} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
19 changes: 19 additions & 0 deletions samples/CreateCoveoCatalogSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import com.coveo.pushapiclient.*;

import java.io.IOException;
import java.net.http.HttpResponse;

import com.coveo.pushapiclient.CatalogSource;

public class CreateCoveoCatalogSource {
public static void main(String[] args) {
PlatformClient platformClient = new PlatformClient("my_api_key", "my_org_id");
try {
HttpResponse<String> response = CatalogSource.create(platformClient, "the_name_of_my_source", SourceVisibility.SHARED);
System.out.println(String.format("Catalog Source creation status: %s", response.statusCode()));
System.out.println(String.format("Catalog Source creation response: %s", response.body()));
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
17 changes: 17 additions & 0 deletions samples/CreateCoveoPushSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import com.coveo.pushapiclient.*;

import java.io.IOException;
import java.net.http.HttpResponse;

public class CreateCoveoPushSource {
public static void main(String[] args) {
PlatformClient platformClient = new PlatformClient("my_api_key", "my_org_id");
try {
HttpResponse<String> response = PushSource.create(platformClient, "the_name_of_my_source", SourceVisibility.SHARED);
System.out.println(String.format("Push Source creation status: %s", response.statusCode()));
System.out.println(String.format("Push Source creation response: %s", response.body()));
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
24 changes: 24 additions & 0 deletions samples/CreatePushSourceInstance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import com.coveo.pushapiclient.*;

import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;

public class CreatePushSourceInstance {
public static void main(String[] args) throws FileNotFoundException {
Properties properties = new Properties();
try {
//create source from url
URL url = new URL("my_api_url");
PushSource pushSource1 = new PushSource("my_api_key", url);

//create source from platform config
PlatformUrl platformUrl = new PlatformUrlBuilder().withEnvironment(Environment.PRODUCTION).withRegion(Region.EU).build();
PushSource pushSource2 = PushSource.fromPlatformUrl("my_api_key","my_organization_id","my_source_id", platformUrl);

} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
1 change: 1 addition & 0 deletions samples/CreateSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.IOException;
import java.net.http.HttpResponse;

@Deprecated
public class CreateSource {
public static void main(String[] args) {
PlatformUrl platformUrl = new PlatformUrlBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/coveo/pushapiclient/CatalogSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.net.http.HttpResponse;

// TODO: LENS-851 - Make public when ready
class CatalogSource implements StreamEnabledSource {
public class CatalogSource implements StreamEnabledSource {
private final String apiKey;
private final ApiUrl urlExtractor;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/coveo/pushapiclient/PushSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.net.http.HttpResponse;

// TODO: LENS-851 - Make public when ready
class PushSource implements PushEnabledSource {
public class PushSource implements PushEnabledSource {
private final String apiKey;
private final ApiUrl urlExtractor;
private final PlatformClient platformClient;
Expand Down