diff --git a/api/v1/swagger/definitions/sip2_account.yaml b/api/v1/swagger/definitions/sip2_account.yaml new file mode 100644 index 0000000000..f498cc8420 --- /dev/null +++ b/api/v1/swagger/definitions/sip2_account.yaml @@ -0,0 +1,206 @@ +--- +type: object +properties: + sip_account_id: + type: integer + description: unique account identifier + readOnly: true + sip_institution_id: + type: integer + description: unique institution identifier + ae_field_template: + description: ae field template + type: + - string + - 'null' + allow_additional_materials_checkout: + description: allow additional materials checkout + type: + - boolean + - 'null' + allow_empty_passwords: + description: allow empty passwords + type: + - boolean + - 'null' + allow_fields: + description: allow fields + type: + - string + - 'null' + av_field_template: + description: av field template + type: + - string + - 'null' + blocked_item_types: + description: blocked item types + type: + - string + - 'null' + checked_in_ok: + description: checked in ok + type: + - boolean + - 'null' + convert_nonprinting_characters: + description: convert nonprinting characters + type: + - string + - 'null' + cr_item_field: + description: cr item field + type: + - string + - 'null' + ct_always_send: + description: ct always send + type: + - boolean + - 'null' + cv_send_00_on_success: + description: cv send 00 on success + type: + - boolean + - 'null' + cv_triggers_alert: + description: cv triggers alert + type: + - boolean + - 'null' + da_field_template: + description: da field template + type: + - string + - 'null' + delimiter: + description: delimiter + type: + - string + - 'null' + disallow_overpayment: + description: disallow overpayment + type: + - boolean + - 'null' + encoding: + description: encoding + type: + - string + - 'null' + error_detect: + description: error detect + type: + - boolean + - 'null' + format_due_date: + description: format due date + type: + - boolean + - 'null' + hide_fields: + description: hide fields + type: + - string + - 'null' + holds_block_checkin: + description: holds block checkin + type: + - boolean + - 'null' + holds_get_captured: + description: holds get captured + type: + - boolean + - 'null' + inhouse_item_types: + description: inhouse item types + type: + - string + - 'null' + inhouse_patron_categories: + description: inhouse patron categories + type: + - string + - 'null' + login_id: + description: login id + type: string + login_password: + description: login password + type: string + lost_block_checkout: + description: lost status for missing + type: + - integer + - 'null' + lost_block_checkout_value: + description: lost status for missing + type: + - integer + - 'null' + lost_status_for_missing: + description: lost status for missing + type: + - integer + - 'null' + overdues_block_checkout: + description: overdues block checkout + type: + - boolean + - 'null' + payment_type_writeoff: + description: payment type writeoff + type: + - string + - 'null' + prevcheckout_block_checkout: + description: prevcheckout block checkout + type: + - boolean + - 'null' + register_id: + description: register id + type: + - integer + - 'null' + seen_on_item_information: + description: seen on item information + type: + - string + - 'null' + send_patron_home_library_in_af: + description: send patron home library in af + type: + - boolean + - 'null' + show_checkin_message: + description: show checkin message + type: + - boolean + - 'null' + show_outstanding_amount: + description: show outstanding amount + type: + - boolean + - 'null' + institution: + description: Related institution embed + type: + - object + - 'null' + terminator: + description: terminator + type: + - string + - "null" + enum: + - CR + - CRLF + - null + +additionalProperties: false +required: + - sip_account_id + - login_id + - login_password diff --git a/api/v1/swagger/paths/sip2_accounts.yaml b/api/v1/swagger/paths/sip2_accounts.yaml new file mode 100644 index 0000000000..4b871c2df3 --- /dev/null +++ b/api/v1/swagger/paths/sip2_accounts.yaml @@ -0,0 +1,272 @@ +--- +/sip2/accounts: + get: + x-mojo-to: SIP2::Accounts#list + operationId: listSip2Accounts + tags: + - sip2_accounts + summary: List accounts + produces: + - application/json + parameters: + - description: Case insensitive search on account sip_account_id + in: query + name: sip_account_id + required: false + type: string + - name: x-koha-embed + in: header + required: false + description: Embed list sent as a request header + type: array + items: + type: string + enum: + - institution + collectionFormat: csv + - $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" + responses: + 200: + description: A list of SIP2 accounts + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_account" + type: array + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + 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: + superlibrarian: 1 # TODO: Fix this, currently for superlibrarians only + post: + x-mojo-to: SIP2::Accounts#add + operationId: addSip2Accounts + tags: + - sip2_accounts + summary: Add accounts + consumes: + - application/json + produces: + - application/json + parameters: + - description: A JSON object containing information about the new account + in: body + name: body + required: true + schema: + $ref: "../swagger.yaml#/definitions/sip2_account" + responses: + 201: + description: A successfully created account + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_account" + 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" + x-koha-authorization: + permissions: + superlibrarian: 1 # TODO: Fix this, currently for superlibrarians only +"/sip2/accounts/{sip_account_id}": + get: + x-mojo-to: SIP2::Accounts#get + operationId: getSip2Accounts + tags: + - sip2_accounts + summary: Get SIP2 account + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_account_id_pp" + responses: + 200: + description: A SIP2 account + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_account" + 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" + 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: + superlibrarian: 1 # TODO: Fix this, currently for superlibrarians only + put: + x-mojo-to: SIP2::Accounts#update + operationId: updateSip2Accounts + tags: + - sip2_accounts + summary: Update account + consumes: + - application/json + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_account_id_pp" + - name: body + in: body + description: A JSON object containing new information about existing account + required: true + schema: + $ref: "../swagger.yaml#/definitions/sip2_account" + responses: + 200: + description: A successfully updated account + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_account" + 400: + description: Bad request + 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 updating 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" + x-koha-authorization: + permissions: + superlibrarian: 1 # TODO: Fix this, currently for superlibrarians only + delete: + x-mojo-to: SIP2::Accounts#delete + operationId: deleteSip2Accounts + tags: + - sip2_accounts + summary: Delete account + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_account_id_pp" + responses: + 204: + description: Account deleted + 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: Resource not found + schema: + $ref: "../swagger.yaml#/definitions/error" + 409: + description: Conflict in deleting resource + 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: + superlibrarian: 1 # TODO: Fix this, currently for superlibrarians only diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index c2801eedfb..fe3709bd91 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -180,6 +180,8 @@ definitions: $ref: ./definitions/rota.yaml search_filter: $ref: ./definitions/search_filter.yaml + sip2_account: + $ref: ./definitions/sip2_account.yaml sip2_institution: $ref: ./definitions/sip2_institution.yaml smtp_server: @@ -599,6 +601,10 @@ paths: $ref: "./paths/rotas.yaml#/~1rotas~1{rota_id}" "/rotas/{rota_id}/stages/{stage_id}/position": $ref: "./paths/rotas.yaml#/~1rotas~1{rota_id}~1stages~1{stage_id}~1position" + /sip2/accounts: + $ref: ./paths/sip2_accounts.yaml#/~1sip2~1accounts + "/sip2/accounts/{sip_account_id}": + $ref: "./paths/sip2_accounts.yaml#/~1sip2~1accounts~1{sip_account_id}" /sip2/institutions: $ref: ./paths/sip2_institutions.yaml#/~1sip2~1institutions "/sip2/institutions/{sip_institution_id}": @@ -989,6 +995,12 @@ parameters: name: seen required: false type: integer + sip_account_id_pp: + description: SIP2 account internal identifier + in: path + name: sip_account_id + required: true + type: integer sip_institution_id_pp: description: SIP2 institution internal identifier in: path