27
27
import java .io .IOException ;
28
28
29
29
30
+ import io .gitea .model .AccessToken ;
31
+ import io .gitea .model .AccessTokenName ;
30
32
import io .gitea .model .CreateEmailOption ;
31
33
import io .gitea .model .CreateGPGKeyOption ;
32
34
import io .gitea .model .CreateKeyOption ;
@@ -431,13 +433,14 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
431
433
/**
432
434
* Build call for userCreateToken
433
435
* @param username username of user (required)
436
+ * @param accessTokenName (optional)
434
437
* @param progressListener Progress listener
435
438
* @param progressRequestListener Progress request listener
436
439
* @return Call to execute
437
440
* @throws ApiException If fail to serialize the request body object
438
441
*/
439
- public com .squareup .okhttp .Call userCreateTokenCall (String username , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
440
- Object localVarPostBody = null ;
442
+ public com .squareup .okhttp .Call userCreateTokenCall (String username , AccessTokenName accessTokenName , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
443
+ Object localVarPostBody = accessTokenName ;
441
444
442
445
// create path and map variables
443
446
String localVarPath = "/users/{username}/tokens"
@@ -479,15 +482,15 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch
479
482
}
480
483
481
484
@ SuppressWarnings ("rawtypes" )
482
- private com .squareup .okhttp .Call userCreateTokenValidateBeforeCall (String username , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
485
+ private com .squareup .okhttp .Call userCreateTokenValidateBeforeCall (String username , AccessTokenName accessTokenName , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
483
486
484
487
// verify the required parameter 'username' is set
485
488
if (username == null ) {
486
489
throw new ApiException ("Missing the required parameter 'username' when calling userCreateToken(Async)" );
487
490
}
488
491
489
492
490
- com .squareup .okhttp .Call call = userCreateTokenCall (username , progressListener , progressRequestListener );
493
+ com .squareup .okhttp .Call call = userCreateTokenCall (username , accessTokenName , progressListener , progressRequestListener );
491
494
return call ;
492
495
493
496
}
@@ -496,33 +499,39 @@ private com.squareup.okhttp.Call userCreateTokenValidateBeforeCall(String userna
496
499
* Create an access token
497
500
*
498
501
* @param username username of user (required)
502
+ * @param accessTokenName (optional)
503
+ * @return AccessToken
499
504
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
500
505
*/
501
- public void userCreateToken (String username ) throws ApiException {
502
- userCreateTokenWithHttpInfo (username );
506
+ public AccessToken userCreateToken (String username , AccessTokenName accessTokenName ) throws ApiException {
507
+ ApiResponse <AccessToken > resp = userCreateTokenWithHttpInfo (username , accessTokenName );
508
+ return resp .getData ();
503
509
}
504
510
505
511
/**
506
512
* Create an access token
507
513
*
508
514
* @param username username of user (required)
509
- * @return ApiResponse<Void>
515
+ * @param accessTokenName (optional)
516
+ * @return ApiResponse<AccessToken>
510
517
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
511
518
*/
512
- public ApiResponse <Void > userCreateTokenWithHttpInfo (String username ) throws ApiException {
513
- com .squareup .okhttp .Call call = userCreateTokenValidateBeforeCall (username , null , null );
514
- return apiClient .execute (call );
519
+ public ApiResponse <AccessToken > userCreateTokenWithHttpInfo (String username , AccessTokenName accessTokenName ) throws ApiException {
520
+ com .squareup .okhttp .Call call = userCreateTokenValidateBeforeCall (username , accessTokenName , null , null );
521
+ Type localVarReturnType = new TypeToken <AccessToken >(){}.getType ();
522
+ return apiClient .execute (call , localVarReturnType );
515
523
}
516
524
517
525
/**
518
526
* Create an access token (asynchronously)
519
527
*
520
528
* @param username username of user (required)
529
+ * @param accessTokenName (optional)
521
530
* @param callback The callback to be executed when the API call finishes
522
531
* @return The request call
523
532
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
524
533
*/
525
- public com .squareup .okhttp .Call userCreateTokenAsync (String username , final ApiCallback <Void > callback ) throws ApiException {
534
+ public com .squareup .okhttp .Call userCreateTokenAsync (String username , AccessTokenName accessTokenName , final ApiCallback <AccessToken > callback ) throws ApiException {
526
535
527
536
ProgressResponseBody .ProgressListener progressListener = null ;
528
537
ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
@@ -543,8 +552,9 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
543
552
};
544
553
}
545
554
546
- com .squareup .okhttp .Call call = userCreateTokenValidateBeforeCall (username , progressListener , progressRequestListener );
547
- apiClient .executeAsync (call , callback );
555
+ com .squareup .okhttp .Call call = userCreateTokenValidateBeforeCall (username , accessTokenName , progressListener , progressRequestListener );
556
+ Type localVarReturnType = new TypeToken <AccessToken >(){}.getType ();
557
+ apiClient .executeAsync (call , localVarReturnType , callback );
548
558
return call ;
549
559
}
550
560
/**
@@ -3459,22 +3469,25 @@ private com.squareup.okhttp.Call userGetTokensValidateBeforeCall(String username
3459
3469
* List the authenticated user's access tokens
3460
3470
*
3461
3471
* @param username username of user (required)
3472
+ * @return List<AccessToken>
3462
3473
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
3463
3474
*/
3464
- public void userGetTokens (String username ) throws ApiException {
3465
- userGetTokensWithHttpInfo (username );
3475
+ public List <AccessToken > userGetTokens (String username ) throws ApiException {
3476
+ ApiResponse <List <AccessToken >> resp = userGetTokensWithHttpInfo (username );
3477
+ return resp .getData ();
3466
3478
}
3467
3479
3468
3480
/**
3469
3481
* List the authenticated user's access tokens
3470
3482
*
3471
3483
* @param username username of user (required)
3472
- * @return ApiResponse<Void >
3484
+ * @return ApiResponse<List<AccessToken> >
3473
3485
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
3474
3486
*/
3475
- public ApiResponse <Void > userGetTokensWithHttpInfo (String username ) throws ApiException {
3487
+ public ApiResponse <List < AccessToken > > userGetTokensWithHttpInfo (String username ) throws ApiException {
3476
3488
com .squareup .okhttp .Call call = userGetTokensValidateBeforeCall (username , null , null );
3477
- return apiClient .execute (call );
3489
+ Type localVarReturnType = new TypeToken <List <AccessToken >>(){}.getType ();
3490
+ return apiClient .execute (call , localVarReturnType );
3478
3491
}
3479
3492
3480
3493
/**
@@ -3485,7 +3498,7 @@ public ApiResponse<Void> userGetTokensWithHttpInfo(String username) throws ApiEx
3485
3498
* @return The request call
3486
3499
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
3487
3500
*/
3488
- public com .squareup .okhttp .Call userGetTokensAsync (String username , final ApiCallback <Void > callback ) throws ApiException {
3501
+ public com .squareup .okhttp .Call userGetTokensAsync (String username , final ApiCallback <List < AccessToken > > callback ) throws ApiException {
3489
3502
3490
3503
ProgressResponseBody .ProgressListener progressListener = null ;
3491
3504
ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
@@ -3507,7 +3520,8 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
3507
3520
}
3508
3521
3509
3522
com .squareup .okhttp .Call call = userGetTokensValidateBeforeCall (username , progressListener , progressRequestListener );
3510
- apiClient .executeAsync (call , callback );
3523
+ Type localVarReturnType = new TypeToken <List <AccessToken >>(){}.getType ();
3524
+ apiClient .executeAsync (call , localVarReturnType , callback );
3511
3525
return call ;
3512
3526
}
3513
3527
/**
0 commit comments