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

(-)a/Koha/REST/V1/Items.pm (+28 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
}
88
61
=head3 get
89
=head3 get
62
90
63
Controller function that handles retrieving a single Koha::Item
91
Controller function that handles retrieving a single Koha::Item
(-)a/api/v1/swagger/paths/items.yaml (+51 lines)
Lines 376-378 Link Here
376
    x-koha-authorization:
376
    x-koha-authorization:
377
      permissions:
377
      permissions:
378
        reserveforothers: place_holds
378
        reserveforothers: place_holds
379
"/public/items":
380
  get:
381
    x-mojo-to: Items#list_public
382
    operationId: listItemsPublic
383
    tags:
384
      - items
385
    summary: List items publically visible
386
    parameters:
387
      - name: external_id
388
        in: query
389
        description: Search on the item's barcode
390
        required: false
391
        type: string
392
      - $ref: "../swagger.yaml#/parameters/match"
393
      - $ref: "../swagger.yaml#/parameters/order_by"
394
      - $ref: "../swagger.yaml#/parameters/page"
395
      - $ref: "../swagger.yaml#/parameters/per_page"
396
      - $ref: "../swagger.yaml#/parameters/q_param"
397
      - $ref: "../swagger.yaml#/parameters/q_body"
398
      - $ref: "../swagger.yaml#/parameters/q_header"
399
      - $ref: "../swagger.yaml#/parameters/request_id_header"
400
    consumes:
401
      - application/json
402
    produces:
403
      - application/json
404
    responses:
405
      "200":
406
        description: A list of item
407
        schema:
408
          type: array
409
          items:
410
            $ref: "../swagger.yaml#/definitions/item"
411
      "401":
412
        description: Authentication required
413
        schema:
414
          $ref: "../swagger.yaml#/definitions/error"
415
      "403":
416
        description: Access forbidden
417
        schema:
418
          $ref: "../swagger.yaml#/definitions/error"
419
      "500":
420
        description: |
421
          Internal server error. Possible `error_code` attribute values:
422
423
          * `internal_server_error`
424
        schema:
425
          $ref: "../swagger.yaml#/definitions/error"
426
      "503":
427
        description: Under maintenance
428
        schema:
429
          $ref: "../swagger.yaml#/definitions/error"
(-)a/api/v1/swagger/swagger.yaml (-1 / +2 lines)
Lines 283-288 paths: Link Here
283
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
283
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
284
  "/public/biblios/{biblio_id}":
284
  "/public/biblios/{biblio_id}":
285
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
285
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
286
  "/public/items":
287
    $ref: "./paths/items.yaml#/~1public~1items"
286
  "/public/biblios/{biblio_id}/items":
288
  "/public/biblios/{biblio_id}/items":
287
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items"
289
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items"
288
  "/public/biblios/{biblio_id}/ratings":
290
  "/public/biblios/{biblio_id}/ratings":
289
- 

Return to bug 33146