<<

#

- NAME
- DESCRIPTION
- SYNOPSIS
- METHODS
  - filter
  - filter_wants
  - validate

# NAME

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

# DESCRIPTION

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

# SYNOPSIS

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

# 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`.

## 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.

<<