diff --git a/api/v1/swagger/definitions/sip2_institution.yaml b/api/v1/swagger/definitions/sip2_institution.yaml new file mode 100644 index 0000000000..411080bd35 --- /dev/null +++ b/api/v1/swagger/definitions/sip2_institution.yaml @@ -0,0 +1,39 @@ +--- +type: object +properties: + sip_institution_id: + type: integer + description: unique identifier + readOnly: true + name: + description: unique string institution's name + type: string + implementation: + description: institution's implementation, defaults to 'ILS' + type: string + checkin: + description: institution's policy for checkin + type: boolean + checkout: + description: institution's policy for checkout + type: boolean + offline: + description: institution's policy for offline + type: boolean + renewal: + description: institution's policy for renewal + type: boolean + retries: + description: institution's policy for retries + type: integer + status_update: + description: institution's policy for status_update + type: boolean + timeout: + description: institution's policy for timeout + type: integer + +additionalProperties: false +required: + - sip_institution_id + - name diff --git a/api/v1/swagger/paths/sip2_institutions.yaml b/api/v1/swagger/paths/sip2_institutions.yaml new file mode 100644 index 0000000000..1240a7e7f0 --- /dev/null +++ b/api/v1/swagger/paths/sip2_institutions.yaml @@ -0,0 +1,272 @@ +--- +/sip2/institutions: + get: + x-mojo-to: SIP2::Institutions#list + operationId: listSip2Institutions + tags: + - sip2_institutions + summary: List institutions + produces: + - application/json + parameters: + - description: Case insensitive search on institution sip_institution_id + in: query + name: sip_institution_id + required: false + type: string + - description: Case insensitive search on institution name + in: query + name: name + required: false + type: string + - description: Case insensitive search on institution implementation + in: query + name: implementation + required: false + type: string #TODO: Put the rest of the attributes here: checkin, checkout, etc + - $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 institutions + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_institution" + 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::Institutions#add + operationId: addSip2Institutions + tags: + - sip2_institutions + summary: Add institutions + consumes: + - application/json + produces: + - application/json + parameters: + - description: A JSON object containing information about the new institution + in: body + name: body + required: true + schema: + $ref: "../swagger.yaml#/definitions/sip2_institution" + responses: + 201: + description: A successfully created institution + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_institution" + 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/institutions/{sip_institution_id}": + get: + x-mojo-to: SIP2::Institutions#get + operationId: getSip2Institutions + tags: + - sip2_institutions + summary: Get SIP2 institution + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_institution_id_pp" + responses: + 200: + description: A SIP2 institution + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_institution" + 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::Institutions#update + operationId: updateSip2Institutions + tags: + - sip2_institutions + summary: Update institution + consumes: + - application/json + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_institution_id_pp" + - name: body + in: body + description: A JSON object containing new information about existing institution + required: true + schema: + $ref: "../swagger.yaml#/definitions/sip2_institution" + responses: + 200: + description: A successfully updated institution + schema: + items: + $ref: "../swagger.yaml#/definitions/sip2_institution" + 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::Institutions#delete + operationId: deleteSip2Institutions + tags: + - sip2_institutions + summary: Delete institution + produces: + - application/json + parameters: + - $ref: "../swagger.yaml#/parameters/sip_institution_id_pp" + responses: + 204: + description: Institution 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 ad31b72042..c2801eedfb 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_institution: + $ref: ./definitions/sip2_institution.yaml smtp_server: $ref: ./definitions/smtp_server.yaml file_transport: @@ -597,6 +599,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/institutions: + $ref: ./paths/sip2_institutions.yaml#/~1sip2~1institutions + "/sip2/institutions/{sip_institution_id}": + $ref: "./paths/sip2_institutions.yaml#/~1sip2~1institutions~1{sip_institution_id}" /suggestions: $ref: ./paths/suggestions.yaml#/~1suggestions "/suggestions/{suggestion_id}": @@ -983,6 +989,12 @@ parameters: name: seen required: false type: integer + sip_institution_id_pp: + description: SIP2 institution internal identifier + in: path + name: sip_institution_id + required: true + type: integer smtp_server_id_pp: description: SMTP server internal identifier in: path