-
Notifications
You must be signed in to change notification settings - Fork 2
/
ArbeidsforholdClient.kt
31 lines (26 loc) · 1.22 KB
/
ArbeidsforholdClient.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package no.nav.familie.ef.sak.arbeidsforhold.ekstern
import no.nav.familie.http.client.AbstractRestClient
import no.nav.familie.kontrakter.felles.Ressurs
import no.nav.familie.kontrakter.felles.arbeidsforhold.Arbeidsforhold
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
import org.springframework.web.client.RestOperations
import org.springframework.web.util.UriComponentsBuilder
import java.net.URI
import java.time.LocalDate
@Component
class ArbeidsforholdClient(
@Value("\${FAMILIE_INTEGRASJONER_URL}") private val uri: URI,
@Qualifier("azure") restOperations: RestOperations,
) : AbstractRestClient(restOperations, "arbeidsforhold") {
private fun lagArbeidsforholdUri() =
UriComponentsBuilder.fromUri(uri).pathSegment("api/aareg/arbeidsforhold").build().toUri()
fun hentArbeidsforhold(personIdent: String, ansettelsesperiodeFom: LocalDate): Ressurs<List<Arbeidsforhold>> {
return postForEntity(lagArbeidsforholdUri(), ArbeidsforholdRequest(personIdent, ansettelsesperiodeFom))
}
}
class ArbeidsforholdRequest(
val personIdent: String,
val ansettelsesperiodeFom: LocalDate,
)