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

Commit

Permalink
Ad icapacity dtos + extra token request api
Browse files Browse the repository at this point in the history
  • Loading branch information
aduchate committed Apr 29, 2022
1 parent 5ef6937 commit 874e1f8
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 27 deletions.
10 changes: 8 additions & 2 deletions icc-api/api/IccContactApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,17 @@ export class IccContactApi {
* Returns the list of services linked to the provided health element id
* @summary List services linked to a health element
* @param healthElementId
* @param hcPartyId hcPartyId
*/
listServicesByHealthElementId(healthElementId: string): Promise<Array<Service>> {
listServicesByHealthElementId(healthElementId: string, hcPartyId: string): Promise<Array<Service>> {
let _body = null

const _url = this.host + `/contact/service/healthElementId/${encodeURIComponent(String(healthElementId))}` + '?ts=' + new Date().getTime()
const _url =
this.host +
`/contact/service/healthElementId/${encodeURIComponent(String(healthElementId))}` +
'?ts=' +
new Date().getTime() +
(hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '')
let headers = this.headers
return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl)
.then((doc) => (doc.body as Array<JSON>).map((it) => new Service(it)))
Expand Down
44 changes: 25 additions & 19 deletions icc-api/api/IccUserApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import { XHR } from './XHR'
import { AbstractFilterUser } from '../model/AbstractFilterUser'
import { DocIdentifier } from '../model/DocIdentifier'
import { EmailTemplate } from '../model/EmailTemplate'
import { FilterChainUser } from '../model/FilterChainUser'
import { PaginatedListUser } from '../model/PaginatedListUser'
import { PropertyStub } from '../model/PropertyStub'
import { TokenWithGroup } from '../model/TokenWithGroup'
import { Unit } from '../model/Unit'
import { User } from '../model/User'
import { UserGroup } from '../model/UserGroup'
Expand Down Expand Up @@ -234,24 +234,6 @@ export class IccUserApi {
.catch((err) => this.handleError(err))
}

/**
*
* @summary Send a forgotten email message to an user
* @param body
* @param email the email of the user
*/
forgottenPassword(email: string, body?: EmailTemplate): Promise<boolean> {
let _body = null
_body = body

const _url = this.host + `/user/forgottenPassword/${encodeURIComponent(String(email))}` + '?ts=' + new Date().getTime()
let headers = this.headers
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))
return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)
.then((doc) => JSON.parse(JSON.stringify(doc.body)))
.catch((err) => this.handleError(err))
}

/**
* Get current user.
* @summary Get Currently logged-in user session.
Expand Down Expand Up @@ -318,6 +300,30 @@ export class IccUserApi {
.catch((err) => this.handleError(err))
}

/**
*
* @summary Require a new temporary token for authentication inside all groups
* @param userIdentifier
* @param key The token key. Only one instance of a token with a defined key can exist at the same time
* @param token
* @param tokenValidity The token validity in seconds
*/
getTokenInAllGroups(userIdentifier: string, key: string, token?: string, tokenValidity?: number): Promise<Array<TokenWithGroup>> {
let _body = null

const _url =
this.host +
`/user/inAllGroups/token/${encodeURIComponent(String(userIdentifier))}/${encodeURIComponent(String(key))}` +
'?ts=' +
new Date().getTime() +
(tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')
let headers = this.headers
token && (headers = headers.concat(new XHR.Header('token', token)))
return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)
.then((doc) => (doc.body as Array<JSON>).map((it) => new TokenWithGroup(it)))
.catch((err) => this.handleError(err))
}

/**
*
* @summary Require a new temporary token for authentication inside provided group
Expand Down
52 changes: 52 additions & 0 deletions icc-api/model/IncapacityExportInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* iCure Data Stack API Documentation
* The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Address } from './Address'
import { HealthcareParty } from './HealthcareParty'
import { Service } from './Service'

export class IncapacityExportInfo {
constructor(json: JSON | any) {
Object.assign(this as IncapacityExportInfo, json)
}

recipient?: HealthcareParty
comment?: string
incapacityId?: string
notificationDate?: number
retraction?: boolean
dataset?: string
transactionType?: string
incapacityreason?: string
beginmoment?: number
endmoment?: number
outofhomeallowed?: boolean
incapWork?: boolean
incapSchool?: boolean
incapSwim?: boolean
incapSchoolsports?: boolean
incapHeavyphysicalactivity?: boolean
diagnoseServices?: Array<Service>
jobstatus?: string
job?: string
occupationalDiseaseDeclDate?: number
accidentDate?: number
expectedbirthgivingDate?: number
maternityleaveBegin?: number
maternityleaveEnd?: number
hospitalisationBegin?: number
hospitalisationEnd?: number
hospital?: HealthcareParty
contactPersonTel?: string
recoveryAddress?: Address
foreignStayBegin?: number
foreignStayEnd?: number
}
21 changes: 21 additions & 0 deletions icc-api/model/TokenWithGroup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* iCure Data Stack API Documentation
* The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

export class TokenWithGroup {
constructor(json: JSON | any) {
Object.assign(this as TokenWithGroup, json)
}

token?: string
groupId?: string
groupName?: string
}
3 changes: 2 additions & 1 deletion icc-api/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export * from './EIDItem'
export * from './Editor'
export * from './EfactInvoice'
export * from './EmailOrSmsMessage'
export * from './EmailTemplate'
export * from './Employer'
export * from './EmploymentInfo'
export * from './EntityReference'
Expand Down Expand Up @@ -106,6 +105,7 @@ export * from './Identifier'
export * from './IdentityDocumentReader'
export * from './ImportMapping'
export * from './ImportResult'
export * from './IncapacityExportInfo'
export * from './IndexedIdentifier'
export * from './IndexingInfo'
export * from './Ingredient'
Expand Down Expand Up @@ -234,6 +234,7 @@ export * from './TimeSeries'
export * from './TimeTable'
export * from './TimeTableHour'
export * from './TimeTableItem'
export * from './TokenWithGroup'
export * from './TypedValueObject'
export * from './Unit'
export * from './User'
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2989,11 +2989,6 @@ fast-diff@^1.1.2:
resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==

fast-equals@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/fast-equals/-/fast-equals-3.0.1.tgz#1e1ae440c04a32478faf698527315cdcf3ee7db2"
integrity sha512-J9FxqqC9E/ja0C+SYhoG3Jl6pQuhP92HNcVC75xDEhB+GUzPnjEp3vMfPIxPprYZFfXS5hpVvvPCWUMiDSMS8Q==

fast-glob@^3.1.1:
version "3.2.5"
resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz"
Expand Down

0 comments on commit 874e1f8

Please sign in to comment.