Объект Google_Service_Calendar_FreeBusyResponsePhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Объект Google_Service_Calendar_FreeBusyResponse

Сообщение Anonymous »

Я использую учетную запись службы freebusy api Oauth2 и получаю следующий результат. Массив «Всегда занят» становится пустым, хотя я создал в своем календаре несколько событий. в чем может быть проблема

MyCode:

$items_arr = [
"xxxxx.com_3434343434xxxxxgb6oqjge1g6cpjed9g74@resource.calendar.google.com"
,
"xxxxx.com_454544dfdfv7v9q6gb6cpjacpg6kp36dpo6c@resource.calendar.google.com"

];

putenv('GOOGLE_APPLICATION_CREDENTIALS=meeting-room-app-4423234xx-5f984f6e1xew3634ds3rdtsdeeqdfe.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Calendar::CALENDAR);
$client->addScope(Google_Service_Calendar::CALENDAR_READONLY);

$service = new Google_Service_Calendar($client);

$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {

$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);

array_push($fnlItems, $item);
}

$timezone = "IST";
$freebusy_req = new Google_Service_Calendar_FreeBusyRequest();
$freebusy_req->setTimeMin(date(DateTime::ATOM, strtotime('2020-01-01T08:00:00.000Z')));
$freebusy_req->setTimeMax(date(DateTime::ATOM, strtotime('2020-01-31T17:00:00.000Z')));
$freebusy_req->setTimeZone($timezone);
$freebusy_req->setCalendarExpansionMax(10);
$freebusy_req->setGroupExpansionMax(10);

//$item='';
$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {
$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);
array_push($fnlItems, $item);
}
$freebusy_req->setItems($fnlItems);
$results = $service->freebusy->query($freebusy_req);

// $response = $sqladmin->instances
// ->listInstances('meeting-room-app-265703')->getItems();

print_r($results); die;


Ниже приведен результат:

Google_Service_Calendar_FreeBusyResponse Object
(
[calendarsType:protected] => Google_Service_Calendar_FreeBusyCalendar
[calendarsDataType:protected] => map`enter code here`
[groupsType:protected] => Google_Service_Calendar_FreeBusyGroup
[groupsDataType:protected] => map
[kind] => calendar#freeBusy
[timeMax] => 2020-01-31T18:29:59.000Z
[timeMin] => 2019-01-01T18:30:00.000Z
[internal_gapi_mappings:protected] => Array
(
)

[modelData:protected] => Array
(
[calendars] => Array
(
[xxxxx.com_188dql9c1ap8ssdqhvdfdsds1gb7ddr55aufhr726gb@resource.calendar.google.com] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => global
[reason] => notFound
)

)

[busy] => Array
(
)
)


Подробнее здесь: https://stackoverflow.com/questions/598 ... nse-object
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»