foliolib.folio.api.settings.Settings
- class foliolib.folio.api.settings.Settings(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApi- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
deletesetting(id_)Delete setting.
getsetting(id_)Get setting.
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
OkapiFatalError – 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
OkapiFatalError – 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
OkapiFatalError – Internal error
Schema
{ "description": "Setting entries response", "type": "object", "properties": { "items": { "description": "List of settings", "type": "array", "items": { "type": "object", "$ref": "entry.json" } }, "resultInfo": { "description": "Common result set information", "type": "object", "$ref": "resultInfo.json" } }, "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
OkapiFatalError – 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
OkapiFatalError – 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
OkapiFatalError – 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" ] }