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

(-)a/Koha/REST/V1/Items.pm (+27 lines)
Lines 58-63 sub list { Link Here
58
    };
58
    };
59
}
59
}
60
60
61
=head3 list_public
62
63
Controller function that handles listing Koha::Item objects available to the opac
64
65
=cut
66
67
sub list_public {
68
    my $c = shift->openapi->valid_input or return;
69
70
    return try {
71
        my $patron = $c->stash('koha.user');
72
73
        my $items_set =
74
          Koha::Items->filter_by_visible_in_opac( { patron => $patron } );
75
        my $items = $c->objects->search($items_set);
76
77
        #  ->filter_by_visible_in_opac( { patron => $patron } );
78
79
        return $c->render(
80
            status  => 200,
81
            openapi => $items
82
        );
83
    }
84
    catch {
85
        $c->unhandled_exception($_);
86
    };
87
}
61
88
62
=head3 get
89
=head3 get
63
90
(-)a/api/v1/swagger/paths/items.yaml (+51 lines)
Lines 316-318 Link Here
316
    x-koha-authorization:
316
    x-koha-authorization:
317
      permissions:
317
      permissions:
318
        reserveforothers: place_holds
318
        reserveforothers: place_holds
319
"/public/items":
320
  get:
321
    x-mojo-to: Items#list_public
322
    operationId: listItemsPublic
323
    tags:
324
      - items
325
    summary: List items publically visible
326
    parameters:
327
      - name: external_id
328
        in: query
329
        description: Search on the item's barcode
330
        required: false
331
        type: string
332
      - $ref: "../swagger.yaml#/parameters/match"
333
      - $ref: "../swagger.yaml#/parameters/order_by"
334
      - $ref: "../swagger.yaml#/parameters/page"
335
      - $ref: "../swagger.yaml#/parameters/per_page"
336
      - $ref: "../swagger.yaml#/parameters/q_param"
337
      - $ref: "../swagger.yaml#/parameters/q_body"
338
      - $ref: "../swagger.yaml#/parameters/q_header"
339
      - $ref: "../swagger.yaml#/parameters/request_id_header"
340
    consumes:
341
      - application/json
342
    produces:
343
      - application/json
344
    responses:
345
      "200":
346
        description: A list of item
347
        schema:
348
          type: array
349
          items:
350
            $ref: "../swagger.yaml#/definitions/item"
351
      "401":
352
        description: Authentication required
353
        schema:
354
          $ref: "../swagger.yaml#/definitions/error"
355
      "403":
356
        description: Access forbidden
357
        schema:
358
          $ref: "../swagger.yaml#/definitions/error"
359
      "500":
360
        description: |
361
          Internal server error. Possible `error_code` attribute values:
362
363
          * `internal_server_error`
364
        schema:
365
          $ref: "../swagger.yaml#/definitions/error"
366
      "503":
367
        description: Under maintenance
368
        schema:
369
          $ref: "../swagger.yaml#/definitions/error"
(-)a/api/v1/swagger/swagger.yaml (-1 / +2 lines)
Lines 273-278 paths: Link Here
273
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
273
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
274
  "/public/biblios/{biblio_id}":
274
  "/public/biblios/{biblio_id}":
275
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
275
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
276
  "/public/items":
277
    $ref: "./paths/items.yaml#/~1public~1items"
276
  "/public/biblios/{biblio_id}/items":
278
  "/public/biblios/{biblio_id}/items":
277
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items"
279
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items"
278
  "/public/biblios/{biblio_id}/ratings":
280
  "/public/biblios/{biblio_id}/ratings":
279
- 

Return to bug 30979