Skip to content

Commit acc50ac

Browse files
committed
Only grab the latest build in the Updater check
1 parent c21762f commit acc50ac

File tree

6 files changed

+111
-11
lines changed

6 files changed

+111
-11
lines changed

scripts/bash/update-apps-api

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ function StartMain {
164164

165165
Status "Generating Node Server"
166166
java -jar "$GeneratorJar" generate -i "$InputSpec" -l nodejs-server -o "$NodeRepo" --disable-examples --template-dir "$TemplateDir"
167+
npx swagger-typescript-api -p "$InputSpec" -o "$NodeRepo\models" --clean-output --no-client
167168

168169
Status "Done!"
169170
}

scripts/windows/update-apps-api.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ function Start-Main([string] $SwaggerGenerator,
160160

161161
Status "Generating Node Server"
162162
java -jar $GeneratorJar generate -i $InputSpec -l nodejs-server -o $NodeRepo "--disable-examples" "--template-dir" $TemplateDir
163+
npx swagger-typescript-api -p $InputSpec -o "$NodeRepo\models" --clean-output --no-client
163164

164165
Status "Done!"
165166
}

src/main/java/com/laytonsmith/core/Updater.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Date getDateFromString(String date) throws ParseException {
3030
}
3131

3232
public static BuildArtifact getLatestVersionInfo() throws ApiException, ParseException {
33-
List<BuildArtifact> versions = API.buildsArtifactGet(DEFAULT_UPDATE_CHANNEL);
33+
List<BuildArtifact> versions = API.buildsArtifactGet(DEFAULT_UPDATE_CHANNEL, true);
3434
BuildArtifact maxVersion = null;
3535
for(int i = 0; i < versions.size(); i++) {
3636
BuildArtifact version = versions.get(i);

src/main/java/io/swagger/client/api/BuildsApi.java

+15-9
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ public void setApiClient(ApiClient apiClient) {
5757
/**
5858
* Build call for buildsArtifactGet
5959
* @param artifact The artifact type to list builds for. (required)
60+
* @param latest (optional)
6061
* @param progressListener Progress listener
6162
* @param progressRequestListener Progress request listener
6263
* @return Call to execute
6364
* @throws ApiException If fail to serialize the request body object
6465
*/
65-
public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
66+
public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, Boolean latest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
6667
Object localVarPostBody = null;
6768

6869
// create path and map variables
@@ -71,6 +72,8 @@ public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, final Pro
7172

7273
List<Pair> localVarQueryParams = new ArrayList<Pair>();
7374
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
75+
if (latest != null)
76+
localVarQueryParams.addAll(apiClient.parameterToPair("latest", latest));
7477

7578
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
7679

@@ -105,13 +108,13 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch
105108
}
106109

107110
@SuppressWarnings("rawtypes")
108-
private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String artifact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
111+
private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String artifact, Boolean latest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
109112
// verify the required parameter 'artifact' is set
110113
if (artifact == null) {
111114
throw new ApiException("Missing the required parameter 'artifact' when calling buildsArtifactGet(Async)");
112115
}
113116

114-
com.squareup.okhttp.Call call = buildsArtifactGetCall(artifact, progressListener, progressRequestListener);
117+
com.squareup.okhttp.Call call = buildsArtifactGetCall(artifact, latest, progressListener, progressRequestListener);
115118
return call;
116119

117120

@@ -124,23 +127,25 @@ private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String arti
124127
* Provides a list of builds of the specified artifact available for download.
125128
* Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary.
126129
* @param artifact The artifact type to list builds for. (required)
130+
* @param latest (optional)
127131
* @return List&lt;BuildArtifact&gt;
128132
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
129133
*/
130-
public List<BuildArtifact> buildsArtifactGet(String artifact) throws ApiException {
131-
ApiResponse<List<BuildArtifact>> resp = buildsArtifactGetWithHttpInfo(artifact);
134+
public List<BuildArtifact> buildsArtifactGet(String artifact, Boolean latest) throws ApiException {
135+
ApiResponse<List<BuildArtifact>> resp = buildsArtifactGetWithHttpInfo(artifact, latest);
132136
return resp.getData();
133137
}
134138

135139
/**
136140
* Provides a list of builds of the specified artifact available for download.
137141
* Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary.
138142
* @param artifact The artifact type to list builds for. (required)
143+
* @param latest (optional)
139144
* @return ApiResponse&lt;List&lt;BuildArtifact&gt;&gt;
140145
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
141146
*/
142-
public ApiResponse<List<BuildArtifact>> buildsArtifactGetWithHttpInfo(String artifact) throws ApiException {
143-
com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, null, null);
147+
public ApiResponse<List<BuildArtifact>> buildsArtifactGetWithHttpInfo(String artifact, Boolean latest) throws ApiException {
148+
com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, latest, null, null);
144149
Type localVarReturnType = new TypeToken<List<BuildArtifact>>(){}.getType();
145150
return apiClient.execute(call, localVarReturnType);
146151
}
@@ -149,11 +154,12 @@ public ApiResponse<List<BuildArtifact>> buildsArtifactGetWithHttpInfo(String art
149154
* Provides a list of builds of the specified artifact available for download. (asynchronously)
150155
* Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary.
151156
* @param artifact The artifact type to list builds for. (required)
157+
* @param latest (optional)
152158
* @param callback The callback to be executed when the API call finishes
153159
* @return The request call
154160
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
155161
*/
156-
public com.squareup.okhttp.Call buildsArtifactGetAsync(String artifact, final ApiCallback<List<BuildArtifact>> callback) throws ApiException {
162+
public com.squareup.okhttp.Call buildsArtifactGetAsync(String artifact, Boolean latest, final ApiCallback<List<BuildArtifact>> callback) throws ApiException {
157163

158164
ProgressResponseBody.ProgressListener progressListener = null;
159165
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
@@ -174,7 +180,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
174180
};
175181
}
176182

177-
com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, progressListener, progressRequestListener);
183+
com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, latest, progressListener, progressRequestListener);
178184
Type localVarReturnType = new TypeToken<List<BuildArtifact>>(){}.getType();
179185
apiClient.executeAsync(call, localVarReturnType, callback);
180186
return call;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* MethodScript Apps
3+
* This is the api for the apps.methodscript.com server. This provides various public functionality for users of the MethodScript programming language.
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import com.google.gson.TypeAdapter;
18+
import com.google.gson.annotations.JsonAdapter;
19+
import com.google.gson.annotations.SerializedName;
20+
import com.google.gson.stream.JsonReader;
21+
import com.google.gson.stream.JsonWriter;
22+
import io.swagger.v3.oas.annotations.media.Schema;
23+
import java.io.IOException;
24+
/**
25+
* BuildsArtifactBody
26+
*/
27+
28+
29+
public class BuildsArtifactBody {
30+
@SerializedName("latest")
31+
private Boolean latest = null;
32+
33+
public BuildsArtifactBody latest(Boolean latest) {
34+
this.latest = latest;
35+
return this;
36+
}
37+
38+
/**
39+
* Get latest
40+
* @return latest
41+
**/
42+
@Schema(description = "")
43+
public Boolean isLatest() {
44+
return latest;
45+
}
46+
47+
public void setLatest(Boolean latest) {
48+
this.latest = latest;
49+
}
50+
51+
52+
@Override
53+
public boolean equals(java.lang.Object o) {
54+
if (this == o) {
55+
return true;
56+
}
57+
if (o == null || getClass() != o.getClass()) {
58+
return false;
59+
}
60+
BuildsArtifactBody buildsArtifactBody = (BuildsArtifactBody) o;
61+
return Objects.equals(this.latest, buildsArtifactBody.latest);
62+
}
63+
64+
@Override
65+
public int hashCode() {
66+
return Objects.hash(latest);
67+
}
68+
69+
70+
@Override
71+
public String toString() {
72+
StringBuilder sb = new StringBuilder();
73+
sb.append("class BuildsArtifactBody {\n");
74+
75+
sb.append(" latest: ").append(toIndentedString(latest)).append("\n");
76+
sb.append("}");
77+
return sb.toString();
78+
}
79+
80+
/**
81+
* Convert the given object to string with each line indented by 4 spaces
82+
* (except the first line).
83+
*/
84+
private String toIndentedString(java.lang.Object o) {
85+
if (o == null) {
86+
return "null";
87+
}
88+
return o.toString().replace("\n", "\n ");
89+
}
90+
91+
}

src/main/resources/apps.methodscript.com/main.tsp

+2-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ interface builds {
226226
@operationId("buildsArtifactGet")
227227
@get buildsArtifact(
228228
@doc("The artifact type to list builds for.")
229-
artifact: string
229+
artifact: string,
230+
@query latest?: boolean,
230231
) : Array<BuildArtifact> | Build404;
231232

232233
@summary("Downloads a specific build of the specified artifact type.")

0 commit comments

Comments
 (0)