foliolib.folio.api.inventoryStorage.LoanType

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

Bases: foliolib.folio.FolioApi

Loan Types API

This documents the API calls that can be made to query and manage loan types of the system

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_loanType(loantypeId)

Delete loanType item with given {loanTypeId}

delete_loanTypes()

DELETE /loan-types

get_loanType(loantypeId)

Retrieve loanType item with given {loanTypeId}

get_loanTypes(**kwargs)

Return a list of loan types

modify_loanType(loantypeId, loanType)

Update loanType item with given {loanTypeId}

set_loanType(loanType)

Create a new loan type

delete_loanType(loantypeId: str)

Delete loanType item with given {loanTypeId}

DELETE /loan-types/{loantypeId}

Parameters

loantypeId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

delete_loanTypes()

DELETE /loan-types

get_loanType(loantypeId: str)

Retrieve loanType item with given {loanTypeId}

GET /loan-types/{loantypeId}

Parameters

loantypeId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A loan type",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the loan type",
      "type": "string"
    },
    "source": {
      "description": "Origin of the loan type record, e.g. 'System', 'User', 'Consortium' etc.",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}
get_loanTypes(**kwargs)

Return a list of loan types

GET /loan-types

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.

    with valid searchable fields

    Example

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

    • name=aaa

  • 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#",
  "description": "A collection of loan types",
  "type": "object",
  "properties": {
    "loantypes": {
      "description": "List of loan types",
      "id": "loantype",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "loantype.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "loantypes",
    "totalRecords"
  ]
}
modify_loanType(loantypeId: str, loanType: dict)

Update loanType item with given {loanTypeId}

PUT /loan-types/{loantypeId}

Parameters
  • loantypeId (str) –

  • loanType (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A loan type",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the loan type",
      "type": "string"
    },
    "source": {
      "description": "Origin of the loan type record, e.g. 'System', 'User', 'Consortium' etc.",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}
set_loanType(loanType: dict)

Create a new loan type

POST /loan-types

Parameters

loanType (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created loanType item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A loan type",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the loan type",
      "type": "string"
    },
    "source": {
      "description": "Origin of the loan type record, e.g. 'System', 'User', 'Consortium' etc.",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}