Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

requincreative's avatar

Help with Google API Client Wrapper

I am hoping that someone can help me with the Google API Client Wrapper package from pulkitjalan/google-apiclient (https://github.com/pulkitjalan/google-apiclient)

We are a Google Suite organization and I am trying to use the Directory Service to return data about ChromeOS Devices that are enrolled in our organization.

So far I have the following which seems to be working:

 $config = config('google');

    $scopes = [
        'https://www.googleapis.com/auth/admin.directory.device.chromeos',
    ];

    $googleClient = Google::getClient();
    $googleClient->setSubject('[email protected]');  // 
    $googleClient->setAuthConfig($config['service']['file']);
    $googleClient->setAccessType('online');
    $googleClient->setScopes($scopes);

    $directoryService = Google::make('directory');
     dd($directoryService);
  

Which returns the following:

Google_Service_Directory {#275 ▼
  +asps: Google_Service_Directory_Resource_Asps {#276 ▶}
  +channels: Google_Service_Directory_Resource_Channels {#277 ▶}
  +chromeosdevices: Google_Service_Directory_Resource_Chromeosdevices {#278 ▶}
  +customer_devices_chromeos: Google_Service_Directory_Resource_CustomerDevicesChromeos {#279 ▶}
  +customer_devices_chromeos_commands: Google_Service_Directory_Resource_CustomerDevicesChromeosCommands {#280 ▶}
  +customers: Google_Service_Directory_Resource_Customers {#281 ▶}
  +customers_chrome_printers: Google_Service_Directory_Resource_CustomersChromePrinters {#282 ▶}
  +domainAliases: Google_Service_Directory_Resource_DomainAliases {#283 ▶}
  +domains: Google_Service_Directory_Resource_Domains {#284 ▶}
  +groups: Google_Service_Directory_Resource_Groups {#285 ▶}
  +groups_aliases: Google_Service_Directory_Resource_GroupsAliases {#286 ▶}
  +members: Google_Service_Directory_Resource_Members {#287 ▶}
  +mobiledevices: Google_Service_Directory_Resource_Mobiledevices {#288 ▶}
  +orgunits: Google_Service_Directory_Resource_Orgunits {#289 ▶}
  +privileges: Google_Service_Directory_Resource_Privileges {#290 ▶}
  +resources_buildings: Google_Service_Directory_Resource_ResourcesBuildings {#291 ▶}
  +resources_calendars: Google_Service_Directory_Resource_ResourcesCalendars {#292 ▶}
  +resources_features: Google_Service_Directory_Resource_ResourcesFeatures {#293 ▶}
  +roleAssignments: Google_Service_Directory_Resource_RoleAssignments {#294 ▶}
  +roles: Google_Service_Directory_Resource_Roles {#295 ▶}
  +schemas: Google_Service_Directory_Resource_Schemas {#296 ▶}
  +tokens: Google_Service_Directory_Resource_Tokens {#297 ▶}
  +twoStepVerification: Google_Service_Directory_Resource_TwoStepVerification {#298 ▶}
  +users: Google_Service_Directory_Resource_Users {#299 ▶}
  +users_aliases: Google_Service_Directory_Resource_UsersAliases {#300 ▶}
  +users_photos: Google_Service_Directory_Resource_UsersPhotos {#301 ▶}
  +verificationCodes: Google_Service_Directory_Resource_VerificationCodes {#302 ▶}
  +batchPath: "batch"
  +rootUrl: "https://admin.googleapis.com/"
  +version: "directory_v1"
  +servicePath: ""
  +availableScopes: null
  +resource: null
  -client: Google\Client {#265 ▶}
  +"serviceName": "admin"
}

I need to run a query using my customerID and the device serial number and have it return a the ChromeOSDevice object with the necessary data about that device similar to what is available here: https://developers.google.com/admin-sdk/directory/reference/rest/v1/chromeosdevices/get

I just don't know where to get started with this package as there aren't many examples to get me oriented.

Thank you

0 likes
0 replies

Please or to participate in this conversation.