foliolib.folio.api.finance.Funds
- class foliolib.folio.api.finance.Funds(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiFund API
This documents the API calls that can be made to manage funds
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_fund(fundsId)Delete fund item with given {fundId}
get_budget_by_fund(fundsId)Retrieve budget item with given {budgetId}
get_expenseClasses(fundsId)Retrieve expenseClass item with given {expenseClassId}
get_fund(fundsId)Retrieve fund item with given {fundId}
get_funds(**kwargs)Retrieve a list of fund items.
modify_fund(fundsId, fund)Update fund item with given {fundId}
set_fund(fund)Create a new fund item.
- delete_fund(fundsId: str)
Delete fund item with given {fundId}
DELETE /finance/funds/{fundsId}- Parameters
fundsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_budget_by_fund(fundsId: str)
Retrieve budget item with given {budgetId}
GET /finance/funds/{fundsId}/budget- Parameters
fundsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestUnauthorized – Authentication is required
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A budget", "type": "object", "javaName": "budget", "extends": { "$ref": "../../common/schemas/entity.json" }, "properties": { "id": { "description": "UUID of this budget", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the budget", "type": "string" }, "budgetStatus": { "description": "The status of the budget", "type": "string", "enum": [ "Active", "Frozen", "Inactive", "Planned", "Closed" ] }, "allowableEncumbrance": { "description": "The encumbrance percentage limit for this budget", "type": "number" }, "allowableExpenditure": { "description": "The expenditure percentage limit for this budget", "type": "number" }, "allocated": { "description": "The amount currently allocated to this budget", "type": "number", "readonly": true }, "awaitingPayment": { "default": 0, "description": "The amount currently awaiting payment for this budget", "type": "number" }, "available": { "description": "The amount currently available for this budge", "type": "number", "readonly": true }, "encumbered": { "default": 0, "description": "The amount currently encumbered for this budget", "type": "number" }, "expenditures": { "default": 0, "description": "The amount currently expended for this budget", "type": "number" }, "netTransfers": { "default": 0, "description": "Summing all the transfers on this budget", "type": "number" }, "unavailable": { "description": "Unavailable amount for this budget", "type": "number", "readonly": true }, "overEncumbrance": { "description": "The amount currently over-encumbered for this budget", "type": "number", "readonly": true }, "overExpended": { "description": "Amount the budget is over expended.", "type": "number", "readonly": true }, "fundId": { "description": "UUID of fund", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "description": "UUID of fiscal year", "$ref": "../../common/schemas/uuid.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this budget", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this budget", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "default": 0, "description": "The amount of the first allocation made to this budget", "type": "number" }, "allocationTo": { "default": 0, "description": "The sum of all allocation transaction amounts made TO this budget not including the Initial allocation", "type": "number" }, "allocationFrom": { "default": 0, "description": "The sum of all allocation transaction amounts made FROM this budget not including the Initial allocation", "type": "number" }, "totalFunding": { "description": "budget.allocated + budget.netTransfers", "type": "number", "readonly": true }, "cashBalance": { "description": "Total Funding minus Expended", "type": "number", "readonly": true } }, "additionalProperties": false, "required": [ "budgetStatus", "name", "fundId", "fiscalYearId" ] }
- get_expenseClasses(fundsId: str)
Retrieve expenseClass item with given {expenseClassId}
GET /finance/funds/{fundsId}/expense-classes- Parameters
fundsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of expense classes", "type": "object", "properties": { "expenseClasses": { "description": "The list of expense classes objects in this collection", "type": "array", "id": "expense_classes", "items": { "type": "object", "$ref": "expense_class.json" } }, "totalRecords": { "description": "The number of objects in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "expenseClasses", "totalRecords" ] }
- get_fund(fundsId: str)
Retrieve fund item with given {fundId}
GET /finance/funds/{fundsId}- Parameters
fundsId (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 composite fund to track financial transactions", "type": "object", "properties": { "fund": { "description": "Fund to track financial transactions", "type": "object", "$ref": "fund.json" }, "groupIds": { "description": "Group ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } } }, "additionalProperties": false, "required": [ "fund" ] }
- get_funds(**kwargs)
Retrieve a list of fund items.
GET /finance/funds- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
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.
with valid searchable fields: for example code
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
[“code”, “MEDGRANT”, “=”]
- 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 funds", "type": "object", "properties": { "funds": { "description": "The list of funds contained in this collection", "type": "array", "id": "funds", "items": { "type": "object", "$ref": "fund.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer", "minimum": 0 } }, "additionalProperties": false, "required": [ "funds", "totalRecords" ] }
- modify_fund(fundsId: str, fund: dict)
Update fund item with given {fundId}
PUT /finance/funds/{fundsId}- Parameters
fundsId (str) –
fund (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#", "description": "A composite fund to track financial transactions", "type": "object", "properties": { "fund": { "description": "Fund to track financial transactions", "type": "object", "$ref": "fund.json" }, "groupIds": { "description": "Group ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } } }, "additionalProperties": false, "required": [ "fund" ] }
- set_fund(fund: dict)
Create a new fund item.
POST /finance/funds- Parameters
fund (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Headers
Location - URI to the created fund item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A composite fund to track financial transactions", "type": "object", "properties": { "fund": { "description": "Fund to track financial transactions", "type": "object", "$ref": "fund.json" }, "groupIds": { "description": "Group ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } } }, "additionalProperties": false, "required": [ "fund" ] }