Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Helper function to create client objects
const debug = require("debug")("appcenter-cli:util:apis:create-client");
import { inspect } from "util";
import { IncomingMessage } from "http";
import { AppCenterClient } from "./generated/appCenterClient";
import { AppCenterClientCredentials } from "./appcenter-client-credentials";
import { userAgentFilter } from "./user-agent-filter";
import { telemetryFilter } from "./telemetry-filter";
const BasicAuthenticationCredentials = require("ms-rest").BasicAuthenticationCredentials;
import { ServiceCallback, ServiceError, WebResource } from "ms-rest";
const createLogger = require("ms-rest").LogFilter.create;
import { isDebug } from "../interaction";
import { Profile } from "../profile";
import { failure, ErrorCodes } from "../../util/commandline/command-result";
export interface AppCenterClientFactory {
fromUserNameAndPassword(userName: string, password: string, endpoint: string): AppCenterClient;
fromToken(token: string | Promise | {(): Promise}, endpoint: string): AppCenterClient;
fromProfile(user: Profile): AppCenterClient;
}
export function createAppCenterClient(command: string[], telemetryEnabled: boolean): AppCenterClientFactory {
function createClientOptions(): any {
debug(`Creating client options, isDebug = ${isDebug()}`);
const filters = [userAgentFilter, telemetryFilter(command.join(" "), telemetryEnabled)];
return {