View | Details | Raw Unified | Return to bug 22615
Collapse All | Expand All

(-)a/Koha/REST/V1/Illbackends.pm (+54 lines)
Line 0 Link Here
1
package Koha::REST::V1::Illbackends;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Mojo::Base 'Mojolicious::Controller';
21
22
use Koha::Illrequest::Config;
23
use Koha::Illrequests;
24
25
=head1 NAME
26
27
Koha::REST::V1::Illbackends
28
29
=head2 Operations
30
31
=head3 list
32
33
Return a list of available ILL backends and its capabilities
34
35
=cut
36
37
sub list {
38
    my $c = shift->openapi->valid_input;
39
40
    my $config = Koha::Illrequest::Config->new;
41
    my $backends = $config->available_backends;
42
43
    my @data;
44
    foreach $b ( @$backends ) {
45
        my $backend = Koha::Illrequest->new->load_backend( $b );
46
        push @data, {
47
            ill_backend_id => $b,
48
            capabilities => $backend->capabilities,
49
        };
50
    }
51
    return $c->render( status => 200, openapi => \@data );
52
}
53
54
1;
(-)a/api/v1/swagger/definitions.json (+3 lines)
Lines 29-34 Link Here
29
  "holds": {
29
  "holds": {
30
    "$ref": "definitions/holds.json"
30
    "$ref": "definitions/holds.json"
31
  },
31
  },
32
  "ill_backends": {
33
    "$ref": "definitions/ill_backends.json"
34
  },
32
  "library": {
35
  "library": {
33
    "$ref": "definitions/library.json"
36
    "$ref": "definitions/library.json"
34
  },
37
  },
(-)a/api/v1/swagger/definitions/ill_backend.json (+13 lines)
Line 0 Link Here
1
{
2
  "type": "object",
3
  "properties": {
4
    "ill_backend_id": {
5
      "type": "string",
6
      "description": "Internal ILL backend identifier"
7
    },
8
    "capabilities": {
9
      "type": "object",
10
      "description": "List of capabilities"
11
    }
12
  }
13
}
(-)a/api/v1/swagger/definitions/ill_backends.json (+6 lines)
Line 0 Link Here
1
{
2
  "type": "array",
3
  "items": {
4
    "$ref": "ill_backend.json"
5
  }
6
}
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 80-85 Link Here
80
  "/patrons/{patron_id}/password": {
80
  "/patrons/{patron_id}/password": {
81
    "$ref": "paths/patrons_password.json#/~1patrons~1{patron_id}~1password"
81
    "$ref": "paths/patrons_password.json#/~1patrons~1{patron_id}~1password"
82
  },
82
  },
83
  "/ill_backends": {
84
    "$ref": "paths/ill_backends.json#/~1ill_backends"
85
  },
83
  "/illrequests": {
86
  "/illrequests": {
84
    "$ref": "paths/illrequests.json#/~1illrequests"
87
    "$ref": "paths/illrequests.json#/~1illrequests"
85
  },
88
  },
(-)a/api/v1/swagger/paths/ill_backends.json (-1 / +56 lines)
Line 0 Link Here
0
- 
1
{
2
    "/ill_backends": {
3
        "get": {
4
            "x-mojo-to": "Illbackends#list",
5
            "operationId": "listIllbackends",
6
            "tags": ["illbackends"],
7
            "parameters": [],
8
            "produces": [
9
                "application/json"
10
            ],
11
            "responses": {
12
                "200": {
13
                    "description": "A list of ILL backends",
14
                    "schema": {
15
                        "$ref": "../definitions.json#/ill_backends"
16
                    }
17
                },
18
                "401": {
19
                  "description": "Authentication required",
20
                  "schema": {
21
                    "$ref": "../definitions.json#/error"
22
                  }
23
                },
24
                "403": {
25
                  "description": "Access forbidden",
26
                  "schema": {
27
                    "$ref": "../definitions.json#/error"
28
                  }
29
                },
30
                "404": {
31
                  "description": "ILL backends not found",
32
                  "schema": {
33
                    "$ref": "../definitions.json#/error"
34
                  }
35
                },
36
                "500": {
37
                  "description": "Internal server error",
38
                  "schema": {
39
                    "$ref": "../definitions.json#/error"
40
                  }
41
                },
42
                "503": {
43
                  "description": "Under maintenance",
44
                  "schema": {
45
                    "$ref": "../definitions.json#/error"
46
                  }
47
                }
48
            },
49
            "x-koha-authorization": {
50
                "permissions": {
51
                    "ill": "1"
52
                }
53
            }
54
        }
55
    }
56
}

Return to bug 22615