-
Notifications
You must be signed in to change notification settings - Fork 1
Class GContactGroups
Full name: \SKien\Google\GContactGroups
Class to manage the contact groups of a google account.
This class encapsulates the following Google People API resources:
- contactGroups
- contactGroups.members
If one of the methods that calls the google API fails (if it returns false),
the last responsecode and furter informations can be retrieved through
following methods of the GClient instance this object was created with:
$oClient->getLastResponseCode()$oClient->getLastError()$oClient->getLastStatus()
See Also:
- \SKien\Google\GClient::getLastResponseCode()
- \SKien\Google\GClient::getLastError()
- \SKien\Google\GClient::getLastStatus()
- https://developers.google.com/people/api/rest/v1/contactGroups
- https://developers.google.com/people/api/rest/v1/contactGroups.members
| Constant | Description |
|---|---|
GF_CLIENT_DATA |
The group's client data |
GF_GROUP_TYPE |
The contact group type |
GF_MEMBER_COUNT |
The total number of contacts in the group irrespective of max members in specified in the request |
GF_METADATA |
The metadata about a contact group |
GF_NAME |
name, formattedName, resourceName |
GT_ALL_CONTACT_GROUPS |
All available contact groups (User- and system groups) |
GT_USER_CONTACT_GROUPS |
User defined contact group |
GT_SYSTEM_CONTACT_GROUPS |
System defined contact group |
DATA_LIST |
full data list |
RES_LIST |
list as associative array resourceName -> groupName |
GRP_STARRED |
system group 'starred' |
GRP_CHAT_BUDDIES |
system group 'chatBuddies' |
GRP_ALL |
system group 'all' |
GRP_MY_CONTACTS |
system group 'myContacts' |
GRP_FRIENDS |
system group 'friends' |
GRP_FAMILY |
system group 'family' |
GRP_COWORKERS |
system group 'coworkers' |
GRP_BLOCKED |
system group 'blocked' |
| Method | Description |
|---|---|
| __construct | Create an instance and pass the client to use for the API requests. |
| addContactsToGroup | Add one or more contacts to the specified group. |
| addGroupFields | Add groupFields for next request. |
| createGroup | Create a new contact group. |
| deleteGroup | Delete the contact group specified by the resourceName. |
| getGroup | Get whole group information. |
| getGroupResourceName | Get the resourceName for a named contact group. |
| list | Get the whole list of the contact groups. |
| removeContactsFromGroup | Remove one or more contacts from the specified group. |
| setPageSize | Set the pagesize for reading lists. |
| updateGroup | Update the groupName for the group specified by the resourceName. |
Create an instance and pass the client to use for the API requests.
public GContactGroups::__construct(\SKien\Google\GClient $oClient)Parameters:
| Parameter | Type | Description |
|---|---|---|
oClient |
\SKien\Google\GClient |
Add one or more contacts to the specified group.
public GContactGroups::addContactsToGroup(string $strGroupResourceName, string[] $aContactResourceNames) : array|falseParameters:
| Parameter | Type | Description |
|---|---|---|
strGroupResourceName |
string | |
aContactResourceNames |
string[] |
Return Type: array|false
See Also:
Add groupFields for next request.
public GContactGroups::addGroupFields(mixed $fields) : voidCan be called multiple and/or by passing an array of groupFields. All
const self::GF_xxxx can be specified.
Normally the groupFields parameter is left blank, which means that
all groupFields except GF_CLIENT_DATA are taken into account.
Parameters:
| Parameter | Type | Description |
|---|---|---|
fields |
mixed |
Create a new contact group.
public GContactGroups::createGroup(string $strGroupName) : array|falseThe name must be unique to the users contact groups. Attempting to create a group with a duplicate name results in a 409 response code.
Parameters:
| Parameter | Type | Description |
|---|---|---|
strGroupName |
string |
Return Type: array|false
See Also:
Delete the contact group specified by the resourceName.
public GContactGroups::deleteGroup(string $strResourceName, bool $bDeleteContacts = false) : boolIf the param $bDeleteContacts is set to true, ALL contacts that are asigned to
the group to delete will be deleted to!
Parameters:
| Parameter | Type | Description |
|---|---|---|
strResourceName |
string | |
bDeleteContacts |
bool | set to true, if all groupmembers should be deleted |
Return Type: bool
true on success, false on error.
See Also:
Get whole group information.
public GContactGroups::getGroup(string $strResourceName, int $iMaxMembers) : array|falseParameters:
| Parameter | Type | Description |
|---|---|---|
strResourceName |
string | |
iMaxMembers |
int |
Return Type: array|false
See Also:
- https://developers.google.com/people/api/rest/v1/contactGroups/get
- https://developers.google.com/people/api/rest/v1/contactGroups#ContactGroup
Get the resourceName for a named contact group.
public GContactGroups::getGroupResourceName(string $strGroupName) : string|falseIf no group with requested name found, the method will return an empty string.
Parameters:
| Parameter | Type | Description |
|---|---|---|
strGroupName |
string |
Return Type: string|false
resourceName or false in case of an error
Get the whole list of the contact groups.
public GContactGroups::list(string $strGroupType = self::GT_ALL_CONTACT_GROUPS, int $iListType = self::RES_LIST) : array|falseThe type of the groups to list (All, User or System) can be specified by the
$strGroupType parameter.
The content of the result array can be specified with the $iListType parameter.
-
self::RES_LIST: all groups as associative arrayressourceName->groupName. -
self::DATA_LIST: an array of all ContactGroup - objects.
Parameters:
| Parameter | Type | Description |
|---|---|---|
strGroupType |
string | use one of the self::GT_xxx constants |
iListType |
int | content of the result array (self::RES_LIST or self::DATA_LIST) |
Return Type: array|false
See Also:
- https://developers.google.com/people/api/rest/v1/contactGroups/list
- https://developers.google.com/people/api/rest/v1/contactGroups#ContactGroup
Remove one or more contacts from the specified group.
public GContactGroups::removeContactsFromGroup(string $strGroupResourceName, string[] $aContactResourceNames) : array|falseParameters:
| Parameter | Type | Description |
|---|---|---|
strGroupResourceName |
string | |
aContactResourceNames |
string[] |
Return Type: array|false
See Also:
Set the pagesize for reading lists.
public GContactGroups::setPageSize(int $iPageSize) : voidMay be limited to the max. pagesize for the request.
Parameters:
| Parameter | Type | Description |
|---|---|---|
iPageSize |
int |
Update the groupName for the group specified by the resourceName.
public GContactGroups::updateGroup(string $strResourceName, string $strGroupName) : array|falseThe new name must be unique to the users contact groups. Attempting to rename a group with a duplicate name results in a 409 response code.
Parameters:
| Parameter | Type | Description |
|---|---|---|
strResourceName |
string | |
strGroupName |
string |
Return Type: array|false
See Also:
build with phpDocumentor 3 using template phpdoc2githubwiki / (2023-04-26)