Skip to content

Commit

Permalink
Merge pull request #2 from bloomreach/dev
Browse files Browse the repository at this point in the history
Dev -> main
  • Loading branch information
prashant-br authored Jan 14, 2024
2 parents d42b2af + 6ed7315 commit f3eade6
Show file tree
Hide file tree
Showing 84 changed files with 4,440 additions and 1 deletion.
156 changes: 156 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#ignored project files
src/main/kotlin/Main.kt
src/main/kotlin/TestJmeter.kt
src/main/kotlin/TestJava.java
src/main/resources/
# Default ignored files
/shelf/
/workspace.xml
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Gradle template
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Kotlin template
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# Discovery Client SDK Integration
# Discovery Client SDK Integration

Discovery client SDK helps in integration of following APIs:
### [1. Search API](SEARCH.md)
### [2. Autosuggest API](SUGGEST.md)
### [3. SEO Widget API](SEO_WIDGET.md)
### [4. Recommendations and Pathways API](REC_PATHWAYS.md)


For more information on the underlying API call and the associated parameters, please refer to the related:

- [Bloomreach Search and Merchandising APIs page](https://documentation.bloomreach.com/discovery/reference/bloomreach-search-and-merchandising-apis).
- [Recommendations and Pathways API v2](https://documentation.bloomreach.com/discovery/reference/recommendations-and-pathways-apis).
- [Thematic Pages API](https://documentation.bloomreach.com/discovery/reference/thematic-pages-api).
- [SEO WIDGET API](https://documentation.bloomreach.com/discovery/reference/widget-api).





177 changes: 177 additions & 0 deletions REC_PATHWAYS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
[GO BACK](README.md)


# Recommendations and Pathways API Integration

For more information on the format of the JSON String, please refer to the [Recommendations and Pathways API v2](https://documentation.bloomreach.com/discovery/reference/recommendations-and-pathways-apis) page.

### Initializing the BrRecsAndPathwaysApi object:

```
val recsAndPathwaysApi = BrRecsAndPathwaysApi.Builder()
.accountId("<ACCOUNT_ID>")
.uuid("<UUID>")
.visitorType(VisitorType.NEW_USER)
.domainKey("<DOMAIN_KEY>")
.authKey("AUTH_KEY")
.userId("USER_ID")
.environment(Env.STAGE)
.build()
```
| Parameter | Description |
| ------------- |--------------------------------------------------------------------------------------------|
| accountId | Account ID provided by Bloomreach |
| uuid | A 13 digit random number |
| visitorType | ENUM type for New User or returning user. |
| domainKey | Your site domain's ID, which is provided by Bloomreach. |
| authKey | The Bloomreach-provided authentication key |
| userId | The Bloomreach-provided authentication key |
| environment | ENUM to specify APIs to be pointed to which environment. STAGE or PROD. Defaulted to STAGE |
| baseUrl | The base url of the API env if its different the default|
| connectionTimeOut | Connection timeout in milliseconds |
| maxTotalConnections | Max total connections |
| responseTimeout | Connection timeout for getting a response |


### Item-based Recommendation Widget

Create the object of WidgetRequest for the request parameter to be passed to the Item-based Recommendation Widget API with different types of fields supported.

```
val widgetRequest = WidgetRequest()
.itemIds("<ITEM_IDs>")
.contextId("<CONTEXT_ID>")
.url("example.com")
//Call the itemBasedRecommendationWidgetApi method and pass the request object.
val response = recsAndPathwaysApi?.itemBasedRecommendationWidgetApi("<WIDGET_ID>", widgetRequest)
if(response is RecsAndPathwaysResponse) {
//gets required response in response object of type RecsAndPathwaysResponse
} else {
val error = response as BrApiError
// if the API fails, handle error here.
}
```

Supported parameters for creating WidgetRequest object

| Parameter | Method calls |
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| item_ids | .itemIds(“1234”)<br/><br/>.itemIds(listOf(“1234”, “98765”)) |
| url | .url() |
| context_id | .contextId(“test”) |
| fields| .fields(“f1,f2”)<br/> <br/> .fields(listOf(“f1”, “f2”)) |
| filter | .filter(“”) <br/> <br/>.filter("price", 10.. 100, true) <br/> <br/> .filter("fabric", listOf("cotton", "linen"), Operator.AND) |
| rows | .rows() |
| user_id | .userId() |
| viewId | .viewId() |

### Category-based Widget API

Create the object of WidgetRequest for the request parameter to be passed to the Category-based Widget API with different types of fields supported.

```
val widgetRequest = WidgetRequest()
.catId("1234")
.url("example.com")
Call the categoryBasedWidgetApi method and pass the request object.
val response = recsAndPathwaysApi?.categoryBasedWidgetApi("<WIDGET_ID>", widgetRequest)
if(response is RecsAndPathwaysResponse) {
//gets required response in response object of type RecsAndPathwaysResponse
} else {
val error = response as BrApiError
// if the API fails, handle error here.
}
```
Supported parameters for creating WidgetRequest object

| Parameter | Method calls |
|------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| cat_id | .catId(“1234”) |
| url | .url() |
| facet | .facet(true) |
| filter_facet| .filterFacet("color:\"red\"")<br/> <br/> .filterFacet("color", "red") <br/> <br/> .filterFacet("color", listOf("red", "blue"), Operator.OR) |
| filter | .filter(“”) <br/> <br/>.filter("price", 10.. 100, true) <br/> <br/> .filter("fabric", listOf("cotton", "linen"), Operator.AND) |
| fields | .fields(“f1,f2”) <br/> <br/> .fields(listOf(“f1”, “f2”)) |
| rows | .rows() |
| start | .start() |
| user_id | .userId() |
| viewId | .viewId() |

### Keyword-based Widget API

Create the object of WidgetRequest for the request parameter to be passed to the Keyword-based Widget API with different types of fields supported.

```
val widgetRequest = WidgetRequest()
.query("cap")
.url("example.com")
val response = recsAndPathwaysApi?.keywordBasedWidgetApi("<WIDGET_ID>", widgetRequest)
if(response is RecsAndPathwaysResponse) {
//gets required response in response object of type RecsAndPathwaysResponse
} else {
val error = response as BrApiError
// if the API fails, handle error here.
}
```

| Parameter | Method calls |
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| query | .query(“cap”) |
Note: Other parameters same as Category Widget API

### Personalization-based Widget API

Create the object of WidgetRequest for the request parameter to be passed to the Personalization-based Widget API with different types of fields supported.

```
val widgetRequest = WidgetRequest()
.query("cap")
.userId(“u123”)
.url("example.com")
val response = recsAndPathwaysApi?.personalizationBasedWidgetApi("<WIDGET_ID>", widgetRequest)
if(response is RecsAndPathwaysResponse) {
//gets required response in response object of type RecsAndPathwaysResponse
} else {
val error = response as BrApiError
// if the API fails, handle error here.
}
```

| Parameter | Method calls |
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| user_id | .userId() |
| query | .query(“cap”) |
Note: Other parameters same as Item-based Widget API

### Global Recommendation Widget API

Create the object of WidgetRequest for the request parameter to be passed to the Global Recommendation Widget API
with different types of fields supported.

```
val widgetRequest = WidgetRequest()
val response = recsAndPathwaysApi?.globalRecommendationWidgetApi("<WIDGET_ID>", widgetRequest)
if(response is RecsAndPathwaysResponse) {
//gets required response in response object of type RecsAndPathwaysResponse
} else {
val error = response as BrApiError
// if the API fails, handle error here.
}
```
Note: Other parameters same as Item-based Widget API


Loading

0 comments on commit f3eade6

Please sign in to comment.