Could someone give a simple example of how to create a new contact. I can authorize and get the existing contacts. But I have searched and searched tried php examples that don't work. All I can find at https://developers.google.com/people/v1/write-people#create-a-new-contact is this Java Code:
Person contactToCreate = new Person();
List names = new ArrayList<>();
names.add(new Name().setGivenName("John").setFamilyName("Doe"));
contactToCreate.setNames(names);
Person createdContact = peopleService.people().createContact(contactToCreate).execute();
I can figure out the first and last line to convert to php. But I am confused as to how to configure the Array setting the GivenName and FamilyName.
UPDATE: This works, but it seems like the long way. Any suggestions would be appreciated! Hope this helps someone else. I learn so much from stackoverflow experts!
$people_service = new Google_Service_PeopleService($gClient);
$person = new Google_Service_PeopleService_Person();
$email1 = new Google_Service_PeopleService_EmailAddress();
$email1->setValue('test@example.com');
$person->setEmailAddresses($email1);
$name = new Google_Service_PeopleService_Name();
$name->setGivenName('firstName');
$name->setFamilyName('lastName');
$person->setNames($name);
$exe = $people_service->people->createContact($person)->execute;