Skip to content

Commit de3a727

Browse files
committed
0.0.9 - File upload fixes
1 parent 48b9ae5 commit de3a727

File tree

11 files changed

+64
-32
lines changed

11 files changed

+64
-32
lines changed

client/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Add this dependency to your project's POM:
4040
<dependency>
4141
<groupId>com.fastcomments</groupId>
4242
<artifactId>client</artifactId>
43-
<version>0.0.8</version>
43+
<version>0.0.9</version>
4444
<scope>compile</scope>
4545
</dependency>
4646
```
@@ -56,7 +56,7 @@ Add this dependency to your project's build file:
5656
}
5757
5858
dependencies {
59-
implementation "com.fastcomments:client:0.0.8"
59+
implementation "com.fastcomments:client:0.0.9"
6060
}
6161
```
6262

@@ -70,7 +70,7 @@ mvn clean package
7070

7171
Then manually install the following JARs:
7272

73-
* `target/client-0.0.8.jar`
73+
* `target/client-0.0.9.jar`
7474
* `target/lib/*.jar`
7575

7676
## Getting Started

client/api/openapi.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ paths:
457457
description: Upload and resize an image
458458
operationId: UploadImage
459459
parameters:
460-
- description: Tenant ID
461-
explode: false
460+
- explode: false
462461
in: path
463462
name: tenantId
464463
required: true
@@ -482,6 +481,12 @@ paths:
482481
schema:
483482
type: string
484483
style: form
484+
requestBody:
485+
content:
486+
multipart/form-data:
487+
schema:
488+
$ref: '#/components/schemas/UploadImage_request'
489+
required: true
485490
responses:
486491
"200":
487492
content:
@@ -492,6 +497,7 @@ paths:
492497
security: []
493498
tags:
494499
- Public
500+
x-content-type: multipart/form-data
495501
x-accepts:
496502
- application/json
497503
/flag-comment/{commentId}:
@@ -7871,6 +7877,14 @@ components:
78717877
- $ref: '#/components/schemas/UserNotificationWriteResponse'
78727878
- $ref: '#/components/schemas/IgnoredResponse'
78737879
- $ref: '#/components/schemas/APIError'
7880+
UploadImage_request:
7881+
properties:
7882+
file:
7883+
format: binary
7884+
type: string
7885+
required:
7886+
- file
7887+
type: object
78747888
FlagCommentPublic_200_response:
78757889
anyOf:
78767890
- $ref: '#/components/schemas/APIEmptyResponse'

client/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'java'
44
apply plugin: 'com.diffplug.spotless'
55

66
group = 'com.fastcomments'
7-
version = '0.0.8'
7+
version = '0.0.9'
88

