forked from chamodshehanka/BackContact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BackContact.bal
44 lines (39 loc) · 1.2 KB
/
BackContact.bal
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
44
import ballerina/io;
import marcus/gcontacts3;
import wso2/gsheets4;
import ballerina/config;
endpoint gcontacts3:Client gContactsEP {
clientConfig:{
auth:{
accessToken:config:getAsString("ACCESS_TOKEN"),
clientId:config:getAsString("CLIENT_ID"),
clientSecret:config:getAsString("CLIENT_SECRET"),
refreshToken:config:getAsString("REFRESH_TOKEN")
}
}
};
endpoint gsheets4:Client spreadsheetEP {
clientConfig:{
auth:{
clientId:config:getAsString("CLIENT_ID"),
clientSecret:config:getAsString("CLIENT_SECRET"),
refreshToken:config:getAsString("REFRESH_TOKEN")
}
}
};
function main(string... args) {
string userEmail = "default";
string[][] contactDetailsArray;
string spreadsheetId = "1YrRVHMwnHMSAsxX7zwHoOBqM3MfxP4vM1tDudblDWt8";
var response = gContactsEP -> getAllContacts(userEmail);
//var responseSpread = spreadsheetEP -> openSpreadsheetById(spreadsheetId);
match response {
xml xmlRes => {
string name = xmlRes.elements().getTextValue();
io:println(name);
}
error err => {
io:println(err);
}
}
}