|
1 | | -import Constants from "./Constants"; |
| 1 | +import { ApiAiConstants } from "./ApiAiConstants"; |
2 | 2 | import { ApiAiClientConfigurationError } from "./Errors"; |
3 | 3 | import { EventRequest } from "./Request/EventRequest"; |
4 | 4 | import TextRequest from "./Request/TextRequest"; |
5 | 5 | import { TTSRequest } from "./Request/TTSRequest"; |
6 | 6 | export * from "./Interfaces"; |
| 7 | +export { ApiAiConstants } from "./ApiAiConstants"; |
7 | 8 | export class ApiAiClient { |
8 | 9 | constructor(options) { |
9 | 10 | if (!options || !options.accessToken) { |
10 | 11 | throw new ApiAiClientConfigurationError("Access token is required for new ApiAi.Client instance"); |
11 | 12 | } |
12 | 13 | this.accessToken = options.accessToken; |
13 | | - this.apiLang = options.lang || Constants.DEFAULT_CLIENT_LANG; |
14 | | - this.apiVersion = options.version || Constants.DEFAULT_API_VERSION; |
15 | | - this.apiBaseUrl = options.baseUrl || Constants.DEFAULT_BASE_URL; |
| 14 | + this.apiLang = options.lang || ApiAiConstants.DEFAULT_CLIENT_LANG; |
| 15 | + this.apiVersion = options.version || ApiAiConstants.DEFAULT_API_VERSION; |
| 16 | + this.apiBaseUrl = options.baseUrl || ApiAiConstants.DEFAULT_BASE_URL; |
16 | 17 | this.sessionId = options.sessionId || this.guid(); |
17 | 18 | this.streamClientClass = options.streamClientClass || null; |
18 | 19 | } |
@@ -54,13 +55,13 @@ export class ApiAiClient { |
54 | 55 | return this.accessToken; |
55 | 56 | } |
56 | 57 | getApiVersion() { |
57 | | - return (this.apiVersion) ? this.apiVersion : Constants.DEFAULT_API_VERSION; |
| 58 | + return (this.apiVersion) ? this.apiVersion : ApiAiConstants.DEFAULT_API_VERSION; |
58 | 59 | } |
59 | 60 | getApiLang() { |
60 | | - return (this.apiLang) ? this.apiLang : Constants.DEFAULT_CLIENT_LANG; |
| 61 | + return (this.apiLang) ? this.apiLang : ApiAiConstants.DEFAULT_CLIENT_LANG; |
61 | 62 | } |
62 | 63 | getApiBaseUrl() { |
63 | | - return (this.apiBaseUrl) ? this.apiBaseUrl : Constants.DEFAULT_BASE_URL; |
| 64 | + return (this.apiBaseUrl) ? this.apiBaseUrl : ApiAiConstants.DEFAULT_BASE_URL; |
64 | 65 | } |
65 | 66 | setSessionId(sessionId) { |
66 | 67 | this.sessionId = sessionId; |
|
0 commit comments