ConstructorIo

object ConstructorIo

The Constructor SDK client used for getting results and tracking behavioural data.

Functions

Link copied to clipboard
fun getAutocompleteResults(request: AutocompleteRequest): Observable<ConstructorData<AutocompleteResponse>>

Returns a list of autocomplete suggestions utilizing a request object.

fun getAutocompleteResults(    term: String,     facets: List<Pair<String, List<String>>>? = null,     groupId: Int? = null,     hiddenFields: List<String>? = null,     variationsMap: VariationsMap? = null,     sectionFacets: Map<String, List<Pair<String, List<String>>>>? = null): Observable<ConstructorData<AutocompleteResponse>>

Returns a list of autocomplete suggestions.

Link copied to clipboard
suspend fun getAutocompleteResultsCRT(    term: String,     facets: List<Pair<String, List<String>>>? = null,     groupId: Int? = null,     hiddenFields: List<String>? = null,     variationsMap: VariationsMap? = null,     sectionFacets: Map<String, List<Pair<String, List<String>>>>? = null): AutocompleteResponse

Returns a list of autocomplete suggestions. This function should be called within a coroutine scope.

Link copied to clipboard
fun getBrowseFacetOptions(request: BrowseFacetOptionsRequest): Observable<ConstructorData<BrowseFacetOptionsResponse>>

Returns a list of browse facet options utilizing a request object.

fun getBrowseFacetOptions(facetName: String, showHiddenFacets: Boolean? = null): Observable<ConstructorData<BrowseFacetOptionsResponse>>

Returns a list of browse facet options results.

Link copied to clipboard
suspend fun getBrowseFacetOptionsCRT(facetName: String, showHiddenFacets: Boolean? = null): BrowseFacetOptionsResponse

Returns a list of browse facet options results. This function should be called within a coroutine scope.

Link copied to clipboard
fun getBrowseFacets(request: BrowseFacetsRequest): Observable<ConstructorData<BrowseFacetsResponse>>

Returns a list of browse facet results utilizing a request object.

fun getBrowseFacets(    page: Int? = null,     perPage: Int? = null,     offset: Int? = null,     showHiddenFacets: Boolean? = null): Observable<ConstructorData<BrowseFacetsResponse>>

Returns a list of browse facet results.

Link copied to clipboard
suspend fun getBrowseFacetsCRT(    page: Int? = null,     perPage: Int? = null,     offset: Int? = null,     showHiddenFacets: Boolean? = null): BrowseFacetsResponse

Returns a list of browse facets results. This function should be called within a coroutine scope.

Link copied to clipboard
fun getBrowseGroups(request: BrowseGroupsRequest): Observable<ConstructorData<BrowseGroupsResponse>>

Returns a list of browse groups results utilizing a request object.

fun getBrowseGroups(groupId: String? = null, groupsMaxDepth: Int? = null): Observable<ConstructorData<BrowseGroupsResponse>>

Returns a list of browse groups results.

Link copied to clipboard
suspend fun getBrowseGroupsCRT(groupId: String? = null, groupsMaxDepth: Int? = null): BrowseGroupsResponse

Returns a list of browse groups results. This function should be called within a coroutine scope.

Link copied to clipboard
fun getBrowseItemsResults(request: BrowseItemsRequest): Observable<ConstructorData<BrowseResponse>>

Returns a list of browse results from a list of item IDs including filters, categories, sort options, etc. utilizing a request object.

Link copied to clipboard
suspend fun getBrowseItemsResultsCRT(    itemIds: List<String>,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): BrowseResponse

Returns a list of browse results from a list of item IDs including filters, categories, sort options, etc. This function should be called within a coroutine scope.

Link copied to clipboard
fun getBrowseResults(request: BrowseRequest): Observable<ConstructorData<BrowseResponse>>

Returns a list of browse results including filters, categories, sort options, etc. utilizing a request object.

fun getBrowseResults(    filterName: String,     filterValue: String,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): Observable<ConstructorData<BrowseResponse>>

Returns a list of browse results including filters, categories, sort options, etc.

Link copied to clipboard
suspend fun getBrowseResultsCRT(    filterName: String,     filterValue: String,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): BrowseResponse

Returns a list of browse results including filters, categories, sort options, etc. This function should be called within a coroutine scope.

Link copied to clipboard
fun getClientId(): String

Returns the current client identifier (a random GUID assigned to the app running on the device)

Link copied to clipboard
fun getQuizNextQuestion(request: QuizRequest): Observable<ConstructorData<QuizQuestionResponse>>

Returns the next quiz question including options and attributes utilizing a request object.

fun getQuizNextQuestion(    quizId: String,     answers: List<List<String>>? = null,     quizVersionId: String? = null,     quizSessionId: String? = null,     sectionName: String? = null): Observable<ConstructorData<QuizQuestionResponse>>

