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

(-)a/Koha/REST/V1/ItemTypes.pm (+32 lines)
Line 0 Link Here
1
package Koha::REST::V1::ItemTypes;
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::ItemTypes;
23
24
sub list {
25
    my ($c, $args, $cb) = @_;
26
27
    my $item_types = Koha::ItemTypes->search;
28
29
    $c->$cb($item_types->unblessed, 200);
30
}
31
32
1;
(-)a/api/v1/swagger/definitions.json (+3 lines)
Lines 5-10 Link Here
5
  "patron": {
5
  "patron": {
6
    "$ref": "definitions/patron.json"
6
    "$ref": "definitions/patron.json"
7
  },
7
  },
8
  "item_type": {
9
    "$ref": "definitions/item_type.json"
10
  },
8
  "holds": {
11
  "holds": {
9
    "$ref": "definitions/holds.json"
12
    "$ref": "definitions/holds.json"
10
  },
13
  },
(-)a/api/v1/swagger/definitions/item_type.json (+51 lines)
Line 0 Link Here
1
{
2
  "type": "object",
3
  "properties": {
4
    "itemtype": {
5
      "description": "unique key identifying itemtype",
6
      "type": "string"
7
    },
8
    "description": {
9
      "description": "a plain text explanation of the item type",
10
      "type": ["string", "null"]
11
    },
12
    "rentalcharge": {
13
      "description": "the amount charged when this item is checked out/issued",
14
      "type": ["string", "null"]
15
    },
16
    "notforloan": {
17
      "description": "1 if the item is not for loan, 0 if the item is available for loan",
18
      "type": ["string", "null"]
19
    },
20
    "imageurl": {
21
      "description": "URL for the item type icon",
22
      "type": ["string", "null"]
23
    },
24
    "summary": {
25
      "description": "information from the summary field, may include HTML",
26
      "type": ["string", "null"]
27
    },
28
    "checkinmsg": {
29
      "description": "message that is displayed when an item with the given item type is checked in",
30
      "type": ["string", "null"]
31
    },
32
    "checkinmsgtype": {
33
      "description": "type (CSS class) for the checkinmsg, can be 'alert' or 'message'",
34
      "type": ["string", "null"]
35
    },
36
    "sip_media_type": {
37
      "description": "SIP2 protocol media type for this itemtype",
38
      "type": ["string", "null"]
39
    },
40
    "hideinopac": {
41
      "description": "Hide the item type from the search options in OPAC",
42
      "type": "string"
43
    },
44
    "searchcategory": {
45
      "description": "Group this item type with others with the same value on OPAC search options",
46
      "type": ["string", "null"]
47
    }
48
  },
49
  "additionalProperties": false,
50
  "required": ["itemtype"]
51
}
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 5-10 Link Here
5
  "/cities/{cityid}": {
5
  "/cities/{cityid}": {
6
    "$ref": "paths/cities.json#/~1cities~1{cityid}"
6
    "$ref": "paths/cities.json#/~1cities~1{cityid}"
7
  },
7
  },
8
  "/item_types": {
9
    "$ref": "paths/item_types.json#/~1item_types"
10
  },
8
  "/holds": {
11
  "/holds": {
9
    "$ref": "paths/holds.json#/~1holds"
12
    "$ref": "paths/holds.json#/~1holds"
10
  },
13
  },
(-)a/api/v1/swagger/paths/item_types.json (-1 / +22 lines)
Line 0 Link Here
0
- 
1
{
2
  "/item_types": {
3
    "get": {
4
      "operationId": "listItemTypes",
5
      "tags": ["item_types"],
6
      "produces": [
7
          "application/json"
8
      ],
9
      "responses": {
10
        "200": {
11
          "description": "A list of item types",
12
          "schema": {
13
            "type": "array",
14
            "items": {
15
              "$ref": "../definitions.json#/item_type"
16
            }
17
          }
18
        }
19
      }
20
    }
21
  }
22
}

Return to bug 17856