foliolib.folio.api.circulationStorage.PatronActionSession

class foliolib.folio.api.circulationStorage.PatronActionSession(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Patron Action Session API

Storage for patron action sessions

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

delete_patronActionSession(patronSessionId)

Delete patronActionSession item with given {patronActionSessionId}

get_expiredSessionPatronIds(**kwargs)

GET /patron-action-session-storage/expired-session-patron-ids

get_patronActionSession(patronSessionId)

Retrieve patronActionSession item with given {patronActionSessionId}

get_patronActionSessions(**kwargs)

Retrieve a list of patronActionSession items.

modify_patronActionSession(patronSessionId, ...)

Update patronActionSession item with given {patronActionSessionId}

set_patronActionSession(patronActionSession)

Create a new patronActionSession item.

delete_patronActionSession(patronSessionId: str)

Delete patronActionSession item with given {patronActionSessionId}

DELETE /patron-action-session-storage/patron-action-sessions/{patronSessionId}

Parameters

patronSessionId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_expiredSessionPatronIds(**kwargs)

GET /patron-action-session-storage/expired-session-patron-ids

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • action_type (str) – Parameter to filter expired sessions by patron action type

  • session_inactivity_time_limit (str) –

    This parameter defines time up to which all sessions are considered as expired. Conforms to the ISO 8601 date and time format

    Example

    • 2018-11-29 13:23:36+00:00

  • limit (int) –

    (default=10) Limit the number of sessions returned in the response

    Example

    • 10

Returns

See Schema below

Return type

dict

Raises
  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of expired sessions",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "expiredSessions": {
      "description": "List of expired sessions",
      "id": "expiredSessions",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "patronId": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
            "description": "Id of patron who has expired session"
          },
          "actionType": {
            "type": "string",
            "enum": [
              "Check-out",
              "Check-in"
            ],
            "description": "Type of expired session"
          }
        }
      }
    }
  },
  "required": [
    "expiredSessions"
  ]
}
get_patronActionSession(patronSessionId: str)

Retrieve patronActionSession item with given {patronActionSessionId}

GET /patron-action-session-storage/patron-action-sessions/{patronSessionId}

Parameters

patronSessionId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "additionalProperties": false,
  "description": "Patron action session",
  "properties": {
    "id": {
      "type": "string",
      "description": "Patron action session id, UUID",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "sessionId": {
      "type": "string",
      "description": "UUID which is the same for all patron action sessions generated in scope of the same check-in/check-out session",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "patronId": {
      "type": "string",
      "description": "Patron id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "loanId": {
      "type": "string",
      "description": "Loan id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "actionType": {
      "type": "string",
      "description": "Defines action type",
      "enum": [
        "Check-out",
        "Check-in"
      ]
    },
    "metadata": {
      "description": "Metadata about creation and changes to patron action session, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "patronId",
    "loanId",
    "actionType"
  ]
}
get_patronActionSessions(**kwargs)

Retrieve a list of patronActionSession items.

GET /patron-action-session-storage/patron-action-sessions

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • offset (int) –

    (default=0) Skip over a number of elements by specifying an offset value for the query

    Example

    • 0

  • limit (int) –

    (default=10) Limit the number of elements returned in the response

    Example

    • 10

  • query (str) –

    A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.

    searchable using CQL

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • name=”undergrad*”

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of patron action sessions",
  "type": "object",
  "properties": {
    "patronActionSessions": {
      "description": "List of patron action sessions",
      "id": "patronActionSessions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "patron-action-session.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "patronActionSessions",
    "totalRecords"
  ]
}
modify_patronActionSession(patronSessionId: str, patronActionSession: dict)

Update patronActionSession item with given {patronActionSessionId}

PUT /patron-action-session-storage/patron-action-sessions/{patronSessionId}

Parameters
  • patronSessionId (str) –

  • patronActionSession (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "additionalProperties": false,
  "description": "Patron action session",
  "properties": {
    "id": {
      "type": "string",
      "description": "Patron action session id, UUID",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "sessionId": {
      "type": "string",
      "description": "UUID which is the same for all patron action sessions generated in scope of the same check-in/check-out session",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "patronId": {
      "type": "string",
      "description": "Patron id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "loanId": {
      "type": "string",
      "description": "Loan id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "actionType": {
      "type": "string",
      "description": "Defines action type",
      "enum": [
        "Check-out",
        "Check-in"
      ]
    },
    "metadata": {
      "description": "Metadata about creation and changes to patron action session, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "patronId",
    "loanId",
    "actionType"
  ]
}
set_patronActionSession(patronActionSession: dict)

Create a new patronActionSession item.

POST /patron-action-session-storage/patron-action-sessions

Parameters

patronActionSession (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created patronActionSession item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "additionalProperties": false,
  "description": "Patron action session",
  "properties": {
    "id": {
      "type": "string",
      "description": "Patron action session id, UUID",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "sessionId": {
      "type": "string",
      "description": "UUID which is the same for all patron action sessions generated in scope of the same check-in/check-out session",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "patronId": {
      "type": "string",
      "description": "Patron id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "loanId": {
      "type": "string",
      "description": "Loan id",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "actionType": {
      "type": "string",
      "description": "Defines action type",
      "enum": [
        "Check-out",
        "Check-in"
      ]
    },
    "metadata": {
      "description": "Metadata about creation and changes to patron action session, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "patronId",
    "loanId",
    "actionType"
  ]
}