@@ -, +, @@ --- api/v1/swagger/definitions.json | 3 + api/v1/swagger/definitions/patron_export.json | 15 ++++ api/v1/swagger/paths.json | 6 ++ api/v1/swagger/paths/patrons_export.json | 68 +++++++++++++++++++ api/v1/swagger/paths/public_patrons.json | 67 ++++++++++++++++++ 5 files changed, 159 insertions(+) create mode 100644 api/v1/swagger/definitions/patron_export.json create mode 100644 api/v1/swagger/paths/patrons_export.json --- a/api/v1/swagger/definitions.json +++ a/api/v1/swagger/definitions.json @@ -74,6 +74,9 @@ "patron_extended_attribute": { "$ref": "definitions/patron_extended_attribute.json" }, + "patron_export": { + "$ref": "definitions/patron_export.json" + }, "quote": { "$ref": "definitions/quote.json" }, --- a/api/v1/swagger/definitions/patron_export.json +++ a/api/v1/swagger/definitions/patron_export.json @@ -0,0 +1,15 @@ +{ + "type": "array", + "items": { + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "type": { + "type": "string" + } + } + }, + "additionalProperties": false +} --- a/api/v1/swagger/paths.json +++ a/api/v1/swagger/paths.json @@ -133,6 +133,9 @@ }, "/patrons/{patron_id}/extended_attributes/{extended_attribute_id}": { "$ref": "paths/patrons_extended_attributes.json#/~1patrons~1{patron_id}~1extended_attributes~1{extended_attribute_id}" + }, + "/patrons/{patron_id}/export": { + "$ref": "paths/patrons_export.json#/~1patrons~1{patron_id}~1export" }, "/patrons/{patron_id}/holds": { "$ref": "paths/patrons_holds.json#/~1patrons~1{patron_id}~1holds" @@ -161,6 +164,9 @@ "/public/biblios/{biblio_id}": { "$ref": "paths/biblios.json#/~1public~1biblios~1{biblio_id}" }, + "/public/patrons/{patron_id}/export": { + "$ref": "paths/public_patrons.json#/~1public~1patrons~1{patron_id}~1export" + }, "/public/patrons/{patron_id}/password": { "$ref": "paths/public_patrons.json#/~1public~1patrons~1{patron_id}~1password" }, --- a/api/v1/swagger/paths/patrons_export.json +++ a/api/v1/swagger/paths/patrons_export.json @@ -0,0 +1,68 @@ +{ + "/patrons/{patron_id}/export": { + "get": { + "x-mojo-to": "Patrons::Export#get", + "operationId": "getPatronExport", + "tags": [ + "patron" + ], + "parameters": [ + { + "$ref": "../parameters.json#/patron_id_pp" + }, + { + "$ref": "../parameters.json#/page" + }, + { + "$ref": "../parameters.json#/per_page" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Patron's data export", + "schema": { + "$ref": "../definitions.json#/patron_export" + } + }, + "401": { + "description": "Authentication required", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "403": { + "description": "Access forbidden", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "404": { + "description": "Patron not found", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "503": { + "description": "Under maintenance", + "schema": { + "$ref": "../definitions.json#/error" + } + } + }, + "x-koha-authorization": { + "permissions": { + "borrowers": "edit_borrowers" + } + } + } + } +} --- a/api/v1/swagger/paths/public_patrons.json +++ a/api/v1/swagger/paths/public_patrons.json @@ -1,4 +1,71 @@ { + "/public/patrons/{patron_id}/export": { + "get": { + "x-mojo-to": "Patrons::Export#get_public", + "operationId": "getPublicPatronExport", + "tags": [ + "patron" + ], + "parameters": [ + { + "$ref": "../parameters.json#/patron_id_pp" + }, + { + "$ref": "../parameters.json#/page" + }, + { + "$ref": "../parameters.json#/per_page" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Patron's data export", + "schema": { + "$ref": "../definitions.json#/patron_export" + } + }, + "401": { + "description": "Authentication required", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "403": { + "description": "Access forbidden", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "404": { + "description": "Patron not found", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "503": { + "description": "Under maintenance", + "schema": { + "$ref": "../definitions.json#/error" + } + } + }, + "x-koha-authorization": { + "permissions": { + "borrowers": "edit_borrowers" + }, + "allow-owner": true + } + } + }, "/public/patrons/{patron_id}/password": { "post": { "x-mojo-to": "Patrons::Password#set_public", --