Koha/api/v1/swagger/paths/patrons_account.yaml
Tomas Cohen Arazi d6c67eddd3 Bug 29620: Move the OpenAPI spec to YAML format
This patch moves all the REST API spec pieces into YAML.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/*
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-07 12:33:35 -10:00

86 lines
2.3 KiB
YAML

---
"/patrons/{patron_id}/account":
get:
x-mojo-to: Patrons::Account#get
operationId: getPatronAccount
tags:
- patrons
summary: Get account information for a patron
parameters:
- $ref: ../parameters.yaml#/patron_id_pp
produces:
- application/json
responses:
"200":
description: Patron's account balance
schema:
$ref: ../definitions.yaml#/patron_balance
"401":
description: Authentication required
schema:
$ref: ../definitions.yaml#/error
"403":
description: Access forbidden
schema:
$ref: ../definitions.yaml#/error
"404":
description: Patron not found
schema:
$ref: ../definitions.yaml#/error
"500":
description: Internal server error
schema:
$ref: ../definitions.yaml#/error
"503":
description: Under maintenance
schema:
$ref: ../definitions.yaml#/error
x-koha-authorization:
permissions:
borrowers: edit_borrowers
updatecharges: remaining_permissions
"/patrons/{patron_id}/account/credits":
post:
x-mojo-to: Patrons::Account#add_credit
operationId: addPatronCredit
tags:
- patrons
summary: Add credit to a patron's account
parameters:
- $ref: ../parameters.yaml#/patron_id_pp
- name: body
in: body
description: A JSON object containing credit information
required: true
schema:
$ref: ../definitions.yaml#/patron_account_credit
produces:
- application/json
responses:
"201":
description: Credit added
schema:
$ref: ../definitions.yaml#/account_line
"401":
description: Authentication required
schema:
$ref: ../definitions.yaml#/error
"403":
description: Access forbidden
schema:
$ref: ../definitions.yaml#/error
"404":
description: Patron not found
schema:
$ref: ../definitions.yaml#/error
"500":
description: Internal server error
schema:
$ref: ../definitions.yaml#/error
"503":
description: Under maintenance
schema:
$ref: ../definitions.yaml#/error
x-koha-authorization:
permissions:
updatecharges: remaining_permissions