NAME

Bb::Collaborate::Ultra::Session::Log

DESCRIPTION

Session logging class.

EXAMPLE

    my @sessions =  Bb::Collaborate::Ultra::Session->get($connection, {contextId => $context_id});
    for my $session (@sessions) {
	print "Session: ". $session->name . "\n";
	my @logs = $session->logs({expand => 'attendees' });

	for my $log (@logs) {
	    say "\tOpened: " .(scalar localtime $log->opened);
	    for my $attendee (@{$log->attendees}) {
		my $first_join;
		my $elapsed = 0;
		for my $attendance (@{$attendee->attendance}) {
		    my $joined = $attendance->joined;
		    $first_join = $joined
			if !$first_join || $first_join > $joined;
		    $elapsed += $attendance->left - $joined;
		}
		say sprintf("\tUser %s (%s) joined at %s, stayed %d minutes", $attendee->externalUserId, $attendee->displayName, (scalar localtime $first_join), $elapsed / 60);
	    }
	    say "\tClosed: " .(scalar localtime $log->closed);
	}
    }

METHODS

This class supports the `get` method as described in https://xx-csa.bbcollab.com/documentation#Attendee-collection.

get_attendees

Returns a list of attendees for this session instance;

my @all_attendees;
my @logs = $session->get_logs;
for my $log (@logs) {
    push @all_attendees, $log->get_attendees;
}

Note: Alternatively, the expand = 'attendees'> query parameter may be set in the get_logs. This causes the server to eagerly populate the attendees in each session log.

my @all_attendees;
my @logs = $session->get_logs({expand => 'attendees' });
for my $log (@logs) {
    push @all_attendees, @{ $log->attendees };
}

This reduces the number of calls to the server, and is generally faster.