Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Fixed doImport #91

Open
wants to merge 1 commit into
base: release/v4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions icc-api/api/IccBeresultimportApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import {XHR} from './XHR'
import {Contact} from '../model/Contact'
import {ResultInfo} from '../model/ResultInfo'
import { XHR } from './XHR'
import { Contact } from '../model/Contact'
import { ResultInfo } from '../model/ResultInfo'

export class IccBeresultimportApi {
host: string
Expand All @@ -20,7 +20,7 @@ export class IccBeresultimportApi {

constructor(host: string, headers: any, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>) {
this.host = host
this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))
this.headers = Object.keys(headers).map(k => new XHR.Header(k, headers[k]))
this.fetchImpl = fetchImpl
}

Expand Down Expand Up @@ -49,8 +49,8 @@ export class IccBeresultimportApi {
(enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '')
let headers = this.headers
return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl)
.then((doc) => JSON.parse(JSON.stringify(doc.body)))
.catch((err) => this.handleError(err))
.then(doc => JSON.parse(JSON.stringify(doc.body)))
.catch(err => this.handleError(err))
}

/**
Expand All @@ -75,7 +75,7 @@ export class IccBeresultimportApi {
enckeys: string,
ctc: Contact
): Promise<Contact> {
let _body = null
let _body = ctc

const _url =
this.host +
Expand All @@ -87,12 +87,11 @@ export class IccBeresultimportApi {
(protocolIds ? '&protocolIds=' + encodeURIComponent(String(protocolIds)) : '') +
(formIds ? '&formIds=' + encodeURIComponent(String(formIds)) : '') +
(planOfActionId ? '&planOfActionId=' + encodeURIComponent(String(planOfActionId)) : '') +
(enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '') +
(ctc ? '&ctc=' + encodeURIComponent(String(ctc)) : '')
(enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '')
let headers = this.headers
return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)
.then((doc) => new Contact(doc.body as JSON))
.catch((err) => this.handleError(err))
.then(doc => new Contact(doc.body as JSON))
.catch(err => this.handleError(err))
}

/**
Expand All @@ -116,7 +115,7 @@ export class IccBeresultimportApi {
(full ? '&full=' + encodeURIComponent(String(full)) : '')
let headers = this.headers
return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl)
.then((doc) => (doc.body as Array<JSON>).map((it) => new ResultInfo(it)))
.catch((err) => this.handleError(err))
.then(doc => (doc.body as Array<JSON>).map(it => new ResultInfo(it)))
.catch(err => this.handleError(err))
}
}