All files / src server.ts

90% Statements 9/10
50% Branches 1/2
100% Functions 1/1
90% Lines 9/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45  1x 1x                                               1x             169x 169x 169x 169x 169x     169x        
import { IProxy } from "./httpClient";
import Logger from "./logger";
const log: Logger = new Logger();
 
export interface IBasicAuth {
    "username": string;
    "password": string;
}
 
/**
 * The options of a server constructor
 */
export interface IServerOptions {
    /**
     * the url of the nextcloud server like https://nextcloud.mydomain.com
     */
    "url": string;
    /**
     * basic authentication informatin to access the nextcloud server
     */
    "basicAuth": IBasicAuth;
    "proxy"?: IProxy;
    "logRequestResponse"?: boolean;
}
 
// tslint:disable-next-line: max-classes-per-file
export default class Server {
    public url: string;
    public basicAuth: IBasicAuth;
    public proxy?: IProxy;
    public logRequestResponse: boolean;
    //    public constructor(url: string, basicAuth: IBasicAuth, proxy?: IProxy, logRequestResponse: boolean = false) {
    public constructor(options: IServerOptions) {
        log.debug("constructor");
        this.url = options.url;
        this.basicAuth = options.basicAuth;
        this.proxy = options.proxy;
        Iif (options.logRequestResponse) {
            this.logRequestResponse = true;
        } else {
            this.logRequestResponse = false;
        }
    }
}