foliolib.folio.api.patronBlocks.AutomatedPatronBlocks

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

Bases: foliolib.folio.FolioApi

API for checking if any automated patron blocks exist for patron

Automated patron blocks API

Parameters
  • tenant (str) – Tenant id

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

Methods

get_automatedPatronBlock(userId)

GET /automated-patron-blocks/{userId}

get_job(syncJobId)

Checks synchronization status of job

set_job(job)

POST /automated-patron-blocks/synchronization/job

set_start()

POST /automated-patron-blocks/synchronization/start

get_automatedPatronBlock(userId: str)

GET /automated-patron-blocks/{userId}

Parameters

userId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Automated patron blocks",
  "description": "Allows to check if automated blocks for patron exist",
  "type": "object",
  "properties": {
    "automatedPatronBlocks": {
      "type": "array",
      "description": "List of automated patron blocks",
      "items": {
        "type": "object",
        "$ref": "automated-patron-block.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "automatedPatronBlocks"
  ]
}
get_job(syncJobId: str)

Checks synchronization status of job

GET /automated-patron-blocks/synchronization/job/{syncJobId}

Parameters

syncJobId (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",
  "description": "Synchronization job schema",
  "properties": {
    "id": {
      "description": "Synchronization job ID",
      "type": "string",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "scope": {
      "type": "string",
      "description": "Scope of re-sync data",
      "enum": [
        "user",
        "full"
      ]
    },
    "userId": {
      "type": "string",
      "description": "Users ID for if scope is [user]",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "status": {
      "description": "Status of synchronization job",
      "type": "string"
    },
    "totalNumberOfLoans": {
      "description": "Total number of loans",
      "type": "integer"
    },
    "totalNumberOfFeesFines": {
      "description": "Total number of fees/fines",
      "type": "integer"
    },
    "numberOfProcessedLoans": {
      "description": "Total number of processed loans",
      "type": "integer"
    },
    "numberOfProcessedFeesFines": {
      "description": "Total number of processed fees/fines",
      "type": "integer"
    },
    "errors": {
      "description": "Contains array of errors",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "additionalProperties": false,
  "required": [
    "scope"
  ]
}
set_job(job: dict)

POST /automated-patron-blocks/synchronization/job

Parameters

job (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Synchronization job schema",
  "properties": {
    "id": {
      "description": "Synchronization job ID",
      "type": "string",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "scope": {
      "type": "string",
      "description": "Scope of re-sync data",
      "enum": [
        "user",
        "full"
      ]
    },
    "userId": {
      "type": "string",
      "description": "Users ID for if scope is [user]",
      "$ref": "raml-util/schemas/uuid.schema"
    },
    "status": {
      "description": "Status of synchronization job",
      "type": "string"
    },
    "totalNumberOfLoans": {
      "description": "Total number of loans",
      "type": "integer"
    },
    "totalNumberOfFeesFines": {
      "description": "Total number of fees/fines",
      "type": "integer"
    },
    "numberOfProcessedLoans": {
      "description": "Total number of processed loans",
      "type": "integer"
    },
    "numberOfProcessedFeesFines": {
      "description": "Total number of processed fees/fines",
      "type": "integer"
    },
    "errors": {
      "description": "Contains array of errors",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    }
  },
  "additionalProperties": false,
  "required": [
    "scope"
  ]
}
set_start()

POST /automated-patron-blocks/synchronization/start

Raises

OkapiFatalError – Server Error