From 2f75b68d00ec8bf732b4f0874fec302bd3262988 Mon Sep 17 00:00:00 2001 From: Koosha Khajeh Moogahi Date: Tue, 24 Jul 2012 12:35:58 -0400 Subject: Bug 697224 - Add methods to get a user's saved searches to the WebService (new "User.saved_searches" or add to User.get) r=dkl, a=LpSolit --- Bugzilla/WebService/User.pm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'Bugzilla/WebService/User.pm') diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm index 9502770de..93c0881cb 100644 --- a/Bugzilla/WebService/User.pm +++ b/Bugzilla/WebService/User.pm @@ -213,6 +213,7 @@ sub get { groups => $self->_filter_bless_groups($_->groups), email_enabled => $self->type('boolean', $_->email_enabled), login_denied_text => $self->type('string', $_->disabledtext), + saved_searches => [map { $self->_query_to_hash($_) } @{ $_->queries }], }} @$in_group; } else { @@ -224,6 +225,7 @@ sub get { email => $self->type('string', $_->email), can_login => $self->type('boolean', $_->is_enabled ? 1 : 0), groups => $self->_filter_bless_groups($_->groups), + saved_searches => [map { $self->_query_to_hash($_) } @{ $_->queries }], }} @$in_group; } @@ -283,6 +285,17 @@ sub _group_to_hash { return $item; } +sub _query_to_hash { + my ($self, $query) = @_; + my $item = { + id => $self->type('int', $query->id), + name => $self->type('string', $query->name), + url => $self->type('string', $query->url), + }; + + return $item; +} + 1; __END__ @@ -626,6 +639,34 @@ C The description for the group =back +=over + +=item saved_searches + +C An array of hashes, each of which represents a user's saved search and has +the following keys: + +=over + +=item id + +C An integer id uniquely identifying the saved search. + +=item name + +C The name of the saved search. + +=item url + +C The CGI parameters for the saved search. + +=back + +B: The elements of the returned array (i.e. hashes) are ordered by the +name of each saved search. + +=back + B: If you are not logged in to Bugzilla when you call this function, you will only be returned the C, C, and C items. If you are logged in and not in editusers group, you will only be returned the C, C, @@ -668,6 +709,8 @@ for C has changed to only returning enabled accounts. =item C Added in Bugzilla B<4.4>. +=item C Added in Bugzilla B<4.4>. + =back =back -- cgit v1.2.3-24-g4f1b