foliolib.folio.api.circulation.CirculationRules
- class foliolib.folio.api.circulation.CirculationRules(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiCirculation Rules API
API for circulation Rules
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
get_loanPolicies(**kwargs)Execute circulation rules and return the loan policy that will be applied, either the matching loan policy with the highest priority or the fallback loan policy
get_loanPolicyAlls(**kwargs)Execute circulation rules and return all matching loan policies in decreasing priority and the fallback loan policy
get_lostItemPolicies(**kwargs)Execute circulation rules and return the lost item policy that will be applied, either the matching lost item policy with the highest priority or the fallback lost item policy policy
get_lostItemPolicyAlls(**kwargs)Execute circulation rules and return all matching lost item policies in decreasing priority and the fallback lost item policy
get_noticePolicies(**kwargs)Get the notice policy when applying circulation rules
get_noticePolicyAlls(**kwargs)Get notice policy for each match when applying circulation rules
get_overdueFinePolicies(**kwargs)Execute circulation rules and return the overdue fine policy that will be applied, either the matching overdue fine policy with the highest priority or the fallback overdue fine policy policy
get_overdueFinePolicyAlls(**kwargs)Execute circulation rules and return all matching overdue fine policies in decreasing priority and the fallback overdue fine policy
get_requestPolicies(**kwargs)Execute circulation rules and return the request policy that will be applied, either the matching request policy with the highest priority or the fallback request policy
get_requestPolicyAlls(**kwargs)Execute circulation rules and return all matching request policies policies in decreasing priority and the fallback request policy
Get the circulation rules
modify_rule(rule)Set the circulation rules using a text file
- get_loanPolicies(**kwargs)
Execute circulation rules and return the loan policy that will be applied, either the matching loan policy with the highest priority or the fallback loan policy
GET /circulation/rules/loan-policy- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result of applying circulation rules to determine a loan policy", "description": "Describes the outcome of applying loan rules to determine a loan policy", "type": "object", "properties": { "loanPolicyId": { "description": "ID of the loan policy determined by the circulation rules", "type": "string" }, "appliedRuleConditions": { "description": "Addition information about conditions which were present in the applied rule", "type": "object", "properties": { "materialTypeMatch": { "description": "Indicates that ItemType was present in applied rule conditions", "type": "boolean" }, "loanTypeMatch": { "description": "Indicates that LoanType was present in applied rule conditions", "type": "boolean" }, "patronGroupMatch": { "description": "Indicates that PatronGroup was present in applied rule conditions", "type": "boolean" } } } }, "additionalProperties": false, "required": [ "loanPolicyId" ] }
- get_loanPolicyAlls(**kwargs)
Execute circulation rules and return all matching loan policies in decreasing priority and the fallback loan policy
GET /circulation/rules/loan-policy-all- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
() (rules) – Circulation rules if provided, otherwise use stored circulation rules
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation policy ids schema", "description": "All rule matches from an application of the rules", "type": "object", "properties": { "ruleMatches": { "id": "ruleMatches", "description": "Set of all rule matches", "type": "array", "items": { "type": "object", "$ref": "circulation-rule-loan-policy-match.json" } } }, "additionalProperties": false, "required": [ "ruleMatches" ] }
- get_lostItemPolicies(**kwargs)
Execute circulation rules and return the lost item policy that will be applied, either the matching lost item policy with the highest priority or the fallback lost item policy policy
GET /circulation/rules/lost-item-policy- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result of applying circulation rules to determine a lost item policy", "description": "Describes the outcome of applying loan rules to determine a lost item policy", "type": "object", "properties": { "lostItemPolicyId": { "description": "ID of the lost item policy determined by the circulation rules", "type": "string", "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$" } }, "additionalProperties": false, "required": [ "lostItemPolicyId" ] }
- get_lostItemPolicyAlls(**kwargs)
Execute circulation rules and return all matching lost item policies in decreasing priority and the fallback lost item policy
GET /circulation/rules/lost-item-policy-all- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
() (rules) – Circulation rules if provided, otherwise use stored circulation rules
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation lost item policy ids schema", "description": "All rule matches from an application of the rules", "type": "object", "properties": { "ruleMatches": { "id": "ruleMatches", "description": "Set of all rule matches", "type": "array", "items": { "type": "object", "$ref": "circulation-rule-lost-item-policy-match.json" } } }, "additionalProperties": false, "required": [ "ruleMatches" ] }
- get_noticePolicies(**kwargs)
Get the notice policy when applying circulation rules
GET /circulation/rules/notice-policy- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result of applying circulation rules to determine a notice policy", "description": "Describes the outcome of applying circulation rules to determine a notice policy", "type": "object", "properties": { "noticePolicyId": { "description": "ID of the notice policy determined by the circulation rules", "type": "string" }, "appliedRuleConditions": { "description": "Addition information about conditions which were present in the applied rule", "type": "object", "properties": { "materialTypeMatch": { "description": "Indicates that ItemType was present in applied rule conditions", "type": "boolean" }, "loanTypeMatch": { "description": "Indicates that LoanType was present in applied rule conditions", "type": "boolean" }, "patronGroupMatch": { "description": "Indicates that PatronGroup was present in applied rule conditions", "type": "boolean" } } } }, "additionalProperties": false, "required": [ "noticePolicyId" ] }
- get_noticePolicyAlls(**kwargs)
Get notice policy for each match when applying circulation rules
GET /circulation/rules/notice-policy-all- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
() (rules) – Circulation rules if provided, otherwise use stored circulation rules
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation policy ids schema", "description": "All rule matches from an application of the rules", "type": "object", "properties": { "ruleMatches": { "id": "ruleMatches", "description": "Set of all rule matches", "type": "array", "items": { "type": "object", "$ref": "circulation-rule-notice-policy-match.json" } } }, "additionalProperties": false, "required": [ "ruleMatches" ] }
- get_overdueFinePolicies(**kwargs)
Execute circulation rules and return the overdue fine policy that will be applied, either the matching overdue fine policy with the highest priority or the fallback overdue fine policy policy
GET /circulation/rules/overdue-fine-policy- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result of applying circulation rules to determine a overdue fine policy", "description": "Describes the outcome of applying loan rules to determine a overdue fine policy", "type": "object", "properties": { "overdueFinePolicyId": { "description": "ID of the overdue fine policy determined by the circulation rules", "type": "string", "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$" } }, "additionalProperties": false, "required": [ "overdueFinePolicyId" ] }
- get_overdueFinePolicyAlls(**kwargs)
Execute circulation rules and return all matching overdue fine policies in decreasing priority and the fallback overdue fine policy
GET /circulation/rules/overdue-fine-policy-all- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
() (rules) – Circulation rules if provided, otherwise use stored circulation rules
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation overdue fine policy ids schema", "description": "All rule matches from an application of the rules", "type": "object", "properties": { "ruleMatches": { "id": "ruleMatches", "description": "Set of all rule matches", "type": "array", "items": { "type": "object", "$ref": "circulation-rule-overdue-fine-policy-match.json" } } }, "additionalProperties": false, "required": [ "ruleMatches" ] }
- get_requestPolicies(**kwargs)
Execute circulation rules and return the request policy that will be applied, either the matching request policy with the highest priority or the fallback request policy
GET /circulation/rules/request-policy- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result of applying circulation rules to determine a request policy", "description": "Describes the outcome of applying circulation rules to determine a request policy", "type": "object", "properties": { "requestPolicyId": { "description": "ID of the request policy determined by the circulation rules", "type": "string" }, "appliedRuleConditions": { "description": "Addition information about conditions which were present in the applied rule", "type": "object", "properties": { "materialTypeMatch": { "description": "Indicates that ItemType was present in applied rule conditions", "type": "boolean" }, "loanTypeMatch": { "description": "Indicates that LoanType was present in applied rule conditions", "type": "boolean" }, "patronGroupMatch": { "description": "Indicates that PatronGroup was present in applied rule conditions", "type": "boolean" } } } }, "additionalProperties": false, "required": [ "requestPolicyId" ] }
- get_requestPolicyAlls(**kwargs)
Execute circulation rules and return all matching request policies policies in decreasing priority and the fallback request policy
GET /circulation/rules/request-policy-all- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
item_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Item type id
loan_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Loan type id
patron_type_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Patron type id
location_id (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): Location id
() (rules) – Circulation rules if provided, otherwise use stored circulation rules
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation policy ids schema", "description": "All rule matches from an application of the rules", "type": "object", "properties": { "ruleMatches": { "id": "ruleMatches", "description": "Set of all rule matches", "type": "array", "items": { "type": "object", "$ref": "circulation-rule-request-policy-match.json" } } }, "additionalProperties": false, "required": [ "ruleMatches" ] }
- get_rules()
Get the circulation rules
GET /circulation/rules- Returns
See Schema below
- Return type
dict
- Raises
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation Rules", "description": "Circulation rules record", "type": "object", "properties": { "id": { "description": "ID of the circulation rules (should only ever be a single record)", "type": "string" }, "rulesAsText": { "description": "Circulation rules represented in text using the bespoke format", "type": "string" } }, "additionalProperties": false, "required": [ "rulesAsText" ] }
- modify_rule(rule: dict)
Set the circulation rules using a text file
PUT /circulation/rules- Parameters
rule (dict) – See Schema below
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Circulation Rules", "description": "Circulation rules record", "type": "object", "properties": { "id": { "description": "ID of the circulation rules (should only ever be a single record)", "type": "string" }, "rulesAsText": { "description": "Circulation rules represented in text using the bespoke format", "type": "string" } }, "additionalProperties": false, "required": [ "rulesAsText" ] }