@saysimple/node-sdk
Advanced tools
Comparing version
# 🚧 Changelog 🚧 | ||
## Latest | ||
**25 February 2022** | ||
- Added optional x-client-ip header to http client initiation | ||
## V0.0.14 | ||
**27 January 2022** | ||
@@ -5,0 +9,0 @@ - Added get unique conversations |
@@ -17,5 +17,5 @@ import { Method } from "axios"; | ||
headers?: { | ||
[name: string]: string; | ||
[name: string]: string | undefined; | ||
}; | ||
} | ||
export {}; |
@@ -27,2 +27,3 @@ "use strict"; | ||
var _a; | ||
var _b; | ||
if (apiToken === void 0) { apiToken = ""; } | ||
@@ -36,3 +37,3 @@ if (privateKey === void 0) { privateKey = ""; } | ||
} | ||
return new intelligence_1.Intelligence(new http_client_1.HttpClient({ baseUrl: config.baseUrl }, new saysimple_authorization_1.SaySimpleAuthorization((_a = config.authenticationUrl) !== null && _a !== void 0 ? _a : "https://api.saysimple.io/v1/auth/authenticate", apiToken, privateKey))); | ||
return new intelligence_1.Intelligence(new http_client_1.HttpClient({ baseUrl: config.baseUrl, headers: (_a = {}, _a["x-client-ip"] = config.xClientIp, _a) }, new saysimple_authorization_1.SaySimpleAuthorization((_b = config.authenticationUrl) !== null && _b !== void 0 ? _b : "https://api.saysimple.io/v1/auth/authenticate", apiToken, privateKey))); | ||
} | ||
@@ -39,0 +40,0 @@ module.exports = { |
export interface IntelligenceV1FactoryMethodConfig { | ||
baseUrl: string; | ||
authenticationUrl: string; | ||
xClientIp: string; | ||
} |
@@ -6,3 +6,3 @@ { | ||
"repository": "https://github.com/saysimple/node-sdk", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "The official SaySimple Node SDK. Want to use our awesome customer conversations platform? Please visit: https://saysimple.com", | ||
@@ -9,0 +9,0 @@ "main": "dist/index.js", |
@@ -78,3 +78,3 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, Method } from "axios"; | ||
baseUrl?: string, | ||
headers?: { [name: string]: string } | ||
headers?: { [name: string]: string | undefined } | ||
} |
@@ -20,3 +20,3 @@ import { HttpClient } from "./base/http-client"; | ||
new HttpClient( | ||
{ baseUrl: config.baseUrl }, | ||
{ baseUrl: config.baseUrl, headers: { [ "x-client-ip" ]: config.xClientIp } }, | ||
new SaySimpleAuthorization( | ||
@@ -23,0 +23,0 @@ config.authenticationUrl ?? "https://api.saysimple.io/v1/auth/authenticate", |
export interface IntelligenceV1FactoryMethodConfig { | ||
baseUrl: string, | ||
authenticationUrl: string | ||
authenticationUrl: string, | ||
xClientIp: string | ||
} |
@@ -30,3 +30,6 @@ import "jest-extended"; | ||
const expectedHttpClientConfig = { | ||
baseUrl: "https://secret-url.com/" | ||
baseUrl : "https://secret-url.com/", | ||
headers : { | ||
"x-client-ip": "192.168.1337.45", | ||
}, | ||
}; | ||
@@ -38,3 +41,4 @@ | ||
{ | ||
baseUrl: "https://secret-url.com" | ||
baseUrl : "https://secret-url.com", | ||
xClientIp : "192.168.1337.45" | ||
} | ||
@@ -59,3 +63,4 @@ ); | ||
authenticationUrl : "www.saysimple.com/auth", | ||
baseUrl : "www.saysimple.com/" | ||
baseUrl : "www.saysimple.com/", | ||
xClientIp : "192.168.1337.45", | ||
} | ||
@@ -62,0 +67,0 @@ ); |
113725
0.43%2055
0.39%