import * as MsClient from "cn.keytop.midend.microservice.Client"; 

/**
 * 使用示例：
 * import * as userAdminMsClient from 'stc.ms.UserAdmin'
 * 
 * const userAdminMsClient = new userAdminMsClient.UserAdmin()
 *  userAdminMsClient.fun1('aaa','bbb','ccc')
 * .catch(error => {console.log(error)})
 * .then(value => {console.log(value)})
 *
 *
 * @author 微服务平台自动生成
 * @desc [演示-用户基本信息管理]接口定义
 * @date 2020-03-28 18:14:14
 **/
export class UserAdmin {
  private pid: string = 'stc.ms.UserAdmin';
  private version: string = '1.0';
  private authType: MsClient.AuthType = MsClient.AuthType.BASE;
  private serviceClient: MsClient.ServiceClient;

  constructor(serviceClientConfig:MsClient.ServiceClientConfig = new MsClient.ServiceClientConfig() ) {
     this.serviceClient = new MsClient.ServiceClientImpl(serviceClientConfig)
   }

  async get(id: string): Promise<Get$Models.ApiResult> {
      let sid = `${this.pid}.get` 
      let tags = '' 
      let header = {'uri':'user/get' , 'pid':`${this.pid}`} 
      let paramMap = {} 
      paramMap = { 'id': id      } 
      let response = await this.serviceClient.get(sid, this.version, tags, header, paramMap, this.authType) 
      if(!response){
          return response;
      }else{
    return  new Get$Models.ApiResult(response);
  }
  }

  async add(addUserInfo: Add$Models.AddUserInfo): Promise<Add$Models.ApiResult> {
      let sid = `${this.pid}.add` 
      let tags = '' 
      let header = {'uri':'user/add' , 'pid':`${this.pid}`} 
      let paramMap = {} 
      let bodyObj = addUserInfo
      let response = await this.serviceClient.call(MsClient.HttpMethodType.POST,sid, this.version, tags, header, paramMap, bodyObj, this.authType,MsClient.RequestBodyType.RAW_JSON) 
      if(!response){
          return response;
      }else{
    return  new Add$Models.ApiResult(response);
  }
  }

  async update(userInfo: Update$Models.UserInfo): Promise<Update$Models.ApiResult> {
      let sid = `${this.pid}.update` 
      let tags = '' 
      let header = {'uri':'user/update' , 'pid':`${this.pid}`} 
      let paramMap = {} 
      let bodyObj = userInfo
      let response = await this.serviceClient.call(MsClient.HttpMethodType.POST,sid, this.version, tags, header, paramMap, bodyObj, this.authType,MsClient.RequestBodyType.RAW_JSON) 
      if(!response){
          return response;
      }else{
    return  new Update$Models.ApiResult(response);
  }
  }

  async delete(id: string): Promise<Delete$Models.ApiResult> {
      let sid = `${this.pid}.delete` 
      let tags = '' 
      let header = {'uri':'user/delete' , 'pid':`${this.pid}`} 
      let paramMap = {} 
      paramMap = { 'id': id      } 
      let response = await this.serviceClient.call(MsClient.HttpMethodType.POST,sid, this.version, tags, header, paramMap, {}, this.authType,MsClient.RequestBodyType.WWW_FORM) 
      if(!response){
          return response;
      }else{
    return  new Delete$Models.ApiResult(response);
  }
  }

}

export namespace Get$Models { 
   export class Map {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class UserInfo {
       private _ms_response_data$$$; 
       private _extattr:Map; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 
           this._extattr = new Map(value.extattr); 

       } 
        get id(): string {
           return this._ms_response_data$$$.id;
        }
        set id(value:string) {
           this._ms_response_data$$$.id = value 
        }
        get name(): string {
           return this._ms_response_data$$$.name;
        }
        set name(value:string) {
           this._ms_response_data$$$.name = value 
        }
        get alias(): string {
           return this._ms_response_data$$$.alias;
        }
        set alias(value:string) {
           this._ms_response_data$$$.alias = value 
        }
        get email(): string {
           return this._ms_response_data$$$.email;
        }
        set email(value:string) {
           this._ms_response_data$$$.email = value 
        }
        get mobile(): string {
           return this._ms_response_data$$$.mobile;
        }
        set mobile(value:string) {
           this._ms_response_data$$$.mobile = value 
        }
        get avatar(): string {
           return this._ms_response_data$$$.avatar;
        }
        set avatar(value:string) {
           this._ms_response_data$$$.avatar = value 
        }
        get extattr(): Map {
           return this._extattr;
        }
        set extattr(value:Map) {
           this._extattr = value 
        }
        get entryTime(): Date  | undefined {
            if(this._ms_response_data$$$.entryTime){
               return new Date(this._ms_response_data$$$.entryTime);
            }else{
               return undefined
            }
        }
        set entryTime(value:Date | undefined) {
           if(value){ 
               this._ms_response_data$$$.entryTime = value.getTime() 
           }
        }

   }

