foliolib.folio.api.financeStorage.Budget

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

Bases: foliolib.folio.FolioApi

mod-finance-storage (Budgets)

CRUD APIs used to manage budgets.

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_budget(budgetsId)

Delete budget item with given {budgetId}

get_budget(budgetsId)

Retrieve budget item with given {budgetId}

get_budgets(**kwargs)

Get list of budgets

modify_budget(budgetsId, budget)

Update budget item with given {budgetId}

set_budget(budget)

Create a new budget item.

delete_budget(budgetsId: str)

Delete budget item with given {budgetId}

DELETE /finance-storage/budgets/{budgetsId}

Parameters

budgetsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_budget(budgetsId: str)

Retrieve budget item with given {budgetId}

GET /finance-storage/budgets/{budgetsId}

Parameters

budgetsId (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 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_budgets(**kwargs)

Get list of budgets

GET /finance-storage/budgets

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: e.g.

    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 budgets",
  "type": "object",
  "properties": {
    "budgets": {
      "description": "The list of budget objects contained in this collection",
      "type": "array",
      "id": "budgets",
      "items": {
        "type": "object",
        "$ref": "budget.json"
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "budgets",
    "totalRecords"
  ]
}
modify_budget(budgetsId: str, budget: dict)

Update budget item with given {budgetId}

PUT /finance-storage/budgets/{budgetsId}

Parameters
  • budgetsId (str) –

  • budget (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 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"
  ]
}
set_budget(budget: dict)

Create a new budget item.

POST /finance-storage/budgets

Parameters

budget (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

Headers

  • Location - URI to the created budget item

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"
  ]
}