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

(-)a/Koha/REST/V1/OAI/Sets.pm (+58 lines)
Line 0 Link Here
1
package Koha::REST::V1::OAI::Sets;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Mojo::Base 'Mojolicious::Controller';
21
22
use Try::Tiny qw( catch try );
23
24
use Koha::OAI::Sets;
25
26
=head1 NAME
27
28
Koha::REST::V1::OAI::Sets;
29
30
=head1 API
31
32
=head2 Methods
33
34
=head3 get
35
36
Controller function that handles retrieving an OAI set
37
38
=cut
39
40
sub get {
41
    my $c = shift->openapi->valid_input or return;
42
43
    return try {
44
        my $set = Koha::OAI::Sets->find( $c->param('set_id') );
45
46
        return $c->render_resource_not_found("OAI set")
47
            unless $set;
48
49
        return $c->render(
50
            status  => 200,
51
            openapi => $c->objects->to_api($set),
52
        );
53
    } catch {
54
        $c->unhandled_exception($_);
55
    }
56
}
57
58
1;
(-)a/api/v1/swagger/definitions/oai_set.yaml (+21 lines)
Line 0 Link Here
1
---
2
type: object
3
properties:
4
  set_id:
5
    type: integer
6
    description: Internal OAI set identifier
7
  spec:
8
    type: string
9
    description: Indicates a hierarchy of sets
10
  name:
11
    type: string
12
    description: Name of set
13
  total_count:
14
    type: integer
15
    description: Number of total items in the set
16
  catalog_count:
17
    type: integer
18
    description: Number of items which exist both in the set and in the catalog
19
additionalProperties: false
20
required:
21
  - set_id
(-)a/api/v1/swagger/paths/oai_sets.yaml (+47 lines)
Line 0 Link Here
1
---
2
"/oai_sets/{set_id}":
3
  get:
4
    x-mojo-to: OAI::Sets#get
5
    operationId: getOAISet
6
    tags:
7
      - oai_sets
8
    summary: Get OAI set
9
    parameters:
10
      - name: set_id
11
        in: path
12
        description: Internal OAI set identifier
13
        required: true
14
        type: integer
15
    produces:
16
      - application/json
17
    responses:
18
      "200":
19
        description: An OAI set
20
        schema:
21
          $ref: "../swagger.yaml#/definitions/oai_set"
22
      "400":
23
        description: Bad request
24
        schema:
25
          $ref: "../swagger.yaml#/definitions/error"
26
      "403":
27
        description: Access forbidden
28
        schema:
29
          $ref: "../swagger.yaml#/definitions/error"
30
      "404":
31
        description: Patron not found
32
        schema:
33
          $ref: "../swagger.yaml#/definitions/error"
34
      "500":
35
        description: |
36
          Internal server error. Possible `error_code` attribute values:
37
38
          * `internal_server_error`
39
        schema:
40
          $ref: "../swagger.yaml#/definitions/error"
41
      "503":
42
        description: Under maintenance
43
        schema:
44
          $ref: "../swagger.yaml#/definitions/error"
45
    x-koha-authorization:
46
      permissions:
47
        parameters: manage_oai_sets
(-)a/api/v1/swagger/swagger.yaml (-1 / +4 lines)
Lines 142-147 definitions: Link Here
142
    $ref: ./definitions/list.yaml
142
    $ref: ./definitions/list.yaml
143
  merge_biblios:
143
  merge_biblios:
144
    $ref: ./definitions/merge_biblios.yaml
144
    $ref: ./definitions/merge_biblios.yaml
145
  oai_set:
146
    $ref: ./definitions/oai_set.yaml
145
  order:
147
  order:
146
    $ref: ./definitions/order.yaml
148
    $ref: ./definitions/order.yaml
147
  order_claim:
149
  order_claim:
Lines 483-488 paths: Link Here
483
    $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1cash_registers"
485
    $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1cash_registers"
484
  "/libraries/{library_id}/desks":
486
  "/libraries/{library_id}/desks":
485
    $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1desks"
487
    $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1desks"
488
  "/oai_sets/{set_id}":
489
    $ref: "./paths/oai_sets.yaml#/~1oai_sets~1{set_id}"
486
  "/oauth/login/{provider_code}/{interface}":
490
  "/oauth/login/{provider_code}/{interface}":
487
    $ref: ./paths/oauth.yaml#/~1oauth~1login~1{provider_code}~1{interface}
491
    $ref: ./paths/oauth.yaml#/~1oauth~1login~1{provider_code}~1{interface}
488
  /oauth/token:
492
  /oauth/token:
489
- 

Return to bug 41463