Returns the next quiz question including options and attributes.

Link copied to clipboard
suspend fun getQuizNextQuestionCRT(    quizId: String,     answers: List<List<String>>? = null,     quizVersionId: String? = null,     quizSessionId: String? = null,     sectionName: String? = null): QuizQuestionResponse

Return the next quiz question including options and attributes. This function should be called within a coroutine scope.

Link copied to clipboard
fun getQuizResults(request: QuizRequest): Observable<ConstructorData<QuizResultsResponse>>

Return a list of quiz results utilizing a request object.

fun getQuizResults(    quizId: String,     answers: List<List<String>>? = null,     quizVersionId: String? = null,     quizSessionId: String? = null,     sectionName: String? = null,     filters: Map<String, List<String>>? = null,     page: Int? = null,     perPage: Int? = null): Observable<ConstructorData<QuizResultsResponse>>

Return a list of quiz results.

Link copied to clipboard
suspend fun getQuizResultsCRT(    quizId: String,     answers: List<List<String>>? = null,     quizVersionId: String? = null,     quizSessionId: String? = null,     sectionName: String? = null,     filters: Map<String, List<String>>? = null,     page: Int? = null,     perPage: Int? = null): QuizResultsResponse

Return a list of quiz results. This function should be called within a coroutine scope.

Link copied to clipboard
fun getRecommendationResults(request: RecommendationsRequest): Observable<ConstructorData<RecommendationsResponse>>
fun getRecommendationResults(    podId: String,     facets: List<Pair<String, List<String>>>? = null,     numResults: Int? = null,     sectionName: String? = null,     itemId: String? = null,     term: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     hiddenFields: List<String>? = null): Observable<ConstructorData<RecommendationsResponse>>

Returns a list of recommendation results for the specified pod.

Link copied to clipboard
suspend fun getRecommendationResultsCRT(    podId: String,     facets: List<Pair<String, List<String>>>? = null,     numResults: Int? = null,     sectionName: String? = null,     itemId: String? = null,     term: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     hiddenFields: List<String>? = null): RecommendationsResponse

Returns a list of recommendation results including filters, categories, sort options, etc.

Link copied to clipboard
fun getSearchResults(request: SearchRequest): Observable<ConstructorData<SearchResponse>>

Returns a list of search results including filters, categories, sort options, etc. utilizing a request object.

fun getSearchResults(    term: String,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): Observable<ConstructorData<SearchResponse>>

Returns a list of search results including filters, categories, sort options, etc.

Link copied to clipboard
suspend fun getSearchResultsCRT(    term: String,     facets: List<Pair<String, List<String>>>? = null,     page: Int? = null,     perPage: Int? = null,     groupId: Int? = null,     sortBy: String? = null,     sortOrder: String? = null,     sectionName: String? = null,     hiddenFields: List<String>? = null,     hiddenFacets: List<String>? = null,     groupsSortBy: String? = null,     groupsSortOrder: String? = null,     variationsMap: VariationsMap? = null,     preFilterExpression: String? = null,     fmtOptions: Map<String, Any>? = null): SearchResponse

Returns a list of search results including filters, categories, sort options, etc. This function should be called within a coroutine scope.

Link copied to clipboard
fun getSessionId(): Int

Returns the current session identifier (an incrementing integer)

Link copied to clipboard
fun init(context: Context?, constructorIoConfig: ConstructorIoConfig)

Initializes the client

Link copied to clipboard
fun setClientId(clientId: String)

Sets the clientId

Link copied to clipboard
fun setSessionId(sessionId: Int)

Sets the sessionId

Link copied to clipboard
fun trackAutocompleteSelect(    searchTerm: String,     originalQuery: String,     sectionName: String,     resultGroup: ResultGroup? = null,     resultID: String? = null)

Tracks autocomplete select events.

Link copied to clipboard
fun trackBrowseResultClick(    filterName: String,     filterValue: String,     customerId: String,     resultPositionOnPage: Int,     sectionName: String? = null,     resultID: String? = null,     analyticsTags: Map<String, String>? = null)
fun trackBrowseResultClick(    filterName: String,     filterValue: String,     customerId: String,     variationId: String,     resultPositionOnPage: Int,     sectionName: String? = null,     resultID: String? = null,     analyticsTags: Map<String, String>? = null)

Tracks browse result click events.

Link copied to clipboard
fun trackBrowseResultsLoaded(    filterName: String,     filterValue: String,     resultCount: Int,     sectionName: String? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)
fun trackBrowseResultsLoaded(    filterName: String,     filterValue: String,     itemIds: Array<String>,     resultCount: Int,     sectionName: String? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)

Tracks browse result loaded (a.k.a. browse results viewed) events.

