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

(-)a/Koha/REST/V1/TopIssues.pm (+27 lines)
Line 0 Link Here
1
package Koha::REST::V1::TopIssues;
2
3
use Modern::Perl;
4
5
use Mojo::Base 'Mojolicious::Controller';
6
7
use C4::Context;
8
use C4::Circulation;
9
10
sub get_top_issues {
11
    my ($c, $args, $cb) = @_;
12
13
    my $req = $c->req;
14
    my %params = (
15
        count => $req->param('count'),
16
        branch => $req->param('branch'),
17
        itemtype => $req->param('itemtype'),
18
        ccode => $req->param('ccode'),
19
        newness => $req->param('newness'),
20
    );
21
22
    my @results = GetTopIssues(\%params);
23
24
    $c->$cb(\@results, 200);
25
}
26
27
1;
(-)a/api/v1/swagger.json (-1 / +93 lines)
Lines 63-68 Link Here
63
          }
63
          }
64
        }
64
        }
65
      }
65
      }
66
    },
67
    "/topissues": {
68
      "get": {
69
        "x-mojo-controller": "Koha::REST::V1::TopIssues",
70
        "operationId": "get_top_issues",
71
        "tags": ["issues"],
72
        "parameters": [
73
          {
74
            "name": "count",
75
            "in": "query",
76
            "type": "integer",
77
            "minimum": 1,
78
            "description": "Number of titles to retrieve"
79
          },
80
          {
81
            "name": "branch",
82
            "in": "query",
83
            "type": "string",
84
            "description": "Filter by branch code"
85
          },
86
          {
87
            "name": "itemtype",
88
            "in": "query",
89
            "type": "string",
90
            "description": "Filter by item type"
91
          },
92
          {
93
            "name": "ccode",
94
            "in": "query",
95
            "type": "string",
96
            "description": "Filter by collection code"
97
          },
98
          {
99
            "name": "newness",
100
            "in": "query",
101
            "type": "integer",
102
            "minimum": 1,
103
            "description": "Filter by newness (in days)"
104
          }
105
        ],
106
        "produces": [
107
          "application/json"
108
        ],
109
        "responses": {
110
          "200": {
111
            "description": "A borrower",
112
            "schema": {
113
              "type": "array",
114
              "items": {
115
                "type": "object",
116
                "properties": {
117
                  "count": {
118
                    "description": "Number of issues for this title"
119
                  },
120
                  "copyrightdate": {
121
                    "description": "Copyright date"
122
                  },
123
                  "ccode": {
124
                    "description": "Collection code"
125
                  },
126
                  "itemtype": {
127
                    "description": "Item type"
128
                  },
129
                  "place": {
130
                    "description": "Publication place"
131
                  },
132
                  "author": {
133
                    "description": "Author"
134
                  },
135
                  "size": {
136
                    "description": "Material size"
137
                  },
138
                  "biblionumber": {
139
                    "description": "Biblio internal identifier"
140
                  },
141
                  "title": {
142
                    "description": "Title"
143
                  },
144
                  "publicationyear": {
145
                    "description": "Publication year"
146
                  },
147
                  "publishercode": {
148
                    "description": "Publisher code"
149
                  },
150
                  "pages": {
151
                    "description": "Number of pages"
152
                  }
153
                }
154
              }
155
            }
156
          }
157
        }
158
      }
66
    }
159
    }
67
  },
160
  },
68
  "definitions": {
161
  "definitions": {
69
- 

Return to bug 14749