99
buildscript {
1010
repositories {

client/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.fastcomments",
44
name := "client",
5-
version := "0.0.8",
5+
version := "0.0.9",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

client/docs/PublicApi.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ No authorization required
21532153

21542154
<a id="uploadImage"></a>
21552155
# **uploadImage**
2156-
> UploadImageResponse uploadImage(tenantId).sizePreset(sizePreset).urlId(urlId).execute();
2156+
> UploadImageResponse uploadImage(tenantId, _file).sizePreset(sizePreset).urlId(urlId).execute();
21572157
21582158

21592159

@@ -2174,11 +2174,12 @@ public class Example {
21742174
defaultClient.setBasePath("http://localhost");
21752175

21762176
PublicApi apiInstance = new PublicApi(defaultClient);
2177-
String tenantId = "tenantId_example"; // String | Tenant ID
2177+
String tenantId = "tenantId_example"; // String |
2178+
File _file = new File("/path/to/file"); // File |
21782179
SizePreset sizePreset = SizePreset.fromValue("Default"); // SizePreset | Size preset: \"Default\" (1000x1000px) or \"CrossPlatform\" (creates sizes for popular devices)
21792180
String urlId = "urlId_example"; // String | Page id that upload is happening from, to configure
21802181
try {
2181-
UploadImageResponse result = apiInstance.uploadImage(tenantId)
2182+
UploadImageResponse result = apiInstance.uploadImage(tenantId, _file)
21822183
.sizePreset(sizePreset)
21832184
.urlId(urlId)
21842185
.execute();
@@ -2198,7 +2199,8 @@ public class Example {
21982199

21992200
| Name | Type | Description | Notes |
22002201
|------------- | ------------- | ------------- | -------------|
2201-
| **tenantId** | **String**| Tenant ID | |
2202+
| **tenantId** | **String**| | |
2203+
| **_file** | **File**| | |
22022204
| **sizePreset** | [**SizePreset**](.md)| Size preset: \&quot;Default\&quot; (1000x1000px) or \&quot;CrossPlatform\&quot; (creates sizes for popular devices) | [optional] [enum: Default, CrossPlatform] |
22032205
| **urlId** | **String**| Page id that upload is happening from, to configure | [optional] |
22042206

@@ -2212,7 +2214,7 @@ No authorization required
22122214

22132215
### HTTP request headers
22142216

2215-
- **Content-Type**: Not defined
2217+
- **Content-Type**: multipart/form-data
22162218
- **Accept**: application/json
22172219

22182220
### HTTP response details

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>client</artifactId>
66
<packaging>jar</packaging>
77
<name>client</name>
8-
<version>0.0.8</version>
8+
<version>0.0.9</version>
99
<url>https://fastcomments.com</url>
1010
<description>FastComments API Client - A SDK for interacting with the FastComments API</description>
1111
<scm>

client/src/main/java/com/fastcomments/api/PublicApi.java

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.fastcomments.model.CreateFeedPostPublic200Response;
3838
import com.fastcomments.model.DeleteCommentPublic200Response;
3939
import com.fastcomments.model.DeleteCommentVote200Response;
40+
import java.io.File;
4041
import com.fastcomments.model.FlagCommentPublic200Response;
4142
import com.fastcomments.model.GetCommentText200Response;
4243
import com.fastcomments.model.GetCommentVoteUserNames200Response;
@@ -6385,7 +6386,7 @@ public okhttp3.Call executeAsync(final ApiCallback<UpdateUserNotificationStatus2
63856386
public APIupdateUserNotificationStatusRequest updateUserNotificationStatus(String tenantId, String notificationId, String newStatus) {
63866387
return new APIupdateUserNotificationStatusRequest(tenantId, notificationId, newStatus);
63876388
}
6388-
private okhttp3.Call uploadImageCall(String tenantId, SizePreset sizePreset, String urlId, final ApiCallback _callback) throws ApiException {
6389+
private okhttp3.Call uploadImageCall(String tenantId, File _file, SizePreset sizePreset, String urlId, final ApiCallback _callback) throws ApiException {
63896390
String basePath = null;
63906391
// Operation Servers
63916392
String[] localBasePaths = new String[] { };
@@ -6411,6 +6412,10 @@ private okhttp3.Call uploadImageCall(String tenantId, SizePreset sizePreset, Str
64116412
Map<String, String> localVarCookieParams = new HashMap<String, String>();
64126413
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
64136414

6415+
if (_file != null) {
6416+
localVarFormParams.put("file", _file);
6417+
}
6418+
64146419
if (sizePreset != null) {
64156420
localVarQueryParams.addAll(localVarApiClient.parameterToPair("sizePreset", sizePreset));
64166421
}
@@ -6428,6 +6433,7 @@ private okhttp3.Call uploadImageCall(String tenantId, SizePreset sizePreset, Str
64286433
}
64296434

64306435
final String[] localVarContentTypes = {
6436+
"multipart/form-data"
64316437
};
64326438
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
64336439
if (localVarContentType != null) {
@@ -6439,38 +6445,45 @@ private okhttp3.Call uploadImageCall(String tenantId, SizePreset sizePreset, Str
64396445
}
64406446

64416447
@SuppressWarnings("rawtypes")
6442-
private okhttp3.Call uploadImageValidateBeforeCall(String tenantId, SizePreset sizePreset, String urlId, final ApiCallback _callback) throws ApiException {
6448+
private okhttp3.Call uploadImageValidateBeforeCall(String tenantId, File _file, SizePreset sizePreset, String urlId, final ApiCallback _callback) throws ApiException {
64436449
// verify the required parameter 'tenantId' is set
64446450
if (tenantId == null) {
64456451
throw new ApiException("Missing the required parameter 'tenantId' when calling uploadImage(Async)");
64466452
}
64476453

6448-
return uploadImageCall(tenantId, sizePreset, urlId, _callback);
6454+
// verify the required parameter '_file' is set
6455+
if (_file == null) {
6456+
throw new ApiException("Missing the required parameter '_file' when calling uploadImage(Async)");
6457+
}
6458+
6459+
return uploadImageCall(tenantId, _file, sizePreset, urlId, _callback);
64496460

64506461
}
64516462

64526463

6453-
private ApiResponse<UploadImageResponse> uploadImageWithHttpInfo(String tenantId, SizePreset sizePreset, String urlId) throws ApiException {
6454-
okhttp3.Call localVarCall = uploadImageValidateBeforeCall(tenantId, sizePreset, urlId, null);
6464+
private ApiResponse<UploadImageResponse> uploadImageWithHttpInfo(String tenantId, File _file, SizePreset sizePreset, String urlId) throws ApiException {
6465+
okhttp3.Call localVarCall = uploadImageValidateBeforeCall(tenantId, _file, sizePreset, urlId, null);
64556466
Type localVarReturnType = new TypeToken<UploadImageResponse>(){}.getType();
64566467
return localVarApiClient.execute(localVarCall, localVarReturnType);
64576468
}
64586469

6459-
private okhttp3.Call uploadImageAsync(String tenantId, SizePreset sizePreset, String urlId, final ApiCallback<UploadImageResponse> _callback) throws ApiException {
6470+
private okhttp3.Call uploadImageAsync(String tenantId, File _file, SizePreset sizePreset, String urlId, final ApiCallback<UploadImageResponse> _callback) throws ApiException {
64606471

6461-
okhttp3.Call localVarCall = uploadImageValidateBeforeCall(tenantId, sizePreset, urlId, _callback);
6472+
okhttp3.Call localVarCall = uploadImageValidateBeforeCall(tenantId, _file, sizePreset, urlId, _callback);
64626473
Type localVarReturnType = new TypeToken<UploadImageResponse>(){}.getType();
64636474
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
64646475
return localVarCall;
64656476
}
64666477

64676478
public class APIuploadImageRequest {
64686479
private final String tenantId;
6480+
private final File _file;
64696481
private SizePreset sizePreset;
64706482
private String urlId;
64716483

6472-
private APIuploadImageRequest(String tenantId) {
6484+
private APIuploadImageRequest(String tenantId, File _file) {
64736485
this.tenantId = tenantId;
6486+
this._file = _file;
64746487
}
64756488

64766489
/**
@@ -6506,7 +6519,7 @@ public APIuploadImageRequest urlId(String urlId) {
65066519
</table>
65076520
*/
65086521
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
6509-
return uploadImageCall(tenantId, sizePreset, urlId, _callback);
6522+
return uploadImageCall(tenantId, _file, sizePreset, urlId, _callback);
65106523
}
65116524

65126525
/**
@@ -6521,7 +6534,7 @@ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
65216534
</table>
65226535
*/
65236536
public UploadImageResponse execute() throws ApiException {
6524-
ApiResponse<UploadImageResponse> localVarResp = uploadImageWithHttpInfo(tenantId, sizePreset, urlId);
6537+
ApiResponse<UploadImageResponse> localVarResp = uploadImageWithHttpInfo(tenantId, _file, sizePreset, urlId);
65256538
return localVarResp.getData();
65266539
}
65276540

@@ -6537,7 +6550,7 @@ public UploadImageResponse execute() throws ApiException {
65376550
</table>
65386551
*/
65396552
public ApiResponse<UploadImageResponse> executeWithHttpInfo() throws ApiException {
6540-
return uploadImageWithHttpInfo(tenantId, sizePreset, urlId);
6553+
return uploadImageWithHttpInfo(tenantId, _file, sizePreset, urlId);
65416554
}
65426555

65436556
/**
@@ -6553,14 +6566,15 @@ public ApiResponse<UploadImageResponse> executeWithHttpInfo() throws ApiExceptio
65536566
</table>
65546567
*/
65556568
public okhttp3.Call executeAsync(final ApiCallback<UploadImageResponse> _callback) throws ApiException {
6556-
return uploadImageAsync(tenantId, sizePreset, urlId, _callback);
6569+
return uploadImageAsync(tenantId, _file, sizePreset, urlId, _callback);
65576570
}
65586571
}
65596572

65606573
/**
65616574
*
65626575
* Upload and resize an image
6563-
* @param tenantId Tenant ID (required)
6576+
* @param tenantId (required)
6577+
* @param _file (required)
65646578
* @return APIuploadImageRequest
65656579
* @http.response.details
65666580
<table border="1">
@@ -6569,8 +6583,8 @@ public okhttp3.Call executeAsync(final ApiCallback<UploadImageResponse> _callbac
65696583
<tr><td> 200 </td><td> Ok </td><td> - </td></tr>
65706584
</table>
65716585
*/
6572-
public APIuploadImageRequest uploadImage(String tenantId) {
6573-
return new APIuploadImageRequest(tenantId);
6586+
public APIuploadImageRequest uploadImage(String tenantId, File _file) {
6587+
return new APIuploadImageRequest(tenantId, _file);
65746588
}
65756589
private okhttp3.Call voteCommentCall(String tenantId, String commentId, String urlId, String broadcastId, VoteBodyParams voteBodyParams, String sessionId, String sso, final ApiCallback _callback) throws ApiException {
65766590
String basePath = null;

client/src/main/java/com/fastcomments/invoker/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void init() {
141141
json = new JSON();
142142

143143
// Set default User-Agent.
144-
setUserAgent("OpenAPI-Generator/0.0.8/java");
144+
setUserAgent("OpenAPI-Generator/0.0.9/java");
145145

146146
authentications = new HashMap<String, Authentication>();
147147
}

client/src/main/java/com/fastcomments/invoker/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0")
1717
public class Configuration {
18-
public static final String VERSION = "0.0.8";
18+
public static final String VERSION = "0.0.9";
1919

2020
private static ApiClient defaultApiClient = new ApiClient();
2121

client/src/test/java/com/fastcomments/api/PublicApiTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.fastcomments.model.CreateFeedPostPublic200Response;
2525
import com.fastcomments.model.DeleteCommentPublic200Response;
2626
import com.fastcomments.model.DeleteCommentVote200Response;
27+
import java.io.File;
2728
import com.fastcomments.model.FlagCommentPublic200Response;
2829
import com.fastcomments.model.GetCommentText200Response;
2930
import com.fastcomments.model.GetCommentVoteUserNames200Response;
@@ -606,9 +607,10 @@ public void updateUserNotificationStatusTest() throws ApiException {
606607
@Test
607608
public void uploadImageTest() throws ApiException {
608609
String tenantId = null;
610+
File _file = null;
609611
SizePreset sizePreset = null;
610612
String urlId = null;
611-
UploadImageResponse response = api.uploadImage(tenantId)
613+
UploadImageResponse response = api.uploadImage(tenantId, _file)
612614
.sizePreset(sizePreset)
613615
.urlId(urlId)
614616
.execute();

0 commit comments

Comments
 (0)