From a769a016322a1c3b40c3f84e0bfa47d69d01d161 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 19 Feb 2026 13:28:10 +0000 Subject: [PATCH] Bug 26355: Update the API specs --- api/v1/swagger/definitions/patron.yaml | 4 + .../swagger/definitions/patron_category.yaml | 30 ++++- .../definitions/patron_self_renewal.yaml | 23 ++++ api/v1/swagger/paths/patron_categories.yaml | 46 ++++++++ api/v1/swagger/paths/public_patrons.yaml | 108 ++++++++++++++++++ api/v1/swagger/swagger.yaml | 4 + 6 files changed, 210 insertions(+), 5 deletions(-) create mode 100644 api/v1/swagger/definitions/patron_self_renewal.yaml diff --git a/api/v1/swagger/definitions/patron.yaml b/api/v1/swagger/definitions/patron.yaml index afb252e1f17..8fa5e1034e7 100644 --- a/api/v1/swagger/definitions/patron.yaml +++ b/api/v1/swagger/definitions/patron.yaml @@ -408,6 +408,10 @@ properties: - "null" description: patron's primary contact method maxLength: 45 + self_renewal_available: + type: + - boolean + description: set to 1 if the patron is eligible to self renew and is within the renewal criteria _strings: type: - object diff --git a/api/v1/swagger/definitions/patron_category.yaml b/api/v1/swagger/definitions/patron_category.yaml index da548a6980d..e640566813c 100644 --- a/api/v1/swagger/definitions/patron_category.yaml +++ b/api/v1/swagger/definitions/patron_category.yaml @@ -46,11 +46,6 @@ properties: - boolean - "null" description: Are overdue notices sent to this patron category (1 for yes, 0 for no) - reserve_fee: - type: - - number - - "null" - description: Cost to place holds hide_lost_items: type: boolean description: Are lost items shown to this category (1 for yes, 0 for no) @@ -129,6 +124,31 @@ properties: type: - boolean description: Set threshold of debt allowed before issues are blocked + self_renewal_enabled: + type: + - boolean + description: Determine whether self-renewal is allowed for this category + self_renewal_availability_start: + type: + - number + - "null" + description: How many days in advance of expiry self-renewal should become available + self_renewal_if_expired: + type: + - number + - "null" + description: How many days after expiry self-renewal should still be available + self_renewal_fines_block: + type: + - number + - "null" + description: How much can be accrued in fines before self-renewal is blocked + self_renewal_failure_message: + type: string + description: The error message to display if self-renewal fails + self_renewal_information_message: + type: string + description: The information to display to the user before starting the renewal process additionalProperties: false required: - patron_category_id diff --git a/api/v1/swagger/definitions/patron_self_renewal.yaml b/api/v1/swagger/definitions/patron_self_renewal.yaml new file mode 100644 index 00000000000..dfa7b58d2a6 --- /dev/null +++ b/api/v1/swagger/definitions/patron_self_renewal.yaml @@ -0,0 +1,23 @@ +--- +type: "object" +properties: + self_renewal_settings: + type: + - object + - "null" + description: The object representing the self-renewal settings for the patron's category + expiry_date: + type: + - string + - "null" + description: The new expiry date on successful self-renewal + confirmation_sent: + type: + - array + - "null" + description: The method(s) through which confirmation of renewal has been sent + patron: + type: + - object + description: The object representing the patron fields from the OPAC form +additionalProperties: false diff --git a/api/v1/swagger/paths/patron_categories.yaml b/api/v1/swagger/paths/patron_categories.yaml index 98d261e0705..95a347ae9d9 100644 --- a/api/v1/swagger/paths/patron_categories.yaml +++ b/api/v1/swagger/paths/patron_categories.yaml @@ -52,3 +52,49 @@ x-koha-authorization: permissions: parameters: manage_patron_categories + post: + x-mojo-to: Patrons::Categories#add + operationId: addCategory + tags: + - categories + summary: Add category + parameters: + - name: body + in: body + description: A JSON object containing informations about the category + required: true + schema: + $ref: "../swagger.yaml#/definitions/patron_category" + produces: + - application/json + responses: + "201": + description: Category added + schema: + $ref: "../swagger.yaml#/definitions/patron_category" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" + "401": + description: Authentication required + schema: + $ref: "../swagger.yaml#/definitions/error" + "403": + description: Access forbidden + schema: + $ref: "../swagger.yaml#/definitions/error" + "500": + description: | + Internal server error. Possible `error_code` attribute values: + + * `internal_server_error` + schema: + $ref: "../swagger.yaml#/definitions/error" + "503": + description: Under maintenance + schema: + $ref: "../swagger.yaml#/definitions/error" + x-koha-authorization: + permissions: + parameters: manage_patron_categories diff --git a/api/v1/swagger/paths/public_patrons.yaml b/api/v1/swagger/paths/public_patrons.yaml index dfa00ae8256..2c56a95026e 100644 --- a/api/v1/swagger/paths/public_patrons.yaml +++ b/api/v1/swagger/paths/public_patrons.yaml @@ -344,3 +344,111 @@ description: Under maintenance schema: $ref: "../swagger.yaml#/definitions/error" +/public/patrons/{patron_id}/self_renewal: + get: + x-mojo-to: Patrons::SelfRenewal#start + operationId: startSelfRenewal + tags: + - patrons + summary: List patrons + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/patron_id_pp" + - $ref: "../swagger.yaml#/parameters/match" + - $ref: "../swagger.yaml#/parameters/order_by" + - $ref: "../swagger.yaml#/parameters/page" + - $ref: "../swagger.yaml#/parameters/per_page" + - $ref: "../swagger.yaml#/parameters/q_param" + - $ref: "../swagger.yaml#/parameters/q_body" + - $ref: "../swagger.yaml#/parameters/request_id_header" + responses: + "200": + description: The metadata required to start patron self-renewal + schema: + type: object + $ref: "../swagger.yaml#/definitions/patron_self_renewal" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" + "401": + description: Authentication required + schema: + $ref: "../swagger.yaml#/definitions/error" + "403": + description: Access forbidden + schema: + $ref: "../swagger.yaml#/definitions/error" + "500": + description: | + Internal server error. Possible `error_code` attribute values: + + * `internal_server_error` + schema: + $ref: "../swagger.yaml#/definitions/error" + "503": + description: Under maintenance + schema: + $ref: "../swagger.yaml#/definitions/error" + post: + x-mojo-to: Patrons::SelfRenewal#submit + operationId: submitSelfRenewal + tags: + - patrons + summary: Submit self-renewal form + consumes: + - application/json + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/patron_id_pp" + - description: A JSON object containing information about the self-renewal + in: body + name: body + required: true + schema: + $ref: "../swagger.yaml#/definitions/patron_self_renewal" + responses: + 201: + description: A successfully completed renewal + schema: + items: + $ref: "../swagger.yaml#/definitions/patron_self_renewal" + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" + 401: + description: Authentication required + schema: + $ref: "../swagger.yaml#/definitions/error" + 403: + description: Access forbidden + schema: + $ref: "../swagger.yaml#/definitions/error" + 404: + description: Ressource not found + schema: + $ref: "../swagger.yaml#/definitions/error" + 409: + description: Conflict in creating resource + schema: + $ref: "../swagger.yaml#/definitions/error" + 413: + description: Payload too large + schema: + $ref: "../swagger.yaml#/definitions/error" + 500: + description: |- + Internal server error. Possible `error_code` attribute values: + * `internal_server_error` + schema: + $ref: "../swagger.yaml#/definitions/error" + 503: + description: Under maintenance + schema: + $ref: "../swagger.yaml#/definitions/error" diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index 9a9b7af7565..c9b003ac2ad 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -154,6 +154,8 @@ definitions: $ref: ./definitions/patron_balance.yaml patron_category: $ref: ./definitions/patron_category.yaml + patron_self_renewal: + $ref: ./definitions/patron_self_renewal.yaml patron_extended_attribute: $ref: ./definitions/patron_extended_attribute.yaml preservation_config: @@ -581,6 +583,8 @@ paths: $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1ill~1requests" "/public/patrons/{patron_id}/password": $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1password" + "/public/patrons/{patron_id}/self_renewal": + $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1self_renewal" "/public/tickets": $ref: "./paths/tickets.yaml#/~1public~1tickets" /quotes: -- 2.50.1