/*
 * Code generated by Microsoft (R) SwaggerTools.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */

'use strict';

const AppCenterClientCredentials = require('./appCenterClientCredentials');
const Account = require('./account/accountClient');
const Codepush = require('./codepush/codepushClient');
const Analytics = require('./analytics/analyticsClient');
const Distribute = require('./distribute/distributeClient');
const Build = require('./build/buildClient');
const Crash = require('./crash/crashClient');
const Test = require('./test/testClient');
const Export = require('./export/exportClient');
const Push = require('./push/pushClient');


class AppCenterClient {
    constructor(credentials, baseUrl = null, options = {}) {
        let credentialsObject;
        if (typeof(credentials) === 'string') {
            credentialsObject = new AppCenterClientCredentials(credentials);
        } else if (credentials instanceof AppCenterClientCredentials) {
            credentialsObject = credentials;
        } else {
            throw new Error('Credentials is not a token or credentials object');
        }
        
        this.account = new Account(credentialsObject, baseUrl, options);
        
        this.codepush = new Codepush(credentialsObject, baseUrl, options);
        
        this.analytics = new Analytics(credentialsObject, baseUrl, options);
        
        this.distribute = new Distribute(credentialsObject, baseUrl, options);
        
        this.build = new Build(credentialsObject, baseUrl, options);
        
        this.crash = new Crash(credentialsObject, baseUrl, options);
        
        this.test = new Test(credentialsObject, baseUrl, options);
        
        this.export = new Export(credentialsObject, baseUrl, options);
        
        this.push = new Push(credentialsObject, baseUrl, options);
        
    }
}

module.exports = AppCenterClient;