Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rt::client::rest::attachment(3pm) [debian man page]

RT::Client::REST::Attachment(3pm)			User Contributed Perl Documentation			 RT::Client::REST::Attachment(3pm)

NAME
RT::Client::REST::Attachment -- this object represents an attachment. SYNOPSIS
my $attachments = $ticket->attachments; my $count = $attachments->count; print "There are $count attachments. "; my $iterator = $attachments->get_iterator; while (my $att = &$iterator) { print "Id: ", $att->id, "; Subject: ", $att->subject, " "; } DESCRIPTION
An attachment is a second-class citizen, as it does not exist (at least from the current REST protocol implementation) by itself. At the moment, it is always associated with a ticket (see parent_id attribute). Thus, you will rarely retrieve an attachment by itself; instead, you should use "attachments()" method of RT::Client::REST::Ticket object to get an iterator for all attachments for that ticket. ATTRIBUTES
id Numeric ID of the attachment. creator_id Numeric ID of the user who created the attachment. parent_id Numeric ID of the object the attachment is associated with. This is not a proper attribute of the attachment as specified by REST -- it is simply to store the ID of the RT::Client::REST::Ticket object this attachment belongs to. subject Subject of the attachment. content_type Content type. file_name File name (if any). transaction_id Numeric ID of the RT::Client::REST::Transaction object this attachment is associated with. message_id Message ID. created Time when the attachment was created content Actual content of the attachment. headers Headers (not parsed), if any. parent Parent (not sure what this is yet). content_encoding Content encoding, if any. METHODS
RT::Client::REST::Attachment is a read-only object, so you cannot "store()" it. Also, because it is a second-class citizen, you cannot "search()" or "count()" it -- use "attachments()" method provided by RT::Client::REST::Ticket. retrieve To retrieve an attachment, attributes id and parent_id must be set. INTERNAL METHODS
rt_type Returns 'attachment'. SEE ALSO
RT::Client::REST::Ticket, RT::Client::REST::SearchResult. AUTHOR
Dmitri Tikhonov <dtikhonov@yahoo.com> LICENSE
Perl license with the exception of RT::Client::REST, which is GPLed. perl v5.14.2 2011-12-27 RT::Client::REST::Attachment(3pm)

Check Out this Related Man Page

RT::Client::REST::SearchResult(3pm)			User Contributed Perl Documentation		       RT::Client::REST::SearchResult(3pm)

NAME
RT::Client::REST::SearchResult -- Search results representation. SYNOPSIS
my $iterator = $search->get_iterator; my $count = $iterator->count; while (defined(my $obj = &$iterator)) { # do something with the $obj } DESCRIPTION
This class is a representation of a search result. This is the type of the object you get back when you call method "search()" on RT::Client::REST::Object-derived objects. It makes it easy to iterate over results and find out just how many there are. METHODS
count Returns the number of search results. This number will always be the same unless you stick your fat dirty fingers into the object and abuse it. This number is not affected by calls to "get_iterator()". get_iterator Returns a reference to a subroutine which is used to iterate over the results. Evaluating it in scalar context, returns the next object or "undef" if all the results have already been iterated over. Note that for each object to be instantiated with correct values, retrieve() method is called on the object before returning it to the caller. Evaluating the subroutine reference in list context returns a list of all results fully instantiated. WARNING: this may be expensive, as each object is issued retrieve() method. Subsequent calls to the iterator result in empty list. You may safely mix calling the iterator in scalar and list context. For example: $iterator = $search->get_iterator; $first = &$iterator; $second = &$iterator; @the_rest = &$iterator; You can get as many iterators as you want -- they will not step on each other's toes. new You should not have to call it yourself, but just for the sake of completeness, here are the arguments: my $search = RT::Client::REST::SearchResult->new( ids => [1 .. 10], object => sub { # Yup, that's a closure. RT::Client::REST::Ticket->new( id => shift, rt => $rt, ); }, ); SEE ALSO
RT::Client::REST::Object, RT::Client::REST. AUTHOR
Dmitri Tikhonov <dtikhonov@yahoo.com> perl v5.14.2 2011-12-27 RT::Client::REST::SearchResult(3pm)
Man Page