Bug 34431: Allow for x-koha-embed in ill/backends endpoint
Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
891700d640
commit
f08d94133d
2 changed files with 21 additions and 4 deletions
|
@ -40,15 +40,22 @@ sub list {
|
|||
|
||||
my $config = Koha::Illrequest::Config->new;
|
||||
my $backends = $config->available_backends;
|
||||
my $backend_module = Koha::Illbackend->new;
|
||||
|
||||
my @data;
|
||||
foreach my $b (@$backends) {
|
||||
my $backend = Koha::Illrequest->new->load_backend($b);
|
||||
push @data,
|
||||
{
|
||||
|
||||
my $embed = $backend_module->embed(
|
||||
$b,
|
||||
$c->req->headers->header('x-koha-embed')
|
||||
);
|
||||
|
||||
my $return = {
|
||||
ill_backend_id => $b,
|
||||
capabilities => $backend->capabilities,
|
||||
};
|
||||
};
|
||||
push @data, $embed ? { %$return, %$embed } : $return;
|
||||
}
|
||||
return $c->render( status => 200, openapi => \@data );
|
||||
}
|
||||
|
|
|
@ -6,7 +6,17 @@
|
|||
tags:
|
||||
- ill_backends
|
||||
summary: List ILL backends
|
||||
parameters: []
|
||||
parameters:
|
||||
- name: x-koha-embed
|
||||
in: header
|
||||
required: false
|
||||
description: Embed list sent as a request header
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- statuses+strings
|
||||
collectionFormat: csv
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
|
Loading…
Reference in a new issue