Skip to content

Commit 630db1f

Browse files
authored
Add non-nullable modifier to return type of functions never returning null (#226)
1 parent d96c451 commit 630db1f

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/Service.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Service_.LOCK_EXPIRATION_MILLISECONDS_ = 30 * 1000;
5656
* this URL should be
5757
* https://accounts.google.com/o/oauth2/auth.
5858
* @param {string} authorizationBaseUrl The authorization endpoint base URL.
59-
* @return {Service_} This service, for chaining.
59+
* @return {!Service_} This service, for chaining.
6060
*/
6161
Service_.prototype.setAuthorizationBaseUrl = function(authorizationBaseUrl) {
6262
this.authorizationBaseUrl_ = authorizationBaseUrl;
@@ -67,7 +67,7 @@ Service_.prototype.setAuthorizationBaseUrl = function(authorizationBaseUrl) {
6767
* Sets the service's token URL (required). For Google services this URL should
6868
* be https://accounts.google.com/o/oauth2/token.
6969
* @param {string} tokenUrl The token endpoint URL.
70-
* @return {Service_} This service, for chaining.
70+
* @return {!Service_} This service, for chaining.
7171
*/
7272
Service_.prototype.setTokenUrl = function(tokenUrl) {
7373
this.tokenUrl_ = tokenUrl;
@@ -78,7 +78,7 @@ Service_.prototype.setTokenUrl = function(tokenUrl) {
7878
* Sets the service's refresh URL. Some OAuth providers require a different URL
7979
* to be used when generating access tokens from a refresh token.
8080
* @param {string} refreshUrl The refresh endpoint URL.
81-
* @return {Service_} This service, for chaining.
81+
* @return {!Service_} This service, for chaining.
8282
*/
8383
Service_.prototype.setRefreshUrl = function(refreshUrl) {
8484
this.refreshUrl_ = refreshUrl;
@@ -88,7 +88,7 @@ Service_.prototype.setRefreshUrl = function(refreshUrl) {
8888
/**
8989
* Sets the format of the returned token. Default: OAuth2.TOKEN_FORMAT.JSON.
9090
* @param {OAuth2.TOKEN_FORMAT} tokenFormat The format of the returned token.
91-
* @return {Service_} This service, for chaining.
91+
* @return {!Service_} This service, for chaining.
9292
*/
9393
Service_.prototype.setTokenFormat = function(tokenFormat) {
9494
this.tokenFormat_ = tokenFormat;
@@ -99,7 +99,7 @@ Service_.prototype.setTokenFormat = function(tokenFormat) {
9999
* Sets the additional HTTP headers that should be sent when retrieving or
100100
* refreshing the access token.
101101
* @param {Object.<string,string>} tokenHeaders A map of header names to values.
102-
* @return {Service_} This service, for chaining.
102+
* @return {!Service_} This service, for chaining.
103103
*/
104104
Service_.prototype.setTokenHeaders = function(tokenHeaders) {
105105
this.tokenHeaders_ = tokenHeaders;
@@ -123,7 +123,7 @@ Service_.prototype.setTokenHeaders = function(tokenHeaders) {
123123
* request.
124124
* @param {tokenHandler} tokenHandler tokenHandler A function to invoke on the
125125
* payload of the request for an access token.
126-
* @return {Service_} This service, for chaining.
126+
* @return {!Service_} This service, for chaining.
127127
*/
128128
Service_.prototype.setTokenPayloadHandler = function(tokenHandler) {
129129
this.tokenPayloadHandler_ = tokenHandler;
@@ -137,7 +137,7 @@ Service_.prototype.setTokenPayloadHandler = function(tokenHandler) {
137137
* which should be passed to this service's <code>handleCallback()</code> method
138138
* to complete the process.
139139
* @param {string} callbackFunctionName The name of the callback function.
140-
* @return {Service_} This service, for chaining.
140+
* @return {!Service_} This service, for chaining.
141141
*/
142142
Service_.prototype.setCallbackFunction = function(callbackFunctionName) {
143143
this.callbackFunctionName_ = callbackFunctionName;
@@ -154,7 +154,7 @@ Service_.prototype.setCallbackFunction = function(callbackFunctionName) {
154154
* the Script Editor, and then click on the link "Google Developers Console" in
155155
* the resulting dialog.
156156
* @param {string} clientId The client ID to use for the OAuth flow.
157-
* @return {Service_} This service, for chaining.
157+
* @return {!Service_} This service, for chaining.
158158
*/
159159
Service_.prototype.setClientId = function(clientId) {
160160
this.clientId_ = clientId;
@@ -166,7 +166,7 @@ Service_.prototype.setClientId = function(clientId) {
166166
* documentation for <code>setClientId()</code> for more information on how to
167167
* create client IDs and secrets.
168168
* @param {string} clientSecret The client secret to use for the OAuth flow.
169-
* @return {Service_} This service, for chaining.
169+
* @return {!Service_} This service, for chaining.
170170
*/
171171
Service_.prototype.setClientSecret = function(clientSecret) {
172172
this.clientSecret_ = clientSecret;
@@ -179,7 +179,7 @@ Service_.prototype.setClientSecret = function(clientSecret) {
179179
* may be appropriate if you want to share access across users.
180180
* @param {PropertiesService.Properties} propertyStore The property store to use
181181
* when persisting credentials.
182-
* @return {Service_} This service, for chaining.
182+
* @return {!Service_} This service, for chaining.
183183
* @see https://developers.google.com/apps-script/reference/properties/
184184
*/
185185
Service_.prototype.setPropertyStore = function(propertyStore) {
@@ -194,7 +194,7 @@ Service_.prototype.setPropertyStore = function(propertyStore) {
194194
* may be appropriate if you want to share access across users.
195195
* @param {CacheService.Cache} cache The cache to use when persisting
196196
* credentials.
197-
* @return {Service_} This service, for chaining.
197+
* @return {!Service_} This service, for chaining.
198198
* @see https://developers.google.com/apps-script/reference/cache/
199199
*/
200200
Service_.prototype.setCache = function(cache) {
@@ -208,7 +208,7 @@ Service_.prototype.setCache = function(cache) {
208208
* stored credentials at a time. This can prevent race conditions that arise
209209
* when two executions attempt to refresh an expired token.
210210
* @param {LockService.Lock} lock The lock to use when accessing credentials.
211-
* @return {Service_} This service, for chaining.
211+
* @return {!Service_} This service, for chaining.
212212
* @see https://developers.google.com/apps-script/reference/lock/
213213
*/
214214
Service_.prototype.setLock = function(lock) {
@@ -223,7 +223,7 @@ Service_.prototype.setLock = function(lock) {
223223
* @param {string|Array.<string>} scope The scope or scopes to request.
224224
* @param {string} [optSeparator] The optional separator to use when joining
225225
* multiple scopes. Default: space.
226-
* @return {Service_} This service, for chaining.
226+
* @return {!Service_} This service, for chaining.
227227
*/
228228
Service_.prototype.setScope = function(scope, optSeparator) {
229229
var separator = optSeparator || ' ';
@@ -237,7 +237,7 @@ Service_.prototype.setScope = function(scope, optSeparator) {
237237
* on what parameter values they support.
238238
* @param {string} name The parameter name.
239239
* @param {string} value The parameter value.
240-
* @return {Service_} This service, for chaining.
240+
* @return {!Service_} This service, for chaining.
241241
*/
242242
Service_.prototype.setParam = function(name, value) {
243243
this.params_[name] = value;
@@ -247,7 +247,7 @@ Service_.prototype.setParam = function(name, value) {
247247
/**
248248
* Sets the private key to use for Service Account authorization.
249249
* @param {string} privateKey The private key.
250-
* @return {Service_} This service, for chaining.
250+
* @return {!Service_} This service, for chaining.
251251
*/
252252
Service_.prototype.setPrivateKey = function(privateKey) {
253253
this.privateKey_ = privateKey;
@@ -258,7 +258,7 @@ Service_.prototype.setPrivateKey = function(privateKey) {
258258
* Sets the issuer (iss) value to use for Service Account authorization.
259259
* If not set the client ID will be used instead.
260260
* @param {string} issuer This issuer value
261-
* @return {Service_} This service, for chaining.
261+
* @return {!Service_} This service, for chaining.
262262
*/
263263
Service_.prototype.setIssuer = function(issuer) {
264264
this.issuer_ = issuer;
@@ -269,7 +269,7 @@ Service_.prototype.setIssuer = function(issuer) {
269269
* Sets additional JWT claims to use for Service Account authorization.
270270
* @param {Object.<string,string>} additionalClaims The additional claims, as
271271
* key-value pairs.
272-
* @return {Service_} This service, for chaining.
272+
* @return {!Service_} This service, for chaining.
273273
*/
274274
Service_.prototype.setAdditionalClaims = function(additionalClaims) {
275275
this.additionalClaims_ = additionalClaims;
@@ -279,7 +279,7 @@ Service_.prototype.setAdditionalClaims = function(additionalClaims) {
279279
/**
280280
* Sets the subject (sub) value to use for Service Account authorization.
281281
* @param {string} subject This subject value
282-
* @return {Service_} This service, for chaining.
282+
* @return {!Service_} This service, for chaining.
283283
*/
284284
Service_.prototype.setSubject = function(subject) {
285285
this.subject_ = subject;
@@ -290,7 +290,7 @@ Service_.prototype.setSubject = function(subject) {
290290
* Sets number of minutes that a token obtained through Service Account
291291
* authorization should be valid. Default: 60 minutes.
292292
* @param {string} expirationMinutes The expiration duration in minutes.
293-
* @return {Service_} This service, for chaining.
293+
* @return {!Service_} This service, for chaining.
294294
*/
295295
Service_.prototype.setExpirationMinutes = function(expirationMinutes) {
296296
this.expirationMinutes_ = expirationMinutes;
@@ -304,7 +304,7 @@ Service_.prototype.setExpirationMinutes = function(expirationMinutes) {
304304
* it to "client_credentials" and then also set the token headers to include
305305
* the Authorization header required by the OAuth2 provider.
306306
* @param {string} grantType The OAuth2 grant_type value.
307-
* @return {Service_} This service, for chaining.
307+
* @return {!Service_} This service, for chaining.
308308
*/
309309
Service_.prototype.setGrantType = function(grantType) {
310310
this.grantType_ = grantType;
@@ -316,7 +316,7 @@ Service_.prototype.setGrantType = function(grantType) {
316316
* library will provide this value automatically, but in some rare cases you may
317317
* need to override it.
318318
* @param {string} redirectUri The redirect URI.
319-
* @return {Service_} This service, for chaining.
319+
* @return {!Service_} This service, for chaining.
320320
*/
321321
Service_.prototype.setRedirectUri = function(redirectUri) {
322322
this.redirectUri_ = redirectUri;
@@ -518,7 +518,7 @@ Service_.prototype.fetchToken_ = function(payload, optUrl) {
518518
/**
519519
* Gets the token from a UrlFetchApp response.
520520
* @param {UrlFetchApp.HTTPResponse} response The response object.
521-
* @return {Object} The parsed token.
521+
* @return {!Object} The parsed token.
522522
* @throws If the token cannot be parsed or the response contained an error.
523523
* @private
524524
*/
@@ -545,7 +545,7 @@ Service_.prototype.getTokenFromResponse_ = function(response) {
545545
/**
546546
* Parses the token using the service's token format.
547547
* @param {string} content The serialized token content.
548-
* @return {Object} The parsed token.
548+
* @return {!Object} The parsed token.
549549
* @private
550550
*/
551551
Service_.prototype.parseToken_ = function(content) {

0 commit comments

Comments
 (0)