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:
Pedro Amorim 2023-08-04 16:01:33 +00:00 committed by Katrin Fischer
parent 891700d640
commit f08d94133d
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 21 additions and 4 deletions

View file

@ -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 );
}

View file

@ -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: