@@ -1304,11 +1304,67 @@ where
1304
1304
TT : TokenType ,
1305
1305
{
1306
1306
///
1307
- /// Extra fields defined by client application.
1307
+ /// Instantiate a new OAuth2 token response.
1308
+ ///
1309
+ pub fn new ( access_token : AccessToken , token_type : TT , extra_fields : EF ) -> Self {
1310
+ Self {
1311
+ access_token,
1312
+ token_type,
1313
+ expires_in : None ,
1314
+ refresh_token : None ,
1315
+ scopes : None ,
1316
+ extra_fields,
1317
+ }
1318
+ }
1319
+
1320
+ ///
1321
+ /// Set the `access_token` field.
1322
+ ///
1323
+ pub fn set_access_token ( & mut self , access_token : AccessToken ) {
1324
+ self . access_token = access_token;
1325
+ }
1326
+
1327
+ ///
1328
+ /// Set the `token_type` field.
1329
+ ///
1330
+ pub fn set_token_type ( & mut self , token_type : TT ) {
1331
+ self . token_type = token_type;
1332
+ }
1333
+
1334
+ ///
1335
+ /// Set the `expires_in` field.
1336
+ ///
1337
+ pub fn set_expires_in ( & mut self , expires_in : Option < u64 > ) {
1338
+ self . expires_in = expires_in;
1339
+ }
1340
+
1341
+ ///
1342
+ /// Set the `refresh_token` field.
1343
+ ///
1344
+ pub fn set_refresh_token ( & mut self , refresh_token : Option < RefreshToken > ) {
1345
+ self . refresh_token = refresh_token;
1346
+ }
1347
+
1348
+ ///
1349
+ /// Set the `scopes` field.
1350
+ ///
1351
+ pub fn set_scopes ( & mut self , scopes : Option < Vec < Scope > > ) {
1352
+ self . scopes = scopes;
1353
+ }
1354
+
1355
+ ///
1356
+ /// Extra fields defined by the client application.
1308
1357
///
1309
1358
pub fn extra_fields ( & self ) -> & EF {
1310
1359
& self . extra_fields
1311
1360
}
1361
+
1362
+ ///
1363
+ /// Set the extra fields defined by the client application.
1364
+ ///
1365
+ pub fn set_extra_fields ( & mut self , extra_fields : EF ) {
1366
+ self . extra_fields = extra_fields;
1367
+ }
1312
1368
}
1313
1369
1314
1370
impl < EF , TT > TokenResponse < TT > for StandardTokenResponse < EF , TT >
@@ -1392,6 +1448,30 @@ pub struct ErrorResponse<T: ErrorResponseType> {
1392
1448
}
1393
1449
1394
1450
impl < T : ErrorResponseType > ErrorResponse < T > {
1451
+ ///
1452
+ /// Instantiate a new `ErrorResponse`.
1453
+ ///
1454
+ /// # Arguments
1455
+ ///
1456
+ /// * `error` - REQUIRED. A single ASCII error code deserialized to the generic parameter.
1457
+ /// `ErrorResponseType`.
1458
+ /// * `error_description` - OPTIONAL. Human-readable ASCII text providing additional
1459
+ /// information, used to assist the client developer in understanding the error that
1460
+ /// occurred. Values for this parameter MUST NOT include characters outside the set
1461
+ /// `%x20-21 / %x23-5B / %x5D-7E`.
1462
+ /// * `error_uri` - OPTIONAL. A URI identifying a human-readable web page with information
1463
+ /// about the error used to provide the client developer with additional information about
1464
+ /// the error. Values for the "error_uri" parameter MUST conform to the URI-reference
1465
+ /// syntax and thus MUST NOT include characters outside the set `%x21 / %x23-5B / %x5D-7E`.
1466
+ ///
1467
+ pub fn new ( error : T , error_description : Option < String > , error_uri : Option < String > ) -> Self {
1468
+ Self {
1469
+ error,
1470
+ error_description,
1471
+ error_uri,
1472
+ }
1473
+ }
1474
+
1395
1475
///
1396
1476
/// REQUIRED. A single ASCII error code deserialized to the generic parameter
1397
1477
/// `ErrorResponseType`.
@@ -1401,14 +1481,17 @@ impl<T: ErrorResponseType> ErrorResponse<T> {
1401
1481
}
1402
1482
///
1403
1483
/// OPTIONAL. Human-readable ASCII text providing additional information, used to assist
1404
- /// the client developer in understanding the error that occurred.
1484
+ /// the client developer in understanding the error that occurred. Values for this
1485
+ /// parameter MUST NOT include characters outside the set `%x20-21 / %x23-5B / %x5D-7E`.
1405
1486
///
1406
1487
pub fn error_description ( & self ) -> Option < & String > {
1407
1488
self . error_description . as_ref ( )
1408
1489
}
1409
1490
///
1410
1491
/// OPTIONAL. A URI identifying a human-readable web page with information about the error,
1411
1492
/// used to provide the client developer with additional information about the error.
1493
+ /// Values for the "error_uri" parameter MUST conform to the URI-reference syntax and
1494
+ /// thus MUST NOT include characters outside the set `%x21 / %x23-5B / %x5D-7E`.
1412
1495
///
1413
1496
pub fn error_uri ( & self ) -> Option < & String > {
1414
1497
self . error_uri . as_ref ( )
0 commit comments