foliolib.folio.api.financeStorage.Fund
- class foliolib.folio.api.financeStorage.Fund(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApimod-finance-storage (Funds)
CRUD APIs used 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_fund(fundsId)Retrieve fund item with given {fundId}
get_funds(**kwargs)Get list of funds
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-storage/funds/{fundsId}- Parameters
fundsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_fund(fundsId: str)
Retrieve fund item with given {fundId}
GET /finance-storage/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 fund to track financial transactions", "type": "object", "properties": { "id": { "description": "UUID of this fund", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "allocatedFromIds": { "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to receive money from", "$ref": "../../common/schemas/uuid.json" } }, "allocatedToIds": { "description": "All the funds that this fund is allowed to send money to. This could be one or many.", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to send money to", "$ref": "../../common/schemas/uuid.json" } }, "code": { "description": "A unique code associated with the fund", "$ref": "../../common/schemas/fund_code.json" }, "description": { "description": "The description of this fund", "type": "string" }, "externalAccountNo": { "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.", "type": "string" }, "fundStatus": { "description": "The current status of this fund", "type": "string", "enum": [ "Active", "Frozen", "Inactive" ] }, "fundTypeId": { "description": "UUID of the fund type associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "ledgerId": { "description": "UUID of the financial ledger associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "name": { "description": "The name of this fund", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this fund", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "description": "Metadata about creation and changes to record, provided by the server (client should not provide)", "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "code", "fundStatus", "ledgerId", "name" ] }
- get_funds(**kwargs)
Get list of funds
GET /finance-storage/funds- 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: 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”, “=”]
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
- 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-storage/funds/{fundsId}- Parameters
fundsId (str) –
fund (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 fund to track financial transactions", "type": "object", "properties": { "id": { "description": "UUID of this fund", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "allocatedFromIds": { "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to receive money from", "$ref": "../../common/schemas/uuid.json" } }, "allocatedToIds": { "description": "All the funds that this fund is allowed to send money to. This could be one or many.", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to send money to", "$ref": "../../common/schemas/uuid.json" } }, "code": { "description": "A unique code associated with the fund", "$ref": "../../common/schemas/fund_code.json" }, "description": { "description": "The description of this fund", "type": "string" }, "externalAccountNo": { "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.", "type": "string" }, "fundStatus": { "description": "The current status of this fund", "type": "string", "enum": [ "Active", "Frozen", "Inactive" ] }, "fundTypeId": { "description": "UUID of the fund type associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "ledgerId": { "description": "UUID of the financial ledger associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "name": { "description": "The name of this fund", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this fund", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "description": "Metadata about creation and changes to record, provided by the server (client should not provide)", "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "code", "fundStatus", "ledgerId", "name" ] }
- set_fund(fund: dict)
Create a new fund item.
POST /finance-storage/funds- Parameters
fund (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created fund item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A fund to track financial transactions", "type": "object", "properties": { "id": { "description": "UUID of this fund", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "allocatedFromIds": { "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to receive money from", "$ref": "../../common/schemas/uuid.json" } }, "allocatedToIds": { "description": "All the funds that this fund is allowed to send money to. This could be one or many.", "type": "array", "items": { "description": "UUID of the fund this fund is allowed to send money to", "$ref": "../../common/schemas/uuid.json" } }, "code": { "description": "A unique code associated with the fund", "$ref": "../../common/schemas/fund_code.json" }, "description": { "description": "The description of this fund", "type": "string" }, "externalAccountNo": { "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.", "type": "string" }, "fundStatus": { "description": "The current status of this fund", "type": "string", "enum": [ "Active", "Frozen", "Inactive" ] }, "fundTypeId": { "description": "UUID of the fund type associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "ledgerId": { "description": "UUID of the financial ledger associated with this fund", "$ref": "../../common/schemas/uuid.json" }, "name": { "description": "The name of this fund", "type": "string" }, "acqUnitIds": { "description": "acquisition unit ids associated with this fund", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this fund", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "description": "Metadata about creation and changes to record, provided by the server (client should not provide)", "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "code", "fundStatus", "ledgerId", "name" ] }