The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

BZ::Client::FlagType - The API for creating, changing, and getting info on Flags

VERSION

version 4.4002

SYNOPSIS

This class provides methods for accessing and managing Flags in Bugzilla.

 my $client = BZ::Client->new( url       => $url,
                               user      => $user,
                               password  => $password );

 my %results     = BZ::Client::FlagType->get( $client, \%params );
 my $id = BZ::Client::FlagType->create( $client, \%params );
 my @updates = BZ::Client::FlagType->update( $client, \%params );

CLASS METHODS

This section lists the class methods, which are available in this module.

get

 $id = BZ::Client::FlagType->get( $client, \%params );

Get information about valid flag types that can be set for bugs and attachments.

History

Added in Bugzilla 5.0.

Parameters

You must pass a product "name" and an optional "component" name.

product

product (string) The name of a valid product.

component

component (string) An optional valid component name associated with the product.

Returns

A hash containing two keys, bug and attachment. Each key value is an array of hashes, containing the following keys:

id

id (int) An integer ID uniquely identifying this flag type.

name

name (string) The name for the flag type.

type

type (string) The target of the flag type which is either bug or attachment.

description

description (string) The description of the flag type.

values

values (array) An array of string values that the user can set on the flag type.

is_requesteeble

is_requesteeble (boolean) Users can ask specific other users to set flags of this type.

is_multiplicable

is_multiplicable (boolean) Multiple flags of this type can be set for the same bug or attachment.

Errors

106 - Product Access Denied

Either the product does not exist or you don't have access to it.

51 - Invalid Component

The component provided does not exist in the product.

create

 $id = BZ::Client::FlagType->create( $client, \%params );

This allows you to create a new Flag Type in Bugzilla.

Marked as unstable as of Bugzilla 5.0.

Added in Bugzilla 5.0.

Parameters

Some params must be set, or an error will be thrown. These params are noted as Required.

name

name (string) A short name identifying this type.

Required.

description

description (string) A comprehensive description of this type.

Required.

inclusions

inclusions (array) An array of strings or a hash containing product names, and optionally component names. If you provide a string, the flag type will be shown on all bugs in that product. If you provide a hash, the key represents the product name, and the value is the components of the product to be included.

For example:

 [ 'FooProduct',
    {
      BarProduct => [ 'C1', 'C3' ],
      BazProduct => [ 'C7' ]
    }
 ]

This flag will be added to All components of FooProduct, components C1 and C3 of BarProduct, and C7 of BazProduct.

exclusions

exclusions (array) An array of strings or hashes containing product names. This uses the same format as inclusions.

This will exclude the flag from all products and components specified.

sortkey

sortkey (int) A number between 1 and 32767 by which this type will be sorted when displayed to users in a list; ignore if you don't care what order the types appear in or if you want them to appear in alphabetical order.

is_active

is_active (boolean) Flag of this type appear in the UI and can be set.

Default is true.

is_requestable

is_requestable (boolean) Users can ask for flags of this type to be set.

Default is true.

cc_list

cc_list (array) An array of strings. If the flag type is requestable, who should receive e-mail notification of requests. This is an array of e-mail addresses which do not need to be Bugzilla logins.

is_specifically_requestable

is_specifically_requestable (boolean) Users can ask specific other users to set flags of this type as opposed to just asking the wind.

Default is true.

is_multiplicable

is_multiplicable (boolean) Multiple flags of this type can be set on the same bug.

Default is true.

grant_group

grant_group (string) The group allowed to grant/deny flags of this type (to allow all users to grant/deny these flags, select no group).

Default is no group.

request_group

request_group (string) If flags of this type are requestable, the group allowed to request them (to allow all users to request these flags, select no group). Note that the request group alone has no effect if the grant group is not defined!

Default is no group.

Returns

The ID of the newly-created group.

Errors

51 - Group Does Not Exist

The group name you entered does not exist, or you do not have access to it.

105 - Unknown component

The component does not exist for this product.

106 - Product Access Denied

Either the product does not exist or you don't have editcomponents privileges to it.

501 - Illegal Email Address

One of the e-mail address in the CC list is invalid. An e-mail in the CC list does NOT need to be a valid Bugzilla user.

1101 - Flag Type Name invalid

You must specify a non-blank name for this flag type. It must no contain spaces or commas, and must be 50 characters or less.

1102 - Flag type must have description

You must specify a description for this flag type.

1103 - Flag type CC list is invalid

The CC list must be 200 characters or less.

