Add new models and page for motions

This commit is contained in:
2025-12-27 16:51:57 +01:00
parent 3ef975ad39
commit 45fe15eef2
36 changed files with 3753 additions and 355 deletions

View File

@@ -22,7 +22,7 @@ class RiksdagenService
string $lastName = '',
string $party = ''
): JsonResponse {
$response = $this->http->get('personlista/', [
$response = $this->http->get('personlista/', [
'query' => [
'iid' => $mp_id,
'parti' => $party,
@@ -30,8 +30,8 @@ class RiksdagenService
'enamn' => $lastName,
'utformat' => 'json',
'sort' => 'sorteringsnamn',
'sortorder' => 'asc'
]
'sortorder' => 'asc',
],
])->getBody()->getContents();
$data = json_decode($response);
@@ -44,14 +44,92 @@ class RiksdagenService
string $party = '',
string $date = '',
): JsonResponse {
$response = $this->http->get('voteringlista/', [
$response = $this->http->get('voteringlista/', [
'query' => [
'iid' => $mp_id,
'rm' => $date,
'parti' => $party,
'utformat' => 'json',
'sz' => '500',
]
'sz' => '3000',
],
])->getBody()->getContents();
$data = json_decode($response);
return response()->json($data);
}
public function getPersonMotions(
string $mp_id,
string $date = '',
): JsonResponse {
$response = $this->http->get('dokumentlista/', [
'query' => [
'iid' => $mp_id,
'rm' => $date,
'doktyp' => 'mot',
'utformat' => 'json',
],
])->getBody()->getContents();
$data = json_decode($response);
return response()->json($data);
}
public function getPartyMotions(
string $party,
string $date = '',
): JsonResponse {
$response = $this->http->get('dokumentlista/', [
'query' => [
'parti' => $party,
'rm' => $date,
'doktyp' => 'mot',
'utformat' => 'json',
],
])->getBody()->getContents();
$data = json_decode($response);
return response()->json($data);
}
public function searchMotions(
string $query = '',
string $party = '',
string $dateInterval = '',
int $page = 1
): JsonResponse {
$response = $this->http->get('dokumentlista/', [
'query' => array_filter([
'sok' => $query,
'parti' => $party,
'rm' => $dateInterval,
'doktyp' => 'mot',
'utformat' => 'json',
'p' => $page,
]),
])->getBody()->getContents();
$data = json_decode($response);
return response()->json($data);
}
public function getMotion(
string $bet,
string $tempbet,
string $nr,
): JsonResponse {
$response = $this->http->get('dokumentlista/', [
'query' => [
'bet' => $bet,
'tempbet' => $tempbet,
'nr' => $nr,
'utformat' => 'json',
],
])->getBody()->getContents();
$data = json_decode($response);