foliolib.folio.api.settings.Settings

class foliolib.folio.api.settings.Settings(tenant: str)

Bases: foliolib.folio.FolioApi

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

deletesetting(id_)

Delete setting.

getsetting(id_)

Get setting.

getsettings()

Get settings with optional CQL query.

postsetting(entry)

Create setting entry.

putsetting(entry, id_)

Update setting.

uploadsettings(uploadRequest)

Upload settings.

deletesetting(id_)

Delete setting. If X-Okapi-Permissions includes settings.global.write, then a setting without a userId may be deleted. If X-Okapi-Permissions includes settings.users.write, then a setting with a userId may be deleted. If X-Okapi-Permissions includes settings.owner.write, then a setting with userId = current-user may be deleted.

DELETE /settings/entries/{id}

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

getsetting(id_)

Get setting. If X-Okapi-Permissions includes settings.global.read, then a setting without a userId may be retrieved. If X-Okapi-Permissions includes settings.users.read, then a setting with a userId may be retrieved. If X-Okapi-Permissions includes settings.owner.read, then a setting with userId = current-user may be retrieved.

GET /settings/entries/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestForbidden – Forbidden

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Setting",
    "type": "object",
    "properties": {
        "id": {
            "description": "Identifier",
            "type": "string",
            "format": "uuid"
        },
        "scope": {
            "type": "string",
            "description": "Scope for this entry (normally a module)"
        },
        "key": {
            "type": "string",
            "description": "Key within scope for this setting"
        },
        "value": {
            "description": "Settings value (any type)"
        },
        "userId": {
            "type": "string",
            "format": "uuid",
            "description": "Owner of this setting (optional)"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "scope",
        "key",
        "value"
    ]
}
getsettings()

Get settings with optional CQL query. If X-Okapi-Permissions includes settings.global.read then settings without a userId are returned. If X-Okapi-Permissions includes settings.users.read then settings with a userId are returned. If X-Okapi-Permissions includes settings.owner.read then settings with userId = current-user are returned.

GET /settings/entries

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Setting entries response",
    "type": "object",
    "properties": {
        "items": {
            "description": "List of settings",
            "type": "array",
            "items": {
                "description": "Setting",
                "type": "object",
                "properties": {
                    "id": {
                        "description": "Identifier",
                        "type": "string",
                        "format": "uuid"
                    },
                    "scope": {
                        "type": "string",
                        "description": "Scope for this entry (normally a module)"
                    },
                    "key": {
                        "type": "string",
                        "description": "Key within scope for this setting"
                    },
                    "value": {
                        "description": "Settings value (any type)"
                    },
                    "userId": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Owner of this setting (optional)"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "id",
                    "scope",
                    "key",
                    "value"
                ]
            }
        },
        "resultInfo": {
            "description": "Common result set information for streaming response",
            "type": "object",
            "properties": {
                "totalRecords": {
                    "description": "Total number of entries in response",
                    "type": "integer"
                },
                "diagnostics": {
                    "description": "Diagnostics for response",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "description": "single diagnostic message",
                                "type": "string"
                            }
                        }
                    }
                },
                "facets": {
                    "type": "array",
                    "description": "Array of facets",
                    "items": {
                        "type": "object",
                        "description": "A facet",
                        "properties": {
                            "facetValues": {
                                "type": "array",
                                "description": "Array of facet values",
                                "items": {
                                    "type": "object",
                                    "description": "A facet value",
                                    "properties": {
                                        "count": {
                                            "type": "integer",
                                            "description": "Count of facet values"
                                        },
                                        "value": {
                                            "description": "Value Object"
                                        }
                                    }
                                }
                            },
                            "type": {
                                "type": "string",
                                "description": "Type of facet"
                            }
                        }
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false,
    "required": [
        "items"
    ]
}
postsetting(entry)

Create setting entry. If X-Okapi-Permissions includes settings.global.write, then a setting without a userId may be created. If X-Okapi-Permissions includes settings.users.write, then a setting with a userId may be created. If X-Okapi-Permissions includes settings.owner.write, then a setting with userId = current-user may be created.

POST /settings/entries

Parameters

entry (dict) – See Schema below.

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestForbidden – Forbidden

  • OkapiRequestPayloadToLarge – Payload Too Large

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Setting",
    "type": "object",
    "properties": {
        "id": {
            "description": "Identifier",
            "type": "string",
            "format": "uuid"
        },
        "scope": {
            "type": "string",
            "description": "Scope for this entry (normally a module)"
        },
        "key": {
            "type": "string",
            "description": "Key within scope for this setting"
        },
        "value": {
            "description": "Settings value (any type)"
        },
        "userId": {
            "type": "string",
            "format": "uuid",
            "description": "Owner of this setting (optional)"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "scope",
        "key",
        "value"
    ]
}
putsetting(entry, id_)

Update setting. If X-Okapi-Permissions includes settings.global.write, then a setting without a userId may be updated. If X-Okapi-Permissions includes settings.users.write, then a setting with a userId may be updated. If X-Okapi-Permissions includes settings.owner.write, then a setting with userId = current-user may be updated.

PUT /settings/entries/{id}

Parameters

entry (dict) – See Schema below.

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestForbidden – Forbidden

  • OkapiRequestNotFound – Not Found

  • OkapiRequestPayloadToLarge – Payload Too Large

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Setting",
    "type": "object",
    "properties": {
        "id": {
            "description": "Identifier",
            "type": "string",
            "format": "uuid"
        },
        "scope": {
            "type": "string",
            "description": "Scope for this entry (normally a module)"
        },
        "key": {
            "type": "string",
            "description": "Key within scope for this setting"
        },
        "value": {
            "description": "Settings value (any type)"
        },
        "userId": {
            "type": "string",
            "format": "uuid",
            "description": "Owner of this setting (optional)"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "scope",
        "key",
        "value"
    ]
}
uploadsettings(uploadRequest)

Upload settings. The entries are inserted or updated depending on whether key, scope, userId already. Each entry gets a unique identifier assigned if it’s a new setting. The id must not be supplied. If X-Okapi-Permissions includes settings.global.write, then a setting without a userId may be created/updated. If X-Okapi-Permissions includes settings.users.write, then a setting with a userId may be created/updated. If X-Okapi-Permissions includes settings.owner.write, then a setting with userId = current-user may be created/updated.

PUT /settings/upload

Parameters

uploadRequest (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestForbidden – Forbidden

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Settings upload request body",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "scope": {
                "type": "string",
                "description": "Scope for this entry (normally a module)"
            },
            "key": {
                "type": "string",
                "description": "Key within scope for this setting"
            },
            "value": {
                "description": "Settings value (any type)"
            },
            "userId": {
                "type": "string",
                "format": "uuid",
                "description": "Owner of this setting (optional)"
            }
        },
        "additionalProperties": false,
        "required": [
            "scope",
            "key",
            "value"
        ]
    }
}
{
    "description": "Upload response",
    "type": "object",
    "properties": {
        "inserted": {
            "type": "integer",
            "description": "Number of settings inserted"
        },
        "updated": {
            "type": "integer",
            "description": "Number of settings updated"
        }
    },
    "additionalProperties": true,
    "required": [
        "inserted",
        "updated"
    ]
}