[pve-devel] [PATCH manager v5 08/16] api: notification: add API for getting known metadata fields/values

Fiona Ebner f.ebner at proxmox.com
Fri Apr 19 15:45:12 CEST 2024


Am 15.04.24 um 10:26 schrieb Lukas Wagner:
> +
> +__PACKAGE__->register_method ({
> +    name => 'get_field_values',
> +    path => 'values',
> +    method => 'GET',
> +    description => 'Returns known notification metadata fields and their known values',
> +    permissions => {
> +	check => ['or',
> +	    ['perm', '/mapping/notifications', ['Mapping.Modify']],
> +	    ['perm', '/mapping/notifications', ['Mapping.Audit']],
> +	],
> +    },
> +    protected => 1,
> +    parameters => {
> +	additionalProperties => 0,
> +    },
> +    returns => {
> +	type => 'array',
> +	items => {
> +	    type => 'object',
> +	    properties => {
> +		'value' => {
> +		    description => 'Notification metadata value known by the system.',
> +		    type => 'string'
> +		},
> +		'comment' => {
> +		    description => 'Additional comment for this value.',
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		'field' => {
> +		    description => 'Field this value belongs to.',
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		'internal' => {
> +		    description => 'Set if "value" was generated by the system and can'
> +		       . ' safely be used as base for translations.',
> +		    type => 'boolean',
> +		    optional => 1,
> +		},

And wouldn't it be nicer to return already grouped by field? Then maybe
we also don't really need the dedicated fields API endpoint either as
those are just the top-level of the result (with empty array when there
are no values so we don't ever miss any fields).

> +	    },
> +	},
> +    },




More information about the pve-devel mailing list