@@ -50,9 +50,9 @@ function login() {
50
50
/**
51
51
* Displays a modal dialog with a simple HTML link that opens in a new tab.
52
52
*
53
- * @param url the URL to link to
54
- * @param message the message to display to the user as a link
55
- * @param title the title of the dialog
53
+ * @param { string } url the URL to link to
54
+ * @param { string } message the message to display to the user as a link
55
+ * @param { string } title the title of the dialog
56
56
*/
57
57
function showLinkDialog ( url , message , title ) {
58
58
var template = HtmlService . createTemplateFromFile ( 'LinkDialog' ) ;
@@ -64,6 +64,8 @@ function showLinkDialog(url, message, title) {
64
64
/**
65
65
* Creates a Salesforce OAuth2 service, using the Apps Script OAuth2 library:
66
66
* https://github.com/gsuitedevs/apps-script-oauth2
67
+ *
68
+ * @return {Object } a Salesforce OAuth2 service
67
69
*/
68
70
function getSalesforceService ( ) {
69
71
return OAuth2 . createService ( 'salesforce' )
@@ -73,12 +75,15 @@ function getSalesforceService() {
73
75
. setClientId ( SALESFORCE_CLIENT_ID )
74
76
. setClientSecret ( SALESFORCE_CLIENT_SECRET )
75
77
. setCallbackFunction ( 'authCallback' )
76
- . setPropertyStore ( PropertiesService . getUserProperties ( ) )
78
+ . setPropertyStore ( PropertiesService . getUserProperties ( ) ) ;
77
79
}
78
80
79
81
/**
80
82
* Authentication callback for OAuth2: called when Salesforce redirects back to
81
83
* Apps Script after sign-in.
84
+ *
85
+ * @param {Object } request the HTTP request, provided by Apps Script
86
+ * @return {Object } HTMLOutput to render the callback as a web page
82
87
*/
83
88
function authCallback ( request ) {
84
89
var salesforce = getSalesforceService ( ) ;
@@ -109,7 +114,7 @@ function promptQuery() {
109
114
/**
110
115
* Executes the given SOQL query and copies its results to a new sheet.
111
116
*
112
- * @param query the SOQL to execute
117
+ * @param { string } query the SOQL to execute
113
118
*/
114
119
function executeQuery ( query ) {
115
120
var response = fetchSoqlResults ( query ) ;
@@ -139,8 +144,8 @@ function executeQuery(query) {
139
144
/**
140
145
* Makes an API call to Salesforce to execute a given SOQL query.
141
146
*
142
- * @param query the SOQL query to execute
143
- * @return the API response from Salesforce, as a parsed JSON object.
147
+ * @param { string } query the SOQL query to execute
148
+ * @return { Object } the API response from Salesforce, as a parsed JSON object.
144
149
*/
145
150
function fetchSoqlResults ( query ) {
146
151
var salesforce = getSalesforceService ( ) ;
@@ -151,8 +156,8 @@ function fetchSoqlResults(query) {
151
156
'headers' : {
152
157
'Authorization' : 'Bearer ' + salesforce . getAccessToken ( ) ,
153
158
'Content-Type' : 'application/json'
154
- } ,
155
- }
159
+ }
160
+ } ;
156
161
var url = 'https://' + SALESFORCE_INSTANCE +
157
162
'.salesforce.com/services/data/v30.0/query' ;
158
163
var response = UrlFetchApp . fetch ( url +
@@ -165,8 +170,8 @@ function fetchSoqlResults(query) {
165
170
* Parses the Salesforce response and extracts the list of field names in the
166
171
* result set.
167
172
*
168
- * @param record a single Salesforce response record
169
- * @return an array of string keys of that record
173
+ * @param { Object } record a single Salesforce response record
174
+ * @return { Array<string> } an array of string keys of that record
170
175
*/
171
176
function getFields ( record ) {
172
177
var fields = [ ] ;
@@ -180,6 +185,5 @@ function getFields(record) {
180
185
181
186
/** Resets the Salesforce service, removing any saved OAuth tokens. */
182
187
function logout ( ) {
183
- var salesforce = getSalesforceService ( ) ;
184
- salesforce . reset ( ) ;
188
+ getSalesforceService ( ) . reset ( ) ;
185
189
}
0 commit comments