I've got a Gmail service running via the PHP API:
$client = new Google_Client();
$client->setClientId('{{CLIENT_ID}}.apps.googleusercontent.com');
$client->setRedirectUri('{{REDIRECT_URL}}');
$client->setClientSecret('{{CLIENT_SECRET}');
$client->setScopes(array('https://www.googleapis.com/auth/gmail.modify'));
$client->setAccessToken($credentials);
I then fetch (get - https://developers.google.com/gmail/api/v1/reference/users/labels/get) all labels matching a certain ID:
$service = new Google_Service_Gmail($client);
$labels = $service->users_labels->get("{{EMAIL}}", $gmail_label_id);
Which works perfectly. How can I specify a parameter to only get threads between a certain date range? Looking at the APIs Explorer I only see the ability to specify:
None of which are appropriate for what I'm trying to do.
I've looked at the Google_Service_Gmail_UsersLabels_Resource
class, specifically the get
method:
public function get($userId, $id, $optParams = array())
{
$params = array('userId' => $userId, 'id' => $id);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Gmail_Label");
}
I see that you can parse in the $optParams
variable, could this perhaps be the key?
If I understood your question correctly you want to get threads between a certain date range? I think you have to use the 'list' method and the optional parameter 'q'. To get the individual thread you then call the 'get' method.