-
Notifications
You must be signed in to change notification settings - Fork 5
docs: create Sample Code classes to create push and Catalog Source in Coveo and instance Java classes in different ways #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f22fd3b
LENS-840 add code samples to create push and catalog source instance …
hdhayneCoveo f934c5a
LENS-840 apply review comments
hdhayneCoveo c5bc941
LENS-840 apply review comments by merging sample code classes for pus…
hdhayneCoveo 896efa8
Merge branch 'main' into LENS-840
hdhayneCoveo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Properties properties = new Properties(); | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| try { | ||
| //create source from url | ||
hdhayneCoveo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| URL url = new URL("my_api_url"); | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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); | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import com.coveo.pushapiclient.*; | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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(); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||
hdhayneCoveo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.