-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogleaccess_getcontact.cpp
43 lines (36 loc) · 1.15 KB
/
googleaccess_getcontact.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//=====================================================================================================
//
// Public: GoogleAccess - getContact
//
// DESCRIPTION:
//
// Retrieves contact
//
// PARAMETERS:
//
// googlecontact - The contact structure to store update
//
// API CALLS:
//
// https://people.googleapis.com/v1/contactGroups/ID (Get)
//
#include "googleaccess.h"
#include "../Lib/supportfunctions.h"
#include <QUrl>
#include <QJsonDocument>
#include <QJsonValueRef>
#include <QJsonObject>
#include <QJsonArray>
bool GoogleAccess::getContact(Contact& googlecontact, bool getgrouponly)
{
bool success=true ;
QString verifyurl = "https://people.googleapis.com/v1/" + googlecontact.getField(Contact::GoogleRecordId) + "?personFields=" + (getgrouponly?GROUPPERSONFIELDS:READPERSONFIELDS) ;
QString verifyjsonresponse ;
verifyjsonresponse = googleGet(verifyurl, (getgrouponly?"getContact(Groups)":"getContact")) ;
if (!getNetworkError().isEmpty()) { success=false ; }
if (success) {
QString tag="" ;
if (!parseContact(verifyjsonresponse, tag, googlecontact)) { success=false ; }
}
return success ;
}