Skip to content

Commit dcfe46c

Browse files
committed
Fix token swagger
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 204c668 commit dcfe46c

File tree

4 files changed

+21
-28
lines changed

4 files changed

+21
-28
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# swagger-java-client
1+
# java-gitea-api
22

33
Gitea API.
44
- API version: 1.14.0&amp;#43;dev-803-gf1da46622
@@ -37,9 +37,9 @@ Add this dependency to your project's POM:
3737

3838
```xml
3939
<dependency>
40-
<groupId>io.swagger</groupId>
41-
<artifactId>swagger-java-client</artifactId>
42-
<version>1.0.0</version>
40+
<groupId>io.gitea</groupId>
41+
<artifactId>java-gitea-api</artifactId>
42+
<version>1.14.0-SNAPSHOT</version>
4343
<scope>compile</scope>
4444
</dependency>
4545
```

docs/UserApi.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ Name | Type | Description | Notes
407407

408408
<a name="userCreateToken"></a>
409409
# **userCreateToken**
410-
> userCreateToken(username, accessToken)
410+
> AccessToken userCreateToken(username, accessToken)
411411
412412
Create an access token
413413

@@ -467,7 +467,8 @@ UserApi apiInstance = new UserApi();
467467
String username = "username_example"; // String | username of user
468468
AccessToken accessToken = new AccessToken(); // AccessToken |
469469
try {
470-
apiInstance.userCreateToken(username, accessToken);
470+
AccessToken result = apiInstance.userCreateToken(username, accessToken);
471+
System.out.println(result);
471472
} catch (ApiException e) {
472473
System.err.println("Exception when calling UserApi#userCreateToken");
473474
e.printStackTrace();
@@ -483,7 +484,7 @@ Name | Type | Description | Notes
483484

484485
### Return type
485486

486-
null (empty response body)
487+
[**AccessToken**](AccessToken.md)
487488

488489
### Authorization
489490

src/main/java/io/gitea/api/UserApi.java

+11-7
Original file line numberDiff line numberDiff line change
@@ -627,23 +627,26 @@ private com.squareup.okhttp.Call userCreateTokenValidateBeforeCall(String userna
627627
*
628628
* @param username username of user (required)
629629
* @param accessToken (optional)
630+
* @return AccessToken
630631
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
631632
*/
632-
public void userCreateToken(String username, AccessToken accessToken) throws ApiException {
633-
userCreateTokenWithHttpInfo(username, accessToken);
633+
public AccessToken userCreateToken(String username, AccessToken accessToken) throws ApiException {
634+
ApiResponse<AccessToken> resp = userCreateTokenWithHttpInfo(username, accessToken);
635+
return resp.getData();
634636
}
635637

636638
/**
637639
* Create an access token
638640
*
639641
* @param username username of user (required)
640642
* @param accessToken (optional)
641-
* @return ApiResponse&lt;Void&gt;
643+
* @return ApiResponse&lt;AccessToken&gt;
642644
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
643645
*/
644-
public ApiResponse<Void> userCreateTokenWithHttpInfo(String username, AccessToken accessToken) throws ApiException {
646+
public ApiResponse<AccessToken> userCreateTokenWithHttpInfo(String username, AccessToken accessToken) throws ApiException {
645647
com.squareup.okhttp.Call call = userCreateTokenValidateBeforeCall(username, accessToken, null, null);
646-
return apiClient.execute(call);
648+
Type localVarReturnType = new TypeToken<AccessToken>(){}.getType();
649+
return apiClient.execute(call, localVarReturnType);
647650
}
648651

649652
/**
@@ -655,7 +658,7 @@ public ApiResponse<Void> userCreateTokenWithHttpInfo(String username, AccessToke
655658
* @return The request call
656659
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
657660
*/
658-
public com.squareup.okhttp.Call userCreateTokenAsync(String username, AccessToken accessToken, final ApiCallback<Void> callback) throws ApiException {
661+
public com.squareup.okhttp.Call userCreateTokenAsync(String username, AccessToken accessToken, final ApiCallback<AccessToken> callback) throws ApiException {
659662

660663
ProgressResponseBody.ProgressListener progressListener = null;
661664
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
@@ -677,7 +680,8 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
677680
}
678681

679682
com.squareup.okhttp.Call call = userCreateTokenValidateBeforeCall(username, accessToken, progressListener, progressRequestListener);
680-
apiClient.executeAsync(call, callback);
683+
Type localVarReturnType = new TypeToken<AccessToken>(){}.getType();
684+
apiClient.executeAsync(call, localVarReturnType, callback);
681685
return call;
682686
}
683687
/**

swagger.v1.json

+2-14
Original file line numberDiff line numberDiff line change
@@ -16298,20 +16298,8 @@
1629816298
"responses": {
1629916299
"AccessToken": {
1630016300
"description": "AccessToken represents an API access token.",
16301-
"headers": {
16302-
"id": {
16303-
"type": "integer",
16304-
"format": "int64"
16305-
},
16306-
"name": {
16307-
"type": "string"
16308-
},
16309-
"sha1": {
16310-
"type": "string"
16311-
},
16312-
"token_last_eight": {
16313-
"type": "string"
16314-
}
16301+
"schema": {
16302+
"$ref": "#/definitions/AccessToken"
1631516303
}
1631616304
},
1631716305
"AccessTokenList": {

0 commit comments

Comments
 (0)