/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * 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 msRest = require('ms-rest');
const ServiceClient = msRest.ServiceClient;

const models = require('./models');
const operations = require('./operations');


/** Class representing a ImageSearchClient. */
class ImageSearchClient extends ServiceClient {
  /**
   * Create a ImageSearchClient.
   * @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
   * @param {object} [options] - The parameter options
   * @param {Array} [options.filters] - Filters to be added to the request pipeline
   * @param {object} [options.requestOptions] - Options for the underlying request object
   * {@link https://github.com/request/request#requestoptions-callback Options doc}
   * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
   * @param {string} [options.endpoint] - Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
   */
  constructor(credentials, options) {
    if (credentials === null || credentials === undefined) {
      throw new Error('\'credentials\' cannot be null.');
    }

    if (!options) options = {};

    super(credentials, options);

    this.endpoint = 'https://api.cognitive.microsoft.com';
    this.baseUri = '{Endpoint}/bing/v7.0';
    this.credentials = credentials;

    let packageInfo = this.getPackageJsonInfo(__dirname);
    this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
    if(options.endpoint !== null && options.endpoint !== undefined) {
      this.endpoint = options.endpoint;
    }
    this.imagesOperations = new operations.ImagesOperations(this);
    this.models = models;
    msRest.addSerializationMixin(this);
  }

}

module.exports = ImageSearchClient;
module.exports['default'] = ImageSearchClient;
module.exports.ImageSearchClient = ImageSearchClient;
module.exports.ImageSearchModels = models;