1104 - Flag Type Sort Key Not Valid

The sort key is not a valid number.

1105 - Flag Type Not Editable

This flag type is not available for the products you can administer. Therefore you can not edit attributes of the flag type, other than the inclusion and exclusion list.

update

 @results = BZ::Client::FlagType->update( $client, \%params );
 $results = BZ::Client::FlagType->update( $client, \%params );

This allows you to update a flag type in Bugzilla.

History

Added in Bugzilla 5.0.

Parameters

Note: The following parameters specify which products you are updating. You must set one or both of these parameters.

ids

ids (array of ints) Numeric ids of the flag types that you wish to update.

names

names (array of strings) Names of the flag types that you wish to update. If many flag types have the same name, this will change ALL of them.

Note: The following parameters specify the new values you want to set for the products you are updating.

name

name (string) A short name identifying this type.

description

description (string) A comprehensive description of this type.

inclusions

An array of strings or a hash containing product names, and optionally component names.

If you provide a string, the flag type will be shown on all bugs in that product.

If you provide a hash, the key represents the product name, and the value is the components of the product to be included.

For example:

 [ 'FooProduct',
   {
     BarProduct => [ 'C1', 'C3' ],
     BazProduct => [ 'C7' ]
   }
 ]

This flag will be added to all components of FooProduct, components C1 and C3 of BarProduct, and C7 of BazProduct.

exclusions

An array of strings or hashes containing product names.

This uses the same fromat as "inclusions".

This will exclude the flag from all products and components specified.

sortkey

sortkey (int) A number between 1 and 32767 by which this type will be sorted when displayed to users in a list; ignore if you don't care what order the types appear in or if you want them to appear in alphabetical order.

is_active

is_active (boolean) Flag of this type appear in the UI and can be set.

is_requestable

is_requestable (boolean) Users can ask for flags of this type to be set.

cc_list

cc_list (array) An array of strings. If the flag type is requestable, who should receive e-mail notification of requests. This is an array of e-mail addresses which do not need to be Bugzilla logins.

is_specifically_requestable

is_specifically_requestable (boolean) Users can ask specific other users to set flags of this type as opposed to just asking the wind.

is_multiplicable

is_multiplicable (boolean) Multiple flags of this type can be set on the same bug.

grant_group

grant_group (string) The group allowed to grant/deny flags of this type (to allow all users to grant/deny these flags, select no group).

request_group

request_group (string) If flags of this type are requestable, the group allowed to request them (to allow all users to request these flags, select no group).

Note that the request group alone has no effect if the grant group is not defined!

Returns

An array of hashes with the following fields:

id

id (int) The ID of the product that was updated.

name

name (string) The name of the product that was updated.

changes

changes (hash) The changes that were actually done on this product.

The keys are the names of the fields that were changed, and the values are a hash with two keys:

added

added (string) The value that this field was changed to.

removed

removed (string) The value that was previously set in this field.

Note that booleans will be represented with the strings 1 and 0.

Here's an example of what a return value might look like:

 [
   {
     id => 123,
     changes => {
       name => {
         removed => 'FooFlagType',
         added   => 'BarFlagType'
       },
       is_requestable => {
         removed => '1',
         added   => '0',
       }
     }
   }
 ]

Errors

51 - Group Does Not Exist

The group name you entered does not exist, or you do not have access to it.

105 - Unknown component

The component does not exist for this product.

106 - Product Access Denied

Either the product does not exist or you don't have editcomponents privileges to it.

501 - Illegal Email Address

One of the e-mail address in the CC list is invalid. An e-mail in the CC list does NOT need to be a valid Bugzilla user.

1101 - Flag Type Name invalid

You must specify a non-blank name for this flag type. It must no contain spaces or commas, and must be 50 characters or less.

1102 - Flag type must have description

You must specify a description for this flag type.

1103 - Flag type CC list is invalid

The CC list must be 200 characters or less.

1104 - Flag Type Sort Key Not Valid

The sort key is not a valid number.

1105 - Flag Type Not Editable

This flag type is not available for the products you can administer. Therefore you can not edit attributes of the flag type, other than the inclusion and exclusion list.

INSTANCE METHODS

FIXME Not yet implemented

EXCEPTION HANDLING

See BZ::Client::Exception

SEE ALSO

BZ::Client, BZ::Client::API, Bugzilla API

AUTHORS

  • Dean Hamstead <dean@bytefoundry.com.au>

  • Jochen Wiedmann <jochen.wiedmann@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Dean Hamstad.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.