5.7.108. Bugzilla::WebService::Util

5.7.108.1. NAME

Bugzilla::WebService::Util - Utility functions used inside of the WebService code. These are not functions that can be called via the WebService.

5.7.108.2. DESCRIPTION

This is somewhat like Bugzilla::Util, but these functions are only used internally in the WebService code.

5.7.108.3. SYNOPSIS

filter({ include_fields => ['id', 'name'],
         exclude_fields => ['name'] }, $hash);
my $wants = filter_wants $params, 'field_name';
validate(@_, 'ids');

5.7.108.4. METHODS

filter

This helps implement the include_fields and exclude_fields arguments of WebService methods. Given a hash (the second argument to this subroutine), this will remove any keys that are not in include_fields and then remove any keys that are in exclude_fields.

An optional third option can be passed that prefixes the field name to allow filtering of data two or more levels deep.

For example, if you want to filter out the id key/value in components returned by Product.get, you would use the value component.id in your exclude_fieldslist.

filter_wants

Returns 1 if a filter would preserve the specified field when passing a hash to filter, 0 otherwise.

validate

This helps in the validation of parameters passed into the WebService methods. Currently it converts listed parameters into an array reference if the client only passed a single scalar value. It modifies the parameters hash in place so other parameters should be unaltered.

translate

WebService methods frequently take parameters with different names than the ones that we use internally in Bugzilla. This function takes a hashref that has field names for keys and returns a hashref with those keys renamed according to the mapping passed in with the second parameter (which is also a hashref).

params_to_objects

Creates objects of the type passed in as the second parameter, using the parameters passed to a WebService method (the first parameter to this function). Helps make life simpler for WebService methods that internally create objects via both "ids" and "names" fields. Also de-duplicates objects that were loaded by both "ids" and "names". Returns an arrayref of objects.

fix_credentials

Allows for certain parameters related to authentication such as Bugzilla_login, Bugzilla_password, and Bugzilla_token to have shorter named equivalents passed in. This function converts the shorter versions to their respective internal names.

extract_flags

Subroutine that takes a list of hashes that are potential flag changes for both bugs and attachments. Then breaks the list down into two separate lists based on if the change is to add a new flag or to update an existing flag.

5.7.108.5. Methods in need of POD

taint_data


This documentation undoubtedly has bugs; if you find some, please file them here.