/*
 * 
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 *
 * Swagger Codegen version: 2.4.18
 *
 * Do not edit the class manually.
 *
 */

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient', 'model/LoginReq', 'model/RegisterReq', 'model/UserInfoReply', 'model/UserInfoReq', 'model/UserSearchReply', 'model/UserSearchReq'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'), require('../model/LoginReq'), require('../model/RegisterReq'), require('../model/UserInfoReply'), require('../model/UserInfoReq'), require('../model/UserSearchReply'), require('../model/UserSearchReq'));
  } else {
    // Browser globals (root is window)
    if (!root.SwaggerJsClient) {
      root.SwaggerJsClient = {};
    }
    root.SwaggerJsClient.UserApiApi = factory(root.SwaggerJsClient.ApiClient, root.SwaggerJsClient.LoginReq, root.SwaggerJsClient.RegisterReq, root.SwaggerJsClient.UserInfoReply, root.SwaggerJsClient.UserInfoReq, root.SwaggerJsClient.UserSearchReply, root.SwaggerJsClient.UserSearchReq);
  }
}(this, function(ApiClient, LoginReq, RegisterReq, UserInfoReply, UserInfoReq, UserSearchReply, UserSearchReq) {
  'use strict';

  /**
   * UserApi service.
   * @module api/UserApiApi
   * @version 1.0.0
   */

  /**
   * Constructs a new UserApiApi. 
   * @alias module:api/UserApiApi
   * @class
   * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
   * default to {@link module:ApiClient#instance} if unspecified.
   */
  var exports = function(apiClient) {
    this.apiClient = apiClient || ApiClient.instance;


    /**
     * Callback function to receive the result of the getUserInfo operation.
     * @callback module:api/UserApiApi~getUserInfoCallback
     * @param {String} error Error message, if any.
     * @param {module:model/UserInfoReply} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * 获取用户信息
     * @param {String} id 
     * @param {module:model/UserInfoReq} body 
     * @param {module:api/UserApiApi~getUserInfoCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:model/UserInfoReply}
     */
    this.getUserInfo = function(id, body, callback) {
      var postBody = body;

      // verify the required parameter 'id' is set
      if (id === undefined || id === null) {
        throw new Error("Missing the required parameter 'id' when calling getUserInfo");
      }

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling getUserInfo");
      }


      var pathParams = {
        'id': id
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = UserInfoReply;

      return this.apiClient.callApi(
        '/api/user/{id}', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }

    /**
     * Callback function to receive the result of the login operation.
     * @callback module:api/UserApiApi~loginCallback
     * @param {String} error Error message, if any.
     * @param {Object} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * 登录
     * @param {module:model/LoginReq} body 
     * @param {module:api/UserApiApi~loginCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Object}
     */
    this.login = function(body, callback) {
      var postBody = body;

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling login");
      }


      var pathParams = {
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = Object;

      return this.apiClient.callApi(
        '/api/user/login', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }

    /**
     * Callback function to receive the result of the register operation.
     * @callback module:api/UserApiApi~registerCallback
     * @param {String} error Error message, if any.
     * @param {Object} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * 注册
     * 注册一个用户
     * @param {module:model/RegisterReq} body 
     * @param {module:api/UserApiApi~registerCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Object}
     */
    this.register = function(body, callback) {
      var postBody = body;

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling register");
      }


      var pathParams = {
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = Object;

      return this.apiClient.callApi(
        '/api/user/register', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }

    /**
     * Callback function to receive the result of the searchUser operation.
     * @callback module:api/UserApiApi~searchUserCallback
     * @param {String} error Error message, if any.
     * @param {module:model/UserSearchReply} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * 用户搜索
     * @param {module:model/UserSearchReq} body 
     * @param {module:api/UserApiApi~searchUserCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:model/UserSearchReply}
     */
    this.searchUser = function(body, callback) {
      var postBody = body;

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling searchUser");
      }


      var pathParams = {
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = UserSearchReply;

      return this.apiClient.callApi(
        '/api/user/search', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }
  };

  return exports;
}));
