我使用以下代码检索休假设置。它使用Google API PHP客户端库和Gmail API来访问gmail平台
我不知道如何安排假期。有人有这样做的示例代码吗?
public function getVacation($userToken)
{
// Get the API client and construct the service object.
$client = $this->getClient($userToken);
$service = new Google_Service_Gmail($client);
// get the vacation settings
$user = 'me';
$results = $service->users_settings->getVacation($user);
print_r($results);
}
function getClient($userToken)
{
... a method that does the connection. for some reason stackoverflow sees it as too much code, but it works :) and i get vacation info.
}
答案 0 :(得分:0)
您应该考虑使用https://www.npmjs.com/package/nano#dbfindselector-callback
$results = $service->users_settings->getVacation("me");
$results->responseSubject = 'Out of Office.';
$results = $service->users_settings->updateVacation("me", $results);