foliolib.folio.api.idmConnect.IdmConnect

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

Bases: foliolib.folio.FolioApi

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_contract(contractId)

Delete contract item with given {contractId}

delete_ubreadernumbers(**kwargs)

Delete a UBReaderNumber

get_contract(contractId)

Retrieve contract item with given {contractId}

get_contracts(**kwargs)

Retrieve a list of contract items.

get_searchidms(**kwargs)

Get existing users

get_transmit_by_contract(contractId)

Transmit the walk-in contract with id to external IDM system and update its status

modify_contract(contractId, contract)

Update contract item with given {contractId}

set_bulkDelete(bulkDelete)

Delete multiple walk-in contracts

set_contract(contract)

Create a new contract item.

set_ubreadernumber(**kwargs)

Set a UBReaderNumber

delete_contract(contractId: str)

Delete contract item with given {contractId}

DELETE /idm-connect/contract/{contractId}

Parameters

contractId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

delete_ubreadernumbers(**kwargs)

Delete a UBReaderNumber

DELETE /idm-connect/ubreadernumber

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments

() (unilogin) –

unilogin

Example

  • 123abc78

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

get_contract(contractId: str)

Retrieve contract item with given {contractId}

GET /idm-connect/contract/{contractId}

Parameters

contractId (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": "A walk-in contract",
  "properties": {
    "id": {
      "description": "The UUID of this contract",
      "type": "string"
    },
    "personal": {
      "description": "Personal information for this contract",
      "type": "object",
      "$ref": "person.json"
    },
    "libraryCard": {
      "description": "Library card number",
      "type": "string"
    },
    "uniLogin": {
      "description": "University login",
      "type": "string"
    },
    "status": {
      "description": "Contract status",
      "type": "string",
      "$ref": "status.json"
    },
    "beginDate": {
      "description": "Contract begin date",
      "type": "string"
    },
    "endDate": {
      "description": "Contract end date",
      "type": "string"
    },
    "comment": {
      "description": "Field for comments",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    },
    "_version": {
      "description": "Record version for optimistic locking",
      "type": "integer"
    }
  }
}
get_contracts(**kwargs)

Retrieve a list of contract items.

GET /idm-connect/contract

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • 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.

    Example

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

  • 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

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#",
  "type": "object",
  "description": "Collection of walk-in contracts",
  "properties": {
    "contracts": {
      "description": "Walk-in contracts",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "contract.json"
      }
    },
    "totalRecords": {
      "description": "Total count of walk-in contracts",
      "type": "integer"
    }
  },
  "required": [
    "contracts",
    "totalRecords"
  ]
}
get_searchidms(**kwargs)

Get existing users

GET /idm-connect/searchidm

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • () (dateOfBirth) –

    Users first name

    Example

    • John

  • ()

    Users last name

    Example

    • Doe

  • ()

    Users date of birth

    Example

    • 2015-12-24

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

get_transmit_by_contract(contractId: str)

Transmit the walk-in contract with id to external IDM system and update its status

GET /idm-connect/contract/{contractId}/transmit

Parameters

contractId (str) –

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

modify_contract(contractId: str, contract: dict)

Update contract item with given {contractId}

PUT /idm-connect/contract/{contractId}

Parameters
  • contractId (str) –

  • contract (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",
  "description": "A walk-in contract",
  "properties": {
    "id": {
      "description": "The UUID of this contract",
      "type": "string"
    },
    "personal": {
      "description": "Personal information for this contract",
      "type": "object",
      "$ref": "person.json"
    },
    "libraryCard": {
      "description": "Library card number",
      "type": "string"
    },
    "uniLogin": {
      "description": "University login",
      "type": "string"
    },
    "status": {
      "description": "Contract status",
      "type": "string",
      "$ref": "status.json"
    },
    "beginDate": {
      "description": "Contract begin date",
      "type": "string"
    },
    "endDate": {
      "description": "Contract end date",
      "type": "string"
    },
    "comment": {
      "description": "Field for comments",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    },
    "_version": {
      "description": "Record version for optimistic locking",
      "type": "integer"
    }
  }
}
set_bulkDelete(bulkDelete: dict)

Delete multiple walk-in contracts

POST /idm-connect/contract/bulk-delete

Parameters

bulkDelete (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Request object for bulk-delete operation",
  "properties": {
    "uuids": {
      "description": "Array of UUIDs that should be deleted",
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    }
  },
  "required": [
    "uuids"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Response object for bulk-delete operation",
  "properties": {
    "requested": {
      "description": "Number of deletions requested",
      "type": "integer"
    },
    "deleted": {
      "description": "Number of successfully executed deletions",
      "type": "integer"
    },
    "failed": {
      "description": "Number of failed deletions",
      "type": "integer"
    },
    "failedItems": {
      "description": "UUIDs that failed deletion",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "requested",
    "deleted",
    "failed"
  ]
}
set_contract(contract: dict)

Create a new contract item.

POST /idm-connect/contract

Parameters

contract (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created contract item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "A walk-in contract",
  "properties": {
    "id": {
      "description": "The UUID of this contract",
      "type": "string"
    },
    "personal": {
      "description": "Personal information for this contract",
      "type": "object",
      "$ref": "person.json"
    },
    "libraryCard": {
      "description": "Library card number",
      "type": "string"
    },
    "uniLogin": {
      "description": "University login",
      "type": "string"
    },
    "status": {
      "description": "Contract status",
      "type": "string",
      "$ref": "status.json"
    },
    "beginDate": {
      "description": "Contract begin date",
      "type": "string"
    },
    "endDate": {
      "description": "Contract end date",
      "type": "string"
    },
    "comment": {
      "description": "Field for comments",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema"
    },
    "_version": {
      "description": "Record version for optimistic locking",
      "type": "integer"
    }
  }
}
set_ubreadernumber(**kwargs)

Set a UBReaderNumber

POST /idm-connect/ubreadernumber

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • () (UBReaderNumber) –

    unilogin

    Example

    • 123abc78

  • ()

    UBReaderNumber

    Example

    • 1234567890

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error