diff --git a/scripts/bash/update-apps-api b/scripts/bash/update-apps-api index c3be5b875..2a602c601 100644 --- a/scripts/bash/update-apps-api +++ b/scripts/bash/update-apps-api @@ -164,6 +164,7 @@ function StartMain { Status "Generating Node Server" java -jar "$GeneratorJar" generate -i "$InputSpec" -l nodejs-server -o "$NodeRepo" --disable-examples --template-dir "$TemplateDir" + npx swagger-typescript-api -p "$InputSpec" -o "$NodeRepo\models" --clean-output --no-client Status "Done!" } diff --git a/scripts/windows/update-apps-api.ps1 b/scripts/windows/update-apps-api.ps1 index 07a53a0a9..e4a1f247f 100644 --- a/scripts/windows/update-apps-api.ps1 +++ b/scripts/windows/update-apps-api.ps1 @@ -160,6 +160,7 @@ function Start-Main([string] $SwaggerGenerator, Status "Generating Node Server" java -jar $GeneratorJar generate -i $InputSpec -l nodejs-server -o $NodeRepo "--disable-examples" "--template-dir" $TemplateDir + npx swagger-typescript-api -p $InputSpec -o "$NodeRepo\models" --clean-output --no-client Status "Done!" } diff --git a/src/main/java/com/laytonsmith/core/Updater.java b/src/main/java/com/laytonsmith/core/Updater.java index a0ced6a36..a4f07111d 100644 --- a/src/main/java/com/laytonsmith/core/Updater.java +++ b/src/main/java/com/laytonsmith/core/Updater.java @@ -30,7 +30,7 @@ public static Date getDateFromString(String date) throws ParseException { } public static BuildArtifact getLatestVersionInfo() throws ApiException, ParseException { - List versions = API.buildsArtifactGet(DEFAULT_UPDATE_CHANNEL); + List versions = API.buildsArtifactGet(DEFAULT_UPDATE_CHANNEL, true); BuildArtifact maxVersion = null; for(int i = 0; i < versions.size(); i++) { BuildArtifact version = versions.get(i); diff --git a/src/main/java/io/swagger/client/api/BuildsApi.java b/src/main/java/io/swagger/client/api/BuildsApi.java index 38bba7f2c..29b3e5df7 100644 --- a/src/main/java/io/swagger/client/api/BuildsApi.java +++ b/src/main/java/io/swagger/client/api/BuildsApi.java @@ -57,12 +57,13 @@ public void setApiClient(ApiClient apiClient) { /** * Build call for buildsArtifactGet * @param artifact The artifact type to list builds for. (required) + * @param latest (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, Boolean latest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables @@ -71,6 +72,8 @@ public com.squareup.okhttp.Call buildsArtifactGetCall(String artifact, final Pro List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + if (latest != null) + localVarQueryParams.addAll(apiClient.parameterToPair("latest", latest)); Map localVarHeaderParams = new HashMap(); @@ -105,13 +108,13 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String artifact, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String artifact, Boolean latest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'artifact' is set if (artifact == null) { throw new ApiException("Missing the required parameter 'artifact' when calling buildsArtifactGet(Async)"); } - com.squareup.okhttp.Call call = buildsArtifactGetCall(artifact, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = buildsArtifactGetCall(artifact, latest, progressListener, progressRequestListener); return call; @@ -124,11 +127,12 @@ private com.squareup.okhttp.Call buildsArtifactGetValidateBeforeCall(String arti * Provides a list of builds of the specified artifact available for download. * Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary. * @param artifact The artifact type to list builds for. (required) + * @param latest (optional) * @return List<BuildArtifact> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public List buildsArtifactGet(String artifact) throws ApiException { - ApiResponse> resp = buildsArtifactGetWithHttpInfo(artifact); + public List buildsArtifactGet(String artifact, Boolean latest) throws ApiException { + ApiResponse> resp = buildsArtifactGetWithHttpInfo(artifact, latest); return resp.getData(); } @@ -136,11 +140,12 @@ public List buildsArtifactGet(String artifact) throws ApiExceptio * Provides a list of builds of the specified artifact available for download. * Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary. * @param artifact The artifact type to list builds for. (required) + * @param latest (optional) * @return ApiResponse<List<BuildArtifact>> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse> buildsArtifactGetWithHttpInfo(String artifact) throws ApiException { - com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, null, null); + public ApiResponse> buildsArtifactGetWithHttpInfo(String artifact, Boolean latest) throws ApiException { + com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, latest, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -149,11 +154,12 @@ public ApiResponse> buildsArtifactGetWithHttpInfo(String art * Provides a list of builds of the specified artifact available for download. (asynchronously) * Provides a list of builds of the specified artifact available for download. Note that the order of the returned artifacts is arbitrary. * @param artifact The artifact type to list builds for. (required) + * @param latest (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call buildsArtifactGetAsync(String artifact, final ApiCallback> callback) throws ApiException { + public com.squareup.okhttp.Call buildsArtifactGetAsync(String artifact, Boolean latest, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -174,7 +180,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don }; } - com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = buildsArtifactGetValidateBeforeCall(artifact, latest, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/src/main/java/io/swagger/client/model/BuildsArtifactBody.java b/src/main/java/io/swagger/client/model/BuildsArtifactBody.java new file mode 100644 index 000000000..aa431cf28 --- /dev/null +++ b/src/main/java/io/swagger/client/model/BuildsArtifactBody.java @@ -0,0 +1,91 @@ +/* + * MethodScript Apps + * This is the api for the apps.methodscript.com server. This provides various public functionality for users of the MethodScript programming language. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * BuildsArtifactBody + */ + + +public class BuildsArtifactBody { + @SerializedName("latest") + private Boolean latest = null; + + public BuildsArtifactBody latest(Boolean latest) { + this.latest = latest; + return this; + } + + /** + * Get latest + * @return latest + **/ + @Schema(description = "") + public Boolean isLatest() { + return latest; + } + + public void setLatest(Boolean latest) { + this.latest = latest; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuildsArtifactBody buildsArtifactBody = (BuildsArtifactBody) o; + return Objects.equals(this.latest, buildsArtifactBody.latest); + } + + @Override + public int hashCode() { + return Objects.hash(latest); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuildsArtifactBody {\n"); + + sb.append(" latest: ").append(toIndentedString(latest)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/resources/apps.methodscript.com/main.tsp b/src/main/resources/apps.methodscript.com/main.tsp index a3a1dd5cf..31f23243e 100644 --- a/src/main/resources/apps.methodscript.com/main.tsp +++ b/src/main/resources/apps.methodscript.com/main.tsp @@ -226,7 +226,8 @@ interface builds { @operationId("buildsArtifactGet") @get buildsArtifact( @doc("The artifact type to list builds for.") - artifact: string + artifact: string, + @query latest?: boolean, ) : Array | Build404; @summary("Downloads a specific build of the specified artifact type.")