Link copied to clipboard
fun trackConversion(    itemName: String,     customerId: String,     revenue: Double?,     searchTerm: String = Constants.QueryConstants.TERM_UNKNOWN,     sectionName: String? = null,     conversionType: String? = null,     isCustomType: Boolean? = null,     displayName: String? = null,     analyticsTags: Map<String, String>? = null)
fun trackConversion(    itemName: String,     customerId: String,     variationId: String?,     revenue: Double?,     searchTerm: String = Constants.QueryConstants.TERM_UNKNOWN,     sectionName: String? = null,     conversionType: String? = null,     isCustomType: Boolean? = null,     displayName: String? = null,     analyticsTags: Map<String, String>? = null)

Tracks conversion (a.k.a add to cart) events.

Link copied to clipboard
fun trackGenericResultClick(    itemName: String,     customerId: String,     variationId: String? = null,     sectionName: String? = null,     analyticsTags: Map<String, String>? = null)

Tracks generic result click events.

Link copied to clipboard
fun trackInputFocus(term: String?)

Tracks input focus events.

Link copied to clipboard
fun trackItemDetailLoaded(    itemName: String,     customerId: String,     variationId: String? = null,     sectionName: String? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)

Tracks item result loaded events.

Link copied to clipboard
fun trackPurchase(    items: Array<PurchaseItem>,     revenue: Double?,     orderID: String,     sectionName: String? = null,     analyticsTags: Map<String, String>? = null)
fun trackPurchase(    customerIds: Array<String>,     revenue: Double?,     orderID: String,     sectionName: String? = null,     analyticsTags: Map<String, String>? = null)

Tracks purchase events.

Link copied to clipboard
fun trackQuizConversion(    quizId: String,     quizVersionId: String,     quizSessionId: String,     displayName: String? = null,     type: String? = null,     isCustomType: Boolean? = null,     customerId: String,     variationId: String? = null,     itemName: String? = null,     sectionName: String? = null,     revenue: String? = null,     analyticsTags: Map<String, String>? = null)

Tracks quiz conversion events ##Example

Link copied to clipboard
fun trackQuizResultClick(    quizId: String,     quizVersionId: String,     quizSessionId: String,     customerId: String,     variationId: String? = null,     itemName: String? = null,     sectionName: String? = null,     resultId: String? = null,     resultPositionOnPage: Int? = null,     numResultsPerPage: Int? = null,     resultPage: Int? = null,     resultCount: Int? = null,     analyticsTags: Map<String, String>? = null)

Tracks quiz result click events ##Example

Link copied to clipboard
fun trackQuizResultLoad(    quizId: String,     quizVersionId: String,     quizSessionId: String,     sectionName: String? = null,     resultId: String? = null,     resultPage: Int? = null,     resultCount: Int? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)

Tracks quiz result load events ##Example

Link copied to clipboard
fun trackRecommendationResultClick(    podId: String,     strategyId: String,     customerId: String,     variationId: String? = null,     sectionName: String? = null,     resultId: String? = null,     numResultsPerPage: Int? = null,     resultPage: Int? = null,     resultCount: Int? = null,     resultPositionOnPage: Int? = null,     analyticsTags: Map<String, String>? = null)

Tracks recommendation result click events.

Link copied to clipboard
fun trackRecommendationResultsView(    podId: String,     numResultsViewed: Int,     resultPage: Int? = null,     resultCount: Int? = null,     resultId: String? = null,     sectionName: String? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)
fun trackRecommendationResultsView(    podId: String,     itemIds: Array<String>,     numResultsViewed: Int,     resultPage: Int? = null,     resultCount: Int? = null,     resultId: String? = null,     sectionName: String? = null,     url: String = "Not Available",     analyticsTags: Map<String, String>? = null)

Tracks recommendation result view events.

Link copied to clipboard
fun trackSearchResultClick(    itemName: String,     customerId: String,     searchTerm: String = Constants.QueryConstants.TERM_UNKNOWN,     sectionName: String? = null,     resultID: String? = null)
fun trackSearchResultClick(    itemName: String,     customerId: String,     variationId: String?,     searchTerm: String = Constants.QueryConstants.TERM_UNKNOWN,     sectionName: String? = null,     resultID: String? = null)

Tracks search result click events.

Link copied to clipboard
fun trackSearchResultsLoaded(    term: String,     resultCount: Int,     customerIds: Array<String>? = null)

Tracks search results loaded (a.k.a. search results viewed) events.

Link copied to clipboard
fun trackSearchSubmit(    searchTerm: String,     originalQuery: String,     resultGroup: ResultGroup?)

Tracks search submit events.

Properties

Link copied to clipboard
var defaultAnalyticsTags: Map<String, String>?

Sets the default analytics tags param

Link copied to clipboard
var segments: List<String?>

Sets the segments param

Link copied to clipboard
var testCells: List<Pair<String, String>?>

Sets the test cells param

Link copied to clipboard
var userId: String?

Sets the logged in user identifier