intercom-client
Version:
Official Node bindings to the Intercom API
28 lines (27 loc) • 1.51 kB
JavaScript
// This file was auto-generated by Fern from our API Definition.
import { BearerAuthProvider } from "./auth/BearerAuthProvider.mjs";
import { mergeHeaders } from "./core/headers.mjs";
import * as core from "./core/index.mjs";
export function normalizeClientOptions(options) {
var _a;
const headers = mergeHeaders({
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "intercom-client",
"X-Fern-SDK-Version": "7.0.3",
"User-Agent": "intercom-client/7.0.3",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
"Intercom-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2.14",
}, options === null || options === void 0 ? void 0 : options.headers);
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
}
export function normalizeClientOptionsWithAuth(options) {
var _a;
const normalized = normalizeClientOptions(options);
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider(normalizedWithNoOpAuthProvider));
return normalized;
}
function withNoOpAuthProvider(options) {
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
}