   export class ApiResult$Companion {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult {
       private _ms_response_data$$$; 
       private _data:UserInfo; 
       private _companion:ApiResult$Companion; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 
           this._data = new UserInfo(value.data); 
           this._companion = new ApiResult$Companion(value.Companion); 

       } 
        get data(): UserInfo {
           return this._data;
        }
        set data(value:UserInfo) {
           this._data = value 
        }
        get code(): string {
           return this._ms_response_data$$$.code;
        }
        set code(value:string) {
           this._ms_response_data$$$.code = value 
        }
        get message(): string {
           return this._ms_response_data$$$.message;
        }
        set message(value:string) {
           this._ms_response_data$$$.message = value 
        }
        get SUCCESS_CODE(): string {
           return this._ms_response_data$$$.SUCCESS_CODE;
        }
        set SUCCESS_CODE(value:string) {
           this._ms_response_data$$$.SUCCESS_CODE = value 
        }
        get FAIL_CODE(): string {
           return this._ms_response_data$$$.FAIL_CODE;
        }
        set FAIL_CODE(value:string) {
           this._ms_response_data$$$.FAIL_CODE = value 
        }
        get Companion(): ApiResult$Companion {
           return this._companion;
        }
        set Companion(value:ApiResult$Companion) {
           this._companion = value 
        }

   }

}

export namespace Add$Models { 
   export class Map {

   }

   export class AddUserInfo {
        name?: string
        alias?: string
        email?: string
        mobile?: string
        avatar?: string
        extattr?: Map
        entryTime?: number

   }

   export class ApiResult$Companion {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult {
       private _ms_response_data$$$; 
       private _companion:ApiResult$Companion; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 
           this._companion = new ApiResult$Companion(value.Companion); 

       } 
        get data(): string {
           return this._ms_response_data$$$.data;
        }
        set data(value:string) {
           this._ms_response_data$$$.data = value 
        }
        get code(): string {
           return this._ms_response_data$$$.code;
        }
        set code(value:string) {
           this._ms_response_data$$$.code = value 
        }
        get message(): string {
           return this._ms_response_data$$$.message;
        }
        set message(value:string) {
           this._ms_response_data$$$.message = value 
        }
        get SUCCESS_CODE(): string {
           return this._ms_response_data$$$.SUCCESS_CODE;
        }
        set SUCCESS_CODE(value:string) {
           this._ms_response_data$$$.SUCCESS_CODE = value 
        }
        get FAIL_CODE(): string {
           return this._ms_response_data$$$.FAIL_CODE;
        }
        set FAIL_CODE(value:string) {
           this._ms_response_data$$$.FAIL_CODE = value 
        }
        get Companion(): ApiResult$Companion {
           return this._companion;
        }
        set Companion(value:ApiResult$Companion) {
           this._companion = value 
        }

   }

}

export namespace Update$Models { 
   export class Map {

   }

   export class UserInfo {
        id?: string
        name?: string
        alias?: string
        email?: string
        mobile?: string
        avatar?: string
        extattr?: Map
        entryTime?: number

   }

   export class Object {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult$Companion {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult {
       private _ms_response_data$$$; 
       private _data:Object; 
       private _companion:ApiResult$Companion; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 
           this._data = new Object(value.data); 
           this._companion = new ApiResult$Companion(value.Companion); 

       } 
        get data(): Object {
           return this._data;
        }
        set data(value:Object) {
           this._data = value 
        }
        get code(): string {
           return this._ms_response_data$$$.code;
        }
        set code(value:string) {
           this._ms_response_data$$$.code = value 
        }
        get message(): string {
           return this._ms_response_data$$$.message;
        }
        set message(value:string) {
           this._ms_response_data$$$.message = value 
        }
        get SUCCESS_CODE(): string {
           return this._ms_response_data$$$.SUCCESS_CODE;
        }
        set SUCCESS_CODE(value:string) {
           this._ms_response_data$$$.SUCCESS_CODE = value 
        }
        get FAIL_CODE(): string {
           return this._ms_response_data$$$.FAIL_CODE;
        }
        set FAIL_CODE(value:string) {
           this._ms_response_data$$$.FAIL_CODE = value 
        }
        get Companion(): ApiResult$Companion {
           return this._companion;
        }
        set Companion(value:ApiResult$Companion) {
           this._companion = value 
        }

   }

}

export namespace Delete$Models { 
   export class Object {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult$Companion {
       private _ms_response_data$$$; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 

       } 

   }

   export class ApiResult {
       private _ms_response_data$$$; 
       private _data:Object; 
       private _companion:ApiResult$Companion; 

       constructor(value){ 
           this._ms_response_data$$$ = value; 
           this._data = new Object(value.data); 
           this._companion = new ApiResult$Companion(value.Companion); 

       } 
        get data(): Object {
           return this._data;
        }
        set data(value:Object) {
           this._data = value 
        }
        get code(): string {
           return this._ms_response_data$$$.code;
        }
        set code(value:string) {
           this._ms_response_data$$$.code = value 
        }
        get message(): string {
           return this._ms_response_data$$$.message;
        }
        set message(value:string) {
           this._ms_response_data$$$.message = value 
        }
        get SUCCESS_CODE(): string {
           return this._ms_response_data$$$.SUCCESS_CODE;
        }
        set SUCCESS_CODE(value:string) {
           this._ms_response_data$$$.SUCCESS_CODE = value 
        }
        get FAIL_CODE(): string {
           return this._ms_response_data$$$.FAIL_CODE;
        }
        set FAIL_CODE(value:string) {
           this._ms_response_data$$$.FAIL_CODE = value 
        }
        get Companion(): ApiResult$Companion {
           return this._companion;
        }
        set Companion(value:ApiResult$Companion) {
           this._companion = value 
        }

   }

}

