本文整理汇总了Java中com.google.api.services.calendar.model.FreeBusyRequestItem类的典型用法代码示例。如果您正苦于以下问题:Java FreeBusyRequestItem类的具体用法?Java FreeBusyRequestItem怎么用?Java FreeBusyRequestItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FreeBusyRequestItem类属于com.google.api.services.calendar.model包,在下文中一共展示了FreeBusyRequestItem类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testQuery
import com.google.api.services.calendar.model.FreeBusyRequestItem; //导入依赖的package包/类
@Test
public void testQuery() throws Exception {
// using com.google.api.services.calendar.model.FreeBusyRequest message
// body for single parameter "content"
com.google.api.services.calendar.model.FreeBusyRequest request = new FreeBusyRequest();
List<FreeBusyRequestItem> items = new ArrayList<FreeBusyRequestItem>();
items.add(new FreeBusyRequestItem().setId(getCalendar().getId()));
request.setItems(items);
request.setTimeMin(DateTime.parseRfc3339("2014-11-10T20:45:30-00:00"));
request.setTimeMax(DateTime.parseRfc3339("2014-11-10T21:45:30-00:00"));
final com.google.api.services.calendar.model.FreeBusyResponse result = requestBody("direct://QUERY", request);
assertNotNull("query result", result);
LOG.debug("query: " + result);
}
示例2: makeFreeBusyRequest
import com.google.api.services.calendar.model.FreeBusyRequestItem; //导入依赖的package包/类
/**
* Get a list of percentages of users who are free during a given time by
* time interval
*
* @param startTime
* - start time in question
* @param endTime
* - end time in question
* @param userEmails
* - list of emails you desire to retrieve free/busy data for
* @return ordered list of percentages of users for the given list who are
* free
* @throws IOException
*/
public static FreeBusyResponse makeFreeBusyRequest(long startTimeMillis, long endTimeMillis,
List<String> userEmails) throws IOException {
// Build the calendar service
com.google.api.services.calendar.Calendar service = GoogleCalendarUtils.makeCalendarServiceInstance();
FreeBusyRequest request = new FreeBusyRequest();
request.setTimeMin(new DateTime(startTimeMillis));
request.setTimeMax(new DateTime(endTimeMillis));
// Build request items
List<FreeBusyRequestItem> requestItems = new ArrayList<FreeBusyRequestItem>();
for(String email: userEmails){
FreeBusyRequestItem item = new FreeBusyRequestItem();
item.setId(email);
requestItems.add(item);
}
request.setItems(requestItems);
return service.freebusy().query(request).execute();
}