foliolib.folio.api.circulationStorage.LoanPolicyStorage

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

Bases: foliolib.folio.FolioApi

Loan Policy Storage API

Storage for loan policies

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_loanPolicies()

DELETE /loan-policy-storage/loan-policies

delete_loanPolicy(loanPolicyId)

Delete loanPolicy item with given {loanPolicyId}

get_loanPolicies(**kwargs)

Retrieve a list of loanPolicy items.

get_loanPolicy(loanPolicyId)

Retrieve loanPolicy item with given {loanPolicyId}

modify_loanPolicy(loanPolicyId, loanPolicy)

Update loanPolicy item with given {loanPolicyId}

set_loanPolicy(loanPolicy)

Create a new loanPolicy item.

delete_loanPolicies()

DELETE /loan-policy-storage/loan-policies

delete_loanPolicy(loanPolicyId: str)

Delete loanPolicy item with given {loanPolicyId}

DELETE /loan-policy-storage/loan-policies/{loanPolicyId}

Parameters

loanPolicyId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiFatalError – Server Error

get_loanPolicies(**kwargs)

Retrieve a list of loanPolicy items.

GET /loan-policy-storage/loan-policies

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

    • id=”cf23adf0-61ba-4887-bf82-956c4aae2260”

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of loan policies",
  "type": "object",
  "properties": {
    "loanPolicies": {
      "description": "List of items",
      "id": "loanPolicies",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "loan-policy.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "loanPolicies",
    "totalRecords"
  ]
}
get_loanPolicy(loanPolicyId: str)

Retrieve loanPolicy item with given {loanPolicyId}

GET /loan-policy-storage/loan-policies/{loanPolicyId}

Parameters

loanPolicyId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rules governing loans",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "The name of the policy.",
      "type": "string"
    },
    "description": {
      "description": "Description of the loan policy",
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        },
        "itemLimit": {
          "type": "integer",
          "description": "Number of items allowed",
          "minimum": 1,
          "maximum": 9999
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "requestManagement": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "recalls": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateGracePeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate grace period for recalled items"
            },
            "minimumGuaranteedLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Minimum guaranteed loan period"
            },
            "recallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Recall return interval"
            },
            "allowRecallsToExtendOverdueLoans": {
              "type": "boolean",
              "description": "Whether recalls are allowed to extend overdue loans",
              "default": false
            },
            "alternateRecallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate recall return interval for overdue loans"
            }
          }
        },
        "holds": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending hold request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending hold request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending hold request"
            }
          }
        },
        "pages": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending page request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending page request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending page request"
            }
          }
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}
modify_loanPolicy(loanPolicyId: str, loanPolicy: dict)

Update loanPolicy item with given {loanPolicyId}

PUT /loan-policy-storage/loan-policies/{loanPolicyId}

Parameters
  • loanPolicyId (str) –

  • loanPolicy (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rules governing loans",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "The name of the policy.",
      "type": "string"
    },
    "description": {
      "description": "Description of the loan policy",
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        },
        "itemLimit": {
          "type": "integer",
          "description": "Number of items allowed",
          "minimum": 1,
          "maximum": 9999
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "requestManagement": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "recalls": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateGracePeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate grace period for recalled items"
            },
            "minimumGuaranteedLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Minimum guaranteed loan period"
            },
            "recallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Recall return interval"
            },
            "allowRecallsToExtendOverdueLoans": {
              "type": "boolean",
              "description": "Whether recalls are allowed to extend overdue loans",
              "default": false
            },
            "alternateRecallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate recall return interval for overdue loans"
            }
          }
        },
        "holds": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending hold request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending hold request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending hold request"
            }
          }
        },
        "pages": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending page request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending page request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending page request"
            }
          }
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}
set_loanPolicy(loanPolicy: dict)

Create a new loanPolicy item.

POST /loan-policy-storage/loan-policies

Parameters

loanPolicy (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created loanPolicy item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rules governing loans",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "The name of the policy.",
      "type": "string"
    },
    "description": {
      "description": "Description of the loan policy",
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        },
        "itemLimit": {
          "type": "integer",
          "description": "Number of items allowed",
          "minimum": 1,
          "maximum": 9999
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "requestManagement": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "recalls": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateGracePeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate grace period for recalled items"
            },
            "minimumGuaranteedLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Minimum guaranteed loan period"
            },
            "recallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Recall return interval"
            },
            "allowRecallsToExtendOverdueLoans": {
              "type": "boolean",
              "description": "Whether recalls are allowed to extend overdue loans",
              "default": false
            },
            "alternateRecallReturnInterval": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate recall return interval for overdue loans"
            }
          }
        },
        "holds": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending hold request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending hold request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending hold request"
            }
          }
        },
        "pages": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alternateCheckoutLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at checkout for items with active, pending page request"
            },
            "renewItemsWithRequest": {
              "type": "boolean",
              "description": "Allow renewal of items with active, pending page request"
            },
            "alternateRenewalLoanPeriod": {
              "type": "object",
              "$ref": "period.json",
              "description": "Alternate loan period at renewal for items with active, pending page request"
            }
          }
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}