@attraqt/search
Advanced tools
Comparing version 1.5.1-alpha.0 to 1.5.1-alpha.1
@@ -12,2 +12,3 @@ import { HttpClient } from '@attraqt/http-client-common'; | ||
private token; | ||
private region; | ||
init(options: SearchInitOptions, httpClient?: HttpClient): void; | ||
@@ -18,5 +19,12 @@ query(query: string, options?: SearchOptions, requestOptions?: SearchRequestOptions): Promise<SearchResponse>; | ||
private assertIsInit; | ||
private configureRegion; | ||
} | ||
export declare enum Region { | ||
EU = "eu", | ||
AU = "au", | ||
US = "us" | ||
} | ||
export interface SearchInitOptions { | ||
token: string; | ||
region?: Region; | ||
} | ||
@@ -23,0 +31,0 @@ export interface InitOptions { |
@@ -71,2 +71,3 @@ "use strict"; | ||
this.httpClient = httpClient; | ||
this.region = this.configureRegion(options); | ||
this.isInitialized = true; | ||
@@ -102,3 +103,3 @@ }; | ||
case 0: | ||
request = __assign({ method: http_client_common_1.Method.Post, headers: { 'Content-Type': 'application/json' }, url: "https://api-eu.attraqt.io" + path, body: JSON.stringify({ | ||
request = __assign({ method: http_client_common_1.Method.Post, headers: { 'Content-Type': 'application/json' }, url: "https://api-" + this.region + ".attraqt.io" + path, body: JSON.stringify({ | ||
query: query, | ||
@@ -127,5 +128,17 @@ token: this.token, | ||
}; | ||
Search.prototype.configureRegion = function (_a) { | ||
var region = _a.region; | ||
return Object.values(Region).includes(region === null || region === void 0 ? void 0 : region.toLowerCase()) | ||
? region.toLowerCase() | ||
: Region.EU; | ||
}; | ||
return Search; | ||
}()); | ||
exports.Search = Search; | ||
var Region; | ||
(function (Region) { | ||
Region["EU"] = "eu"; | ||
Region["AU"] = "au"; | ||
Region["US"] = "us"; | ||
})(Region = exports.Region || (exports.Region = {})); | ||
//# sourceMappingURL=search.js.map |
{ | ||
"name": "@attraqt/search", | ||
"version": "1.5.1-alpha.0", | ||
"version": "1.5.1-alpha.1", | ||
"license": "MIT", | ||
@@ -32,5 +32,5 @@ "repository": "git://github.com:Attraqt/attraqt-js.git", | ||
"dependencies": { | ||
"@attraqt/http-client-browser": "^1.5.1-alpha.0", | ||
"@attraqt/http-client-common": "^1.5.1-alpha.0", | ||
"@attraqt/http-client-node": "^1.5.1-alpha.0", | ||
"@attraqt/http-client-browser": "^1.5.1-alpha.1", | ||
"@attraqt/http-client-common": "^1.5.1-alpha.1", | ||
"@attraqt/http-client-node": "^1.5.1-alpha.1", | ||
"@attraqt/search-commons": "^1.6.0" | ||
@@ -46,3 +46,3 @@ }, | ||
}, | ||
"gitHead": "b711a16d7062d62056f35da6ba2e157c88672016" | ||
"gitHead": "07f5bf7614713b3bb4fb802876739ceb94bff487" | ||
} |
@@ -48,2 +48,11 @@ # @attraqt/search | ||
## Search Init Options | ||
Properties to initialize the search component. | ||
| Option | Type | Description | | ||
| ------------ | --------------------- | -------------------------------------------------------------------------------------------------------------------- | | ||
| `token` | `string` | Required: Your unique token provided by Attraqt | | ||
| `region`? | [`Region`](#regions) | Optional: Region where you need to use the service. If an invalid or no region is selected then EU will be used. | | ||
## Search options | ||
@@ -73,1 +82,11 @@ | ||
| `groupBy` | `GroupOptions` | Group result by an attribute and its specified values | | ||
### Regions | ||
The following table lists the name and code of each Region. | ||
| Region name | Code | | ||
| ------------- | ----- | | ||
| Australia | AU | | ||
| Europe | EU | | ||
| United States | US | |
Sorry, the diff of this file is not supported yet
104022
1170
91